From c9f3e1bdabea8292a970a82aadcfe2ebf11ff320 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Thu, 17 Oct 2024 21:20:46 -0600 Subject: [PATCH] fix bug allowing click on disabled actions --- .../app-actions/app-actions-item.component.html | 2 +- .../apps-routes/app-actions/app-actions.page.html | 6 +++--- .../pages/apps-routes/app-actions/app-actions.page.ts | 11 +++++++++-- web/projects/ui/src/app/services/api/api.fixures.ts | 2 +- web/projects/ui/src/app/services/api/mock-patch.ts | 2 +- 5 files changed, 15 insertions(+), 8 deletions(-) diff --git a/web/projects/ui/src/app/pages/apps-routes/app-actions/app-actions-item.component.html b/web/projects/ui/src/app/pages/apps-routes/app-actions/app-actions-item.component.html index 79d7af03f..11faa8235 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-actions/app-actions-item.component.html +++ b/web/projects/ui/src/app/pages/apps-routes/app-actions/app-actions-item.component.html @@ -1,4 +1,4 @@ - +

{{ action.name }}

diff --git a/web/projects/ui/src/app/pages/apps-routes/app-actions/app-actions.page.html b/web/projects/ui/src/app/pages/apps-routes/app-actions/app-actions.page.html index bacbed729..3532fcacc 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-actions/app-actions.page.html +++ b/web/projects/ui/src/app/pages/apps-routes/app-actions/app-actions.page.html @@ -18,7 +18,7 @@ visibility: 'enabled' }" icon="construct-outline" - (click)="rebuild(pkg.manifest.id)" + (onClick)="rebuild(pkg.manifest.id)" > @@ -38,7 +38,7 @@ *ngFor="let action of pkg.actions" [action]="action" icon="play-outline" - (click)="handleAction(pkg.mainStatus, pkg.icon, pkg.manifest, action)" + (onClick)="handleAction(pkg.mainStatus, pkg.icon, pkg.manifest, action)" > diff --git a/web/projects/ui/src/app/pages/apps-routes/app-actions/app-actions.page.ts b/web/projects/ui/src/app/pages/apps-routes/app-actions/app-actions.page.ts index feea649d1..949a1adad 100644 --- a/web/projects/ui/src/app/pages/apps-routes/app-actions/app-actions.page.ts +++ b/web/projects/ui/src/app/pages/apps-routes/app-actions/app-actions.page.ts @@ -1,4 +1,10 @@ -import { ChangeDetectionStrategy, Component, Input } from '@angular/core' +import { + ChangeDetectionStrategy, + Component, + EventEmitter, + Input, + Output, +} from '@angular/core' import { ActivatedRoute } from '@angular/router' import { getPkgId } from '@start9labs/shared' import { T } from '@start9labs/start-sdk' @@ -70,9 +76,10 @@ export class AppActionsItemComponent { description: string visibility: T.ActionVisibility } - @Input() icon!: string + @Output() onClick: EventEmitter = new EventEmitter() + get disabledText() { return ( typeof this.action.visibility === 'object' && diff --git a/web/projects/ui/src/app/services/api/api.fixures.ts b/web/projects/ui/src/app/services/api/api.fixures.ts index d6c27e353..828b36642 100644 --- a/web/projects/ui/src/app/services/api/api.fixures.ts +++ b/web/projects/ui/src/app/services/api/api.fixures.ts @@ -1701,7 +1701,7 @@ export module Mock { description: 'An example of an action that shows a warning and takes no input', warning: 'careful running this action', - visibility: 'enabled', + visibility: { disabled: 'This is temporarily disabled' }, allowedStatuses: 'only-running', hasInput: false, group: null, diff --git a/web/projects/ui/src/app/services/api/mock-patch.ts b/web/projects/ui/src/app/services/api/mock-patch.ts index 3a8560336..d5989affa 100644 --- a/web/projects/ui/src/app/services/api/mock-patch.ts +++ b/web/projects/ui/src/app/services/api/mock-patch.ts @@ -129,7 +129,7 @@ export const mockPatchData: DataModel = { description: 'An example of an action that shows a warning and takes no input', warning: 'careful running this action', - visibility: 'enabled', + visibility: { disabled: 'This is temporarily disabled' }, allowedStatuses: 'only-running', hasInput: false, group: null,