Notifications
This commit is contained in:
22
src/App.vue
22
src/App.vue
@ -4,10 +4,10 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<main role="main" class="col-md-12 ml-sm-auto col-lg-12 pt-3 px-4">
|
||||
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-2 mb-3 border-bottom">
|
||||
<h1 class="h2">Jobs</h1>
|
||||
</div>
|
||||
<job v-for="(job, id) in jobs" :job="job" :key="job.id"></job>
|
||||
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-2 mb-3 border-bottom">
|
||||
<h1 class="h2">Jobs</h1>
|
||||
</div>
|
||||
<job v-for="(job, id) in jobs" :job="job" :key="job.id"></job>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
@ -19,6 +19,12 @@ import Vue from 'vue'
|
||||
import job from './components/Job';
|
||||
import navbar from './components/Nav';
|
||||
import EventWebSocket from './websocket';
|
||||
import Noty from 'noty';
|
||||
|
||||
Noty.overrideDefaults({
|
||||
theme: 'bootstrap-v4',
|
||||
timeout: 5000
|
||||
});
|
||||
|
||||
let d = {
|
||||
jobs: {},
|
||||
@ -27,6 +33,14 @@ let d = {
|
||||
|
||||
let ws = new EventWebSocket(window.arm_config.url);
|
||||
|
||||
ws.on('notification', function(data) {
|
||||
console.log(data);
|
||||
new Noty({
|
||||
type: data.type || 'alert',
|
||||
text: data.message
|
||||
}).show();
|
||||
});
|
||||
|
||||
ws.on('jobs', function(data) {
|
||||
// Create jobs components
|
||||
d.jobs = data;
|
||||
|
Reference in New Issue
Block a user