Skip to content

Commit

Permalink
Merge pull request #104 from ymaheshwari1/feat/run
Browse files Browse the repository at this point in the history
Implemented: support to display the runTime and frequency for a group on the list page
  • Loading branch information
ymaheshwari1 authored Feb 16, 2024
2 parents e9980da + f0c01f3 commit 9c66642
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
19 changes: 19 additions & 0 deletions src/store/modules/orderRouting/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,25 @@ const actions: ActionTree<OrderRoutingState, RootState> = {
}

if(routingGroups.length) {
const groupScheduleInfoPayload = routingGroups.map((group: any) => {
return group.routingGroupId
})

const resp = await Promise.allSettled(groupScheduleInfoPayload.map((routingGroupId: any) => OrderRoutingService.fetchRoutingScheduleInformation(routingGroupId)))

// Performing check on only those responses for which the status is fulfilled
const schedules = resp.filter((response: any) => response.status === "fulfilled").reduce((schedules: any, response: any) => {
if(response.value.data.schedule) {
schedules[response.value.data.schedule.jobName] = response.value.data.schedule
}
return schedules;
}, {})

routingGroups = routingGroups.map((group: any) => ({
...group,
schedule: schedules[group.jobName]
}))

routingGroups = sortSequence(routingGroups)
}

Expand Down
12 changes: 5 additions & 7 deletions src/views/BrokeringRoute.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,10 @@
</main>
<aside>
<ion-card>
<ion-card-header>
<ion-card-title>
{{ translate("Scheduler") }}
</ion-card-title>
<ion-badge>{{ timeTillJobUsingSeconds(job.nextExecutionDateTime) }}</ion-badge>
</ion-card-header>
<ion-item lines="none">
<h2>{{ translate("Scheduler") }}</h2>
<ion-badge slot="end">{{ timeTillJobUsingSeconds(job.nextExecutionDateTime) }}</ion-badge>
</ion-item>
<ion-item v-show="typeof isOmsConnectionExist === 'boolean' && !isOmsConnectionExist" lines="none">
<ion-label color="danger" class="ion-text-wrap">
{{ translate("Connection configuration is missing for oms.") }}
Expand Down Expand Up @@ -139,7 +137,7 @@
</template>

<script setup lang="ts">
import { IonBackButton, IonBadge, IonButtons, IonButton, IonCard, IonCardHeader, IonCardTitle, IonChip, IonContent, IonFab, IonFabButton, IonHeader, IonIcon, IonItem, IonLabel, IonList, IonListHeader, IonPage, IonReorder, IonReorderGroup, IonSelect, IonSelectOption, IonTextarea, IonTitle, IonToolbar, alertController, modalController, onIonViewWillEnter } from "@ionic/vue";
import { IonBackButton, IonBadge, IonButtons, IonButton, IonCard, IonChip, IonContent, IonFab, IonFabButton, IonHeader, IonIcon, IonItem, IonLabel, IonList, IonListHeader, IonPage, IonReorder, IonReorderGroup, IonSelect, IonSelectOption, IonTextarea, IonTitle, IonToolbar, alertController, modalController, onIonViewWillEnter } from "@ionic/vue";
import { addCircleOutline, archiveOutline, refreshOutline, reorderTwoOutline, saveOutline, timeOutline, timerOutline } from "ionicons/icons"
import { onBeforeRouteLeave, useRouter } from "vue-router";
import { useStore } from "vuex";
Expand Down
12 changes: 9 additions & 3 deletions src/views/BrokeringRuns.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
{{ group.description }}
</ion-item>
<ion-item>
<ion-label>{{ group.frequency ? group.frequency : "-" }}</ion-label>
<ion-label slot="end">{{ group.runTime ? group.runTime : "-" }}</ion-label>
<ion-label>{{ group.schedule ? getScheduleFrequency(group.schedule.cronExpression) : "-" }}</ion-label>
<ion-label slot="end">{{ group.schedule ? getTimeFromSeconds(group.schedule.nextExecutionDateTime) : "-" }}</ion-label>
</ion-item>
<ion-item>
{{ getDateAndTime(group.createdDate) }}
Expand All @@ -72,7 +72,7 @@
import emitter from "@/event-bus";
import { translate } from "@/i18n";
import { Group } from "@/types";
import { getDateAndTime, showToast } from "@/utils";
import { getDateAndTime, getTimeFromSeconds, showToast } from "@/utils";
import { IonButton, IonButtons, IonCard, IonCardHeader, IonCardTitle, IonContent, IonHeader, IonIcon, IonItem, IonLabel, IonList, IonListHeader, IonPage, IonRadioGroup, IonRadio, IonSearchbar, IonSpinner, IonTitle, IonToolbar, alertController, onIonViewWillEnter } from "@ionic/vue";
import { addOutline } from "ionicons/icons"
import { computed, ref } from "vue";
Expand All @@ -85,6 +85,8 @@ const groups = computed(() => store.getters["orderRouting/getRoutingGroups"])
const userProfile = computed(() => store.getters["user/getUserProfile"])
const currentEComStore = computed(() => store.getters["user/getCurrentEComStore"])
const cronExpressions = JSON.parse(process.env?.VUE_APP_CRON_EXPRESSIONS)
let isLoading = ref(false)
let queryString = ref("")
let brokeringGroups = ref([]) as any
Expand Down Expand Up @@ -150,6 +152,10 @@ async function setEComStore(event: CustomEvent) {
emitter.emit("dismissLoader")
}
function getScheduleFrequency(cronExp: string) {
return Object.entries(cronExpressions).find(([description, expression]) => expression === cronExp)?.[0] || "-"

Check warning on line 156 in src/views/BrokeringRuns.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (18.x)

'description' is defined but never used

Check warning on line 156 in src/views/BrokeringRuns.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / build_and_deploy

'description' is defined but never used

Check warning on line 156 in src/views/BrokeringRuns.vue

View workflow job for this annotation

GitHub Actions / call-workflow-in-another-repo / reusable_workflow_job (20.x)

'description' is defined but never used
}
async function redirect(group: Group) {
router.push(`brokering/${group.routingGroupId}/routes`)
}
Expand Down

0 comments on commit 9c66642

Please sign in to comment.