Skip to content
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: button for copying failed job reason in the modal #657

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"Completed orders": "Completed orders",
"Configuration missing": "Configuration missing",
"Copied job details to clipboard": "Copied job details to clipboard",
"Copied to clipboard": "Copied to clipboard",
"Copy details": "Copy details",
"Custom": "Custom",
"Custom frequency": "Custom frequency",
Expand Down
13 changes: 13 additions & 0 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Papa from 'papaparse'
import { DateTime } from "luxon";
import logger from "@/logger";
import { translate } from "@/i18n";
import { Plugins } from '@capacitor/core';

// TODO Use separate files for specific utilities

Expand Down Expand Up @@ -330,7 +331,19 @@ const hasJobDataError = (job: any) => {
return false;
}

const copyToClipboard = async (value: string, text?: string) => {
const { Clipboard } = Plugins;

await Clipboard.write({
string: value,
}).then(() => {
text ? showToast(translate(text)) : showToast(translate("Copied", { value }));
});
}


export {
copyToClipboard,
isCustomRunTime,
getNowTimestamp,
generateAllowedFrequencies,
Expand Down
12 changes: 10 additions & 2 deletions src/views/FailedJobReasonModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
</ion-button>
</ion-buttons>
<ion-title>{{ $t("Failed job reason") }}</ion-title>
<ion-buttons slot="end">
<ion-button @click="copyToClipboard(job.jobResult, 'Copied to clipboard')">
<ion-icon slot="icon-only" :icon="copyOutline" />
</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content>
Expand All @@ -29,7 +34,8 @@ import {
modalController,
} from '@ionic/vue';
import { defineComponent } from 'vue';
import { closeOutline } from 'ionicons/icons';
import { closeOutline, copyOutline } from 'ionicons/icons';
import { copyToClipboard } from "@/utils";

export default defineComponent({
name: "FailedJobReasonModal",
Expand All @@ -51,7 +57,9 @@ export default defineComponent({
},
setup() {
return {
closeOutline
closeOutline,
copyOutline,
copyToClipboard
};
},
});
Expand Down
Loading