diff --git a/ui-ngx/src/app/core/http/dashboard.service.ts b/ui-ngx/src/app/core/http/dashboard.service.ts index c039fed4da..f4355d7ebe 100644 --- a/ui-ngx/src/app/core/http/dashboard.service.ts +++ b/ui-ngx/src/app/core/http/dashboard.service.ts @@ -165,12 +165,14 @@ export class DashboardService { public assignDashboardToEdge(edgeId: string, dashboardId: string, config?: RequestConfig): Observable { - return this.http.post(`/api/edge/${edgeId}/dashboard/${dashboardId}`, - null, defaultHttpOptionsFromConfig(config)); + return this.http.post(`/api/edge/${edgeId}/dashboard/${dashboardId}`, null, + defaultHttpOptionsFromConfig(config)); } - public unassignDashboardFromEdge(edgeId: string, dashboardId: string, config?: RequestConfig) { - return this.http.delete(`/api/edge/${edgeId}/dashboard/${dashboardId}`, defaultHttpOptionsFromConfig(config)); + public unassignDashboardFromEdge(edgeId: string, dashboardId: string, + config?: RequestConfig) { + return this.http.delete(`/api/edge/${edgeId}/dashboard/${dashboardId}`, + defaultHttpOptionsFromConfig(config)); } } diff --git a/ui-ngx/src/app/core/http/device.service.ts b/ui-ngx/src/app/core/http/device.service.ts index 23dd53c2fd..048a6196f7 100644 --- a/ui-ngx/src/app/core/http/device.service.ts +++ b/ui-ngx/src/app/core/http/device.service.ts @@ -155,11 +155,14 @@ export class DeviceService { return this.http.delete(`/api/customer/device/${deviceName}/claim`, defaultHttpOptionsFromConfig(config)); } - public assignDeviceToEdge(edgeId: string, deviceId: string, config?: RequestConfig): Observable { - return this.http.post(`/api/edge/${edgeId}/device/${deviceId}`, defaultHttpOptionsFromConfig(config)); + public assignDeviceToEdge(edgeId: string, deviceId: string, + config?: RequestConfig): Observable { + return this.http.post(`/api/edge/${edgeId}/device/${deviceId}`, + defaultHttpOptionsFromConfig(config)); } - public unassignDeviceFromEdge(edgeId: string, deviceId: string, config?: RequestConfig) { + public unassignDeviceFromEdge(edgeId: string, deviceId: string, + config?: RequestConfig) { return this.http.delete(`/api/edge/${edgeId}/device/${deviceId}`, defaultHttpOptionsFromConfig(config)); } diff --git a/ui-ngx/src/app/core/http/edge.service.ts b/ui-ngx/src/app/core/http/edge.service.ts index b8bf6c7282..b33b13378d 100644 --- a/ui-ngx/src/app/core/http/edge.service.ts +++ b/ui-ngx/src/app/core/http/edge.service.ts @@ -54,38 +54,32 @@ export class EdgeService { return this.http.get>('/api/edge/types', defaultHttpOptionsFromConfig(config)); } - public getTenantEdges(pageLink: PageLink, type: string = '', - config?: RequestConfig): Observable> { - return this.http.get>(`/api/tenant/edges${pageLink.toQuery()}&type=${type}`, - defaultHttpOptionsFromConfig(config)); - } - - public getCustomerEdges(customerId: string, pageLink: PageLink, type: string = '', - config?: RequestConfig): Observable> { - return this.http.get>(`/api/customer/${customerId}/edges${pageLink.toQuery()}&type=${type}`, - defaultHttpOptionsFromConfig(config)); - } - public getCustomerEdgeInfos(customerId: string, pageLink: PageLink, type: string = '', config?: RequestConfig): Observable> { return this.http.get>(`/api/customer/${customerId}/edgeInfos${pageLink.toQuery()}&type=${type}`, defaultHttpOptionsFromConfig(config)); } - public assignEdgeToCustomer(customerId: string, edgeId: string, config?: RequestConfig): Observable { - return this.http.post(`/api/customer/${customerId}/edge/${edgeId}`, defaultHttpOptionsFromConfig(config)); + public assignEdgeToCustomer(customerId: string, edgeId: string, + config?: RequestConfig): Observable { + return this.http.post(`/api/customer/${customerId}/edge/${edgeId}`, + defaultHttpOptionsFromConfig(config)); } public unassignEdgeFromCustomer(edgeId: string, config?: RequestConfig) { - return this.http.delete(`/api/customer/edge/${edgeId}`, defaultHttpOptionsFromConfig(config)); + return this.http.delete(`/api/customer/edge/${edgeId}`, + defaultHttpOptionsFromConfig(config)); } public makeEdgePublic(edgeId: string, config?: RequestConfig): Observable { - return this.http.post(`/api/customer/public/edge/${edgeId}`, defaultHttpOptionsFromConfig(config)); + return this.http.post(`/api/customer/public/edge/${edgeId}`, + defaultHttpOptionsFromConfig(config)); } - public setRootRuleChain(edgeId: string, ruleChainId: string, config?: RequestConfig): Observable { - return this.http.post(`/api/edge/${edgeId}/${ruleChainId}/root`, defaultHttpOptionsFromConfig(config)); + public setRootRuleChain(edgeId: string, ruleChainId: string, + config?: RequestConfig): Observable { + return this.http.post(`/api/edge/${edgeId}/${ruleChainId}/root`, + defaultHttpOptionsFromConfig(config)); } public getTenantEdgeInfos(pageLink: PageLink, type: string = '', @@ -95,10 +89,12 @@ export class EdgeService { } public findByQuery(query: EdgeSearchQuery, config?: RequestConfig): Observable> { - return this.http.post>('/api/edges', query, defaultHttpOptionsFromConfig(config)); + return this.http.post>('/api/edges', query, + defaultHttpOptionsFromConfig(config)); } - public getEdgeEvents(entityId: EntityId, pageLink: TimePageLink, config?: RequestConfig): Observable> { + public getEdgeEvents(entityId: EntityId, pageLink: TimePageLink, + config?: RequestConfig): Observable> { return this.http.get>(`/api/edge/${entityId.id}/events` + `${pageLink.toQuery()}`, defaultHttpOptionsFromConfig(config)); } diff --git a/ui-ngx/src/app/core/http/entity-view.service.ts b/ui-ngx/src/app/core/http/entity-view.service.ts index 468ccca53d..a9f59e5821 100644 --- a/ui-ngx/src/app/core/http/entity-view.service.ts +++ b/ui-ngx/src/app/core/http/entity-view.service.ts @@ -88,7 +88,8 @@ export class EntityViewService { defaultHttpOptionsFromConfig(config)); } - public unassignEntityViewFromEdge(edgeId: string, entityViewId: string, config?: RequestConfig) { + public unassignEntityViewFromEdge(edgeId: string, entityViewId: string, + config?: RequestConfig) { return this.http.delete(`/api/edge/${edgeId}/entityView/${entityViewId}`, defaultHttpOptionsFromConfig(config)); } diff --git a/ui-ngx/src/app/core/http/entity.service.ts b/ui-ngx/src/app/core/http/entity.service.ts index 0d077fea45..a61c52c379 100644 --- a/ui-ngx/src/app/core/http/entity.service.ts +++ b/ui-ngx/src/app/core/http/entity.service.ts @@ -68,7 +68,6 @@ import { StringOperation } from '@shared/models/query/query.models'; import { alarmFields } from '@shared/models/alarm.models'; - import { EdgeService } from "@core/http/edge.service"; import { ruleChainType } from "@shared/models/rule-chain.models"; import { Router } from "@angular/router"; @@ -93,7 +92,7 @@ export class EntityService { private entityRelationService: EntityRelationService, private attributeService: AttributeService, private utils: UtilsService, - private route: Router + private router: Router ) { } private getEntityObservable(entityType: EntityType, entityId: string, @@ -323,7 +322,7 @@ export class EntityService { break; case EntityType.RULE_CHAIN: pageLink.sortOrder.property = 'name'; - if (this.route.url.includes('edge')) { + if (this.router.url.includes('edge')) { entitiesObservable = this.ruleChainService.getRuleChains(pageLink, ruleChainType.edge, config); } else { entitiesObservable = this.ruleChainService.getRuleChains(pageLink, ruleChainType.core, config); diff --git a/ui-ngx/src/app/core/http/event.service.ts b/ui-ngx/src/app/core/http/event.service.ts index 62a8a01780..fe5c064cb5 100644 --- a/ui-ngx/src/app/core/http/event.service.ts +++ b/ui-ngx/src/app/core/http/event.service.ts @@ -39,7 +39,8 @@ export class EventService { defaultHttpOptionsFromConfig(config)); } - public getEdgeEvents(entityId: EntityId, pageLink: TimePageLink, config?: RequestConfig): Observable> { + public getEdgeEvents(entityId: EntityId, pageLink: TimePageLink, + config?: RequestConfig): Observable> { return this.http.get>(`/api/edge/${entityId.id}/events` + `${pageLink.toQuery()}`, defaultHttpOptionsFromConfig(config)); } diff --git a/ui-ngx/src/app/core/http/rule-chain.service.ts b/ui-ngx/src/app/core/http/rule-chain.service.ts index 1a6c011a4c..61a52e899b 100644 --- a/ui-ngx/src/app/core/http/rule-chain.service.ts +++ b/ui-ngx/src/app/core/http/rule-chain.service.ts @@ -25,9 +25,10 @@ import { RuleChain, RuleChainConnectionInfo, RuleChainMetaData, - ruleChainNodeComponent, RuleChainType, + ruleChainNodeComponent, ruleNodeTypeComponentTypes, - unknownNodeComponent + unknownNodeComponent, + RuleChainType } from '@shared/models/rule-chain.models'; import { ComponentDescriptorService } from './component-descriptor.service'; import { diff --git a/ui-ngx/src/app/modules/home/components/event/event-table-config.ts b/ui-ngx/src/app/modules/home/components/event/event-table-config.ts index 02ee8ea578..4b7a2c8ade 100644 --- a/ui-ngx/src/app/modules/home/components/event/event-table-config.ts +++ b/ui-ngx/src/app/modules/home/components/event/event-table-config.ts @@ -22,11 +22,11 @@ import { } from '@home/models/entity/entities-table-config.models'; import { DebugEventType, - EdgeEventType, - EdgeEventStatusColor, - edgeEventStatusColor, Event, - EventType + EventType, + EdgeEventType, + EdgeEventStatus, + edgeEventStatusColor } from '@shared/models/event.models'; import {TimePageLink} from '@shared/models/page/page-link'; import {TranslateService} from '@ngx-translate/core'; @@ -66,7 +66,7 @@ export class EventTableConfig extends EntityTableConfig { } eventTypes: Array; - queueStartTs: any; + queueStartTs: number; constructor(private eventService: EventService, private dialogService: DialogService, @@ -197,7 +197,7 @@ export class EventTableConfig extends EntityTableConfig { new EntityTableColumn('status', 'event.status', '100%', (entity) => this.updateEdgeEventStatus(entity.createdTime), entity => ({ - color: this.isPending(entity.createdTime) ? edgeEventStatusColor.get(EdgeEventStatusColor.PENDING) : edgeEventStatusColor.get(EdgeEventStatusColor.DEPLOYED) + color: this.isPending(entity.createdTime) ? edgeEventStatusColor.get(EdgeEventStatus.PENDING) : edgeEventStatusColor.get(EdgeEventStatus.DEPLOYED) }), false), new EntityActionTableColumn('data', 'event.data', { @@ -347,14 +347,10 @@ export class EventTableConfig extends EntityTableConfig { } updateEdgeEventStatus(createdTime) { - if (this.queueStartTs) { - var status: string; - if (createdTime < this.queueStartTs) { - status = this.translate.instant('edge.success'); - } else { - status = this.translate.instant('edge.failed'); - } - return status; + if (this.queueStartTs && createdTime < this.queueStartTs) { + return this.translate.instant('edge.success'); + } else { + return this.translate.instant('edge.failed'); } } @@ -363,13 +359,14 @@ export class EventTableConfig extends EntityTableConfig { } loadEdgeInfo() { - this.attributeService.getEntityAttributes(this.entityId, AttributeScope.SERVER_SCOPE,["queueStartTs"]) + this.attributeService.getEntityAttributes(this.entityId, AttributeScope.SERVER_SCOPE, ['queueStartTs']) .subscribe( attributes => this.onUpdate(attributes) ); } onUpdate(attributes) { + this.queueStartTs = 0; let edge = attributes.reduce(function (map, attribute) { map[attribute.key] = attribute; return map; diff --git a/ui-ngx/src/app/modules/home/components/event/event-table.component.ts b/ui-ngx/src/app/modules/home/components/event/event-table.component.ts index 6aa96c83da..ac1ccd1e09 100644 --- a/ui-ngx/src/app/modules/home/components/event/event-table.component.ts +++ b/ui-ngx/src/app/modules/home/components/event/event-table.component.ts @@ -25,7 +25,7 @@ import { EventService } from '@core/http/event.service'; import { DialogService } from '@core/services/dialog.service'; import { DebugEventType, EventType } from '@shared/models/event.models'; import { RuleChainService } from "@core/http/rule-chain.service"; -import {AttributeService} from "@core/http/attribute.service"; +import { AttributeService } from "@core/http/attribute.service"; @Component({ selector: 'tb-event-table', diff --git a/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts b/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts index 416fd35992..4fbbd32900 100644 --- a/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts +++ b/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts @@ -107,6 +107,7 @@ export class EntityActionTableColumn> extends BaseEnti super('action', key, title, width, false); } } + export class DateEntityTableColumn> extends EntityTableColumn { constructor(key: string, title: string, diff --git a/ui-ngx/src/app/modules/home/pages/asset/asset.component.ts b/ui-ngx/src/app/modules/home/pages/asset/asset.component.ts index 5c3fd44a8e..ee79b58d45 100644 --- a/ui-ngx/src/app/modules/home/pages/asset/asset.component.ts +++ b/ui-ngx/src/app/modules/home/pages/asset/asset.component.ts @@ -35,7 +35,7 @@ export class AssetComponent extends EntityComponent { entityType = EntityType; - assetScope: 'tenant' | 'customer' | 'customer_user'; + assetScope: 'tenant' | 'customer' | 'customer_user' | 'edge'; constructor(protected store: Store, protected translate: TranslateService, diff --git a/ui-ngx/src/app/modules/home/pages/asset/assets-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/asset/assets-table-config.resolver.ts index 5b48a5c36c..36ddf43760 100644 --- a/ui-ngx/src/app/modules/home/pages/asset/assets-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/asset/assets-table-config.resolver.ts @@ -70,7 +70,6 @@ export class AssetsTableConfigResolver implements Resolve = new EntityTableConfig(); private customerId: string; - private edgeId: string; constructor(private store: Store, private broadcast: BroadcastService, @@ -115,10 +114,10 @@ export class AssetsTableConfigResolver implements Resolve { if (authUser.authority === Authority.CUSTOMER_USER) { @@ -137,8 +136,9 @@ export class AssetsTableConfigResolver implements Resolve - this.config.tableTitle = edge.name + ': ' + this.translate.instant('asset.assets'))).subscribe(); + this.edgeService.getEdge(this.config.componentsData.edgeId).subscribe( + edge => this.config.tableTitle = edge.name + ': ' + this.translate.instant('asset.assets') + ); } else { this.config.tableTitle = this.translate.instant('asset.assets'); } @@ -181,7 +181,7 @@ export class AssetsTableConfigResolver implements Resolve this.assetService.deleteAsset(id.id); } else if (assetScope === 'edge') { this.config.entitiesFetchFunction = pageLink => - this.assetService.getEdgeAssets(this.edgeId, pageLink, this.config.componentsData.assetType); + this.assetService.getEdgeAssets(this.config.componentsData.edgeId, pageLink, this.config.componentsData.assetType); } else { this.config.entitiesFetchFunction = pageLink => this.assetService.getCustomerAssetInfos(this.customerId, pageLink, this.config.componentsData.assetType); @@ -479,7 +479,7 @@ export class AssetsTableConfigResolver implements Resolve { if (res) { - this.assetService.unassignAssetFromEdge(this.edgeId, asset.id.id).subscribe( + this.assetService.unassignAssetFromEdge(this.config.componentsData.edgeId, asset.id.id).subscribe( () => { this.config.table.updateData(); } @@ -527,7 +527,7 @@ export class AssetsTableConfigResolver implements Resolve[] = []; assets.forEach( (asset) => { - tasks.push(this.assetService.unassignAssetFromEdge(this.edgeId, asset.id.id)); + tasks.push(this.assetService.unassignAssetFromEdge(this.config.componentsData.edgeId, asset.id.id)); } ); forkJoin(tasks).subscribe( diff --git a/ui-ngx/src/app/modules/home/pages/customer/customer-routing.module.ts b/ui-ngx/src/app/modules/home/pages/customer/customer-routing.module.ts index 732f14184c..27988c70c6 100644 --- a/ui-ngx/src/app/modules/home/pages/customer/customer-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/customer/customer-routing.module.ts @@ -27,7 +27,7 @@ import { DashboardsTableConfigResolver } from '@modules/home/pages/dashboard/das import { DashboardPageComponent } from '@home/pages/dashboard/dashboard-page.component'; import { BreadCrumbConfig } from '@shared/components/breadcrumb'; import { dashboardBreadcumbLabelFunction, DashboardResolver } from '@home/pages/dashboard/dashboard-routing.module'; -import {EdgesTableConfigResolver} from "@home/pages/edge/edges-table-config.resolver"; +import { EdgesTableConfigResolver } from "@home/pages/edge/edges-table-config.resolver"; const routes: Routes = [ { diff --git a/ui-ngx/src/app/modules/home/pages/dashboard/dashboard-form.component.ts b/ui-ngx/src/app/modules/home/pages/dashboard/dashboard-form.component.ts index ee72b33453..2f5f517d84 100644 --- a/ui-ngx/src/app/modules/home/pages/dashboard/dashboard-form.component.ts +++ b/ui-ngx/src/app/modules/home/pages/dashboard/dashboard-form.component.ts @@ -38,7 +38,7 @@ import { isEqual } from '@core/utils'; }) export class DashboardFormComponent extends EntityComponent { - dashboardScope: 'tenant' | 'customer' | 'customer_user'; + dashboardScope: 'tenant' | 'customer' | 'customer_user' | 'edge'; customerId: string; publicLink: string; diff --git a/ui-ngx/src/app/modules/home/pages/dashboard/dashboards-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/dashboard/dashboards-table-config.resolver.ts index 0c4d68d435..7ea931f3ab 100644 --- a/ui-ngx/src/app/modules/home/pages/dashboard/dashboards-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/dashboard/dashboards-table-config.resolver.ts @@ -132,8 +132,9 @@ export class DashboardsTableConfigResolver implements Resolve - this.config.tableTitle = edge.name + ': ' + this.translate.instant('dashboard.dashboards'))).subscribe(); + this.edgeService.getEdge(this.config.componentsData.edgeId).subscribe( + edge => this.config.tableTitle = edge.name + ': ' + this.translate.instant('dashboard.dashboards') + ); } else { this.config.tableTitle = this.translate.instant('dashboard.dashboards'); } diff --git a/ui-ngx/src/app/modules/home/pages/device/device.component.ts b/ui-ngx/src/app/modules/home/pages/device/device.component.ts index 833919eb78..adf2891a8c 100644 --- a/ui-ngx/src/app/modules/home/pages/device/device.component.ts +++ b/ui-ngx/src/app/modules/home/pages/device/device.component.ts @@ -46,7 +46,7 @@ export class DeviceComponent extends EntityComponent { entityType = EntityType; - deviceScope: 'tenant' | 'customer' | 'customer_user'; + deviceScope: 'tenant' | 'customer' | 'customer_user' | 'edge'; constructor(protected store: Store, protected translate: TranslateService, diff --git a/ui-ngx/src/app/modules/home/pages/device/devices-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/device/devices-table-config.resolver.ts index 8c6e237b43..21ef8c1a36 100644 --- a/ui-ngx/src/app/modules/home/pages/device/devices-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/device/devices-table-config.resolver.ts @@ -73,7 +73,6 @@ export class DevicesTableConfigResolver implements Resolve = new EntityTableConfig(); private customerId: string; - private edgeId: string; constructor(private store: Store, private broadcast: BroadcastService, @@ -120,10 +119,11 @@ export class DevicesTableConfigResolver implements Resolve { if (authUser.authority === Authority.CUSTOMER_USER) { @@ -142,8 +142,9 @@ export class DevicesTableConfigResolver implements Resolve - this.config.tableTitle = edge.name + ': ' + this.translate.instant('device.devices'))).subscribe(); + this.edgeService.getEdge(this.config.componentsData.edgeId).subscribe( + edge => this.config.tableTitle = edge.name + ': ' + this.translate.instant('device.devices') + ); } else { this.config.tableTitle = this.translate.instant('device.devices'); } @@ -194,7 +195,7 @@ export class DevicesTableConfigResolver implements Resolve this.deviceService.deleteDevice(id.id); } else if (deviceScope === 'edge') { this.config.entitiesFetchFunction = pageLink => - this.deviceService.getEdgeDevices(this.edgeId, pageLink, this.config.componentsData.edgeType); + this.deviceService.getEdgeDevices(this.config.componentsData.edgeId, pageLink, this.config.componentsData.edgeType); } else { this.config.entitiesFetchFunction = pageLink => this.deviceService.getCustomerDeviceInfosByDeviceProfileId(this.customerId, pageLink, @@ -534,7 +535,7 @@ export class DevicesTableConfigResolver implements Resolve { if (res) { - this.deviceService.unassignDeviceFromEdge(this.edgeId, device.id.id).subscribe( + this.deviceService.unassignDeviceFromEdge(this.config.componentsData.edgeId, device.id.id).subscribe( () => { this.config.table.updateData(); } @@ -582,7 +583,7 @@ export class DevicesTableConfigResolver implements Resolve[] = []; devices.forEach( (device) => { - tasks.push(this.deviceService.unassignDeviceFromEdge(this.edgeId, device.id.id)); + tasks.push(this.deviceService.unassignDeviceFromEdge(this.config.componentsData.edgeId, device.id.id)); } ); forkJoin(tasks).subscribe( diff --git a/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts b/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts index 4d101d81fe..4fcad45d19 100644 --- a/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts @@ -50,8 +50,8 @@ const routes: Routes = [ path: ':edgeId/ruleChains', component: EntitiesTableComponent, data: { - auth: [Authority.TENANT_ADMIN, Authority.CUSTOMER_USER], - ruleChainScope: 'edge', + auth: [Authority.TENANT_ADMIN], + ruleChainsType: 'edge', breadcrumb: { label: 'edge.rulechains', icon: 'settings_ethernet' diff --git a/ui-ngx/src/app/modules/home/pages/edge/edge-tabs.component.ts b/ui-ngx/src/app/modules/home/pages/edge/edge-tabs.component.ts index 860081e0a1..fb83ac5c34 100644 --- a/ui-ngx/src/app/modules/home/pages/edge/edge-tabs.component.ts +++ b/ui-ngx/src/app/modules/home/pages/edge/edge-tabs.component.ts @@ -14,11 +14,11 @@ /// limitations under the License. /// -import {Component} from '@angular/core'; -import {Store} from "@ngrx/store"; -import {AppState} from "@core/core.state"; -import {EdgeInfo} from "@shared/models/edge.models"; -import {EntityTabsComponent} from "@home/components/entity/entity-tabs.component"; +import { Component } from '@angular/core'; +import { Store } from "@ngrx/store"; +import { AppState } from "@core/core.state"; +import { EdgeInfo } from "@shared/models/edge.models"; +import { EntityTabsComponent } from "@home/components/entity/entity-tabs.component"; @Component({ selector: 'tb-edge-tabs', diff --git a/ui-ngx/src/app/modules/home/pages/edge/edge.component.html b/ui-ngx/src/app/modules/home/pages/edge/edge.component.html index 8d3f73797a..dca66eab64 100644 --- a/ui-ngx/src/app/modules/home/pages/edge/edge.component.html +++ b/ui-ngx/src/app/modules/home/pages/edge/edge.component.html @@ -79,6 +79,23 @@ edge.copy-id + + +
@@ -147,14 +164,6 @@ -
@@ -163,14 +172,6 @@
-
diff --git a/ui-ngx/src/app/modules/home/pages/edge/edges-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/edge/edges-table-config.resolver.ts index 05aeeda3c6..614c801653 100644 --- a/ui-ngx/src/app/modules/home/pages/edge/edges-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/edge/edges-table-config.resolver.ts @@ -51,7 +51,6 @@ import { AddEntitiesToCustomerDialogData } from '../../dialogs/add-entities-to-customer-dialog.component'; import { HomeDialogsService } from '@home/dialogs/home-dialogs.service'; - import { Edge, EdgeInfo } from "@shared/models/edge.models"; import { EdgeService } from "@core/http/edge.service"; import { EdgeComponent } from "@home/pages/edge/edge.component"; @@ -96,19 +95,15 @@ export class EdgesTableConfigResolver implements Resolve this.edgeService.getEdge(savedEdge.id.id) )); }; - this.config.onEntityAction = action => this.onEdgeAction(action); this.config.detailsReadonly = () => this.config.componentsData.edgeScope === 'customer_user'; - this.config.headerComponent = EdgeTableHeaderComponent; - } resolve(route: ActivatedRouteSnapshot): Observable> { const routeParams = route.params; this.config.componentsData = { - edgeScope: route.data.edgesType, - edgeType: '' + edgeScope: route.data.edgesType }; this.customerId = routeParams.customerId; return this.store.pipe(select(selectAuthUser), take(1)).pipe( @@ -166,12 +161,12 @@ export class EdgesTableConfigResolver implements Resolve - this.edgeService.getTenantEdgeInfos(pageLink, this.config.componentsData.edgeType); + this.edgeService.getTenantEdgeInfos(pageLink); this.config.deleteEntity = id => this.edgeService.deleteEdge(id.id); } if (edgeScope === 'customer') { this.config.entitiesFetchFunction = pageLink => - this.edgeService.getCustomerEdgeInfos(this.customerId, pageLink, this.config.componentsData.edgeType); + this.edgeService.getCustomerEdgeInfos(this.customerId, pageLink); this.config.deleteEntity = id => this.edgeService.unassignEdgeFromCustomer(id.id); } } diff --git a/ui-ngx/src/app/modules/home/pages/entity-view/entity-view.component.ts b/ui-ngx/src/app/modules/home/pages/entity-view/entity-view.component.ts index 1a1895dada..e464a6f87f 100644 --- a/ui-ngx/src/app/modules/home/pages/entity-view/entity-view.component.ts +++ b/ui-ngx/src/app/modules/home/pages/entity-view/entity-view.component.ts @@ -40,7 +40,7 @@ export class EntityViewComponent extends EntityComponent { dataKeyType = DataKeyType; - entityViewScope: 'tenant' | 'customer' | 'customer_user'; + entityViewScope: 'tenant' | 'customer' | 'customer_user' | 'edge'; allowedEntityTypes = [EntityType.DEVICE, EntityType.ASSET]; diff --git a/ui-ngx/src/app/modules/home/pages/entity-view/entity-views-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/entity-view/entity-views-table-config.resolver.ts index d0c6102288..cc2f5b3e60 100644 --- a/ui-ngx/src/app/modules/home/pages/entity-view/entity-views-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/entity-view/entity-views-table-config.resolver.ts @@ -68,7 +68,6 @@ export class EntityViewsTableConfigResolver implements Resolve = new EntityTableConfig(); private customerId: string; - private edgeId: string; constructor(private store: Store, private broadcast: BroadcastService, @@ -115,10 +114,10 @@ export class EntityViewsTableConfigResolver implements Resolve { if (authUser.authority === Authority.CUSTOMER_USER) { @@ -137,8 +136,9 @@ export class EntityViewsTableConfigResolver implements Resolve - this.config.tableTitle = edge.name + ': ' + this.translate.instant('entity-view.entity-views'))).subscribe(); + this.edgeService.getEdge(this.config.componentsData.edgeId).subscribe( + edge => this.config.tableTitle = edge.name + ': ' + this.translate.instant('entity-view.entity-views') + ); } else { this.config.tableTitle = this.translate.instant('entity-view.entity-views'); @@ -181,7 +181,7 @@ export class EntityViewsTableConfigResolver implements Resolve this.entityViewService.deleteEntityView(id.id); } else if (entityViewScope === 'edge') { this.config.entitiesFetchFunction = pageLink => - this.entityViewService.getEdgeEntityViews(this.edgeId, pageLink, this.config.componentsData.entityViewType); + this.entityViewService.getEdgeEntityViews(this.config.componentsData.edgeId, pageLink, this.config.componentsData.entityViewType); } else { this.config.entitiesFetchFunction = pageLink => this.entityViewService.getCustomerEntityViewInfos(this.customerId, pageLink, this.config.componentsData.entityViewType); @@ -454,7 +454,7 @@ export class EntityViewsTableConfigResolver implements Resolve { if (res) { - this.entityViewService.unassignEntityViewFromEdge(this.edgeId, entityView.id.id).subscribe( + this.entityViewService.unassignEntityViewFromEdge(this.config.componentsData.edgeId, entityView.id.id).subscribe( () => { this.config.table.updateData(); } @@ -502,7 +502,7 @@ export class EntityViewsTableConfigResolver implements Resolve[] = []; entityViews.forEach( (entityView) => { - tasks.push(this.entityViewService.unassignEntityViewFromEdge(this.edgeId, entityView.id.id)); + tasks.push(this.entityViewService.unassignEntityViewFromEdge(this.config.componentsData.edgeId, entityView.id.id)); } ); forkJoin(tasks).subscribe( diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.ts b/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.ts index 7096045aed..9c235cb8de 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.ts +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.ts @@ -1281,7 +1281,7 @@ export class RuleChainPageComponent extends PageComponent if (this.isImport) { this.isDirtyValue = false; this.isImport = false; - this.router.navigateByUrl(`ruleChains/${this.ruleChain.id.id}`); + this.router.navigateByUrl(`ruleChains/${this.route.snapshot.data.ruleChainType.toLowerCase()}/${this.ruleChain.id.id}`); } else { this.createRuleChainModel(); } diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts b/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts index 3be2010445..fd7b58f0f0 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts @@ -34,7 +34,6 @@ import { BreadCrumbConfig, BreadCrumbLabelFunction } from '@shared/components/br import { ResolvedRuleChainMetaData, RuleChain, - RuleChainType, ruleChainType, } from '@shared/models/rule-chain.models'; import { RuleChainService } from '@core/http/rule-chain.service'; @@ -76,8 +75,7 @@ export class RuleNodeComponentsResolver implements Resolve> { - const ruleChainType: RuleChainType = route.data.type; - return this.ruleChainService.getRuleNodeComponents(this.modulesMap, ruleChainType); + return this.ruleChainService.getRuleNodeComponents(this.modulesMap, route.data.ruleChainType); } } @@ -151,8 +149,7 @@ const routes: Routes = [ data: { auth: [Authority.TENANT_ADMIN], title: 'rulechain.rulechains', - ruleChainScope: 'tenant', - type: ruleChainType.core + ruleChainsType: 'tenant' }, resolve: { entitiesTableConfig: RuleChainsTableConfigResolver @@ -170,7 +167,7 @@ const routes: Routes = [ auth: [Authority.TENANT_ADMIN], title: 'rulechain.rulechain', import: false, - type: ruleChainType.core + ruleChainType: ruleChainType.core }, resolve: { ruleChain: RuleChainResolver, @@ -190,7 +187,8 @@ const routes: Routes = [ } as BreadCrumbConfig, auth: [Authority.TENANT_ADMIN], title: 'rulechain.rulechain', - import: true + import: true, + ruleChainType: ruleChainType.core }, resolve: { ruleNodeComponents: RuleNodeComponentsResolver @@ -204,8 +202,7 @@ const routes: Routes = [ breadcrumb: { label: 'rulechain.edge-rulechains', icon: 'settings_ethernet' - }, - type: 'edge' + } }, children: [ { @@ -214,48 +211,48 @@ const routes: Routes = [ data: { auth: [Authority.TENANT_ADMIN], title: 'edge.rulechains', - ruleChainScope: 'edges', - type: ruleChainType.edge + ruleChainsType: 'edges' }, resolve: { entitiesTableConfig: RuleChainsTableConfigResolver } }, { - path: 'ruleChain/import', + path: ':ruleChainId', component: RuleChainPageComponent, - canActivate: [RuleChainImportGuard], canDeactivate: [ConfirmOnExitGuard], data: { breadcrumb: { - labelFunction: importRuleChainBreadcumbLabelFunction, + labelFunction: ruleChainBreadcumbLabelFunction, icon: 'settings_ethernet' } as BreadCrumbConfig, auth: [Authority.TENANT_ADMIN], - title: 'rulechain.rulechain', - import: true + title: 'edge.rulechain', + import: false, + ruleChainType: ruleChainType.edge }, resolve: { + ruleChain: RuleChainResolver, + ruleChainMetaData: ResolvedRuleChainMetaDataResolver, ruleNodeComponents: RuleNodeComponentsResolver } }, { - path: ':ruleChainId', + path: 'ruleChain/import', component: RuleChainPageComponent, + canActivate: [RuleChainImportGuard], canDeactivate: [ConfirmOnExitGuard], data: { breadcrumb: { - labelFunction: ruleChainBreadcumbLabelFunction, + labelFunction: importRuleChainBreadcumbLabelFunction, icon: 'settings_ethernet' } as BreadCrumbConfig, auth: [Authority.TENANT_ADMIN], - title: 'rulechain.rulechain', - import: false, - type: ruleChainType.edge + title: 'edge.rulechain', + import: true, + ruleChainType: ruleChainType.edge }, resolve: { - ruleChain: RuleChainResolver, - ruleChainMetaData: ResolvedRuleChainMetaDataResolver, ruleNodeComponents: RuleNodeComponentsResolver } } diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts index bd8c9b8e1a..280e4082ba 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts @@ -52,7 +52,6 @@ import { Edge } from "@shared/models/edge.models"; export class RuleChainsTableConfigResolver implements Resolve> { private readonly config: EntityTableConfig = new EntityTableConfig(); - private edgeId: string; private edge: Edge; constructor(private ruleChainService: RuleChainService, @@ -75,11 +74,11 @@ export class RuleChainsTableConfigResolver implements Resolve('name', 'rulechain.name', '100%'), new EntityTableColumn('root', 'rulechain.root', '60px', entity => { - if (isDefined(this.edgeId) && this.edgeId != null) { - return checkBoxCell((this.edge.rootRuleChainId.id == entity.id.id)); - } else { - return checkBoxCell(entity.root); - } + if (isDefined(this.config.componentsData.edgeId)) { + return checkBoxCell((this.config.componentsData.edge.rootRuleChainId.id == entity.id.id)); + } else { + return checkBoxCell(entity.root); + } }) ); this.config.deleteEntityTitle = ruleChain => this.translate.instant('rulechain.delete-rulechain-title', @@ -91,23 +90,26 @@ export class RuleChainsTableConfigResolver implements Resolve this.saveRuleChain(ruleChain); this.config.deleteEntity = id => this.ruleChainService.deleteRuleChain(id.id); this.config.onEntityAction = action => this.onRuleChainAction(action); - this.config.deleteEnabled = (ruleChain) => ruleChain && !ruleChain.root && !this.edgeId; - this.config.entitySelectionEnabled = (ruleChain) => { - if (isDefined(this.edgeId) && this.edgeId != null) { - return this.edge.rootRuleChainId.id != ruleChain.id.id; - } else { - return ruleChain && !ruleChain.root; - } - } } resolve(route: ActivatedRouteSnapshot): EntityTableConfig { const routeParams = route.params; this.config.componentsData = { - ruleChainScope: route.data.ruleChainScope, - type: route.data.type + ruleChainScope: route.data.ruleChainsType, + edgeId: routeParams.edgeId }; - this.edgeId = routeParams.edgeId; + if (this.config.componentsData.edgeId) { + this.config.entitySelectionEnabled = ruleChain => this.config.componentsData.edge.rootRuleChainId.id != ruleChain.id.id; + this.config.deleteEnabled = () => false; + this.edgeService.getEdge(this.config.componentsData.edgeId).subscribe(edge => { + this.config.componentsData.edge = edge; + this.config.tableTitle = edge.name + ': ' + this.translate.instant('rulechain.edge-rulechains'); + }); + } + else { + this.config.entitySelectionEnabled = ruleChain => ruleChain && !ruleChain.root; + this.config.deleteEnabled = (ruleChain) => ruleChain && !ruleChain.root; + } this.configureEntityFunctions(this.config.componentsData.ruleChainScope); this.config.groupActionDescriptors = this.configureGroupActions(this.config.componentsData.ruleChainScope); this.config.addActionDescriptors = this.configureAddActions(this.config.componentsData.ruleChainScope); @@ -154,14 +156,7 @@ export class RuleChainsTableConfigResolver implements Resolve this.fetchEdgeRuleChains(pageLink); } else if (ruleChainScope === 'edge') { - if (isDefined(this.edgeId) && this.edgeId != null) { - this.edgeService.getEdge(this.edgeId) - .pipe(map(edge => { - this.edge = edge; - this.config.tableTitle = edge.name + ': ' + this.translate.instant('rulechain.edge-rulechains') - })).subscribe(); - } - this.config.entitiesFetchFunction = pageLink => this.ruleChainService.getEdgeRuleChains(this.edgeId, pageLink); + this.config.entitiesFetchFunction = pageLink => this.ruleChainService.getEdgeRuleChains(this.config.componentsData.edgeId, pageLink); } } @@ -241,7 +236,7 @@ export class RuleChainsTableConfigResolver implements Resolve entity.id.id != this.edge.rootRuleChainId.id, + isEnabled: (entity) => entity.id.id != this.config.componentsData.edge.rootRuleChainId.id, onAction: ($event, entity) => this.unassignFromEdge($event, entity) } ) @@ -298,10 +293,10 @@ export class RuleChainsTableConfigResolver implements Resolve { if (res) { - if (isDefined(this.edgeId) && this.edgeId != null) { - this.edgeService.setRootRuleChain(this.edgeId, ruleChain.id.id).subscribe( + if (this.config.componentsData.edgeId) { + this.edgeService.setRootRuleChain(this.config.componentsData.edgeId, ruleChain.id.id).subscribe( (edge) => { - this.edge = edge; + this.config.componentsData.edge = edge; this.config.table.updateData(); } ) @@ -363,7 +358,7 @@ export class RuleChainsTableConfigResolver implements Resolve { if (res) { - this.ruleChainService.unassignRuleChainFromEdge(this.edgeId, ruleChain.id.id).subscribe( + this.ruleChainService.unassignRuleChainFromEdge(this.config.componentsData.edgeId, ruleChain.id.id).subscribe( () => { this.config.table.updateData(); } @@ -470,8 +465,8 @@ export class RuleChainsTableConfigResolver implements Resolve = []; - this.ruleChainService.getDefaultEdgeRuleChains().pipe( - map(ruleChains => - ruleChains.map(ruleChain => - defaultEdgeRuleChainIds.push(ruleChain.id.id) - ) - ) - ).subscribe(); + this.ruleChainService.getDefaultEdgeRuleChains().subscribe(ruleChains => { + ruleChains.map(ruleChain => defaultEdgeRuleChainIds.push(ruleChain.id.id)) + }); return this.ruleChainService.getRuleChains(pageLink, ruleChainType.edge).pipe( - map((response) => { + map(response => { response.data.map(ruleChain => ruleChain.isDefault = defaultEdgeRuleChainIds.some(id => ruleChain.id.id.includes(id)) ); - return response; + return response; }) ); } - } diff --git a/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts b/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts index de5e1bc6f8..c70314c284 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts @@ -143,7 +143,7 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit, break; case EntityType.EDGE: this.placeholder = this.required ? this.translate.instant('edge.enter-edge-type') - : this.translate.instant('edge-any-edge'); + : this.translate.instant('edge.edge-any-edge'); this.secondaryPlaceholder = '+' + this.translate.instant('edge.edge-type'); this.noSubtypesMathingText = 'edge.no-edge-types-matching'; this.broadcastSubscription = this.broadcast.on('edgeSaved', () => { diff --git a/ui-ngx/src/app/shared/models/ace/service-completion.models.ts b/ui-ngx/src/app/shared/models/ace/service-completion.models.ts index f9b42f12f5..60c3be986d 100644 --- a/ui-ngx/src/app/shared/models/ace/service-completion.models.ts +++ b/ui-ngx/src/app/shared/models/ace/service-completion.models.ts @@ -18,13 +18,13 @@ import { FunctionArg, FunctionArgType, TbEditorCompletions } from '@shared/model export const entityIdHref = 'EntityId'; -export const baseDataHref = 'Base data'; +export const baseDataHref = 'Base data'; export const alarmDataHref = 'Alarm data'; -export const alarmDataQueryHref = 'Alarm data query'; +export const alarmDataQueryHref = 'Alarm data query'; -export const attributeScopeHref = 'Attribute scope'; +export const attributeScopeHref = 'Attribute scope'; export const entityTypeHref = 'EntityType'; @@ -32,15 +32,15 @@ export const pageDataHref = 'DeviceInfo'; -export const assetInfoHref = 'AssetInfo'; +export const assetInfoHref = 'AssetInfo'; export const entityViewInfoHref = 'EntityViewInfo'; export const entityRelationsQueryHref = 'EntityRelationsQuery'; -export const entityRelationInfoHref = 'EntityRelationInfo'; +export const entityRelationInfoHref = 'EntityRelationInfo'; -export const dashboardInfoHref = 'DashboardInfo'; +export const dashboardInfoHref = 'DashboardInfo'; export const deviceHref = 'Device'; @@ -50,13 +50,13 @@ export const entityViewHref = 'Entity relation'; -export const dashboardHref = 'Dashboard'; +export const dashboardHref = 'Dashboard'; export const customerHref = 'Customer'; export const attributeDataHref = 'Attribute Data'; -export const userHref = 'User'; +export const userHref = 'User'; export const entityDataHref = 'Entity data'; diff --git a/ui-ngx/src/app/shared/models/alias.models.ts b/ui-ngx/src/app/shared/models/alias.models.ts index b08dbb0894..54b67ccc0a 100644 --- a/ui-ngx/src/app/shared/models/alias.models.ts +++ b/ui-ngx/src/app/shared/models/alias.models.ts @@ -17,7 +17,6 @@ import { EntityType } from '@shared/models/entity-type.models'; import { EntityId } from '@shared/models/id/entity-id'; import { EntitySearchDirection, EntityTypeFilter } from '@shared/models/relation.models'; -import { EntityInfo } from './entity.models'; import { EntityFilter } from '@shared/models/query/query.models'; export enum AliasFilterType { diff --git a/ui-ngx/src/app/shared/models/asset.models.ts b/ui-ngx/src/app/shared/models/asset.models.ts index d1e64c06d7..ab952d26a5 100644 --- a/ui-ngx/src/app/shared/models/asset.models.ts +++ b/ui-ngx/src/app/shared/models/asset.models.ts @@ -19,7 +19,6 @@ import { AssetId } from './id/asset-id'; import { TenantId } from '@shared/models/id/tenant-id'; import { CustomerId } from '@shared/models/id/customer-id'; import { EntitySearchQuery } from '@shared/models/relation.models'; -import { EdgeId } from "@shared/models/id/edge-id"; export interface Asset extends BaseData { tenantId?: TenantId; diff --git a/ui-ngx/src/app/shared/models/event.models.ts b/ui-ngx/src/app/shared/models/event.models.ts index 3f101f4e24..3e37b4027f 100644 --- a/ui-ngx/src/app/shared/models/event.models.ts +++ b/ui-ngx/src/app/shared/models/event.models.ts @@ -31,7 +31,7 @@ export enum DebugEventType { DEBUG_RULE_NODE = 'DEBUG_RULE_NODE', DEBUG_RULE_CHAIN = 'DEBUG_RULE_CHAIN' } -//TODO deaflynx filter CE only event types + export enum EdgeEventType { DASHBOARD = "DASHBOARD", ASSET = "ASSET", @@ -44,25 +44,20 @@ export enum EdgeEventType { USER = "USER", CUSTOMER = "CUSTOMER", RELATION = "RELATION", - ENTITY_GROUP = "ENTITY_GROUP", - SCHEDULER_EVENT = "SCHEDULER_EVENT", - WHITE_LABELING = "WHITE_LABELING", - LOGIN_WHITE_LABELING = "LOGIN_WHITE_LABELING", - CUSTOM_TRANSLATION = "CUSTOM_TRANSLATION", WIDGETS_BUNDLE = "WIDGETS_BUNDLE", WIDGET_TYPE = "WIDGET_TYPE", ADMIN_SETTINGS = "ADMIN_SETTINGS" } -export enum EdgeEventStatusColor { +export enum EdgeEventStatus { DEPLOYED = "DEPLOYED", PENDING = "PENDING" } -export const edgeEventStatusColor = new Map ( +export const edgeEventStatusColor = new Map ( [ - [EdgeEventStatusColor.DEPLOYED, '#000000'], - [EdgeEventStatusColor.PENDING, '#9e9e9e'] + [EdgeEventStatus.DEPLOYED, '#000000'], + [EdgeEventStatus.PENDING, '#9e9e9e'] ] ); diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index a419648612..1fbfcfc2dc 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -983,10 +983,10 @@ "rulechains": "Edge Rule Chains", "rulechain": "Edge Rule Chain", "edge-key": "Edge key", - "copy-edge-key": "Copy edge key", + "copy-edge-key": "Copy Edge key", "edge-key-copied-message": "Edge key has been copied to clipboard", "edge-secret": "Edge secret", - "copy-edge-secret": "Copy edge secret", + "copy-edge-secret": "Copy Edge secret", "edge-secret-copied-message": "Edge secret has been copied to clipboard", "manage-edge-assets": "Manage edge assets", "manage-edge-devices": "Manage edge devices", @@ -1001,7 +1001,10 @@ "success": "Deployed", "failed": "Pending", "search": "Search edges", - "selected-edges": "{ count, plural, 1 {1 edge} other {# edges} } selected" + "selected-edges": "{ count, plural, 1 {1 edge} other {# edges} } selected", + "enter-edge-type": "Enter entity view type", + "any-edge": "Any edge", + "no-edge-types-matching": "No edge types matching '{{entitySubtype}}' were found." }, "error": { "unable-to-connect": "Unable to connect to the server! Please check your internet connection.",