Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

target_switch

Marcel Kloubert edited this page Nov 27, 2017 · 12 revisions

Home >> Targets >> switch

Switch

Switches between existing targets.

You can change the state of a switch by using the Deploy: Change switch (extension.deploy.changeSwitch) command or a button.

{
    "deploy": {
        // ...

        "targets": [
            {
                "name": "My SFTP switch",
                "type": "switch",

                "options": [
                    {
                        "name": "Server 1",
                        "targets": "sftp1",

                        "isDefault": true
                    },

                    {
                        "name": "Server 2",
                        "targets": [ "sftp2" ]
                    }
                ]
            },

            {
                "name": "sftp1",
                "type": "sftp",
                
                // ...
            },
            {
                "name": "sftp2",
                "type": "sftp",
                
                // ...
            }
        ]
    }
}
Name Description
button If defined: Displays a button in the status bar. Can also be a boolean value to indicate if a button should be displayed or not. Default: (false)
options One or more option. Can also be one or more string which the targets to deploy to.

Button

{
    "deploy": {
        // ...

        "targets": [
            {
                "name": "My SFTP switch",
                "type": "switch",

                "button": {
                    "color": "#ffff00",
                    "text": "${selectedSwitch}: ${selectedSwitchOption}",
                    "tooltip": "Click here to change the current option of that switch..."
                }

                // ...
            },

            // ...
        ]
    }
}
Name Description
color The custom text color. Default: #ffffff
enabled Enable button or not. Default: (true)
isRight Put button on the right side or not. Default: (false)
priority The priority.
text* The custom text.
tooltip* The custom tooltip.

* supports placeholders

Additional placeholders

Name Description
selectedSwitch The name of the current switch.
selectedSwitchOption The name of the selected switch option.

Options

Name Description
description The description.
isDefault Is default option or not. Default: (false)
name The (display) name.
sortOrder An optional number or object to sort the option elements. If this value is an object, it is searched for a property that contains the name of the current machine, by using its value as sort value. Default: 0
targets One or more target (names) to deploy to.
Clone this wiki locally