open-nomad/ui/app/controllers/jobs/job/versions.js

34 lines
803 B
JavaScript
Raw Normal View History

import Controller from '@ember/controller';
import WithNamespaceResetting from 'nomad-ui/mixins/with-namespace-resetting';
2018-07-11 16:34:22 +00:00
import { alias } from '@ember/object/computed';
import { action, computed } from '@ember/object';
import classic from 'ember-classic-decorator';
2017-09-19 14:47:10 +00:00
const alertClassFallback = 'is-info';
const errorLevelToAlertClass = {
danger: 'is-danger',
warn: 'is-warning',
};
@classic
export default class VersionsController extends Controller.extend(WithNamespaceResetting) {
error = null;
@alias('model') job;
@computed('error.level')
get errorLevelClass() {
return errorLevelToAlertClass[this.get('error.level')] || alertClassFallback;
}
onDismiss() {
this.set('error', null);
}
@action
handleError(errorObject) {
this.set('error', errorObject);
}
}