Redeploy action on workloads

This commit is contained in:
Vincent Fiduccia 2020-07-27 11:34:00 -07:00
parent 3f17434bc0
commit 42235589f3
No known key found for this signature in database
GPG Key ID: 2B29AD6BB2BB2582
1 changed files with 16 additions and 6 deletions

View File

@ -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();
}
};