thingsboard-aplcache
Changes
ui/src/app/api/dashboard.service.js 2(+1 -1)
ui/src/app/api/user.service.js 7(+4 -3)
ui/src/app/app.run.js 7(+5 -2)
ui/src/app/dashboard/dashboard.controller.js 11(+10 -1)
ui/src/app/dashboard/dashboard.routes.js 18(+18 -0)
Details
ui/src/app/api/dashboard.service.js 2(+1 -1)
diff --git a/ui/src/app/api/dashboard.service.js b/ui/src/app/api/dashboard.service.js
index 507fe97..adab48f 100644
--- a/ui/src/app/api/dashboard.service.js
+++ b/ui/src/app/api/dashboard.service.js
@@ -252,7 +252,7 @@ function DashboardService($rootScope, $http, $q, $location, $filter) {
if (port != 80 && port != 443) {
url += ":" + port;
}
- url += "/dashboards/" + dashboard.id.id + "?publicId=" + dashboard.publicCustomerId;
+ url += "/dashboard/" + dashboard.id.id + "?publicId=" + dashboard.publicCustomerId;
return url;
}
ui/src/app/api/user.service.js 7(+4 -3)
diff --git a/ui/src/app/api/user.service.js b/ui/src/app/api/user.service.js
index cb85709..48c811b 100644
--- a/ui/src/app/api/user.service.js
+++ b/ui/src/app/api/user.service.js
@@ -488,7 +488,8 @@ function UserService($http, $q, $rootScope, adminService, dashboardService, logi
} else {
return true;
}
- } else if (to.name === 'home.dashboards.dashboard' && allowedDashboardIds.indexOf(params.dashboardId) > -1) {
+ } else if ((to.name === 'home.dashboards.dashboard' || to.name === 'dashboard')
+ && allowedDashboardIds.indexOf(params.dashboardId) > -1) {
return false;
} else {
return true;
@@ -504,10 +505,10 @@ function UserService($http, $q, $rootScope, adminService, dashboardService, logi
var place = 'home.links';
if (currentUser.authority === 'TENANT_ADMIN' || currentUser.authority === 'CUSTOMER_USER') {
if (userHasDefaultDashboard()) {
- place = 'home.dashboards.dashboard';
+ place = $rootScope.forceFullscreen ? 'dashboard' : 'home.dashboards.dashboard';
params = {dashboardId: currentUserDetails.additionalInfo.defaultDashboardId};
} else if (isPublic()) {
- place = 'home.dashboards.dashboard';
+ place = 'dashboard';
params = {dashboardId: lastPublicDashboardId};
}
} else if (currentUser.authority === 'SYS_ADMIN') {
ui/src/app/app.run.js 7(+5 -2)
diff --git a/ui/src/app/app.run.js b/ui/src/app/app.run.js
index f3886b8..4667b09 100644
--- a/ui/src/app/app.run.js
+++ b/ui/src/app/app.run.js
@@ -113,7 +113,10 @@ export default function AppRun($rootScope, $window, $injector, $location, $log,
showForbiddenDialog();
} else if (to.redirectTo) {
evt.preventDefault();
- $state.go(to.redirectTo, params)
+ $state.go(to.redirectTo, params);
+ } else if (to.name === 'home.dashboards.dashboard' && $rootScope.forceFullscreen) {
+ evt.preventDefault();
+ $state.go('dashboard', params);
}
}
} else {
@@ -138,7 +141,7 @@ export default function AppRun($rootScope, $window, $injector, $location, $log,
$rootScope.pageTitle = 'ThingsBoard';
$rootScope.stateChangeSuccessHandle = $rootScope.$on('$stateChangeSuccess', function (evt, to, params) {
- if (userService.isPublic() && to.name === 'home.dashboards.dashboard') {
+ if (userService.isPublic() && to.name === 'dashboard') {
$location.search('publicId', userService.getPublicId());
userService.updateLastPublicDashboardId(params.dashboardId);
}
diff --git a/ui/src/app/components/widget/widget.controller.js b/ui/src/app/components/widget/widget.controller.js
index 9feb40d..36e5bee 100644
--- a/ui/src/app/components/widget/widget.controller.js
+++ b/ui/src/app/components/widget/widget.controller.js
@@ -479,7 +479,11 @@ export default function WidgetController($scope, $state, $timeout, $window, $ele
dashboardId: targetDashboardId,
state: utils.objToBase64([ stateObject ])
}
- $state.go('home.dashboards.dashboard', stateParams);
+ if ($state.current.name === 'dashboard') {
+ $state.go('dashboard', stateParams);
+ } else {
+ $state.go('home.dashboards.dashboard', stateParams);
+ }
break;
case types.widgetActionTypes.custom.value:
var customFunction = descriptor.customFunction;
ui/src/app/dashboard/dashboard.controller.js 11(+10 -1)
diff --git a/ui/src/app/dashboard/dashboard.controller.js b/ui/src/app/dashboard/dashboard.controller.js
index f672f3f..6df48df 100644
--- a/ui/src/app/dashboard/dashboard.controller.js
+++ b/ui/src/app/dashboard/dashboard.controller.js
@@ -196,6 +196,7 @@ export default function DashboardController(types, utils, dashboardUtils, widget
vm.displayDashboardTimewindow = displayDashboardTimewindow;
vm.displayDashboardsSelect = displayDashboardsSelect;
vm.displayEntitiesSelect = displayEntitiesSelect;
+ vm.hideFullscreenButton = hideFullscreenButton;
vm.widgetsBundle;
@@ -258,7 +259,11 @@ export default function DashboardController(types, utils, dashboardUtils, widget
dashboardId: vm.currentDashboardId
});
} else {
- $state.go('home.dashboards.dashboard', {dashboardId: vm.currentDashboardId});
+ if ($state.current.name === 'dashboard') {
+ $state.go('dashboard', {dashboardId: vm.currentDashboardId});
+ } else {
+ $state.go('home.dashboards.dashboard', {dashboardId: vm.currentDashboardId});
+ }
}
}
});
@@ -805,6 +810,10 @@ export default function DashboardController(types, utils, dashboardUtils, widget
}
}
+ function hideFullscreenButton() {
+ return vm.widgetEditMode || vm.iframeMode || $rootScope.forceFullscreen || $state.current.name === 'dashboard';
+ }
+
function onRevertWidgetEdit(widgetForm) {
if (widgetForm.$dirty) {
widgetForm.$setPristine();
ui/src/app/dashboard/dashboard.routes.js 18(+18 -0)
diff --git a/ui/src/app/dashboard/dashboard.routes.js b/ui/src/app/dashboard/dashboard.routes.js
index ccb43c7..4572ac3 100644
--- a/ui/src/app/dashboard/dashboard.routes.js
+++ b/ui/src/app/dashboard/dashboard.routes.js
@@ -86,6 +86,24 @@ export default function DashboardRoutes($stateProvider) {
label: '{"icon": "dashboard", "label": "{{ vm.dashboard.title }}", "translate": "false"}'
}
})
+ .state('dashboard', {
+ url: '/dashboard/:dashboardId?state',
+ reloadOnSearch: false,
+ module: 'private',
+ auth: ['TENANT_ADMIN', 'CUSTOMER_USER'],
+ views: {
+ "@": {
+ templateUrl: dashboardTemplate,
+ controller: 'DashboardController',
+ controllerAs: 'vm'
+ }
+ },
+ data: {
+ widgetEditMode: false,
+ searchEnabled: false,
+ pageTitle: 'dashboard.dashboard'
+ }
+ })
.state('home.customers.dashboards.dashboard', {
url: '/:dashboardId?state',
reloadOnSearch: false,
diff --git a/ui/src/app/dashboard/dashboard.tpl.html b/ui/src/app/dashboard/dashboard.tpl.html
index 9626509..829f174 100644
--- a/ui/src/app/dashboard/dashboard.tpl.html
+++ b/ui/src/app/dashboard/dashboard.tpl.html
@@ -16,7 +16,7 @@
-->
<md-content style="padding-top: 150px;" flex tb-expand-fullscreen="vm.widgetEditMode || vm.iframeMode || forceFullscreen" expand-button-id="dashboard-expand-button"
- hide-expand-button="vm.widgetEditMode || vm.iframeMode || forceFullscreen" expand-tooltip-direction="bottom" ng-if="vm.dashboard">
+ hide-expand-button="vm.hideFullscreenButton()" expand-tooltip-direction="bottom" ng-if="vm.dashboard">
<section class="tb-dashboard-toolbar" ng-show="vm.showDashboardToolbar()"
ng-class="{ 'tb-dashboard-toolbar-opened': vm.toolbarOpened, 'tb-dashboard-toolbar-closed': !vm.toolbarOpened }">
<tb-dashboard-toolbar ng-show="!vm.widgetEditMode" force-fullscreen="forceFullscreen"