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
This commit is contained in:
Randall Morey authored and GitHub committed 2022-12-20 12:07:52 -05:00
1 parent 473ebcc397
commit 69dfc7c784
13 files changed
+44 -32

No files matched your search

@@ -1,7 +1,8 @@
import Component from '@glimmer/component';
import { types } from 'api/models/target';
import { TYPES_TARGET } from 'api/models/target';
//Note: this is a temporary solution till we have resource type helper in place
// 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',
@@ -14,8 +15,7 @@ export default class FormTargetComponent extends Component {
* @type {object}
*/
get typeMetas() {
const reversedTypes = [...types].reverse();
return reversedTypes.map((type) => ({
return types.map((type) => ({
type,
icon: icons[type],
}));