Browse Source

fix(iot-hub): resolve helpImage paths from ZIP images

The helpImage field in form definitions was rendered with the raw path
from the ZIP. Now resolved through zipImages map to get the base64 data
URI, same as markdown images.
pull/15508/head
Andrii Shvaika 3 months ago
parent
commit
6e5eb35cd1
  1. 2
      ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.html
  2. 7
      ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/device-install-dialog.component.ts

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

@ -154,7 +154,7 @@
<div class="tb-form-field-help">{{ field.helpText }}</div>
}
@if (field.helpImage) {
<img class="tb-form-field-help-image" [src]="field.helpImage" [alt]="field.label">
<img class="tb-form-field-help-image" [src]="resolveImagePath(field.helpImage)" [alt]="field.label">
}
}
</form>

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

@ -275,6 +275,13 @@ export class TbDeviceInstallDialogComponent extends DialogComponent<TbDeviceInst
});
}
resolveImagePath(path: string): string {
if (path.startsWith('data:') || path.startsWith('http')) {
return path;
}
return this.zipImages.get(path) || path;
}
getPatternErrorMessage(field: FormFieldDefinition): string {
return field.validators?.[0]?.message || 'Invalid format';
}

Loading…
Cancel
Save