open-nomad/ui/app/components/job-page/parts/latest-deployment.js
Michael Lange 52a7a48177 Don't use generic ACL error messages
When the error is actually a 403, an ACL error is appropriate, but when
it isn't, fallback on what the API returns.
2021-01-28 12:18:53 -08:00

28 lines
718 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;
}