public setAdvancedActions()

in src/SfxWeb/src/app/Models/DataModels/Node.ts [99:168]


    public setAdvancedActions(): void {
        this.actions.add(new Action(
            'activateNode',
            'Activate',
            'Activating',
            () => this.activate(),
            () => (this.expectedNodeStatus !== NodeStatus.Invalid) ?
                this.expectedNodeStatus === NodeStatus.Disabled :
                this.raw.NodeStatus === NodeStatusConstants.Down || this.raw.NodeStatus === NodeStatusConstants.Disabling || this.raw.NodeStatus === NodeStatusConstants.Disabled
            , true
                ));

        const removeNodeState = new ActionWithConfirmationDialog(
            this.data.dialog,
            'removeNodeState',
            'Remove node state',
            'Removing',
            () => this.removeNodeState(),
            () => this.raw.NodeStatus === NodeStatusConstants.Down,
            'Confirm Node Removal',
            `Data about node ${this.name} will be completely erased from the cluster ${window.location.host}. All data stored on the node will be lost permanently. Are you sure to continue?`,
            this.name
            );
        removeNodeState.isAdvanced = true;
        this.actions.add(removeNodeState);

        const deactivePauseNode = new ActionWithConfirmationDialog(
            this.data.dialog,
            'deactivePauseNode',
            'Deactivate (pause)',
            'Deactivating',
            () => this.deactivate(1),
            // There are various levels of "disabling" and it should be possible to disable "at a higher level" an already-disabled node.
            () => this.raw.NodeStatus !== NodeStatusConstants.Down,
            // We do not track the level of disabling, so we just enable the command as long as the node is not down.
            'Confirm Node Deactivation',
            `Deactivate node '${this.name}' from cluster '${window.location.host}'? This node will not become operational again until it is manually reactivated. WARNING: Deactivating nodes can cause data loss if not used with caution. For more information see: https://go.microsoft.com/fwlink/?linkid=825861`,
            this.name
        );
        deactivePauseNode.isAdvanced = true;
        this.actions.add(deactivePauseNode);

        const deactiveRestartNode = new ActionWithConfirmationDialog(
            this.data.dialog,
            'deactiveRestartNode',
            'Deactivate (restart)',
            'Deactivating',
            () => this.deactivate(2),
            () => this.raw.NodeStatus !== NodeStatusConstants.Down,
            'Confirm Node Deactivation',
            `Deactivate node '${this.name}' from cluster '${window.location.host}'? This node will not become operational again until it is manually reactivated. WARNING: Deactivating nodes can cause data loss if not used with caution. For more information see: https://go.microsoft.com/fwlink/?linkid=825861`,
            this.name
        );
        deactiveRestartNode.isAdvanced = true;
        this.actions.add(deactiveRestartNode);

        const deactiveRemoveNodeData =  new ActionWithConfirmationDialog(
            this.data.dialog,
            'deactiveRemoveNodeData',
            'Deactivate (remove data)',
            'Deactivating',
            () => this.deactivate(3),
            () => this.raw.NodeStatus !== NodeStatusConstants.Down,
            'Confirm Node Deactivation',
            `Deactivate node '${this.name}' from cluster '${window.location.host}'? This node will not become operational again until it is manually reactivated. WARNING: Deactivating nodes can cause data loss if not used with caution. For more information see: https://go.microsoft.com/fwlink/?linkid=825861`,
            this.name
        );
        deactiveRemoveNodeData.isAdvanced = true;
        this.actions.add(deactiveRemoveNodeData);
    }