Browse Source

Edge menu hide

pull/3957/head
Artem Babak 6 years ago
parent
commit
479c318925
  1. 3
      ui/src/app/api/user.service.js
  2. 206
      ui/src/app/services/menu.service.js

3
ui/src/app/api/user.service.js

@ -67,8 +67,7 @@ function UserService($http, $q, $rootScope, adminService, dashboardService, time
isUserTokenAccessEnabled: isUserTokenAccessEnabled, isUserTokenAccessEnabled: isUserTokenAccessEnabled,
loginAsUser: loginAsUser, loginAsUser: loginAsUser,
setUserCredentialsEnabled: setUserCredentialsEnabled, setUserCredentialsEnabled: setUserCredentialsEnabled,
isEdgesSupportEnabled: isEdgesSupportEnabled, isEdgesSupportEnabled: isEdgesSupportEnabled
loadIsEdgesSupportEnabled: loadIsEdgesSupportEnabled
} }
reloadUser(); reloadUser();

206
ui/src/app/services/menu.service.js

@ -147,45 +147,6 @@ function Menu(userService, $state, $rootScope) {
] ]
}]; }];
} else if (authority === 'TENANT_ADMIN') { } else if (authority === 'TENANT_ADMIN') {
let edgeMenuSection = {
side: {
name: 'edge.management',
type: 'toggle',
state: 'home.edges',
height: '80px',
icon: 'router',
pages: [
{
name: 'edge.edges',
type: 'link',
state: 'home.edges',
icon: 'router'
},
{
name: 'rulechain.edge-rulechains',
type: 'link',
state: 'home.edges.edgeRuleChains',
icon: 'code'
}
]
},
home: {
name: 'edge.management',
places: [
{
name: 'edge.edges',
icon: 'router',
state: 'home.edges'
},
{
name: 'rulechain.edge-rulechains',
icon: 'code',
state: 'home.edges.edgeRuleChains'
}
]
}
}
sections = [ sections = [
{ {
name: 'home.home', name: 'home.home',
@ -222,7 +183,33 @@ function Menu(userService, $state, $rootScope) {
type: 'link', type: 'link',
state: 'home.entityViews', state: 'home.entityViews',
icon: 'view_quilt' icon: 'view_quilt'
}, }];
if (userService.isEdgesSupportEnabled()) {
sections.push(
{
name: 'edge.management',
type: 'toggle',
state: 'home.edges',
height: '80px',
icon: 'router',
pages: [
{
name: 'edge.edges',
type: 'link',
state: 'home.edges',
icon: 'router'
},
{
name: 'rulechain.edge-rulechains',
type: 'link',
state: 'home.edges.edgeRuleChains',
icon: 'code'
}
]
}
);
}
sections.push(
{ {
name: 'widget.widget-library', name: 'widget.widget-library',
type: 'link', type: 'link',
@ -230,17 +217,18 @@ function Menu(userService, $state, $rootScope) {
icon: 'now_widgets' icon: 'now_widgets'
}, },
{ {
name: 'dashboard.dashboards', name: 'dashboard.dashboards',
type: 'link', type: 'link',
state: 'home.dashboards', state: 'home.dashboards',
icon: 'dashboards' icon: 'dashboards'
}, },
{ {
name: 'audit-log.audit-logs', name: 'audit-log.audit-logs',
type: 'link', type: 'link',
state: 'home.auditLogs', state: 'home.auditLogs',
icon: 'track_changes' icon: 'track_changes'
}]; }
);
homeSections = homeSections =
[{ [{
@ -292,58 +280,52 @@ function Menu(userService, $state, $rootScope) {
state: 'home.entityViews' state: 'home.entityViews'
} }
] ]
},
{
name: 'dashboard.management',
places: [
{
name: 'widget.widget-library',
icon: 'now_widgets',
state: 'home.widgets-bundles'
},
{
name: 'dashboard.dashboards',
icon: 'dashboard',
state: 'home.dashboards'
}
]
},
{
name: 'audit-log.audit',
places: [
{
name: 'audit-log.audit-logs',
icon: 'track_changes',
state: 'home.auditLogs'
}
]
}]; }];
if (userService.isEdgesSupportEnabled()) { if (userService.isEdgesSupportEnabled()) {
sections.splice(6, 0, edgeMenuSection.side); homeSections.push({
homeSections.splice(5, 0, edgeMenuSection.home); name: 'edge.management',
}
} else if (authority === 'CUSTOMER_USER') {
let edgeMenuSection = {
side: {
name: 'edge.edges',
type: 'link',
state: 'home.edges',
icon: 'router'
},
home: {
name: 'edge.edges',
places: [ places: [
{ {
name: 'edge.edges', name: 'edge.edges',
icon: 'router', icon: 'router',
state: 'home.edges' state: 'home.edges'
},
{
name: 'rulechain.edge-rulechains',
icon: 'code',
state: 'home.edges.edgeRuleChains'
} }
] ]
} });
} }
homeSections.push(
{
name: 'dashboard.management',
places: [
{
name: 'widget.widget-library',
icon: 'now_widgets',
state: 'home.widgets-bundles'
},
{
name: 'dashboard.dashboards',
icon: 'dashboard',
state: 'home.dashboards'
}
]
},
{
name: 'audit-log.audit',
places: [
{
name: 'audit-log.audit-logs',
icon: 'track_changes',
state: 'home.auditLogs'
}
]
});
} else if (authority === 'CUSTOMER_USER') {
sections = [ sections = [
{ {
name: 'home.home', name: 'home.home',
@ -368,13 +350,25 @@ function Menu(userService, $state, $rootScope) {
type: 'link', type: 'link',
state: 'home.entityViews', state: 'home.entityViews',
icon: 'view_quilt' icon: 'view_quilt'
}, }];
if (userService.isEdgesSupportEnabled()) {
sections.push(
{
name: 'edge.edges',
type: 'link',
state: 'home.edges',
icon: 'router'
}
);
}
sections.push(
{ {
name: 'dashboard.dashboards', name: 'dashboard.dashboards',
type: 'link', type: 'link',
state: 'home.dashboards', state: 'home.dashboards',
icon: 'dashboard' icon: 'dashboard'
}]; }
);
homeSections = homeSections =
[{ [{
@ -406,7 +400,23 @@ function Menu(userService, $state, $rootScope) {
state: 'home.entityViews' state: 'home.entityViews'
} }
] ]
}, }];
if (userService.isEdgesSupportEnabled()) {
homeSections.push(
{
name: 'edge.edges',
places: [
{
name: 'edge.edges',
icon: 'router',
state: 'home.edges'
}
]
}
);
}
homeSections.push(
{ {
name: 'dashboard.view-dashboards', name: 'dashboard.view-dashboards',
places: [ places: [
@ -416,12 +426,8 @@ function Menu(userService, $state, $rootScope) {
state: 'home.dashboards' state: 'home.dashboards'
} }
] ]
}]; }
);
if (userService.isEdgesSupportEnabled()) {
sections.splice(4, 0, edgeMenuSection.side);
homeSections.splice(3, 0, edgeMenuSection.home);
}
} }
} }
} }

Loading…
Cancel
Save