From 697104c8e85bbc436d5b3d05906fa95c3a7eada3 Mon Sep 17 00:00:00 2001 From: Maksym Tsymbarov Date: Wed, 2 Dec 2026 17:53:14 +0100 Subject: [PATCH] Fixed agent wizards and the edge instructions dialog not scrolling on mobile (#16809) * Unified agent dialogs layout and fixed scroll issues in edge instructions dialog * Fixed agent wizards review issues: config step check, embedded layout, shared step constants * Fixed agent dialogs review issues: wide dialog width, fullscreen event progress, host binding * Fixed PR comments * Fixed PR comments * Fixed PR comments: wide uninstall dialog, compose editor/diff heights, unused stepper ViewChild * Used the shared agent color variables in the compose editor and diff, merged duplicate host-context blocks in the wizard dialog mixin --------- Co-authored-by: Vladyslav_Prykhodko --- .../home/components/agent/_agent-shared.scss | 5 +- .../agent/agent-deploy-status.component.scss | 32 + .../agent-compose-diff.component.scss | 4 +- .../component/agent-compose-diff.component.ts | 11 +- .../agent-compose-editor.component.scss | 6 +- ...agent-auto-provision-dialog.component.html | 59 +- ...agent-auto-provision-dialog.component.scss | 9 +- .../agent-auto-provision-dialog.component.ts | 3 +- .../agent-auto-provision-dialog.service.ts | 2 +- .../agent/wizard/_agent-wizard.scss | 284 ++------- .../agent-app-install-flow.component.html | 601 +++++++++--------- .../agent-app-install-flow.component.scss | 10 +- .../agent-app-install-flow.component.ts | 87 ++- .../wizard/agent-app-install-wizard-dialog.ts | 22 + .../agent-app-install-wizard.component.scss | 5 - .../agent-app-install-wizard.component.ts | 1 - .../agent-app-update-flow.component.html | 72 +-- .../agent-app-update-flow.component.scss | 2 +- .../wizard/agent-app-update-flow.component.ts | 14 +- .../agent-app-upgrade-flow.component.html | 294 ++++----- .../agent-app-upgrade-flow.component.scss | 2 +- .../agent-app-upgrade-flow.component.ts | 35 +- .../agent/agent-app-profile.component.ts | 3 +- ...gent-app-profiles-table-config.resolver.ts | 13 +- .../agent/agent-application.component.ts | 46 +- ...gent-applications-table-config.resolver.ts | 54 +- .../agent/agent-deploy-dialog.service.ts | 31 +- .../agent-executions-side-panel.component.ts | 13 +- ...install-instructions-dialog.component.scss | 11 +- .../agent-profile-create-dialog.service.ts | 2 +- ...gent-profile-created-dialog.component.html | 32 +- ...gent-profile-created-dialog.component.scss | 49 +- ...agent-profile-merged-profiles.component.ts | 5 +- .../agent-profiles-table-config.resolver.ts | 2 +- .../agent/agents-table-config.resolver.ts | 2 +- ...t-app-assign-compare-dialog.component.html | 30 +- ...t-app-assign-compare-dialog.component.scss | 2 +- ...t-app-event-progress-dialog.component.html | 15 +- ...t-app-event-progress-dialog.component.scss | 53 +- ...-app-profile-upgrade-dialog.component.html | 41 +- ...-app-profile-upgrade-dialog.component.scss | 2 +- ...-app-version-warning-dialog.component.html | 18 +- ...-app-version-warning-dialog.component.scss | 53 +- ...ofile-assign-profile-dialog.component.scss | 9 +- ...profile-assign-profile-dialog.component.ts | 15 +- ...-profile-bulk-action-dialog.component.scss | 11 +- ...agent-profile-preset-dialog.component.html | 63 +- ...agent-profile-preset-dialog.component.scss | 45 +- .../abstract-agent-app-event-table-config.ts | 13 +- .../agent/util/agent-app-event-progress.ts | 2 +- .../agent/util/agent-version-warnings.ts | 2 +- .../wizard/agent-app-profile-wizard-dialog.ts | 23 + .../agent-app-profile-wizard.component.html | 348 +++++----- .../agent-app-profile-wizard.component.scss | 2 +- .../agent-app-profile-wizard.component.ts | 25 + .../agent/wizard/agent-app-wizard.models.ts | 26 + .../agent-profile-wizard.component.html | 68 +- .../agent-profile-wizard.component.scss | 27 +- .../wizard/agent-profile-wizard.component.ts | 21 +- .../edge-instructions-dialog.component.html | 48 +- .../edge-instructions-dialog.component.scss | 18 +- .../modules/home/pages/edge/edge.component.ts | 33 +- .../pages/edge/edges-table-config.resolver.ts | 16 +- ui-ngx/src/styles.scss | 10 - 64 files changed, 1293 insertions(+), 1569 deletions(-) create mode 100644 ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-wizard-dialog.ts delete mode 100644 ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-wizard.component.scss create mode 100644 ui-ngx/src/app/modules/home/pages/agent/wizard/agent-app-profile-wizard-dialog.ts diff --git a/ui-ngx/src/app/modules/home/components/agent/_agent-shared.scss b/ui-ngx/src/app/modules/home/components/agent/_agent-shared.scss index c44b7923e8..3daf483b7f 100644 --- a/ui-ngx/src/app/modules/home/components/agent/_agent-shared.scss +++ b/ui-ngx/src/app/modules/home/components/agent/_agent-shared.scss @@ -93,10 +93,11 @@ $agent-type-generic-fg: #6a1b9a; display: flex; align-items: center; justify-content: space-between; + gap: 16px; padding: 4px 0; font-size: 13px; - .label { color: $agent-text-secondary; } - .value { color: $agent-text-primary; font-weight: 500; } + .label { flex: none; color: $agent-text-secondary; } + .value { min-width: 0; color: $agent-text-primary; font-weight: 500; text-align: right; overflow-wrap: anywhere; } } } diff --git a/ui-ngx/src/app/modules/home/components/agent/agent-deploy-status.component.scss b/ui-ngx/src/app/modules/home/components/agent/agent-deploy-status.component.scss index 231d0ac663..d4c26d1fe8 100644 --- a/ui-ngx/src/app/modules/home/components/agent/agent-deploy-status.component.scss +++ b/ui-ngx/src/app/modules/home/components/agent/agent-deploy-status.component.scss @@ -21,6 +21,12 @@ border: 1px solid $agent-divider-light; border-radius: 10px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03); + + @media #{$mat-lt-sm} { + flex-wrap: wrap; + gap: 12px 16px; + padding: 16px; + } } .tb-deploy-card-icon { @@ -33,11 +39,22 @@ justify-content: center; background: color-mix(in srgb, var(--tb-primary-500) 14%, transparent); + @media #{$mat-lt-sm} { + width: 44px; + height: 44px; + } + mat-icon { color: var(--tb-primary-600, var(--tb-primary-500)); font-size: 32px; width: 32px; height: 32px; + + @media #{$mat-lt-sm} { + font-size: 24px; + width: 24px; + height: 24px; + } } } @@ -58,6 +75,10 @@ font-size: 20px; font-weight: 600; color: $agent-text-primary; + + @media #{$mat-lt-sm} { + font-size: 17px; + } } .tb-deploy-card-desc { @@ -85,6 +106,13 @@ align-items: flex-end; gap: 6px; flex-shrink: 0; + + @media #{$mat-lt-sm} { + flex-direction: row; + flex-wrap: wrap; + align-items: center; + width: 100%; + } } .tb-deploy-pill { @@ -181,6 +209,10 @@ transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; text-align: left; + @media #{$mat-lt-sm} { + padding: 16px; + } + &:hover { border-color: color-mix(in srgb, var(--tb-primary-500) 40%, transparent); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); diff --git a/ui-ngx/src/app/modules/home/components/agent/component/agent-compose-diff.component.scss b/ui-ngx/src/app/modules/home/components/agent/component/agent-compose-diff.component.scss index 891f4f85a5..426cfa045e 100644 --- a/ui-ngx/src/app/modules/home/components/agent/component/agent-compose-diff.component.scss +++ b/ui-ngx/src/app/modules/home/components/agent/component/agent-compose-diff.component.scss @@ -8,7 +8,7 @@ tb-agent-compose-diff { .diff-viewer { position: relative; overflow: hidden; - height: clamp(220px, calc(85vh - 280px), 520px); + height: clamp(220px, calc(75vh - 240px), 520px); width: 100%; .acediff__wrap { @@ -32,7 +32,7 @@ tb-agent-compose-diff { .ace_editor { font-family: $agent-mono-font !important; } - .ace_gutter { width: 44px !important; background: #f5f5f5; color: rgba(0, 0, 0, 0.42); } + .ace_gutter { width: 44px !important; background: $agent-surface-soft; color: $agent-ink-42; } .ace_gutter-layer { width: 44px !important; } .acediff__right .ace_gutter { diff --git a/ui-ngx/src/app/modules/home/components/agent/component/agent-compose-diff.component.ts b/ui-ngx/src/app/modules/home/components/agent/component/agent-compose-diff.component.ts index 216ceb2e4e..c5495ca4a2 100644 --- a/ui-ngx/src/app/modules/home/components/agent/component/agent-compose-diff.component.ts +++ b/ui-ngx/src/app/modules/home/components/agent/component/agent-compose-diff.component.ts @@ -221,15 +221,20 @@ export class AgentComposeDiffComponent implements AfterViewInit, OnChanges, OnDe requestAnimationFrame(() => this.whenReady(cb, frames - 1)); } - private scheduleRebuild(): void { + private scheduleRebuild(frames = 60): void { if (this.rebuildHandle != null || this.destroyed) { return; } this.rebuildHandle = requestAnimationFrame(() => { this.rebuildHandle = null; - if (!this.destroyed) { - this.build(); + if (this.destroyed) { + return; } + if (this.differ && !this.ready && frames > 0) { + this.scheduleRebuild(frames - 1); + return; + } + this.build(); }); } diff --git a/ui-ngx/src/app/modules/home/components/agent/component/agent-compose-editor.component.scss b/ui-ngx/src/app/modules/home/components/agent/component/agent-compose-editor.component.scss index a4c87845ac..38a3946a9a 100644 --- a/ui-ngx/src/app/modules/home/components/agent/component/agent-compose-editor.component.scss +++ b/ui-ngx/src/app/modules/home/components/agent/component/agent-compose-editor.component.scss @@ -8,7 +8,7 @@ tb-agent-compose-editor { .yaml-editor { width: 100%; box-sizing: border-box; padding: 12px 14px; border: 1px solid $agent-divider; border-radius: 4px; - background: $agent-surface-muted; color: #1f2328; + background: $agent-surface-muted; color: $agent-editor-fg; font-family: $agent-mono-font; font-size: 12px; line-height: 1.55; letter-spacing: 0; tab-size: 2; -moz-tab-size: 2; @@ -16,7 +16,7 @@ tb-agent-compose-editor { .yaml-editor-ace { padding: 0; - height: clamp(220px, calc(85vh - 280px), 520px); + height: clamp(220px, calc(75vh - 240px), 520px); overflow: hidden; overscroll-behavior: contain; .ace_editor { @@ -28,6 +28,6 @@ tb-agent-compose-editor { .ace_content { overscroll-behavior: contain; } - .ace_gutter { background: #f5f5f5; color: rgba(0, 0, 0, 0.42); } + .ace_gutter { background: $agent-surface-soft; color: $agent-ink-42; } } } diff --git a/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.html b/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.html index 88855e5893..99b0e1a1c5 100644 --- a/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.html @@ -4,18 +4,17 @@ SPDX-License-Identifier: BUSL-1.1 --> - -
-

{{ titleKey | translate }}

-
+ +

{{ titleKey | translate }}

+
-
- -
- +
+ @@ -98,16 +97,6 @@ }
- - @@ -146,16 +135,30 @@ edge.auto-provision-no-script
} - - - +
+ @if (selectedIndex === 0) { +
+ +
+ + } +
+ + @if (selectedIndex > 0) { + + } +
+
diff --git a/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.scss b/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.scss index c3f58c4989..ffe68e19c0 100644 --- a/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.scss +++ b/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.scss @@ -2,14 +2,7 @@ // SPDX-License-Identifier: BUSL-1.1 @use '../wizard/agent-wizard' as *; -@include wizard-chrome; - -:host { - display: block; - width: min(800px, 95vw); - min-width: 0; - max-width: 95vw; -} +@include wizard-stepper-dialog(800px); .select-form { display: block; diff --git a/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.ts b/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.ts index a833397836..395f72bb99 100644 --- a/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.ts @@ -58,6 +58,7 @@ export class AgentAutoProvisionDialogComponent searchText = ''; loading = false; + selectedIndex = 0; @ViewChild('stepper', { static: false }) stepper: MatStepper; @ViewChild(MatAutocompleteTrigger) private autocompleteTrigger: MatAutocompleteTrigger; @@ -221,7 +222,7 @@ export class AgentAutoProvisionDialogComponent return this.dialog.open( AgentProfileAssignProfileDialogComponent, { disableClose: true, - panelClass: ['tb-dialog'], + panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-wide-dialog'], data: { selectedIds, lockedAppType: this.appType } } ).afterClosed(); diff --git a/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.service.ts b/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.service.ts index 4283ec6f50..30ab9e23c9 100644 --- a/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.service.ts +++ b/ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.service.ts @@ -20,7 +20,7 @@ export class AgentAutoProvisionDialogService { return this.dialog.open( AgentAutoProvisionDialogComponent, { disableClose: true, - panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'], + panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-wide-dialog'], data: { appType } } ).afterClosed(); diff --git a/ui-ngx/src/app/modules/home/components/agent/wizard/_agent-wizard.scss b/ui-ngx/src/app/modules/home/components/agent/wizard/_agent-wizard.scss index b1a57cfd06..85e0b73a8a 100644 --- a/ui-ngx/src/app/modules/home/components/agent/wizard/_agent-wizard.scss +++ b/ui-ngx/src/app/modules/home/components/agent/wizard/_agent-wizard.scss @@ -4,96 +4,76 @@ @forward '../agent-shared'; @use '../agent-shared' as *; -@mixin wizard-chrome { +@mixin wizard-dialog($width) { :host { - display: block; - width: min(1280px, 95vw); - min-width: 0; - max-width: 95vw; + height: 100%; + width: $width; + max-width: 100%; + display: grid; + grid-template-rows: min-content minmax(0, 1fr) min-content; + grid-template-columns: minmax(0, 1fr); } - .tb-install-wizard-toolbar { - display: flex; align-items: center; gap: 8px; - padding: 0 16px; - min-height: 56px; - .tb-install-wizard-toolbar-content { - flex: 1; min-width: 0; - display: flex; flex-direction: row; align-items: center; gap: 8px; - h2 { font-size: 20px; font-weight: 400; margin: 0; color: inherit; } - span { font-size: 20px; font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } + :host-context(.mat-mdc-dialog-container) { + @media #{$mat-gt-xs} { + max-height: calc(100vh - 32px); } - } - .tb-install-wizard-body.tb-install-wizard-embedded { - max-height: none !important; - overflow-y: visible !important; - padding: 8px 0 !important; - } + .mat-mdc-dialog-content { + overscroll-behavior: contain; - .tb-install-wizard-body { - // No vertical padding: the sticky stepper header sits flush at the top and the - // sticky footer flush at the bottom, with the content carrying its own spacing. - padding: 0 24px !important; - // Cap the dialog body to the viewport. Allow vertical scroll so tall step - // content (e.g. update/upgrade step 2 with config sections + summary card + - // info box + footer) can reach its buttons. The ace editors inside are - // clamped so they don't contribute unbounded height, and .acediff__wrap has - // its own overflow killed — so the only outer scrollbar that appears here - // is a legitimate chrome scroll when the step content genuinely overflows. - max-height: 85vh; - overflow-y: auto; - // Contain horizontal overscroll so two-finger trackpad swipes inside the - // ace editors / diff panes don't bubble up to the browser's back/forward - // page navigation. Also block vertical bounce from escaping the dialog. - overscroll-behavior: contain; + @media #{$mat-gt-xs} { + max-height: 75vh; + } + } } +} - :host ::ng-deep .mat-horizontal-stepper-wrapper { - margin-top: 0; - } +@mixin wizard-stepper-dialog($width) { + @include wizard-dialog($width); - :host ::ng-deep .mat-horizontal-stepper-header-container { - margin-top: 0; - // Keep the step indicators (1)…(N) pinned at the top while content scrolls. - position: sticky; - top: 0; - z-index: 5; - background: #fff; + :host { + .dialog-actions-row { + padding: 8px; + } } - :host ::ng-deep .mat-horizontal-stepper-header { - padding: 0 12px; - } + :host-context(.mat-mdc-dialog-container) { + .mat-mdc-dialog-content { + padding: 0; + scrollbar-gutter: stable; + } - :host ::ng-deep .mat-horizontal-content-container { - padding: 12px 0; - // Material defaults this to `overflow: hidden`, which makes it a scroll - // container and anchors the sticky `.step-footer` here (content height, so it - // never sticks). `clip` still clips the sliding steps but is NOT a scroll - // container, so the footer anchors to the scrolling `.tb-install-wizard-body`. - overflow: clip; - max-width: 100%; + .mat-mdc-dialog-actions { + padding: 0; + } } - :host-context(.tb-fullscreen-dialog .mat-mdc-dialog-container) { - max-width: 100%; + :host ::ng-deep { + .mat-horizontal-stepper-header-container { + position: sticky; + top: 0; + z-index: 5; + background: #fff; + } - .tb-install-wizard-body { - max-width: 100%; - overflow-x: hidden; + .mat-horizontal-content-container, + .mat-vertical-content { + padding-top: 4px; } - } - :host ::ng-deep .mat-step-header { - // Kill the hover/focus background — navigation works, but no visual fill. - &:hover, - &.cdk-program-focused, - &.cdk-mouse-focused, - &.cdk-focused { - background-color: transparent !important; + .mat-step-header { + &:hover, + &.cdk-program-focused, + &.cdk-mouse-focused, + &.cdk-focused { + background-color: transparent !important; + } } } +} +@mixin wizard-steps-locked { :host ::ng-deep .tb-steps-locked .mat-step-header[aria-selected="false"] { pointer-events: none; cursor: default; @@ -107,22 +87,6 @@ color: $agent-text-hint !important; } } - - .step-footer { - display: flex; align-items: center; justify-content: flex-end; gap: 8px; - padding: 12px 0; border-top: 1px solid $agent-divider-light; margin-top: 16px; - button mat-icon { font-size: 18px; width: 18px; height: 18px; } - } - - // Pin the footer to the bottom of the scrolling body so its action buttons stay - // visible while tall step content scrolls. Skipped in embedded mode, where the - // body doesn't scroll (the host dialog does) and a sticky footer would misbehave. - .tb-install-wizard-body:not(.tb-install-wizard-embedded) .step-footer { - position: sticky; - bottom: 0; - z-index: 15; - background: #fff; - } } @mixin wizard-step-basics { @@ -172,23 +136,20 @@ mat-icon { font-size: 36px; width: 36px; height: 36px; color: var(--tb-primary-500); margin-bottom: 8px; } h4 { font-size: 16px; font-weight: 500; margin: 0 0 4px; } p { font-size: 13px; color: $agent-text-secondary; margin: 0; } - } -} -@mixin wizard-yaml-editor { - // Defensive: also contain overscroll on the editor hosts themselves, so even - // if a swipe lands directly on an ace editor (not on the body), it won't be - // interpreted as page navigation. - .diff-viewer, - .yaml-editor-ace { - overscroll-behavior: contain; - ::ng-deep .ace_editor, - ::ng-deep .ace_scroller, - ::ng-deep .ace_content { - overscroll-behavior: contain; + @media #{$mat-lt-sm} { + display: grid; + grid-template-columns: 32px minmax(0, 1fr); + column-gap: 12px; + align-items: center; + padding: 12px 16px; + text-align: left; + mat-icon { grid-row: span 2; font-size: 32px; width: 32px; height: 32px; margin: 0; } } } +} +@mixin wizard-yaml-editor { .tb-compose-panel { box-shadow: none !important; border: 1px solid $agent-divider; @@ -198,33 +159,6 @@ } } - .yaml-editor { - width: 100%; box-sizing: border-box; padding: 12px 14px; - border: 1px solid $agent-divider; border-radius: 4px; - background: $agent-surface-muted; color: $agent-editor-fg; - font-family: $agent-mono-font; - font-size: 12px; line-height: 1.55; letter-spacing: 0; - tab-size: 2; -moz-tab-size: 2; - resize: vertical; - &:focus { - outline: none; border-color: var(--tb-primary-400); - box-shadow: 0 0 0 3px color-mix(in srgb, var(--tb-primary-400) 15%, transparent); - } - } - - // Ace-backed single editor (install mode and detail view) sits in the same - // .yaml-editor box but needs padding removed and a fixed height for ace layout. - .yaml-editor-ace { - padding: 0; - height: clamp(220px, calc(85vh - 280px), 520px); - overflow: hidden; - ::ng-deep .ace_editor { - font-family: $agent-mono-font !important; - background: transparent; - } - ::ng-deep .ace_gutter { background: $agent-surface-soft; color: $agent-ink-42; } - } - .pull-images { display: block; margin-top: 12px; } // Compact, content-width toggle (Material defaults the group to full width). @@ -283,6 +217,8 @@ .diff-header { flex: 1 1 50%; box-sizing: border-box; padding: 8px 12px; font-size: 12px; font-weight: 500; letter-spacing: 0.3px; + min-width: 0; overflow-wrap: anywhere; + @media #{$mat-lt-sm} { padding: 6px 8px; font-size: 11px; } & + .diff-header { border-left: 1px solid $agent-divider; padding-right: 36px; } &.added { background: $agent-success-surface; color: $agent-color-success-dark; } &.removed { background: #fce4ec; color: $agent-color-error-dark; } @@ -350,102 +286,6 @@ } } - .diff-viewer { - position: relative; - overflow: hidden; - // Fit within the wizard body (which no longer scrolls). Chrome above/below - // the editor (toolbar + stepper header + name field + footer + padding) is - // roughly 280px; the clamp floors at 220px so very short viewports still - // show a usable editor and cap at 520px on large displays. - height: clamp(220px, calc(85vh - 280px), 520px); - width: 100%; - - // ace-diff ships with `.acediff__wrap { overflow: auto }`. That creates an - // extra scrollbar wrapping the two editors + center gutter — the outer - // scrollbar the user sees. Force it hidden; each ace editor has its own - // internal scrollbar for the YAML content and that's the only one we want. - ::ng-deep .acediff__wrap { - overflow: hidden !important; - } - border: 1px solid $agent-divider; - border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; - background: $agent-surface-muted; - - // ace-diff overrides: narrow center gutter, unified monospace styling, tight gutters. - // flex: 0 0 60px is ace-diff's default — must override flex-basis, not just width, - // otherwise the element stays 60px and its grey background leaks around the arrows. - ::ng-deep .acediff__gutter { - flex: 0 0 40px !important; - width: 40px !important; - background: #ffffff !important; - border-left: 1px solid $agent-divider-light !important; - border-right: 1px solid $agent-divider-light !important; - overflow: visible !important; - contain: layout paint style; - will-change: transform; - svg { width: 40px !important; background: transparent !important; } - } - ::ng-deep .ace_editor { - font-family: $agent-mono-font !important; - } - ::ng-deep .ace_gutter { width: 44px !important; background: $agent-surface-soft; color: $agent-ink-42; } - ::ng-deep .ace_gutter-layer { width: 44px !important; } - - // Flip the right pane's gutter to the right edge. Ace lays out .ace_gutter - // and .ace_scroller with absolute positioning (gutter: left 0; scroller: left - // ). Overriding both moves the line numbers against the outer - // edge of the right pane, mirroring the left pane — numbers end up hugging - // both outside edges, with code meeting in the middle at the copy arrows. - ::ng-deep .acediff__right .ace_gutter { - left: auto !important; - right: 0 !important; - border-left: 1px solid $agent-divider-light; - } - ::ng-deep .acediff__right .ace_scroller { - left: 0 !important; - right: 44px !important; - } - ::ng-deep .acediff__right .ace_scrollbar-v { - right: 44px !important; - } - - // Hide the LEFT pane's vertical scrollbar — it overlaps the center gutter and - // covers ace-diff's copy-arrow circles. ace-diff keeps both editors scroll- - // synced internally, and the right pane still shows its own scrollbar, so - // vertical scrolling remains available via mouse wheel / right-side thumb. - ::ng-deep .acediff__left .ace_scrollbar, - ::ng-deep .acediff__left .ace_scrollbar-v { - display: none !important; - width: 0 !important; - } - // Pull the left pane's scroller flush to its right edge so no blank strip - // remains where the scrollbar used to sit. - ::ng-deep .acediff__left .ace_scroller { - right: 0 !important; - } - // Raise the entire center gutter above the panes so nothing from either - // editor can occlude the copy-arrow SVGs. - ::ng-deep .acediff__gutter { - z-index: 10; - } - ::ng-deep .acediff__gutter svg, - ::ng-deep .acediff__copy { - z-index: 11; - position: relative; - } - // The connector SVG paints over the copy arrows and swallows clicks. - // Make the whole gutter SVG click-through so the copy arrow
s stay hit-testable. - ::ng-deep .acediff__gutter svg { pointer-events: none !important; } - ::ng-deep .acediff__copy, - ::ng-deep .acediff__copy--left, - ::ng-deep .acediff__copy--right, - ::ng-deep .acediff__copy--left div, - ::ng-deep .acediff__copy--right div { - pointer-events: auto !important; - z-index: 12 !important; - } - } - .diff-hint { font-size: 12px; color: $agent-text-secondary; margin: 6px 0 0; } diff --git a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.html b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.html index a99468da7f..de4faf9639 100644 --- a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.html +++ b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.html @@ -5,28 +5,33 @@ --> @if (!embedded) { - + @if (showBack) { - } -
-

{{ 'agent.app-install-title' | translate }}@if (agent) {:}

- @if (agent) { - - {{ 'agent.app-install-on-agent' | translate: { name: agent?.name } }} - - } -
+

{{ 'agent.app-install-title' | translate }}@if (agent) {: {{ 'agent.app-install-on-agent' | translate: { name: agent?.name } }}}

+
-
} +@if (embedded) { + + +} @else { +
+ +
+
+ +
+} -
+ @if (checkingManaged) {
@@ -35,7 +40,7 @@ } @if (!checkingManaged && managedApp) { -
+
-
} @if (selectAgent && !embedded && !checkingManaged && !managedApp) { -
+
info_outline agent.deploy-via-agent-desc
@@ -62,302 +61,292 @@ @if (!checkingManaged && !managedApp) { - @if (selectAgent) { - -

agent.deploy-intro

- - - -
- } - @if (!lockedType) { - -

agent.app-install-pick-type

-
- @for (card of typeCards; track card.type) { - - } -
- @if (loadingTemplate) { -
- - agent.app-install-loading-template -
+ @for (step of steps; track step) { + @switch (step) { + @case ('agent') { + +

agent.deploy-intro

+ + +
} - @if (loadError) { -
- error_outline - {{ loadError }} -
+ @case ('type') { + +

agent.app-install-pick-type

+
+ @for (card of typeCards; track card.type) { + + } +
+ @if (loadingTemplate) { +
+ + agent.app-install-loading-template +
+ } + @if (loadError) { +
+ error_outline + {{ loadError }} +
+ } +
} - -
- } - -
- - {{ 'agent.app-install-from-profile' | translate }} - {{ 'agent.app-install-custom-config' | translate }} - -
- - agent.app-install-name - - - @if (canHaveRelatedEntity) { - - - } - @if (useProfile && typesWithoutTemplates.has(selectedType)) { -
- warning_amber - agent.app-no-templates -
- } - @if (useProfile) { - - agent.app-install-select-profile - - @if (profileSelectFormGroup.get('profile').value) { - - } - @if (!profileSelectFormGroup.get('profile').value && canCreateProfileForType) { - - } - - @if (filteredProfiles | async; as profiles) { - @for (p of profiles; track trackKey(p)) { - - {{ p.name }} - @if (isVirtualProfile(p)) { - {{ 'agent.app-install-virtual-profile-badge' | translate }} - } - @if (!isVirtualProfile(p) && p.templateVersion) { - {{ profileTemplateLabel(p) }} + @case ('config') { + +
+ + {{ 'agent.app-install-from-profile' | translate }} + {{ 'agent.app-install-custom-config' | translate }} + +
+ + agent.app-install-name + + + @if (canHaveRelatedEntity) { + + + } + @if (useProfile && typesWithoutTemplates.has(selectedType)) { +
+ warning_amber + agent.app-no-templates +
+ } + @if (useProfile) { + + agent.app-install-select-profile + + @if (profileSelectFormGroup.get('profile').value) { + + } + @if (!profileSelectFormGroup.get('profile').value && canCreateProfileForType) { + + } + + @if (filteredProfiles | async; as profiles) { + @for (p of profiles; track trackKey(p)) { + + {{ p.name }} + @if (isVirtualProfile(p)) { + {{ 'agent.app-install-virtual-profile-badge' | translate }} + } + @if (!isVirtualProfile(p) && p.templateVersion) { + {{ profileTemplateLabel(p) }} + } + + } + @if (!profiles.length) { + +
+ agent.app-install-no-profiles +
+
+ } } -
+
+
+ } + @if (loadingProfiles) { +
+ + agent.app-install-loading-template +
+ } + + @if (useProfile && selectedProfile && !isVirtualProfile(selectedProfile)) { +
+ +
+ } + @if (useProfile && selectedProfile) { + + + agent.app-install-yaml + + + + + + } + @if (mergeError) { +
+ error_outline + {{ mergeError }} +
+ } + @if (!useProfile && !template && loadError) { +
+ error_outline + {{ loadError }} +
+ } @else if (!useProfile) { + @if (composeTypeKeys.length > 1) { + + agent.app-compose-template-select + + @for (key of composeTypeKeys; track key) { + + {{ composeTypeLabel(key) }} + + } + + } - @if (!profiles.length) { - -
- agent.app-install-no-profiles -
-
+ @if (relatedEntityId) { +
+ info_outline + agent.app-compose-creds-overridden-hint +
} +
+
agent.app-install-diff-template
+
agent.app-install-diff-editable
+ +
+ +

agent.app-install-diff-hint

} - - - } - @if (loadingProfiles) { -
- - agent.app-install-loading-template -
- } - - @if (useProfile && selectedProfile && !isVirtualProfile(selectedProfile)) { -
- -
- } - @if (useProfile && selectedProfile) { - - - agent.app-install-yaml - - - - - - } - @if (mergeError) { -
- error_outline - {{ mergeError }} -
- } - @if (!useProfile && !template && loadError) { -
- error_outline - {{ loadError }} -
- } @else if (!useProfile) { - @if (composeTypeKeys.length > 1) { - - agent.app-compose-template-select - - @for (key of composeTypeKeys; track key) { - - {{ composeTypeLabel(key) }} - +
+ } + @case ('summary') { + +
+
+ agent.app-name + {{ appName }} +
+
+ agent.app-type + {{ selectedType }} +
+ @if (template) { +
+ agent.app-template + {{ template.appType }} {{ template.currentVersion }} +
} - - + @if (useProfile && selectedProfile) { +
+ agent.app-install-select-profile + {{ selectedProfile.name }} +
+ } + @if (agent) { +
+ agent.agents + {{ agent.name }} +
+ } +
+
+ info_outline + agent.app-install-confirm-info +
+
} - @if (relatedEntityId) { -
- info_outline - agent.app-compose-creds-overridden-hint -
+ @case ('deploy') { + + + + } -
-
agent.app-install-diff-template
-
agent.app-install-diff-editable
- -
- -

agent.app-install-diff-hint

} - - - -
-
- agent.app-name - {{ appName }} -
-
- agent.app-type - {{ selectedType }} -
- @if (template) { -
- agent.app-template - {{ template.appType }} {{ template.currentVersion }} -
- } - @if (useProfile && selectedProfile) { -
- agent.app-install-select-profile - {{ selectedProfile.name }} -
- } - @if (agent) { -
- agent.agents - {{ agent.name }} -
- } -
-
- info_outline - agent.app-install-confirm-info -
- -
- @if (selectAgent) { - - - - - }
} -
+ + + + @if (!checkingManaged && !managedApp && (canGoBack() || showNext())) { +
+ @if (canGoBack()) { + + } + + @if (showNext()) { + + } +
+ @if (!embedded || canInstall()) { + + } + } + @if (!embedded || canInstall()) { +
+ @if (!embedded) { + + } + @if (canInstall()) { + + } +
+ } +
diff --git a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.scss b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.scss index 1af432721a..95d4951c34 100644 --- a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.scss +++ b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.scss @@ -2,10 +2,18 @@ // SPDX-License-Identifier: BUSL-1.1 @use 'agent-wizard' as *; -@include wizard-chrome; +@include wizard-stepper-dialog(1280px); @include wizard-step-basics; @include wizard-type-cards; @include wizard-yaml-editor; @include wizard-diff; @include wizard-summary; @include agent-virtual-profile-badge; +@include wizard-steps-locked; + +:host(.tb-embedded) { + display: block; + width: auto; + height: auto; + max-height: none; +} diff --git a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.ts b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.ts index 4e42694692..ece77cd194 100644 --- a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.ts +++ b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.ts @@ -38,22 +38,28 @@ import { buildVirtualAppProfiles, VIRTUAL_APP_TYPES } from '@home/pages/agent/util/virtual-app-profiles'; -import { - AgentAppProfileWizardComponent, - AgentAppProfileWizardData -} from '@home/pages/agent/wizard/agent-app-profile-wizard.component'; +import { openAgentAppProfileWizard } from '@home/pages/agent/wizard/agent-app-profile-wizard-dialog'; import { UserPermissionsService } from '@core/http/user-permissions.service'; import { Operation, Resource } from '@shared/models/security.models'; import { AgentAppWizardLoaderService } from '@home/pages/agent/wizard/agent-app-wizard-loader.service'; import { AgentAppWizardSubmitService } from '@home/pages/agent/wizard/agent-app-wizard-submit.service'; -import { AgentAppUpgradeResult, AgentAppWizardFinish, AgentTypeCard } from '@home/pages/agent/wizard/agent-app-wizard.models'; +import { + AGENT_APP_INSTALL_STEP_LABELS, + AgentAppInstallStepKey, + AgentAppUpgradeResult, + AgentAppWizardFinish, + AgentTypeCard +} from '@home/pages/agent/wizard/agent-app-wizard.models'; import { EdgeTemplateCompatibilityService } from '@home/pages/agent/util/edge-template-compatibility.service'; @Component({ selector: 'tb-agent-app-install-flow', templateUrl: './agent-app-install-flow.component.html', styleUrls: ['./agent-app-install-flow.component.scss'], - standalone: false + standalone: false, + host: { + '[class.tb-embedded]': 'embedded' + } }) export class AgentAppInstallFlowComponent extends PageComponent implements OnInit { @@ -82,6 +88,9 @@ export class AgentAppInstallFlowComponent extends PageComponent implements OnIni @ViewChild('stepper', { static: false }) stepper: MatStepper; + readonly stepLabels = AGENT_APP_INSTALL_STEP_LABELS; + steps: AgentAppInstallStepKey[] = []; + selectedIndex = 0; bindings: StepBinding[] = []; @@ -207,6 +216,7 @@ export class AgentAppInstallFlowComponent extends PageComponent implements OnIni } ngOnInit() { + this.steps = this.buildSteps(); this.relatedEntityId = this.lockedRelatedEntity || null; if (this.selectAgent && this.lockedRelatedEntity?.id && this.lockedRelatedEntity?.entityType) { this.checkingManaged = true; @@ -402,12 +412,7 @@ export class AgentAppInstallFlowComponent extends PageComponent implements OnIni const appType = this.selectedType || this.lockedType; if (!appType) { return; } const presetName = this.relatedEntityName ? `${this.relatedEntityName} profile` : undefined; - this.dialog.open( - AgentAppProfileWizardComponent, { - disableClose: true, - panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'], - data: { lockedAppType: appType, presetName } - }).afterClosed().subscribe(saved => { + openAgentAppProfileWizard(this.dialog, { lockedAppType: appType, presetName }).subscribe(saved => { if (saved) { this.availableProfiles = [ ...this.availableProfiles.filter(p => !(isVirtualAppProfile(p) && p.templateVersion === saved.templateVersion)), @@ -421,12 +426,7 @@ export class AgentAppInstallFlowComponent extends PageComponent implements OnIni openEditProfile() { if (!this.selectedProfile || isVirtualAppProfile(this.selectedProfile)) { return; } - this.dialog.open( - AgentAppProfileWizardComponent, { - disableClose: true, - panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'], - data: { profile: this.selectedProfile } - }).afterClosed().subscribe(saved => { + openAgentAppProfileWizard(this.dialog, { profile: this.selectedProfile }).subscribe(saved => { if (saved) { this.availableProfiles = this.availableProfiles.map(p => p.id?.id === saved.id?.id ? saved : p); this.cacheRealProfiles(saved.appType); @@ -731,4 +731,55 @@ export class AgentAppInstallFlowComponent extends PageComponent implements OnIni cancel() { this.cancelled.emit(null); } + + currentStep(): AgentAppInstallStepKey | undefined { + return this.steps[this.selectedIndex]; + } + + canGoBack(): boolean { + return this.selectedIndex > 0 && !this.installedApplication; + } + + canInstall(): boolean { + return !this.checkingManaged && !this.managedApp && !this.installedApplication; + } + + showNext(): boolean { + const hasNext = this.selectedIndex < this.steps.length - 1; + return hasNext && (this.currentStep() !== 'summary' || !!this.installedApplication); + } + + canGoNext(): boolean { + switch (this.currentStep()) { + case 'agent': + return this.canProceedFromAgent(); + case 'type': + return this.canProceedFromType(); + case 'config': + return this.canSubmit(); + case 'summary': + return !!this.installedApplication; + default: + return false; + } + } + + nextStepLabel(): string { + return this.stepLabels[this.steps[this.selectedIndex + 1]] ?? ''; + } + + private buildSteps(): AgentAppInstallStepKey[] { + const keys: AgentAppInstallStepKey[] = []; + if (this.selectAgent) { + keys.push('agent'); + } + if (!this.lockedType) { + keys.push('type'); + } + keys.push('config', 'summary'); + if (this.selectAgent) { + keys.push('deploy'); + } + return keys; + } } diff --git a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-wizard-dialog.ts b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-wizard-dialog.ts new file mode 100644 index 0000000000..c4d6a400fd --- /dev/null +++ b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-wizard-dialog.ts @@ -0,0 +1,22 @@ +// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. +// SPDX-License-Identifier: BUSL-1.1 +import { MatDialog } from '@angular/material/dialog'; +import { Observable } from 'rxjs'; +import { + AgentAppInstallWizardComponent, + AgentAppInstallWizardData, + AgentAppInstallWizardResult +} from '@home/components/agent/wizard/agent-app-install-wizard.component'; + +export function openAgentAppInstallWizard( + dialog: MatDialog, + data: AgentAppInstallWizardData +): Observable { + return dialog.open( + AgentAppInstallWizardComponent, { + disableClose: false, + panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-wide-dialog'], + data + } + ).afterClosed(); +} diff --git a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-wizard.component.scss b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-wizard.component.scss deleted file mode 100644 index d662554d66..0000000000 --- a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-wizard.component.scss +++ /dev/null @@ -1,5 +0,0 @@ -// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. -// SPDX-License-Identifier: BUSL-1.1 -@use 'agent-wizard' as *; - -@include wizard-chrome; diff --git a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-wizard.component.ts b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-wizard.component.ts index 6b74694329..2a95ed1705 100644 --- a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-wizard.component.ts +++ b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-wizard.component.ts @@ -47,7 +47,6 @@ export { isAgentAppUpgradeResult } from '@home/pages/agent/wizard/agent-app-wiza @Component({ selector: 'tb-agent-app-install-wizard', templateUrl: './agent-app-install-wizard.component.html', - styleUrls: ['./agent-app-install-wizard.component.scss'], standalone: false, providers: [AgentAppWizardLoaderService, AgentAppWizardSubmitService] }) diff --git a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-update-flow.component.html b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-update-flow.component.html index 46c50b18b7..6f42c808d0 100644 --- a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-update-flow.component.html +++ b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-update-flow.component.html @@ -5,36 +5,28 @@ --> @if (!embedded) { - + @if (showBack) { - } -
-

{{ 'agent.app-update-wizard-title' | translate }}@if (existingApplication) { - : - }

- @if (existingApplication) { - - {{ 'agent.app-update-on-app' | translate: { name: existingApplication?.name } }} - - } -
+

{{ 'agent.app-update-wizard-title' | translate }}@if (existingApplication) {: {{ 'agent.app-update-on-app' | translate: { name: existingApplication?.name } }}}

+
-
} - -
+
- + agent.app-install-name @@ -124,13 +116,6 @@

agent.app-update-compare-hint

} - -
@@ -171,18 +156,33 @@ info_outline agent.app-install-confirm-info
- -
+
+
+ @if (selectedIndex > 0) { + + } + + @if (selectedIndex === 0) { + + } +
+ +
+ + +
+
diff --git a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-update-flow.component.scss b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-update-flow.component.scss index 29da806e40..a5d3ab398a 100644 --- a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-update-flow.component.scss +++ b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-update-flow.component.scss @@ -2,7 +2,7 @@ // SPDX-License-Identifier: BUSL-1.1 @use 'agent-wizard' as *; -@include wizard-chrome; +@include wizard-stepper-dialog(1280px); @include wizard-step-basics; @include wizard-config-section; @include wizard-diff; diff --git a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-update-flow.component.ts b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-update-flow.component.ts index 83dc7275e8..481316fb06 100644 --- a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-update-flow.component.ts +++ b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-update-flow.component.ts @@ -23,10 +23,7 @@ import { buildStepInputs, createStepBinding, StepBinding } from '@home/pages/age import { buildUpdateApplication } from '@home/pages/agent/util/agent-app-payloads'; import { buildUpdateMergeDraft } from '@home/pages/agent/util/agent-app-compose-preview'; import { composeTemplateKeys, composeTypeLabelKey, dumpCompose, pickComposeType } from '@home/pages/agent/util/agent-compose-yaml'; -import { - AgentAppProfileWizardComponent, - AgentAppProfileWizardData -} from '@home/pages/agent/wizard/agent-app-profile-wizard.component'; +import { openAgentAppProfileWizard } from '@home/pages/agent/wizard/agent-app-profile-wizard-dialog'; import { AgentAppWizardLoaderService } from '@home/pages/agent/wizard/agent-app-wizard-loader.service'; import { AgentAppWizardSubmitService } from '@home/pages/agent/wizard/agent-app-wizard-submit.service'; import { AgentAppUpgradeResult, AgentAppWizardFinish } from '@home/pages/agent/wizard/agent-app-wizard.models'; @@ -52,6 +49,8 @@ export class AgentAppUpdateFlowComponent extends PageComponent implements OnInit @Output() cancelled = new EventEmitter(); @Output() back = new EventEmitter(); + selectedIndex = 0; + bindings: StepBinding[] = []; proposedYaml = ''; @@ -237,12 +236,7 @@ export class AgentAppUpdateFlowComponent extends PageComponent implements OnInit openEditProfile() { if (!this.profileForCompare) { return; } - this.dialog.open( - AgentAppProfileWizardComponent, { - disableClose: true, - panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'], - data: { profile: this.profileForCompare } - }).afterClosed().subscribe(saved => { + openAgentAppProfileWizard(this.dialog, { profile: this.profileForCompare }).subscribe(saved => { if (saved) { this.profileForCompare = saved; this.refreshFutureCompare(); diff --git a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-upgrade-flow.component.html b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-upgrade-flow.component.html index aba02480fa..bf7cfeb2e2 100644 --- a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-upgrade-flow.component.html +++ b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-upgrade-flow.component.html @@ -5,30 +5,21 @@ --> @if (!embedded) { - + @if (showBack) { - } -
-

{{ 'agent.app-upgrade-title' | translate }}@if (existingApplication) { - : - }

- @if (existingApplication) { - - {{ 'agent.app-upgrade-heading' | translate: { name: existingApplication?.name, from: fromVersion || '—', to: toVersion || '—' } }} - - } -
+

{{ 'agent.app-upgrade-title' | translate }}@if (existingApplication) {: {{ 'agent.app-upgrade-heading' | translate: { name: existingApplication?.name, from: fromVersion || '—', to: toVersion || '—' } }}}

+
-
} - -
+
@if (loadingTemplate || loadingProfile) {
@@ -45,143 +36,154 @@ @if (!(loadingTemplate || loadingProfile || loadError)) { - @if (showProfileUpgradeStep) { - - @if (loadingProfile) { -
- - agent.app-upgrade-profile-loading -
+ @for (step of steps; track step) { + @switch (step) { + @case ('profile') { + + @if (loadingProfile) { +
+ + agent.app-upgrade-profile-loading +
+ } + @if (!loadingProfile && profileLoadError) { +
+ error_outline + {{ profileLoadError }} +
+ } + @if (!loadingProfile && !profileLoadError && profile && template) { +
+
+ agent.app-upgrade-profile-name + {{ profile.name }} +
+
+ agent.app-upgrade-summary-versions + {{ fromVersion || '—' }} → {{ toVersion || '—' }} +
+
+

agent.app-upgrade-profile-hint

+
+
+ {{ 'agent.app-upgrade-template-new' | translate: { version: toVersion || '—' } }} +
+
agent.app-upgrade-profile-current
+ @if (profileUpgraded) { +
+ lock + agent.app-diff-read-only +
+ } + +
+ +

agent.app-upgrade-diff-hint

+ } +
} - @if (!loadingProfile && profileLoadError) { -
- error_outline - {{ profileLoadError }} -
+ @case ('config') { + + @if (canHaveRelatedEntity && isProfileBoundUpgrade) { + + + } + + @if (!isProfileBoundUpgrade) { +
+
+ {{ 'agent.app-upgrade-template-new' | translate: { version: toVersion || '—' } }} +
+
agent.app-upgrade-current
+ +
+ +

agent.app-upgrade-diff-hint

+ } +
} - @if (!loadingProfile && !profileLoadError && profile && template) { -
-
- agent.app-upgrade-profile-name - {{ profile.name }} -
-
- agent.app-upgrade-summary-versions - {{ fromVersion || '—' }} → {{ toVersion || '—' }} + @case ('summary') { + +
+
+ agent.app-name + {{ appName }} +
+
+ agent.app-upgrade-summary-versions + {{ fromVersion || '—' }} → {{ toVersion || '—' }} +
+ @if (hasBackupVolumeInput) { +
+ agent.app-upgrade-summary-volumes-label + + {{ 'agent.app-upgrade-summary-volumes' | translate: { count: selectedBackupVolumeCount } }} + +
+ }
-
-

agent.app-upgrade-profile-hint

-
-
- {{ 'agent.app-upgrade-template-new' | translate: { version: toVersion || '—' } }} +
+ info_outline + agent.app-upgrade-rollback-info
-
agent.app-upgrade-profile-current
- @if (profileUpgraded) { -
- lock - agent.app-diff-read-only -
- } - -
- -

agent.app-upgrade-diff-hint

+ } - - - } - - @if (canHaveRelatedEntity && isProfileBoundUpgrade) { - - - } - - @if (!isProfileBoundUpgrade) { -
-
- {{ 'agent.app-upgrade-template-new' | translate: { version: toVersion || '—' } }} -
-
agent.app-upgrade-current
- -
- -

agent.app-upgrade-diff-hint

} - -
- -
-
- agent.app-name - {{ appName }} -
-
- agent.app-upgrade-summary-versions - {{ fromVersion || '—' }} → {{ toVersion || '—' }} -
- @if (hasBackupVolumeInput) { -
- agent.app-upgrade-summary-volumes-label - - {{ 'agent.app-upgrade-summary-volumes' | translate: { count: selectedBackupVolumeCount } }} - -
- } -
-
- info_outline - agent.app-upgrade-rollback-info -
- -
+ } }
+
+ @if (canGoBack() || showNext()) { +
+ @if (canGoBack()) { + + } + + @if (showNext()) { + + } +
+ + } +
+ + @if (currentStep() === 'profile' && !profileUpgraded) { + + } @else { + + } +
+
diff --git a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-upgrade-flow.component.scss b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-upgrade-flow.component.scss index fcbe6cb001..d3ab782e2b 100644 --- a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-upgrade-flow.component.scss +++ b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-upgrade-flow.component.scss @@ -2,7 +2,7 @@ // SPDX-License-Identifier: BUSL-1.1 @use 'agent-wizard' as *; -@include wizard-chrome; +@include wizard-stepper-dialog(1280px); @include wizard-step-basics; @include wizard-diff; @include wizard-summary; diff --git a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-upgrade-flow.component.ts b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-upgrade-flow.component.ts index 12a0e21ae7..133567985a 100644 --- a/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-upgrade-flow.component.ts +++ b/ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-upgrade-flow.component.ts @@ -29,7 +29,12 @@ import { ActionNotificationShow } from '@core/notification/notification.actions' import * as YAML from 'yaml'; import { AgentAppWizardLoaderService } from '@home/pages/agent/wizard/agent-app-wizard-loader.service'; import { AgentAppWizardSubmitService } from '@home/pages/agent/wizard/agent-app-wizard-submit.service'; -import { AgentAppUpgradeResult, AgentAppWizardFinish } from '@home/pages/agent/wizard/agent-app-wizard.models'; +import { + AGENT_APP_UPGRADE_STEP_LABELS, + AgentAppUpgradeResult, + AgentAppUpgradeStepKey, + AgentAppWizardFinish +} from '@home/pages/agent/wizard/agent-app-wizard.models'; @Component({ selector: 'tb-agent-app-upgrade-flow', @@ -65,10 +70,11 @@ export class AgentAppUpgradeFlowComponent extends PageComponent implements OnIni profileLoadError = ''; profileUpgrading = false; profileUpgraded = false; - showProfileUpgradeStep = false; - @ViewChild('stepper', { static: false }) stepper: MatStepper; + readonly stepLabels = AGENT_APP_UPGRADE_STEP_LABELS; + steps: AgentAppUpgradeStepKey[] = ['config', 'summary']; + selectedIndex = 0; bindings: StepBinding[] = []; @@ -210,7 +216,7 @@ export class AgentAppUpgradeFlowComponent extends PageComponent implements OnIni private maybeInitProfileDiff() { if (!this.needsProfileUpgrade || !this.template || !this.profile || this.profileMergeRequested) { return; } this.profileMergeRequested = true; - this.showProfileUpgradeStep = true; + this.steps = ['profile', 'config', 'summary']; const profileComposeType = dockerComposeConfig(this.profile)?.composeType || undefined; this.profileProposedYaml = dumpRawTemplateCompose(this.template, profileComposeType); const draft = { ...this.profile, templateVersion: this.template.currentVersion } as AgentAppProfile; @@ -354,4 +360,25 @@ export class AgentAppUpgradeFlowComponent extends PageComponent implements OnIni // the caller refresh even when the user backs out before the app upgrade. this.cancelled.emit(this.profileUpgraded ? { profileOnly: true } : null); } + + currentStep(): AgentAppUpgradeStepKey | undefined { + return this.loadingTemplate || this.loadingProfile || this.loadError ? undefined : this.steps[this.selectedIndex]; + } + + canGoBack(): boolean { + return this.selectedIndex > 0 && this.steps[this.selectedIndex - 1] !== 'profile'; + } + + showNext(): boolean { + const step = this.currentStep(); + return step === 'config' || (step === 'profile' && this.profileUpgraded); + } + + canGoNext(): boolean { + return this.currentStep() === 'profile' ? this.profileUpgraded : this.canSubmit(); + } + + nextStepLabel(): string { + return this.stepLabels[this.steps[this.selectedIndex + 1]] ?? ''; + } } diff --git a/ui-ngx/src/app/modules/home/pages/agent/agent-app-profile.component.ts b/ui-ngx/src/app/modules/home/pages/agent/agent-app-profile.component.ts index ab510451db..b81379f31e 100644 --- a/ui-ngx/src/app/modules/home/pages/agent/agent-app-profile.component.ts +++ b/ui-ngx/src/app/modules/home/pages/agent/agent-app-profile.component.ts @@ -10,7 +10,6 @@ import { AgentAppArgument, AgentAppProfile, AgentApplicationType, - AgentAppTemplate, agentApplicationTypeTranslationMap, AgentAppConfigType, dockerComposeConfig @@ -175,7 +174,7 @@ export class AgentAppProfileComponent extends EntityComponent this.dialog.open( AgentAppProfileUpgradeDialogComponent, { disableClose: false, - panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], + panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-wide-dialog'], data: { profile: this.entity } } ).afterClosed().subscribe(saved => { diff --git a/ui-ngx/src/app/modules/home/pages/agent/agent-app-profiles-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/agent/agent-app-profiles-table-config.resolver.ts index cfeca0072a..8b6703c5d2 100644 --- a/ui-ngx/src/app/modules/home/pages/agent/agent-app-profiles-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/agent/agent-app-profiles-table-config.resolver.ts @@ -23,10 +23,7 @@ import { AgentService } from '@core/http/agent.service'; import { AgentAppProfileComponent } from '@home/pages/agent/agent-app-profile.component'; import { MatDialog } from '@angular/material/dialog'; import { DialogService } from '@core/services/dialog.service'; -import { - AgentAppProfileWizardComponent, - AgentAppProfileWizardData -} from '@home/pages/agent/wizard/agent-app-profile-wizard.component'; +import { openAgentAppProfileWizard } from '@home/pages/agent/wizard/agent-app-profile-wizard-dialog'; import { AiAssistantConfigService } from '@core/services/ai-assistant-config.service'; import { AiAssistantViewType } from '@shared/models/ai-chat.models'; @@ -135,13 +132,7 @@ export class AgentAppProfilesTableConfigResolver { } private openProfileWizard(): Observable { - return this.dialog.open( - AgentAppProfileWizardComponent, { - disableClose: false, - panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'], - data: {} - } - ).afterClosed().pipe( + return openAgentAppProfileWizard(this.dialog, {}, false).pipe( tap(saved => { if (saved) { this.templateCache.clear(); diff --git a/ui-ngx/src/app/modules/home/pages/agent/agent-application.component.ts b/ui-ngx/src/app/modules/home/pages/agent/agent-application.component.ts index 98bc6c5b18..2f9857ed73 100644 --- a/ui-ngx/src/app/modules/home/pages/agent/agent-application.component.ts +++ b/ui-ngx/src/app/modules/home/pages/agent/agent-application.component.ts @@ -41,11 +41,7 @@ import { AgentAppDeleteDialogComponent, AgentAppDeleteDialogData } from '@home/pages/agent/dialog/agent-app-delete-dialog.component'; -import { - AgentAppInstallWizardComponent, - AgentAppInstallWizardData, - AgentAppInstallWizardResult -} from '@home/components/agent/wizard/agent-app-install-wizard.component'; +import { openAgentAppInstallWizard } from '@home/components/agent/wizard/agent-app-install-wizard-dialog'; import { catchError, map, mergeMap, share, startWith } from 'rxjs/operators'; import { findComposeDownStep } from '@home/pages/agent/util/agent-app-steps'; import { confineWheelToAceEditor } from '@home/pages/agent/util/ace-wheel-confine'; @@ -387,7 +383,7 @@ export class AgentApplicationComponent extends EntityComponent this.dialog.open( AgentAppAssignCompareDialogComponent, { disableClose: false, - panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], + panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-wide-dialog'], data: { appName: this.entity?.name, profileName: profile.name, @@ -608,18 +604,12 @@ export class AgentApplicationComponent extends EntityComponent { if (!confirmed) { return; } - this.dialog.open( - AgentAppInstallWizardComponent, { - disableClose: false, - panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'], - data: { - agentId: full.agentId.id, - agent: null, - mode: 'update', - application: full - } - } - ).afterClosed().subscribe(event => { + openAgentAppInstallWizard(this.dialog, { + agentId: full.agentId.id, + agent: null, + mode: 'update', + application: full + }).subscribe(event => { if (event) { this.reloadEntity(); } @@ -659,18 +649,12 @@ export class AgentApplicationComponent extends EntityComponent { - this.dialog.open( - AgentAppInstallWizardComponent, { - disableClose: false, - panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'], - data: { - agentId: full.agentId.id, - agent: null, - mode: 'upgrade', - application: full - } - } - ).afterClosed().subscribe(event => { + openAgentAppInstallWizard(this.dialog, { + agentId: full.agentId.id, + agent: null, + mode: 'upgrade', + application: full + }).subscribe(event => { if (event) { this.reloadEntity(); } @@ -692,7 +676,7 @@ export class AgentApplicationComponent extends EntityComponent this.dialog.open( AgentAppDeleteDialogComponent, { disableClose: false, - panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], + panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-wide-dialog'], data: { application: full, composeDownStep } } ).afterClosed().pipe(map(event => ({ full, event })))) diff --git a/ui-ngx/src/app/modules/home/pages/agent/agent-applications-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/agent/agent-applications-table-config.resolver.ts index be9d621224..cff2686ff8 100644 --- a/ui-ngx/src/app/modules/home/pages/agent/agent-applications-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/agent/agent-applications-table-config.resolver.ts @@ -47,12 +47,8 @@ import { AgentAppDeleteDialogComponent, AgentAppDeleteDialogData } from '@home/pages/agent/dialog/agent-app-delete-dialog.component'; -import { - AgentAppInstallWizardComponent, - AgentAppInstallWizardData, - AgentAppInstallWizardResult, - isAgentAppUpgradeResult -} from '@home/components/agent/wizard/agent-app-install-wizard.component'; +import { isAgentAppUpgradeResult } from '@home/components/agent/wizard/agent-app-install-wizard.component'; +import { openAgentAppInstallWizard } from '@home/components/agent/wizard/agent-app-install-wizard-dialog'; import { AiAssistantConfigService } from '@core/services/ai-assistant-config.service'; import { AiAssistantViewType } from '@shared/models/ai-chat.models'; import { AgentId } from '@shared/models/id/agent-id'; @@ -300,18 +296,12 @@ export class AgentApplicationsTableConfigResolver { )) ).subscribe(({ full, confirmed }) => { if (!confirmed) { return; } - this.dialog.open( - AgentAppInstallWizardComponent, { - disableClose: false, - panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'], - data: { - agentId: this.agentId, - agent: this.agent, - mode: 'update', - application: full - } - } - ).afterClosed().subscribe(event => { + openAgentAppInstallWizard(this.dialog, { + agentId: this.agentId, + agent: this.agent, + mode: 'update', + application: full + }).subscribe(event => { if (event) { this.config.updateData(); } @@ -367,7 +357,7 @@ export class AgentApplicationsTableConfigResolver { this.dialog.open( AgentAppDeleteDialogComponent, { disableClose: false, - panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], + panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-wide-dialog'], data: { application: app, agentName: this.agent?.name, @@ -389,18 +379,12 @@ export class AgentApplicationsTableConfigResolver { } private showUpgradeWizard(application: AgentApplicationInfo) { - this.dialog.open( - AgentAppInstallWizardComponent, { - disableClose: false, - panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'], - data: { - agentId: this.agentId, - agent: this.agent, - mode: 'upgrade', - application - } - } - ).afterClosed().subscribe(event => { + openAgentAppInstallWizard(this.dialog, { + agentId: this.agentId, + agent: this.agent, + mode: 'upgrade', + application + }).subscribe(event => { if (event) { this.config.updateData(); } @@ -408,13 +392,7 @@ export class AgentApplicationsTableConfigResolver { } private openInstallWizard(): Observable { - return this.dialog.open( - AgentAppInstallWizardComponent, { - disableClose: false, - panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'], - data: { agentId: this.agentId, agent: this.agent } - } - ).afterClosed().pipe( + return openAgentAppInstallWizard(this.dialog, { agentId: this.agentId, agent: this.agent }).pipe( switchMap(result => !isAgentAppUpgradeResult(result) && result?.applicationId?.id ? this.agentService.getAgentApplicationInfoById(result.applicationId.id) : of(null)) diff --git a/ui-ngx/src/app/modules/home/pages/agent/agent-deploy-dialog.service.ts b/ui-ngx/src/app/modules/home/pages/agent/agent-deploy-dialog.service.ts index ea4a7f4407..fb148d4aa0 100644 --- a/ui-ngx/src/app/modules/home/pages/agent/agent-deploy-dialog.service.ts +++ b/ui-ngx/src/app/modules/home/pages/agent/agent-deploy-dialog.service.ts @@ -5,13 +5,10 @@ import { MatDialog } from '@angular/material/dialog'; import { Observable, of } from 'rxjs'; import { catchError } from 'rxjs/operators'; import { EntityId } from '@shared/models/id/entity-id'; -import { AgentApplication, AgentApplicationType, AgentAppEvent } from '@shared/models/agent.models'; +import { AgentApplication, AgentApplicationType } from '@shared/models/agent.models'; import { AgentService } from '@core/http/agent.service'; -import { - AgentAppInstallWizardComponent, - AgentAppInstallWizardData, - AgentAppInstallWizardResult -} from '@home/components/agent/wizard/agent-app-install-wizard.component'; +import { AgentAppInstallWizardResult } from '@home/components/agent/wizard/agent-app-install-wizard.component'; +import { openAgentAppInstallWizard } from '@home/components/agent/wizard/agent-app-install-wizard-dialog'; @Injectable({ providedIn: 'root' }) export class AgentDeployDialogService { @@ -29,19 +26,13 @@ export class AgentDeployDialogService { open(appType: AgentApplicationType, relatedEntity: EntityId, options?: { showBack?: boolean }): Observable { - return this.dialog.open( - AgentAppInstallWizardComponent, { - disableClose: false, - panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'], - data: { - mode: 'install', - selectAgent: true, - lockedType: appType, - lockedRelatedEntity: relatedEntity, - navigateToAgentOnFinish: true, - showBack: !!options?.showBack - } - } - ).afterClosed(); + return openAgentAppInstallWizard(this.dialog, { + mode: 'install', + selectAgent: true, + lockedType: appType, + lockedRelatedEntity: relatedEntity, + navigateToAgentOnFinish: true, + showBack: !!options?.showBack + }); } } diff --git a/ui-ngx/src/app/modules/home/pages/agent/agent-executions-side-panel.component.ts b/ui-ngx/src/app/modules/home/pages/agent/agent-executions-side-panel.component.ts index bd14db6c27..c9ac977fe0 100644 --- a/ui-ngx/src/app/modules/home/pages/agent/agent-executions-side-panel.component.ts +++ b/ui-ngx/src/app/modules/home/pages/agent/agent-executions-side-panel.component.ts @@ -28,10 +28,7 @@ import { AgentProfileInfo } from '@shared/models/agent.models'; import { TranslateService } from '@ngx-translate/core'; -import { - AgentAppEventProgressDialogComponent, - AgentAppEventProgressDialogData -} from '@home/pages/agent/dialog/agent-app-event-progress-dialog.component'; +import { openAgentAppEventProgress } from '@home/pages/agent/util/agent-app-event-progress'; const NON_TERMINAL_BULK: ReadonlyArray = [ AgentBulkActionStatus.QUEUED, @@ -173,13 +170,7 @@ export class AgentExecutionsSidePanelComponent implements OnChanges, OnDestroy { } private openProgressDialog(application: AgentApplication | null, event: AgentAppEventInfo): void { - this.dialog.open( - AgentAppEventProgressDialogComponent, { - disableClose: false, - panelClass: ['tb-dialog'], - data: { application, event } - } - ).afterClosed().subscribe(() => this.refresh()); + openAgentAppEventProgress(this.dialog, application, event).subscribe(() => this.refresh()); } formatTime(ts: number): string { diff --git a/ui-ngx/src/app/modules/home/pages/agent/agent-install-instructions-dialog.component.scss b/ui-ngx/src/app/modules/home/pages/agent/agent-install-instructions-dialog.component.scss index 9ce06bb00e..f7eaa5d4a3 100644 --- a/ui-ngx/src/app/modules/home/pages/agent/agent-install-instructions-dialog.component.scss +++ b/ui-ngx/src/app/modules/home/pages/agent/agent-install-instructions-dialog.component.scss @@ -1,13 +1,8 @@ // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-License-Identifier: BUSL-1.1 -@use '../../components/agent/agent-shared' as *; +@use '../../components/agent/wizard/agent-wizard' as *; -:host { - display: block; - width: min(720px, 95vw); - min-width: 0; - max-width: 95vw; -} +@include wizard-dialog(720px); .tb-agent-install-dialog-header { display: flex; @@ -24,8 +19,6 @@ .tb-agent-install-dialog-body { padding: 16px 24px 24px; - max-height: 70vh; - overflow-y: auto; } .instructions-section { diff --git a/ui-ngx/src/app/modules/home/pages/agent/agent-profile-create-dialog.service.ts b/ui-ngx/src/app/modules/home/pages/agent/agent-profile-create-dialog.service.ts index 8bbf869fc7..41821f2d43 100644 --- a/ui-ngx/src/app/modules/home/pages/agent/agent-profile-create-dialog.service.ts +++ b/ui-ngx/src/app/modules/home/pages/agent/agent-profile-create-dialog.service.ts @@ -18,7 +18,7 @@ export class AgentProfileCreateDialogService { return this.dialog.open( AgentProfilePresetDialogComponent, { disableClose: true, - panelClass: ['tb-dialog'], + panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], data }).afterClosed(); } diff --git a/ui-ngx/src/app/modules/home/pages/agent/agent-profile-created-dialog.component.html b/ui-ngx/src/app/modules/home/pages/agent/agent-profile-created-dialog.component.html index 2ce11e5a61..625e559007 100644 --- a/ui-ngx/src/app/modules/home/pages/agent/agent-profile-created-dialog.component.html +++ b/ui-ngx/src/app/modules/home/pages/agent/agent-profile-created-dialog.component.html @@ -4,18 +4,18 @@ SPDX-License-Identifier: BUSL-1.1 --> -
-

- check_circle - agent.agent-profile-created -

+ + check_circle +

agent.agent-profile-created

+
- -
- -
+ +

@@ -63,13 +63,13 @@

-