2018-03-05 11:11:07 +02:00
|
|
|
<template>
|
|
|
|
<div class="root">
|
|
|
|
<div class="signins" v-if="signins.length != 0">
|
|
|
|
<div v-for="signin in signins">
|
|
|
|
<header @click="signin._show = !signin._show">
|
2018-11-05 18:40:11 +02:00
|
|
|
<template v-if="signin.success"><fa icon="check"/></template>
|
|
|
|
<template v-else><fa icon="times"/></template>
|
2018-03-05 11:11:07 +02:00
|
|
|
<span class="ip">{{ signin.ip }}</span>
|
2018-03-29 08:48:47 +03:00
|
|
|
<mk-time :time="signin.createdAt"/>
|
2018-03-05 11:11:07 +02:00
|
|
|
</header>
|
|
|
|
<div class="headers" v-show="signin._show">
|
2018-11-05 18:40:11 +02:00
|
|
|
<!-- TODO -->
|
2018-03-05 11:11:07 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
|
|
|
export default Vue.extend({
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
fetching: true,
|
|
|
|
signins: [],
|
2018-10-07 05:06:17 +03:00
|
|
|
connection: null
|
2018-03-05 11:11:07 +02:00
|
|
|
};
|
|
|
|
},
|
2018-10-07 05:06:17 +03:00
|
|
|
|
2018-03-05 11:11:07 +02:00
|
|
|
mounted() {
|
|
|
|
(this as any).api('i/signin_history').then(signins => {
|
|
|
|
this.signins = signins;
|
|
|
|
this.fetching = false;
|
|
|
|
});
|
|
|
|
|
2018-10-07 05:06:17 +03:00
|
|
|
this.connection = (this as any).os.stream.useSharedConnection('main');
|
2018-03-05 11:11:07 +02:00
|
|
|
|
|
|
|
this.connection.on('signin', this.onSignin);
|
|
|
|
},
|
2018-10-07 05:06:17 +03:00
|
|
|
|
2018-03-05 11:11:07 +02:00
|
|
|
beforeDestroy() {
|
2018-10-07 05:06:17 +03:00
|
|
|
this.connection.dispose();
|
2018-03-05 11:11:07 +02:00
|
|
|
},
|
2018-10-07 05:06:17 +03:00
|
|
|
|
2018-03-05 11:11:07 +02:00
|
|
|
methods: {
|
|
|
|
onSignin(signin) {
|
|
|
|
this.signins.unshift(signin);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
.root
|
|
|
|
> .signins
|
|
|
|
> div
|
|
|
|
border-bottom solid 1px #eee
|
|
|
|
|
|
|
|
> header
|
|
|
|
display flex
|
|
|
|
padding 8px 0
|
|
|
|
line-height 32px
|
|
|
|
cursor pointer
|
|
|
|
|
2018-11-05 18:40:11 +02:00
|
|
|
> [data-icon]
|
2018-03-05 11:11:07 +02:00
|
|
|
margin-right 8px
|
|
|
|
text-align left
|
|
|
|
|
|
|
|
&.check
|
|
|
|
color #0fda82
|
|
|
|
|
|
|
|
&.times
|
|
|
|
color #ff3100
|
|
|
|
|
|
|
|
> .ip
|
|
|
|
display inline-block
|
|
|
|
text-align left
|
|
|
|
padding 8px
|
|
|
|
line-height 16px
|
|
|
|
font-family monospace
|
|
|
|
font-size 14px
|
|
|
|
color #444
|
|
|
|
background #f8f8f8
|
|
|
|
border-radius 4px
|
|
|
|
|
|
|
|
> .mk-time
|
|
|
|
margin-left auto
|
|
|
|
text-align right
|
|
|
|
color #777
|
|
|
|
|
|
|
|
> .headers
|
|
|
|
overflow auto
|
|
|
|
margin 0 0 16px 0
|
|
|
|
max-height 100px
|
|
|
|
white-space pre-wrap
|
|
|
|
word-break break-all
|
|
|
|
|
|
|
|
</style>
|