open-nomad/ui/app/mixins/with-forbidden-state.js
2023-04-10 15:36:59 +00:00

23 lines
500 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import Mixin from '@ember/object/mixin';
// eslint-disable-next-line ember/no-new-mixins
export default Mixin.create({
setupController(controller) {
if (this.isForbidden) {
this.set('isForbidden', undefined);
controller.set('isForbidden', true);
}
this._super(...arguments);
},
resetController(controller) {
controller.set('isForbidden', false);
this._super(...arguments);
},
});