-
Notifications
You must be signed in to change notification settings - Fork 1
/
strolch-wc-user-management.html
192 lines (170 loc) · 7.31 KB
/
strolch-wc-user-management.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<!-- Imports -->
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<link rel="import" href="../iron-pages/iron-pages.html">
<link rel="import" href="../strolch-wc-styles/strolch-wc-app-style.html">
<link rel="import" href="../strolch-wc-util-behavior/strolch-wc-component-behavior.html">
<link rel="import" href="./strolch-wc-users.html">
<link rel="import" href="./strolch-wc-groups.html">
<link rel="import" href="./strolch-wc-roles.html">
<link rel="import" href="./strolch-wc-sessions.html">
<dom-module id="strolch-wc-user-management">
<template>
<!-- Style -->
<style is="custom-style" include="strolch-wc-app-style">
:host {
display: block;
}
.content {
padding: var(--app-pages-content-padding);
padding-top: 0;
min-width: 1080px;
}
paper-tabs {
margin: 0;
padding: 0;
--paper-tabs-selection-bar-color: var(--app-regular-highlight-bg-color);
}
</style>
<!-- Content -->
<div class="content">
<paper-tabs id="paperTabs" selected="{{selectedTab}}" attr-for-selected="name" fit-container>
<template is="dom-if" if="[[hasPrivilege('PrivilegeGetUser')]]">
<paper-tab name="users">[[localize('users')]]</paper-tab>
</template>
<template is="dom-if" if="[[hasPrivilege('PrivilegeGetGroup')]]">
<paper-tab name="groups">[[localize('groups')]]</paper-tab>
</template>
<template is="dom-if" if="[[hasPrivilege('PrivilegeGetRole')]]">
<paper-tab name="roles">[[localize('roles')]]</paper-tab>
</template>
<template is="dom-if" if="[[hasPrivilege('GetSession')]]">
<paper-tab name="sessions">[[localize('sessions')]]</paper-tab>
</template>
</paper-tabs>
<iron-pages selected="[[selectedTab]]" attr-for-selected="id">
<template is="dom-if" if="[[equal(selectedTab, 'users')]]" restamp>
<template is="dom-if" if="[[hasPrivilege('PrivilegeGetUser')]]">
<strolch-wc-users id="users"
base-path="[[basePath]]"
search-term="{{searchTerm}}"
user-location="[[userLocation]]"
propagate-show-dialog></strolch-wc-users>
</template>
</template>
<template is="dom-if" if="[[equal(selectedTab, 'groups')]]" restamp>
<template is="dom-if" if="[[hasPrivilege('PrivilegeGetGroup')]]">
<strolch-wc-groups id="groups"
base-path="[[basePath]]"
search-term="{{searchTerm}}"
user-location="[[userLocation]]"
propagate-show-dialog></strolch-wc-groups>
</template>
</template>
<template is="dom-if" if="[[equal(selectedTab, 'roles')]]" restamp>
<template is="dom-if" if="[[hasPrivilege('PrivilegeGetRole')]]">
<strolch-wc-roles id="roles"
base-path="[[basePath]]"
search-term="{{searchTerm}}"
user-location="[[userLocation]]"
propagate-show-dialog></strolch-wc-roles>
</template>
</template>
<template is="dom-if" if="[[equal(selectedTab, 'sessions')]]" restamp>
<template is="dom-if" if="[[hasPrivilege('GetSession')]]">
<strolch-wc-sessions id="sessions"
base-path="[[basePath]]"
search-term="{{searchTerm}}"
user-location="[[userLocation]]"
propagate-show-dialog></strolch-wc-sessions>
</template>
</template>
</iron-pages>
</div>
</template>
<script>
Polymer({
/* Component */
is: "strolch-wc-user-management",
behaviors: [
StrolchComponentBehavior
],
/* Properties */
properties: {
basePath: {
type: String,
value: './'
},
baseRestPath: {
type: String,
value: './'
},
localesPath: {
type: String,
value: './locales.json'
},
toolbarConfig: {
type: Object,
value: {
pageTitle: "userManagement",
backButton: true,
hasSearchTerm: true,
searchInput: true
},
notify: true,
readOnly: true
},
userLocation: {
type: String
},
selectedTab: {
type: String,
observer: 'selectedTabChanged'
},
searchTerm: {
type: String,
notify: true,
}
},
/* Computations */
/* Observers */
observers: [
"observeRoutePath(route.path)"
],
observeRoutePath: function (routePath) {
console.log("New Route path: " + routePath);
var tab = this.getQueryParamValue("tab");
if (Strolch.isNotEmptyString(tab) && this.selectedTab !== tab)
this.selectedTab = tab;
},
selectedTabChanged: function (newValue, oldValue) {
if (newValue != null && oldValue != null) {
this.setQueryParamValue('tab', newValue);
this.fire("strolch-clear-search-term");
}
},
listeners: {},
/* Public */
/* Private */
refresh: function () {
if (this.selectedTab != null) {
this.debounce('refreshTab', function (e) {
var view = this.$$('#' + this.selectedTab);
if (view != null)
view.reload();
}, 0);
}
},
attached: function (e) {
var tab = this.getQueryParamValue("tab");
if (Strolch.isNotEmptyString(tab))
this.selectedTab = tab;
},
/* Lifecycle */
reload: function () {
this.refresh();
}
});
</script>
</dom-module>