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';
|
2020-06-10 13:49:16 +00:00
|
|
|
import { tagName } from '@ember-decorators/component';
|
|
|
|
import classic from 'ember-classic-decorator';
|
2018-01-25 17:31:48 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
@classic
|
|
|
|
@tagName('')
|
|
|
|
export default class LatestDeployment extends Component {
|
|
|
|
job = null;
|
2018-07-30 21:32:17 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
handleError() {}
|
2018-08-24 22:34:07 +00:00
|
|
|
|
2020-06-10 13:49:16 +00:00
|
|
|
isShowingDeploymentDetails = false;
|
2018-08-24 22:34:07 +00:00
|
|
|
|
2021-12-28 14:45:20 +00:00
|
|
|
@task(function* () {
|
2018-08-24 22:34:07 +00:00
|
|
|
try {
|
|
|
|
yield this.get('job.latestDeployment.content').promote();
|
|
|
|
} catch (err) {
|
2019-03-26 07:46:44 +00:00
|
|
|
this.handleError({
|
2018-08-24 22:34:07 +00:00
|
|
|
title: 'Could Not Promote Deployment',
|
2021-01-28 00:40:51 +00:00
|
|
|
description: messageFromAdapterError(err, 'promote deployments'),
|
2018-08-24 22:34:07 +00:00
|
|
|
});
|
|
|
|
}
|
2020-06-10 13:49:16 +00:00
|
|
|
})
|
|
|
|
promote;
|
2021-02-10 14:38:37 +00:00
|
|
|
|
2021-12-28 14:45:20 +00:00
|
|
|
@task(function* () {
|
2021-02-10 14:38:37 +00:00
|
|
|
try {
|
|
|
|
yield this.get('job.latestDeployment.content').fail();
|
|
|
|
} catch (err) {
|
|
|
|
this.handleError({
|
|
|
|
title: 'Could Not Fail Deployment',
|
2021-02-10 16:23:19 +00:00
|
|
|
description: messageFromAdapterError(err, 'fail deployments'),
|
2021-02-10 14:38:37 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
})
|
|
|
|
fail;
|
2020-06-10 13:49:16 +00:00
|
|
|
}
|