diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-action-line.component.ts b/ui-ngx/src/app/modules/home/components/ai/ai-action-line.component.ts
index 8cf16b3431..57d8e87421 100644
--- a/ui-ngx/src/app/modules/home/components/ai/ai-action-line.component.ts
+++ b/ui-ngx/src/app/modules/home/components/ai/ai-action-line.component.ts
@@ -183,8 +183,12 @@ export class AiActionLineComponent {
const facts = this.facts();
const stages = this.action().stages ?? [];
const done = this.action().status === 'SUCCESS' && this.action().progress ? [...stages, this.action().progress] : stages;
+ const labelOf = (fact: AiDetailFact) => (fact.raw ? fact.label : this.translate.instant(fact.label) as string).trim().toLowerCase();
+ const changed = new Set(facts.filter(fact => fact.change).map(labelOf));
+ const own = changed.size ? view.blocks.map(block => block.type === 'facts' ? {...block, rows: block.rows.filter(fact => !changed.has(labelOf(fact)))} : block)
+ .filter(block => block.type !== 'facts' || block.rows.length) : view.blocks;
const blocks = [...(done.length ? [{type: 'list' as const, label: {key: 'ai-assistant.detail.stages'}, rows: done}] : []),
- ...view.blocks, ...(facts.length ? [{type: 'facts' as const, rows: facts}] : [])];
+ ...own, ...(facts.length ? [{type: 'facts' as const, rows: facts}] : [])];
return {...view, blocks};
});
diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-color-field.component.html b/ui-ngx/src/app/modules/home/components/ai/ai-color-field.component.html
index 681a5dde69..4e9c9baef8 100644
--- a/ui-ngx/src/app/modules/home/components/ai/ai-color-field.component.html
+++ b/ui-ngx/src/app/modules/home/components/ai/ai-color-field.component.html
@@ -30,10 +30,14 @@
[value]="digits()" [disabled]="disabled()" [attr.aria-invalid]="wrong() || null"
[attr.aria-label]="'ai-assistant.question.hex-label' | translate: {question: question().question, label: ('ai-assistant.question.other-color-short' | translate)}"
(input)="typeHex(hexInput)" (blur)="checkHex(hexInput)" (keydown.enter)="hexEnter($event, hexInput)">
-
+
+
+
+
@if (wrong()) {
diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-color-field.component.ts b/ui-ngx/src/app/modules/home/components/ai/ai-color-field.component.ts
index 2b06877fab..d38ab5bd0d 100644
--- a/ui-ngx/src/app/modules/home/components/ai/ai-color-field.component.ts
+++ b/ui-ngx/src/app/modules/home/components/ai/ai-color-field.component.ts
@@ -1,10 +1,7 @@
// SPDX-FileCopyrightText: Copyright ThingsBoard, Inc.
// SPDX-License-Identifier: BUSL-1.1
-import { ChangeDetectionStrategy, Component, computed, ElementRef, inject, input, model, output, Renderer2, signal, ViewContainerRef } from '@angular/core';
+import { ChangeDetectionStrategy, Component, computed, ElementRef, inject, input, model, output, signal } from '@angular/core';
import { AiQuestion } from '@shared/models/solution-creator.models';
-import { TbPopoverService } from '@shared/components/popover.service';
-import { ColorPickerPanelComponent } from '@shared/components/color-picker/color-picker-panel.component';
-import tinycolor from 'tinycolor2';
import { aiColorOf, aiHexOf, aiIsFree } from '@home/components/ai/ai-question.models';
export function aiColorReady(question: AiQuestion, value: string): boolean {
@@ -29,9 +26,6 @@ export class AiColorFieldComponent {
enter = output();
private elementRef: ElementRef = inject(ElementRef);
- private popoverService = inject(TbPopoverService);
- private renderer = inject(Renderer2);
- private viewContainerRef = inject(ViewContainerRef);
readonly colorOf = aiColorOf;
readonly wrong = signal(false);
@@ -81,31 +75,20 @@ export class AiColorFieldComponent {
}
}
- openPicker(trigger: HTMLElement, field: HTMLInputElement): void {
+ openPicker(picker: HTMLInputElement, field: HTMLInputElement): void {
if (this.disabled()) {
return;
}
- if (this.popoverService.hasPopover(trigger)) {
- this.popoverService.hidePopover(trigger);
- return;
+ picker.value = aiHexOf(field.value) ?? '#000000';
+ try {
+ picker.showPicker();
+ } catch {
+ picker.click();
}
- const popover = this.popoverService.displayPopover({
- trigger,
- renderer: this.renderer,
- hostView: this.viewContainerRef,
- componentType: ColorPickerPanelComponent,
- preferredPlacement: ['bottomLeft', 'bottom', 'topLeft', 'top'],
- context: {color: this.hex() ?? '#305680', disableAlpha: true, colorCancelButton: true},
- showCloseButton: false,
- popoverContentStyle: {padding: '12px 4px 12px 12px'},
- isModal: true
- });
- popover.tbComponentRef.instance.popover = popover;
- popover.tbComponentRef.instance.colorSelected.subscribe((color: string) => {
- popover.hide();
- field.value = tinycolor(color).toHex().toUpperCase();
- this.typeHex(field);
- });
- popover.tbComponentRef.instance.colorCancelDialog.subscribe(() => popover.hide());
+ }
+
+ pickColor(picker: HTMLInputElement, field: HTMLInputElement): void {
+ field.value = picker.value.slice(1).toUpperCase();
+ this.typeHex(field);
}
}
diff --git a/ui-ngx/src/app/modules/home/components/ai/ai-references.ts b/ui-ngx/src/app/modules/home/components/ai/ai-references.ts
index c4a71bf928..39379705b6 100644
--- a/ui-ngx/src/app/modules/home/components/ai/ai-references.ts
+++ b/ui-ngx/src/app/modules/home/components/ai/ai-references.ts
@@ -236,6 +236,13 @@ function replaceMatches(node: Text, pattern: RegExp, chip: (match: RegExpExecArr
export function decorateSeverities(root: HTMLElement, severities: string[] | undefined, label: (severity: string) => string): void {
if (aiHasSeverityMarks(root.textContent ?? '')) {
+ const lone = new RegExp('^\\s*' + SEVERITY_MARK.source + '\\s*$');
+ root.querySelectorAll('code').forEach(code => {
+ const match = !code.closest('pre') ? lone.exec(code.textContent ?? '') : null;
+ if (match) {
+ code.replaceWith(severityChip(match[1], label));
+ }
+ });
textNodes(root, MARK_SKIP).forEach(node => replaceMatches(node, SEVERITY_MARK, match => severityChip(match[1], label)));
decorateAlarmTables(root);
return;
diff --git a/ui-ngx/src/app/modules/home/components/entity/entity-details-page.component.ts b/ui-ngx/src/app/modules/home/components/entity/entity-details-page.component.ts
index a18d4f90c2..538ec3dfc2 100644
--- a/ui-ngx/src/app/modules/home/components/entity/entity-details-page.component.ts
+++ b/ui-ngx/src/app/modules/home/components/entity/entity-details-page.component.ts
@@ -97,6 +97,20 @@ export class EntityDetailsPageComponent extends EntityDetailsPanelComponent impl
this.reload();
}
}));
+ this.subscriptions.push(this.panelService.updatedData$.subscribe(affected => {
+ const id = this.currentEntityId?.id;
+ if (!id || !affected.some(entityId => entityId.id === id)) {
+ return;
+ }
+ if (this.isEdit) {
+ this.panelService.keepEdits('entity', () => {
+ this.onToggleDetailsEditMode();
+ this.reload();
+ });
+ } else {
+ this.reload();
+ }
+ }));
this.subscriptions.push(this.route.paramMap.subscribe( paramMap => {
if (this.entitiesTableConfig) {
const entityType = this.entitiesTableConfig.entityType;
diff --git a/ui-ngx/src/theme/ai-theme.scss b/ui-ngx/src/theme/ai-theme.scss
index 7ae1bf463b..d7e3c12f69 100644
--- a/ui-ngx/src/theme/ai-theme.scss
+++ b/ui-ngx/src/theme/ai-theme.scss
@@ -4727,6 +4727,23 @@ cursor: pointer;
}
}
+.k-ask .k-hexf-pick {
+ position: relative;
+ display: inline-flex;
+
+ > input[type="color"] {
+ position: absolute;
+ inset: 0;
+ width: 100%;
+ height: 100%;
+ margin: 0;
+ padding: 0;
+ border: 0;
+ opacity: 0;
+ pointer-events: none;
+ }
+}
+
.k-ask .k-hexf-hash {
font-family: var(--tb-mono);
font-size: var(--chat-code);