thingsboard/ui/src/app/edge/edge.routes.js

166 lines
5.7 KiB
JavaScript
Raw Normal View History

2019-09-17 13:05:27 +03:00
/*
* Copyright © 2016-2020 The Thingsboard Authors
2019-09-17 13:05:27 +03:00
*
* 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.
*/
/* eslint-disable import/no-unresolved, import/default */
import edgesTemplate from './edges.tpl.html';
import entityViewsTemplate from "../entity-view/entity-views.tpl.html";
import devicesTemplate from "../device/devices.tpl.html";
import assetsTemplate from "../asset/assets.tpl.html";
import dashboardsTemplate from "../dashboard/dashboards.tpl.html";
import dashboardTemplate from "../dashboard/dashboard.tpl.html";
2019-09-17 13:05:27 +03:00
/* eslint-enable import/no-unresolved, import/default */
/*@ngInject*/
export default function EdgeRoutes($stateProvider, types) {
2019-09-17 13:05:27 +03:00
$stateProvider
.state('home.edges', {
url: '/edges',
params: {'topIndex': 0},
module: 'private',
auth: ['TENANT_ADMIN', 'CUSTOMER_USER'],
views: {
"content@home": {
templateUrl: edgesTemplate,
controller: 'EdgeController',
controllerAs: 'vm'
}
},
data: {
edgesType: 'tenant',
searchEnabled: true,
searchByEntitySubtype: true,
searchEntityType: types.entityType.edge,
pageTitle: 'edge.edges'
},
ncyBreadcrumb: {
label: '{"icon": "transform", "label": "edge.edges"}'
}
})
.state('home.edges.entityViews', {
url: '/:edgeId/entityViews',
params: {'topIndex': 0},
module: 'private',
2019-09-17 13:05:27 +03:00
auth: ['TENANT_ADMIN'],
views: {
"content@home": {
templateUrl: entityViewsTemplate,
2019-09-17 13:05:27 +03:00
controllerAs: 'vm',
controller: 'EntityViewController'
2019-09-17 13:05:27 +03:00
}
},
data: {
entityViewsType: 'edge',
2019-09-17 13:05:27 +03:00
searchEnabled: true,
searchByEntitySubtype: true,
searchEntityType: types.entityType.entityView,
pageTitle: 'edge.entity-views'
},
ncyBreadcrumb: {
label: '{"icon": "view_quilt", "label": "edge.entity-views"}'
}
})
.state('home.edges.devices', {
url: '/:edgeId/devices',
params: {'topIndex': 0},
module: 'private',
auth: ['TENANT_ADMIN'],
views: {
"content@home": {
templateUrl: devicesTemplate,
controllerAs: 'vm',
controller: 'DeviceController'
}
},
data: {
devicesType: 'edge',
searchEnabled: true,
searchByEntitySubtype: true,
searchEntityType: types.entityType.device,
pageTitle: 'edge.devices'
},
ncyBreadcrumb: {
label: '{"icon": "devices_other", "label": "edge.devices"}'
}
})
.state('home.edges.assets', {
url: '/:edgeId/assets',
params: {'topIndex': 0},
module: 'private',
auth: ['TENANT_ADMIN'],
views: {
"content@home": {
templateUrl: assetsTemplate,
controllerAs: 'vm',
controller: 'AssetController'
}
},
data: {
assetsType: 'edge',
searchEnabled: true,
searchByEntitySubtype: true,
searchEntityType: types.entityType.asset,
pageTitle: 'edge.assets'
},
ncyBreadcrumb: {
label: '{"icon": "domain", "label": "edge.assets"}'
}
})
.state('home.edges.dashboards', {
url: '/:edgeId/dashboards',
params: {'topIndex': 0},
module: 'private',
auth: ['TENANT_ADMIN'],
views: {
"content@home": {
templateUrl: dashboardsTemplate,
controllerAs: 'vm',
controller: 'DashboardsController'
}
},
data: {
dashboardsType: 'edge',
searchEnabled: true,
pageTitle: 'edge.dashboards'
},
ncyBreadcrumb: {
label: '{"icon": "dashboard", "label": "edge.dashboards"}'
}
})
.state('home.edges.dashboards.dashboard', {
url: '/:dashboardId?state',
reloadOnSearch: false,
module: 'private',
auth: ['TENANT_ADMIN', 'CUSTOMER_USER'],
views: {
"content@home": {
templateUrl: dashboardTemplate,
controller: 'DashboardController',
controllerAs: 'vm'
}
},
data: {
widgetEditMode: false,
searchEnabled: false,
pageTitle: 'dashboard.dashboard',
dashboardsType: 'edge',
2019-09-17 13:05:27 +03:00
},
ncyBreadcrumb: {
label: '{"icon": "dashboard", "label": "{{ vm.dashboard.title }}", "translate": "false"}'
2019-09-17 13:05:27 +03:00
}
});
}