9e68a82650
* setup wild card helper and call the helper inside the search select component * change to wildcardLabel instead of wildCardLabel to keep consistent with usage * clean up errors * add wilcard functionality to roles * add tooltip delete functionality * move cli command to computed property too complicated for template and it didn't cover everything * edit modal on transformation when there's a role * make small adjustments based on logic confusion on my end * use brace expansion * fixes * filter-wildcard helper test * is-wildcard-string-test * search select test * check for empty array * nest conditional so wildcard helper doesn't get called uncessarily * remove wildcard from roles * refactor a little * clean up wildcard helper and test
30 lines
857 B
JavaScript
30 lines
857 B
JavaScript
import TransformBase from './transform-edit-base';
|
|
import { computed } from '@ember/object';
|
|
|
|
export default TransformBase.extend({
|
|
cliCommand: computed('model.{allowed_roles,type,tweak_source}', function() {
|
|
if (!this.model) {
|
|
return;
|
|
}
|
|
|
|
let { type, allowed_roles, tweak_source, name } = this.model;
|
|
let wildCardRole = allowed_roles.find(role => role.includes('*'));
|
|
|
|
// values to be returned
|
|
let role = '<choose a role>';
|
|
let value = 'value=<enter your value here>';
|
|
let tweak = '';
|
|
|
|
// determine the role
|
|
if (allowed_roles.length === 1 && !wildCardRole) {
|
|
role = allowed_roles[0];
|
|
}
|
|
// determine the tweak_source
|
|
if (type === 'fpe' && tweak_source === 'supplied') {
|
|
tweak = 'tweak=<enter your tweak>';
|
|
}
|
|
|
|
return `${role} ${value} ${tweak} transformation=${name}`;
|
|
}),
|
|
});
|