From 42235589f3db2f42fa9bc480c9e2ac7509702aa7 Mon Sep 17 00:00:00 2001 From: Vincent Fiduccia Date: Mon, 27 Jul 2020 11:34:00 -0700 Subject: [PATCH] Redeploy action on workloads --- models/workload.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/models/workload.js b/models/workload.js index d8979e8d7b..f275ae9879 100644 --- a/models/workload.js +++ b/models/workload.js @@ -1,3 +1,5 @@ +import { insertAt } from '@/utils/array'; +import { TIMESTAMP } from '@/config/labels-annotations'; import { WORKLOAD_TYPES } from '@/config/types'; export default { @@ -5,18 +7,19 @@ export default { _availableActions() { let out = this._standardActions; + insertAt(out, 0, { + action: 'redeploy', + label: 'Redeploy', + icon: 'icon icon-spinner', + enabled: !!this.links.update, + }); + const toFilter = ['cloneYaml']; out = out.filter((action) => { if (!toFilter.includes(action.action)) { return action; } - }).map((action) => { - if (action.action === 'viewEditYaml') { - action.label = 'View as YAML'; - } - - return action; }); return out; @@ -63,4 +66,11 @@ export default { */ ]; }, + + redeploy() { + const now = (new Date()).toISOString().replace(/\.\d+Z$/, 'Z'); + + this.setAnnotation(TIMESTAMP, now); + this.save(); + } };