* feat: 🎸 Add worker_filter deprecation message to target form * test: 💍 fix test selectors for worker_filter message
41 lines
981 B
JavaScript
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;
|
|
}
|
|
}
|