4adf59785d
This is a supplement to #9831 to incorporate the extracted missing-permissions error handling from #9909. It fixes this failure on the main branch! 😳 https://app.circleci.com/pipelines/github/hashicorp/nomad/14728/workflows/4c147dca-fd1e-4de7-86aa-90ded7aabad2/jobs/137137
40 lines
1,001 B
JavaScript
40 lines
1,001 B
JavaScript
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;
|
|
|
|
@task(function*() {
|
|
try {
|
|
yield this.get('job.latestDeployment.content').promote();
|
|
} catch (err) {
|
|
this.handleError({
|
|
title: 'Could Not Promote Deployment',
|
|
description: messageFromAdapterError(err, 'promote deployments'),
|
|
});
|
|
}
|
|
})
|
|
promote;
|
|
|
|
@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;
|
|
}
|