@afeefa/vue-app 0.0.349 → 0.0.350

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.350
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.350",
4
4
  "description": "",
5
5
  "author": "Afeefa Kollektiv <kollektiv@afeefa.de>",
6
6
  "license": "MIT",
@@ -1,5 +1,12 @@
1
1
  <template>
2
2
  <div class="admin">
3
+ <div
4
+ v-if="isImpersonating"
5
+ class="impersonationBanner"
6
+ >
7
+ Angemeldet als {{ impersonatedAccountTitle }}
8
+ </div>
9
+
3
10
  <v-overlay
4
11
  fixed
5
12
  :value="sidebarsFloating"
@@ -31,12 +38,12 @@
31
38
  >
32
39
  <navigation-bar
33
40
  :has="$has"
34
- :class="{showDevSkin}"
41
+ :class="{ showDevSkin }"
35
42
  />
36
43
 
37
44
  <div
38
45
  id="v-main"
39
- :class="{marginRight: hasFloatingInformationBar}"
46
+ :class="{ marginRight: hasFloatingInformationBar }"
40
47
  >
41
48
  <a-loading-indicator
42
49
  :isLoading="!!numLoadingRequests"
@@ -46,13 +53,13 @@
46
53
  <sticky-header />
47
54
 
48
55
  <div class="pa-8 pt-4">
49
- <router-view :class="{isLoading: !!numLoadingRequests}" />
56
+ <router-view :class="{ isLoading: !!numLoadingRequests }" />
50
57
  </div>
51
58
 
52
59
  <sticky-footer-container />
53
60
  </div>
54
61
 
55
- <information-bar :class="{showDevSkin}" />
62
+ <information-bar :class="{ showDevSkin }" />
56
63
  </div>
57
64
 
58
65
  <a-dialog id="app" />
@@ -123,7 +130,7 @@ export default class App extends Vue {
123
130
  this.$events.on(LoadingEvent.START_LOADING, this.startLoading)
124
131
  this.$events.on(LoadingEvent.STOP_LOADING, this.stopLoading)
125
132
 
126
- this.$events.on(SidebarEvent.STATUS, ({payload: {hasFloatingOverlay, mobile, information}}) => {
133
+ this.$events.on(SidebarEvent.STATUS, ({ payload: { hasFloatingOverlay, mobile, information } }) => {
127
134
  this.sidebarsFloating = hasFloatingOverlay
128
135
  this.hasFloatingInformationBar = mobile && information
129
136
  })
@@ -188,6 +195,16 @@ export default class App extends Vue {
188
195
  return adminConfig.app.show_dev_skin
189
196
  }
190
197
 
198
+ get isImpersonating () {
199
+ return this.$auth.isImpersonating
200
+ }
201
+
202
+ get impersonatedAccountTitle () {
203
+ const account = this.$auth.account
204
+ const name = [account.first_name, account.last_name].filter(Boolean).join(' ').trim()
205
+ return name || account.username || account.email
206
+ }
207
+
191
208
  startLoading () {
192
209
  this.numLoadingRequests++
193
210
  }
@@ -198,7 +215,6 @@ export default class App extends Vue {
198
215
  }
199
216
  </script>
200
217
 
201
-
202
218
  <style lang="scss" scoped>
203
219
  .isLoading {
204
220
  opacity: .6;
@@ -233,4 +249,21 @@ export default class App extends Vue {
233
249
  }
234
250
  }
235
251
 
252
+ .impersonationBanner {
253
+ // absolute, not sticky: the layout (sidebar) is 100vh — a banner in the flow
254
+ // would push it down and the sidebar avatar would overflow the viewport.
255
+ // centered pill at the top, only as wide as its text.
256
+ position: absolute;
257
+ top: 0;
258
+ left: 50%;
259
+ transform: translateX(-50%);
260
+ z-index: 500;
261
+ padding: .375rem 1.25rem;
262
+ border-radius: 0 0 6px 6px;
263
+ background: #C62828;
264
+ color: white;
265
+ font-weight: 600;
266
+ white-space: nowrap;
267
+ }
268
+
236
269
  </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