2018-01-25 17:31:48 +00:00
|
|
|
import Component from '@ember/component';
|
2018-08-24 22:34:07 +00:00
|
|
|
import { task } from 'ember-concurrency';
|
|
|
|
import messageFromAdapterError from 'nomad-ui/utils/message-from-adapter-error';
|
2018-01-25 17:31:48 +00:00
|
|
|
|
|
|
|
export default Component.extend({
|
|
|
|
job: null,
|
|
|
|
tagName: '',
|
2018-07-30 21:32:17 +00:00
|
|
|
|
2018-08-24 22:34:07 +00:00
|
|
|
handleError() {},
|
|
|
|
|
2018-07-30 21:32:17 +00:00
|
|
|
isShowingDeploymentDetails: false,
|
2018-08-24 22:34:07 +00:00
|
|
|
|
|
|
|
promote: task(function*() {
|
|
|
|
try {
|
|
|
|
yield this.get('job.latestDeployment.content').promote();
|
|
|
|
} catch (err) {
|
|
|
|
let message = messageFromAdapterError(err);
|
|
|
|
if (!message || message === 'Forbidden') {
|
|
|
|
message = 'Your ACL token does not grant permission to promote deployments.';
|
|
|
|
}
|
2019-03-26 07:46:44 +00:00
|
|
|
this.handleError({
|
2018-08-24 22:34:07 +00:00
|
|
|
title: 'Could Not Promote Deployment',
|
|
|
|
description: message,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}),
|
2018-01-25 17:31:48 +00:00
|
|
|
});
|