Icu 16534 refactor usage of tracked using this args (#2711)

* refactor: 💡 remove tracked usage with this.args
This commit is contained in:
Lisbet Alvarez authored and GitHub committed 2025-03-12 10:09:16 -07:00
1 parent e8fc6d163b
commit 89263918ea
10 files changed
+48 -58

No files matched your search

+8 -6
View File
@@ -4,6 +4,7 @@
*/
import GeneratedHostCatalogModel from '../generated/models/host-catalog';
import { tracked } from '@glimmer/tracking';
export const TYPE_HOST_CATALOG_STATIC = 'static';
export const TYPE_HOST_CATALOG_DYNAMIC = 'plugin';
@@ -40,7 +41,8 @@ export const STATIC_CREDENTIAL_FIELDS = ['access_key_id, secret_access_key'];
export default class HostCatalogModel extends GeneratedHostCatalogModel {
// =attributes
#credentialType;
@tracked _credentialTypeValue;
/**
* True if the host catalog is static.
* @type {boolean}
@@ -62,14 +64,14 @@ export default class HostCatalogModel extends GeneratedHostCatalogModel {
* @type {string}
*/
get credentialType() {
if (!this.#credentialType) {
if (!this._credentialTypeValue) {
if (DYNAMIC_CREDENTIAL_FIELDS.some((field) => this[field])) {
this.#credentialType = TYPE_CREDENTIAL_DYNAMIC;
return TYPE_CREDENTIAL_DYNAMIC;
} else {
this.#credentialType = TYPE_CREDENTIAL_STATIC;
return TYPE_CREDENTIAL_STATIC;
}
}
return this.#credentialType;
return this._credentialTypeValue;
}
/**
@@ -77,7 +79,7 @@ export default class HostCatalogModel extends GeneratedHostCatalogModel {
* @type {string}
*/
set credentialType(type) {
this.#credentialType = type;
this._credentialTypeValue = type;
}
/**
+9 -6
View File
@@ -4,6 +4,7 @@
*/
import GeneratedStorageBucketModel from '../generated/models/storage-bucket';
import { tracked } from '@glimmer/tracking';
export const TYPE_STORAGE_BUCKET_PLUGIN = 'plugin';
export const TYPES_STORAGE_BUCKET = Object.freeze([TYPE_STORAGE_BUCKET_PLUGIN]);
@@ -26,7 +27,8 @@ export const TYPES_CREDENTIALS = Object.freeze([
export default class StorageBucketModel extends GeneratedStorageBucketModel {
// attributes
#credentialType;
@tracked _credentialTypeValue;
/**
* True if the storage bucket is a plugin.
* @type {boolean}
@@ -40,14 +42,14 @@ export default class StorageBucketModel extends GeneratedStorageBucketModel {
* @type {string}
*/
get credentialType() {
if (!this.#credentialType) {
if (!this._credentialTypeValue) {
if (this.role_arn) {
this.#credentialType = TYPE_CREDENTIAL_DYNAMIC;
return TYPE_CREDENTIAL_DYNAMIC;
} else {
this.#credentialType = TYPE_CREDENTIAL_STATIC;
return TYPE_CREDENTIAL_STATIC;
}
}
return this.#credentialType;
return this._credentialTypeValue;
}
/**
@@ -55,8 +57,9 @@ export default class StorageBucketModel extends GeneratedStorageBucketModel {
* @type {string}
*/
set credentialType(type) {
this.#credentialType = type;
this._credentialTypeValue = type;
}
/**
* True if the storage bucket is an unknown type.
* @type {boolean}