-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented: additional job actions, to job config component (#364tt29) #212
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
214b588
Implemented: additional job actions, to job config component(#364tt29)
rathoreprashant c71605b
Improved: check to pin and unpin job from job config component(#364tt29)
rathoreprashant 1eb3ea1
Improved: markup and its css property(#364tt29)
rathoreprashant 8036f1f
Improved: indentation and apply self closing tag for ion-checkbox(#36…
rathoreprashant 497af0b
Improved: css property and Arrange code in the right manner (#364tt29)
rathoreprashant File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,13 +70,34 @@ | |
<ion-button expand="block" @click="saveChanges()">{{ $t("Save changes") }}</ion-button> | ||
</div> | ||
</section> | ||
<div class="job-actions"> | ||
<ion-item slot="start" @click="viewJobHistory(currentJob)" button> | ||
<ion-icon slot="start" :icon="timeOutline" /> | ||
{{ $t("History") }} | ||
</ion-item> | ||
<ion-item slot="end" @click="runNow(title, currentJob)" button> | ||
<ion-icon slot="start" :icon="flashOutline" /> | ||
{{ $t("Run now") }} | ||
</ion-item> | ||
<ion-item slot="start" @click="copyJobInformation(currentJob)" button> | ||
<ion-icon slot="start" :icon="copyOutline" /> | ||
{{ $t("Copy details") }} | ||
</ion-item> | ||
<ion-item slot="end" @click="updatePinnedJobs(currentJob?.systemJobEnumId)" button> | ||
<ion-icon slot="start" :icon="pinOutline" /> | ||
{{ $t("Pin job") }} | ||
<ion-checkbox :checked="getPinnedJobs.includes(currentJob.systemJobEnumId)" slot="end"></ion-checkbox> | ||
</ion-item> | ||
</div> | ||
|
||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from "vue"; | ||
import { | ||
IonBadge, | ||
IonButton, | ||
IonCheckbox, | ||
IonContent, | ||
IonDatetime, | ||
IonIcon, | ||
|
@@ -86,15 +107,21 @@ import { | |
IonModal, | ||
IonSelect, | ||
IonSelectOption, | ||
alertController | ||
ymaheshwari1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
alertController, | ||
modalController, | ||
} from "@ionic/vue"; | ||
import { | ||
calendarClearOutline, | ||
flashOutline, | ||
copyOutline, | ||
timeOutline, | ||
timerOutline, | ||
syncOutline, | ||
personCircleOutline | ||
personCircleOutline, | ||
pinOutline, | ||
} from "ionicons/icons"; | ||
import JobHistoryModal from '@/components/JobHistoryModal.vue' | ||
import { Plugins } from '@capacitor/core'; | ||
import { handleDateTimeInput, showToast } from "@/utils"; | ||
import { mapGetters, useStore } from "vuex"; | ||
import { DateTime } from 'luxon'; | ||
|
@@ -115,7 +142,8 @@ export default defineComponent({ | |
IonList, | ||
IonModal, | ||
IonSelect, | ||
IonSelectOption | ||
IonSelectOption, | ||
IonCheckbox | ||
}, | ||
data() { | ||
return { | ||
|
@@ -127,6 +155,9 @@ export default defineComponent({ | |
props: ["title", "status", "type"], | ||
computed: { | ||
...mapGetters({ | ||
getEnumDescription: 'job/getEnumDescription', | ||
getEnumName: 'job/getEnumName', | ||
getPinnedJobs: 'user/getPinnedJobs', | ||
getJobStatus: 'job/getJobStatus', | ||
getJob: 'job/getJob', | ||
shopifyConfigId: 'user/getShopifyConfigId', | ||
|
@@ -286,6 +317,60 @@ export default defineComponent({ | |
if (job) { | ||
job.runTime = handleDateTimeInput(ev['detail'].value) | ||
} | ||
}, | ||
async viewJobHistory(job: any) { | ||
const jobHistoryModal = await modalController.create({ | ||
component: JobHistoryModal, | ||
componentProps: { currentJob: job } | ||
}); | ||
await jobHistoryModal.present(); | ||
jobHistoryModal.onDidDismiss().then(() => { | ||
jobHistoryModal.dismiss({ dismissed: true }); | ||
}) | ||
}, | ||
async runNow(header: string, job: any) { | ||
const jobAlert = await alertController | ||
.create({ | ||
header, | ||
message: this.$t('This job will be scheduled to run as soon as possible. There may not be enough time to revert this action.', {space: '<br/><br/>'}), | ||
buttons: [ | ||
{ | ||
text: this.$t("Cancel"), | ||
role: 'cancel', | ||
}, | ||
{ | ||
text: this.$t('Run now'), | ||
handler: () => { | ||
if (job) { | ||
this.store.dispatch('job/runServiceNow', job) | ||
} | ||
} | ||
} | ||
] | ||
}); | ||
|
||
return jobAlert.present(); | ||
}, | ||
async copyJobInformation(job: any) { | ||
const { Clipboard } = Plugins; | ||
const jobDetails = `jobId: ${job.jobId}, jobName: ${this.getEnumName(job.systemJobEnumId)}, jobDescription: ${this.getEnumDescription(job.systemJobEnumId)}`; | ||
|
||
await Clipboard.write({ | ||
string: jobDetails | ||
}).then(() => { | ||
showToast(this.$t("Copied job details to clipboard")); | ||
}) | ||
}, | ||
async updatePinnedJobs(enumId: any) { | ||
const pinnedJobs = new Set(this.getPinnedJobs); | ||
if(pinnedJobs.has(enumId)) { | ||
pinnedJobs.delete(enumId); | ||
await this.store.dispatch('user/updatePinnedJobs', { pinnedJobs: [...pinnedJobs] }); | ||
emitter.emit("pinnedJobsUpdated", enumId); | ||
} else { | ||
pinnedJobs.add(enumId); | ||
await this.store.dispatch('user/updatePinnedJobs', { pinnedJobs: [...pinnedJobs] }); | ||
} | ||
} | ||
}, | ||
setup() { | ||
|
@@ -294,12 +379,15 @@ export default defineComponent({ | |
|
||
return { | ||
calendarClearOutline, | ||
copyOutline, | ||
flashOutline, | ||
timeOutline, | ||
timerOutline, | ||
store, | ||
router, | ||
syncOutline, | ||
personCircleOutline | ||
personCircleOutline, | ||
pinOutline | ||
}; | ||
} | ||
}); | ||
|
@@ -328,7 +416,19 @@ ion-list { | |
|
||
.mobile-only { | ||
display: none; | ||
} | ||
} | ||
.job-actions { | ||
azkyakhan marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We already have an "actions" class. So job actions doesn't make sense here I think. "More actions" seems better. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated sir |
||
margin-top: var(--spacer-sm); | ||
row-gap: var(--spacer-sm); | ||
display: flex; | ||
flex-wrap: wrap; | ||
} | ||
.job-actions > ion-item { | ||
flex-basis: 50%; | ||
} | ||
.job-actions > ion-item > ion-checkbox{ | ||
margin: unset; | ||
} | ||
} | ||
|
||
ion-label:nth-child(3) { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@azkyakhan Thoughts on slot here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This slots over here are not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed