-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from vidar-team/dev
v0.7.0
- Loading branch information
Showing
9 changed files
with
383 additions
and
162 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<template> | ||
<v-footer padless> | ||
<v-row justify="center" no-gutters> | ||
<v-col style="font-size: 14px;" class="py-4 text-center white--text" cols="12"> | ||
{{ new Date().getFullYear() }} — <strong>Powered by | ||
<a class="white--text" href="https://cardinal.ink/" target="_blank">Cardinal</a> | ||
</strong> | ||
</v-col> | ||
</v-row> | ||
</v-footer> | ||
|
||
</template> | ||
|
||
<script> | ||
export default { | ||
name: "Copyrights" | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<template> | ||
<div> | ||
<v-simple-table :height="200" v-if="logs.length !== 0"> | ||
<template v-slot:default> | ||
<tbody> | ||
<tr v-for="(item, index) in logs" v-bind:key="index"> | ||
<td>{{ item.message }}</td> | ||
<td width="220px" style="text-align: right;">{{ new Date(item.time * 1000).toLocaleString() }}</td> | ||
</tr> | ||
</tbody> | ||
</template> | ||
</v-simple-table> | ||
<div style="height: 200px;" v-else> | ||
{{$t('log.no_data')}} | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: "LiveLog", | ||
data: () => ({ | ||
logs: [], | ||
stream: null, | ||
}), | ||
mounted() { | ||
this.getStream() | ||
}, | ||
methods: { | ||
getStream() { | ||
this.stream = new EventSource(this.utils.baseURL + '/livelog') | ||
this.stream.onmessage = (event) => { | ||
let data = JSON.parse(event.data) | ||
switch (data['Type']) { | ||
case 'submit_flag': | ||
this.push({ | ||
time: data['Time'], | ||
message: this.$t('log.submit_flag', { | ||
'from': data['Message']['From'], | ||
'to': data['Message']['To'], | ||
'challenge': data['Message']['Challenge'], | ||
}) | ||
}) | ||
break; | ||
case 'check_down': | ||
this.push({ | ||
time: data['Time'], | ||
message: this.$t('log.check_down', { | ||
'team': data['Message']['Team'], | ||
'challenge': data['Message']['Challenge'], | ||
}) | ||
}) | ||
break; | ||
} | ||
}; | ||
this.stream.onerror = function (err) { | ||
console.log(err) | ||
}; | ||
}, | ||
push(data) { | ||
if (this.logs.length > 30) { | ||
this.logs = this.logs.slice(0, 30) | ||
} | ||
this.logs.unshift(data) | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.