Icu 13889 update tags column to action that opens hds flyout and add link to tags tab if more than 10 tags (#2355)

* refactor: 💡 update worker factory to include api_tags

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13889

* feat: 🎸 add tags flyout for workers table

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13889

* refactor: 💡 move test selector to const

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13889

* refactor: 💡 only show 'view more tags' if more than 10 tags

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13889

* test: 💍 update test name

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13889

* refactor: 💡 update how worker tags are shown in flyout

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13889

* refactor: 💡 add one more api tag for worker in mirage

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13889

* refactor: 💡 fix tagDisplayName signature

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13889

* refactor: 💡 update tag shortener styling

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13889
This commit is contained in:
Cameron Perera authored and cameronperera committed 2024-07-16 15:48:10 -05:00
1 parent f51124cfdb
commit 40ebbf8b09
7 files changed
+277 -19

No files matched your search

@@ -7,6 +7,7 @@ import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { loading } from 'ember-loading';
import { tracked } from '@glimmer/tracking';
import { confirm } from 'core/decorators/confirm';
import { notifySuccess, notifyError } from 'core/decorators/notify';
@@ -16,8 +17,39 @@ export default class ScopesScopeWorkersIndexController extends Controller {
@service router;
@service can;
// =attributes
@tracked selectedWorker;
/**
* Get the first 10 tags of the selected worker.
* @type {object[]}
*/
get selectedWorkerTags() {
// only show the first 10 tags if there are more than 10
return this.selectedWorker.allTags.slice(0, 10);
}
/**
* Build the display name for a worker tag
* @param {object} tag
* @returns {string}
*/
tagDisplayName(tag) {
return `${tag.key} = ${tag.value}`;
}
// =actions
/**
* Toggle the tags flyout to display or hide the tags of a worker.
* @param {object} selectedWorker
*/
@action
selectWorker(selectedWorker) {
this.selectedWorker = selectedWorker;
}
/**
* Rollback changes on workers.
* @param {WorkerModel} worker