Add ability to hide saltutil.find_jobs
jobs
This commit is contained in:
parent
3b3603cd6f
commit
c87322a36f
12
src/App.vue
12
src/App.vue
@ -1,11 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
<label>
|
||||||
|
Show Raw Events JSON <input type="checkbox" v-model="showRawEvents"
|
||||||
|
/></label>
|
||||||
|
<label>
|
||||||
|
Hide
|
||||||
|
<code>saltutil.find_job</code>
|
||||||
|
jobs <input type="checkbox" v-model="hideFindJob"
|
||||||
|
/></label>
|
||||||
<Job
|
<Job
|
||||||
v-for="(jobEvents, jid) in jobs"
|
v-for="(jobEvents, jid) in jobs"
|
||||||
:key="jid"
|
:key="jid"
|
||||||
:jid="jid"
|
:jid="jid"
|
||||||
:showRawEvents="showRawEvents"
|
|
||||||
:events="jobEvents"
|
:events="jobEvents"
|
||||||
|
:showRawEvents="showRawEvents"
|
||||||
|
:hideFindJob="hideFindJob"
|
||||||
></Job>
|
></Job>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -26,6 +35,7 @@ export default class App extends Vue {
|
|||||||
events: salt.SaltEvent[] = [];
|
events: salt.SaltEvent[] = [];
|
||||||
jobs: { [key: string]: salt.JobEvent[] } = {};
|
jobs: { [key: string]: salt.JobEvent[] } = {};
|
||||||
showRawEvents: boolean = false;
|
showRawEvents: boolean = false;
|
||||||
|
hideFindJob: boolean = true;
|
||||||
|
|
||||||
mounted(): void {
|
mounted(): void {
|
||||||
fetch(BASE_URL + 'login', {
|
fetch(BASE_URL + 'login', {
|
||||||
|
16
src/Job.vue
16
src/Job.vue
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="job">
|
<div class="job" v-show="!hidden">
|
||||||
<h3>
|
<h3>
|
||||||
<span v-if="startEvent">
|
<span v-if="startEvent">
|
||||||
{{ startEvent.data.fun }}
|
{{ startEvent.data.fun }}
|
||||||
@ -48,6 +48,7 @@ export default class Job extends Vue {
|
|||||||
@Prop(Number) readonly jid: salt.JobID;
|
@Prop(Number) readonly jid: salt.JobID;
|
||||||
@Prop(Boolean) readonly showRawEvents: boolean;
|
@Prop(Boolean) readonly showRawEvents: boolean;
|
||||||
@Prop() readonly events: salt.JobEvent[];
|
@Prop() readonly events: salt.JobEvent[];
|
||||||
|
@Prop(String) readonly hideFindJob: string;
|
||||||
|
|
||||||
isJobEventType<T extends salt.JobEvent['splitTag'][3]>(
|
isJobEventType<T extends salt.JobEvent['splitTag'][3]>(
|
||||||
event: salt.JobEvent,
|
event: salt.JobEvent,
|
||||||
@ -59,7 +60,7 @@ export default class Job extends Vue {
|
|||||||
return event.splitTag[3] === type;
|
return event.splitTag[3] === type;
|
||||||
}
|
}
|
||||||
|
|
||||||
get startEvent(): salt.JobNewEvent {
|
get startEvent(): salt.JobNewEvent | undefined {
|
||||||
return this.events.find((event): event is salt.JobNewEvent =>
|
return this.events.find((event): event is salt.JobNewEvent =>
|
||||||
this.isJobEventType(event, 'new')
|
this.isJobEventType(event, 'new')
|
||||||
);
|
);
|
||||||
@ -79,6 +80,17 @@ export default class Job extends Vue {
|
|||||||
}, {});
|
}, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get hidden(): boolean {
|
||||||
|
return (
|
||||||
|
this.hideFindJob &&
|
||||||
|
this.events.find(
|
||||||
|
event =>
|
||||||
|
!this.isJobEventType(event, 'prog') &&
|
||||||
|
event.data.fun === 'saltutil.find_job'
|
||||||
|
) !== undefined
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
event_name(event: salt.JobEvent) {
|
event_name(event: salt.JobEvent) {
|
||||||
if (this.isJobEventType(event, 'prog')) {
|
if (this.isJobEventType(event, 'prog')) {
|
||||||
return `${this.event_symbol(event)} Progress: ${
|
return `${this.event_symbol(event)} Progress: ${
|
||||||
|
Loading…
Reference in New Issue
Block a user