From 31995aa918e2683256c2f817d81c0fc892939486 Mon Sep 17 00:00:00 2001 From: Michael Foiani Date: Thu, 18 Aug 2022 16:17:31 +0200 Subject: add option to select labels for bug. other style changes and bug fixes. --- src/client/util/ReportManager.scss | 19 ++++++++++++++++ src/client/util/ReportManager.tsx | 46 +++++++++++++++++++++++++++++++++----- 2 files changed, 60 insertions(+), 5 deletions(-) (limited to 'src/client/util') diff --git a/src/client/util/ReportManager.scss b/src/client/util/ReportManager.scss index 4bcbdc566..5a2f2fcad 100644 --- a/src/client/util/ReportManager.scss +++ b/src/client/util/ReportManager.scss @@ -67,3 +67,22 @@ .loading-center { margin: auto 0; } + +.settings-content label { + margin-top: 10px; +} + +.report-disclaimer { + font-size: 8px; + color: grey; + padding-right: 50px; + font-style: italic; + text-align: left; +} + +.flex-select { + display: flex; + align-items: center; + justify-content: center; + gap: 10px; +} diff --git a/src/client/util/ReportManager.tsx b/src/client/util/ReportManager.tsx index 223c7ff7d..ed9a4fc89 100644 --- a/src/client/util/ReportManager.tsx +++ b/src/client/util/ReportManager.tsx @@ -79,6 +79,10 @@ export class ReportManager extends React.Component<{}> { @action setBugTitle = action((title: string) => { this.bugTitle = title; }); @observable private bugDescription = ''; @action setBugDescription = action((description: string) => { this.bugDescription = description; }); + @observable private bugType = ''; + @action setBugType = action((type: string) => { this.bugType = type; }); + @observable private bugPriority = ''; + @action setBugPriority = action((priortiy: string) => { this.bugPriority = priortiy; }); // private toGithub = false; // will always be set to true - no alterntive option yet @@ -101,6 +105,13 @@ export class ReportManager extends React.Component<{}> { } public async reportIssue() { + if (this.bugTitle === '' || this.bugDescription === '' + || this.bugType === '' || this.bugPriority === '') { + alert('Please fill out all required fields to report an issue.'); + return; + } + + if (this.toGithub) { const req = await this.octokit.request('POST /repos/{owner}/{repo}/issues', { @@ -110,6 +121,8 @@ export class ReportManager extends React.Component<{}> { body: `${this.bugDescription} \n\nfileLinks:\n${(this.fileLinks ?? []).join('\n')}`, labels: [ 'from-dash-app', + this.bugType, + this.bugPriority ] }); @@ -124,11 +137,13 @@ export class ReportManager extends React.Component<{}> { // if not going to github issues, not sure what to do yet... } - // if we're down here, then we're good to go. + // if we're down here, then we're good to go. reset the fields. this.setBugTitle(''); this.setBugDescription(''); this.toGithub = false; - this.setFileLinks([]) + this.setFileLinks([]); + this.setBugType(''); + this.setBugPriority(''); this.close(); } @@ -138,6 +153,7 @@ export class ReportManager extends React.Component<{}> { private getServerPath = (link: any) => { return link.result.accessPaths.agnostic.server } private uploadFiles = (input: any) => { + // keep null while uploading this.setFileLinks(null); // upload the files to the server if (input.files && input.files.length !== 0) { @@ -164,17 +180,36 @@ export class ReportManager extends React.Component<{}> {