Files
threshold-ui/ui/admin/app/components/form/target/details/index.js
T
Cameron Perera f7c80c8869 UI target worker filter deprecation message (#1574)
* feat: 🎸 Add worker_filter deprecation message to target form

* test: 💍 fix test selectors for worker_filter message
2023-01-11 15:46:47 -06:00

41 lines
981 B
JavaScript

import Component from '@glimmer/component';
import { TYPES_TARGET } from 'api/models/target';
// NOTE: this is all a temporary solution till we have a resource type helper.
const types = [...TYPES_TARGET].reverse();
const icons = {
ssh: 'terminal-screen',
tcp: 'network',
};
export default class FormTargetComponent extends Component {
// =properties
/**
* maps resource type with icon
* @type {object}
*/
get typeMetas() {
return types.map((type) => ({
type,
icon: icons[type],
}));
}
/**
* returns icons based on the model type
* unlike other resources, this is needed as we use generic details component for both tcp and ssh
* @type {string}
*/
get icon() {
return icons[this.args.model.type];
}
/**
* determines when the worker filter deprecation message should be shown
* @type {boolean}
*/
get showDeprecationMessage() {
return !this.args.model.isNew && this.args.model.worker_filter;
}
}