aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/components/ContextPopup.vue
diff options
context:
space:
mode:
Diffstat (limited to 'web_src/js/components/ContextPopup.vue')
-rw-r--r--web_src/js/components/ContextPopup.vue28
1 files changed, 20 insertions, 8 deletions
diff --git a/web_src/js/components/ContextPopup.vue b/web_src/js/components/ContextPopup.vue
index efaa7be89e..c002a3d066 100644
--- a/web_src/js/components/ContextPopup.vue
+++ b/web_src/js/components/ContextPopup.vue
@@ -16,13 +16,17 @@
</div>
</div>
</div>
+ <div v-if="!loading && issue === null">
+ <p><small>{{ i18nErrorOccurred }}</small></p>
+ <p>{{ i18nErrorMessage }}</p>
+ </div>
</div>
</template>
<script>
import {SvgIcon} from '../svg.js';
-const {appSubUrl} = window.config;
+const {appSubUrl, i18n} = window.config;
// NOTE: see models/issue_label.go for similar implementation
const srgbToLinear = (color) => {
@@ -49,7 +53,9 @@ export default {
data: () => ({
loading: false,
- issue: null
+ issue: null,
+ i18nErrorOccurred: i18n.error_occurred,
+ i18nErrorMessage: null,
}),
computed: {
@@ -112,14 +118,20 @@ export default {
methods: {
load(data, callback) {
this.loading = true;
- $.get(`${appSubUrl}/api/v1/repos/${data.owner}/${data.repo}/issues/${data.index}`, (issue) => {
+ this.i18nErrorMessage = null;
+ $.get(`${appSubUrl}/api/v1/repos/${data.owner}/${data.repo}/issues/${data.index}`).done((issue) => {
this.issue = issue;
+ }).fail((jqXHR) => {
+ if (jqXHR.responseJSON && jqXHR.responseJSON.message) {
+ this.i18nErrorMessage = jqXHR.responseJSON.message;
+ } else {
+ this.i18nErrorMessage = i18n.network_error;
+ }
+ }).always(() => {
this.loading = false;
- this.$nextTick(() => {
- if (callback) {
- callback();
- }
- });
+ if (callback) {
+ this.$nextTick(callback);
+ }
});
}
}