41 lines
908 B
JavaScript
41 lines
908 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import Component from '@glimmer/component';
|
|
import { TYPES_TARGET } from 'api/models/target';
|
|
import { service } from '@ember/service';
|
|
|
|
// 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 {
|
|
// =services
|
|
|
|
@service features;
|
|
|
|
/**
|
|
* 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];
|
|
}
|
|
}
|