diff --git a/client/src/components/Collections/common/UserReportingError.vue b/client/src/components/Collections/common/UserReportingError.vue new file mode 100644 index 000000000000..811d24e2c0aa --- /dev/null +++ b/client/src/components/Collections/common/UserReportingError.vue @@ -0,0 +1,88 @@ + + + diff --git a/client/src/components/Collections/common/reporting.ts b/client/src/components/Collections/common/reporting.ts new file mode 100644 index 000000000000..9ea253248827 --- /dev/null +++ b/client/src/components/Collections/common/reporting.ts @@ -0,0 +1,34 @@ +import { GalaxyApi } from "@/api"; +import { type HDADetailed } from "@/api"; +import { errorMessageAsString } from "@/utils/simple-error"; + +export interface ReportableObject { + id: string; + creating_job: string; +} + +export async function submitReport( + reportableData: HDADetailed, + message: string, + email: string +): Promise<{ messages: string[][]; error?: string }> { + try { + const { data, error } = await GalaxyApi().POST("/api/jobs/{job_id}/error", { + params: { + path: { job_id: reportableData.creating_job }, + }, + body: { + dataset_id: reportableData.id, + message, + email, + }, + }); + + if (error) { + return { messages: [], error: errorMessageAsString(error) }; + } + return { messages: data.messages }; + } catch (err) { + return { messages: [], error: errorMessageAsString(err) }; + } +} diff --git a/client/src/components/DatasetInformation/DatasetError.vue b/client/src/components/DatasetInformation/DatasetError.vue index cbe9f3e40189..9c09951773ff 100644 --- a/client/src/components/DatasetInformation/DatasetError.vue +++ b/client/src/components/DatasetInformation/DatasetError.vue @@ -1,21 +1,18 @@