Browse Source

IoT Hub: filter the catalogue by the creator's verification status (#16165)

* feat: filter the IoT Hub catalogue by the creator's verification status

Adds a "Verified creators only" control to every IoT Hub filter panel the
platform renders: the catalogue page, the embedded browse a dialog opens, and
the widget picker in the dashboard editor. It applies through the new
creatorVerified parameter on /api/versions/published, so the result count and
the page count reflect it rather than only the rows on screen, and it joins the
rest of the panel's state - chips, the count on the filter button, "Clear all",
and the reset that happens when the mode changes.

The control is a single checkbox above the facets rather than a section of its
own: one boolean has no list to collapse, and a one-option accordion reads as a
heading whose section never grows. The catalogue's sidebar had no name for its
panel at all, which left that checkbox sitting under nothing, so the sidebar now
carries the same "Filter" title the drawer has, with the same rule under it.

The parameter is matched, not switched, the shape peOnly/ceOnly already have:
creatorVerified=false means "only *un*verified". An unchecked control therefore
omits it entirely and never sends false - MpItemVersionQuery.toQuery() writes
the parameter only when the option is true, and both panels pass undefined
rather than false.

Two surfaces need the facet applied by hand. "Installed from IoT Hub" filters a
cached list in the browser instead of asking the server, so it gets the same
predicate locally; without it the panel would offer the control and the list
would not move. And the widget picker's category landing passes the parameter
to /api/item-listing/widgetCategories, so it stops offering a category whose
only widgets the grid then hides - which is also why the filter button is now
shown on the landing while the flag is set, the one place the panel is
otherwise hidden and the filter would have been unclearable.

The creator page and the search page run the same reads through a component
with no filter panel, so the parameter never reaches them.

Copy names what it filters - the creator's verification status - and claims no
quality tier.

* IoT Hub verified filter: address review comments

- Show only the verified checkbox in the widget-select filter panel on the
  category landing; the other facets are ignored there
- Badge on the landing counts only the verified filter
- Pass the verified flag as-is; the query builders already drop false
- Align the sidebar filter title weight with the drawer header (500)
- Trim explanatory comments

* IoT Hub browse: share the filter checkbox rule with the standalone checkbox

Put the standalone class on the mat-checkbox itself, inset it with a
margin and drop the wrapper and the duplicated hover block.
pull/16134/merge
Dmytro Pinkevych 1 month ago
committed by GitHub
parent
commit
700d7bb8e7
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 5
      ui-ngx/src/app/core/http/iot-hub-api.service.ts
  2. 189
      ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.html
  3. 31
      ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.ts
  4. 21
      ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-browse.component.html
  5. 39
      ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-browse.component.scss
  6. 16
      ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-browse.component.ts
  7. 5
      ui-ngx/src/app/shared/models/iot-hub/iot-hub-version.models.ts
  8. 1
      ui-ngx/src/assets/locale/locale.constant-en_US.json

5
ui-ngx/src/app/core/http/iot-hub-api.service.ts

@ -87,7 +87,7 @@ export class IotHubApiService {
return this.http.get<ItemTypeFilterInfo>(url, { params: this.buildParams(config) });
}
public getWidgetCategories(textSearch?: string, scadaFirst?: boolean,
public getWidgetCategories(textSearch?: string, scadaFirst?: boolean, creatorVerified?: boolean,
config?: IotHubRequestConfig): Observable<WidgetCategory[]> {
const queryParams: string[] = [
`peOnly=false`,
@ -99,6 +99,9 @@ export class IotHubApiService {
if (scadaFirst != null) {
queryParams.push(`scadaFirst=${scadaFirst}`);
}
if (creatorVerified) {
queryParams.push(`creatorVerified=true`);
}
const url = `${this.baseUrl}/api/item-listing/widgetCategories?${queryParams.join('&')}`;
return this.http.get<WidgetCategory[]>(url, { params: this.buildParams(config) });
}

189
ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.html

@ -457,120 +457,129 @@
</div>
}
} @else {
<mat-expansion-panel [expanded]="true">
<mat-expansion-panel-header>
<mat-panel-title>
{{ 'iot-hub.type' | translate }}
@if (iotHubAppliedWidgetTypes.size) {
<span class="tb-iot-hub-filter-badge">{{ iotHubAppliedWidgetTypes.size }}</span>
}
</mat-panel-title>
</mat-expansion-panel-header>
@if (iotHubWidgetTypeOptions.length >= 10) {
<div class="tb-iot-hub-filter-search">
<mat-icon>search</mat-icon>
<input [placeholder]="'iot-hub.search' | translate"
[ngModel]="iotHubFilterSearch['widgetType']"
(ngModelChange)="iotHubFilterSearch['widgetType'] = $event">
@if (iotHubFilterSearch['widgetType']) {
<button mat-icon-button class="tb-iot-hub-filter-search-clear" (click)="iotHubFilterSearch['widgetType'] = ''">
<mat-icon>close</mat-icon>
</button>
}
</div>
}
<div class="tb-iot-hub-filter-items" [class.scrollable]="getFilteredIotHubItems(iotHubWidgetTypeOptions, 'widgetType').length > 8"
(mouseenter)="getFilteredIotHubItems(iotHubWidgetTypeOptions, 'widgetType').length > 8 && (iotHubFilterItemsHovered = true)"
(mouseleave)="iotHubFilterItemsHovered = false">
@for (opt of getFilteredIotHubItems(iotHubWidgetTypeOptions, 'widgetType'); track opt.key) {
<div class="tb-iot-hub-filter-option">
<mat-checkbox [checked]="iotHubAppliedWidgetTypes.has(opt.key)"
(change)="toggleIotHubWidgetType(opt.key)">
{{ getIotHubWidgetTypeLabel(opt.key) }}
</mat-checkbox>
</div>
}
</div>
</mat-expansion-panel>
@if (!hideCategoriesFilterSection) {
<div class="tb-iot-hub-filter-option">
<mat-checkbox [checked]="iotHubVerifiedCreatorsOnly"
(change)="toggleIotHubVerifiedCreators()">
{{ 'iot-hub.verified-creators-only' | translate }}
</mat-checkbox>
</div>
@if (iotHubSubMode !== 'default') {
<mat-divider></mat-divider>
<mat-expansion-panel [expanded]="false">
<mat-expansion-panel [expanded]="true">
<mat-expansion-panel-header>
<mat-panel-title>
{{ 'iot-hub.category' | translate }}
@if (iotHubAppliedCategories.size) {
<span class="tb-iot-hub-filter-badge">{{ iotHubAppliedCategories.size }}</span>
{{ 'iot-hub.type' | translate }}
@if (iotHubAppliedWidgetTypes.size) {
<span class="tb-iot-hub-filter-badge">{{ iotHubAppliedWidgetTypes.size }}</span>
}
</mat-panel-title>
</mat-expansion-panel-header>
@if (iotHubCategoryOptions.length >= 10) {
@if (iotHubWidgetTypeOptions.length >= 10) {
<div class="tb-iot-hub-filter-search">
<mat-icon>search</mat-icon>
<input [placeholder]="'iot-hub.search' | translate"
[ngModel]="iotHubFilterSearch['category']"
(ngModelChange)="iotHubFilterSearch['category'] = $event">
@if (iotHubFilterSearch['category']) {
<button mat-icon-button class="tb-iot-hub-filter-search-clear" (click)="iotHubFilterSearch['category'] = ''">
[ngModel]="iotHubFilterSearch['widgetType']"
(ngModelChange)="iotHubFilterSearch['widgetType'] = $event">
@if (iotHubFilterSearch['widgetType']) {
<button mat-icon-button class="tb-iot-hub-filter-search-clear" (click)="iotHubFilterSearch['widgetType'] = ''">
<mat-icon>close</mat-icon>
</button>
}
</div>
}
<div class="tb-iot-hub-filter-items" [class.scrollable]="getFilteredIotHubItems(iotHubCategoryOptions, 'category').length > 8"
(mouseenter)="getFilteredIotHubItems(iotHubCategoryOptions, 'category').length > 8 && (iotHubFilterItemsHovered = true)"
<div class="tb-iot-hub-filter-items" [class.scrollable]="getFilteredIotHubItems(iotHubWidgetTypeOptions, 'widgetType').length > 8"
(mouseenter)="getFilteredIotHubItems(iotHubWidgetTypeOptions, 'widgetType').length > 8 && (iotHubFilterItemsHovered = true)"
(mouseleave)="iotHubFilterItemsHovered = false">
@for (opt of getFilteredIotHubItems(iotHubCategoryOptions, 'category'); track opt.key) {
@for (opt of getFilteredIotHubItems(iotHubWidgetTypeOptions, 'widgetType'); track opt.key) {
<div class="tb-iot-hub-filter-option">
<mat-checkbox [checked]="iotHubAppliedCategories.has(opt.key)"
(change)="toggleIotHubCategory(opt.key)">
{{ opt.key }}
<mat-checkbox [checked]="iotHubAppliedWidgetTypes.has(opt.key)"
(change)="toggleIotHubWidgetType(opt.key)">
{{ getIotHubWidgetTypeLabel(opt.key) }}
</mat-checkbox>
</div>
}
</div>
</mat-expansion-panel>
}
<mat-divider></mat-divider>
<mat-expansion-panel [expanded]="false">
<mat-expansion-panel-header>
<mat-panel-title>
{{ 'iot-hub.use-case' | translate }}
@if (iotHubAppliedUseCases.size) {
<span class="tb-iot-hub-filter-badge">{{ iotHubAppliedUseCases.size }}</span>
}
</mat-panel-title>
</mat-expansion-panel-header>
@if (iotHubUseCaseOptions.length >= 10) {
<div class="tb-iot-hub-filter-search">
<mat-icon>search</mat-icon>
<input [placeholder]="'iot-hub.search' | translate"
[ngModel]="iotHubFilterSearch['useCase']"
(ngModelChange)="iotHubFilterSearch['useCase'] = $event">
@if (iotHubFilterSearch['useCase']) {
<button mat-icon-button class="tb-iot-hub-filter-search-clear" (click)="iotHubFilterSearch['useCase'] = ''">
<mat-icon>close</mat-icon>
</button>
}
</div>
}
<div class="tb-iot-hub-filter-items" [class.scrollable]="getFilteredIotHubItems(iotHubUseCaseOptions, 'useCase').length > 8"
(mouseenter)="getFilteredIotHubItems(iotHubUseCaseOptions, 'useCase').length > 8 && (iotHubFilterItemsHovered = true)"
(mouseleave)="iotHubFilterItemsHovered = false">
@for (group of getGroupedIotHubFilterItems(iotHubUseCaseOptions, 'useCase'); track group.label) {
@if (group.label) {
<div class="tb-iot-hub-filter-group-label">{{ group.label | translate }}</div>
}
@for (opt of group.items; track opt.key) {
<div class="tb-iot-hub-filter-option">
<mat-checkbox [checked]="iotHubAppliedUseCases.has(opt.key)"
(change)="toggleIotHubUseCase(opt.key)">
{{ opt.key }}
</mat-checkbox>
@if (!hideCategoriesFilterSection) {
<mat-divider></mat-divider>
<mat-expansion-panel [expanded]="false">
<mat-expansion-panel-header>
<mat-panel-title>
{{ 'iot-hub.category' | translate }}
@if (iotHubAppliedCategories.size) {
<span class="tb-iot-hub-filter-badge">{{ iotHubAppliedCategories.size }}</span>
}
</mat-panel-title>
</mat-expansion-panel-header>
@if (iotHubCategoryOptions.length >= 10) {
<div class="tb-iot-hub-filter-search">
<mat-icon>search</mat-icon>
<input [placeholder]="'iot-hub.search' | translate"
[ngModel]="iotHubFilterSearch['category']"
(ngModelChange)="iotHubFilterSearch['category'] = $event">
@if (iotHubFilterSearch['category']) {
<button mat-icon-button class="tb-iot-hub-filter-search-clear" (click)="iotHubFilterSearch['category'] = ''">
<mat-icon>close</mat-icon>
</button>
}
</div>
}
<div class="tb-iot-hub-filter-items" [class.scrollable]="getFilteredIotHubItems(iotHubCategoryOptions, 'category').length > 8"
(mouseenter)="getFilteredIotHubItems(iotHubCategoryOptions, 'category').length > 8 && (iotHubFilterItemsHovered = true)"
(mouseleave)="iotHubFilterItemsHovered = false">
@for (opt of getFilteredIotHubItems(iotHubCategoryOptions, 'category'); track opt.key) {
<div class="tb-iot-hub-filter-option">
<mat-checkbox [checked]="iotHubAppliedCategories.has(opt.key)"
(change)="toggleIotHubCategory(opt.key)">
{{ opt.key }}
</mat-checkbox>
</div>
}
</div>
</mat-expansion-panel>
}
<mat-divider></mat-divider>
<mat-expansion-panel [expanded]="false">
<mat-expansion-panel-header>
<mat-panel-title>
{{ 'iot-hub.use-case' | translate }}
@if (iotHubAppliedUseCases.size) {
<span class="tb-iot-hub-filter-badge">{{ iotHubAppliedUseCases.size }}</span>
}
</mat-panel-title>
</mat-expansion-panel-header>
@if (iotHubUseCaseOptions.length >= 10) {
<div class="tb-iot-hub-filter-search">
<mat-icon>search</mat-icon>
<input [placeholder]="'iot-hub.search' | translate"
[ngModel]="iotHubFilterSearch['useCase']"
(ngModelChange)="iotHubFilterSearch['useCase'] = $event">
@if (iotHubFilterSearch['useCase']) {
<button mat-icon-button class="tb-iot-hub-filter-search-clear" (click)="iotHubFilterSearch['useCase'] = ''">
<mat-icon>close</mat-icon>
</button>
}
</div>
}
</div>
</mat-expansion-panel>
<div class="tb-iot-hub-filter-items" [class.scrollable]="getFilteredIotHubItems(iotHubUseCaseOptions, 'useCase').length > 8"
(mouseenter)="getFilteredIotHubItems(iotHubUseCaseOptions, 'useCase').length > 8 && (iotHubFilterItemsHovered = true)"
(mouseleave)="iotHubFilterItemsHovered = false">
@for (group of getGroupedIotHubFilterItems(iotHubUseCaseOptions, 'useCase'); track group.label) {
@if (group.label) {
<div class="tb-iot-hub-filter-group-label">{{ group.label | translate }}</div>
}
@for (opt of group.items; track opt.key) {
<div class="tb-iot-hub-filter-option">
<mat-checkbox [checked]="iotHubAppliedUseCases.has(opt.key)"
(change)="toggleIotHubUseCase(opt.key)">
{{ opt.key }}
</mat-checkbox>
</div>
}
}
</div>
</mat-expansion-panel>
}
}
</div>
</div>

31
ui-ngx/src/app/modules/home/components/dashboard-page/dashboard-widget-select.component.ts

@ -137,6 +137,7 @@ export class DashboardWidgetSelectComponent {
this.iotHubAppliedWidgetTypes.clear();
this.iotHubAppliedCategories.clear();
this.iotHubAppliedUseCases.clear();
this.iotHubVerifiedCreatorsOnly = false;
this.iotHubFilterCount = 0;
}
}
@ -260,6 +261,7 @@ export class DashboardWidgetSelectComponent {
iotHubAppliedWidgetTypes = new Set<string>();
iotHubAppliedCategories = new Set<string>();
iotHubAppliedUseCases = new Set<string>();
iotHubVerifiedCreatorsOnly = false;
iotHubWidgetTypeOptions: FilterParamInfo[] = [];
iotHubCategoryOptions: FilterParamInfo[] = [];
@ -314,7 +316,8 @@ export class DashboardWidgetSelectComponent {
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
scadaFirst: this.scadaFirst ? true : undefined,
creatorVerified: this.iotHubVerifiedCreatorsOnly
});
return this.iotHubApiService.getPublishedVersions(query, { ignoreLoading: true });
};
@ -337,7 +340,8 @@ export class DashboardWidgetSelectComponent {
this.iotHubDefaultFetchFunction = (pageSize, page, filter) => {
const search = typeof filter === 'string' ? filter.split('|')[0] : filter;
return this.iotHubApiService.getWidgetCategories(search || undefined,
this.scadaFirst ? true : undefined, { ignoreLoading: true }).pipe(
this.scadaFirst ? true : undefined,
this.iotHubVerifiedCreatorsOnly, { ignoreLoading: true }).pipe(
map(categories => ({
data: categories.slice(page * pageSize, page * pageSize + pageSize),
totalPages: Math.ceil(categories.length / pageSize),
@ -554,11 +558,19 @@ export class DashboardWidgetSelectComponent {
this.onIotHubFiltersChanged();
}
toggleIotHubVerifiedCreators(): void {
this.iotHubVerifiedCreatorsOnly = !this.iotHubVerifiedCreatorsOnly;
this.loadWidgetCategories();
this.onIotHubFiltersChanged();
}
clearIotHubFilters(): void {
this.iotHubAppliedWidgetTypes.clear();
this.iotHubAppliedCategories.clear();
this.iotHubAppliedUseCases.clear();
this.iotHubVerifiedCreatorsOnly = false;
this.iotHubFilterSearch = {};
this.loadWidgetCategories();
this.onIotHubFiltersChanged();
}
@ -566,7 +578,8 @@ export class DashboardWidgetSelectComponent {
this.iotHubFilterCount =
this.iotHubAppliedWidgetTypes.size +
(this.iotHubSelectedCategory ? 0 : this.iotHubAppliedCategories.size) +
this.iotHubAppliedUseCases.size;
this.iotHubAppliedUseCases.size +
(this.iotHubVerifiedCreatorsOnly ? 1 : 0);
this.reloadIotHubWidgets();
}
@ -582,6 +595,9 @@ export class DashboardWidgetSelectComponent {
if (this.selectWidgetMode === 'installed') {
return (this.filterWidgetTypes?.length ?? 0) + (this.includeDeprecated ? 1 : 0);
}
if (this.iotHubSubMode === 'default') {
return this.iotHubVerifiedCreatorsOnly ? 1 : 0;
}
return this.iotHubFilterCount;
}
@ -591,7 +607,8 @@ export class DashboardWidgetSelectComponent {
}
return this.iotHubAppliedWidgetTypes.size > 0
|| this.iotHubAppliedCategories.size > 0
|| this.iotHubAppliedUseCases.size > 0;
|| this.iotHubAppliedUseCases.size > 0
|| this.iotHubVerifiedCreatorsOnly;
}
clearAllFilters(): void {
@ -630,7 +647,8 @@ export class DashboardWidgetSelectComponent {
isFilterVisible(): boolean {
if (this.selectWidgetMode === 'iotHub') {
return this.iotHubSubMode !== 'default';
// The category landing honours only the verified filter, so the button stays while it is on
return this.iotHubSubMode !== 'default' || this.iotHubVerifiedCreatorsOnly;
}
return this.installedSubMode === 'allWidgets' || this.widgetsBundle !== null;
}
@ -838,6 +856,9 @@ export class DashboardWidgetSelectComponent {
if (this.iotHubAppliedUseCases.size > 0) {
filtered = filtered.filter(v => v.useCases?.some(u => this.iotHubAppliedUseCases.has(u)));
}
if (this.iotHubVerifiedCreatorsOnly) {
filtered = filtered.filter(v => v.creatorVerified);
}
filtered = this.sortInstalledVersions(filtered);
const start = page * pageSize;
const data = filtered.slice(start, start + pageSize);

21
ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-browse.component.html

@ -25,6 +25,13 @@
<!-- Filter panel template (reused in sidebar and drawer) -->
<ng-template #filterPanelContent>
<div class="tb-iot-hub-filters-inner">
<mat-checkbox class="tb-iot-hub-filter-standalone"
[checked]="verifiedCreatorsOnly"
(change)="onVerifiedCreatorsToggle()">
{{ 'iot-hub.verified-creators-only' | translate }}
</mat-checkbox>
<div class="tb-iot-hub-filter-divider"></div>
@if (!fixedSubType && subtypeOptions.length > 0 && activeType !== ItemType.ALARM_RULE) {
<mat-expansion-panel [expanded]="true" class="tb-iot-hub-filter-panel">
<mat-expansion-panel-header>
@ -253,6 +260,12 @@
<div class="tb-iot-hub-filter-divider" style="margin-bottom: 8px"></div>
<div class="tb-iot-hub-filter-drawer-chips flex flex-wrap items-center gap-2">
<mat-chip-set>
@if (verifiedCreatorsOnly) {
<mat-chip (removed)="onVerifiedCreatorsToggle()">
{{ 'iot-hub.verified-creators-only' | translate }}
<mat-icon matChipRemove>close</mat-icon>
</mat-chip>
}
@for (key of getActiveSubtypesArray(); track key) {
<mat-chip (removed)="onSubtypeToggle(key)">
{{ getSubtypeLabel(key) }}
@ -305,6 +318,8 @@
<!-- Left sidebar filters (visible on large screens) -->
<div class="tb-iot-hub-filters tb-iot-hub-filters-desktop">
<div class="tb-iot-hub-filters-wrapper" [class.filter-items-hovered]="filterItemsHovered">
<div class="tb-iot-hub-filters-header">{{ 'iot-hub.filter' | translate }}</div>
<div class="tb-iot-hub-filter-divider"></div>
<ng-container *ngTemplateOutlet="filterPanelContent"></ng-container>
</div>
</div>
@ -347,6 +362,12 @@
<!-- Active filter chips (hidden on small screens) -->
@if (hasActiveDropdownFilters()) {
<mat-chip-set class="tb-iot-hub-active-filters">
@if (verifiedCreatorsOnly) {
<mat-chip (removed)="onVerifiedCreatorsToggle()">
{{ 'iot-hub.verified-creators-only' | translate }}
<mat-icon matChipRemove>close</mat-icon>
</mat-chip>
}
@for (key of getActiveSubtypesArray(); track key) {
<mat-chip (removed)="onSubtypeToggle(key)">
{{ getSubtypeLabel(key) }}

39
ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-browse.component.scss

@ -97,6 +97,17 @@
}
}
.tb-iot-hub-filters-header {
padding: 16px 16px 12px 56px;
font-size: 18px;
font-weight: 500;
color: rgba(0, 0, 0, 0.87);
}
.tb-iot-hub-filters-desktop .tb-iot-hub-filters-inner {
padding-top: 8px;
}
.tb-iot-hub-filters-wrapper {
position: sticky;
max-height: calc(100vh - var(--mat-toolbar-standard-height, 64px));
@ -167,6 +178,10 @@
padding: 0;
}
.tb-iot-hub-filter-standalone {
margin-left: 13px;
}
.tb-iot-hub-filter-panel.mat-expansion-panel {
.mat-expansion-panel-header {
padding-left: 24px;
@ -199,6 +214,21 @@
background: rgba(0, 0, 0, 0.12);
}
// 56px section-title inset minus the checkbox's own 11px
.tb-iot-hub-filter-standalone {
margin-left: 45px;
}
.tb-iot-hub-filter-panel.mat-expansion-panel mat-checkbox,
.tb-iot-hub-filter-standalone {
display: block;
overflow: hidden;
&:hover {
background: rgba(0, 0, 0, 0.04);
}
}
// Filter expansion panels — Design: no shadow, pl-40 for content
.tb-iot-hub-filter-panel.mat-expansion-panel {
box-shadow: none;
@ -221,15 +251,6 @@
padding: 0 8px 0 0;
}
mat-checkbox {
display: block;
overflow: hidden;
&:hover {
background: rgba(0, 0, 0, 0.04);
}
}
.tb-iot-hub-filter-items {
padding-left: 44px;
max-height: 340px;

16
ui-ngx/src/app/modules/home/components/iot-hub/iot-hub-browse.component.ts

@ -128,6 +128,7 @@ export class TbIotHubBrowseComponent implements OnInit, AfterViewInit, OnDestroy
activeConnectivity = new Set<string>();
activeHardwareTypes = new Set<string>();
activeVendors = new Set<string>();
verifiedCreatorsOnly = false;
sortOptions: SortOption[] = [
{ value: 'totalInstallCount', label: 'iot-hub.sort-most-installed', direction: Direction.DESC },
@ -396,6 +397,12 @@ export class TbIotHubBrowseComponent implements OnInit, AfterViewInit, OnDestroy
this.loadItems();
}
onVerifiedCreatorsToggle(): void {
this.verifiedCreatorsOnly = !this.verifiedCreatorsOnly;
this.pageIndex = 0;
this.loadItems();
}
isVendorActive(vendor: string): boolean {
return this.activeVendors.has(vendor);
}
@ -499,12 +506,14 @@ export class TbIotHubBrowseComponent implements OnInit, AfterViewInit, OnDestroy
this.activeConnectivity.clear();
this.activeHardwareTypes.clear();
this.activeVendors.clear();
this.verifiedCreatorsOnly = false;
}
get activeFilterCount(): number {
const subtypeCount = this.fixedSubType ? this.getActiveSubtypesArray().length : (this.getActiveSubtypes()?.size || 0);
return subtypeCount + this.activeCategories.size + this.activeUseCases.size +
this.activeConnectivity.size + this.activeHardwareTypes.size + this.activeVendors.size;
this.activeConnectivity.size + this.activeHardwareTypes.size + this.activeVendors.size +
(this.verifiedCreatorsOnly ? 1 : 0);
}
hasActiveDropdownFilters(): boolean {
@ -512,7 +521,7 @@ export class TbIotHubBrowseComponent implements OnInit, AfterViewInit, OnDestroy
return this.activeCategories.size > 0 ||
this.activeUseCases.size > 0 || subtypeCount > 0 ||
this.activeConnectivity.size > 0 || this.activeHardwareTypes.size > 0 ||
this.activeVendors.size > 0;
this.activeVendors.size > 0 || this.verifiedCreatorsOnly;
}
hasActiveFilters(): boolean {
@ -700,7 +709,8 @@ export class TbIotHubBrowseComponent implements OnInit, AfterViewInit, OnDestroy
ruleChainTypes: this.activeRuleChainTypes.size > 0 ? Array.from(this.activeRuleChainTypes) : undefined,
hardwareTypes: this.activeHardwareTypes.size > 0 ? Array.from(this.activeHardwareTypes) : undefined,
connectivity: this.activeConnectivity.size > 0 ? Array.from(this.activeConnectivity) : undefined,
vendors: this.activeVendors.size > 0 ? Array.from(this.activeVendors) : undefined
vendors: this.activeVendors.size > 0 ? Array.from(this.activeVendors) : undefined,
creatorVerified: this.verifiedCreatorsOnly
});
this.iotHubApiService.getPublishedVersions(
query,

5
ui-ngx/src/app/shared/models/iot-hub/iot-hub-version.models.ts

@ -131,6 +131,8 @@ export interface MpItemVersionQueryOptions {
connectivity?: string[];
vendors?: string[];
scadaFirst?: boolean;
// Serialized only when true: the API matches the value, so `false` would mean "unverified only"
creatorVerified?: boolean;
}
export class MpItemVersionQuery {
@ -178,6 +180,9 @@ export class MpItemVersionQuery {
if (o.scadaFirst != null) {
query += `&scadaFirst=${o.scadaFirst}`;
}
if (o.creatorVerified) {
query += `&creatorVerified=true`;
}
return query;
}
}

1
ui-ngx/src/assets/locale/locale.constant-en_US.json

@ -3772,6 +3772,7 @@
"sort-newest": "Newest",
"sort-name": "Name (A-Z)",
"type-filter-label": "Type",
"verified-creators-only": "Verified creators only",
"category": "Category",
"use-case": "Use case",
"vendor": "Vendor",

Loading…
Cancel
Save