Fixed and refactored customer edges
This commit is contained in:
parent
716ed83d8e
commit
f1b58a9df1
@ -27,6 +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";
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
@ -96,6 +97,22 @@ const routes: Routes = [
|
||||
entitiesTableConfig: AssetsTableConfigResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
path: ':customerId/edges',
|
||||
component: EntitiesTableComponent,
|
||||
data: {
|
||||
auth: [Authority.TENANT_ADMIN],
|
||||
title: 'customer.edges',
|
||||
edgesType: 'customer',
|
||||
breadcrumb: {
|
||||
label: 'customer.edges',
|
||||
icon: 'router'
|
||||
}
|
||||
},
|
||||
resolve: {
|
||||
entitiesTableConfig: EdgesTableConfigResolver
|
||||
}
|
||||
},
|
||||
{
|
||||
path: ':customerId/dashboards',
|
||||
data: {
|
||||
|
||||
@ -95,7 +95,18 @@ export class CustomersTableConfigResolver implements Resolve<EntityTableConfig<C
|
||||
icon: 'dashboard',
|
||||
isEnabled: (customer) => true,
|
||||
onAction: ($event, entity) => this.manageCustomerDashboards($event, entity)
|
||||
}
|
||||
},
|
||||
{
|
||||
name: this.translate.instant('customer.manage-customer-edges'),
|
||||
nameFunction: (customer) => {
|
||||
return customer.additionalInfo && customer.additionalInfo.isPublic
|
||||
? this.translate.instant('customer.manage-public-edges')
|
||||
: this.translate.instant('customer.manage-customer-edges');
|
||||
},
|
||||
icon: 'router',
|
||||
isEnabled: (customer) => true,
|
||||
onAction: ($event, entity) => this.manageCustomerEdges($event, entity)
|
||||
},
|
||||
);
|
||||
|
||||
this.config.deleteEntityTitle = customer => this.translate.instant('customer.delete-customer-title', { customerTitle: customer.title });
|
||||
@ -147,6 +158,13 @@ export class CustomersTableConfigResolver implements Resolve<EntityTableConfig<C
|
||||
this.router.navigateByUrl(`customers/${customer.id.id}/dashboards`);
|
||||
}
|
||||
|
||||
manageCustomerEdges($event: Event, customer: Customer) {
|
||||
if ($event) {
|
||||
$event.stopPropagation();
|
||||
}
|
||||
this.router.navigateByUrl(`customers/${customer.id.id}/edges`);
|
||||
}
|
||||
|
||||
onCustomerAction(action: EntityAction<Customer>): boolean {
|
||||
switch (action.action) {
|
||||
case 'manageUsers':
|
||||
|
||||
@ -40,7 +40,7 @@ const routes: Routes = [
|
||||
component: EntitiesTableComponent,
|
||||
data: {
|
||||
auth: [Authority.TENANT_ADMIN, Authority.CUSTOMER_USER],
|
||||
edgeScope: 'tenant'
|
||||
edgesType: 'tenant'
|
||||
},
|
||||
resolve: {
|
||||
entitiesTableConfig: EdgesTableConfigResolver
|
||||
|
||||
@ -107,7 +107,7 @@ export class EdgesTableConfigResolver implements Resolve<EntityTableConfig<EdgeI
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<EntityTableConfig<EdgeInfo>> {
|
||||
const routeParams = route.params;
|
||||
this.config.componentsData = {
|
||||
edgeScope: route.data.edgeScope,
|
||||
edgeScope: route.data.edgesType,
|
||||
edgeType: ''
|
||||
};
|
||||
this.customerId = routeParams.customerId;
|
||||
|
||||
@ -36,7 +36,6 @@ export interface Edge extends BaseData<EdgeId> {
|
||||
export interface EdgeInfo extends Edge {
|
||||
customerTitle: string;
|
||||
customerIsPublic: boolean;
|
||||
// assignedCustomers?: Array<ShortCustomerInfo> //TODO: deaflynx check usage
|
||||
}
|
||||
|
||||
export interface EdgeSearchQuery extends EntitySearchQuery {
|
||||
|
||||
@ -422,6 +422,7 @@
|
||||
"devices": "Customer Devices",
|
||||
"entity-views": "Customer Entity Views",
|
||||
"assets": "Customer Assets",
|
||||
"edges": "Customer Edges",
|
||||
"public-dashboards": "Public Dashboards",
|
||||
"public-devices": "Public Devices",
|
||||
"public-assets": "Public Assets",
|
||||
@ -436,6 +437,8 @@
|
||||
"manage-public-dashboards": "Manage public dashboards",
|
||||
"manage-customer-assets": "Manage customer assets",
|
||||
"manage-public-assets": "Manage public assets",
|
||||
"manage-customer-edges": "Manage customer edges",
|
||||
"manage-public-edges": "Manage customer edges",
|
||||
"add-customer-text": "Add new customer",
|
||||
"no-customers-text": "No customers found",
|
||||
"customer-details": "Customer details",
|
||||
@ -446,6 +449,7 @@
|
||||
"delete-customers-text": "Be careful, after the confirmation all selected customers will be removed and all related data will become unrecoverable.",
|
||||
"manage-users": "Manage users",
|
||||
"manage-assets": "Manage assets",
|
||||
"manage-edges": "Manage edges",
|
||||
"manage-devices": "Manage devices",
|
||||
"manage-dashboards": "Manage dashboards",
|
||||
"title": "Title",
|
||||
@ -980,7 +984,9 @@
|
||||
"set-root-rule-chain-to-edges-text": "Set root rule chain for { count, plural, 1 {1 edge} other {# edges} }",
|
||||
"status": "Received by edge",
|
||||
"success": "Deployed",
|
||||
"failed": "Pending"
|
||||
"failed": "Pending",
|
||||
"search": "Search edges",
|
||||
"selected-edges": "{ count, plural, 1 {1 edge} other {# edges} } selected"
|
||||
},
|
||||
"error": {
|
||||
"unable-to-connect": "Unable to connect to the server! Please check your internet connection.",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user