-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#### Changelog: * Feature: Use centrifugo to notify browser about new history lines. * Fix: Performance issues when rendering history lines. * Feature: Add centrifugo and traefik to docker-compose. * Service: Change `HistoryLines.id` to `BigAutoField` and `HistoryLines.line` to `TextField`. * Service: Update vstutils 5.0.0b123. See merge request polemarch/ce!234
- Loading branch information
Showing
22 changed files
with
279 additions
and
97 deletions.
There are no files selected for viewing
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
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,51 @@ | ||
/** @vue/component */ | ||
export const ExecutionTimeFieldMixin = { | ||
data() { | ||
return { | ||
intervalId: null, | ||
generatedTime: null, | ||
}; | ||
}, | ||
computed: { | ||
shouldGenerateTime() { | ||
return this.$app.centrifugoClient && ['RUN', 'DELAY'].includes(this.data.status); | ||
}, | ||
value() { | ||
if (this.shouldGenerateTime) { | ||
return this.generatedTime; | ||
} | ||
return this.data[this.field.name]; | ||
}, | ||
}, | ||
watch: { | ||
shouldGenerateTime: { | ||
immediate: true, | ||
handler(value) { | ||
if (value && !this.intervalId) { | ||
this.intervalId = setInterval(() => this.updateGeneratedTime(), 1000); | ||
} else { | ||
clearInterval(this.intervalId); | ||
} | ||
}, | ||
}, | ||
}, | ||
methods: { | ||
updateGeneratedTime() { | ||
this.generatedTime = this.$u.getTimeInUptimeFormat( | ||
window.moment.duration(window.moment().diff(this.data.start_time)).asSeconds(), | ||
); | ||
}, | ||
}, | ||
}; | ||
|
||
export class ExecutionTimeField extends spa.fields.datetime.UptimeField { | ||
static format = 'execution-time'; | ||
|
||
static get mixins() { | ||
return super.mixins.concat(ExecutionTimeFieldMixin); | ||
} | ||
} | ||
|
||
spa.signals.once('APP_CREATED', (app) => { | ||
app.fieldsResolver.registerField('integer', ExecutionTimeField.format, ExecutionTimeField); | ||
}); |
Oops, something went wrong.