vault/ui/lib/kmip/addon/components/operation-field-display.js
claire bontempo 918642bd9c
UI: Ember deprecation prep for 5.0: ember-data:deprecate-array-like (#26170)
* remove .get() from cluster and vault route

* replace .get() use in adapters

* remove .get() from components part 1

* remove .get() from string-list

* remaining components

* controller .get() removal

* remove .get() use in mixins

* routes/cluster/access* .get() replacement

* policy index route

* routes/secrets/backend*

* route/cluster*

* serializers

* is-active-route

* remaining top-level addon gets

* replication get()

* revery change that broke things

* woops, revert other store service change

* revert some controller changes

* revert get on URLSearchParams class

* remove .sortBy ember method

* small cleanup items

* small cleanups from PR review
2024-03-28 12:13:33 -07:00

48 lines
1.2 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
/**
* @module OperationFieldDisplay
* OperationFieldDisplay components are used on KMIP role show pages to display the allowed operations on that model
*
* @example
* ```js
* <OperationFieldDisplay @model={{model}} />
* ```
*
* @param model {DS.Model} - model is the KMIP role model that needs to display its allowed operations
*
*/
import Component from '@ember/component';
import layout from '../templates/components/operation-field-display';
export default Component.extend({
layout,
tagName: '',
model: null,
trueOrFalseString(model, field, trueString, falseString) {
if (model.operationAll) {
return trueString;
}
if (model.operationNone) {
return falseString;
}
return model[field.name] ? trueString : falseString;
},
actions: {
iconClass(model, field) {
return this.trueOrFalseString(model, field, 'hds-foreground-success', 'hds-foreground-faint');
},
iconGlyph(model, field) {
return this.trueOrFalseString(model, field, 'check-circle', 'x-square');
},
operationEnabled(model, field) {
return this.trueOrFalseString(model, field, 'Enabled', 'Disabled');
},
},
});