Files
threshold-ui/ui/admin/app/components/form/target/details/index.js
T
Randall Morey 69dfc7c784 refactor: 💡 use constants for target types (#1538)
* refactor: 💡 use constants for target types

* chore: 🤖 import types rather than *

* chore: 🤖 use capitalized TYPES_TARGET constant name
2022-12-20 12:07:52 -05:00

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];
}
}