From 5df3cd7a93aa5fae7063ccea0a626a49c6cc7e55 Mon Sep 17 00:00:00 2001 From: Yuhuai Liu Date: Tue, 24 Jun 2025 04:07:34 -0400 Subject: [PATCH 1/2] add instanceOf helper; use the helper --- app/guid-node/addons/index/template.hbs | 14 +++++++++++--- app/helpers/instance-of.ts | 20 ++++++++++++++++++++ translations/en-us.yml | 1 + 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 app/helpers/instance-of.ts diff --git a/app/guid-node/addons/index/template.hbs b/app/guid-node/addons/index/template.hbs index 56b67152bb9..9705bfc09fb 100644 --- a/app/guid-node/addons/index/template.hbs +++ b/app/guid-node/addons/index/template.hbs @@ -243,10 +243,18 @@ {{manager.selectedConfiguration.displayName}}
- {{#if manager.selectedConfiguration.rootFolder}} - {{manager.selectedConfiguration.rootFolderName}} + {{#if (instance-of manager.selectedConfiguration 'ConfiguredLinkAddon')}} + {{#if manager.selectedConfiguration.targetUrl}} + {{manager.selectedConfiguration.targetItemName}} + {{else}} + {{t 'addons.list.target-not-set'}} + {{/if}} {{else}} - {{t 'addons.list.root-folder-not-set'}} + {{#if manager.selectedConfiguration.rootFolder}} + {{manager.selectedConfiguration.rootFolderName}} + {{else}} + {{t 'addons.list.root-folder-not-set'}} + {{/if}} {{/if}}
diff --git a/app/helpers/instance-of.ts b/app/helpers/instance-of.ts new file mode 100644 index 00000000000..c4aa98e2a86 --- /dev/null +++ b/app/helpers/instance-of.ts @@ -0,0 +1,20 @@ +import { getOwner } from '@ember/application'; +import { assert } from '@ember/debug'; + +import Helper from '@ember/component/helper'; + +export default class InstanceOf extends Helper { + compute([object, className]: [any, string]) { + if (!object || typeof className !== 'string') { + return false; + } + // Look up the class from the container + const owner = getOwner(this); + const klass = owner.factoryFor(`model:${className}`)?.class; + if (!klass) { + assert(`Class "${className}" not found`); + return false; + } + return object instanceof klass; + } +} diff --git a/translations/en-us.yml b/translations/en-us.yml index 53fa3b14327..4fe2c95166e 100644 --- a/translations/en-us.yml +++ b/translations/en-us.yml @@ -247,6 +247,7 @@ addons: confirm-remove-connected-location: 'You are about to disconnect the addon below from the project.' connected-to-account: 'Connected to account' root-folder-not-set: 'Root folder not set' + target-not-set: 'Target not set' sync-details-1: 'Sync your projects with external services to help stay connected and organized. Select a category and browse the options.' sync-details-2: 'To manage all add-ons connected to your account, visit your profile settings.' sync-details-3: 'Manage your connected Add-ons, re-authorize, disconnect account, or disconnect project' From 702bd57c9972766612a30f8320fefefeceb7e175 Mon Sep 17 00:00:00 2001 From: Yuhuai Liu Date: Tue, 24 Jun 2025 04:25:36 -0400 Subject: [PATCH 2/2] add minimum width to edit.link column --- app/guid-node/links/styles.scss | 4 ++++ app/guid-node/links/template.hbs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/guid-node/links/styles.scss b/app/guid-node/links/styles.scss index c904e51f0fb..b82c910252e 100644 --- a/app/guid-node/links/styles.scss +++ b/app/guid-node/links/styles.scss @@ -9,6 +9,10 @@ padding-top: 10px; } +.edit-header { + min-width: 30px; +} + .table-row { border-bottom: 1px solid $color-border-gray; } diff --git a/app/guid-node/links/template.hbs b/app/guid-node/links/template.hbs index bfacda06ee7..ab5af5264ab 100644 --- a/app/guid-node/links/template.hbs +++ b/app/guid-node/links/template.hbs @@ -7,7 +7,7 @@ {{t 'links.linked-service'}} {{t 'links.display-name'}} {{t 'links.resource-type'}} - + {{#if this.currentUserCanEdit}}