Browse Source

feat(iot-hub): render solution template install/update errors as markdown

Install and update dialogs now render error details via tb-markdown
when the failing item is a SOLUTION_TEMPLATE, falling back to the plain
text block for other item types. Supports the rich instruction-style
error messages returned by the solution install flow.
pull/15539/head
Igor Kulikov 5 months ago
parent
commit
be1fcd50af
  1. 8
      ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-install-dialog.component.html
  2. 6
      ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-install-dialog.component.scss
  3. 2
      ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-install-dialog.component.ts
  4. 8
      ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-update-dialog.component.html
  5. 2
      ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-update-dialog.component.ts

8
ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-install-dialog.component.html

@ -44,7 +44,13 @@
@case ('error') { @case ('error') {
<h2 class="tb-iot-hub-install-title">{{ 'iot-hub.install-error-title' | translate }}</h2> <h2 class="tb-iot-hub-install-title">{{ 'iot-hub.install-error-title' | translate }}</h2>
<p class="tb-iot-hub-install-desc">{{ 'iot-hub.install-error-message' | translate:{ name: item.name } }}</p> <p class="tb-iot-hub-install-desc">{{ 'iot-hub.install-error-message' | translate:{ name: item.name } }}</p>
<div class="tb-iot-hub-error-details">{{ errorMessage }}</div> @if (item?.type === ItemType.SOLUTION_TEMPLATE) {
<tb-markdown class="tb-iot-hub-error-details-markdown" [data]="errorMessage"></tb-markdown>
} @else {
<div class="tb-iot-hub-error-details">
{{ errorMessage }}
</div>
}
} }
} }
</div> </div>

6
ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-install-dialog.component.scss

@ -43,3 +43,9 @@
white-space: pre-wrap; white-space: pre-wrap;
word-break: break-word; word-break: break-word;
} }
.tb-iot-hub-error-details-markdown {
border: 1px solid rgba(0, 0, 0, 0.12);
border-radius: 8px;
padding-bottom: 24px;
}

2
ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-install-dialog.component.ts

@ -44,6 +44,8 @@ export type InstallState = 'select-entity' | 'confirm' | 'installing' | 'success
}) })
export class TbIotHubInstallDialogComponent extends DialogComponent<TbIotHubInstallDialogComponent> { export class TbIotHubInstallDialogComponent extends DialogComponent<TbIotHubInstallDialogComponent> {
ItemType = ItemType;
item: MpItemVersionView; item: MpItemVersionView;
typeTranslations = itemTypeTranslations; typeTranslations = itemTypeTranslations;
state: InstallState = 'confirm'; state: InstallState = 'confirm';

8
ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-update-dialog.component.html

@ -32,7 +32,13 @@
@case ('error') { @case ('error') {
<h2 class="tb-iot-hub-install-title">{{ 'iot-hub.update-error-title' | translate }}</h2> <h2 class="tb-iot-hub-install-title">{{ 'iot-hub.update-error-title' | translate }}</h2>
<p class="tb-iot-hub-install-desc">{{ 'iot-hub.update-error-message' | translate:{ name: data.itemName } }}</p> <p class="tb-iot-hub-install-desc">{{ 'iot-hub.update-error-message' | translate:{ name: data.itemName } }}</p>
<div class="tb-iot-hub-error-details">{{ errorMessage }}</div> @if (data?.itemType === ItemType.SOLUTION_TEMPLATE) {
<tb-markdown class="tb-iot-hub-error-details-markdown" [data]="errorMessage"></tb-markdown>
} @else {
<div class="tb-iot-hub-error-details">
{{ errorMessage }}
</div>
}
} }
} }
</div> </div>

2
ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-update-dialog.component.ts

@ -46,6 +46,8 @@ export type UpdateState = 'confirm' | 'updating' | 'success' | 'error';
}) })
export class TbIotHubUpdateDialogComponent extends DialogComponent<TbIotHubUpdateDialogComponent> { export class TbIotHubUpdateDialogComponent extends DialogComponent<TbIotHubUpdateDialogComponent> {
ItemType = ItemType;
typeTranslations = itemTypeTranslations; typeTranslations = itemTypeTranslations;
state: UpdateState = 'confirm'; state: UpdateState = 'confirm';
errorMessage = ''; errorMessage = '';

Loading…
Cancel
Save