43 changed files with 1641 additions and 436 deletions
@ -0,0 +1,140 @@ |
|||||
|
///
|
||||
|
/// Copyright © 2016-2023 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 { Injectable, NgModule } from '@angular/core'; |
||||
|
import { Resolve, RouterModule, Routes } from '@angular/router'; |
||||
|
import { ConfirmOnExitGuard } from '@core/guards/confirm-on-exit.guard'; |
||||
|
import { Authority } from '@shared/models/authority.enum'; |
||||
|
import { Observable } from 'rxjs'; |
||||
|
import { OAuth2Service } from '@core/http/oauth2.service'; |
||||
|
import { EntitiesTableComponent } from '@home/components/entity/entities-table.component'; |
||||
|
import { EntityDetailsPageComponent } from '@home/components/entity/entity-details-page.component'; |
||||
|
import { entityDetailsPageBreadcrumbLabelFunction } from '@home/pages/home-pages.models'; |
||||
|
import { BreadCrumbConfig } from '@shared/components/breadcrumb'; |
||||
|
import { RouterTabsComponent } from '@home/components/router-tabs.component'; |
||||
|
import { AlarmTableComponent } from '@home/components/alarm/alarm-table.component'; |
||||
|
import { AlarmRulesTableConfigResolver } from '@home/pages/alarm/alarm-rules-table-config.resolver'; |
||||
|
import { AlarmsMode } from '@shared/models/alarm.models'; |
||||
|
|
||||
|
@Injectable() |
||||
|
export class OAuth2LoginProcessingUrlResolver implements Resolve<string> { |
||||
|
|
||||
|
constructor(private oauth2Service: OAuth2Service) { |
||||
|
} |
||||
|
|
||||
|
resolve(): Observable<string> { |
||||
|
return this.oauth2Service.getLoginProcessingUrl(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
const routes: Routes = [ |
||||
|
{ |
||||
|
path: 'alarm', |
||||
|
component: RouterTabsComponent, |
||||
|
data: { |
||||
|
auth: [Authority.TENANT_ADMIN], |
||||
|
breadcrumb: { |
||||
|
label: 'alarm.alarms', |
||||
|
icon: 'notifications' |
||||
|
} |
||||
|
}, |
||||
|
children: [ |
||||
|
{ |
||||
|
path: '', |
||||
|
children: [], |
||||
|
data: { |
||||
|
auth: [Authority.TENANT_ADMIN], |
||||
|
redirectTo: '/alarm/alarms' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
path: 'alarms', |
||||
|
component: AlarmTableComponent, |
||||
|
data: { |
||||
|
auth: [Authority.TENANT_ADMIN], |
||||
|
title: 'alarm.all-alarms', |
||||
|
breadcrumb: { |
||||
|
label: 'alarm.all-alarms', |
||||
|
icon: 'notifications' |
||||
|
}, |
||||
|
isPage: true, |
||||
|
alarmsMode: AlarmsMode.ALL |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
path: 'rules', |
||||
|
data: { |
||||
|
breadcrumb: { |
||||
|
label: 'alarm-rule.rules', |
||||
|
icon: 'edit_notifications' |
||||
|
} |
||||
|
}, |
||||
|
children: [ |
||||
|
{ |
||||
|
path: '', |
||||
|
component: EntitiesTableComponent, |
||||
|
data: { |
||||
|
auth: [Authority.TENANT_ADMIN], |
||||
|
title: 'alarm-rule.alarm-rules' |
||||
|
}, |
||||
|
resolve: { |
||||
|
entitiesTableConfig: AlarmRulesTableConfigResolver |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
path: ':entityId', |
||||
|
component: EntityDetailsPageComponent, |
||||
|
canDeactivate: [ConfirmOnExitGuard], |
||||
|
data: { |
||||
|
breadcrumb: { |
||||
|
labelFunction: entityDetailsPageBreadcrumbLabelFunction, |
||||
|
icon: 'domain' |
||||
|
} as BreadCrumbConfig<EntityDetailsPageComponent>, |
||||
|
auth: [Authority.TENANT_ADMIN], |
||||
|
title: 'alarm-rule.alarm-rules' |
||||
|
}, |
||||
|
resolve: { |
||||
|
entitiesTableConfig: AlarmRulesTableConfigResolver |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
] |
||||
|
}, |
||||
|
{ |
||||
|
path: 'alarms', |
||||
|
component: AlarmTableComponent, |
||||
|
data: { |
||||
|
auth: [Authority.CUSTOMER_USER], |
||||
|
title: 'alarm.alarms', |
||||
|
breadcrumb: { |
||||
|
label: 'alarm.alarms', |
||||
|
icon: 'notifications' |
||||
|
}, |
||||
|
isPage: true, |
||||
|
alarmsMode: AlarmsMode.ALL |
||||
|
} |
||||
|
} |
||||
|
]; |
||||
|
|
||||
|
@NgModule({ |
||||
|
imports: [RouterModule.forChild(routes)], |
||||
|
exports: [RouterModule], |
||||
|
providers: [ |
||||
|
AlarmRulesTableConfigResolver |
||||
|
] |
||||
|
}) |
||||
|
export class AlarmRoutingModule { } |
||||
@ -0,0 +1,21 @@ |
|||||
|
<!-- |
||||
|
|
||||
|
Copyright © 2016-2023 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. |
||||
|
|
||||
|
--> |
||||
|
<mat-tab *ngIf="entity && !isEdit" #auditLogsTab="matTab" |
||||
|
label="{{ 'audit-log.audit-logs' | translate }}"> |
||||
|
<tb-audit-log-table detailsMode="true" [active]="auditLogsTab.isActive" [auditLogMode]="auditLogModes.ENTITY" [entityId]="entity.id"></tb-audit-log-table> |
||||
|
</mat-tab> |
||||
@ -0,0 +1,38 @@ |
|||||
|
///
|
||||
|
/// Copyright © 2016-2023 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 { EntityTabsComponent } from '../../components/entity/entity-tabs.component'; |
||||
|
import { AlarmRule } from '@shared/models/alarm-rule.models'; |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'tb-alarm-rule-tabs', |
||||
|
templateUrl: './alarm-rule-tabs.component.html', |
||||
|
styleUrls: [] |
||||
|
}) |
||||
|
export class AlarmRuleTabsComponent extends EntityTabsComponent<AlarmRule> { |
||||
|
|
||||
|
constructor(protected store: Store<AppState>) { |
||||
|
super(store); |
||||
|
} |
||||
|
|
||||
|
ngOnInit() { |
||||
|
super.ngOnInit(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,47 @@ |
|||||
|
<!-- |
||||
|
|
||||
|
Copyright © 2016-2023 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. |
||||
|
|
||||
|
--> |
||||
|
<div class="tb-details-buttons" fxLayout.xs="column"> |
||||
|
<button mat-raised-button color="primary" |
||||
|
[disabled]="(isLoading$ | async)" |
||||
|
(click)="onEntityAction($event, 'open')" |
||||
|
[fxShow]="!isEdit && !isDetailsPage"> |
||||
|
{{'common.open-details-page' | translate }} |
||||
|
</button> |
||||
|
<button mat-raised-button color="primary" |
||||
|
[disabled]="(isLoading$ | async)" |
||||
|
(click)="onEntityAction($event, 'delete')" |
||||
|
[fxShow]="!hideDelete() && !isEdit"> |
||||
|
{{'alarm-rule.delete' | translate }} |
||||
|
</button> |
||||
|
</div> |
||||
|
<div class="mat-padding" fxLayout="column"> |
||||
|
<form [formGroup]="entityForm"> |
||||
|
<fieldset [disabled]="(isLoading$ | async) || !isEdit" style="min-width: 0;"> |
||||
|
<mat-form-field class="mat-block"> |
||||
|
<mat-label translate>alarm-rule.name</mat-label> |
||||
|
<input matInput formControlName="name" required/> |
||||
|
<mat-error *ngIf="entityForm.get('name').hasError('required')"> |
||||
|
{{ 'alarm-rule.name-required' | translate }} |
||||
|
</mat-error> |
||||
|
<mat-error *ngIf="entityForm.get('name').hasError('maxlength')"> |
||||
|
{{ 'alarm-rule.name-max-length' | translate }} |
||||
|
</mat-error> |
||||
|
</mat-form-field> |
||||
|
</fieldset> |
||||
|
</form> |
||||
|
</div> |
||||
@ -0,0 +1,63 @@ |
|||||
|
///
|
||||
|
/// Copyright © 2016-2023 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 { ChangeDetectorRef, Component, Inject, Optional } from '@angular/core'; |
||||
|
import { Store } from '@ngrx/store'; |
||||
|
import { AppState } from '@core/core.state'; |
||||
|
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; |
||||
|
import { TranslateService } from '@ngx-translate/core'; |
||||
|
import { EntityTableConfig } from '@home/models/entity/entities-table-config.models'; |
||||
|
import { EntityComponent } from '@home/components/entity/entity.component'; |
||||
|
import { AlarmRule } from '@shared/models/alarm-rule.models'; |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'tb-alarm-rule', |
||||
|
templateUrl: './alarm-rule.component.html', |
||||
|
styleUrls: [] |
||||
|
}) |
||||
|
export class AlarmRuleComponent extends EntityComponent<AlarmRule> { |
||||
|
|
||||
|
constructor(protected store: Store<AppState>, |
||||
|
protected translate: TranslateService, |
||||
|
@Optional() @Inject('entity') protected entityValue: AlarmRule, |
||||
|
@Optional() @Inject('entitiesTableConfig') protected entitiesTableConfigValue: EntityTableConfig<AlarmRule>, |
||||
|
protected fb: UntypedFormBuilder, |
||||
|
protected cd: ChangeDetectorRef) { |
||||
|
super(store, fb, entityValue, entitiesTableConfigValue, cd); |
||||
|
} |
||||
|
|
||||
|
hideDelete() { |
||||
|
if (this.entitiesTableConfig) { |
||||
|
return !this.entitiesTableConfig.deleteEnabled(this.entity); |
||||
|
} else { |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
buildForm(entity: AlarmRule): UntypedFormGroup { |
||||
|
const form = this.fb.group( |
||||
|
{ |
||||
|
name: [entity ? entity.name : '', [Validators.required, Validators.maxLength(255)]] |
||||
|
} |
||||
|
); |
||||
|
return form; |
||||
|
} |
||||
|
|
||||
|
updateForm(entity: AlarmRule) { |
||||
|
this.entityForm.patchValue({name: entity.name}); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,100 @@ |
|||||
|
///
|
||||
|
/// Copyright © 2016-2023 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 { Injectable } from '@angular/core'; |
||||
|
import { Resolve, Router } from '@angular/router'; |
||||
|
import { |
||||
|
DateEntityTableColumn, |
||||
|
EntityTableColumn, |
||||
|
EntityTableConfig |
||||
|
} from '@home/models/entity/entities-table-config.models'; |
||||
|
import { TranslateService } from '@ngx-translate/core'; |
||||
|
import { DatePipe } from '@angular/common'; |
||||
|
import { EntityType, entityTypeResources, entityTypeTranslations } from '@shared/models/entity-type.models'; |
||||
|
import { EntityAction } from '@home/models/entity/entity-component.models'; |
||||
|
import { DialogService } from '@core/services/dialog.service'; |
||||
|
import { MatDialog } from '@angular/material/dialog'; |
||||
|
import { ImportExportService } from '@home/components/import-export/import-export.service'; |
||||
|
import { HomeDialogsService } from '@home/dialogs/home-dialogs.service'; |
||||
|
import { AlarmRuleComponent } from '@home/pages/alarm/alarm-rule.component'; |
||||
|
import { AlarmRuleTabsComponent } from '@home/pages/alarm/alarm-rule-tabs.component'; |
||||
|
import { AlarmRule } from '@shared/models/alarm-rule.models'; |
||||
|
import { emptyPageData } from '@shared/models/page/page-data'; |
||||
|
import { of } from 'rxjs'; |
||||
|
|
||||
|
@Injectable() |
||||
|
export class AlarmRulesTableConfigResolver implements Resolve<EntityTableConfig<AlarmRule>> { |
||||
|
|
||||
|
private readonly config: EntityTableConfig<AlarmRule> = new EntityTableConfig<AlarmRule>(); |
||||
|
|
||||
|
constructor(private importExport: ImportExportService, |
||||
|
private homeDialogs: HomeDialogsService, |
||||
|
private translate: TranslateService, |
||||
|
private datePipe: DatePipe, |
||||
|
private dialogService: DialogService, |
||||
|
private router: Router, |
||||
|
private dialog: MatDialog) { |
||||
|
|
||||
|
this.config.entityType = EntityType.ALARM_RULE; |
||||
|
this.config.entityComponent = AlarmRuleComponent; |
||||
|
this.config.entityTabsComponent = AlarmRuleTabsComponent; |
||||
|
this.config.entityTranslations = entityTypeTranslations.get(EntityType.ALARM_RULE); |
||||
|
this.config.entityResources = entityTypeResources.get(EntityType.ALARM_RULE); |
||||
|
|
||||
|
this.config.hideDetailsTabsOnEdit = false; |
||||
|
|
||||
|
this.config.columns.push( |
||||
|
new DateEntityTableColumn<AlarmRule>('createdTime', 'common.created-time', this.datePipe, '150px'), |
||||
|
new EntityTableColumn<AlarmRule>('name', 'alarm-rule.name', '50%') |
||||
|
); |
||||
|
|
||||
|
this.config.deleteEntityTitle = alarmRule => this.translate.instant('alarm-rule.delete-alarm-rule-title', |
||||
|
{ alarmRuleName: alarmRule.name }); |
||||
|
this.config.deleteEntityContent = () => this.translate.instant('alarm-rule.delete-alarm-rule-text'); |
||||
|
this.config.deleteEntitiesTitle = count => this.translate.instant('alarm-rule.delete-alarm-rules-title', {count}); |
||||
|
this.config.deleteEntitiesContent = () => this.translate.instant('alarm-rule.delete-alarm-rules-text'); |
||||
|
|
||||
|
this.config.entitiesFetchFunction = pageLink => of(emptyPageData<AlarmRule>()); // TODO
|
||||
|
this.config.loadEntity = id => of(null); // TODO
|
||||
|
this.config.saveEntity = alarmRule => of(alarmRule); // TODO
|
||||
|
this.config.deleteEntity = id => of(null); // TODO
|
||||
|
this.config.onEntityAction = action => this.onAlarmRuleAction(action); |
||||
|
} |
||||
|
|
||||
|
resolve(): EntityTableConfig<AlarmRule> { |
||||
|
this.config.tableTitle = this.translate.instant('alarm-rule.alarm-rules'); |
||||
|
|
||||
|
return this.config; |
||||
|
} |
||||
|
|
||||
|
private openAlarmRule($event: Event, alarmRule: AlarmRule) { |
||||
|
if ($event) { |
||||
|
$event.stopPropagation(); |
||||
|
} |
||||
|
const url = this.router.createUrlTree(['alarm', 'rules', alarmRule.id.id]); |
||||
|
this.router.navigateByUrl(url); |
||||
|
} |
||||
|
|
||||
|
onAlarmRuleAction(action: EntityAction<AlarmRule>): boolean { |
||||
|
switch (action.action) { |
||||
|
case 'open': |
||||
|
this.openAlarmRule(action.event, action.entity); |
||||
|
return true; |
||||
|
} |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
///
|
||||
|
/// Copyright © 2016-2023 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 { NgModule } from '@angular/core'; |
||||
|
import { CommonModule } from '@angular/common'; |
||||
|
import { SharedModule } from '@shared/shared.module'; |
||||
|
import { HomeDialogsModule } from '../../dialogs/home-dialogs.module'; |
||||
|
import { HomeComponentsModule } from '@modules/home/components/home-components.module'; |
||||
|
import { AlarmRoutingModule } from '@home/pages/alarm/alarm-routing.module'; |
||||
|
import { AlarmRuleComponent } from '@home/pages/alarm/alarm-rule.component'; |
||||
|
import { AlarmRuleTabsComponent } from '@home/pages/alarm/alarm-rule-tabs.component'; |
||||
|
|
||||
|
@NgModule({ |
||||
|
declarations: [ |
||||
|
AlarmRuleComponent, |
||||
|
AlarmRuleTabsComponent |
||||
|
], |
||||
|
imports: [ |
||||
|
CommonModule, |
||||
|
SharedModule, |
||||
|
HomeComponentsModule, |
||||
|
HomeDialogsModule, |
||||
|
AlarmRoutingModule |
||||
|
] |
||||
|
}) |
||||
|
export class AlarmModule { } |
||||
@ -0,0 +1,54 @@ |
|||||
|
///
|
||||
|
/// Copyright © 2016-2023 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 { RouterModule, Routes } from '@angular/router'; |
||||
|
import { Authority } from '@shared/models/authority.enum'; |
||||
|
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'; |
||||
|
|
||||
|
const routes: Routes = [ |
||||
|
{ |
||||
|
path: 'entities', |
||||
|
data: { |
||||
|
auth: [Authority.TENANT_ADMIN, Authority.CUSTOMER_USER], |
||||
|
breadcrumb: { |
||||
|
label: 'entity.entities', |
||||
|
icon: 'category' |
||||
|
} |
||||
|
}, |
||||
|
children: [ |
||||
|
{ |
||||
|
path: '', |
||||
|
children: [], |
||||
|
data: { |
||||
|
auth: [Authority.TENANT_ADMIN, Authority.CUSTOMER_USER], |
||||
|
redirectTo: '/entities/devices' |
||||
|
} |
||||
|
}, |
||||
|
...deviceRoutes, |
||||
|
...assetRoutes, |
||||
|
...entityViewRoutes |
||||
|
] |
||||
|
} |
||||
|
]; |
||||
|
|
||||
|
@NgModule({ |
||||
|
imports: [RouterModule.forChild(routes)], |
||||
|
exports: [RouterModule] |
||||
|
}) |
||||
|
export class EntitiesRoutingModule { } |
||||
@ -0,0 +1,30 @@ |
|||||
|
///
|
||||
|
/// Copyright © 2016-2023 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 { NgModule } from '@angular/core'; |
||||
|
import { CommonModule } from '@angular/common'; |
||||
|
import { SharedModule } from '@shared/shared.module'; |
||||
|
import { EntitiesRoutingModule } from '@home/pages/entities/entities-routing.module'; |
||||
|
|
||||
|
@NgModule({ |
||||
|
declarations: [], |
||||
|
imports: [ |
||||
|
CommonModule, |
||||
|
SharedModule, |
||||
|
EntitiesRoutingModule |
||||
|
] |
||||
|
}) |
||||
|
export class EntitiesModule { } |
||||
@ -0,0 +1,54 @@ |
|||||
|
///
|
||||
|
/// Copyright © 2016-2023 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 { RouterModule, Routes } from '@angular/router'; |
||||
|
import { Authority } from '@shared/models/authority.enum'; |
||||
|
import { NgModule } from '@angular/core'; |
||||
|
import { ruleChainsRoutes } from '@home/pages/rulechain/rulechain-routing.module'; |
||||
|
import { otaUpdatesRoutes } from '@home/pages/ota-update/ota-update-routing.module'; |
||||
|
import { vcRoutes } from '@home/pages/vc/vc-routing.module'; |
||||
|
|
||||
|
const routes: Routes = [ |
||||
|
{ |
||||
|
path: 'features', |
||||
|
data: { |
||||
|
auth: [Authority.TENANT_ADMIN], |
||||
|
breadcrumb: { |
||||
|
label: 'feature.advanced-features', |
||||
|
icon: 'construction' |
||||
|
} |
||||
|
}, |
||||
|
children: [ |
||||
|
{ |
||||
|
path: '', |
||||
|
children: [], |
||||
|
data: { |
||||
|
auth: [Authority.TENANT_ADMIN], |
||||
|
redirectTo: '/features/ruleChains' |
||||
|
} |
||||
|
}, |
||||
|
...ruleChainsRoutes, |
||||
|
...otaUpdatesRoutes, |
||||
|
...vcRoutes |
||||
|
] |
||||
|
} |
||||
|
]; |
||||
|
|
||||
|
@NgModule({ |
||||
|
imports: [RouterModule.forChild(routes)], |
||||
|
exports: [RouterModule] |
||||
|
}) |
||||
|
export class FeaturesRoutingModule { } |
||||
@ -0,0 +1,30 @@ |
|||||
|
///
|
||||
|
/// Copyright © 2016-2023 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 { NgModule } from '@angular/core'; |
||||
|
import { CommonModule } from '@angular/common'; |
||||
|
import { SharedModule } from '@shared/shared.module'; |
||||
|
import { FeaturesRoutingModule } from '@home/pages/features/features-routing.module'; |
||||
|
|
||||
|
@NgModule({ |
||||
|
declarations: [], |
||||
|
imports: [ |
||||
|
CommonModule, |
||||
|
SharedModule, |
||||
|
FeaturesRoutingModule |
||||
|
] |
||||
|
}) |
||||
|
export class FeaturesModule { } |
||||
@ -0,0 +1,135 @@ |
|||||
|
///
|
||||
|
/// Copyright © 2016-2023 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 { ActivatedRoute, RouterModule, Routes } from '@angular/router'; |
||||
|
import { Authority } from '@shared/models/authority.enum'; |
||||
|
import { Component, NgModule, OnInit } from '@angular/core'; |
||||
|
import { RouterTabsComponent } from '@home/components/router-tabs.component'; |
||||
|
import { isDefinedAndNotNull } from '@core/utils'; |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'tb-notification-temp-component', |
||||
|
template: '<div>{{text}}</div>', |
||||
|
styleUrls: [] |
||||
|
}) |
||||
|
class NotificationTempComponent implements OnInit { |
||||
|
|
||||
|
text: string; |
||||
|
|
||||
|
constructor(private route: ActivatedRoute) {} |
||||
|
|
||||
|
ngOnInit() { |
||||
|
if (isDefinedAndNotNull(this.route.snapshot.data.text)) { |
||||
|
this.text = this.route.snapshot.data.text; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
const routes: Routes = [ |
||||
|
{ |
||||
|
path: 'notification', |
||||
|
component: RouterTabsComponent, |
||||
|
data: { |
||||
|
auth: [Authority.TENANT_ADMIN, Authority.CUSTOMER_USER], |
||||
|
breadcrumb: { |
||||
|
label: 'notification.notification-center', |
||||
|
icon: 'mdi:message-badge' |
||||
|
} |
||||
|
}, |
||||
|
children: [ |
||||
|
{ |
||||
|
path: '', |
||||
|
children: [], |
||||
|
data: { |
||||
|
auth: [Authority.TENANT_ADMIN, Authority.CUSTOMER_USER], |
||||
|
redirectTo: '/notification/inbox' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
path: 'inbox', |
||||
|
component: NotificationTempComponent, |
||||
|
data: { |
||||
|
auth: [Authority.TENANT_ADMIN, Authority.CUSTOMER_USER], |
||||
|
title: 'notification.inbox', |
||||
|
breadcrumb: { |
||||
|
label: 'notification.inbox', |
||||
|
icon: 'inbox' |
||||
|
}, |
||||
|
text: 'TODO: Implement inbox' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
path: 'sent', |
||||
|
component: NotificationTempComponent, |
||||
|
data: { |
||||
|
auth: [Authority.TENANT_ADMIN], |
||||
|
title: 'notification.sent', |
||||
|
breadcrumb: { |
||||
|
label: 'notification.sent', |
||||
|
icon: 'outbox' |
||||
|
}, |
||||
|
text: 'TODO: Implement sent' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
path: 'templates', |
||||
|
component: NotificationTempComponent, |
||||
|
data: { |
||||
|
auth: [Authority.TENANT_ADMIN], |
||||
|
title: 'notification.templates', |
||||
|
breadcrumb: { |
||||
|
label: 'notification.templates', |
||||
|
icon: 'mdi:message-draw' |
||||
|
}, |
||||
|
text: 'TODO: Implement templates' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
path: 'recipients', |
||||
|
component: NotificationTempComponent, |
||||
|
data: { |
||||
|
auth: [Authority.TENANT_ADMIN], |
||||
|
title: 'notification.recipients', |
||||
|
breadcrumb: { |
||||
|
label: 'notification.recipients', |
||||
|
icon: 'contacts' |
||||
|
}, |
||||
|
text: 'TODO: Implement recipients' |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
path: 'rules', |
||||
|
component: NotificationTempComponent, |
||||
|
data: { |
||||
|
auth: [Authority.TENANT_ADMIN], |
||||
|
title: 'notification.rules', |
||||
|
breadcrumb: { |
||||
|
label: 'notification.rules', |
||||
|
icon: 'mdi:message-cog' |
||||
|
}, |
||||
|
text: 'TODO: Implement rules' |
||||
|
} |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
]; |
||||
|
|
||||
|
@NgModule({ |
||||
|
declarations: [NotificationTempComponent], |
||||
|
imports: [RouterModule.forChild(routes)], |
||||
|
exports: [RouterModule] |
||||
|
}) |
||||
|
export class NotificationRoutingModule { } |
||||
@ -0,0 +1,30 @@ |
|||||
|
///
|
||||
|
/// Copyright © 2016-2023 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 { NgModule } from '@angular/core'; |
||||
|
import { CommonModule } from '@angular/common'; |
||||
|
import { SharedModule } from '@shared/shared.module'; |
||||
|
import { NotificationRoutingModule } from '@home/pages/notification/notification-routing.module'; |
||||
|
|
||||
|
@NgModule({ |
||||
|
declarations: [], |
||||
|
imports: [ |
||||
|
CommonModule, |
||||
|
SharedModule, |
||||
|
NotificationRoutingModule |
||||
|
] |
||||
|
}) |
||||
|
export class NotificationModule { } |
||||
@ -0,0 +1,24 @@ |
|||||
|
///
|
||||
|
/// Copyright © 2016-2023 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 { BaseData } from '@shared/models/base-data'; |
||||
|
import { TenantId } from '@shared/models/id/tenant-id'; |
||||
|
import { AlarmRuleId } from '@shared/models/id/alarm-rule-id'; |
||||
|
|
||||
|
export interface AlarmRule extends BaseData<AlarmRuleId> { |
||||
|
tenantId: TenantId; |
||||
|
name: string; |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
///
|
||||
|
/// Copyright © 2016-2023 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 { EntityId } from './entity-id'; |
||||
|
import { EntityType } from '@shared/models/entity-type.models'; |
||||
|
|
||||
|
export class AlarmRuleId implements EntityId { |
||||
|
entityType = EntityType.ALARM_RULE; |
||||
|
id: string; |
||||
|
constructor(id: string) { |
||||
|
this.id = id; |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue