Skip to content

Commit

Permalink
feat(tools/fastani): Removed autorefresh on FastANI calculator until …
Browse files Browse the repository at this point in the history
…fixed.
  • Loading branch information
aaronmussig committed Mar 11, 2022
1 parent 95ca307 commit d0e0545
Showing 1 changed file with 39 additions and 10 deletions.
49 changes: 39 additions & 10 deletions components/fastani/FastAniResults.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
<div>
<div v-if="areJobsRunning">
<p>
The table below will be automatically refreshed every
{{ (refreshEveryMs / 1000).toLocaleString() }} seconds.
Press the "Refresh" button below to reload the results.
<!-- The table below will be automatically refreshed every-->
<!-- {{ (refreshEveryMs / 1000).toLocaleString() }} seconds.-->
</p>
<p v-if="positionInQueue !== null">
Position in queue: {{ positionInQueue.toLocaleString() }}
Expand All @@ -15,16 +16,30 @@
</p>
</div>

<!-- TODO: This is currently broken, this is being replaced with a manual refresh for now -->
<!-- <v-btn-->
<!-- :color="isAutoRefreshEnabled ? '#e79595' : '#74d993'"-->
<!-- :disabled="!areJobsRunning"-->
<!-- depressed-->
<!-- small-->
<!-- @click="toggleAutoRefresh"-->
<!-- >-->
<!-- {{ isAutoRefreshEnabled ? 'Disable' : 'Enable' }} Auto Refresh-->
<!-- <v-icon right>-->
<!-- {{ mdiCogRefreshSvg }}-->
<!-- </v-icon>-->
<!-- </v-btn>-->

<v-btn
:color="isAutoRefreshEnabled ? '#e79595' : '#74d993'"
:disabled="!areJobsRunning"
depressed
small
@click="toggleAutoRefresh"
@click="manualRefresh"
:loading="isManualRefreshLoading || isRefreshQueryStillRunning"
>
{{ isAutoRefreshEnabled ? 'Disable' : 'Enable' }} Auto Refresh
Refresh
<v-icon right>
{{ mdiCogRefreshSvg }}
{{ mdiRefreshSvg }}
</v-icon>
</v-btn>

Expand Down Expand Up @@ -236,11 +251,11 @@ import Vue from 'vue';
import {RqJobStatus} from "~/assets/api/models";
import HelpTooltip from "~/components/layout/HelpTooltip.vue";
import {mdiCogRefresh, mdiDownload} from "@mdi/js";
import {mdiCogRefresh, mdiDownload, mdiRefresh} from "@mdi/js";
import {FastAniResult, FastAniResultData} from "~/assets/api/fastani";
import FastAniLogsModal from "~/components/fastani/FastAniLogsModal.vue";
import {DataOptions} from "vuetify";
import {isDefined, JsonEqual} from "~/assets/ts/common";
import {isDefined, JsonEqual, sleep} from "~/assets/ts/common";
const RUNNING_STATUSES = ['queued', 'started', 'deferred', 'scheduled'];
Expand Down Expand Up @@ -272,6 +287,7 @@ export default Vue.extend({
// Icons
mdiCogRefreshSvg: mdiCogRefresh,
mdiDownloadSvg: mdiDownload,
mdiRefreshSvg: mdiRefresh,
// Refreshing results
isAutoRefreshEnabled: false,
Expand All @@ -281,6 +297,7 @@ export default Vue.extend({
lastRefreshRequestStartTime: new Date(),
refreshProgressPct: 0,
isRefreshQueryStillRunning: false,
isManualRefreshLoading: false,
// Pagination
totalRows: 0,
Expand Down Expand Up @@ -310,6 +327,18 @@ export default Vue.extend({
this.isAutoRefreshEnabled = !this.isAutoRefreshEnabled;
},
// Do a manual refresh of the data, force the user to wait a few seconds.
manualRefresh() {
if (this.isManualRefreshLoading || this.isRefreshQueryStillRunning) {
return;
}
this.isManualRefreshLoading = true;
this.getJobData();
sleep(5000).finally(() => {
this.isManualRefreshLoading = false;
});
},
// A collection of status states
isStatusRunning(status: RqJobStatus): boolean {
return [RqJobStatus.STARTED].includes(status);
Expand Down Expand Up @@ -482,15 +511,15 @@ export default Vue.extend({
jobId(after, before) {
if (after && after !== before) {
this.getJobData()
this.startNewAutoRefreshInterval()
// this.startNewAutoRefreshInterval()
}
}
},
mounted() {
// If this component is loaded with a job id in the url, then load
if (this.hasJobId) {
this.getJobData()
this.startNewAutoRefreshInterval()
// this.startNewAutoRefreshInterval()
}
}
})
Expand Down

0 comments on commit d0e0545

Please sign in to comment.