Skip to content

Commit

Permalink
Improved: removed timeFromNow and used existing timeTillJob function,…
Browse files Browse the repository at this point in the history
… added isDesktop property for history segment(#680)
  • Loading branch information
R-Sourabh committed Nov 11, 2024
1 parent 89b8b4a commit 2c9dd31
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
6 changes: 1 addition & 5 deletions src/components/JobConfiguration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ion-button fill="outline" slot="end" v-if="isRefreshRequired" @click="refreshCurrentJob">
<ion-icon :icon="refreshOutline" slot="icon-only" />
</ion-button>
<ion-badge slot="end" color="dark" v-if="currentJob.cancelDateTime || currentJob.finishDateTime">{{ currentJob.statusId == "SERVICE_CANCELLED" || currentJob.statusId == "SERVICE_CRASHED" ? timeFromNow(currentJob.cancelDateTime) : timeFromNow(currentJob.finishDateTime) }}</ion-badge>
<ion-badge slot="end" color="dark" v-if="currentJob.cancelDateTime || currentJob.finishDateTime">{{ currentJob.statusId == "SERVICE_CANCELLED" || currentJob.statusId == "SERVICE_CRASHED" ? timeTillJob(currentJob.cancelDateTime) : timeTillJob(currentJob.finishDateTime) }}</ion-badge>
<ion-badge slot="end" color="dark" v-else-if="currentJob?.runTime && currentJob.statusId !== 'SERVICE_DRAFT' && !isRefreshRequired">{{ translate("running") }} {{ timeTillJob(currentJob.runTime) }}</ion-badge>
</ion-item>

Expand Down Expand Up @@ -484,10 +484,6 @@ export default defineComponent({
const timeDiff = DateTime.fromMillis(time).diff(DateTime.local());
return DateTime.local().plus(timeDiff).toRelative();
},
timeFromNow (time: any) {
const timeDiff = DateTime.fromMillis(time).diff(DateTime.local());
return DateTime.local().plus(timeDiff).toRelative();
},
async viewJobHistory(job: any) {
const jobHistoryModal = await modalController.create({
component: JobHistoryModal,
Expand Down
6 changes: 1 addition & 5 deletions src/components/JobParameterModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</ion-buttons>
<ion-title>{{ translate('Custom Parameters') }}</ion-title>
<ion-buttons slot="end">
<ion-button color="primary" :disabled="isSaveDisabledByStatus(currentJob.statusId)" @click="save()">{{ translate('Save') }}</ion-button>
<ion-button color="primary" :disabled="currentJob.statusId !== 'SERVICE_DRAFT'" @click="save()">{{ translate('Save') }}</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
Expand Down Expand Up @@ -119,10 +119,6 @@ export default defineComponent({
return JSON.stringify(res);
},
isSaveDisabledByStatus(statusId: any) {
const invalidStatuses = ["SERVICE_PENDING", "SERVICE_CANCELLED", "SERVICE_CRASHED", "SERVICE_FAILED", "SERVICE_FINISHED"];
return invalidStatuses.includes(statusId);
},
save() {
modalController.dismiss({ dismissed: true, customOptionalParameters: this.customOptionalParametersValue, customRequiredParameters: this.customRequiredParametersValue })
}
Expand Down
4 changes: 2 additions & 2 deletions src/views/Pipeline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
</div>

<div v-else>
<ion-card v-for="job in jobHistory" :key="job.jobId" @click="viewJobConfiguration(job)">
<ion-card v-for="job in jobHistory" :key="job.jobId" @click="viewJobConfiguration(job)" :button="isDesktop">
<ion-card-header>
<div>
<ion-card-subtitle class="overline">{{ job.parentJobId }}</ion-card-subtitle>
Expand Down Expand Up @@ -608,7 +608,7 @@ export default defineComponent({
this.freqType = appFreqType ? appFreqType[1] : "default"
await this.store.dispatch('job/updateCurrentJob', { job });
if (this.segmentSelected === 'history' && job.runtimeData?.configId) {
if (!this.isDesktop && this.segmentSelected === 'history' && job.runtimeData?.configId) {
await this.store.dispatch('job/fetchDataManagerLogs', job.jobId)
}
if(!this.isDesktop && job?.jobId) {
Expand Down

0 comments on commit 2c9dd31

Please sign in to comment.