Browse Source

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 <vprykhodko@thingsboard.io>
pull/16870/head
Maksym Tsymbarov 2 days ago
committed by GitHub
parent
commit
697104c8e8
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      ui-ngx/src/app/modules/home/components/agent/_agent-shared.scss
  2. 32
      ui-ngx/src/app/modules/home/components/agent/agent-deploy-status.component.scss
  3. 4
      ui-ngx/src/app/modules/home/components/agent/component/agent-compose-diff.component.scss
  4. 11
      ui-ngx/src/app/modules/home/components/agent/component/agent-compose-diff.component.ts
  5. 6
      ui-ngx/src/app/modules/home/components/agent/component/agent-compose-editor.component.scss
  6. 59
      ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.html
  7. 9
      ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.scss
  8. 3
      ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.ts
  9. 2
      ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.service.ts
  10. 284
      ui-ngx/src/app/modules/home/components/agent/wizard/_agent-wizard.scss
  11. 601
      ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.html
  12. 10
      ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.scss
  13. 87
      ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.ts
  14. 22
      ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-wizard-dialog.ts
  15. 5
      ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-wizard.component.scss
  16. 1
      ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-wizard.component.ts
  17. 72
      ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-update-flow.component.html
  18. 2
      ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-update-flow.component.scss
  19. 14
      ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-update-flow.component.ts
  20. 294
      ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-upgrade-flow.component.html
  21. 2
      ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-upgrade-flow.component.scss
  22. 35
      ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-upgrade-flow.component.ts
  23. 3
      ui-ngx/src/app/modules/home/pages/agent/agent-app-profile.component.ts
  24. 13
      ui-ngx/src/app/modules/home/pages/agent/agent-app-profiles-table-config.resolver.ts
  25. 46
      ui-ngx/src/app/modules/home/pages/agent/agent-application.component.ts
  26. 54
      ui-ngx/src/app/modules/home/pages/agent/agent-applications-table-config.resolver.ts
  27. 31
      ui-ngx/src/app/modules/home/pages/agent/agent-deploy-dialog.service.ts
  28. 13
      ui-ngx/src/app/modules/home/pages/agent/agent-executions-side-panel.component.ts
  29. 11
      ui-ngx/src/app/modules/home/pages/agent/agent-install-instructions-dialog.component.scss
  30. 2
      ui-ngx/src/app/modules/home/pages/agent/agent-profile-create-dialog.service.ts
  31. 32
      ui-ngx/src/app/modules/home/pages/agent/agent-profile-created-dialog.component.html
  32. 49
      ui-ngx/src/app/modules/home/pages/agent/agent-profile-created-dialog.component.scss
  33. 5
      ui-ngx/src/app/modules/home/pages/agent/agent-profile-merged-profiles.component.ts
  34. 2
      ui-ngx/src/app/modules/home/pages/agent/agent-profiles-table-config.resolver.ts
  35. 2
      ui-ngx/src/app/modules/home/pages/agent/agents-table-config.resolver.ts
  36. 30
      ui-ngx/src/app/modules/home/pages/agent/dialog/agent-app-assign-compare-dialog.component.html
  37. 2
      ui-ngx/src/app/modules/home/pages/agent/dialog/agent-app-assign-compare-dialog.component.scss
  38. 15
      ui-ngx/src/app/modules/home/pages/agent/dialog/agent-app-event-progress-dialog.component.html
  39. 53
      ui-ngx/src/app/modules/home/pages/agent/dialog/agent-app-event-progress-dialog.component.scss
  40. 41
      ui-ngx/src/app/modules/home/pages/agent/dialog/agent-app-profile-upgrade-dialog.component.html
  41. 2
      ui-ngx/src/app/modules/home/pages/agent/dialog/agent-app-profile-upgrade-dialog.component.scss
  42. 18
      ui-ngx/src/app/modules/home/pages/agent/dialog/agent-app-version-warning-dialog.component.html
  43. 53
      ui-ngx/src/app/modules/home/pages/agent/dialog/agent-app-version-warning-dialog.component.scss
  44. 9
      ui-ngx/src/app/modules/home/pages/agent/dialog/agent-profile-assign-profile-dialog.component.scss
  45. 15
      ui-ngx/src/app/modules/home/pages/agent/dialog/agent-profile-assign-profile-dialog.component.ts
  46. 11
      ui-ngx/src/app/modules/home/pages/agent/dialog/agent-profile-bulk-action-dialog.component.scss
  47. 63
      ui-ngx/src/app/modules/home/pages/agent/dialog/agent-profile-preset-dialog.component.html
  48. 45
      ui-ngx/src/app/modules/home/pages/agent/dialog/agent-profile-preset-dialog.component.scss
  49. 13
      ui-ngx/src/app/modules/home/pages/agent/table/abstract-agent-app-event-table-config.ts
  50. 2
      ui-ngx/src/app/modules/home/pages/agent/util/agent-app-event-progress.ts
  51. 2
      ui-ngx/src/app/modules/home/pages/agent/util/agent-version-warnings.ts
  52. 23
      ui-ngx/src/app/modules/home/pages/agent/wizard/agent-app-profile-wizard-dialog.ts
  53. 348
      ui-ngx/src/app/modules/home/pages/agent/wizard/agent-app-profile-wizard.component.html
  54. 2
      ui-ngx/src/app/modules/home/pages/agent/wizard/agent-app-profile-wizard.component.scss
  55. 25
      ui-ngx/src/app/modules/home/pages/agent/wizard/agent-app-profile-wizard.component.ts
  56. 26
      ui-ngx/src/app/modules/home/pages/agent/wizard/agent-app-wizard.models.ts
  57. 68
      ui-ngx/src/app/modules/home/pages/agent/wizard/agent-profile-wizard.component.html
  58. 27
      ui-ngx/src/app/modules/home/pages/agent/wizard/agent-profile-wizard.component.scss
  59. 21
      ui-ngx/src/app/modules/home/pages/agent/wizard/agent-profile-wizard.component.ts
  60. 48
      ui-ngx/src/app/modules/home/pages/edge/edge-instructions-dialog.component.html
  61. 18
      ui-ngx/src/app/modules/home/pages/edge/edge-instructions-dialog.component.scss
  62. 33
      ui-ngx/src/app/modules/home/pages/edge/edge.component.ts
  63. 16
      ui-ngx/src/app/modules/home/pages/edge/edges-table-config.resolver.ts
  64. 10
      ui-ngx/src/styles.scss

5
ui-ngx/src/app/modules/home/components/agent/_agent-shared.scss

@ -93,10 +93,11 @@ $agent-type-generic-fg: #6a1b9a;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
gap: 16px;
padding: 4px 0; padding: 4px 0;
font-size: 13px; font-size: 13px;
.label { color: $agent-text-secondary; } .label { flex: none; color: $agent-text-secondary; }
.value { color: $agent-text-primary; font-weight: 500; } .value { min-width: 0; color: $agent-text-primary; font-weight: 500; text-align: right; overflow-wrap: anywhere; }
} }
} }

32
ui-ngx/src/app/modules/home/components/agent/agent-deploy-status.component.scss

@ -21,6 +21,12 @@
border: 1px solid $agent-divider-light; border: 1px solid $agent-divider-light;
border-radius: 10px; border-radius: 10px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03); 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 { .tb-deploy-card-icon {
@ -33,11 +39,22 @@
justify-content: center; justify-content: center;
background: color-mix(in srgb, var(--tb-primary-500) 14%, transparent); background: color-mix(in srgb, var(--tb-primary-500) 14%, transparent);
@media #{$mat-lt-sm} {
width: 44px;
height: 44px;
}
mat-icon { mat-icon {
color: var(--tb-primary-600, var(--tb-primary-500)); color: var(--tb-primary-600, var(--tb-primary-500));
font-size: 32px; font-size: 32px;
width: 32px; width: 32px;
height: 32px; height: 32px;
@media #{$mat-lt-sm} {
font-size: 24px;
width: 24px;
height: 24px;
}
} }
} }
@ -58,6 +75,10 @@
font-size: 20px; font-size: 20px;
font-weight: 600; font-weight: 600;
color: $agent-text-primary; color: $agent-text-primary;
@media #{$mat-lt-sm} {
font-size: 17px;
}
} }
.tb-deploy-card-desc { .tb-deploy-card-desc {
@ -85,6 +106,13 @@
align-items: flex-end; align-items: flex-end;
gap: 6px; gap: 6px;
flex-shrink: 0; flex-shrink: 0;
@media #{$mat-lt-sm} {
flex-direction: row;
flex-wrap: wrap;
align-items: center;
width: 100%;
}
} }
.tb-deploy-pill { .tb-deploy-pill {
@ -181,6 +209,10 @@
transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s; transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
text-align: left; text-align: left;
@media #{$mat-lt-sm} {
padding: 16px;
}
&:hover { &:hover {
border-color: color-mix(in srgb, var(--tb-primary-500) 40%, transparent); border-color: color-mix(in srgb, var(--tb-primary-500) 40%, transparent);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);

4
ui-ngx/src/app/modules/home/components/agent/component/agent-compose-diff.component.scss

@ -8,7 +8,7 @@ tb-agent-compose-diff {
.diff-viewer { .diff-viewer {
position: relative; position: relative;
overflow: hidden; overflow: hidden;
height: clamp(220px, calc(85vh - 280px), 520px); height: clamp(220px, calc(75vh - 240px), 520px);
width: 100%; width: 100%;
.acediff__wrap { .acediff__wrap {
@ -32,7 +32,7 @@ tb-agent-compose-diff {
.ace_editor { .ace_editor {
font-family: $agent-mono-font !important; 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; } .ace_gutter-layer { width: 44px !important; }
.acediff__right .ace_gutter { .acediff__right .ace_gutter {

11
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)); requestAnimationFrame(() => this.whenReady(cb, frames - 1));
} }
private scheduleRebuild(): void { private scheduleRebuild(frames = 60): void {
if (this.rebuildHandle != null || this.destroyed) { if (this.rebuildHandle != null || this.destroyed) {
return; return;
} }
this.rebuildHandle = requestAnimationFrame(() => { this.rebuildHandle = requestAnimationFrame(() => {
this.rebuildHandle = null; this.rebuildHandle = null;
if (!this.destroyed) { if (this.destroyed) {
this.build(); return;
} }
if (this.differ && !this.ready && frames > 0) {
this.scheduleRebuild(frames - 1);
return;
}
this.build();
}); });
} }

6
ui-ngx/src/app/modules/home/components/agent/component/agent-compose-editor.component.scss

@ -8,7 +8,7 @@ tb-agent-compose-editor {
.yaml-editor { .yaml-editor {
width: 100%; box-sizing: border-box; padding: 12px 14px; width: 100%; box-sizing: border-box; padding: 12px 14px;
border: 1px solid $agent-divider; border-radius: 4px; 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-family: $agent-mono-font;
font-size: 12px; line-height: 1.55; letter-spacing: 0; font-size: 12px; line-height: 1.55; letter-spacing: 0;
tab-size: 2; -moz-tab-size: 2; tab-size: 2; -moz-tab-size: 2;
@ -16,7 +16,7 @@ tb-agent-compose-editor {
.yaml-editor-ace { .yaml-editor-ace {
padding: 0; padding: 0;
height: clamp(220px, calc(85vh - 280px), 520px); height: clamp(220px, calc(75vh - 240px), 520px);
overflow: hidden; overflow: hidden;
overscroll-behavior: contain; overscroll-behavior: contain;
.ace_editor { .ace_editor {
@ -28,6 +28,6 @@ tb-agent-compose-editor {
.ace_content { .ace_content {
overscroll-behavior: contain; overscroll-behavior: contain;
} }
.ace_gutter { background: #f5f5f5; color: rgba(0, 0, 0, 0.42); } .ace_gutter { background: $agent-surface-soft; color: $agent-ink-42; }
} }
} }

59
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 SPDX-License-Identifier: BUSL-1.1
--> -->
<mat-toolbar color="tb-primary" class="tb-install-wizard-toolbar"> <mat-toolbar color="tb-primary" class="tb-bottom-border">
<div class="tb-install-wizard-toolbar-content"> <h2>{{ titleKey | translate }}</h2>
<h2>{{ titleKey | translate }}</h2> <span class="flex-1"></span>
</div>
<div tb-help="agentProfileAutoProvision"></div> <div tb-help="agentProfileAutoProvision"></div>
<button mat-icon-button (click)="cancel()" type="button" tabindex="-1"> <button mat-icon-button (click)="cancel()" type="button">
<mat-icon>close</mat-icon> <mat-icon class="material-icons">close</mat-icon>
</button> </button>
</mat-toolbar> </mat-toolbar>
<div mat-dialog-content>
<div mat-dialog-content class="tb-install-wizard-body"> <mat-stepper linear #stepper [labelPosition]="(stepperLabelPosition | async)"
<mat-stepper linear #stepper [labelPosition]="(stepperLabelPosition | async)"> (selectionChange)="selectedIndex = $event.selectedIndex">
<mat-step [completed]="canProceed()" <mat-step [completed]="canProceed()"
[label]="stepSelectKey | translate"> [label]="stepSelectKey | translate">
@ -98,16 +97,6 @@
} }
</div> </div>
</form> </form>
<div class="step-footer">
<button mat-button type="button" (click)="cancel()">{{ 'action.cancel' | translate }}</button>
<button mat-raised-button color="primary" type="button"
[disabled]="!canProceed() || loading"
(click)="proceedToScript()">
<span>{{ 'action.next' | translate }}</span>
<mat-icon iconPositionEnd>chevron_right</mat-icon>
</button>
</div>
</mat-step> </mat-step>
<mat-step [label]="stepScriptKey | translate"> <mat-step [label]="stepScriptKey | translate">
@ -146,16 +135,30 @@
<span translate>edge.auto-provision-no-script</span> <span translate>edge.auto-provision-no-script</span>
</div> </div>
} }
<div class="step-footer">
<button mat-button type="button" (click)="cancel()">{{ 'action.close' | translate }}</button>
<button mat-raised-button color="primary" type="button" (click)="goToProfile()">
<mat-icon>open_in_new</mat-icon>
<span translate>agent.go-to-profile</span>
</button>
</div>
</mat-step> </mat-step>
</mat-stepper> </mat-stepper>
</div> </div>
<div mat-dialog-actions>
@if (selectedIndex === 0) {
<div class="dialog-actions-row flex flex-1 flex-row items-center justify-end">
<button mat-stroked-button
color="primary"
[disabled]="!canProceed() || loading"
(click)="proceedToScript()">{{ 'action.next-with-label' | translate: { label: (stepScriptKey | translate) } }}</button>
</div>
<mat-divider class="w-full"></mat-divider>
}
<div class="dialog-actions-row flex flex-1 flex-row items-center justify-end gap-2">
<button mat-button
(click)="cancel()">{{ (selectedIndex === 0 ? 'action.cancel' : 'action.close') | translate }}</button>
@if (selectedIndex > 0) {
<button mat-raised-button
color="primary"
(click)="goToProfile()">
<mat-icon>open_in_new</mat-icon>
<span translate>agent.go-to-profile</span>
</button>
}
</div>
</div>

9
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 // SPDX-License-Identifier: BUSL-1.1
@use '../wizard/agent-wizard' as *; @use '../wizard/agent-wizard' as *;
@include wizard-chrome; @include wizard-stepper-dialog(800px);
:host {
display: block;
width: min(800px, 95vw);
min-width: 0;
max-width: 95vw;
}
.select-form { .select-form {
display: block; display: block;

3
ui-ngx/src/app/modules/home/components/agent/dialog/agent-auto-provision-dialog.component.ts

@ -58,6 +58,7 @@ export class AgentAutoProvisionDialogComponent
searchText = ''; searchText = '';
loading = false; loading = false;
selectedIndex = 0;
@ViewChild('stepper', { static: false }) stepper: MatStepper; @ViewChild('stepper', { static: false }) stepper: MatStepper;
@ViewChild(MatAutocompleteTrigger) private autocompleteTrigger: MatAutocompleteTrigger; @ViewChild(MatAutocompleteTrigger) private autocompleteTrigger: MatAutocompleteTrigger;
@ -221,7 +222,7 @@ export class AgentAutoProvisionDialogComponent
return this.dialog.open<AgentProfileAssignProfileDialogComponent, AgentProfileAssignProfileDialogData, string[]>( return this.dialog.open<AgentProfileAssignProfileDialogComponent, AgentProfileAssignProfileDialogData, string[]>(
AgentProfileAssignProfileDialogComponent, { AgentProfileAssignProfileDialogComponent, {
disableClose: true, disableClose: true,
panelClass: ['tb-dialog'], panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-wide-dialog'],
data: { selectedIds, lockedAppType: this.appType } data: { selectedIds, lockedAppType: this.appType }
} }
).afterClosed(); ).afterClosed();

2
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, AgentAutoProvisionDialogData, boolean>( return this.dialog.open<AgentAutoProvisionDialogComponent, AgentAutoProvisionDialogData, boolean>(
AgentAutoProvisionDialogComponent, { AgentAutoProvisionDialogComponent, {
disableClose: true, disableClose: true,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'], panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-wide-dialog'],
data: { appType } data: { appType }
} }
).afterClosed(); ).afterClosed();

284
ui-ngx/src/app/modules/home/components/agent/wizard/_agent-wizard.scss

@ -4,96 +4,76 @@
@forward '../agent-shared'; @forward '../agent-shared';
@use '../agent-shared' as *; @use '../agent-shared' as *;
@mixin wizard-chrome { @mixin wizard-dialog($width) {
:host { :host {
display: block; height: 100%;
width: min(1280px, 95vw); width: $width;
min-width: 0; max-width: 100%;
max-width: 95vw; display: grid;
grid-template-rows: min-content minmax(0, 1fr) min-content;
grid-template-columns: minmax(0, 1fr);
} }
.tb-install-wizard-toolbar { :host-context(.mat-mdc-dialog-container) {
display: flex; align-items: center; gap: 8px; @media #{$mat-gt-xs} {
padding: 0 16px; max-height: calc(100vh - 32px);
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; }
} }
}
.tb-install-wizard-body.tb-install-wizard-embedded { .mat-mdc-dialog-content {
max-height: none !important; overscroll-behavior: contain;
overflow-y: visible !important;
padding: 8px 0 !important;
}
.tb-install-wizard-body { @media #{$mat-gt-xs} {
// No vertical padding: the sticky stepper header sits flush at the top and the max-height: 75vh;
// 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;
} }
}
:host ::ng-deep .mat-horizontal-stepper-wrapper { @mixin wizard-stepper-dialog($width) {
margin-top: 0; @include wizard-dialog($width);
}
:host ::ng-deep .mat-horizontal-stepper-header-container { :host {
margin-top: 0; .dialog-actions-row {
// Keep the step indicators (1)…(N) pinned at the top while content scrolls. padding: 8px;
position: sticky; }
top: 0;
z-index: 5;
background: #fff;
} }
:host ::ng-deep .mat-horizontal-stepper-header { :host-context(.mat-mdc-dialog-container) {
padding: 0 12px; .mat-mdc-dialog-content {
} padding: 0;
scrollbar-gutter: stable;
}
:host ::ng-deep .mat-horizontal-content-container { .mat-mdc-dialog-actions {
padding: 12px 0; padding: 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%;
} }
:host-context(.tb-fullscreen-dialog .mat-mdc-dialog-container) { :host ::ng-deep {
max-width: 100%; .mat-horizontal-stepper-header-container {
position: sticky;
top: 0;
z-index: 5;
background: #fff;
}
.tb-install-wizard-body { .mat-horizontal-content-container,
max-width: 100%; .mat-vertical-content {
overflow-x: hidden; padding-top: 4px;
} }
}
:host ::ng-deep .mat-step-header { .mat-step-header {
// Kill the hover/focus background — navigation works, but no visual fill. &:hover,
&:hover, &.cdk-program-focused,
&.cdk-program-focused, &.cdk-mouse-focused,
&.cdk-mouse-focused, &.cdk-focused {
&.cdk-focused { background-color: transparent !important;
background-color: transparent !important; }
} }
} }
}
@mixin wizard-steps-locked {
:host ::ng-deep .tb-steps-locked .mat-step-header[aria-selected="false"] { :host ::ng-deep .tb-steps-locked .mat-step-header[aria-selected="false"] {
pointer-events: none; pointer-events: none;
cursor: default; cursor: default;
@ -107,22 +87,6 @@
color: $agent-text-hint !important; 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 { @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; } 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; } h4 { font-size: 16px; font-weight: 500; margin: 0 0 4px; }
p { font-size: 13px; color: $agent-text-secondary; margin: 0; } p { font-size: 13px; color: $agent-text-secondary; margin: 0; }
}
}
@mixin wizard-yaml-editor { @media #{$mat-lt-sm} {
// Defensive: also contain overscroll on the editor hosts themselves, so even display: grid;
// if a swipe lands directly on an ace editor (not on the body), it won't be grid-template-columns: 32px minmax(0, 1fr);
// interpreted as page navigation. column-gap: 12px;
.diff-viewer, align-items: center;
.yaml-editor-ace { padding: 12px 16px;
overscroll-behavior: contain; text-align: left;
::ng-deep .ace_editor, mat-icon { grid-row: span 2; font-size: 32px; width: 32px; height: 32px; margin: 0; }
::ng-deep .ace_scroller,
::ng-deep .ace_content {
overscroll-behavior: contain;
} }
} }
}
@mixin wizard-yaml-editor {
.tb-compose-panel { .tb-compose-panel {
box-shadow: none !important; box-shadow: none !important;
border: 1px solid $agent-divider; 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; } .pull-images { display: block; margin-top: 12px; }
// Compact, content-width toggle (Material defaults the group to full width). // Compact, content-width toggle (Material defaults the group to full width).
@ -283,6 +217,8 @@
.diff-header { .diff-header {
flex: 1 1 50%; box-sizing: border-box; padding: 8px 12px; font-size: 12px; font-weight: 500; flex: 1 1 50%; box-sizing: border-box; padding: 8px 12px; font-size: 12px; font-weight: 500;
letter-spacing: 0.3px; 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; } & + .diff-header { border-left: 1px solid $agent-divider; padding-right: 36px; }
&.added { background: $agent-success-surface; color: $agent-color-success-dark; } &.added { background: $agent-success-surface; color: $agent-color-success-dark; }
&.removed { background: #fce4ec; color: $agent-color-error-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
// <gutterWidth>). 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 <div>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 { .diff-hint {
font-size: 12px; color: $agent-text-secondary; margin: 6px 0 0; font-size: 12px; color: $agent-text-secondary; margin: 6px 0 0;
} }

601
ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.html

@ -5,28 +5,33 @@
--> -->
@if (!embedded) { @if (!embedded) {
<mat-toolbar color="tb-primary" class="tb-install-wizard-toolbar"> <mat-toolbar color="tb-primary" class="tb-bottom-border">
@if (showBack) { @if (showBack) {
<button mat-icon-button (click)="back.emit()" type="button" tabindex="-1"> <button mat-icon-button (click)="back.emit()" type="button">
<mat-icon>arrow_back</mat-icon> <mat-icon class="material-icons">arrow_back</mat-icon>
</button> </button>
} }
<div class="tb-install-wizard-toolbar-content"> <h2>{{ 'agent.app-install-title' | translate }}@if (agent) {: {{ 'agent.app-install-on-agent' | translate: { name: agent?.name } }}}</h2>
<h2>{{ 'agent.app-install-title' | translate }}@if (agent) {:}</h2> <span class="flex-1"></span>
@if (agent) {
<span class="flex-1">
{{ 'agent.app-install-on-agent' | translate: { name: agent?.name } }}
</span>
}
</div>
<div [tb-help]="helpLinkId"></div> <div [tb-help]="helpLinkId"></div>
<button mat-icon-button (click)="cancel()" type="button" tabindex="-1"> <button mat-icon-button (click)="cancel()" type="button">
<mat-icon>close</mat-icon> <mat-icon class="material-icons">close</mat-icon>
</button> </button>
</mat-toolbar> </mat-toolbar>
} }
@if (embedded) {
<ng-container [ngTemplateOutlet]="body"></ng-container>
<ng-container [ngTemplateOutlet]="actions"></ng-container>
} @else {
<div mat-dialog-content>
<ng-container [ngTemplateOutlet]="body"></ng-container>
</div>
<div mat-dialog-actions>
<ng-container [ngTemplateOutlet]="actions"></ng-container>
</div>
}
<div mat-dialog-content class="tb-install-wizard-body" [class.tb-install-wizard-embedded]="embedded"> <ng-template #body>
@if (checkingManaged) { @if (checkingManaged) {
<div class="loading-state"> <div class="loading-state">
@ -35,7 +40,7 @@
} }
@if (!checkingManaged && managedApp) { @if (!checkingManaged && managedApp) {
<div class="managed-block"> <div class="managed-block p-6">
<tb-agent-deploy-status <tb-agent-deploy-status
[agent]="managedAgent" [agent]="managedAgent"
[application]="managedApp" [application]="managedApp"
@ -43,17 +48,11 @@
(goToAgentApplication)="goToAgentApplication()" (goToAgentApplication)="goToAgentApplication()"
(goToAgentEvents)="goToAgentEvents()"> (goToAgentEvents)="goToAgentEvents()">
</tb-agent-deploy-status> </tb-agent-deploy-status>
<div class="step-footer">
<span class="flex-1"></span>
@if (!embedded) {
<button mat-button (click)="cancel()">{{ 'action.close' | translate }}</button>
}
</div>
</div> </div>
} }
@if (selectAgent && !embedded && !checkingManaged && !managedApp) { @if (selectAgent && !embedded && !checkingManaged && !managedApp) {
<div class="tb-form-hint tb-primary-fill mb-4"> <div class="tb-form-hint tb-primary-fill mx-6 mt-4">
<mat-icon>info_outline</mat-icon> <mat-icon>info_outline</mat-icon>
<span translate>agent.deploy-via-agent-desc</span> <span translate>agent.deploy-via-agent-desc</span>
</div> </div>
@ -62,302 +61,292 @@
@if (!checkingManaged && !managedApp) { @if (!checkingManaged && !managedApp) {
<mat-stepper linear #stepper <mat-stepper linear #stepper
[class.tb-steps-locked]="!!installedApplication" [class.tb-steps-locked]="!!installedApplication"
(selectionChange)="selectedIndex = $event.selectedIndex"
[orientation]="(stepperOrientation | async)" [orientation]="(stepperOrientation | async)"
[labelPosition]="(stepperLabelPosition | async)"> [labelPosition]="(stepperLabelPosition | async)">
@if (selectAgent) { @for (step of steps; track step) {
<mat-step [label]="'agent.deploy-select-agent-step' | translate" @switch (step) {
[completed]="canProceedFromAgent()" @case ('agent') {
[editable]="!installedApplication"> <mat-step [label]="stepLabels[step] | translate"
<p class="hint" translate>agent.deploy-intro</p> [completed]="canProceedFromAgent()"
<tb-agent-autocomplete [editable]="!installedApplication">
[ngModel]="agent" <p class="hint" translate>agent.deploy-intro</p>
(ngModelChange)="onSelectedAgentChange($event)"> <tb-agent-autocomplete
</tb-agent-autocomplete> [ngModel]="agent"
<div class="step-footer"> (ngModelChange)="onSelectedAgentChange($event)">
<button mat-raised-button color="primary" matStepperNext [disabled]="!canProceedFromAgent()"> </tb-agent-autocomplete>
{{ 'action.next' | translate }} </mat-step>
<mat-icon iconPositionEnd>chevron_right</mat-icon>
</button>
</div>
</mat-step>
}
@if (!lockedType) {
<mat-step [label]="'agent.app-install-step1' | translate">
<p class="hint" translate>agent.app-install-pick-type</p>
<div class="type-cards">
@for (card of typeCards; track card.type) {
<button type="button" class="type-card"
[class.selected]="selectedType === card.type"
[disabled]="isTypeDisabled(card.type)"
[attr.aria-pressed]="selectedType === card.type"
(click)="selectType(card.type)">
<mat-icon>{{ card.icon }}</mat-icon>
<h4>{{ card.labelKey | translate }}</h4>
<p>{{ (unavailableTypes.has(card.type) ? 'agent.app-type-unavailable' : card.descKey) | translate }}</p>
</button>
}
</div>
@if (loadingTemplate) {
<div class="loading-state">
<mat-spinner diameter="20"></mat-spinner>
<span translate>agent.app-install-loading-template</span>
</div>
} }
@if (loadError) { @case ('type') {
<div class="error-state"> <mat-step [label]="stepLabels[step] | translate" [completed]="canProceedFromType()">
<mat-icon>error_outline</mat-icon> <p class="hint" translate>agent.app-install-pick-type</p>
<span>{{ loadError }}</span> <div class="type-cards">
</div> @for (card of typeCards; track card.type) {
<button type="button" class="type-card"
[class.selected]="selectedType === card.type"
[disabled]="isTypeDisabled(card.type)"
[attr.aria-pressed]="selectedType === card.type"
(click)="selectType(card.type)">
<mat-icon>{{ card.icon }}</mat-icon>
<h4>{{ card.labelKey | translate }}</h4>
<p>{{ (unavailableTypes.has(card.type) ? 'agent.app-type-unavailable' : card.descKey) | translate }}</p>
</button>
}
</div>
@if (loadingTemplate) {
<div class="loading-state">
<mat-spinner diameter="20"></mat-spinner>
<span translate>agent.app-install-loading-template</span>
</div>
}
@if (loadError) {
<div class="error-state">
<mat-icon>error_outline</mat-icon>
<span>{{ loadError }}</span>
</div>
}
</mat-step>
} }
<div class="step-footer"> @case ('config') {
@if (selectAgent) { <mat-step [label]="stepLabels[step] | translate" [completed]="canSubmit() || !!installedApplication"
<button mat-button matStepperPrevious> [editable]="!installedApplication">
<mat-icon>chevron_left</mat-icon> <div class="config-toggle">
{{ 'action.back' | translate }} <tb-toggle-select class="xs:w-full" [(ngModel)]="useProfile" (ngModelChange)="toggleUseProfile($event)" appearance="fill" disablePagination>
</button> <tb-toggle-option [value]="true">{{ 'agent.app-install-from-profile' | translate }}</tb-toggle-option>
} <tb-toggle-option [value]="false">{{ 'agent.app-install-custom-config' | translate }}</tb-toggle-option>
<button mat-raised-button color="primary" matStepperNext [disabled]="!canProceedFromType()"> </tb-toggle-select>
{{ 'action.next' | translate }} </div>
<mat-icon iconPositionEnd>chevron_right</mat-icon> <mat-form-field class="mat-block" appearance="outline">
</button> <mat-label translate>agent.app-install-name</mat-label>
</div> <input matInput [(ngModel)]="appName" required>
</mat-step> </mat-form-field>
} @if (canHaveRelatedEntity) {
<mat-step [label]="'agent.app-install-step3' | translate" [editable]="!installedApplication"> <tb-agent-related-entity-autocomplete
<div class="config-toggle"> [appType]="selectedType"
<tb-toggle-select [(ngModel)]="useProfile" (ngModelChange)="toggleUseProfile($event)" appearance="fill" disablePagination> [disabled]="!!lockedRelatedEntity"
<tb-toggle-option [value]="true">{{ 'agent.app-install-from-profile' | translate }}</tb-toggle-option> [required]="relatedEntityRequired"
<tb-toggle-option [value]="false">{{ 'agent.app-install-custom-config' | translate }}</tb-toggle-option> allowCreate
</tb-toggle-select> [ngModel]="relatedEntityId"
</div> (ngModelChange)="relatedEntityId = $event; onRelatedEntityChange($event)"
<mat-form-field class="mat-block" appearance="outline"> (relatedEntityNameChange)="onRelatedEntityName($event)">
<mat-label translate>agent.app-install-name</mat-label> </tb-agent-related-entity-autocomplete>
<input matInput [(ngModel)]="appName" required> }
</mat-form-field> @if (useProfile && typesWithoutTemplates.has(selectedType)) {
@if (canHaveRelatedEntity) { <div class="tb-form-hint tb-primary-fill tb-form-hint-warning mb-4">
<tb-agent-related-entity-autocomplete <mat-icon>warning_amber</mat-icon>
[appType]="selectedType" <span translate>agent.app-no-templates</span>
[disabled]="!!lockedRelatedEntity" </div>
[required]="relatedEntityRequired" }
allowCreate @if (useProfile) {
[ngModel]="relatedEntityId" <mat-form-field class="mat-block" appearance="outline" [formGroup]="profileSelectFormGroup">
(ngModelChange)="relatedEntityId = $event; onRelatedEntityChange($event)" <mat-label translate>agent.app-install-select-profile</mat-label>
(relatedEntityNameChange)="onRelatedEntityName($event)"> <input matInput type="text" required
</tb-agent-related-entity-autocomplete> #profileInput
} formControlName="profile"
@if (useProfile && typesWithoutTemplates.has(selectedType)) { [matAutocomplete]="profileAutocomplete">
<div class="tb-form-hint tb-primary-fill tb-form-hint-warning mb-4"> @if (profileSelectFormGroup.get('profile').value) {
<mat-icon>warning_amber</mat-icon> <button type="button"
<span translate>agent.app-no-templates</span> matSuffix mat-icon-button aria-label="Clear"
</div> (click)="clearProfile()">
} <mat-icon class="material-icons">close</mat-icon>
@if (useProfile) { </button>
<mat-form-field class="mat-block" appearance="outline" [formGroup]="profileSelectFormGroup"> }
<mat-label translate>agent.app-install-select-profile</mat-label> @if (!profileSelectFormGroup.get('profile').value && canCreateProfileForType) {
<input matInput type="text" required <button
#profileInput mat-button color="primary" matSuffix type="button"
formControlName="profile" (mousedown)="$event.preventDefault()"
[matAutocomplete]="profileAutocomplete"> (click)="createProfile($event)">
@if (profileSelectFormGroup.get('profile').value) { <span style="white-space: nowrap">{{ 'agent.deploy-create-new' | translate }}</span>
<button type="button" </button>
matSuffix mat-icon-button aria-label="Clear" }
(click)="clearProfile()"> <mat-autocomplete class="tb-autocomplete"
<mat-icon class="material-icons">close</mat-icon> #profileAutocomplete="matAutocomplete"
</button> [displayWith]="displayProfileFn">
} @if (filteredProfiles | async; as profiles) {
@if (!profileSelectFormGroup.get('profile').value && canCreateProfileForType) { @for (p of profiles; track trackKey(p)) {
<button <mat-option [value]="p" class="tb-profile-option"
mat-button color="primary" matSuffix type="button" [matTooltip]="isVirtualProfile(p) ? ('agent.app-install-virtual-profile-hint' | translate) : ''"
(mousedown)="$event.preventDefault()" matTooltipPosition="right">
(click)="createProfile($event)"> <span>{{ p.name }}</span>
<span style="white-space: nowrap">{{ 'agent.deploy-create-new' | translate }}</span> @if (isVirtualProfile(p)) {
</button> <span class="tb-virtual-profile-badge">{{ 'agent.app-install-virtual-profile-badge' | translate }}</span>
} }
<mat-autocomplete class="tb-autocomplete" @if (!isVirtualProfile(p) && p.templateVersion) {
#profileAutocomplete="matAutocomplete" <span class="tb-profile-template-version">{{ profileTemplateLabel(p) }}</span>
[displayWith]="displayProfileFn"> }
@if (filteredProfiles | async; as profiles) { </mat-option>
@for (p of profiles; track trackKey(p)) { }
<mat-option [value]="p" class="tb-profile-option" @if (!profiles.length) {
[matTooltip]="isVirtualProfile(p) ? ('agent.app-install-virtual-profile-hint' | translate) : ''" <mat-option [value]="null" disabled class="tb-not-found">
matTooltipPosition="right"> <div class="tb-not-found-content">
<span>{{ p.name }}</span> <span translate>agent.app-install-no-profiles</span>
@if (isVirtualProfile(p)) { </div>
<span class="tb-virtual-profile-badge">{{ 'agent.app-install-virtual-profile-badge' | translate }}</span> </mat-option>
} }
@if (!isVirtualProfile(p) && p.templateVersion) {
<span class="tb-profile-template-version">{{ profileTemplateLabel(p) }}</span>
} }
</mat-option> </mat-autocomplete>
</mat-form-field>
}
@if (loadingProfiles) {
<div class="loading-state">
<mat-spinner diameter="20"></mat-spinner>
<span translate>agent.app-install-loading-template</span>
</div>
}
<tb-agent-app-step-inputs [bindings]="bindings"></tb-agent-app-step-inputs>
@if (useProfile && selectedProfile && !isVirtualProfile(selectedProfile)) {
<div class="tb-compare-actions">
<button mat-stroked-button color="primary" type="button" (click)="openEditProfile()">
<mat-icon>edit</mat-icon>
<span>{{ 'agent.app-update-edit-profile' | translate }}</span>
</button>
</div>
}
@if (useProfile && selectedProfile) {
<mat-expansion-panel class="tb-compose-panel">
<mat-expansion-panel-header>
<mat-panel-title translate>agent.app-install-yaml</mat-panel-title>
</mat-expansion-panel-header>
<ng-template matExpansionPanelContent>
<tb-agent-compose-editor [value]="composeYaml" [readOnly]="useProfile && !!selectedProfile"></tb-agent-compose-editor>
</ng-template>
</mat-expansion-panel>
}
@if (mergeError) {
<div class="error-state">
<mat-icon>error_outline</mat-icon>
<span>{{ mergeError }}</span>
</div>
}
@if (!useProfile && !template && loadError) {
<div class="error-state">
<mat-icon>error_outline</mat-icon>
<span>{{ loadError }}</span>
</div>
} @else if (!useProfile) {
@if (composeTypeKeys.length > 1) {
<mat-form-field class="mat-block" appearance="outline">
<mat-label translate>agent.app-compose-template-select</mat-label>
<mat-select [value]="composeType" (selectionChange)="onComposeTypeChange($event.value)">
@for (key of composeTypeKeys; track key) {
<mat-option [value]="key">
{{ composeTypeLabel(key) }}
</mat-option>
}
</mat-select>
</mat-form-field>
} }
@if (!profiles.length) { @if (relatedEntityId) {
<mat-option [value]="null" disabled class="tb-not-found"> <div class="tb-form-hint tb-primary-fill mb-4">
<div class="tb-not-found-content"> <mat-icon>info_outline</mat-icon>
<span translate>agent.app-install-no-profiles</span> <span translate>agent.app-compose-creds-overridden-hint</span>
</div> </div>
</mat-option>
} }
<div class="diff-header-row">
<div class="diff-header added" translate>agent.app-install-diff-template</div>
<div class="diff-header removed" translate>agent.app-install-diff-editable</div>
<button type="button" class="diff-sync-toggle"
[class.active]="diffSyncScroll"
[matTooltip]="'agent.app-diff-sync-scroll' | translate"
(click)="diffSyncScroll = !diffSyncScroll">
<mat-icon>{{ diffSyncScroll ? 'link' : 'link_off' }}</mat-icon>
</button>
</div>
<tb-agent-compose-diff [left]="proposedYaml" [right]="currentYaml" [syncScroll]="diffSyncScroll" (rightChange)="composeYaml = $event"></tb-agent-compose-diff>
<p class="diff-hint" translate>agent.app-install-diff-hint</p>
} }
</mat-autocomplete> </mat-step>
</mat-form-field> }
} @case ('summary') {
@if (loadingProfiles) { <mat-step [label]="stepLabels[step] | translate" [completed]="!!installedApplication"
<div class="loading-state"> [editable]="!installedApplication">
<mat-spinner diameter="20"></mat-spinner> <div class="summary-card">
<span translate>agent.app-install-loading-template</span> <div class="summary-row">
</div> <span class="label" translate>agent.app-name</span>
} <span class="value">{{ appName }}</span>
<tb-agent-app-step-inputs [bindings]="bindings"></tb-agent-app-step-inputs> </div>
@if (useProfile && selectedProfile && !isVirtualProfile(selectedProfile)) { <div class="summary-row">
<div class="tb-compare-actions"> <span class="label" translate>agent.app-type</span>
<button mat-stroked-button color="primary" type="button" (click)="openEditProfile()"> <span class="value"><span class="tb-type-badge"
<mat-icon>edit</mat-icon> [class.edge]="selectedType === 'EDGE'"
<span>{{ 'agent.app-update-edit-profile' | translate }}</span> [class.gateway]="selectedType === 'GATEWAY'"
</button> [class.generic]="selectedType === 'GENERIC'">{{ selectedType }}</span></span>
</div> </div>
} @if (template) {
@if (useProfile && selectedProfile) { <div class="summary-row">
<mat-expansion-panel class="tb-compose-panel"> <span class="label" translate>agent.app-template</span>
<mat-expansion-panel-header> <span class="value">{{ template.appType }} {{ template.currentVersion }}</span>
<mat-panel-title translate>agent.app-install-yaml</mat-panel-title> </div>
</mat-expansion-panel-header>
<ng-template matExpansionPanelContent>
<tb-agent-compose-editor [value]="composeYaml" [readOnly]="useProfile && !!selectedProfile"></tb-agent-compose-editor>
</ng-template>
</mat-expansion-panel>
}
@if (mergeError) {
<div class="error-state">
<mat-icon>error_outline</mat-icon>
<span>{{ mergeError }}</span>
</div>
}
@if (!useProfile && !template && loadError) {
<div class="error-state">
<mat-icon>error_outline</mat-icon>
<span>{{ loadError }}</span>
</div>
} @else if (!useProfile) {
@if (composeTypeKeys.length > 1) {
<mat-form-field class="mat-block" appearance="outline">
<mat-label translate>agent.app-compose-template-select</mat-label>
<mat-select [value]="composeType" (selectionChange)="onComposeTypeChange($event.value)">
@for (key of composeTypeKeys; track key) {
<mat-option [value]="key">
{{ composeTypeLabel(key) }}
</mat-option>
} }
</mat-select> @if (useProfile && selectedProfile) {
</mat-form-field> <div class="summary-row">
<span class="label" translate>agent.app-install-select-profile</span>
<span class="value">{{ selectedProfile.name }}</span>
</div>
}
@if (agent) {
<div class="summary-row">
<span class="label" translate>agent.agents</span>
<span class="value">{{ agent.name }}</span>
</div>
}
</div>
<div class="tb-form-hint tb-primary-fill mb-4">
<mat-icon>info_outline</mat-icon>
<span translate>agent.app-install-confirm-info</span>
</div>
</mat-step>
} }
@if (relatedEntityId) { @case ('deploy') {
<div class="tb-form-hint tb-primary-fill mb-4"> <mat-step [label]="stepLabels[step] | translate">
<mat-icon>info_outline</mat-icon> <tb-agent-deploy-status
<span translate>agent.app-compose-creds-overridden-hint</span> [agent]="agent"
</div> [application]="installedApplication"
(goToAgent)="goToAgent()"
(goToAgentApplication)="goToAgentApplication()"
(goToAgentEvents)="goToAgentEvents()">
</tb-agent-deploy-status>
</mat-step>
} }
<div class="diff-header-row">
<div class="diff-header added" translate>agent.app-install-diff-template</div>
<div class="diff-header removed" translate>agent.app-install-diff-editable</div>
<button type="button" class="diff-sync-toggle"
[class.active]="diffSyncScroll"
[matTooltip]="'agent.app-diff-sync-scroll' | translate"
(click)="diffSyncScroll = !diffSyncScroll">
<mat-icon>{{ diffSyncScroll ? 'link' : 'link_off' }}</mat-icon>
</button>
</div>
<tb-agent-compose-diff [left]="proposedYaml" [right]="currentYaml" [syncScroll]="diffSyncScroll" (rightChange)="composeYaml = $event"></tb-agent-compose-diff>
<p class="diff-hint" translate>agent.app-install-diff-hint</p>
} }
<div class="step-footer">
@if (!installedApplication) {
<button mat-button matStepperPrevious [disabled]="submitting">
<mat-icon>chevron_left</mat-icon>
{{ 'action.back' | translate }}
</button>
}
<button mat-raised-button color="primary" matStepperNext [disabled]="!canSubmit()">
{{ 'action.next' | translate }}
<mat-icon iconPositionEnd>chevron_right</mat-icon>
</button>
</div>
</mat-step>
<mat-step [label]="'agent.app-install-step4' | translate" [completed]="!!installedApplication"
[editable]="!installedApplication">
<div class="summary-card">
<div class="summary-row">
<span class="label" translate>agent.app-name</span>
<span class="value">{{ appName }}</span>
</div>
<div class="summary-row">
<span class="label" translate>agent.app-type</span>
<span class="value"><span class="tb-type-badge"
[class.edge]="selectedType === 'EDGE'"
[class.gateway]="selectedType === 'GATEWAY'"
[class.generic]="selectedType === 'GENERIC'">{{ selectedType }}</span></span>
</div>
@if (template) {
<div class="summary-row">
<span class="label" translate>agent.app-template</span>
<span class="value">{{ template.appType }} {{ template.currentVersion }}</span>
</div>
}
@if (useProfile && selectedProfile) {
<div class="summary-row">
<span class="label" translate>agent.app-install-select-profile</span>
<span class="value">{{ selectedProfile.name }}</span>
</div>
}
@if (agent) {
<div class="summary-row">
<span class="label" translate>agent.agents</span>
<span class="value">{{ agent.name }}</span>
</div>
}
</div>
<div class="tb-form-hint tb-primary-fill mb-4">
<mat-icon>info_outline</mat-icon>
<span translate>agent.app-install-confirm-info</span>
</div>
<div class="step-footer">
@if (!installedApplication) {
<button mat-button matStepperPrevious [disabled]="submitting">
<mat-icon>chevron_left</mat-icon>
{{ 'action.back' | translate }}
</button>
}
@if (!installedApplication) {
<button mat-raised-button color="primary"
(click)="submit()" [disabled]="!canSubmit()">
<mat-icon>save</mat-icon>
<span>{{ 'agent.app-install-cta' | translate }}</span>
</button>
}
@if (installedApplication) {
<button mat-raised-button color="primary" matStepperNext>
{{ 'action.next' | translate }}
<mat-icon iconPositionEnd>chevron_right</mat-icon>
</button>
}
</div>
</mat-step>
@if (selectAgent) {
<mat-step [label]="'agent.deploy-install-step' | translate">
<tb-agent-deploy-status
[agent]="agent"
[application]="installedApplication"
(goToAgent)="goToAgent()"
(goToAgentApplication)="goToAgentApplication()"
(goToAgentEvents)="goToAgentEvents()">
</tb-agent-deploy-status>
<div class="step-footer">
<span class="flex-1"></span>
@if (!embedded) {
<button mat-button (click)="cancel()">{{ 'action.close' | translate }}</button>
}
</div>
</mat-step>
} }
</mat-stepper> </mat-stepper>
} }
</div> </ng-template>
<ng-template #actions>
@if (!checkingManaged && !managedApp && (canGoBack() || showNext())) {
<div class="dialog-actions-row flex flex-1 flex-row items-center justify-end">
@if (canGoBack()) {
<button mat-stroked-button
[disabled]="submitting"
(click)="stepper.previous()">{{ 'action.back' | translate }}</button>
}
<span class="flex-1"></span>
@if (showNext()) {
<button mat-stroked-button
color="primary"
[disabled]="!canGoNext()"
(click)="stepper.next()">{{ 'action.next-with-label' | translate: { label: (nextStepLabel() | translate) } }}</button>
}
</div>
@if (!embedded || canInstall()) {
<mat-divider class="w-full"></mat-divider>
}
}
@if (!embedded || canInstall()) {
<div class="dialog-actions-row flex flex-1 flex-row items-center justify-end gap-2">
@if (!embedded) {
<button mat-button
[disabled]="submitting"
(click)="cancel()">{{ (managedApp || installedApplication ? 'action.close' : 'action.cancel') | translate }}</button>
}
@if (canInstall()) {
<button mat-raised-button
color="primary"
[disabled]="currentStep() !== 'summary' || !canSubmit()"
(click)="submit()">{{ 'agent.app-install-cta' | translate }}</button>
}
</div>
}
</ng-template>

10
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 // SPDX-License-Identifier: BUSL-1.1
@use 'agent-wizard' as *; @use 'agent-wizard' as *;
@include wizard-chrome; @include wizard-stepper-dialog(1280px);
@include wizard-step-basics; @include wizard-step-basics;
@include wizard-type-cards; @include wizard-type-cards;
@include wizard-yaml-editor; @include wizard-yaml-editor;
@include wizard-diff; @include wizard-diff;
@include wizard-summary; @include wizard-summary;
@include agent-virtual-profile-badge; @include agent-virtual-profile-badge;
@include wizard-steps-locked;
:host(.tb-embedded) {
display: block;
width: auto;
height: auto;
max-height: none;
}

87
ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-flow.component.ts

@ -38,22 +38,28 @@ import {
buildVirtualAppProfiles, buildVirtualAppProfiles,
VIRTUAL_APP_TYPES VIRTUAL_APP_TYPES
} from '@home/pages/agent/util/virtual-app-profiles'; } from '@home/pages/agent/util/virtual-app-profiles';
import { import { openAgentAppProfileWizard } from '@home/pages/agent/wizard/agent-app-profile-wizard-dialog';
AgentAppProfileWizardComponent,
AgentAppProfileWizardData
} from '@home/pages/agent/wizard/agent-app-profile-wizard.component';
import { UserPermissionsService } from '@core/http/user-permissions.service'; import { UserPermissionsService } from '@core/http/user-permissions.service';
import { Operation, Resource } from '@shared/models/security.models'; import { Operation, Resource } from '@shared/models/security.models';
import { AgentAppWizardLoaderService } from '@home/pages/agent/wizard/agent-app-wizard-loader.service'; 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 { 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'; import { EdgeTemplateCompatibilityService } from '@home/pages/agent/util/edge-template-compatibility.service';
@Component({ @Component({
selector: 'tb-agent-app-install-flow', selector: 'tb-agent-app-install-flow',
templateUrl: './agent-app-install-flow.component.html', templateUrl: './agent-app-install-flow.component.html',
styleUrls: ['./agent-app-install-flow.component.scss'], styleUrls: ['./agent-app-install-flow.component.scss'],
standalone: false standalone: false,
host: {
'[class.tb-embedded]': 'embedded'
}
}) })
export class AgentAppInstallFlowComponent extends PageComponent implements OnInit { export class AgentAppInstallFlowComponent extends PageComponent implements OnInit {
@ -82,6 +88,9 @@ export class AgentAppInstallFlowComponent extends PageComponent implements OnIni
@ViewChild('stepper', { static: false }) @ViewChild('stepper', { static: false })
stepper: MatStepper; stepper: MatStepper;
readonly stepLabels = AGENT_APP_INSTALL_STEP_LABELS;
steps: AgentAppInstallStepKey[] = [];
selectedIndex = 0;
bindings: StepBinding[] = []; bindings: StepBinding[] = [];
@ -207,6 +216,7 @@ export class AgentAppInstallFlowComponent extends PageComponent implements OnIni
} }
ngOnInit() { ngOnInit() {
this.steps = this.buildSteps();
this.relatedEntityId = this.lockedRelatedEntity || null; this.relatedEntityId = this.lockedRelatedEntity || null;
if (this.selectAgent && this.lockedRelatedEntity?.id && this.lockedRelatedEntity?.entityType) { if (this.selectAgent && this.lockedRelatedEntity?.id && this.lockedRelatedEntity?.entityType) {
this.checkingManaged = true; this.checkingManaged = true;
@ -402,12 +412,7 @@ export class AgentAppInstallFlowComponent extends PageComponent implements OnIni
const appType = this.selectedType || this.lockedType; const appType = this.selectedType || this.lockedType;
if (!appType) { return; } if (!appType) { return; }
const presetName = this.relatedEntityName ? `${this.relatedEntityName} profile` : undefined; const presetName = this.relatedEntityName ? `${this.relatedEntityName} profile` : undefined;
this.dialog.open<AgentAppProfileWizardComponent, AgentAppProfileWizardData, AgentAppProfile>( openAgentAppProfileWizard(this.dialog, { lockedAppType: appType, presetName }).subscribe(saved => {
AgentAppProfileWizardComponent, {
disableClose: true,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'],
data: { lockedAppType: appType, presetName }
}).afterClosed().subscribe(saved => {
if (saved) { if (saved) {
this.availableProfiles = [ this.availableProfiles = [
...this.availableProfiles.filter(p => !(isVirtualAppProfile(p) && p.templateVersion === saved.templateVersion)), ...this.availableProfiles.filter(p => !(isVirtualAppProfile(p) && p.templateVersion === saved.templateVersion)),
@ -421,12 +426,7 @@ export class AgentAppInstallFlowComponent extends PageComponent implements OnIni
openEditProfile() { openEditProfile() {
if (!this.selectedProfile || isVirtualAppProfile(this.selectedProfile)) { return; } if (!this.selectedProfile || isVirtualAppProfile(this.selectedProfile)) { return; }
this.dialog.open<AgentAppProfileWizardComponent, AgentAppProfileWizardData, AgentAppProfile>( openAgentAppProfileWizard(this.dialog, { profile: this.selectedProfile }).subscribe(saved => {
AgentAppProfileWizardComponent, {
disableClose: true,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'],
data: { profile: this.selectedProfile }
}).afterClosed().subscribe(saved => {
if (saved) { if (saved) {
this.availableProfiles = this.availableProfiles.map(p => p.id?.id === saved.id?.id ? saved : p); this.availableProfiles = this.availableProfiles.map(p => p.id?.id === saved.id?.id ? saved : p);
this.cacheRealProfiles(saved.appType); this.cacheRealProfiles(saved.appType);
@ -731,4 +731,55 @@ export class AgentAppInstallFlowComponent extends PageComponent implements OnIni
cancel() { cancel() {
this.cancelled.emit(null); 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;
}
} }

22
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<AgentAppInstallWizardResult> {
return dialog.open<AgentAppInstallWizardComponent, AgentAppInstallWizardData, AgentAppInstallWizardResult>(
AgentAppInstallWizardComponent, {
disableClose: false,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-wide-dialog'],
data
}
).afterClosed();
}

5
ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-install-wizard.component.scss

@ -1,5 +0,0 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1
@use 'agent-wizard' as *;
@include wizard-chrome;

1
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({ @Component({
selector: 'tb-agent-app-install-wizard', selector: 'tb-agent-app-install-wizard',
templateUrl: './agent-app-install-wizard.component.html', templateUrl: './agent-app-install-wizard.component.html',
styleUrls: ['./agent-app-install-wizard.component.scss'],
standalone: false, standalone: false,
providers: [AgentAppWizardLoaderService, AgentAppWizardSubmitService] providers: [AgentAppWizardLoaderService, AgentAppWizardSubmitService]
}) })

72
ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-update-flow.component.html

@ -5,36 +5,28 @@
--> -->
@if (!embedded) { @if (!embedded) {
<mat-toolbar color="tb-primary" class="tb-install-wizard-toolbar"> <mat-toolbar color="tb-primary" class="tb-bottom-border">
@if (showBack) { @if (showBack) {
<button mat-icon-button (click)="back.emit()" type="button" tabindex="-1"> <button mat-icon-button (click)="back.emit()" type="button">
<mat-icon>arrow_back</mat-icon> <mat-icon class="material-icons">arrow_back</mat-icon>
</button> </button>
} }
<div class="tb-install-wizard-toolbar-content"> <h2>{{ 'agent.app-update-wizard-title' | translate }}@if (existingApplication) {: {{ 'agent.app-update-on-app' | translate: { name: existingApplication?.name } }}}</h2>
<h2>{{ 'agent.app-update-wizard-title' | translate }}@if (existingApplication) { <span class="flex-1"></span>
:
}</h2>
@if (existingApplication) {
<span class="flex-1">
{{ 'agent.app-update-on-app' | translate: { name: existingApplication?.name } }}
</span>
}
</div>
<div tb-help="agentAppUpdate"></div> <div tb-help="agentAppUpdate"></div>
<button mat-icon-button (click)="cancel()" type="button" tabindex="-1"> <button mat-icon-button (click)="cancel()" type="button">
<mat-icon>close</mat-icon> <mat-icon class="material-icons">close</mat-icon>
</button> </button>
</mat-toolbar> </mat-toolbar>
} }
<div mat-dialog-content>
<div mat-dialog-content class="tb-install-wizard-body" [class.tb-install-wizard-embedded]="embedded">
<mat-stepper linear #stepper <mat-stepper linear #stepper
(selectionChange)="selectedIndex = $event.selectedIndex"
[orientation]="(stepperOrientation | async)" [orientation]="(stepperOrientation | async)"
[labelPosition]="(stepperLabelPosition | async)"> [labelPosition]="(stepperLabelPosition | async)">
<mat-step [label]="'agent.app-install-step3' | translate"> <mat-step [label]="'agent.app-install-step3' | translate" [completed]="canSubmit()">
<mat-form-field class="mat-block" appearance="outline"> <mat-form-field class="mat-block" appearance="outline">
<mat-label translate>agent.app-install-name</mat-label> <mat-label translate>agent.app-install-name</mat-label>
@ -124,13 +116,6 @@
<tb-agent-compose-diff [left]="currentYaml" [right]="futureYaml" [readOnly]="readOnlyCompare" [syncScroll]="diffSyncScroll"></tb-agent-compose-diff> <tb-agent-compose-diff [left]="currentYaml" [right]="futureYaml" [readOnly]="readOnlyCompare" [syncScroll]="diffSyncScroll"></tb-agent-compose-diff>
<p class="diff-hint" translate>agent.app-update-compare-hint</p> <p class="diff-hint" translate>agent.app-update-compare-hint</p>
} }
<div class="step-footer">
<button mat-raised-button color="primary" matStepperNext [disabled]="!canSubmit()">
{{ 'action.next' | translate }}
<mat-icon iconPositionEnd>chevron_right</mat-icon>
</button>
</div>
</mat-step> </mat-step>
<mat-step [label]="'agent.app-install-step4' | translate"> <mat-step [label]="'agent.app-install-step4' | translate">
@ -171,18 +156,33 @@
<mat-icon>info_outline</mat-icon> <mat-icon>info_outline</mat-icon>
<span translate>agent.app-install-confirm-info</span> <span translate>agent.app-install-confirm-info</span>
</div> </div>
<div class="step-footer">
<button mat-button matStepperPrevious [disabled]="submitting">
<mat-icon>chevron_left</mat-icon>
{{ 'action.back' | translate }}
</button>
<button mat-raised-button color="primary" (click)="submit()" [disabled]="!canSubmit()">
<mat-icon>save</mat-icon>
<span>{{ 'agent.app-update-cta' | translate }}</span>
</button>
</div>
</mat-step> </mat-step>
</mat-stepper> </mat-stepper>
</div> </div>
<div mat-dialog-actions>
<div class="dialog-actions-row flex flex-1 flex-row items-center justify-end">
@if (selectedIndex > 0) {
<button mat-stroked-button
[disabled]="submitting"
(click)="stepper.previous()">{{ 'action.back' | translate }}</button>
}
<span class="flex-1"></span>
@if (selectedIndex === 0) {
<button mat-stroked-button
color="primary"
[disabled]="!canSubmit()"
(click)="stepper.next()">{{ 'action.next-with-label' | translate: { label: ('agent.app-install-step4' | translate) } }}</button>
}
</div>
<mat-divider class="w-full"></mat-divider>
<div class="dialog-actions-row flex flex-1 flex-row items-center justify-end gap-2">
<button mat-button
[disabled]="submitting"
(click)="cancel()">{{ 'action.cancel' | translate }}</button>
<button mat-raised-button
color="primary"
[disabled]="selectedIndex !== 1 || !canSubmit()"
(click)="submit()">{{ 'agent.app-update-cta' | translate }}</button>
</div>
</div>

2
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 // SPDX-License-Identifier: BUSL-1.1
@use 'agent-wizard' as *; @use 'agent-wizard' as *;
@include wizard-chrome; @include wizard-stepper-dialog(1280px);
@include wizard-step-basics; @include wizard-step-basics;
@include wizard-config-section; @include wizard-config-section;
@include wizard-diff; @include wizard-diff;

14
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 { buildUpdateApplication } from '@home/pages/agent/util/agent-app-payloads';
import { buildUpdateMergeDraft } from '@home/pages/agent/util/agent-app-compose-preview'; 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 { composeTemplateKeys, composeTypeLabelKey, dumpCompose, pickComposeType } from '@home/pages/agent/util/agent-compose-yaml';
import { import { openAgentAppProfileWizard } from '@home/pages/agent/wizard/agent-app-profile-wizard-dialog';
AgentAppProfileWizardComponent,
AgentAppProfileWizardData
} from '@home/pages/agent/wizard/agent-app-profile-wizard.component';
import { AgentAppWizardLoaderService } from '@home/pages/agent/wizard/agent-app-wizard-loader.service'; 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 { AgentAppWizardSubmitService } from '@home/pages/agent/wizard/agent-app-wizard-submit.service';
import { AgentAppUpgradeResult, AgentAppWizardFinish } from '@home/pages/agent/wizard/agent-app-wizard.models'; 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<AgentAppUpgradeResult | null>(); @Output() cancelled = new EventEmitter<AgentAppUpgradeResult | null>();
@Output() back = new EventEmitter<void>(); @Output() back = new EventEmitter<void>();
selectedIndex = 0;
bindings: StepBinding[] = []; bindings: StepBinding[] = [];
proposedYaml = ''; proposedYaml = '';
@ -237,12 +236,7 @@ export class AgentAppUpdateFlowComponent extends PageComponent implements OnInit
openEditProfile() { openEditProfile() {
if (!this.profileForCompare) { return; } if (!this.profileForCompare) { return; }
this.dialog.open<AgentAppProfileWizardComponent, AgentAppProfileWizardData, AgentAppProfile>( openAgentAppProfileWizard(this.dialog, { profile: this.profileForCompare }).subscribe(saved => {
AgentAppProfileWizardComponent, {
disableClose: true,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'],
data: { profile: this.profileForCompare }
}).afterClosed().subscribe(saved => {
if (saved) { if (saved) {
this.profileForCompare = saved; this.profileForCompare = saved;
this.refreshFutureCompare(); this.refreshFutureCompare();

294
ui-ngx/src/app/modules/home/components/agent/wizard/agent-app-upgrade-flow.component.html

@ -5,30 +5,21 @@
--> -->
@if (!embedded) { @if (!embedded) {
<mat-toolbar color="tb-primary" class="tb-install-wizard-toolbar"> <mat-toolbar color="tb-primary" class="tb-bottom-border">
@if (showBack) { @if (showBack) {
<button mat-icon-button (click)="back.emit()" type="button" tabindex="-1"> <button mat-icon-button (click)="back.emit()" type="button">
<mat-icon>arrow_back</mat-icon> <mat-icon class="material-icons">arrow_back</mat-icon>
</button> </button>
} }
<div class="tb-install-wizard-toolbar-content"> <h2>{{ 'agent.app-upgrade-title' | translate }}@if (existingApplication) {: {{ 'agent.app-upgrade-heading' | translate: { name: existingApplication?.name, from: fromVersion || '—', to: toVersion || '—' } }}}</h2>
<h2>{{ 'agent.app-upgrade-title' | translate }}@if (existingApplication) { <span class="flex-1"></span>
:
}</h2>
@if (existingApplication) {
<span class="flex-1">
{{ 'agent.app-upgrade-heading' | translate: { name: existingApplication?.name, from: fromVersion || '—', to: toVersion || '—' } }}
</span>
}
</div>
<div tb-help="agentAppUpgrade"></div> <div tb-help="agentAppUpgrade"></div>
<button mat-icon-button (click)="cancel()" type="button" tabindex="-1"> <button mat-icon-button (click)="cancel()" type="button">
<mat-icon>close</mat-icon> <mat-icon class="material-icons">close</mat-icon>
</button> </button>
</mat-toolbar> </mat-toolbar>
} }
<div mat-dialog-content>
<div mat-dialog-content class="tb-install-wizard-body" [class.tb-install-wizard-embedded]="embedded">
@if (loadingTemplate || loadingProfile) { @if (loadingTemplate || loadingProfile) {
<div class="loading-state"> <div class="loading-state">
@ -45,143 +36,154 @@
@if (!(loadingTemplate || loadingProfile || loadError)) { @if (!(loadingTemplate || loadingProfile || loadError)) {
<mat-stepper linear #stepper <mat-stepper linear #stepper
(selectionChange)="selectedIndex = $event.selectedIndex"
[orientation]="(stepperOrientation | async)" [orientation]="(stepperOrientation | async)"
[labelPosition]="(stepperLabelPosition | async)"> [labelPosition]="(stepperLabelPosition | async)">
@if (showProfileUpgradeStep) { @for (step of steps; track step) {
<mat-step [label]="'agent.app-upgrade-profile-step' | translate" @switch (step) {
[completed]="profileUpgraded"> @case ('profile') {
@if (loadingProfile) { <mat-step [label]="stepLabels[step] | translate"
<div class="loading-state"> [completed]="profileUpgraded">
<mat-spinner diameter="20"></mat-spinner> @if (loadingProfile) {
<span translate>agent.app-upgrade-profile-loading</span> <div class="loading-state">
</div> <mat-spinner diameter="20"></mat-spinner>
<span translate>agent.app-upgrade-profile-loading</span>
</div>
}
@if (!loadingProfile && profileLoadError) {
<div class="error-state">
<mat-icon>error_outline</mat-icon>
<span>{{ profileLoadError }}</span>
</div>
}
@if (!loadingProfile && !profileLoadError && profile && template) {
<div class="summary-card" style="margin-bottom: 16px;">
<div class="summary-row">
<span class="label" translate>agent.app-upgrade-profile-name</span>
<span class="value">{{ profile.name }}</span>
</div>
<div class="summary-row">
<span class="label" translate>agent.app-upgrade-summary-versions</span>
<span class="value">{{ fromVersion || '—' }} → {{ toVersion || '—' }}</span>
</div>
</div>
<p class="hint" translate>agent.app-upgrade-profile-hint</p>
<div class="diff-header-row">
<div class="diff-header added">
{{ 'agent.app-upgrade-template-new' | translate: { version: toVersion || '—' } }}
</div>
<div class="diff-header removed" translate>agent.app-upgrade-profile-current</div>
@if (profileUpgraded) {
<div class="diff-readonly-chip">
<mat-icon>lock</mat-icon>
<span translate>agent.app-diff-read-only</span>
</div>
}
<button type="button" class="diff-sync-toggle"
[class.active]="diffSyncScroll"
[matTooltip]="'agent.app-diff-sync-scroll' | translate"
(click)="diffSyncScroll = !diffSyncScroll">
<mat-icon>{{ diffSyncScroll ? 'link' : 'link_off' }}</mat-icon>
</button>
</div>
<tb-agent-compose-diff [left]="profileProposedYaml" [right]="profileCurrentYaml" [readOnly]="profileUpgraded" [syncScroll]="diffSyncScroll" (rightChange)="profileComposeYaml = $event"></tb-agent-compose-diff>
<p class="diff-hint" translate>agent.app-upgrade-diff-hint</p>
}
</mat-step>
} }
@if (!loadingProfile && profileLoadError) { @case ('config') {
<div class="error-state"> <mat-step [label]="stepLabels[step] | translate" [completed]="canSubmit()">
<mat-icon>error_outline</mat-icon> @if (canHaveRelatedEntity && isProfileBoundUpgrade) {
<span>{{ profileLoadError }}</span> <tb-agent-related-entity-autocomplete
</div> [appType]="selectedType || existingApplication?.appType"
[disabled]="!!lockedRelatedEntity"
[required]="relatedEntityRequired"
[ngModel]="relatedEntityId"
(ngModelChange)="relatedEntityId = $event">
</tb-agent-related-entity-autocomplete>
}
<tb-agent-app-step-inputs [bindings]="bindings"></tb-agent-app-step-inputs>
@if (!isProfileBoundUpgrade) {
<div class="diff-header-row">
<div class="diff-header added">
{{ 'agent.app-upgrade-template-new' | translate: { version: toVersion || '—' } }}
</div>
<div class="diff-header removed" translate>agent.app-upgrade-current</div>
<button type="button" class="diff-sync-toggle"
[class.active]="diffSyncScroll"
[matTooltip]="'agent.app-diff-sync-scroll' | translate"
(click)="diffSyncScroll = !diffSyncScroll">
<mat-icon>{{ diffSyncScroll ? 'link' : 'link_off' }}</mat-icon>
</button>
</div>
<tb-agent-compose-diff [left]="proposedYaml" [right]="currentYaml" [syncScroll]="diffSyncScroll" (rightChange)="composeYaml = $event"></tb-agent-compose-diff>
<p class="diff-hint" translate>agent.app-upgrade-diff-hint</p>
}
</mat-step>
} }
@if (!loadingProfile && !profileLoadError && profile && template) { @case ('summary') {
<div class="summary-card" style="margin-bottom: 16px;"> <mat-step [label]="stepLabels[step] | translate">
<div class="summary-row"> <div class="summary-card">
<span class="label" translate>agent.app-upgrade-profile-name</span> <div class="summary-row">
<span class="value">{{ profile.name }}</span> <span class="label" translate>agent.app-name</span>
</div> <span class="value">{{ appName }}</span>
<div class="summary-row"> </div>
<span class="label" translate>agent.app-upgrade-summary-versions</span> <div class="summary-row">
<span class="value">{{ fromVersion || '—' }} → {{ toVersion || '—' }}</span> <span class="label" translate>agent.app-upgrade-summary-versions</span>
<span class="value">{{ fromVersion || '—' }} → {{ toVersion || '—' }}</span>
</div>
@if (hasBackupVolumeInput) {
<div class="summary-row">
<span class="label" translate>agent.app-upgrade-summary-volumes-label</span>
<span class="value">
{{ 'agent.app-upgrade-summary-volumes' | translate: { count: selectedBackupVolumeCount } }}
</span>
</div>
}
</div> </div>
</div> <div class="tb-form-hint tb-primary-fill mb-4">
<p class="hint" translate>agent.app-upgrade-profile-hint</p> <mat-icon>info_outline</mat-icon>
<div class="diff-header-row"> <span translate>agent.app-upgrade-rollback-info</span>
<div class="diff-header added">
{{ 'agent.app-upgrade-template-new' | translate: { version: toVersion || '—' } }}
</div> </div>
<div class="diff-header removed" translate>agent.app-upgrade-profile-current</div> </mat-step>
@if (profileUpgraded) {
<div class="diff-readonly-chip">
<mat-icon>lock</mat-icon>
<span translate>agent.app-diff-read-only</span>
</div>
}
<button type="button" class="diff-sync-toggle"
[class.active]="diffSyncScroll"
[matTooltip]="'agent.app-diff-sync-scroll' | translate"
(click)="diffSyncScroll = !diffSyncScroll">
<mat-icon>{{ diffSyncScroll ? 'link' : 'link_off' }}</mat-icon>
</button>
</div>
<tb-agent-compose-diff [left]="profileProposedYaml" [right]="profileCurrentYaml" [readOnly]="profileUpgraded" [syncScroll]="diffSyncScroll" (rightChange)="profileComposeYaml = $event"></tb-agent-compose-diff>
<p class="diff-hint" translate>agent.app-upgrade-diff-hint</p>
} }
<div class="step-footer">
@if (!profileUpgraded) {
<button mat-raised-button color="primary"
(click)="submitProfileUpgrade()"
[disabled]="!canSubmitProfileUpgrade()"
>
<mat-icon>upgrade</mat-icon>
<span>{{ 'agent.app-upgrade-profile-cta' | translate }}</span>
</button>
}
@if (profileUpgraded) {
<button mat-raised-button color="primary" matStepperNext>
{{ 'action.next' | translate }}
<mat-icon iconPositionEnd>chevron_right</mat-icon>
</button>
}
</div>
</mat-step>
}
<mat-step [label]="'agent.app-install-step3' | translate">
@if (canHaveRelatedEntity && isProfileBoundUpgrade) {
<tb-agent-related-entity-autocomplete
[appType]="selectedType || existingApplication?.appType"
[disabled]="!!lockedRelatedEntity"
[required]="relatedEntityRequired"
[ngModel]="relatedEntityId"
(ngModelChange)="relatedEntityId = $event">
</tb-agent-related-entity-autocomplete>
}
<tb-agent-app-step-inputs [bindings]="bindings"></tb-agent-app-step-inputs>
@if (!isProfileBoundUpgrade) {
<div class="diff-header-row">
<div class="diff-header added">
{{ 'agent.app-upgrade-template-new' | translate: { version: toVersion || '—' } }}
</div>
<div class="diff-header removed" translate>agent.app-upgrade-current</div>
<button type="button" class="diff-sync-toggle"
[class.active]="diffSyncScroll"
[matTooltip]="'agent.app-diff-sync-scroll' | translate"
(click)="diffSyncScroll = !diffSyncScroll">
<mat-icon>{{ diffSyncScroll ? 'link' : 'link_off' }}</mat-icon>
</button>
</div>
<tb-agent-compose-diff [left]="proposedYaml" [right]="currentYaml" [syncScroll]="diffSyncScroll" (rightChange)="composeYaml = $event"></tb-agent-compose-diff>
<p class="diff-hint" translate>agent.app-upgrade-diff-hint</p>
} }
<div class="step-footer"> }
<button mat-raised-button color="primary" matStepperNext [disabled]="!canSubmit()">
{{ 'action.next' | translate }}
<mat-icon iconPositionEnd>chevron_right</mat-icon>
</button>
</div>
</mat-step>
<mat-step [label]="'agent.app-install-step4' | translate">
<div class="summary-card">
<div class="summary-row">
<span class="label" translate>agent.app-name</span>
<span class="value">{{ appName }}</span>
</div>
<div class="summary-row">
<span class="label" translate>agent.app-upgrade-summary-versions</span>
<span class="value">{{ fromVersion || '—' }} → {{ toVersion || '—' }}</span>
</div>
@if (hasBackupVolumeInput) {
<div class="summary-row">
<span class="label" translate>agent.app-upgrade-summary-volumes-label</span>
<span class="value">
{{ 'agent.app-upgrade-summary-volumes' | translate: { count: selectedBackupVolumeCount } }}
</span>
</div>
}
</div>
<div class="tb-form-hint tb-primary-fill mb-4">
<mat-icon>info_outline</mat-icon>
<span translate>agent.app-upgrade-rollback-info</span>
</div>
<div class="step-footer">
<button mat-button matStepperPrevious [disabled]="submitting">
<mat-icon>chevron_left</mat-icon>
{{ 'action.back' | translate }}
</button>
<button mat-raised-button color="primary" (click)="submit()" [disabled]="!canSubmit()">
<mat-icon>upgrade</mat-icon>
<span>{{ 'agent.app-upgrade-cta' | translate }}</span>
</button>
</div>
</mat-step>
</mat-stepper> </mat-stepper>
} }
</div> </div>
<div mat-dialog-actions>
@if (canGoBack() || showNext()) {
<div class="dialog-actions-row flex flex-1 flex-row items-center justify-end">
@if (canGoBack()) {
<button mat-stroked-button
[disabled]="submitting"
(click)="stepper.previous()">{{ 'action.back' | translate }}</button>
}
<span class="flex-1"></span>
@if (showNext()) {
<button mat-stroked-button
color="primary"
[disabled]="!canGoNext()"
(click)="stepper.next()">{{ 'action.next-with-label' | translate: { label: (nextStepLabel() | translate) } }}</button>
}
</div>
<mat-divider class="w-full"></mat-divider>
}
<div class="dialog-actions-row flex flex-1 flex-row items-center justify-end gap-2">
<button mat-button
[disabled]="submitting"
(click)="cancel()">{{ 'action.cancel' | translate }}</button>
@if (currentStep() === 'profile' && !profileUpgraded) {
<button mat-raised-button
color="primary"
[disabled]="!canSubmitProfileUpgrade()"
(click)="submitProfileUpgrade()">{{ 'agent.app-upgrade-profile-cta' | translate }}</button>
} @else {
<button mat-raised-button
color="primary"
[disabled]="currentStep() !== 'summary' || !canSubmit()"
(click)="submit()">{{ 'agent.app-upgrade-cta' | translate }}</button>
}
</div>
</div>

2
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 // SPDX-License-Identifier: BUSL-1.1
@use 'agent-wizard' as *; @use 'agent-wizard' as *;
@include wizard-chrome; @include wizard-stepper-dialog(1280px);
@include wizard-step-basics; @include wizard-step-basics;
@include wizard-diff; @include wizard-diff;
@include wizard-summary; @include wizard-summary;

35
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 * as YAML from 'yaml';
import { AgentAppWizardLoaderService } from '@home/pages/agent/wizard/agent-app-wizard-loader.service'; 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 { 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({ @Component({
selector: 'tb-agent-app-upgrade-flow', selector: 'tb-agent-app-upgrade-flow',
@ -65,10 +70,11 @@ export class AgentAppUpgradeFlowComponent extends PageComponent implements OnIni
profileLoadError = ''; profileLoadError = '';
profileUpgrading = false; profileUpgrading = false;
profileUpgraded = false; profileUpgraded = false;
showProfileUpgradeStep = false;
@ViewChild('stepper', { static: false }) @ViewChild('stepper', { static: false })
stepper: MatStepper; stepper: MatStepper;
readonly stepLabels = AGENT_APP_UPGRADE_STEP_LABELS;
steps: AgentAppUpgradeStepKey[] = ['config', 'summary'];
selectedIndex = 0;
bindings: StepBinding[] = []; bindings: StepBinding[] = [];
@ -210,7 +216,7 @@ export class AgentAppUpgradeFlowComponent extends PageComponent implements OnIni
private maybeInitProfileDiff() { private maybeInitProfileDiff() {
if (!this.needsProfileUpgrade || !this.template || !this.profile || this.profileMergeRequested) { return; } if (!this.needsProfileUpgrade || !this.template || !this.profile || this.profileMergeRequested) { return; }
this.profileMergeRequested = true; this.profileMergeRequested = true;
this.showProfileUpgradeStep = true; this.steps = ['profile', 'config', 'summary'];
const profileComposeType = dockerComposeConfig(this.profile)?.composeType || undefined; const profileComposeType = dockerComposeConfig(this.profile)?.composeType || undefined;
this.profileProposedYaml = dumpRawTemplateCompose(this.template, profileComposeType); this.profileProposedYaml = dumpRawTemplateCompose(this.template, profileComposeType);
const draft = { ...this.profile, templateVersion: this.template.currentVersion } as AgentAppProfile; 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. // the caller refresh even when the user backs out before the app upgrade.
this.cancelled.emit(this.profileUpgraded ? { profileOnly: true } : null); 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]] ?? '';
}
} }

3
ui-ngx/src/app/modules/home/pages/agent/agent-app-profile.component.ts

@ -10,7 +10,6 @@ import {
AgentAppArgument, AgentAppArgument,
AgentAppProfile, AgentAppProfile,
AgentApplicationType, AgentApplicationType,
AgentAppTemplate,
agentApplicationTypeTranslationMap, agentApplicationTypeTranslationMap,
AgentAppConfigType, AgentAppConfigType,
dockerComposeConfig dockerComposeConfig
@ -175,7 +174,7 @@ export class AgentAppProfileComponent extends EntityComponent<AgentAppProfile>
this.dialog.open<AgentAppProfileUpgradeDialogComponent, AgentAppProfileUpgradeDialogData, AgentAppProfile | null>( this.dialog.open<AgentAppProfileUpgradeDialogComponent, AgentAppProfileUpgradeDialogData, AgentAppProfile | null>(
AgentAppProfileUpgradeDialogComponent, { AgentAppProfileUpgradeDialogComponent, {
disableClose: false, disableClose: false,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-wide-dialog'],
data: { profile: this.entity } data: { profile: this.entity }
} }
).afterClosed().subscribe(saved => { ).afterClosed().subscribe(saved => {

13
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 { AgentAppProfileComponent } from '@home/pages/agent/agent-app-profile.component';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { DialogService } from '@core/services/dialog.service'; import { DialogService } from '@core/services/dialog.service';
import { import { openAgentAppProfileWizard } from '@home/pages/agent/wizard/agent-app-profile-wizard-dialog';
AgentAppProfileWizardComponent,
AgentAppProfileWizardData
} from '@home/pages/agent/wizard/agent-app-profile-wizard.component';
import { AiAssistantConfigService } from '@core/services/ai-assistant-config.service'; import { AiAssistantConfigService } from '@core/services/ai-assistant-config.service';
import { AiAssistantViewType } from '@shared/models/ai-chat.models'; import { AiAssistantViewType } from '@shared/models/ai-chat.models';
@ -135,13 +132,7 @@ export class AgentAppProfilesTableConfigResolver {
} }
private openProfileWizard(): Observable<AgentAppProfile | null> { private openProfileWizard(): Observable<AgentAppProfile | null> {
return this.dialog.open<AgentAppProfileWizardComponent, AgentAppProfileWizardData, AgentAppProfile>( return openAgentAppProfileWizard(this.dialog, {}, false).pipe(
AgentAppProfileWizardComponent, {
disableClose: false,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'],
data: {}
}
).afterClosed().pipe(
tap(saved => { tap(saved => {
if (saved) { if (saved) {
this.templateCache.clear(); this.templateCache.clear();

46
ui-ngx/src/app/modules/home/pages/agent/agent-application.component.ts

@ -41,11 +41,7 @@ import {
AgentAppDeleteDialogComponent, AgentAppDeleteDialogComponent,
AgentAppDeleteDialogData AgentAppDeleteDialogData
} from '@home/pages/agent/dialog/agent-app-delete-dialog.component'; } from '@home/pages/agent/dialog/agent-app-delete-dialog.component';
import { import { openAgentAppInstallWizard } from '@home/components/agent/wizard/agent-app-install-wizard-dialog';
AgentAppInstallWizardComponent,
AgentAppInstallWizardData,
AgentAppInstallWizardResult
} from '@home/components/agent/wizard/agent-app-install-wizard.component';
import { catchError, map, mergeMap, share, startWith } from 'rxjs/operators'; import { catchError, map, mergeMap, share, startWith } from 'rxjs/operators';
import { findComposeDownStep } from '@home/pages/agent/util/agent-app-steps'; import { findComposeDownStep } from '@home/pages/agent/util/agent-app-steps';
import { confineWheelToAceEditor } from '@home/pages/agent/util/ace-wheel-confine'; import { confineWheelToAceEditor } from '@home/pages/agent/util/ace-wheel-confine';
@ -387,7 +383,7 @@ export class AgentApplicationComponent extends EntityComponent<AgentApplicationI
mergeMap(futureYaml => this.dialog.open<AgentAppAssignCompareDialogComponent, AgentAppAssignCompareDialogData, boolean>( mergeMap(futureYaml => this.dialog.open<AgentAppAssignCompareDialogComponent, AgentAppAssignCompareDialogData, boolean>(
AgentAppAssignCompareDialogComponent, { AgentAppAssignCompareDialogComponent, {
disableClose: false, disableClose: false,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-wide-dialog'],
data: { data: {
appName: this.entity?.name, appName: this.entity?.name,
profileName: profile.name, profileName: profile.name,
@ -608,18 +604,12 @@ export class AgentApplicationComponent extends EntityComponent<AgentApplicationI
takeUntilDestroyed(this.destroyRef) takeUntilDestroyed(this.destroyRef)
).subscribe(({ full, confirmed }) => { ).subscribe(({ full, confirmed }) => {
if (!confirmed) { return; } if (!confirmed) { return; }
this.dialog.open<AgentAppInstallWizardComponent, AgentAppInstallWizardData, AgentAppInstallWizardResult>( openAgentAppInstallWizard(this.dialog, {
AgentAppInstallWizardComponent, { agentId: full.agentId.id,
disableClose: false, agent: null,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'], mode: 'update',
data: { application: full
agentId: full.agentId.id, }).subscribe(event => {
agent: null,
mode: 'update',
application: full
}
}
).afterClosed().subscribe(event => {
if (event) { if (event) {
this.reloadEntity(); this.reloadEntity();
} }
@ -659,18 +649,12 @@ export class AgentApplicationComponent extends EntityComponent<AgentApplicationI
this.agentService.getAgentApplicationInfoById(this.entity.id.id).pipe( this.agentService.getAgentApplicationInfoById(this.entity.id.id).pipe(
takeUntilDestroyed(this.destroyRef) takeUntilDestroyed(this.destroyRef)
).subscribe(full => { ).subscribe(full => {
this.dialog.open<AgentAppInstallWizardComponent, AgentAppInstallWizardData, AgentAppInstallWizardResult>( openAgentAppInstallWizard(this.dialog, {
AgentAppInstallWizardComponent, { agentId: full.agentId.id,
disableClose: false, agent: null,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'], mode: 'upgrade',
data: { application: full
agentId: full.agentId.id, }).subscribe(event => {
agent: null,
mode: 'upgrade',
application: full
}
}
).afterClosed().subscribe(event => {
if (event) { if (event) {
this.reloadEntity(); this.reloadEntity();
} }
@ -692,7 +676,7 @@ export class AgentApplicationComponent extends EntityComponent<AgentApplicationI
mergeMap(composeDownStep => this.dialog.open<AgentAppDeleteDialogComponent, AgentAppDeleteDialogData, AgentAppEvent | null>( mergeMap(composeDownStep => this.dialog.open<AgentAppDeleteDialogComponent, AgentAppDeleteDialogData, AgentAppEvent | null>(
AgentAppDeleteDialogComponent, { AgentAppDeleteDialogComponent, {
disableClose: false, disableClose: false,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-wide-dialog'],
data: { application: full, composeDownStep } data: { application: full, composeDownStep }
} }
).afterClosed().pipe(map(event => ({ full, event })))) ).afterClosed().pipe(map(event => ({ full, event }))))

54
ui-ngx/src/app/modules/home/pages/agent/agent-applications-table-config.resolver.ts

@ -47,12 +47,8 @@ import {
AgentAppDeleteDialogComponent, AgentAppDeleteDialogComponent,
AgentAppDeleteDialogData AgentAppDeleteDialogData
} from '@home/pages/agent/dialog/agent-app-delete-dialog.component'; } from '@home/pages/agent/dialog/agent-app-delete-dialog.component';
import { import { isAgentAppUpgradeResult } from '@home/components/agent/wizard/agent-app-install-wizard.component';
AgentAppInstallWizardComponent, import { openAgentAppInstallWizard } from '@home/components/agent/wizard/agent-app-install-wizard-dialog';
AgentAppInstallWizardData,
AgentAppInstallWizardResult,
isAgentAppUpgradeResult
} from '@home/components/agent/wizard/agent-app-install-wizard.component';
import { AiAssistantConfigService } from '@core/services/ai-assistant-config.service'; import { AiAssistantConfigService } from '@core/services/ai-assistant-config.service';
import { AiAssistantViewType } from '@shared/models/ai-chat.models'; import { AiAssistantViewType } from '@shared/models/ai-chat.models';
import { AgentId } from '@shared/models/id/agent-id'; import { AgentId } from '@shared/models/id/agent-id';
@ -300,18 +296,12 @@ export class AgentApplicationsTableConfigResolver {
)) ))
).subscribe(({ full, confirmed }) => { ).subscribe(({ full, confirmed }) => {
if (!confirmed) { return; } if (!confirmed) { return; }
this.dialog.open<AgentAppInstallWizardComponent, AgentAppInstallWizardData, AgentAppInstallWizardResult>( openAgentAppInstallWizard(this.dialog, {
AgentAppInstallWizardComponent, { agentId: this.agentId,
disableClose: false, agent: this.agent,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'], mode: 'update',
data: { application: full
agentId: this.agentId, }).subscribe(event => {
agent: this.agent,
mode: 'update',
application: full
}
}
).afterClosed().subscribe(event => {
if (event) { if (event) {
this.config.updateData(); this.config.updateData();
} }
@ -367,7 +357,7 @@ export class AgentApplicationsTableConfigResolver {
this.dialog.open<AgentAppDeleteDialogComponent, AgentAppDeleteDialogData, AgentAppEvent | null>( this.dialog.open<AgentAppDeleteDialogComponent, AgentAppDeleteDialogData, AgentAppEvent | null>(
AgentAppDeleteDialogComponent, { AgentAppDeleteDialogComponent, {
disableClose: false, disableClose: false,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-wide-dialog'],
data: { data: {
application: app, application: app,
agentName: this.agent?.name, agentName: this.agent?.name,
@ -389,18 +379,12 @@ export class AgentApplicationsTableConfigResolver {
} }
private showUpgradeWizard(application: AgentApplicationInfo) { private showUpgradeWizard(application: AgentApplicationInfo) {
this.dialog.open<AgentAppInstallWizardComponent, AgentAppInstallWizardData, AgentAppInstallWizardResult>( openAgentAppInstallWizard(this.dialog, {
AgentAppInstallWizardComponent, { agentId: this.agentId,
disableClose: false, agent: this.agent,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'], mode: 'upgrade',
data: { application
agentId: this.agentId, }).subscribe(event => {
agent: this.agent,
mode: 'upgrade',
application
}
}
).afterClosed().subscribe(event => {
if (event) { if (event) {
this.config.updateData(); this.config.updateData();
} }
@ -408,13 +392,7 @@ export class AgentApplicationsTableConfigResolver {
} }
private openInstallWizard(): Observable<AgentApplicationInfo | null> { private openInstallWizard(): Observable<AgentApplicationInfo | null> {
return this.dialog.open<AgentAppInstallWizardComponent, AgentAppInstallWizardData, AgentAppInstallWizardResult>( return openAgentAppInstallWizard(this.dialog, { agentId: this.agentId, agent: this.agent }).pipe(
AgentAppInstallWizardComponent, {
disableClose: false,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'],
data: { agentId: this.agentId, agent: this.agent }
}
).afterClosed().pipe(
switchMap(result => !isAgentAppUpgradeResult(result) && result?.applicationId?.id switchMap(result => !isAgentAppUpgradeResult(result) && result?.applicationId?.id
? this.agentService.getAgentApplicationInfoById(result.applicationId.id) ? this.agentService.getAgentApplicationInfoById(result.applicationId.id)
: of(null)) : of(null))

31
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 { Observable, of } from 'rxjs';
import { catchError } from 'rxjs/operators'; import { catchError } from 'rxjs/operators';
import { EntityId } from '@shared/models/id/entity-id'; 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 { AgentService } from '@core/http/agent.service';
import { import { AgentAppInstallWizardResult } from '@home/components/agent/wizard/agent-app-install-wizard.component';
AgentAppInstallWizardComponent, import { openAgentAppInstallWizard } from '@home/components/agent/wizard/agent-app-install-wizard-dialog';
AgentAppInstallWizardData,
AgentAppInstallWizardResult
} from '@home/components/agent/wizard/agent-app-install-wizard.component';
@Injectable({ providedIn: 'root' }) @Injectable({ providedIn: 'root' })
export class AgentDeployDialogService { export class AgentDeployDialogService {
@ -29,19 +26,13 @@ export class AgentDeployDialogService {
open(appType: AgentApplicationType, relatedEntity: EntityId, open(appType: AgentApplicationType, relatedEntity: EntityId,
options?: { showBack?: boolean }): Observable<AgentAppInstallWizardResult> { options?: { showBack?: boolean }): Observable<AgentAppInstallWizardResult> {
return this.dialog.open<AgentAppInstallWizardComponent, AgentAppInstallWizardData, AgentAppInstallWizardResult>( return openAgentAppInstallWizard(this.dialog, {
AgentAppInstallWizardComponent, { mode: 'install',
disableClose: false, selectAgent: true,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'], lockedType: appType,
data: { lockedRelatedEntity: relatedEntity,
mode: 'install', navigateToAgentOnFinish: true,
selectAgent: true, showBack: !!options?.showBack
lockedType: appType, });
lockedRelatedEntity: relatedEntity,
navigateToAgentOnFinish: true,
showBack: !!options?.showBack
}
}
).afterClosed();
} }
} }

13
ui-ngx/src/app/modules/home/pages/agent/agent-executions-side-panel.component.ts

@ -28,10 +28,7 @@ import {
AgentProfileInfo AgentProfileInfo
} from '@shared/models/agent.models'; } from '@shared/models/agent.models';
import { TranslateService } from '@ngx-translate/core'; import { TranslateService } from '@ngx-translate/core';
import { import { openAgentAppEventProgress } from '@home/pages/agent/util/agent-app-event-progress';
AgentAppEventProgressDialogComponent,
AgentAppEventProgressDialogData
} from '@home/pages/agent/dialog/agent-app-event-progress-dialog.component';
const NON_TERMINAL_BULK: ReadonlyArray<AgentBulkActionStatus> = [ const NON_TERMINAL_BULK: ReadonlyArray<AgentBulkActionStatus> = [
AgentBulkActionStatus.QUEUED, AgentBulkActionStatus.QUEUED,
@ -173,13 +170,7 @@ export class AgentExecutionsSidePanelComponent implements OnChanges, OnDestroy {
} }
private openProgressDialog(application: AgentApplication | null, event: AgentAppEventInfo): void { private openProgressDialog(application: AgentApplication | null, event: AgentAppEventInfo): void {
this.dialog.open<AgentAppEventProgressDialogComponent, AgentAppEventProgressDialogData, boolean>( openAgentAppEventProgress(this.dialog, application, event).subscribe(() => this.refresh());
AgentAppEventProgressDialogComponent, {
disableClose: false,
panelClass: ['tb-dialog'],
data: { application, event }
}
).afterClosed().subscribe(() => this.refresh());
} }
formatTime(ts: number): string { formatTime(ts: number): string {

11
ui-ngx/src/app/modules/home/pages/agent/agent-install-instructions-dialog.component.scss

@ -1,13 +1,8 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1 // SPDX-License-Identifier: BUSL-1.1
@use '../../components/agent/agent-shared' as *; @use '../../components/agent/wizard/agent-wizard' as *;
:host { @include wizard-dialog(720px);
display: block;
width: min(720px, 95vw);
min-width: 0;
max-width: 95vw;
}
.tb-agent-install-dialog-header { .tb-agent-install-dialog-header {
display: flex; display: flex;
@ -24,8 +19,6 @@
.tb-agent-install-dialog-body { .tb-agent-install-dialog-body {
padding: 16px 24px 24px; padding: 16px 24px 24px;
max-height: 70vh;
overflow-y: auto;
} }
.instructions-section { .instructions-section {

2
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, AgentProfileWizardData, AgentProfile>( return this.dialog.open<AgentProfilePresetDialogComponent, AgentProfileWizardData, AgentProfile>(
AgentProfilePresetDialogComponent, { AgentProfilePresetDialogComponent, {
disableClose: true, disableClose: true,
panelClass: ['tb-dialog'], panelClass: ['tb-dialog', 'tb-fullscreen-dialog'],
data data
}).afterClosed(); }).afterClosed();
} }

32
ui-ngx/src/app/modules/home/pages/agent/agent-profile-created-dialog.component.html

@ -4,18 +4,18 @@
SPDX-License-Identifier: BUSL-1.1 SPDX-License-Identifier: BUSL-1.1
--> -->
<div mat-dialog-title class="tb-agent-profile-created-header"> <mat-toolbar color="tb-primary" class="tb-bottom-border">
<h2 class="flex-1"> <mat-icon class="material-icons mr-2">check_circle</mat-icon>
<mat-icon class="success-icon">check_circle</mat-icon> <h2 translate>agent.agent-profile-created</h2>
<span translate>agent.agent-profile-created</span> <span class="flex-1"></span>
</h2>
<div tb-help="agentProfileProvisionCommand"></div> <div tb-help="agentProfileProvisionCommand"></div>
<button mat-icon-button (click)="close()" tabindex="-1"> <button mat-icon-button
<mat-icon>close</mat-icon> (click)="close()"
type="button">
<mat-icon class="material-icons">close</mat-icon>
</button> </button>
</div> </mat-toolbar>
<div mat-dialog-content>
<div mat-dialog-content class="tb-agent-profile-created-body">
<section class="instructions-section"> <section class="instructions-section">
<h3> <h3>
@ -63,13 +63,13 @@
</div> </div>
<div mat-dialog-actions align="end" class="tb-agent-profile-created-footer"> <div mat-dialog-actions class="flex items-center justify-end">
<button mat-button (click)="close()"> <button mat-button
{{ 'action.close' | translate }} (click)="close()">{{ 'action.close' | translate }}</button>
</button>
@if (agentProfile?.id?.id) { @if (agentProfile?.id?.id) {
<button mat-raised-button color="primary" <button mat-raised-button
(click)="goToProfile()"> color="primary"
(click)="goToProfile()">
<mat-icon>open_in_new</mat-icon> <mat-icon>open_in_new</mat-icon>
<span translate>agent.go-to-profile</span> <span translate>agent.go-to-profile</span>
</button> </button>

49
ui-ngx/src/app/modules/home/pages/agent/agent-profile-created-dialog.component.scss

@ -1,42 +1,8 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1 // SPDX-License-Identifier: BUSL-1.1
@use '../../components/agent/agent-shared' as *; @use '../../components/agent/wizard/agent-wizard' as *;
:host { @include wizard-dialog(760px);
display: block;
width: min(760px, 95vw);
min-width: 0;
max-width: 95vw;
}
.tb-agent-profile-created-header {
display: flex;
align-items: center;
justify-content: space-between;
margin: 0;
h2 {
display: flex;
align-items: center;
gap: 10px;
font-size: 20px;
font-weight: 400;
margin: 0;
.success-icon {
color: #4caf50;
font-size: 24px;
width: 24px;
height: 24px;
}
}
}
.tb-agent-profile-created-body {
padding: 16px 24px 24px;
max-height: 72vh;
overflow-y: auto;
}
.instructions-section { .instructions-section {
h3 { h3 {
@ -89,14 +55,3 @@
} }
} }
} }
.tb-agent-profile-created-footer {
padding: 8px 16px;
button[mat-raised-button] mat-icon {
font-size: 18px;
width: 18px;
height: 18px;
margin-right: 4px;
}
}

5
ui-ngx/src/app/modules/home/pages/agent/agent-profile-merged-profiles.component.ts

@ -28,7 +28,6 @@ import {
AgentAppConfigType, AgentAppConfigType,
AgentAppEventActionType, AgentAppEventActionType,
agentAppEventActionTypeTranslationMap, agentAppEventActionTypeTranslationMap,
AgentAppProfile,
AgentAppProfileRelationInfo, AgentAppProfileRelationInfo,
AgentAppTemplate, AgentAppTemplate,
AgentApplicationType, AgentApplicationType,
@ -321,7 +320,7 @@ export class AgentProfileMergedProfilesComponent implements OnInit, OnChanges, O
this.dialog.open<AgentProfileAssignProfileDialogComponent, AgentProfileAssignProfileDialogData, string[]>( this.dialog.open<AgentProfileAssignProfileDialogComponent, AgentProfileAssignProfileDialogData, string[]>(
AgentProfileAssignProfileDialogComponent, { AgentProfileAssignProfileDialogComponent, {
disableClose: true, disableClose: true,
panelClass: ['tb-dialog'], panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-wide-dialog'],
data: { selectedIds } data: { selectedIds }
} }
).afterClosed().pipe(takeUntil(this.destroy$)).subscribe(nextIds => { ).afterClosed().pipe(takeUntil(this.destroy$)).subscribe(nextIds => {
@ -476,7 +475,7 @@ export class AgentProfileMergedProfilesComponent implements OnInit, OnChanges, O
switchMap(({ templates, preview }) => this.dialog.open<AgentProfileBulkActionDialogComponent, AgentProfileBulkActionDialogData>( switchMap(({ templates, preview }) => this.dialog.open<AgentProfileBulkActionDialogComponent, AgentProfileBulkActionDialogData>(
AgentProfileBulkActionDialogComponent, { AgentProfileBulkActionDialogComponent, {
disableClose: false, disableClose: false,
panelClass: ['tb-dialog'], panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-wide-dialog'],
data: { data: {
agentProfile: this.agentProfile, agentProfile: this.agentProfile,
profile, profile,

2
ui-ngx/src/app/modules/home/pages/agent/agent-profiles-table-config.resolver.ts

@ -97,7 +97,7 @@ export class AgentProfilesTableConfigResolver {
this.dialog.open<AgentProfileCreatedDialogComponent, AgentProfileCreatedDialogData>( this.dialog.open<AgentProfileCreatedDialogComponent, AgentProfileCreatedDialogData>(
AgentProfileCreatedDialogComponent, { AgentProfileCreatedDialogComponent, {
disableClose: false, disableClose: false,
panelClass: ['tb-dialog'], panelClass: ['tb-dialog', 'tb-fullscreen-dialog'],
data: { agentProfile, dockerCommand: res?.instructions || '' } data: { agentProfile, dockerCommand: res?.instructions || '' }
}); });
}); });

2
ui-ngx/src/app/modules/home/pages/agent/agents-table-config.resolver.ts

@ -394,7 +394,7 @@ export class AgentsTableConfigResolver {
this.dialog.open<AgentInstallInstructionsDialogComponent, AgentInstallInstructionsDialogData>( this.dialog.open<AgentInstallInstructionsDialogComponent, AgentInstallInstructionsDialogData>(
AgentInstallInstructionsDialogComponent, { AgentInstallInstructionsDialogComponent, {
disableClose: false, disableClose: false,
panelClass: ['tb-dialog'], panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-wide-dialog'],
data: { data: {
agent, agent,
afterAdd, afterAdd,

30
ui-ngx/src/app/modules/home/pages/agent/dialog/agent-app-assign-compare-dialog.component.html

@ -4,18 +4,15 @@
SPDX-License-Identifier: BUSL-1.1 SPDX-License-Identifier: BUSL-1.1
--> -->
<mat-toolbar color="tb-primary" class="tb-install-wizard-toolbar"> <mat-toolbar color="tb-primary" class="tb-bottom-border">
<div class="tb-install-wizard-toolbar-content"> <h2>{{ 'agent.app-assign-compare-title' | translate }}: {{ data.profileName }}</h2>
<h2>{{ 'agent.app-assign-compare-title' | translate }}:</h2> <span class="flex-1"></span>
<span class="flex-1">{{ data.profileName }}</span>
</div>
<div tb-help="agentAppProfileUse"></div> <div tb-help="agentAppProfileUse"></div>
<button mat-icon-button (click)="cancel()" type="button" tabindex="-1"> <button mat-icon-button (click)="cancel()" type="button">
<mat-icon>close</mat-icon> <mat-icon class="material-icons">close</mat-icon>
</button> </button>
</mat-toolbar> </mat-toolbar>
<div mat-dialog-content>
<div mat-dialog-content class="tb-install-wizard-body">
<div class="diff-header-row"> <div class="diff-header-row">
<div class="diff-header compare">{{ 'agent.app-update-current-config' | translate }}</div> <div class="diff-header compare">{{ 'agent.app-update-current-config' | translate }}</div>
<div class="diff-header compare">{{ 'agent.app-update-future-config' | translate }}</div> <div class="diff-header compare">{{ 'agent.app-update-future-config' | translate }}</div>
@ -35,12 +32,11 @@
{{ 'agent.app-assign-compare-hint' | translate: { profileName: data.profileName, appName: data.appName } }} {{ 'agent.app-assign-compare-hint' | translate: { profileName: data.profileName, appName: data.appName } }}
</p> </p>
<div class="step-footer"> </div>
<button mat-button (click)="cancel()"> <div mat-dialog-actions class="flex items-center justify-end">
{{ 'action.cancel' | translate }} <button mat-button
</button> (click)="cancel()">{{ 'action.cancel' | translate }}</button>
<button mat-raised-button color="primary" (click)="confirm()"> <button mat-raised-button
<span>{{ 'agent.app-assign-compare-cta' | translate }}</span> color="primary"
</button> (click)="confirm()">{{ 'agent.app-assign-compare-cta' | translate }}</button>
</div>
</div> </div>

2
ui-ngx/src/app/modules/home/pages/agent/dialog/agent-app-assign-compare-dialog.component.scss

@ -2,5 +2,5 @@
// SPDX-License-Identifier: BUSL-1.1 // SPDX-License-Identifier: BUSL-1.1
@use '../../../components/agent/wizard/agent-wizard' as *; @use '../../../components/agent/wizard/agent-wizard' as *;
@include wizard-chrome; @include wizard-dialog(1280px);
@include wizard-diff; @include wizard-diff;

15
ui-ngx/src/app/modules/home/pages/agent/dialog/agent-app-event-progress-dialog.component.html

@ -4,16 +4,15 @@
SPDX-License-Identifier: BUSL-1.1 SPDX-License-Identifier: BUSL-1.1
--> -->
<mat-toolbar color="tb-primary" class="tb-progress-dialog-header"> <mat-toolbar color="tb-primary" class="tb-bottom-border">
<h2 mat-dialog-title translate>agent.app-event-progress-title</h2> <h2>{{ 'agent.app-event-progress-title' | translate }}: {{ subjectName }}</h2>
<span class="header-app-name">{{ subjectName }}</span> <span class="flex-1"></span>
<div tb-help="agentAppEvents"></div> <div tb-help="agentAppEvents"></div>
<button mat-icon-button (click)="cancel()" type="button" tabindex="-1"> <button mat-icon-button (click)="cancel()" type="button">
<mat-icon>close</mat-icon> <mat-icon class="material-icons">close</mat-icon>
</button> </button>
</mat-toolbar> </mat-toolbar>
<div mat-dialog-content>
<div mat-dialog-content class="tb-progress-body">
@if (loading) { @if (loading) {
<div class="tb-progress-loading"> <div class="tb-progress-loading">
<mat-spinner diameter="20"></mat-spinner> <mat-spinner diameter="20"></mat-spinner>
@ -112,7 +111,7 @@
} }
</div> </div>
<div mat-dialog-actions class="tb-progress-actions"> <div mat-dialog-actions class="flex flex-wrap items-center justify-end">
@if (canCancel) { @if (canCancel) {
<button mat-button color="warn" (click)="cancelEvent($event)"> <button mat-button color="warn" (click)="cancelEvent($event)">
<mat-icon>cancel</mat-icon> <mat-icon>cancel</mat-icon>

53
ui-ngx/src/app/modules/home/pages/agent/dialog/agent-app-event-progress-dialog.component.scss

@ -1,44 +1,8 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1 // SPDX-License-Identifier: BUSL-1.1
@use '../../../components/agent/agent-shared' as *; @use '../../../components/agent/wizard/agent-wizard' as *;
:host { display: block; width: min(640px, 95vw); min-width: 0; max-width: 95vw; } @include wizard-dialog(640px);
.tb-progress-dialog-header {
display: flex;
align-items: center;
gap: 8px;
padding: 0 16px 0 24px;
min-height: 56px;
h2 {
font-size: 20px;
font-weight: 400;
margin: 0;
padding: 0;
color: inherit;
&::before {
display: none;
}
}
.header-app-name {
flex: 1;
min-width: 0;
font-size: 14px;
font-weight: 500;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.tb-progress-body {
padding: 16px 24px 24px;
max-height: 70vh;
overflow-y: auto;
}
.tb-progress-loading, .tb-progress-loading,
.tb-progress-error { .tb-progress-error {
@ -51,12 +15,12 @@
display: flex; gap: 12px; margin-bottom: 20px; display: flex; gap: 12px; margin-bottom: 20px;
padding: 12px 16px; border: 1px solid $agent-divider-light; padding: 12px 16px; border: 1px solid $agent-divider-light;
border-radius: 4px; background: $agent-surface-muted; border-radius: 4px; background: $agent-surface-muted;
.info-col { flex: 1; } .info-col { flex: 1; min-width: 0; }
.info-label { .info-label {
font-size: 11px; font-weight: 500; color: $agent-text-secondary; font-size: 11px; font-weight: 500; color: $agent-text-secondary;
text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px;
} }
.info-value { font-size: 13px; font-weight: 500; } .info-value { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
} }
.tb-status-badge { .tb-status-badge {
@ -131,7 +95,8 @@
.step-content { flex: 1; padding-top: 4px; min-width: 0; } .step-content { flex: 1; padding-top: 4px; min-width: 0; }
.step-title { .step-title {
font-size: 14px; font-weight: 500; color: $agent-text-primary; font-size: 14px; font-weight: 500; color: $agent-text-primary;
margin-bottom: 2px; display: flex; align-items: center; gap: 8px; margin-bottom: 2px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
overflow-wrap: anywhere;
} }
.step-type-label { .step-type-label {
font-size: 11px; font-weight: 500; padding: 2px 6px; border-radius: 3px; font-size: 11px; font-weight: 500; padding: 2px 6px; border-radius: 3px;
@ -144,9 +109,3 @@
&.processing .step-meta { color: $agent-color-warning-light; font-weight: 500; } &.processing .step-meta { color: $agent-color-warning-light; font-weight: 500; }
&.error .step-meta { color: $agent-color-error; font-weight: 500; } &.error .step-meta { color: $agent-color-error; font-weight: 500; }
} }
.tb-progress-actions {
display: flex; align-items: center;
padding: 8px 16px; border-top: 1px solid $agent-divider-light;
button mat-icon { font-size: 18px; width: 18px; height: 18px; margin-right: 4px; }
}

41
ui-ngx/src/app/modules/home/pages/agent/dialog/agent-app-profile-upgrade-dialog.component.html

@ -4,18 +4,15 @@
SPDX-License-Identifier: BUSL-1.1 SPDX-License-Identifier: BUSL-1.1
--> -->
<mat-toolbar color="tb-primary" class="tb-install-wizard-toolbar"> <mat-toolbar color="tb-primary" class="tb-bottom-border">
<div class="tb-install-wizard-toolbar-content"> <h2>{{ 'agent.app-upgrade-title' | translate }}: {{ profile.name }}</h2>
<h2>{{ 'agent.app-upgrade-title' | translate }}:</h2> <span class="flex-1"></span>
<span class="flex-1">{{ profile.name }}</span>
</div>
<div tb-help="agentAppProfileVersions"></div> <div tb-help="agentAppProfileVersions"></div>
<button mat-icon-button (click)="cancel()" type="button" tabindex="-1"> <button mat-icon-button (click)="cancel()" type="button">
<mat-icon>close</mat-icon> <mat-icon class="material-icons">close</mat-icon>
</button> </button>
</mat-toolbar> </mat-toolbar>
<div mat-dialog-content>
<div mat-dialog-content class="tb-install-wizard-body">
@if (loadingTemplate) { @if (loadingTemplate) {
<div class="loading-state"> <div class="loading-state">
@ -27,9 +24,6 @@
<div class="error-state"> <div class="error-state">
<mat-icon>error_outline</mat-icon> <mat-icon>error_outline</mat-icon>
<span>{{ loadError }}</span> <span>{{ loadError }}</span>
<div class="step-footer">
<button mat-button (click)="cancel()">{{ 'action.close' | translate }}</button>
</div>
</div> </div>
} }
@ -61,14 +55,19 @@
<span translate>agent.app-compose-invalid-yaml</span> <span translate>agent.app-compose-invalid-yaml</span>
</div> </div>
} }
<div class="step-footer"> }
<button mat-button (click)="cancel()" [disabled]="submitting"> </div>
{{ 'action.cancel' | translate }} <div mat-dialog-actions class="flex items-center justify-end">
</button> <button mat-button
<button mat-raised-button color="primary" (click)="submit()" [disabled]="!canSubmit()"> [disabled]="submitting"
<mat-icon>upgrade</mat-icon> (click)="cancel()">{{ (loadError ? 'action.close' : 'action.cancel') | translate }}</button>
<span>{{ 'agent.app-upgrade-cta' | translate }}</span> @if (!loadingTemplate && !loadError) {
</button> <button mat-raised-button
</div> color="primary"
[disabled]="!canSubmit()"
(click)="submit()">
<mat-icon>upgrade</mat-icon>
<span>{{ 'agent.app-upgrade-cta' | translate }}</span>
</button>
} }
</div> </div>

2
ui-ngx/src/app/modules/home/pages/agent/dialog/agent-app-profile-upgrade-dialog.component.scss

@ -2,7 +2,7 @@
// SPDX-License-Identifier: BUSL-1.1 // SPDX-License-Identifier: BUSL-1.1
@use '../../../components/agent/wizard/agent-wizard' as *; @use '../../../components/agent/wizard/agent-wizard' as *;
@include wizard-chrome; @include wizard-dialog(1280px);
@include wizard-step-basics; @include wizard-step-basics;
@include wizard-diff; @include wizard-diff;
@include wizard-summary; @include wizard-summary;

18
ui-ngx/src/app/modules/home/pages/agent/dialog/agent-app-version-warning-dialog.component.html

@ -4,16 +4,18 @@
SPDX-License-Identifier: BUSL-1.1 SPDX-License-Identifier: BUSL-1.1
--> -->
<div mat-dialog-title class="tb-app-version-warning-header" [class.destructive]="destructive"> <mat-toolbar color="tb-primary" class="tb-bottom-border">
<mat-icon class="warn-icon">warning</mat-icon> <mat-icon class="material-icons mr-2 flex-none">warning</mat-icon>
<h2>{{ titleKey | translate }}</h2> <h2>{{ titleKey | translate }}</h2>
<span class="flex-1"></span>
<div tb-help="agentAppProfileVersions"></div> <div tb-help="agentAppProfileVersions"></div>
<button mat-icon-button (click)="cancel()" tabindex="-1"> <button mat-icon-button
<mat-icon>close</mat-icon> (click)="cancel()"
type="button">
<mat-icon class="material-icons">close</mat-icon>
</button> </button>
</div> </mat-toolbar>
<div mat-dialog-content>
<div mat-dialog-content class="tb-app-version-warning-body">
<p class="warning-text"> <p class="warning-text">
{{ textKey | translate: { {{ textKey | translate: {
@ -40,7 +42,7 @@
</div> </div>
</div> </div>
<div mat-dialog-actions align="end" class="tb-app-version-warning-footer"> <div mat-dialog-actions class="flex flex-wrap items-center justify-end">
<button mat-button (click)="cancel()"> <button mat-button (click)="cancel()">
{{ 'action.cancel' | translate }} {{ 'action.cancel' | translate }}
</button> </button>

53
ui-ngx/src/app/modules/home/pages/agent/dialog/agent-app-version-warning-dialog.component.scss

@ -1,55 +1,16 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1 // SPDX-License-Identifier: BUSL-1.1
@use '../../../components/agent/agent-shared' as *; @use '../../../components/agent/wizard/agent-wizard' as *;
:host { @include wizard-dialog(560px);
display: block;
width: min(560px, 95vw);
min-width: 0;
max-width: 95vw;
}
.tb-app-version-warning-header {
display: flex;
align-items: center;
gap: 8px;
margin: 0;
.warn-icon {
color: $agent-color-warning-strong;
font-size: 22px;
width: 22px;
height: 22px;
}
&.destructive .warn-icon { .warning-text {
color: $agent-color-error-accent; font-size: 14px;
} color: rgba(0, 0, 0, 0.74);
margin: 0 0 16px;
h2 { line-height: 1.5;
flex: 1;
font-size: 20px;
font-weight: 400;
margin: 0;
}
}
.tb-app-version-warning-body {
padding: 16px 24px 24px;
.warning-text {
font-size: 14px;
color: rgba(0, 0, 0, 0.74);
margin: 0 0 16px;
line-height: 1.5;
}
} }
.app-summary { .app-summary {
@include agent-summary-card($agent-surface-muted, $agent-divider-light); @include agent-summary-card($agent-surface-muted, $agent-divider-light);
} }
.tb-app-version-warning-footer {
padding: 8px 24px 16px;
gap: 8px;
}

9
ui-ngx/src/app/modules/home/pages/agent/dialog/agent-profile-assign-profile-dialog.component.scss

@ -1,13 +1,8 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1 // SPDX-License-Identifier: BUSL-1.1
@use '../../../components/agent/agent-shared' as *; @use '../../../components/agent/wizard/agent-wizard' as *;
:host { @include wizard-dialog(920px);
display: block;
width: min(920px, 95vw);
min-width: 0;
max-width: 95vw;
}
.tb-create-new-link { .tb-create-new-link {
white-space: nowrap; white-space: nowrap;

15
ui-ngx/src/app/modules/home/pages/agent/dialog/agent-profile-assign-profile-dialog.component.ts

@ -7,11 +7,8 @@ import { Router } from '@angular/router';
import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog'; import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog';
import { DialogComponent } from '@shared/components/dialog.component'; import { DialogComponent } from '@shared/components/dialog.component';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms'; import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { AgentAppProfile, AgentApplicationType } from '@shared/models/agent.models'; import { AgentApplicationType } from '@shared/models/agent.models';
import { import { openAgentAppProfileWizard } from '@home/pages/agent/wizard/agent-app-profile-wizard-dialog';
AgentAppProfileWizardComponent,
AgentAppProfileWizardData
} from '@home/pages/agent/wizard/agent-app-profile-wizard.component';
export interface AgentProfileAssignProfileDialogData { export interface AgentProfileAssignProfileDialogData {
selectedIds?: string[]; selectedIds?: string[];
@ -62,13 +59,7 @@ export class AgentProfileAssignProfileDialogComponent
} }
private openAppProfileWizard() { private openAppProfileWizard() {
this.dialog.open<AgentAppProfileWizardComponent, AgentAppProfileWizardData, AgentAppProfile>( openAgentAppProfileWizard(this.dialog, { lockedAppType: this.data?.lockedAppType }).subscribe(saved => {
AgentAppProfileWizardComponent, {
disableClose: true,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'],
data: { lockedAppType: this.data?.lockedAppType }
}
).afterClosed().subscribe(saved => {
if (saved) { if (saved) {
const currentIds: string[] = this.formGroup.value?.appProfileIds ?? []; const currentIds: string[] = this.formGroup.value?.appProfileIds ?? [];
if (!currentIds.includes(saved.id.id)) { if (!currentIds.includes(saved.id.id)) {

11
ui-ngx/src/app/modules/home/pages/agent/dialog/agent-profile-bulk-action-dialog.component.scss

@ -1,13 +1,8 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1 // SPDX-License-Identifier: BUSL-1.1
@use '../../../components/agent/agent-shared' as *; @use '../../../components/agent/wizard/agent-wizard' as *;
:host { @include wizard-dialog(720px);
display: block;
width: min(720px, 95vw);
min-width: 0;
max-width: 95vw;
}
.tb-bulk-dialog-header { .tb-bulk-dialog-header {
display: flex; display: flex;
@ -25,8 +20,6 @@
.tb-bulk-dialog-body { .tb-bulk-dialog-body {
padding: 16px 24px; padding: 16px 24px;
max-height: 70vh;
overflow-y: auto;
} }
.tb-bulk-summary { .tb-bulk-summary {

63
ui-ngx/src/app/modules/home/pages/agent/dialog/agent-profile-preset-dialog.component.html

@ -4,29 +4,30 @@
SPDX-License-Identifier: BUSL-1.1 SPDX-License-Identifier: BUSL-1.1
--> -->
<div mat-dialog-title class="tb-preset-dialog-header"> <mat-toolbar color="tb-primary" class="tb-bottom-border">
<h2 translate>agent.add-profile</h2> <h2 translate>agent.add-profile</h2>
<span class="flex-1"></span>
<div tb-help="agentProfiles"></div> <div tb-help="agentProfiles"></div>
<button mat-icon-button (click)="cancel()" tabindex="-1"> <button mat-icon-button
<mat-icon>close</mat-icon> (click)="cancel()"
type="button">
<mat-icon class="material-icons">close</mat-icon>
</button> </button>
</div> </mat-toolbar>
@if (mode === 'advanced') {
<div mat-dialog-content class="tb-preset-dialog-body" [class.tb-preset-body-advanced]="mode === 'advanced'"> <tb-agent-profile-wizard
@if (mode === 'advanced') { [embedded]="true"
<tb-agent-profile-wizard [showBack]="true"
[embedded]="true" [defaults]="advancedDefaults"
[showBack]="true" [lockedAppType]="data?.lockedAppType"
[defaults]="advancedDefaults" (finished)="onAdvancedFinished($event)"
[lockedAppType]="data?.lockedAppType" (cancelled)="cancel()"
(finished)="onAdvancedFinished($event)" (backClicked)="onAdvancedBack()">
(cancelled)="cancel()" </tb-agent-profile-wizard>
(backClicked)="onAdvancedBack()"> }
</tb-agent-profile-wizard> @if (mode === 'preset') {
} <div mat-dialog-content>
<div [formGroup]="form">
@if (mode === 'preset') {
<form [formGroup]="form">
<mat-form-field class="mat-block" appearance="outline" subscriptSizing="dynamic"> <mat-form-field class="mat-block" appearance="outline" subscriptSizing="dynamic">
<mat-label translate>agent.profile-name</mat-label> <mat-label translate>agent.profile-name</mat-label>
<input matInput formControlName="name" required <input matInput formControlName="name" required
@ -38,7 +39,7 @@
</mat-error> </mat-error>
} }
</mat-form-field> </mat-form-field>
</form> </div>
<div class="tb-preset-section-label" translate>agent.preset-setup</div> <div class="tb-preset-section-label" translate>agent.preset-setup</div>
<div class="tb-preset-grid"> <div class="tb-preset-grid">
@for (tile of tiles; track tile.labelKey) { @for (tile of tiles; track tile.labelKey) {
@ -93,16 +94,14 @@
</div> </div>
</div> </div>
} }
} </div>
</div> <div mat-dialog-actions class="flex items-center justify-end">
<button mat-button
@if (mode === 'preset') { [disabled]="submitting"
<div mat-dialog-actions align="end" class="tb-preset-dialog-footer"> (click)="cancel()">{{ 'action.cancel' | translate }}</button>
<button mat-button (click)="cancel()" [disabled]="submitting"> <button mat-raised-button
{{ 'action.cancel' | translate }} color="primary"
</button> [disabled]="!canSubmit"
<button mat-raised-button color="primary" (click)="submit()" [disabled]="!canSubmit"> (click)="submit()">{{ 'action.add' | translate }}</button>
{{ 'action.add' | translate }}
</button>
</div> </div>
} }

45
ui-ngx/src/app/modules/home/pages/agent/dialog/agent-profile-preset-dialog.component.scss

@ -1,42 +1,11 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc. // SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1 // SPDX-License-Identifier: BUSL-1.1
@use '../../../components/agent/agent-shared' as *; @use '../../../components/agent/wizard/agent-wizard' as *;
:host { @include wizard-dialog(720px);
display: block;
width: min(720px, 95vw);
min-width: 0;
max-width: 95vw;
}
.tb-preset-dialog-header {
display: flex;
align-items: center;
gap: 8px;
border-bottom: 1px solid $agent-divider;
h2 {
flex: 1;
font-size: 20px;
font-weight: 400;
margin: 0;
}
}
.tb-preset-dialog-body {
max-height: 75vh;
padding: 12px 24px 16px;
&.tb-preset-body-advanced {
padding: 0 !important;
}
}
tb-agent-profile-wizard { tb-agent-profile-wizard {
display: block; display: contents;
width: 100% !important;
min-width: 0 !important;
max-width: 100% !important;
} }
.tb-preset-section-label { .tb-preset-section-label {
@ -180,11 +149,3 @@ tb-agent-profile-wizard {
} }
} }
} }
.tb-preset-dialog-footer {
display: flex;
align-items: center;
justify-content: flex-end;
gap: 8px;
border-top: 1px solid $agent-divider-light;
}

13
ui-ngx/src/app/modules/home/pages/agent/table/abstract-agent-app-event-table-config.ts

@ -30,10 +30,7 @@ import {
isAgentScopedAppEventActionType, isAgentScopedAppEventActionType,
processingStartStatusTranslationMap processingStartStatusTranslationMap
} from '@shared/models/agent.models'; } from '@shared/models/agent.models';
import { import { openAgentAppEventProgress } from '@home/pages/agent/util/agent-app-event-progress';
AgentAppEventProgressDialogComponent,
AgentAppEventProgressDialogData
} from '@home/pages/agent/dialog/agent-app-event-progress-dialog.component';
import { import {
AGENT_APP_EVENT_FILTER_PANEL_DATA, AGENT_APP_EVENT_FILTER_PANEL_DATA,
AgentAppEventFilterPanelComponent, AgentAppEventFilterPanelComponent,
@ -196,13 +193,7 @@ export abstract class AbstractAgentAppEventTableConfig<E extends AgentAppEvent>
} }
private openProgress(application: AgentApplication | null, event: E): void { private openProgress(application: AgentApplication | null, event: E): void {
this.dialog.open<AgentAppEventProgressDialogComponent, AgentAppEventProgressDialogData, boolean>( openAgentAppEventProgress(this.dialog, application, event).subscribe(() => this.updateData());
AgentAppEventProgressDialogComponent, {
disableClose: false,
panelClass: ['tb-dialog'],
data: { application, event }
}
).afterClosed().subscribe(() => this.updateData());
} }
private cancelEvent($event: Event, e: E): void { private cancelEvent($event: Event, e: E): void {

2
ui-ngx/src/app/modules/home/pages/agent/util/agent-app-event-progress.ts

@ -24,7 +24,7 @@ export function openAgentAppEventProgress(
return dialog.open<AgentAppEventProgressDialogComponent, AgentAppEventProgressDialogData, boolean>( return dialog.open<AgentAppEventProgressDialogComponent, AgentAppEventProgressDialogData, boolean>(
AgentAppEventProgressDialogComponent, { AgentAppEventProgressDialogComponent, {
disableClose: false, disableClose: false,
panelClass: ['tb-dialog'], panelClass: ['tb-dialog', 'tb-fullscreen-dialog'],
data: { application, event } data: { application, event }
} }
).afterClosed(); ).afterClosed();

2
ui-ngx/src/app/modules/home/pages/agent/util/agent-version-warnings.ts

@ -15,7 +15,7 @@ export function confirmAppVersionWarning(dialog: MatDialog,
return dialog.open<AgentAppVersionWarningDialogComponent, AgentAppVersionWarningDialogData, AgentAppVersionWarningResult>( return dialog.open<AgentAppVersionWarningDialogComponent, AgentAppVersionWarningDialogData, AgentAppVersionWarningResult>(
AgentAppVersionWarningDialogComponent, { AgentAppVersionWarningDialogComponent, {
disableClose: false, disableClose: false,
panelClass: ['tb-dialog'], panelClass: ['tb-dialog', 'tb-fullscreen-dialog'],
data data
}).afterClosed().pipe(map(res => res ?? false)); }).afterClosed().pipe(map(res => res ?? false));
} }

23
ui-ngx/src/app/modules/home/pages/agent/wizard/agent-app-profile-wizard-dialog.ts

@ -0,0 +1,23 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1
import { MatDialog } from '@angular/material/dialog';
import { Observable } from 'rxjs';
import { AgentAppProfile } from '@shared/models/agent.models';
import {
AgentAppProfileWizardComponent,
AgentAppProfileWizardData
} from '@home/pages/agent/wizard/agent-app-profile-wizard.component';
export function openAgentAppProfileWizard(
dialog: MatDialog,
data: AgentAppProfileWizardData,
disableClose = true
): Observable<AgentAppProfile> {
return dialog.open<AgentAppProfileWizardComponent, AgentAppProfileWizardData, AgentAppProfile>(
AgentAppProfileWizardComponent, {
disableClose,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-wide-dialog'],
data
}
).afterClosed();
}

348
ui-ngx/src/app/modules/home/pages/agent/wizard/agent-app-profile-wizard.component.html

@ -4,194 +4,198 @@
SPDX-License-Identifier: BUSL-1.1 SPDX-License-Identifier: BUSL-1.1
--> -->
<mat-toolbar color="tb-primary" class="tb-install-wizard-toolbar"> <mat-toolbar color="tb-primary" class="tb-bottom-border">
<div class="tb-install-wizard-toolbar-content"> <h2>{{ titleKey | translate }}</h2>
<h2>{{ titleKey | translate }}</h2> <span class="flex-1"></span>
</div>
<div tb-help="agentAppProfiles"></div> <div tb-help="agentAppProfiles"></div>
<button mat-icon-button (click)="cancel()" type="button" tabindex="-1"> <button mat-icon-button
<mat-icon>close</mat-icon> (click)="cancel()"
type="button">
<mat-icon class="material-icons">close</mat-icon>
</button> </button>
</mat-toolbar> </mat-toolbar>
<div mat-dialog-content>
<div mat-dialog-content class="tb-install-wizard-body flex min-h-[50vh] flex-col"> <mat-stepper linear #stepper
(selectionChange)="selectedIndex = $event.selectedIndex"
<mat-stepper class="flex-1" linear #stepper
[orientation]="(stepperOrientation | async)" [orientation]="(stepperOrientation | async)"
[labelPosition]="(stepperLabelPosition | async)"> [labelPosition]="(stepperLabelPosition | async)">
@for (step of steps; track step) {
@if (!editMode) { @switch (step) {
<mat-step [label]="'agent.app-install-step1' | translate" [completed]="canProceedFromType()"> @case ('type') {
<div class="step-content"> <mat-step [label]="stepLabels[step] | translate" [completed]="canProceedFromType()">
<div class="type-select"> <div class="step-content">
<p class="hint" translate>agent.app-install-pick-type</p> <div class="type-select">
<div class="type-cards"> <p class="hint" translate>agent.app-install-pick-type</p>
@for (card of typeCards; track card.type) { <div class="type-cards">
<button type="button" class="type-card" @for (card of typeCards; track card.type) {
[class.selected]="selectedType === card.type" <button type="button" class="type-card"
[class.locked-out]="lockedAppType && lockedAppType !== card.type" [class.selected]="selectedType === card.type"
[disabled]="lockedAppType && lockedAppType !== card.type" [class.locked-out]="lockedAppType && lockedAppType !== card.type"
[attr.aria-pressed]="selectedType === card.type" [disabled]="lockedAppType && lockedAppType !== card.type"
(click)="selectType(card.type)"> [attr.aria-pressed]="selectedType === card.type"
<mat-icon>{{ card.icon }}</mat-icon> (click)="selectType(card.type)">
<h4>{{ card.labelKey | translate }}</h4> <mat-icon>{{ card.icon }}</mat-icon>
<p>{{ card.descKey | translate }}</p> <h4>{{ card.labelKey | translate }}</h4>
</button> <p>{{ card.descKey | translate }}</p>
} </button>
</div>
@if (selectedType && selectedType !== 'GENERIC' && availableTemplates.length) {
<mat-form-field class="mat-block" appearance="outline">
<mat-label translate>agent.template</mat-label>
<mat-select [value]="selectedTemplateVersion" (selectionChange)="onTemplateSelected($event.value)">
@for (tpl of availableTemplates; track tpl.currentVersion) {
<mat-option [value]="tpl.currentVersion">
{{ tpl.currentVersion }}
</mat-option>
} }
</mat-select> </div>
</mat-form-field> @if (selectedType && selectedType !== 'GENERIC' && availableTemplates.length) {
} <mat-form-field class="mat-block" appearance="outline">
@if (loadingTemplate || loadingTemplates) { <mat-label translate>agent.template</mat-label>
<div class="loading-state"> <mat-select [value]="selectedTemplateVersion" (selectionChange)="onTemplateSelected($event.value)">
<mat-spinner diameter="20"></mat-spinner> @for (tpl of availableTemplates; track tpl.currentVersion) {
<span translate>agent.app-install-loading-template</span> <mat-option [value]="tpl.currentVersion">
</div> {{ tpl.currentVersion }}
} </mat-option>
@if (selectedType && !loadingTemplates && !loadError && !availableTemplates.length) { }
<div class="tb-form-hint tb-primary-fill tb-form-hint-warning"> </mat-select>
<mat-icon>warning_amber</mat-icon> </mat-form-field>
<span translate>agent.app-no-templates</span> }
@if (loadingTemplate || loadingTemplates) {
<div class="loading-state">
<mat-spinner diameter="20"></mat-spinner>
<span translate>agent.app-install-loading-template</span>
</div>
}
@if (selectedType && !loadingTemplates && !loadError && !availableTemplates.length) {
<div class="tb-form-hint tb-primary-fill tb-form-hint-warning">
<mat-icon>warning_amber</mat-icon>
<span translate>agent.app-no-templates</span>
</div>
}
@if (loadError) {
<div class="error-state">
<mat-icon>error_outline</mat-icon>
<span>{{ loadError }}</span>
</div>
}
</div> </div>
} </div>
@if (loadError) { </mat-step>
<div class="error-state"> }
<mat-icon>error_outline</mat-icon> @case ('config') {
<span>{{ loadError }}</span> <mat-step [stepControl]="profileForm" [label]="stepLabels[step] | translate" [completed]="canSubmit()">
</div> <div class="step-content">
}
</div> <form [formGroup]="profileForm">
</div> <mat-form-field class="mat-block" appearance="outline">
</mat-step> <mat-label translate>agent.app-profile-name</mat-label>
} <input matInput formControlName="name" [placeholder]="profileNamePlaceholder">
@if (profileForm.get('name').hasError('required')) {
<!-- Step 2: Name + YAML editor --> <mat-error>{{ 'agent.profile-name-required' | translate }}</mat-error>
<mat-step [stepControl]="profileForm" [label]="'agent.app-install-step3' | translate" [completed]="canSubmit()"> }
<div class="step-content"> </mat-form-field>
<form [formGroup]="profileForm"> <mat-form-field class="mat-block" appearance="outline">
<mat-form-field class="mat-block" appearance="outline"> <mat-label translate>agent.app-profile-description</mat-label>
<mat-label translate>agent.app-profile-name</mat-label> <textarea matInput formControlName="description" cdkTextareaAutosize cdkAutosizeMinRows="1" rows="1"></textarea>
<input matInput formControlName="name" [placeholder]="profileNamePlaceholder"> </mat-form-field>
@if (profileForm.get('name').hasError('required')) { </form>
<mat-error>{{ 'agent.profile-name-required' | translate }}</mat-error>
} @if (composeTypeKeys.length > 1) {
</mat-form-field> <mat-form-field class="mat-block" appearance="outline">
<mat-label translate>agent.app-compose-template-select</mat-label>
<mat-form-field class="mat-block" appearance="outline"> <mat-select [value]="composeType" (selectionChange)="onComposeTypeChange($event.value)">
<mat-label translate>agent.app-profile-description</mat-label> @for (key of composeTypeKeys; track key) {
<textarea matInput formControlName="description" cdkTextareaAutosize cdkAutosizeMinRows="1" rows="1"></textarea> <mat-option [value]="key">
</mat-form-field> {{ composeTypeLabel(key) }}
</form> </mat-option>
}
</mat-select>
</mat-form-field>
}
@if (composeTypeKeys.length > 1) { @if (selectedType === 'EDGE' || selectedType === 'GATEWAY') {
<mat-form-field class="mat-block" appearance="outline"> <div class="tb-form-hint tb-primary-fill">
<mat-label translate>agent.app-compose-template-select</mat-label> <mat-icon>info_outline</mat-icon>
<mat-select [value]="composeType" (selectionChange)="onComposeTypeChange($event.value)"> <span translate>agent.app-profile-compose-creds-hint</span>
@for (key of composeTypeKeys; track key) { </div>
<mat-option [value]="key">
{{ composeTypeLabel(key) }}
</mat-option>
} }
</mat-select>
</mat-form-field>
}
@if (selectedType === 'EDGE' || selectedType === 'GATEWAY') { <div class="diff-header-row">
<div class="tb-form-hint tb-primary-fill"> <div class="diff-header added" translate>agent.app-install-diff-template</div>
<mat-icon>info_outline</mat-icon> <div class="diff-header removed" translate>agent.app-install-diff-editable</div>
<span translate>agent.app-profile-compose-creds-hint</span> <button type="button" class="diff-sync-toggle"
</div> [class.active]="diffSyncScroll"
[matTooltip]="'agent.app-diff-sync-scroll' | translate"
(click)="diffSyncScroll = !diffSyncScroll">
<mat-icon>{{ diffSyncScroll ? 'link' : 'link_off' }}</mat-icon>
</button>
</div>
<tb-agent-compose-diff [left]="proposedYaml" [right]="currentYaml"
[syncScroll]="diffSyncScroll" (rightChange)="composeYaml = $event"></tb-agent-compose-diff>
<p class="diff-hint" translate>agent.app-install-diff-hint</p>
</div>
</mat-step>
} }
@case ('save') {
<mat-step [label]="stepLabels[step] | translate">
<div class="step-content">
<div class="summary-section">
<div class="summary-card">
<div class="summary-row">
<span class="label" translate>agent.app-profile-name</span>
<span class="value">{{ profileName }}</span>
</div>
<div class="summary-row">
<span class="label" translate>agent.app-type</span>
<span class="value"><span class="tb-type-badge"
[class.edge]="selectedType === 'EDGE'"
[class.gateway]="selectedType === 'GATEWAY'"
[class.generic]="selectedType === 'GENERIC'">{{ selectedType }}</span></span>
</div>
@if (template) {
<div class="summary-row">
<span class="label" translate>agent.app-template</span>
<span class="value">{{ template.currentVersion }}</span>
</div>
}
@if (profileDescription) {
<div class="summary-row">
<span class="label" translate>agent.app-profile-description</span>
<span class="value">{{ profileDescription }}</span>
</div>
}
</div>
<div class="diff-header-row"> <div class="tb-form-hint tb-primary-fill">
<div class="diff-header added" translate>agent.app-install-diff-template</div> <mat-icon>info_outline</mat-icon>
<div class="diff-header removed" translate>agent.app-install-diff-editable</div> <span translate>agent.app-profile-wizard-confirm-info</span>
<button type="button" class="diff-sync-toggle" </div>
[class.active]="diffSyncScroll"
[matTooltip]="'agent.app-diff-sync-scroll' | translate"
(click)="diffSyncScroll = !diffSyncScroll">
<mat-icon>{{ diffSyncScroll ? 'link' : 'link_off' }}</mat-icon>
</button>
</div>
<tb-agent-compose-diff [left]="proposedYaml" [right]="currentYaml"
[syncScroll]="diffSyncScroll" (rightChange)="composeYaml = $event"></tb-agent-compose-diff>
<p class="diff-hint" translate>agent.app-install-diff-hint</p>
</div>
</mat-step>
<!-- Step 3: Summary + Confirm -->
<mat-step [label]="'agent.app-profile-step-save' | translate">
<div class="step-content">
<div class="summary-section">
<div class="summary-card">
<div class="summary-row">
<span class="label" translate>agent.app-profile-name</span>
<span class="value">{{ profileName }}</span>
</div>
<div class="summary-row">
<span class="label" translate>agent.app-type</span>
<span class="value"><span class="tb-type-badge"
[class.edge]="selectedType === 'EDGE'"
[class.gateway]="selectedType === 'GATEWAY'"
[class.generic]="selectedType === 'GENERIC'">{{ selectedType }}</span></span>
</div>
@if (template) {
<div class="summary-row">
<span class="label" translate>agent.app-template</span>
<span class="value">{{ template.currentVersion }}</span>
</div>
}
@if (profileDescription) {
<div class="summary-row">
<span class="label" translate>agent.app-profile-description</span>
<span class="value">{{ profileDescription }}</span>
</div> </div>
} </div>
</div> </mat-step>
}
<div class="tb-form-hint tb-primary-fill"> }
<mat-icon>info_outline</mat-icon> }
<span translate>agent.app-profile-wizard-confirm-info</span>
</div>
</div>
</div>
</mat-step>
</mat-stepper> </mat-stepper>
</div>
<div class="step-footer"> <div mat-dialog-actions>
@let stepIndex = stepper?.selectedIndex; <div class="dialog-actions-row flex flex-1 flex-row items-center justify-end">
@if (stepIndex > 0) { @if (selectedIndex > 0) {
<button mat-button type="button" (click)="stepper.previous()" [disabled]="submitting"> <button mat-stroked-button
<mat-icon>chevron_left</mat-icon> [disabled]="submitting"
{{ 'action.back' | translate }} (click)="stepper.previous()">{{ 'action.back' | translate }}</button>
</button>
} }
<button mat-button type="button" (click)="cancel()" [disabled]="submitting"> <span class="flex-1"></span>
{{ 'action.cancel' | translate }} @if (!isLastStep()) {
</button> <button mat-stroked-button
@if (stepIndex === stepper?.steps.length - 1) { color="primary"
<button mat-raised-button color="primary" type="button" (click)="submit()" [disabled]="!canSubmit()"> [disabled]="!canGoNext()"
<mat-icon>save</mat-icon> (click)="stepper.next()">{{ 'action.next-with-label' | translate: { label: (nextStepLabel() | translate) } }}</button>
<span>{{ 'action.save' | translate }}</span>
</button>
} @else {
<button mat-raised-button color="primary" type="button" (click)="stepper.next()"
[disabled]="!stepper?.selected?.completed">
{{ 'action.next' | translate }}
<mat-icon iconPositionEnd>chevron_right</mat-icon>
</button>
} }
</div> </div>
<mat-divider class="w-full"></mat-divider>
<div class="dialog-actions-row flex flex-1 flex-row items-center justify-end gap-2">
<button mat-button
[disabled]="submitting"
(click)="cancel()">{{ 'action.cancel' | translate }}</button>
<button mat-raised-button
color="primary"
[disabled]="!isLastStep() || !canSubmit()"
(click)="submit()">{{ 'action.save' | translate }}</button>
</div>
</div> </div>

2
ui-ngx/src/app/modules/home/pages/agent/wizard/agent-app-profile-wizard.component.scss

@ -2,7 +2,7 @@
// SPDX-License-Identifier: BUSL-1.1 // SPDX-License-Identifier: BUSL-1.1
@use '../../../components/agent/wizard/agent-wizard' as *; @use '../../../components/agent/wizard/agent-wizard' as *;
@include wizard-chrome; @include wizard-stepper-dialog(1280px);
@include wizard-step-basics; @include wizard-step-basics;
@include wizard-type-cards; @include wizard-type-cards;
@include wizard-diff; @include wizard-diff;

25
ui-ngx/src/app/modules/home/pages/agent/wizard/agent-app-profile-wizard.component.ts

@ -33,6 +33,10 @@ import {
import { orderTemplatesNewestFirst } from '@home/pages/agent/util/template-version-order'; import { orderTemplatesNewestFirst } from '@home/pages/agent/util/template-version-order';
import { EdgeTemplateCompatibilityService } from '@home/pages/agent/util/edge-template-compatibility.service'; import { EdgeTemplateCompatibilityService } from '@home/pages/agent/util/edge-template-compatibility.service';
import { AgentAppWizardLoaderService } from '@home/pages/agent/wizard/agent-app-wizard-loader.service'; import { AgentAppWizardLoaderService } from '@home/pages/agent/wizard/agent-app-wizard-loader.service';
import {
AGENT_APP_PROFILE_STEP_LABELS,
AgentAppProfileStepKey
} from '@home/pages/agent/wizard/agent-app-wizard.models';
export interface AgentAppProfileWizardData { export interface AgentAppProfileWizardData {
profile?: AgentAppProfile; profile?: AgentAppProfile;
@ -58,6 +62,10 @@ export class AgentAppProfileWizardComponent
extends DialogComponent<AgentAppProfileWizardComponent, AgentAppProfile> extends DialogComponent<AgentAppProfileWizardComponent, AgentAppProfile>
implements OnInit { implements OnInit {
readonly stepLabels = AGENT_APP_PROFILE_STEP_LABELS;
steps: AgentAppProfileStepKey[] = [];
selectedIndex = 0;
// Left (read-only) = raw template compose; right (editable) = same content, // Left (read-only) = raw template compose; right (editable) = same content,
// user-editable. This is the value persisted on submit. // user-editable. This is the value persisted on submit.
proposedYaml = ''; proposedYaml = '';
@ -130,6 +138,7 @@ export class AgentAppProfileWizardComponent
} }
ngOnInit() { ngOnInit() {
this.steps = this.buildSteps();
const prefetchTypes = this.lockedAppType ? [this.lockedAppType] : this.typeCards.map(card => card.type); const prefetchTypes = this.lockedAppType ? [this.lockedAppType] : this.typeCards.map(card => card.type);
prefetchTypes.forEach(type => { prefetchTypes.forEach(type => {
this.loader.loadTemplatesByType(type).subscribe({ error: () => {} }); this.loader.loadTemplatesByType(type).subscribe({ error: () => {} });
@ -308,6 +317,22 @@ export class AgentAppProfileWizardComponent
this.dialogRef.close(undefined); this.dialogRef.close(undefined);
} }
isLastStep(): boolean {
return this.selectedIndex === this.steps.length - 1;
}
canGoNext(): boolean {
return this.steps[this.selectedIndex] === 'type' ? this.canProceedFromType() : this.canSubmit();
}
nextStepLabel(): string {
return this.stepLabels[this.steps[this.selectedIndex + 1]] ?? '';
}
private buildSteps(): AgentAppProfileStepKey[] {
return this.editMode ? ['config', 'save'] : ['type', 'config', 'save'];
}
canProceedFromType(): boolean { canProceedFromType(): boolean {
return !!this.selectedType && !!this.selectedTemplateVersion && !!this.template return !!this.selectedType && !!this.selectedTemplateVersion && !!this.template
&& !this.loadingTemplate && !this.loadingTemplates && !this.loadError; && !this.loadingTemplate && !this.loadingTemplates && !this.loadError;

26
ui-ngx/src/app/modules/home/pages/agent/wizard/agent-app-wizard.models.ts

@ -41,6 +41,32 @@ export interface AgentAppWizardFinish {
closeOnly?: boolean; closeOnly?: boolean;
} }
export type AgentAppInstallStepKey = 'agent' | 'type' | 'config' | 'summary' | 'deploy';
export const AGENT_APP_INSTALL_STEP_LABELS: Record<AgentAppInstallStepKey, string> = {
agent: 'agent.deploy-select-agent-step',
type: 'agent.app-install-step1',
config: 'agent.app-install-step3',
summary: 'agent.app-install-step4',
deploy: 'agent.deploy-install-step'
};
export type AgentAppUpgradeStepKey = 'profile' | 'config' | 'summary';
export const AGENT_APP_UPGRADE_STEP_LABELS: Record<AgentAppUpgradeStepKey, string> = {
profile: 'agent.app-upgrade-profile-step',
config: 'agent.app-install-step3',
summary: 'agent.app-install-step4'
};
export type AgentAppProfileStepKey = 'type' | 'config' | 'save';
export const AGENT_APP_PROFILE_STEP_LABELS: Record<AgentAppProfileStepKey, string> = {
type: 'agent.app-install-step1',
config: 'agent.app-install-step3',
save: 'agent.app-profile-step-save'
};
export interface AgentTypeCard { export interface AgentTypeCard {
type: AgentApplicationType; type: AgentApplicationType;
icon: string; icon: string;

68
ui-ngx/src/app/modules/home/pages/agent/wizard/agent-profile-wizard.component.html

@ -5,20 +5,21 @@
--> -->
@if (!embedded) { @if (!embedded) {
<mat-toolbar color="tb-primary" class="tb-install-wizard-toolbar"> <mat-toolbar color="tb-primary" class="tb-bottom-border">
<div class="tb-install-wizard-toolbar-content"> <h2>{{ (isEdit ? 'agent.edit-profile' : 'agent.add-profile') | translate }}</h2>
<h2>{{ (isEdit ? 'agent.edit-profile' : 'agent.add-profile') | translate }}</h2> <span class="flex-1"></span>
</div>
<div tb-help="agentProfiles"></div> <div tb-help="agentProfiles"></div>
<button mat-icon-button (click)="cancel()" type="button" tabindex="-1"> <button mat-icon-button
<mat-icon>close</mat-icon> (click)="cancel()"
type="button">
<mat-icon class="material-icons">close</mat-icon>
</button> </button>
</mat-toolbar> </mat-toolbar>
} }
<div mat-dialog-content>
<div mat-dialog-content class="tb-install-wizard-body flex min-h-[50vh] flex-col" [class.tb-install-wizard-embedded]="embedded"> <mat-stepper linear #stepper [labelPosition]="(stepperLabelPosition | async)"
(selectionChange)="selectedIndex = $event.selectedIndex">
<mat-stepper class="flex-1" linear #stepper [labelPosition]="(stepperLabelPosition | async)">
<mat-step [stepControl]="step1Form" [label]="'agent.add-profile-step-details' | translate"> <mat-step [stepControl]="step1Form" [label]="'agent.add-profile-step-details' | translate">
<form [formGroup]="step1Form" autocomplete="off"> <form [formGroup]="step1Form" autocomplete="off">
@ -106,30 +107,31 @@
</mat-stepper> </mat-stepper>
<div class="step-footer"> </div>
@if (stepper?.selectedIndex === 0) {
@if (showBack) { <div mat-dialog-actions>
<button mat-button type="button" (click)="back()"> <div class="dialog-actions-row flex flex-1 flex-row items-center justify-end">
<mat-icon>chevron_left</mat-icon> @if (selectedIndex > 0 || showBack) {
{{ 'action.back' | translate }} <button mat-stroked-button
</button> [disabled]="submitting"
} (click)="back()">{{ 'action.back' | translate }}</button>
<button mat-button type="button" (click)="cancel()">{{ 'action.cancel' | translate }}</button> }
<button mat-raised-button color="primary" type="button" [disabled]="step1Form.invalid" (click)="stepper.next()"> <span class="flex-1"></span>
{{ 'action.next' | translate }} @if (selectedIndex === 0) {
<mat-icon iconPositionEnd>chevron_right</mat-icon> <button mat-stroked-button
</button> color="primary"
} @else { [disabled]="step1Form.invalid"
<button mat-button type="button" (click)="stepper.previous()"> (click)="stepper.next()">{{ 'action.next-with-label' | translate: { label: ('agent.add-profile-step-app-profiles' | translate) } }}</button>
<mat-icon>chevron_left</mat-icon>
{{ 'action.back' | translate }}
</button>
<button mat-raised-button color="primary" type="button"
[disabled]="!canSubmit()"
(click)="submit()">
{{ (isEdit ? 'action.save' : 'action.add') | translate }}
</button>
} }
</div> </div>
<mat-divider class="w-full"></mat-divider>
<div class="dialog-actions-row flex flex-1 flex-row items-center justify-end gap-2">
<button mat-button
[disabled]="submitting"
(click)="cancel()">{{ 'action.cancel' | translate }}</button>
<button mat-raised-button
color="primary"
[disabled]="selectedIndex === 0 || !canSubmit()"
(click)="submit()">{{ (isEdit ? 'action.save' : 'action.add') | translate }}</button>
</div>
</div> </div>

27
ui-ngx/src/app/modules/home/pages/agent/wizard/agent-profile-wizard.component.scss

@ -2,32 +2,9 @@
// SPDX-License-Identifier: BUSL-1.1 // SPDX-License-Identifier: BUSL-1.1
@use '../../../components/agent/wizard/agent-wizard' as *; @use '../../../components/agent/wizard/agent-wizard' as *;
@include wizard-chrome; @include wizard-stepper-dialog(750px);
:host { :host {
display: block;
width: min(750px, 95vw);
min-width: 0;
max-width: 95vw;
.tb-install-wizard-body.tb-install-wizard-embedded {
padding: 16px 24px 0 !important;
mat-stepper {
flex: 1 1 auto;
}
.step-footer {
position: sticky;
bottom: 0;
z-index: 15;
background: #fff;
margin: 16px -24px 0;
padding: 8px;
min-height: 52px;
}
}
// Sibling layout: button lives outside the entity-list's form-field so // Sibling layout: button lives outside the entity-list's form-field so
// clicking it counts as a genuine outside-click and MatAutocomplete closes // clicking it counts as a genuine outside-click and MatAutocomplete closes
// its panel naturally — no synthetic-event hacks needed. // its panel naturally — no synthetic-event hacks needed.
@ -38,7 +15,7 @@
gap: 12px; gap: 12px;
.app-profile-picker-field { .app-profile-picker-field {
flex: 1; flex: 1 1 280px;
min-width: 0; min-width: 0;
} }

21
ui-ngx/src/app/modules/home/pages/agent/wizard/agent-profile-wizard.component.ts

@ -9,7 +9,6 @@ import { MediaBreakpoints } from '@shared/models/constants';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { map } from 'rxjs/operators'; import { map } from 'rxjs/operators';
import { import {
AgentAppProfile,
AgentApplicationType, AgentApplicationType,
AgentProfile, AgentProfile,
AgentProvisionType, AgentProvisionType,
@ -19,10 +18,7 @@ import {
import { AgentService } from '@core/http/agent.service'; import { AgentService } from '@core/http/agent.service';
import { UserPermissionsService } from '@core/http/user-permissions.service'; import { UserPermissionsService } from '@core/http/user-permissions.service';
import { Operation, Resource } from '@shared/models/security.models'; import { Operation, Resource } from '@shared/models/security.models';
import { import { openAgentAppProfileWizard } from '@home/pages/agent/wizard/agent-app-profile-wizard-dialog';
AgentAppProfileWizardComponent,
AgentAppProfileWizardData
} from '@home/pages/agent/wizard/agent-app-profile-wizard.component';
export interface AgentProfileWizardData { export interface AgentProfileWizardData {
defaults?: Partial<AgentProfile>; defaults?: Partial<AgentProfile>;
@ -62,6 +58,7 @@ export class AgentProfileWizardComponent implements OnInit {
assignmentsLoadState: 'loading' | 'loaded' | 'failed' = 'loaded'; assignmentsLoadState: 'loading' | 'loaded' | 'failed' = 'loaded';
@ViewChild('stepper', { static: false }) stepper: MatStepper; @ViewChild('stepper', { static: false }) stepper: MatStepper;
selectedIndex = 0;
stepperLabelPosition: Observable<'bottom' | 'end'>; stepperLabelPosition: Observable<'bottom' | 'end'>;
@ -125,7 +122,11 @@ export class AgentProfileWizardComponent implements OnInit {
} }
back() { back() {
this.backClicked.emit(); if (this.selectedIndex > 0) {
this.stepper.previous();
} else {
this.backClicked.emit();
}
} }
canSubmit(): boolean { canSubmit(): boolean {
@ -162,13 +163,7 @@ export class AgentProfileWizardComponent implements OnInit {
} }
private openAppProfileWizard() { private openAppProfileWizard() {
this.dialog.open<AgentAppProfileWizardComponent, AgentAppProfileWizardData, AgentAppProfile>( openAgentAppProfileWizard(this.dialog, { lockedAppType: this.lockedAppType }).subscribe(saved => {
AgentAppProfileWizardComponent, {
disableClose: true,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'],
data: { lockedAppType: this.lockedAppType }
}
).afterClosed().subscribe(saved => {
if (saved) { if (saved) {
const currentIds: string[] = this.step2Form.value?.appProfileIds ?? []; const currentIds: string[] = this.step2Form.value?.appProfileIds ?? [];
if (!currentIds.includes(saved.id.id)) { if (!currentIds.includes(saved.id.id)) {

48
ui-ngx/src/app/modules/home/pages/edge/edge-instructions-dialog.component.html

@ -48,15 +48,13 @@
</ng-template> </ng-template>
<ng-template matTabContent> <ng-template matTabContent>
<div class="tb-form-panel no-padding no-border"> <div class="tb-form-panel no-padding no-border">
<div class="tb-form-panel no-padding stroked"> @if (contentData.docker) {
@if (contentData.docker) { <tb-markdown [data]='contentData.docker'></tb-markdown>
<tb-markdown [data]='contentData.docker'></tb-markdown> } @else {
} @else { <div class="tb-loader">
<div class="tb-loader"> <mat-spinner color="accent" diameter="48" strokeWidth="4"></mat-spinner>
<mat-spinner color="accent" diameter="48" strokeWidth="4"></mat-spinner> </div>
</div> }
}
</div>
</div> </div>
</ng-template> </ng-template>
</mat-tab> </mat-tab>
@ -67,15 +65,13 @@
</ng-template> </ng-template>
<ng-template matTabContent> <ng-template matTabContent>
<div class="tb-form-panel no-padding no-border"> <div class="tb-form-panel no-padding no-border">
<div class="tb-form-panel no-padding stroked"> @if (contentData.ubuntu) {
@if (contentData.ubuntu) { <tb-markdown [data]='contentData.ubuntu'></tb-markdown>
<tb-markdown [data]='contentData.ubuntu'></tb-markdown> } @else {
} @else { <div class="tb-loader">
<div class="tb-loader"> <mat-spinner color="accent" diameter="48" strokeWidth="4"></mat-spinner>
<mat-spinner color="accent" diameter="48" strokeWidth="4"></mat-spinner> </div>
</div> }
}
</div>
</div> </div>
</ng-template> </ng-template>
</mat-tab> </mat-tab>
@ -86,15 +82,13 @@
</ng-template> </ng-template>
<ng-template matTabContent> <ng-template matTabContent>
<div class="tb-form-panel no-padding no-border"> <div class="tb-form-panel no-padding no-border">
<div class="tb-form-panel no-padding stroked"> @if (contentData.centos) {
@if (contentData.centos) { <tb-markdown [data]='contentData.centos'></tb-markdown>
<tb-markdown [data]='contentData.centos'></tb-markdown> } @else {
} @else { <div class="tb-loader">
<div class="tb-loader"> <mat-spinner color="accent" diameter="48" strokeWidth="4"></mat-spinner>
<mat-spinner color="accent" diameter="48" strokeWidth="4"></mat-spinner> </div>
</div> }
}
</div>
</div> </div>
</ng-template> </ng-template>
</mat-tab> </mat-tab>

18
ui-ngx/src/app/modules/home/pages/edge/edge-instructions-dialog.component.scss

@ -6,8 +6,10 @@
:host { :host {
height: 100%; height: 100%;
max-height: 100vh; max-height: 100vh;
max-width: 100%;
display: grid; display: grid;
grid-template-rows: min-content minmax(auto, 1fr) min-content; grid-template-rows: min-content minmax(auto, 1fr) min-content;
grid-template-columns: minmax(0, 1fr);
.tb-loader { .tb-loader {
display: flex; display: flex;
@ -49,13 +51,27 @@
} }
.mat-mdc-dialog-content { .mat-mdc-dialog-content {
max-height: 80vh;
padding: 0 16px 16px 16px; padding: 0 16px 16px 16px;
border-top: 16px solid #fff; border-top: 16px solid #fff;
display: flex;
flex-direction: column;
overflow: hidden;
@media #{$mat-gt-xs} {
max-height: 80vh;
}
} }
} }
:host ::ng-deep { :host ::ng-deep {
.mat-mdc-dialog-content > .tb-form-panel,
.mat-mdc-dialog-content > .tb-form-panel > .tb-form-panel,
.mat-mdc-tab-group,
.mat-mdc-tab-body-wrapper {
flex: 1 1 auto;
min-height: 0;
}
.tb-markdown-view { .tb-markdown-view {
padding: 16px 16px 32px 16px; padding: 16px 16px 32px 16px;
div { div {

33
ui-ngx/src/app/modules/home/pages/edge/edge.component.ts

@ -21,12 +21,8 @@ import {EdgeService} from "@core/http/edge.service";
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { MatDialog } from '@angular/material/dialog'; import { MatDialog } from '@angular/material/dialog';
import { AgentService } from '@core/http/agent.service'; import { AgentService } from '@core/http/agent.service';
import { AgentApplication, AgentAppConfigType, AgentAppEvent } from '@shared/models/agent.models'; import { AgentApplication, AgentAppConfigType } from '@shared/models/agent.models';
import { import { openAgentAppInstallWizard } from '@home/components/agent/wizard/agent-app-install-wizard-dialog';
AgentAppInstallWizardComponent,
AgentAppInstallWizardData,
AgentAppInstallWizardResult
} from '@home/components/agent/wizard/agent-app-install-wizard.component';
@Component({ @Component({
selector: 'tb-edge', selector: 'tb-edge',
@ -218,21 +214,16 @@ export class EdgeComponent extends GroupEntityComponent<EdgeInfo> {
if ($event) { $event.stopPropagation(); } if ($event) { $event.stopPropagation(); }
if (!this.managedApp) { return; } if (!this.managedApp) { return; }
this.agentService.getAgentApplicationInfoById(this.managedApp.id.id).subscribe(full => { this.agentService.getAgentApplicationInfoById(this.managedApp.id.id).subscribe(full => {
this.dialog.open<AgentAppInstallWizardComponent, AgentAppInstallWizardData, AgentAppInstallWizardResult>( openAgentAppInstallWizard(this.dialog, {
AgentAppInstallWizardComponent, { agentId: full.agentId?.id,
disableClose: false, agent: null,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-agent-wizard-dialog'], mode: 'upgrade',
data: { application: full
agentId: full.agentId?.id, }).subscribe(event => {
agent: null, if (event && this.entity?.id?.id) {
mode: 'upgrade', this.loadManagedApp(this.entity.id.id);
application: full }
} });
}).afterClosed().subscribe(event => {
if (event && this.entity?.id?.id) {
this.loadManagedApp(this.entity.id.id);
}
});
}); });
} }

16
ui-ngx/src/app/modules/home/pages/edge/edges-table-config.resolver.ts

@ -49,10 +49,7 @@ import { CustomerId } from '@shared/models/id/customer-id';
import { UtilsService } from '@core/services/utils.service'; import { UtilsService } from '@core/services/utils.service';
import { AddGroupEntityDialogComponent } from '@home/components/group/add-group-entity-dialog.component'; import { AddGroupEntityDialogComponent } from '@home/components/group/add-group-entity-dialog.component';
import { AddGroupEntityDialogData } from '@home/models/group/group-entity-component.models'; import { AddGroupEntityDialogData } from '@home/models/group/group-entity-component.models';
import { import { AgentAutoProvisionDialogService } from '@home/components/agent/dialog/agent-auto-provision-dialog.service';
AgentAutoProvisionDialogData,
AgentAutoProvisionDialogComponent
} from '@home/components/agent/dialog/agent-auto-provision-dialog.component';
import { AgentApplicationType } from '@shared/models/agent.models'; import { AgentApplicationType } from '@shared/models/agent.models';
import { AiAssistantConfigService } from '@core/services/ai-assistant-config.service'; import { AiAssistantConfigService } from '@core/services/ai-assistant-config.service';
import { AiAssistantViewType } from '@shared/models/ai-chat.models'; import { AiAssistantViewType } from '@shared/models/ai-chat.models';
@ -74,7 +71,8 @@ export class EdgesTableConfigResolver {
private utils: UtilsService, private utils: UtilsService,
private datePipe: DatePipe, private datePipe: DatePipe,
private router: Router, private router: Router,
private dialog: MatDialog) { private dialog: MatDialog,
private autoProvisionDialogService: AgentAutoProvisionDialogService) {
} }
resolve(route: ActivatedRouteSnapshot): Observable<EntityTableConfig<EdgeInfo>> { resolve(route: ActivatedRouteSnapshot): Observable<EntityTableConfig<EdgeInfo>> {
@ -297,13 +295,7 @@ export class EdgesTableConfigResolver {
if ($event) { if ($event) {
$event.stopPropagation(); $event.stopPropagation();
} }
this.dialog.open<AgentAutoProvisionDialogComponent, AgentAutoProvisionDialogData, boolean>( this.autoProvisionDialogService.open(AgentApplicationType.EDGE).subscribe(result => {
AgentAutoProvisionDialogComponent, {
disableClose: true,
panelClass: ['tb-dialog', 'tb-fullscreen-dialog'],
data: { appType: AgentApplicationType.EDGE }
}
).afterClosed().subscribe(result => {
if (result) { if (result) {
config.updateData(); config.updateData();
} }

10
ui-ngx/src/styles.scss

@ -1127,16 +1127,6 @@ tb-entities-table.white-background {
} }
} }
// The agent wizards are opened under the 'tb-agent-wizard-dialog' panelClass and size
// themselves, so the surface must not impose its own min-width floor on small displays.
.tb-agent-wizard-dialog {
.mat-mdc-dialog-surface,
.mdc-dialog__surface {
min-width: 0 !important;
max-width: 95vw !important;
}
}
.tb-fullscreen-dialog-gt-xs { .tb-fullscreen-dialog-gt-xs {
@media #{$mat-gt-xs} { @media #{$mat-gt-xs} {
min-height: 100%; min-height: 100%;

Loading…
Cancel
Save