Browse Source

removed unnecessary request from library

pull/8337/head
Maksym Dudnik 3 years ago
parent
commit
c71ee6fa14
  1. 2
      ui-ngx/src/app/shared/components/device/gateway-configuration.component.ts
  2. 2
      ui-ngx/src/app/shared/components/device/gateway-connectors.component.ts
  3. 3
      ui-ngx/src/app/shared/components/device/gateway-statistics.component.ts

2
ui-ngx/src/app/shared/components/device/gateway-configuration.component.ts

@ -31,6 +31,7 @@ import { DeviceService } from '@core/http/device.service';
import { of } from 'rxjs';
import { mergeMap } from 'rxjs/operators';
import { DeviceCredentialsType } from '@shared/models/device.models';
import { NULL_UUID } from '@shared/models/id/has-uuid';
export enum StorageTypes {
MEMORY = 'memory',
@ -317,6 +318,7 @@ export class GatewayConfigurationComponent implements OnInit {
}
fetchConfigAttribute(entityId: EntityId) {
if (entityId.id === NULL_UUID) return;
this.attributeService.getEntityAttributes(entityId, AttributeScope.CLIENT_SCOPE,
['general_configuration', 'grpc_configuration', 'logs_configuration', 'storage_configuration', 'RemoteLoggingLevel']).pipe(
mergeMap(attributes => attributes.length ? of(attributes) : this.attributeService.getEntityAttributes(

2
ui-ngx/src/app/shared/components/device/gateway-connectors.component.ts

@ -39,6 +39,7 @@ import { ActionNotificationShow } from '@core/notification/notification.actions'
import { DialogService } from '@app/core/services/dialog.service';
import { WidgetContext } from '@home/models/widget-component.models';
import { deepClone } from '@core/utils';
import { NULL_UUID } from '@shared/models/id/has-uuid';
export interface gatewayConnector {
@ -161,6 +162,7 @@ export class GatewayConnectorComponent extends PageComponent implements AfterVie
this.viewsInited = true;
if (this.device) {
if (this.device.id === NULL_UUID) return;
forkJoin(this.attributeService.getEntityAttributes(this.device, AttributeScope.SHARED_SCOPE, ['active_connectors']),
this.attributeService.getEntityAttributes(this.device, AttributeScope.SERVER_SCOPE, ['inactive_connectors'])).subscribe(attributes => {
if (attributes.length) {

3
ui-ngx/src/app/shared/components/device/gateway-statistics.component.ts

@ -39,6 +39,7 @@ import { PageLink } from '@shared/models/page/page-link';
import { Direction, SortOrder } from '@shared/models/page/sort-order';
import { MatTableDataSource } from '@angular/material/table';
import { MatSort } from '@angular/material/sort';
import { NULL_UUID } from '@shared/models/id/has-uuid';
@Component({
@ -124,8 +125,8 @@ export class GatewayStatisticsComponent extends PageComponent implements AfterVi
})
this.init();
if (this.ctx.defaultSubscription.datasources.length) {
const gateway = this.ctx.defaultSubscription.datasources[0].entity;
if (gateway.id.id === NULL_UUID) return;
if (!this.general) {
this.attributeService.getEntityAttributes(gateway.id, AttributeScope.SHARED_SCOPE, ["general_configuration"]).subscribe((resp: AttributeData[]) => {
if (resp && resp.length) {

Loading…
Cancel
Save