-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #214 from shashwatbangar/#364ttxy
Implemented: Miscellaneous page in job-manager(#364ttxy)
- Loading branch information
Showing
11 changed files
with
252 additions
and
6 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
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,153 @@ | ||
<template> | ||
<ion-page> | ||
<ion-header :translucent="true"> | ||
<ion-toolbar> | ||
<ion-menu-button slot="start" /> | ||
<ion-title>{{ $t("Miscellaneous") }}</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
|
||
<ion-content> | ||
<main> | ||
<section> | ||
<ion-list> | ||
<ion-list-header>{{ $t("Miscellaneous jobs") }}</ion-list-header> | ||
<ion-item v-for="job in miscellaneousJobs" :key="job.jobId" @click="viewJobConfiguration(job)" detail button> | ||
<ion-label>{{ job.jobName }}</ion-label> | ||
<ion-note slot="end">{{ getJobRuntime(job) }}</ion-note> | ||
</ion-item> | ||
</ion-list> | ||
|
||
<ion-infinite-scroll @ionInfinite="loadMoreMiscellaneousJobs($event)" threshold="100px" :disabled="!isMiscellaneousJobsScrollable"> | ||
<ion-infinite-scroll-content loading-spinner="crescent" :loading-text="$t('Loading')"/> | ||
</ion-infinite-scroll> | ||
</section> | ||
|
||
<aside class="desktop-only" v-if="isDesktop" v-show="currentJob && Object.keys(currentJob).length"> | ||
<JobConfiguration :title="currentJobTitle" :status="currentJobStatus" :key="currentJob"/> | ||
</aside> | ||
</main> | ||
</ion-content> | ||
</ion-page> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { DateTime } from 'luxon'; | ||
import { | ||
IonContent, | ||
IonHeader, | ||
IonInfiniteScroll, | ||
IonInfiniteScrollContent, | ||
IonItem, | ||
IonLabel, | ||
IonList, | ||
IonListHeader, | ||
IonMenuButton, | ||
IonNote, | ||
IonPage, | ||
IonTitle, | ||
IonToolbar, | ||
isPlatform, | ||
} from '@ionic/vue'; | ||
import { defineComponent } from 'vue'; | ||
import { useRouter } from 'vue-router' | ||
import { mapGetters, useStore } from 'vuex' | ||
import emitter from '@/event-bus'; | ||
import JobConfiguration from '@/components/JobConfiguration.vue'; | ||
import { isFutureDate } from '@/utils'; | ||
export default defineComponent({ | ||
name: 'Miscellaneous', | ||
components: { | ||
IonContent, | ||
IonHeader, | ||
IonInfiniteScroll, | ||
IonInfiniteScrollContent, | ||
IonItem, | ||
IonLabel, | ||
IonList, | ||
IonListHeader, | ||
IonMenuButton, | ||
IonNote, | ||
IonPage, | ||
IonTitle, | ||
IonToolbar, | ||
JobConfiguration | ||
}, | ||
mounted() { | ||
this.getMiscellaneousJobs(); | ||
}, | ||
data() { | ||
return { | ||
currentJobTitle: '', | ||
currentJobStatus: '', | ||
isJobDetailAnimationCompleted: false, | ||
isDesktop: isPlatform('desktop') | ||
} | ||
}, | ||
computed: { | ||
...mapGetters({ | ||
miscellaneousJobs: 'job/getMiscellaneousJobs', | ||
getCurrentEComStore:'user/getCurrentEComStore', | ||
currentJob: 'job/getCurrentJob', | ||
isMiscellaneousJobsScrollable: 'job/isMiscellaneousJobsScrollable' | ||
}) | ||
}, | ||
methods: { | ||
async viewJobConfiguration(job: any) { | ||
this.currentJob = job | ||
this.currentJobTitle = job.jobName | ||
this.currentJobStatus = job.status | ||
// if job runTime is not a valid date then making runTime as empty | ||
if (job?.runTime && !isFutureDate(job?.runTime)) { | ||
job.runTime = '' | ||
} | ||
await this.store.dispatch('job/updateCurrentJob', { job }); | ||
if(!this.isDesktop && job?.jobId) { | ||
this.router.push({name: 'JobDetails', params: { title: this.currentJobTitle, jobId: job?.jobId, category: "miscellaneous"}}); | ||
return; | ||
} | ||
if (job && !this.isJobDetailAnimationCompleted) { | ||
emitter.emit('playAnimation'); | ||
this.isJobDetailAnimationCompleted = true; | ||
} | ||
}, | ||
async getMiscellaneousJobs(viewSize = 20, viewIndex = 0) { | ||
await this.store.dispatch('job/fetchMiscellaneousJobs', {eComStoreId: this.getCurrentEComStore.productStoreId, viewSize, viewIndex}); | ||
}, | ||
async loadMoreMiscellaneousJobs (event: any) { | ||
this.getMiscellaneousJobs( | ||
undefined, | ||
Math.ceil(this.miscellaneousJobs.length / (process.env.VUE_APP_VIEW_SIZE as any)) | ||
).then(() => { | ||
event.target.complete(); | ||
}) | ||
}, | ||
timeFromNow (time: any) { | ||
const timeDiff = DateTime.fromMillis(time).diff(DateTime.local()); | ||
return DateTime.local().plus(timeDiff).toRelative(); | ||
}, | ||
getJobRuntime(job: any) { | ||
return job.statusId !== 'SERVICE_DRAFT' && this.timeFromNow(job.runTime) ? this.timeFromNow(job.runTime) : this.$t('Disabled') | ||
} | ||
}, | ||
setup() { | ||
const store = useStore(); | ||
const router = useRouter(); | ||
return { | ||
router, | ||
store, | ||
}; | ||
}, | ||
}) | ||
</script> | ||
|
||
<style scoped> | ||
main > section { | ||
width: 423px; | ||
} | ||
</style> |