mirror of https://github.com/Lissy93/dashy.git
⚡ Improved widget error handling, don't fail on error
This commit is contained in:
parent
cf98a96a15
commit
bf39553e1d
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div :class="`widget-base ${ loading ? 'is-loading' : '' }`">
|
<div :class="`widget-base ${ loading ? 'is-loading' : '' }`">
|
||||||
<!-- Update and Full-Page Action Buttons -->
|
<!-- Update and Full-Page Action Buttons -->
|
||||||
<Button :click="update" class="action-btn update-btn" v-if="!error && !loading">
|
<Button :click="update" class="action-btn update-btn" v-if="!loading">
|
||||||
<UpdateIcon />
|
<UpdateIcon />
|
||||||
</Button>
|
</Button>
|
||||||
<Button :click="fullScreenWidget" class="action-btn open-btn" v-if="!error && !loading">
|
<Button :click="fullScreenWidget" class="action-btn open-btn" v-if="!error && !loading">
|
||||||
|
@ -15,9 +15,10 @@
|
||||||
<div v-if="error" class="widget-error">
|
<div v-if="error" class="widget-error">
|
||||||
<p class="error-msg">An error occurred, see the logs for more info.</p>
|
<p class="error-msg">An error occurred, see the logs for more info.</p>
|
||||||
<p class="error-output">{{ errorMsg }}</p>
|
<p class="error-output">{{ errorMsg }}</p>
|
||||||
|
<p class="retry-link" @click="update">Retry</p>
|
||||||
</div>
|
</div>
|
||||||
<!-- Widget -->
|
<!-- Widget -->
|
||||||
<div v-else class="widget-wrap">
|
<div :class="`widget-wrap ${ error ? 'has-error' : '' }`">
|
||||||
<AnonAddy
|
<AnonAddy
|
||||||
v-if="widgetType === 'anonaddy'"
|
v-if="widgetType === 'anonaddy'"
|
||||||
:options="widgetOptions"
|
:options="widgetOptions"
|
||||||
|
@ -460,6 +461,7 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
/* Calls update data method on widget */
|
/* Calls update data method on widget */
|
||||||
update() {
|
update() {
|
||||||
|
this.error = false;
|
||||||
this.$refs[this.widgetRef].update();
|
this.$refs[this.widgetRef].update();
|
||||||
},
|
},
|
||||||
/* Shows message when error occurred */
|
/* Shows message when error occurred */
|
||||||
|
@ -507,6 +509,15 @@ export default {
|
||||||
right: 1.75rem;
|
right: 1.75rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.widget-wrap {
|
||||||
|
&.has-error {
|
||||||
|
cursor: not-allowed;
|
||||||
|
opacity: 0.5;
|
||||||
|
border-radius: var(--curve-factor);
|
||||||
|
background: #ffff0080;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Error message output
|
// Error message output
|
||||||
.widget-error {
|
.widget-error {
|
||||||
p.error-msg {
|
p.error-msg {
|
||||||
|
@ -521,6 +532,13 @@ export default {
|
||||||
font-size: 0.85rem;
|
font-size: 0.85rem;
|
||||||
margin: 0.5rem auto;
|
margin: 0.5rem auto;
|
||||||
}
|
}
|
||||||
|
p.retry-link {
|
||||||
|
cursor: pointer;
|
||||||
|
text-decoration: underline;
|
||||||
|
color: var(--widget-text-color);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Loading spinner
|
// Loading spinner
|
||||||
.loading {
|
.loading {
|
||||||
|
|
Loading…
Reference in New Issue