open-nomad/ui/app/components/job-page/parts/latest-deployment.js

40 lines
1,003 B
JavaScript
Raw Normal View History

import Component from '@ember/component';
import { task } from 'ember-concurrency';
import messageFromAdapterError from 'nomad-ui/utils/message-from-adapter-error';
import { tagName } from '@ember-decorators/component';
import classic from 'ember-classic-decorator';
@classic
@tagName('')
export default class LatestDeployment extends Component {
job = null;
handleError() {}
isShowingDeploymentDetails = false;
2021-12-28 14:45:20 +00:00
@task(function* () {
try {
yield this.get('job.latestDeployment.content').promote();
} catch (err) {
2019-03-26 07:46:44 +00:00
this.handleError({
title: 'Could Not Promote Deployment',
description: messageFromAdapterError(err, 'promote deployments'),
});
}
})
promote;
2021-12-28 14:45:20 +00:00
@task(function* () {
try {
yield this.get('job.latestDeployment.content').fail();
} catch (err) {
this.handleError({
title: 'Could Not Fail Deployment',
description: messageFromAdapterError(err, 'fail deployments'),
});
}
})
fail;
}