private _buildCommands()

in desktop/src/app/components/pool/action/pool-commands.ts [54:137]


    private _buildCommands() {
        this.addJob = this.simpleCommand({
            name: "add",
            ...COMMAND_LABEL_ICON.AddJob,
            action: (pool) => this._addJob(pool),
            multiple: false,
            confirm: false,
            notify: false,
            permission: Permission.Write,
        });

        this.resize = this.simpleCommand({
            name: "resize",
            label: this.i18n.t("pool-commands.resize"),
            icon: "fa fa-arrows-v",
            action: (pool) => this._resizePool(pool),
            visible: (pool) => pool.allocationState !== PoolAllocationState.resizing,
            multiple: false,
            confirm: false,
            notify: false,
            permission: Permission.Write,
        });

        this.stopResize = this.simpleCommand({
            name: "stopResize",
            label: this.i18n.t("pool-commands.stopResize"),
            icon: "fa fa-stop",
            action: (pool) => this._stopResizingPool(pool),
            visible: (pool) => pool.allocationState === PoolAllocationState.resizing,
            permission: Permission.Write,
        });

        this.clone = this.simpleCommand({
            name: "clone",
            ...COMMAND_LABEL_ICON.Clone,
            action: (pool) => this._clonePool(pool),
            multiple: false,
            confirm: false,
            notify: false,
            permission: Permission.Write,
        });

        this.delete = this.simpleCommand<DeletePoolOutput>({
            name: "delete",
            ...COMMAND_LABEL_ICON.Delete,
            action: (pool: Pool, options) => this._deletePool(pool, options),
            confirm: (entities) => this._confirmDeletePool(entities),
            permission: Permission.Write,
        });

        this.exportAsJSON = this.simpleCommand({
            name: "exportAsJson",
            ...COMMAND_LABEL_ICON.ExportAsJSON,
            action: (pool) => this._exportAsJSON(pool),
            multiple: false,
            confirm: false,
            notify: false,
        });

        this.pin = this.simpleCommand({
            name: "pin",
            label: (pool: Pool) => {
                return this.pinnedEntityService.isFavorite(pool)
                    ? COMMAND_LABEL_ICON.UnpinFavoriteLabel : COMMAND_LABEL_ICON.PinFavoriteLabel;
            },
            icon: (pool: Pool) => {
                return this.pinnedEntityService.isFavorite(pool)
                    ? COMMAND_LABEL_ICON.UnpinFavoriteIcon : COMMAND_LABEL_ICON.PinFavoriteIcon;
            },
            action: (pool: Pool) => this._pinPool(pool),
            confirm: false,
            multiple: false,
        });

        this.commands = [
            this.addJob,
            this.resize,
            this.stopResize,
            this.clone,
            this.delete,
            this.exportAsJSON,
            this.pin,
        ];
    }