Browse Source

refactoring

pull/11872/head^2
mpetrov 2 years ago
parent
commit
0a8d724163
  1. 2
      ui-ngx/src/app/modules/home/components/dashboard-view/dashboard-view.component.html
  2. 0
      ui-ngx/src/app/modules/home/components/dashboard-view/dashboard-view.component.scss
  3. 10
      ui-ngx/src/app/modules/home/components/dashboard-view/dashboard-view.component.ts
  4. 7
      ui-ngx/src/app/modules/home/components/home-components.module.ts
  5. 6
      ui-ngx/src/app/modules/home/pages/api-usage/api-usage-routing.module.ts
  6. 37
      ui-ngx/src/app/modules/home/pages/api-usage/api-usage.component.ts
  7. 5
      ui-ngx/src/app/modules/home/pages/api-usage/api-usage.module.ts
  8. 2
      ui-ngx/src/app/modules/home/pages/device/device-routing.module.ts
  9. 4
      ui-ngx/src/app/modules/home/pages/entities/entities-routing.module.ts
  10. 8
      ui-ngx/src/app/modules/home/pages/gateways/gateways-routing.module.ts
  11. 18
      ui-ngx/src/app/modules/home/pages/gateways/gateways.component.html
  12. 19
      ui-ngx/src/app/modules/home/pages/gateways/gateways.component.scss
  13. 5
      ui-ngx/src/app/modules/home/pages/gateways/gateways.module.ts

2
ui-ngx/src/app/modules/home/pages/api-usage/api-usage.component.html → ui-ngx/src/app/modules/home/components/dashboard-view/dashboard-view.component.html

@ -15,4 +15,4 @@
limitations under the License.
-->
<tb-dashboard-page [embedded]="true" [dashboard]="apiUsageDashboard"></tb-dashboard-page>
<tb-dashboard-page [embedded]="true" [dashboard]="dashboard"></tb-dashboard-page>

0
ui-ngx/src/app/modules/home/pages/api-usage/api-usage.component.scss → ui-ngx/src/app/modules/home/components/dashboard-view/dashboard-view.component.scss

10
ui-ngx/src/app/modules/home/pages/gateways/gateways.component.ts → ui-ngx/src/app/modules/home/components/dashboard-view/dashboard-view.component.ts

@ -22,13 +22,13 @@ import { Dashboard } from '@shared/models/dashboard.models';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'tb-gateways',
templateUrl: './gateways.component.html',
styleUrls: ['./gateways.component.scss']
selector: 'tb-dashboard-view',
templateUrl: './dashboard-view.component.html',
styleUrls: ['./dashboard-view.component.scss']
})
export class GatewaysComponent extends PageComponent {
export class DashboardViewComponent extends PageComponent {
gatewaysDashboard: Dashboard = this.route.snapshot.data.gatewaysDashboard;
dashboard: Dashboard = this.route.snapshot.data.dashboard;
constructor(protected store: Store<AppState>,
private route: ActivatedRoute) {

7
ui-ngx/src/app/modules/home/components/home-components.module.ts

@ -182,6 +182,7 @@ import {
SelectDashboardBreakpointComponent
} from '@home/components/dashboard-page/layout/select-dashboard-breakpoint.component';
import { EntityChipsComponent } from '@home/components/entity/entity-chips.component';
import { DashboardViewComponent } from '@home/components/dashboard-view/dashboard-view.component';
@NgModule({
declarations:
@ -324,7 +325,8 @@ import { EntityChipsComponent } from '@home/components/entity/entity-chips.compo
RateLimitsTextComponent,
RateLimitsDetailsDialogComponent,
SendNotificationButtonComponent,
EntityChipsComponent
EntityChipsComponent,
DashboardViewComponent
],
imports: [
CommonModule,
@ -460,7 +462,8 @@ import { EntityChipsComponent } from '@home/components/entity/entity-chips.compo
RateLimitsTextComponent,
RateLimitsDetailsDialogComponent,
SendNotificationButtonComponent,
EntityChipsComponent
EntityChipsComponent,
DashboardViewComponent
],
providers: [
WidgetComponentService,

6
ui-ngx/src/app/modules/home/pages/api-usage/api-usage-routing.module.ts

@ -17,11 +17,11 @@
import { inject, NgModule } from '@angular/core';
import { ActivatedRouteSnapshot, ResolveFn, RouterModule, RouterStateSnapshot, Routes } from '@angular/router';
import { Authority } from '@shared/models/authority.enum';
import { ApiUsageComponent } from '@home/pages/api-usage/api-usage.component';
import { Dashboard } from '@shared/models/dashboard.models';
import { ResourcesService } from '@core/services/resources.service';
import { Observable } from 'rxjs';
import { MenuId } from '@core/services/menu.models';
import { DashboardViewComponent } from '@home/components/dashboard-view/dashboard-view.component';
const apiUsageDashboardJson = '/assets/dashboard/api_usage.json';
@ -34,7 +34,7 @@ export const apiUsageDashboardResolver: ResolveFn<Dashboard> = (
const routes: Routes = [
{
path: 'usage',
component: ApiUsageComponent,
component: DashboardViewComponent,
data: {
auth: [Authority.TENANT_ADMIN],
title: 'api-usage.api-usage',
@ -43,7 +43,7 @@ const routes: Routes = [
}
},
resolve: {
apiUsageDashboard: apiUsageDashboardResolver
dashboard: apiUsageDashboardResolver
}
}
];

37
ui-ngx/src/app/modules/home/pages/api-usage/api-usage.component.ts

@ -1,37 +0,0 @@
///
/// Copyright © 2016-2024 The Thingsboard Authors
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
import { Component } from '@angular/core';
import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state';
import { PageComponent } from '@shared/components/page.component';
import { Dashboard } from '@shared/models/dashboard.models';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'tb-api-usage',
templateUrl: './api-usage.component.html',
styleUrls: ['./api-usage.component.scss']
})
export class ApiUsageComponent extends PageComponent {
apiUsageDashboard: Dashboard = this.route.snapshot.data.apiUsageDashboard;
constructor(protected store: Store<AppState>,
private route: ActivatedRoute) {
super(store);
}
}

5
ui-ngx/src/app/modules/home/pages/api-usage/api-usage.module.ts

@ -18,14 +18,9 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SharedModule } from '@app/shared/shared.module';
import { HomeComponentsModule } from '@modules/home/components/home-components.module';
import { ApiUsageComponent } from '@home/pages/api-usage/api-usage.component';
import { ApiUsageRoutingModule } from '@home/pages/api-usage/api-usage-routing.module';
@NgModule({
declarations:
[
ApiUsageComponent
],
imports: [
CommonModule,
SharedModule,

2
ui-ngx/src/app/modules/home/pages/device/device-routing.module.ts

@ -24,8 +24,6 @@ import { EntityDetailsPageComponent } from '@home/components/entity/entity-detai
import { ConfirmOnExitGuard } from '@core/guards/confirm-on-exit.guard';
import { entityDetailsPageBreadcrumbLabelFunction } from '@home/pages/home-pages.models';
import { BreadCrumbConfig } from '@shared/components/breadcrumb';
import { assetRoutes } from '@home/pages/asset/asset-routing.module';
import { entityViewRoutes } from '@home/pages/entity-view/entity-view-routing.module';
import { MenuId } from '@core/services/menu.models';
export const deviceRoutes: Routes = [

4
ui-ngx/src/app/modules/home/pages/entities/entities-routing.module.ts

@ -20,6 +20,7 @@ import { NgModule } from '@angular/core';
import { deviceRoutes } from '@home/pages/device/device-routing.module';
import { assetRoutes } from '@home/pages/asset/asset-routing.module';
import { entityViewRoutes } from '@home/pages/entity-view/entity-view-routing.module';
import { gatewaysRoutes } from '@home/pages/gateways/gateways-routing.module';
const routes: Routes = [
{
@ -41,7 +42,8 @@ const routes: Routes = [
},
...deviceRoutes,
...assetRoutes,
...entityViewRoutes
...entityViewRoutes,
...gatewaysRoutes
]
}
];

8
ui-ngx/src/app/modules/home/pages/gateways/gateways-routing.module.ts

@ -21,7 +21,7 @@ import { Dashboard } from '@shared/models/dashboard.models';
import { ResourcesService } from '@core/services/resources.service';
import { Observable } from 'rxjs';
import { MenuId } from '@core/services/menu.models';
import { GatewaysComponent } from '@home/pages/gateways/gateways.component';
import { DashboardViewComponent } from '@home/components/dashboard-view/dashboard-view.component';
const gatewaysDashboardJson = '/api/resource/dashboard/system/gateways_dashboard.json';
@ -31,10 +31,10 @@ export const gatewaysDashboardResolver: ResolveFn<Dashboard> = (
resourcesService = inject(ResourcesService)
): Observable<Dashboard> => resourcesService.loadJsonResource(gatewaysDashboardJson);
const routes: Routes = [
export const gatewaysRoutes: Routes = [
{
path: 'entities/gateways',
component: GatewaysComponent,
component: DashboardViewComponent,
data: {
auth: [Authority.TENANT_ADMIN],
title: 'gateway.gateways',
@ -49,7 +49,7 @@ const routes: Routes = [
];
@NgModule({
imports: [RouterModule.forChild(routes)],
imports: [RouterModule.forChild(gatewaysRoutes)],
exports: [RouterModule]
})
export class GatewaysRoutingModule { }

18
ui-ngx/src/app/modules/home/pages/gateways/gateways.component.html

@ -1,18 +0,0 @@
<!--
Copyright © 2016-2024 The Thingsboard Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<tb-dashboard-page [embedded]="true" [dashboard]="gatewaysDashboard"></tb-dashboard-page>

19
ui-ngx/src/app/modules/home/pages/gateways/gateways.component.scss

@ -1,19 +0,0 @@
/**
* Copyright © 2016-2024 The Thingsboard Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
:host {
width: 100%;
height: 100%;
}

5
ui-ngx/src/app/modules/home/pages/gateways/gateways.module.ts

@ -18,14 +18,9 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { SharedModule } from '@app/shared/shared.module';
import { HomeComponentsModule } from '@modules/home/components/home-components.module';
import { GatewaysComponent } from '@home/pages/gateways/gateways.component';
import { GatewaysRoutingModule } from '@home/pages/gateways/gateways-routing.module';
@NgModule({
declarations:
[
GatewaysComponent
],
imports: [
CommonModule,
SharedModule,

Loading…
Cancel
Save