@afeefa/vue-app 0.0.198 → 0.0.200
Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.200
|
package/package.json
CHANGED
@@ -37,12 +37,19 @@
|
|
37
37
|
<flying-context-container />
|
38
38
|
|
39
39
|
<div id="popupContainer" />
|
40
|
+
|
41
|
+
<a-dialog
|
42
|
+
id="autologout"
|
43
|
+
ref="autologoutDialog"
|
44
|
+
>
|
45
|
+
{{ autoLogoutMessage }}
|
46
|
+
</a-dialog>
|
40
47
|
</div>
|
41
48
|
</template>
|
42
49
|
|
43
50
|
<script>
|
44
51
|
import { Component, Vue, Watch } from '@a-vue'
|
45
|
-
import { LoadingEvent } from '@a-vue/events'
|
52
|
+
import { LoadingEvent, DialogEvent } from '@a-vue/events'
|
46
53
|
import { adminConfig } from '@a-admin/config/AdminConfig'
|
47
54
|
import { sleep } from '@a-vue/utils/timeout'
|
48
55
|
import AppBarButtons from './app/AppBarButtons'
|
@@ -78,6 +85,12 @@ export default class App extends Vue {
|
|
78
85
|
sidebarsFloating = false
|
79
86
|
hasFloatingInformationBar = false
|
80
87
|
|
88
|
+
autoLogoutChannel = new BroadcastChannel('auth.autologout')
|
89
|
+
autoLogoutStartSeconds = 0
|
90
|
+
autoLogoutStartRemainingSeconds = 0
|
91
|
+
autoLogoutRemainingSeconds = 0
|
92
|
+
autoLogoutRemainingInterval = null
|
93
|
+
|
81
94
|
created () {
|
82
95
|
this.$events.on(LoadingEvent.START_LOADING, this.startLoading)
|
83
96
|
this.$events.on(LoadingEvent.STOP_LOADING, this.stopLoading)
|
@@ -87,12 +100,46 @@ export default class App extends Vue {
|
|
87
100
|
this.hasFloatingInformationBar = mobile && information
|
88
101
|
})
|
89
102
|
|
103
|
+
this.autoLogoutChannel.addEventListener('message', e => {
|
104
|
+
if (e.data.type === 'autoLogoutStart') {
|
105
|
+
this.autoLogoutStartSeconds = this.getCurrentSeconds()
|
106
|
+
this.autoLogoutStartRemainingSeconds = e.data.remainingSeconds
|
107
|
+
this.autoLogoutRemainingSeconds = e.data.remainingSeconds
|
108
|
+
|
109
|
+
this.autoLogoutRemainingInterval = setInterval(() => {
|
110
|
+
const secondsSinceStart = this.getCurrentSeconds() - this.autoLogoutStartSeconds
|
111
|
+
this.autoLogoutRemainingSeconds = this.autoLogoutStartRemainingSeconds - secondsSinceStart
|
112
|
+
}, 1000)
|
113
|
+
|
114
|
+
this.$events.dispatch(new DialogEvent(DialogEvent.SHOW, {
|
115
|
+
id: 'autologout',
|
116
|
+
title: 'Inaktivität',
|
117
|
+
yesButton: 'Bitte nicht'
|
118
|
+
}))
|
119
|
+
}
|
120
|
+
if (e.data.type === 'autoLogoutStop') {
|
121
|
+
clearInterval(this.autoLogoutRemainingInterval)
|
122
|
+
const dialog = this.$refs.autologoutDialog
|
123
|
+
if (dialog) {
|
124
|
+
dialog.cancel()
|
125
|
+
}
|
126
|
+
}
|
127
|
+
})
|
128
|
+
|
90
129
|
this.sidebarsFloating = sidebarService.hasFloatingOverlay
|
91
130
|
this.hasFloatingInformationBar = sidebarService.mobile && sidebarService.information
|
92
131
|
|
93
132
|
this.$emit('appLoaded')
|
94
133
|
}
|
95
134
|
|
135
|
+
get autoLogoutMessage () {
|
136
|
+
return `Sie werden in ${this.autoLogoutRemainingSeconds} Sekunden abgemeldet.`
|
137
|
+
}
|
138
|
+
|
139
|
+
getCurrentSeconds () {
|
140
|
+
return Math.round(new Date().getTime() / 1000)
|
141
|
+
}
|
142
|
+
|
96
143
|
closeFloatingSidebars () {
|
97
144
|
sidebarService.closeAllFloating()
|
98
145
|
}
|
@@ -81,10 +81,12 @@ export default class FlyingContext extends Mixins(CancelOnEscMixin) {
|
|
81
81
|
this.$events.dispatch(new FlyingContextEvent(FlyingContextEvent.START_HIDE_CONTEXT))
|
82
82
|
|
83
83
|
setTimeout(() => { // fade in then hide contents
|
84
|
-
this.$el
|
85
|
-
|
86
|
-
|
87
|
-
|
84
|
+
if (this.$el && this.getContent()) { // if left current route, this might not be existing any longer
|
85
|
+
this.$el.appendChild(this.getContent())
|
86
|
+
this.coe_unwatchCancel() // hide context -> do not watch esc any more
|
87
|
+
this.isVisible = false
|
88
|
+
this.$emit('hide')
|
89
|
+
}
|
88
90
|
}, 200)
|
89
91
|
}
|
90
92
|
}
|