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

+5 -3
View File
@@ -2,7 +2,9 @@ import GeneratedTargetModel from '../generated/models/target';
import { attr } from '@ember-data/model';
import { inject as service } from '@ember/service';
export const types = ['tcp', 'ssh'];
export const TYPE_TARGET_TCP = 'tcp';
export const TYPE_TARGET_SSH = 'ssh';
export const TYPES_TARGET = Object.freeze([TYPE_TARGET_TCP, TYPE_TARGET_SSH]);
export default class TargetModel extends GeneratedTargetModel {
// =services
@@ -321,7 +323,7 @@ export default class TargetModel extends GeneratedTargetModel {
* @type {boolean}
*/
get isTCP() {
return this.type === 'tcp';
return this.type === TYPE_TARGET_TCP;
}
/**
@@ -329,6 +331,6 @@ export default class TargetModel extends GeneratedTargetModel {
* @type {boolean}
*/
get isSSH() {
return this.type === 'ssh';
return this.type === TYPE_TARGET_SSH;
}
}