Skip to content

Commit

Permalink
made issue card reset and resolved #92
Browse files Browse the repository at this point in the history
  • Loading branch information
jabelone committed Jan 10, 2021
1 parent a660cc4 commit 1bedb85
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 48 deletions.
54 changes: 25 additions & 29 deletions frontend/src/components/ReportIssueCard.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
<template>
<div class="q-pa-md">
<div>
<q-card class="submit-issue-card">
<h6 class="q-ma-none q-pa-md">
{{ $t('reportIssue.pageDescription') }}
{{ $t("reportIssue.pageDescription") }}
</h6>

<q-card-section>
<q-form
class="q-gutter-md"
@submit="onSubmit"
>
<q-form ref="form" class="q-gutter-md" @submit="onSubmit">
<q-input
v-model="title"
filled
type="text"
label="Issue Title"
lazy-rules
:rules="[
val => validateNotEmpty(val) || $t('validation.cannotBeEmpty'),
(val) => validateNotEmpty(val) || $t('validation.cannotBeEmpty'),
]"
>
<template v-slot:prepend>
Expand All @@ -33,31 +30,23 @@
autogrow
lazy-rules
:rules="[
val => validateNotEmpty(val) || $t('validation.cannotBeEmpty'),
(val) => validateNotEmpty(val) || $t('validation.cannotBeEmpty'),
]"
>
<template v-slot:prepend>
<q-icon :name="icons.comment" />
</template>
</q-input>

<q-banner
v-if="submitSuccess"
class="bg-positive text-white"
>
{{ $t('reportIssue.success') }}<br>
<a
v-if="issueUrl"
target="_blank"
:href="issueUrl"
>{{ issueUrl }}</a>
<q-banner v-if="submitSuccess" class="bg-positive text-white">
{{ $t("reportIssue.success") }}<br />
<a v-if="issueUrl" target="_blank" :href="issueUrl">{{
issueUrl
}}</a>
</q-banner>

<q-banner
v-if="submitError"
class="bg-negative text-white"
>
{{ $t('reportIssue.fail') }}
<q-banner v-if="submitError" class="bg-negative text-white">
{{ $t("reportIssue.fail") }}
</q-banner>

<div class="row">
Expand Down Expand Up @@ -108,15 +97,22 @@ export default {
this.submitError = false;
this.buttonLoading = true;
this.$axios.post("/api/tools/issue/", {
title: this.title,
description: this.description,
})
this.$axios
.post("/api/tools/issue/", {
title: this.title,
description: this.description,
})
.then((response) => {
if (response.data.success === true) {
this.issueUrl = response.data.url;
this.submitError = false;
this.submitSuccess = true;
this.title = null;
this.description = null;
this.submitError = false;
this.buttonLoading = false;
this.$refs.form.resetValidation();
} else {
this.submitError = true;
this.submitSuccess = false;
Expand All @@ -136,6 +132,6 @@ export default {
</script>

<style lang="sass" scoped>
.submit-issue-card
min-width: $minWidth
.submit-issue-card
min-width: $minWidth
</style>
19 changes: 0 additions & 19 deletions frontend/src/components/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@
<p class="text-h6">
{{ $t("settings.other.title") }}
</p>

<q-btn
color="primary"
:label="$t('settings.other.reloadPage')"
@click="reloadWindow()"
/>
</q-card-section>

<q-card-actions align="right">
Expand All @@ -57,16 +51,8 @@
import icons from "@icons";
import { mapGetters, mapMutations } from "vuex";
import Vue from "vue";
import { Platform } from "quasar";
import formMixin from "../mixins/formMixin";
let getCurrentWindow;
if (Platform.is.electron) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
getCurrentWindow = require("electron").remote.getCurrentWindow;
}
export default {
name: "Settings",
mixins: [formMixin],
Expand Down Expand Up @@ -150,11 +136,6 @@ export default {
? this.$t("settings.rfidScanner.connected")
: this.$t("settings.rfidScanner.disconnected");
},
reloadWindow() {
return Platform.is.electron
? getCurrentWindow().reload()
: window.location.reload();
},
},
};
</script>
Expand Down

0 comments on commit 1bedb85

Please sign in to comment.