diff --git a/ui-ngx/src/app/core/http/iot-hub-api.service.ts b/ui-ngx/src/app/core/http/iot-hub-api.service.ts index f6d10b330a..f6583a32ef 100644 --- a/ui-ngx/src/app/core/http/iot-hub-api.service.ts +++ b/ui-ngx/src/app/core/http/iot-hub-api.service.ts @@ -73,11 +73,11 @@ export class IotHubApiService { } public getPublishedVersions(query: MpItemVersionQuery, config?: IotHubRequestConfig): Observable> { - if (query.tbVersion == null) { - query.tbVersion = tbVersionToInt(env.tbVersion); + if (query.options.tbVersion == null) { + query.options.tbVersion = tbVersionToInt(env.tbVersion); } - if (query.peOnly == null) { - query.peOnly = false; + if (query.options.peOnly == null) { + query.options.peOnly = false; } return this.http.get>( `${this.baseUrl}/api/versions/published${query.toQuery()}`, @@ -129,14 +129,6 @@ export class IotHubApiService { }); } - public reportVersionInstalled(versionId: string, config?: IotHubRequestConfig): Observable { - return this.http.post( - `${this.baseUrl}/api/versions/${versionId}/install`, - null, - { params: this.buildParams(config) } - ); - } - public getConnectivitySettings(config?: IotHubRequestConfig): Observable { return this.http.get( `/api/iot-hub/connectivity`, diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.html b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.html index 77029df41d..53b557a12e 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.html +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.html @@ -106,7 +106,7 @@ [itemCard]="installedDefaultCard" [loadingCell]="widgetLoadingCard" [dataLoading]="loadingWidgetBundles" - [noData]="noWidgetBundles"> + [noData]="noData"> @switch (item.__logical) { @@ -119,7 +119,7 @@
- {{ 'widget.all-widgets' | translate }} + {{ 'widget.all-widgets' | translate }}
} @@ -152,10 +152,6 @@
- - widgets-bundle.no-widgets-bundles-text - } } @case ('iotHub') { @@ -169,7 +165,7 @@ [itemCard]="iotHubDefaultCard" [loadingCell]="widgetLoadingCard" [dataLoading]="loadingCategories" - [noData]="noCategories"> + [noData]="noData"> @switch (item.__logical) { @@ -182,7 +178,7 @@
- {{ 'widget.all-widgets' | translate }} + {{ 'widget.all-widgets' | translate }}
} @@ -195,7 +191,7 @@
- {{ 'iot-hub.installed-from-iot-hub' | translate }} + {{ 'iot-hub.installed-from-iot-hub' | translate }}
} @@ -222,9 +218,6 @@
- - {{ 'iot-hub.no-items-found' | translate }} - } @case ('installed') { @@ -246,7 +239,7 @@ [itemCard]="widgetCard" [loadingCell]="widgetLoadingCard" [dataLoading]="loadingWidgets" - [noData]="noWidgets"> + [noData]="noData"> @@ -278,9 +271,6 @@ - - {{ 'widget.no-widgets-text' | translate }} - @@ -302,7 +292,7 @@ [itemCard]="iotHubWidgetCard" [loadingCell]="widgetLoadingCard" [dataLoading]="loadingIotHubWidgets" - [noData]="noIotHubWidgets"> + [noData]="noData"> @@ -315,9 +305,6 @@ - - {{ 'iot-hub.no-items-found' | translate }} - @@ -329,7 +316,7 @@ [itemCard]="iotHubInstalledWidgetCard" [loadingCell]="widgetLoadingCard" [dataLoading]="loadingIotHubInstalledWidgets" - [noData]="noIotHubInstalledWidgets"> + [noData]="noData"> @@ -342,9 +329,30 @@ - - {{ 'iot-hub.no-items-found' | translate }} - + + + +
+
+
+

{{ 'iot-hub.no-widgets-found' | translate }}

+

{{ 'iot-hub.no-items-found-text' | translate }}

+ @if (hasActiveSearchOrFilters()) { + + } +
+ @if (selectWidgetMode === 'installed' && installedSubMode === 'allWidgets') { +
+ storefront +

+ {{ 'iot-hub.browse-tip-prefix' | translate }} {{ 'iot-hub.browse-tip-link' | translate }} {{ 'iot-hub.browse-tip-suffix' | translate }} +

+ arrow_forward +
+ } +
diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.scss b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.scss index f69cd35eca..0a0d700053 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.scss +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.scss @@ -13,6 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@import "../../../../../scss/constants"; + tb-dashboard-widget-select { display: flex; flex-direction: column; @@ -71,7 +73,7 @@ tb-dashboard-widget-select { background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 8px; - caret-color: #00695c; + caret-color: $tb-primary-color; color: rgba(255, 255, 255, 0.84); mat-icon { @@ -103,7 +105,7 @@ tb-dashboard-widget-select { &.focus { background: #fff; border-color: rgba(255, 255, 255, 0.15); - caret-color: #00695c; + caret-color: $tb-primary-color; mat-icon { color: rgba(0, 0, 0, 0.54); @@ -153,6 +155,79 @@ tb-dashboard-widget-select { } } + .tb-widget-select-empty-state { + padding: 40px 12px; + text-align: center; + gap: 40px; + + .tb-widget-select-empty-inner { + gap: 20px; + + .tb-no-data-bg { + flex: auto; + height: 100px; + } + + h3 { + font-size: 20px; + font-weight: 600; + line-height: 24px; + letter-spacing: 0.1px; + color: rgba(0, 0, 0, 0.87); + margin: 0; + } + + p { + font-size: 14px; + font-weight: 400; + line-height: 20px; + letter-spacing: 0.2px; + color: rgba(0, 0, 0, 0.76); + margin: 0; + } + } + + .tb-widget-select-browse-tip { + display: flex; + width: 100%; + gap: 16px; + align-items: center; + padding: 16px 20px; + border: 1px solid $tb-primary-color; + border-radius: 4px; + background: #fff; + cursor: pointer; + transition: background-color 0.2s; + + &:hover { + background: rgba($tb-primary-color, 0.06); + } + + .tb-widget-select-browse-tip-icon, + .tb-widget-select-browse-tip-arrow { + flex-shrink: 0; + color: $tb-primary-color; + } + + .tb-widget-select-browse-tip-text { + flex: 1; + text-align: left; + margin: 0; + font-size: 16px; + font-weight: 400; + line-height: 24px; + letter-spacing: 0.15px; + color: rgba(0, 0, 0, 0.76); + + .tb-widget-select-browse-tip-link { + font-weight: 500; + letter-spacing: 0.25px; + color: $tb-primary-color; + } + } + } + } + .mat-mdc-card.tb-widget-preview-card { cursor: pointer; transition: box-shadow 0.2s; diff --git a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.ts b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.ts index 4116b38b65..4b744bb762 100644 --- a/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.ts +++ b/ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.ts @@ -319,19 +319,13 @@ export class DashboardWidgetSelectComponent { const effectiveCategories = this.iotHubSelectedCategory ? [this.iotHubSelectedCategory] : (this.iotHubAppliedCategories.size > 0 ? Array.from(this.iotHubAppliedCategories) : undefined); - const query = new MpItemVersionQuery(pageLink, ItemType.WIDGET, - undefined, undefined, - effectiveCategories, - this.iotHubAppliedUseCases.size > 0 ? Array.from(this.iotHubAppliedUseCases) : undefined, - undefined, - this.iotHubAppliedWidgetTypes.size > 0 ? Array.from(this.iotHubAppliedWidgetTypes) : undefined, - undefined, - undefined, - undefined, - undefined, - undefined, - this.scadaFirst ? true : undefined - ); + const query = new MpItemVersionQuery(pageLink, { + type: ItemType.WIDGET, + categories: effectiveCategories, + useCases: this.iotHubAppliedUseCases.size > 0 ? Array.from(this.iotHubAppliedUseCases) : undefined, + widgetTypes: this.iotHubAppliedWidgetTypes.size > 0 ? Array.from(this.iotHubAppliedWidgetTypes) : undefined, + scadaFirst: this.scadaFirst ? true : undefined + }); return this.iotHubApiService.getPublishedVersions(query, { ignoreLoading: true }); }; @@ -641,6 +635,22 @@ export class DashboardWidgetSelectComponent { } } + hasActiveSearchOrFilters(): boolean { + return !!this.searchSubject.value?.trim() || this.hasActiveFilters(); + } + + clearSearchAndFilters(): void { + this.searchSubject.next(''); + if (this.hasActiveFilters()) { + this.clearAllFilters(); + } + } + + navigateToIotHubAllWidgets(): void { + this.selectWidgetMode = 'iotHub'; + this.iotHubSubMode = 'allWidgets'; + } + get hideCategoriesFilterSection(): boolean { return this.selectWidgetMode === 'iotHub' && this.iotHubSubMode === 'category'; } @@ -680,7 +690,7 @@ export class DashboardWidgetSelectComponent { return this.translate.instant('iot-hub.installed-from-iot-hub'); } if (this.iotHubSubMode === 'allWidgets') { - return this.translate.instant('widget.all-widgets'); + return this.translate.instant('iot-hub.all-iot-hub-widgets'); } return ''; } diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-actions.service.ts b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-actions.service.ts index c43d284595..9cc248df35 100644 --- a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-actions.service.ts +++ b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-actions.service.ts @@ -49,7 +49,7 @@ export class IotHubActionsService { addItem(itemType: ItemType, options?: { itemSubType?: string; entityId?: EntityId }): Observable { return this.dialog.open(TbIotHubAddItemDialogComponent, { - panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], + panelClass: ['tb-dialog', 'tb-fullscreen-dialog-lt-md'], disableClose: true, autoFocus: false, data: { diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-add-item-dialog.component.scss b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-add-item-dialog.component.scss index 831b8f8e92..c2234ab92e 100644 --- a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-add-item-dialog.component.scss +++ b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-add-item-dialog.component.scss @@ -21,19 +21,24 @@ position: relative; padding: 0; overflow-x: hidden; - height: 80vh; + height: 70vh; + max-height: 70vh; tb-iot-hub-browse { height: 100%; } - @media #{$mat-gt-xs} { + @media #{$mat-gt-sm} { width: 80vw; } @media #{$mat-gt-md} { width: 1000px; } + + @media #{$mat-gt-xmd} { + width: 1200px; + } } .mat-mdc-dialog-actions { diff --git a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-browse.component.html b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-browse.component.html index 36aafc21e1..f5f0590813 100644 --- a/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-browse.component.html +++ b/ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-browse.component.html @@ -15,7 +15,7 @@ limitations under the License. --> -
+