mirror of https://github.com/rancher/dashboard.git
add scaledown action to mgmt nodes
This commit is contained in:
parent
f9df160d19
commit
a021c9421d
|
|
@ -2498,6 +2498,7 @@ node:
|
|||
taints: Taints
|
||||
actions:
|
||||
downloadSSHKey: Download SSH Key
|
||||
scaleDown: Scale Down
|
||||
|
||||
persistentVolume:
|
||||
pluginConfiguration:
|
||||
|
|
|
|||
|
|
@ -96,7 +96,13 @@ export default {
|
|||
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
showNodes(neu) {
|
||||
if (neu) {
|
||||
this.$store.dispatch('rancher/findAll', { type: NORMAN.NODE });
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
defaultTab() {
|
||||
if (this.showRegistration && !this.machines?.length) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { MANAGEMENT_NODE } from '@/config/labels-annotations';
|
||||
import { CAPI, MANAGEMENT, NODE } from '@/config/types';
|
||||
import { CAPI, MANAGEMENT, NODE, NORMAN } from '@/config/types';
|
||||
import { NAME as EXPLORER } from '@/config/product/explorer';
|
||||
import { listNodeRoles } from '@/models/cluster/node';
|
||||
import { insertAt } from '@/utils/array';
|
||||
|
|
@ -8,6 +8,7 @@ import { downloadFile } from '@/utils/download';
|
|||
export default {
|
||||
_availableActions() {
|
||||
const out = this._standardActions;
|
||||
const normanAction = this.normanNode?.actions || {};
|
||||
|
||||
const downloadKeys = {
|
||||
action: 'downloadKeys',
|
||||
|
|
@ -16,8 +17,17 @@ export default {
|
|||
label: this.t('node.actions.downloadSSHKey'),
|
||||
};
|
||||
|
||||
const scaleDown = {
|
||||
action: 'scaleDown',
|
||||
enabled: !!normanAction.scaledown,
|
||||
icon: 'icon icon-fw icon-x',
|
||||
label: this.t('node.actions.scaleDown'),
|
||||
bulkable: true,
|
||||
};
|
||||
|
||||
insertAt(out, 0, { divider: true });
|
||||
insertAt(out, 0, downloadKeys);
|
||||
insertAt(out, 0, scaleDown);
|
||||
|
||||
return out;
|
||||
},
|
||||
|
|
@ -66,12 +76,28 @@ export default {
|
|||
return this.$rootGetters['management/byId'](MANAGEMENT.NODE_POOL, nodePoolID);
|
||||
},
|
||||
|
||||
normanNode() {
|
||||
const normanNodeId = this.id.replace('/', ':');
|
||||
|
||||
return this.$rootGetters['rancher/byId'](NORMAN.NODE, normanNodeId);
|
||||
},
|
||||
|
||||
downloadKeys() {
|
||||
return () => {
|
||||
downloadFile(this.status.nodeName, this.status.rkeNode.sshKey, 'application/octet-stream');
|
||||
};
|
||||
},
|
||||
|
||||
scaleDown() {
|
||||
return async(resources) => {
|
||||
const safeResources = Array.isArray(resources) ? resources : [this];
|
||||
|
||||
await Promise.all(safeResources.map((node) => {
|
||||
return node.normanNode.doAction('scaledown');
|
||||
}));
|
||||
};
|
||||
},
|
||||
|
||||
provisioningCluster() {
|
||||
return this.$getters['all'](CAPI.RANCHER_CLUSTER).find(c => c.name === this.namespace);
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue