@afeefa/vue-app 0.0.349 → 0.0.351

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- 0.0.349
1
+ 0.0.351
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@afeefa/vue-app",
3
- "version": "0.0.349",
3
+ "version": "0.0.351",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -1,5 +1,16 @@
1
1
  <template>
2
2
  <div class="admin">
3
+ <div
4
+ v-if="isImpersonating"
5
+ class="impersonationBanner"
6
+ >
7
+ Angemeldet als {{ impersonatedAccountTitle }}
8
+ <a
9
+ class="impersonationBanner-exit ml-2"
10
+ @click="$auth.logout()"
11
+ >abmelden</a>
12
+ </div>
13
+
3
14
  <v-overlay
4
15
  fixed
5
16
  :value="sidebarsFloating"
@@ -31,12 +42,12 @@
31
42
  >
32
43
  <navigation-bar
33
44
  :has="$has"
34
- :class="{showDevSkin}"
45
+ :class="{ showDevSkin }"
35
46
  />
36
47
 
37
48
  <div
38
49
  id="v-main"
39
- :class="{marginRight: hasFloatingInformationBar}"
50
+ :class="{ marginRight: hasFloatingInformationBar }"
40
51
  >
41
52
  <a-loading-indicator
42
53
  :isLoading="!!numLoadingRequests"
@@ -46,13 +57,13 @@
46
57
  <sticky-header />
47
58
 
48
59
  <div class="pa-8 pt-4">
49
- <router-view :class="{isLoading: !!numLoadingRequests}" />
60
+ <router-view :class="{ isLoading: !!numLoadingRequests }" />
50
61
  </div>
51
62
 
52
63
  <sticky-footer-container />
53
64
  </div>
54
65
 
55
- <information-bar :class="{showDevSkin}" />
66
+ <information-bar :class="{ showDevSkin }" />
56
67
  </div>
57
68
 
58
69
  <a-dialog id="app" />
@@ -123,7 +134,7 @@ export default class App extends Vue {
123
134
  this.$events.on(LoadingEvent.START_LOADING, this.startLoading)
124
135
  this.$events.on(LoadingEvent.STOP_LOADING, this.stopLoading)
125
136
 
126
- this.$events.on(SidebarEvent.STATUS, ({payload: {hasFloatingOverlay, mobile, information}}) => {
137
+ this.$events.on(SidebarEvent.STATUS, ({ payload: { hasFloatingOverlay, mobile, information } }) => {
127
138
  this.sidebarsFloating = hasFloatingOverlay
128
139
  this.hasFloatingInformationBar = mobile && information
129
140
  })
@@ -188,6 +199,16 @@ export default class App extends Vue {
188
199
  return adminConfig.app.show_dev_skin
189
200
  }
190
201
 
202
+ get isImpersonating () {
203
+ return this.$auth.isImpersonating
204
+ }
205
+
206
+ get impersonatedAccountTitle () {
207
+ const account = this.$auth.account
208
+ const name = [account.first_name, account.last_name].filter(Boolean).join(' ').trim()
209
+ return name || account.username || account.email
210
+ }
211
+
191
212
  startLoading () {
192
213
  this.numLoadingRequests++
193
214
  }
@@ -198,7 +219,6 @@ export default class App extends Vue {
198
219
  }
199
220
  </script>
200
221
 
201
-
202
222
  <style lang="scss" scoped>
203
223
  .isLoading {
204
224
  opacity: .6;
@@ -233,4 +253,28 @@ export default class App extends Vue {
233
253
  }
234
254
  }
235
255
 
256
+ .impersonationBanner {
257
+ // absolute, not sticky: the layout (sidebar) is 100vh — a banner in the flow
258
+ // would push it down and the sidebar avatar would overflow the viewport.
259
+ // centered pill at the top, only as wide as its text.
260
+ position: absolute;
261
+ top: 0;
262
+ left: 50%;
263
+ transform: translateX(-50%);
264
+ z-index: 500;
265
+ padding: .375rem 1.25rem;
266
+ border-radius: 0 0 6px 6px;
267
+ background: #C62828;
268
+ color: white;
269
+ font-weight: 600;
270
+ white-space: nowrap;
271
+ }
272
+
273
+ .impersonationBanner-exit {
274
+ color: white;
275
+ font-weight: normal;
276
+ text-decoration: underline;
277
+ cursor: pointer;
278
+ }
279
+
236
280
  </style>
@@ -14,6 +14,17 @@ class AuthPlugin {
14
14
  return authService.getCurrentAccountRoles()
15
15
  },
16
16
 
17
+ // login-as: is the current tab acting as another account, and as whom
18
+ get isImpersonating () {
19
+ return !!authService.isImpersonating
20
+ },
21
+
22
+ get impersonatedBy () {
23
+ return authService.impersonatedBy
24
+ },
25
+
26
+ impersonate: accountId => authService.forwardToImpersonateEndpoint(accountId),
27
+
17
28
  logout: () => authService.forwardToLogoutEndpoint()
18
29
  }
19
30