* refactor: 💡 use constants for target types * chore: 🤖 import types rather than * * chore: 🤖 use capitalized TYPES_TARGET constant name
33 lines
767 B
JavaScript
33 lines
767 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];
|
|
}
|
|
}
|