diff --git a/client/src/components/Common/UserReportingError.vue b/client/src/components/Common/UserReportingError.vue index 61534713ff3b..ea7201cd9e59 100644 --- a/client/src/components/Common/UserReportingError.vue +++ b/client/src/components/Common/UserReportingError.vue @@ -61,7 +61,7 @@ variant="primary" class="mt-3" :disabled="disableSubmit" - @click="submit({}, currentUser?.email)"> + @click="submit(currentUser?.email)"> Report @@ -79,7 +79,6 @@ import { useMarkdown } from "@/composables/markdown"; import { useUserStore } from "@/stores/userStore"; import { sendErrorReport } from "../DatasetInformation/services"; -import { sendErrorReportTool } from "../ToolInformation/services"; export default { components: { @@ -140,28 +139,18 @@ export default { onError(err) { this.errorMessage = err; }, - submit(dataset, userEmailJob) { + submit(userEmailJob) { const email = userEmailJob || this.currentUserEmail; const message = this.message; - if (this.transcript) { - sendErrorReportTool(dataset, message, email, this.transcript).then( - (resultMessages) => { - this.resultMessages = resultMessages; - }, - (errorMessage) => { - this.errorMessage = errorMessage; - } - ); - } else { - sendErrorReport(dataset, message, email, this.transcript).then( - (resultMessages) => { - this.resultMessages = resultMessages; - }, - (errorMessage) => { - this.errorMessage = errorMessage; - } - ); - } + const report_type = this.transcript ? "tool" : "dataset"; + sendErrorReport(email, message, report_type, this.dataset, this.transcript).then( + (resultMessages) => { + this.resultMessages = resultMessages; + }, + (errorMessage) => { + this.errorMessage = errorMessage; + } + ); }, hasDetails(outputs) { return ( diff --git a/client/src/components/DatasetInformation/DatasetError.vue b/client/src/components/DatasetInformation/DatasetError.vue index 9f6fe74eca15..d1e0286c4ec6 100644 --- a/client/src/components/DatasetInformation/DatasetError.vue +++ b/client/src/components/DatasetInformation/DatasetError.vue @@ -15,7 +15,6 @@ :result-messages="resultMessages" :show-form="showForm" :message="message" - :submit="submit" :dataset="dataset" :command-outputs="buildCommandOutputs(jobDetails)" :notifications="buildNotifications(jobDetails.tool_id)" /> @@ -35,8 +34,6 @@ import { mapState } from "pinia"; import { useMarkdown } from "@/composables/markdown"; import { useUserStore } from "@/stores/userStore"; -import { sendErrorReport } from "./services"; - import UserReportingError from "../Common/UserReportingError.vue"; library.add(faBug); @@ -99,18 +96,6 @@ export default { }, ]; }, - submit(dataset, userEmailJob) { - const email = userEmailJob || this.currentUserEmail; - const message = this.message; - sendErrorReport(dataset, message, email).then( - (resultMessages) => { - this.resultMessages = resultMessages; - }, - (errorMessage) => { - this.errorMessage = errorMessage; - } - ); - }, }, }; diff --git a/client/src/components/DatasetInformation/services.js b/client/src/components/DatasetInformation/services.js index 13c4c62bd3d6..6a984c27bf56 100644 --- a/client/src/components/DatasetInformation/services.js +++ b/client/src/components/DatasetInformation/services.js @@ -2,13 +2,19 @@ import axios from "axios"; import { getAppRoot } from "onload/loadConfig"; import { rethrowSimple } from "utils/simple-error"; -export async function sendErrorReport(dataset, message, email) { +export async function sendErrorReport(email, message, report_type = "dataset", dataset = {}, transcript = null) { + let url = ""; const payload = { dataset_id: dataset.id, message, email, + transcript, }; - const url = `${getAppRoot()}api/jobs/${dataset.creating_job}/error`; + if (report_type == "tool") { + url = `${getAppRoot()}api/user-reporting/error`; + } else { + url = `${getAppRoot()}api/jobs/${dataset.creating_job}/error`; + } try { const { data } = await axios.post(url, payload); return data.messages; diff --git a/client/src/components/Tool/ToolForm.vue b/client/src/components/Tool/ToolForm.vue index ecb264978050..90427129bec0 100644 --- a/client/src/components/Tool/ToolForm.vue +++ b/client/src/components/Tool/ToolForm.vue @@ -8,12 +8,10 @@ - {{ /* TODO integrate submit-prop into larger form */ }}