Skip to content

Commit

Permalink
REVERT: Removed changes related to the backend for simplicity in merg…
Browse files Browse the repository at this point in the history
…ing. Renamed 'transcript' to more universal 'api_request'.
  • Loading branch information
hujambo-dunia committed Apr 12, 2024
1 parent ceedac5 commit d1cbee0
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 262 deletions.
7 changes: 3 additions & 4 deletions client/src/components/Common/UserReportingError.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
({{ title }}) Error transcript:
</BLink>
<BCollapse id="collapse-previous" v-model="isExpanded">
<pre class="rounded code">{{ transcript }}</pre></BCollapse
<pre class="rounded code">{{ api_request }}</pre></BCollapse
><br />
<BButton
id="dataset-error-submit"
Expand Down Expand Up @@ -103,7 +103,7 @@ export default {
type: Array,
default: () => [],
},
transcript: {
api_request: {
type: String,
default: "",
},
Expand Down Expand Up @@ -142,8 +142,7 @@ export default {
submit(userEmailJob) {
const email = userEmailJob || this.currentUserEmail;
const message = this.message;
const report_type = this.transcript ? "tool" : "dataset";
sendErrorReport(email, message, report_type, this.dataset, this.transcript).then(
sendErrorReport(email, message, "dataset", this.dataset, this.api_request).then(
(resultMessages) => {
this.resultMessages = resultMessages;
},
Expand Down
12 changes: 4 additions & 8 deletions client/src/components/DatasetInformation/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,15 @@ import axios from "axios";
import { getAppRoot } from "onload/loadConfig";
import { rethrowSimple } from "utils/simple-error";

export async function sendErrorReport(email, message, report_type = "dataset", dataset = {}, transcript = null) {
let url = "";
export async function sendErrorReport(email, message, report_type = "dataset", dataset = {}, api_request = null) {
const payload = {
dataset_id: dataset.id,
message,
email,
transcript,
report_type,
api_request,
};
if (report_type == "tool") {
url = `${getAppRoot()}api/user-reporting/error`;
} else {
url = `${getAppRoot()}api/jobs/${dataset.creating_job}/error`;
}
const url = `${getAppRoot()}api/jobs/${dataset.creating_job}/error`;
try {
const { data } = await axios.post(url, payload);
return data.messages;
Expand Down
42 changes: 11 additions & 31 deletions client/src/components/Tool/ToolForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
<ToolEntryPoints v-for="job in entryPoints" :key="job.id" :job-id="job.id" />
</div>
<b-modal v-model="showError" size="sm" :title="errorTitle | l" scrollable ok-only>
<UserReportingError
:result-messages="[]"
:show-form="'true'"
:message="''"
:transcript="errorContentPretty"
:command-outputs="buildCommandOutputs(errorMessage)"
:notifications="buildNotifications(formConfig.id)" />
<b-alert v-if="errorMessage" show variant="danger">
{{ errorMessage }}
</b-alert>
<b-alert show variant="warning">
The server could not complete this request. Please verify your parameter settings, retry submission and
contact the Galaxy Team if this error persists. A transcript of the submitted data is shown below.
</b-alert>
<small class="text-muted">
<pre>{{ errorContentPretty }}</pre>
</small>
</b-modal>
<ToolRecommendation v-if="showRecommendation" :tool-id="formConfig.id" />
<ToolCard
Expand Down Expand Up @@ -117,14 +120,12 @@ import { refreshContentsWrapper } from "utils/data";
import { useConfigStore } from "@/stores/configurationStore";
import { useHistoryStore } from "@/stores/historyStore";
import { useUserStore } from "@/stores/userStore";
import { errorMessageAsString } from "@/utils/simple-error";
import ToolRecommendation from "../ToolRecommendation";
import { getToolFormData, submitJob, updateToolFormData } from "./services";
import ToolCard from "./ToolCard";
import { allowCachedJobs } from "./utilities";
import UserReportingError from "../Common/UserReportingError.vue";
import FormSelect from "@/components/Form/Elements/FormSelect.vue";
export default {
Expand All @@ -138,7 +139,6 @@ export default {
ToolEntryPoints,
ToolRecommendation,
Heading,
UserReportingError,
},
props: {
id: {
Expand Down Expand Up @@ -380,7 +380,7 @@ export default {
}
},
(e) => {
this.errorMessage = errorMessageAsString(e);
this.errorMessage = e?.response?.data?.err_msg;
this.showExecuting = false;
let genericError = true;
const errorData = e && e.response && e.response.data && e.response.data.err_data;
Expand All @@ -399,26 +399,6 @@ export default {
}
);
},
buildNotifications(toolId) {
return [
{
text: `An error occurred while running the tool <b id='dataset-error-tool-id' class='text-break '>${toolId}</b>.`,
variant: "danger",
},
{
text: `The server could not complete this request. Please verify your parameter settings, retry submission and contact the Galaxy team if this error persists. A transcript of the submitted data is shown below.`,
variant: "warning",
},
];
},
buildCommandOutputs(detail) {
return [
{
text: "Tool Message (?)",
detail: [detail],
},
];
},
},
};
</script>
31 changes: 0 additions & 31 deletions lib/galaxy/schema/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -3657,34 +3657,3 @@ class DatasetSummary(Model):
file_size: int
total_size: int
uuid: UuidField


class UserReportingErrorPayload(Model):
dataset_id: Optional[DecodedDatabaseIdField] = Field(
default={},
title="History Dataset Association ID",
description="The History Dataset Association ID related to the error.",
)
message: Optional[str] = Field(
default=None,
title="Message",
description="The optional message sent with the error report.",
)
email: Optional[str] = Field(
default=None,
title="Email",
description="Email address for communication with the user. Only required for anonymous users.",
)
transcript: Optional[str] = Field(
default=None,
title="Transcript",
description="The optional tool transcript sent with the error report.",
)


class UserReportingErrorSummary(Model):
messages: List[List[str]] = Field(
default=...,
title="Error messages",
description="The error messages for the specified job.",
)
3 changes: 1 addition & 2 deletions lib/galaxy/tools/error_reports/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ def _can_access_dataset(self, dataset, user):
roles = []
return self.app.security_agent.can_access_dataset(roles, dataset.dataset)

def submit_report(self, dataset, job, tool, user_submission=False, **kwargs):
user = kwargs.get("user")
def submit_report(self, dataset, job, tool, user=None, user_submission=False, **kwargs):
if user_submission:
assert self._can_access_dataset(dataset, user), Exception("You are not allowed to access this dataset.")

Expand Down
17 changes: 2 additions & 15 deletions lib/galaxy/tools/error_reports/plugins/email.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,12 @@ def __init__(self, **kwargs):

def submit_report(self, dataset, job, tool, **kwargs):
"""Send report as an email"""
data_uid = None
try:
report_type = kwargs.get("report_type")
transcript = kwargs.get("transcript")
if report_type == "dataset":
data_uid = dataset.id
user = job.get_user()
elif report_type == "tool":
data_uid = dataset
user = kwargs.get("user")

error_reporter = EmailErrorReporter(data_uid, self.app, report_type)
error_reporter = EmailErrorReporter(dataset.id, self.app)
error_reporter.send_report(
user=user,
user=job.get_user(),
email=kwargs.get("email", None),
message=kwargs.get("message", None),
report_type=report_type,
tool=tool,
transcript=transcript,
redact_user_details_in_bugreport=self.redact_user_details_in_bugreport,
)
return ("Your error report has been sent", "success")
Expand Down
Loading

0 comments on commit d1cbee0

Please sign in to comment.