mirror of
https://github.com/Lissy93/dashy.git
synced 2025-07-25 14:44:49 +02:00
added gluetun service status widget
This commit is contained in:
parent
55bde6c78a
commit
8d22d88471
@ -55,6 +55,7 @@ Dashy has support for displaying dynamic content in the form of widgets. There a
|
|||||||
- [Nextcloud Stats](#nextcloud-stats)
|
- [Nextcloud Stats](#nextcloud-stats)
|
||||||
- [Nextcloud PHP Opcache](#nextcloud-php-opcache-stats)
|
- [Nextcloud PHP Opcache](#nextcloud-php-opcache-stats)
|
||||||
- [Sabnzbd](#sabnzbd)
|
- [Sabnzbd](#sabnzbd)
|
||||||
|
- [Gluetun VPN Info](#gluetun-vpn-info)
|
||||||
- **[System Resource Monitoring](#system-resource-monitoring)**
|
- **[System Resource Monitoring](#system-resource-monitoring)**
|
||||||
- [CPU Usage Current](#current-cpu-usage)
|
- [CPU Usage Current](#current-cpu-usage)
|
||||||
- [CPU Usage Per Core](#cpu-usage-per-core)
|
- [CPU Usage Per Core](#cpu-usage-per-core)
|
||||||
@ -1827,6 +1828,39 @@ Shows queue information regarding your self hosted Sabnzbd server.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### Gluetun VPN Info
|
||||||
|
|
||||||
|
Display info from the Gluetun VPN container public IP API. This can show the IP and location data for the exit VPN node.
|
||||||
|
|
||||||
|
<p align="center"><img width="380" src="https://imgur.com/TOtYZ7k" /></p>
|
||||||
|
|
||||||
|
##### Options
|
||||||
|
|
||||||
|
**Field** | **Type** | **Required** | **Description**
|
||||||
|
--- | --- | --- | ---
|
||||||
|
**`visibleFields`** | `string` | Required | A comma separated list of the fields you want visible in the widget. You can have any number of the following : `public_ip`, `region`, `country`, `city`, `location`, `organisation`, `postal_code`, `timezone`
|
||||||
|
**`host`** | `string` | Required | The url to the gluetun HTTP control server. E.g. `http://gluetun:8000`
|
||||||
|
|
||||||
|
|
||||||
|
##### Example
|
||||||
|
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- type: gluetun-status
|
||||||
|
useProxy: true
|
||||||
|
options:
|
||||||
|
hostname: http://server-or-conatiner-hostname:8000
|
||||||
|
visibleFields: public_ip,region,country,city,location,organisation,postal_code,timezone
|
||||||
|
```
|
||||||
|
##### Info
|
||||||
|
- **CORS**: 🟠 Proxied
|
||||||
|
- **Auth**: 🟢 Required
|
||||||
|
- **Price**: 🟢 Free
|
||||||
|
- **Host**: Self-Hosted (see [Gluetun](https://github.com/qdm12/gluetun))
|
||||||
|
- **Privacy**: _See [Gluetun Wiki](https://github.com/qdm12/gluetun/wiki)_
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## System Resource Monitoring
|
## System Resource Monitoring
|
||||||
|
|
||||||
The easiest method for displaying system info and resource usage in Dashy is with [Glances](https://nicolargo.github.io/glances/).
|
The easiest method for displaying system info and resource usage in Dashy is with [Glances](https://nicolargo.github.io/glances/).
|
||||||
|
121
src/components/Widgets/GluetunStatus.vue
Executable file
121
src/components/Widgets/GluetunStatus.vue
Executable file
@ -0,0 +1,121 @@
|
|||||||
|
<template>
|
||||||
|
<div class="vpn-ip-addr-wrapper">
|
||||||
|
<div class="ip-row public-ip" v-if="public_ipT">
|
||||||
|
<span class="lbl">VPN IP</span>
|
||||||
|
<span class="val">{{ public_ip }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="ip-row" v-if="regionT">
|
||||||
|
<span class="lbl">Region</span>
|
||||||
|
<span class="val">{{ region }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="ip-row" v-if="countryT">
|
||||||
|
<span class="lbl">Country</span>
|
||||||
|
<span class="val">{{ country }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="ip-row" v-if="cityT">
|
||||||
|
<span class="lbl">City</span>
|
||||||
|
<span class="val">{{ city }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="ip-row" v-if="postal_codeT">
|
||||||
|
<span class="lbl">Post Code</span>
|
||||||
|
<span class="val">{{ postal_code }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="ip-row" v-if="locationT">
|
||||||
|
<span class="lbl">Location</span>
|
||||||
|
<span class="val">{{ location }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="ip-row" v-if="timezoneT">
|
||||||
|
<span class="lbl">Timezone</span>
|
||||||
|
<span class="val">{{ timezone }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="ip-row" v-if="organizationT">
|
||||||
|
<span class="lbl">Organization</span>
|
||||||
|
<span class="val">{{ organization }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import WidgetMixin from '@/mixins/WidgetMixin';
|
||||||
|
import { widgetApiEndpoints } from '@/utils/defaults';
|
||||||
|
import { getCountryFlag, getMapUrl } from '@/utils/MiscHelpers';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
mixins: [WidgetMixin],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
public_ip: null,
|
||||||
|
region: null,
|
||||||
|
country: null,
|
||||||
|
city: null,
|
||||||
|
location: null,
|
||||||
|
organization: null,
|
||||||
|
postal_code: null,
|
||||||
|
timezone: null,
|
||||||
|
public_ipT: null,
|
||||||
|
regionT: null,
|
||||||
|
countryT: null,
|
||||||
|
cityT: null,
|
||||||
|
locationT: null,
|
||||||
|
organizationT: null,
|
||||||
|
postal_codeT: null,
|
||||||
|
timezoneT: null,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/* Make GET request to Gluetun publicip API endpoint */
|
||||||
|
fetchData() {
|
||||||
|
this.processToggles(this.options.visibleFields);
|
||||||
|
this.makeRequest(this.options.hostname + "/v1/publicip/ip").then(this.processData);
|
||||||
|
},
|
||||||
|
/* Assign data variables to the returned data */
|
||||||
|
processData(ipInfo) {
|
||||||
|
this.public_ip = ipInfo.public_ip;
|
||||||
|
this.region = ipInfo.region;
|
||||||
|
this.country = ipInfo.country;
|
||||||
|
this.city = ipInfo.city;
|
||||||
|
this.location = ipInfo.location;
|
||||||
|
this.organization = ipInfo.organization;
|
||||||
|
this.postal_code = ipInfo.postal_code;
|
||||||
|
this.timezone = ipInfo.timezone;
|
||||||
|
},
|
||||||
|
processToggles(toggles) {
|
||||||
|
var fields = toggles.split(",");
|
||||||
|
this.public_ipT = fields.includes("public_ip");
|
||||||
|
this.regionT = fields.includes("region");
|
||||||
|
this.countryT = fields.includes("country");
|
||||||
|
this.cityT = fields.includes("city");
|
||||||
|
this.locationT = fields.includes("location");
|
||||||
|
this.organizationT = fields.includes("organization");
|
||||||
|
this.postal_codeT = fields.includes("postal_code");
|
||||||
|
this.timezoneT = fields.includes("timezone");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.vpn-ip-addr-wrapper {
|
||||||
|
.ip-row {
|
||||||
|
display: flex;
|
||||||
|
padding: 0.1rem 0.1rem 0.5rem 0.1rem;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
color: var(--widget-text-color);
|
||||||
|
max-width: 400px;
|
||||||
|
margin: 0.5rem auto;
|
||||||
|
span.lbl {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
span.val {
|
||||||
|
font-family: var(--font-monospace);
|
||||||
|
}
|
||||||
|
&:not(.public-ip) {
|
||||||
|
opacity: var(--dimming-factor);
|
||||||
|
}
|
||||||
|
&:not(:last-child) {
|
||||||
|
border-bottom: 1px dashed var(--widget-text-color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
557
src/components/Widgets/WidgetBase.vue
Normal file → Executable file
557
src/components/Widgets/WidgetBase.vue
Normal file → Executable file
@ -1,278 +1,279 @@
|
|||||||
<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="!hideControls && !loading">
|
<Button :click="update" class="action-btn update-btn" v-if="!hideControls && !loading">
|
||||||
<UpdateIcon />
|
<UpdateIcon />
|
||||||
</Button>
|
</Button>
|
||||||
<Button :click="fullScreenWidget"
|
<Button :click="fullScreenWidget"
|
||||||
class="action-btn open-btn" v-if="!hideControls && !error && !loading">
|
class="action-btn open-btn" v-if="!hideControls && !error && !loading">
|
||||||
<OpenIcon />
|
<OpenIcon />
|
||||||
</Button>
|
</Button>
|
||||||
<!-- Loading Spinner -->
|
<!-- Loading Spinner -->
|
||||||
<div v-if="loading" class="loading">
|
<div v-if="loading" class="loading">
|
||||||
<LoadingAnimation v-if="loading" class="loader" />
|
<LoadingAnimation v-if="loading" class="loader" />
|
||||||
</div>
|
</div>
|
||||||
<!-- Error Message Display -->
|
<!-- Error Message Display -->
|
||||||
<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>
|
<p class="retry-link" @click="update">Retry</p>
|
||||||
</div>
|
</div>
|
||||||
<!-- Widget Label -->
|
<!-- Widget Label -->
|
||||||
<div class="widget-label" v-if="widgetOptions.label">{{ widgetOptions.label }}</div>
|
<div class="widget-label" v-if="widgetOptions.label">{{ widgetOptions.label }}</div>
|
||||||
<!-- Widget -->
|
<!-- Widget -->
|
||||||
<div :class="`widget-wrap ${ error ? 'has-error' : '' }`">
|
<div :class="`widget-wrap ${ error ? 'has-error' : '' }`">
|
||||||
<component
|
<component
|
||||||
v-bind:is="component"
|
v-bind:is="component"
|
||||||
:options="widgetOptions"
|
:options="widgetOptions"
|
||||||
@loading="setLoaderState"
|
@loading="setLoaderState"
|
||||||
@error="handleError"
|
@error="handleError"
|
||||||
:ref="widgetRef"
|
:ref="widgetRef"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Import form elements, icons and utils
|
// Import form elements, icons and utils
|
||||||
import ErrorHandler from '@/utils/ErrorHandler';
|
import ErrorHandler from '@/utils/ErrorHandler';
|
||||||
import Button from '@/components/FormElements/Button';
|
import Button from '@/components/FormElements/Button';
|
||||||
import UpdateIcon from '@/assets/interface-icons/widget-update.svg';
|
import UpdateIcon from '@/assets/interface-icons/widget-update.svg';
|
||||||
import OpenIcon from '@/assets/interface-icons/open-new-tab.svg';
|
import OpenIcon from '@/assets/interface-icons/open-new-tab.svg';
|
||||||
import LoadingAnimation from '@/assets/interface-icons/loader.svg';
|
import LoadingAnimation from '@/assets/interface-icons/loader.svg';
|
||||||
|
|
||||||
const COMPAT = {
|
const COMPAT = {
|
||||||
'adguard-dns-info': 'AdGuardDnsInfo',
|
'adguard-dns-info': 'AdGuardDnsInfo',
|
||||||
'adguard-filter-status': 'AdGuardFilterStatus',
|
'adguard-filter-status': 'AdGuardFilterStatus',
|
||||||
'adguard-stats': 'AdGuardStats',
|
'adguard-stats': 'AdGuardStats',
|
||||||
'adguard-top-domains': 'AdGuardTopDomains',
|
'adguard-top-domains': 'AdGuardTopDomains',
|
||||||
anonaddy: 'AnonAddy',
|
anonaddy: 'AnonAddy',
|
||||||
apod: 'Apod',
|
apod: 'Apod',
|
||||||
'blacklist-check': 'BlacklistCheck',
|
'blacklist-check': 'BlacklistCheck',
|
||||||
clock: 'Clock',
|
clock: 'Clock',
|
||||||
'crypto-price-chart': 'CryptoPriceChart',
|
'crypto-price-chart': 'CryptoPriceChart',
|
||||||
'crypto-watch-list': 'CryptoWatchList',
|
'crypto-watch-list': 'CryptoWatchList',
|
||||||
'cve-vulnerabilities': 'CveVulnerabilities',
|
'cve-vulnerabilities': 'CveVulnerabilities',
|
||||||
'domain-monitor': 'DomainMonitor',
|
'domain-monitor': 'DomainMonitor',
|
||||||
'code-stats': 'CodeStats',
|
'code-stats': 'CodeStats',
|
||||||
'covid-stats': 'CovidStats',
|
'covid-stats': 'CovidStats',
|
||||||
embed: 'EmbedWidget',
|
embed: 'EmbedWidget',
|
||||||
'eth-gas-prices': 'EthGasPrices',
|
'eth-gas-prices': 'EthGasPrices',
|
||||||
'exchange-rates': 'ExchangeRates',
|
'exchange-rates': 'ExchangeRates',
|
||||||
'flight-data': 'Flights',
|
'flight-data': 'Flights',
|
||||||
'github-profile-stats': 'GitHubProfile',
|
'github-profile-stats': 'GitHubProfile',
|
||||||
'github-trending-repos': 'GitHubTrending',
|
'github-trending-repos': 'GitHubTrending',
|
||||||
'gl-alerts': 'GlAlerts',
|
'gl-alerts': 'GlAlerts',
|
||||||
'gl-current-cores': 'GlCpuCores',
|
'gl-current-cores': 'GlCpuCores',
|
||||||
'gl-current-cpu': 'GlCpuGauge',
|
'gl-current-cpu': 'GlCpuGauge',
|
||||||
'gl-cpu-history': 'GlCpuHistory',
|
'gl-cpu-history': 'GlCpuHistory',
|
||||||
'gl-disk-io': 'GlDiskIo',
|
'gl-disk-io': 'GlDiskIo',
|
||||||
'gl-disk-space': 'GlDiskSpace',
|
'gl-disk-space': 'GlDiskSpace',
|
||||||
'gl-ip-address': 'GlIpAddress',
|
'gl-ip-address': 'GlIpAddress',
|
||||||
'gl-load-history': 'GlLoadHistory',
|
'gl-load-history': 'GlLoadHistory',
|
||||||
'gl-current-mem': 'GlMemGauge',
|
'gl-current-mem': 'GlMemGauge',
|
||||||
'gl-mem-history': 'GlMemHistory',
|
'gl-mem-history': 'GlMemHistory',
|
||||||
'gl-network-interfaces': 'GlNetworkInterfaces',
|
'gl-network-interfaces': 'GlNetworkInterfaces',
|
||||||
'gl-network-traffic': 'GlNetworkTraffic',
|
'gl-network-traffic': 'GlNetworkTraffic',
|
||||||
'gl-system-load': 'GlSystemLoad',
|
'gl-system-load': 'GlSystemLoad',
|
||||||
'gl-cpu-temp': 'GlCpuTemp',
|
'gl-cpu-temp': 'GlCpuTemp',
|
||||||
'health-checks': 'HealthChecks',
|
'health-checks': 'HealthChecks',
|
||||||
iframe: 'IframeWidget',
|
'gluetun-status': 'GluetunStatus',
|
||||||
image: 'ImageWidget',
|
iframe: 'IframeWidget',
|
||||||
joke: 'Jokes',
|
image: 'ImageWidget',
|
||||||
'mullvad-status': 'MullvadStatus',
|
joke: 'Jokes',
|
||||||
'nd-cpu-history': 'NdCpuHistory',
|
'mullvad-status': 'MullvadStatus',
|
||||||
'nd-load-history': 'NdLoadHistory',
|
'nd-cpu-history': 'NdCpuHistory',
|
||||||
'nd-ram-history': 'NdRamHistory',
|
'nd-load-history': 'NdLoadHistory',
|
||||||
'news-headlines': 'NewsHeadlines',
|
'nd-ram-history': 'NdRamHistory',
|
||||||
'nextcloud-notifications': 'NextcloudNotifications',
|
'news-headlines': 'NewsHeadlines',
|
||||||
'nextcloud-php-opcache': 'NextcloudPhpOpcache',
|
'nextcloud-notifications': 'NextcloudNotifications',
|
||||||
'nextcloud-stats': 'NextcloudStats',
|
'nextcloud-php-opcache': 'NextcloudPhpOpcache',
|
||||||
'nextcloud-system': 'NextcloudSystem',
|
'nextcloud-stats': 'NextcloudStats',
|
||||||
'nextcloud-user': 'NextcloudUser',
|
'nextcloud-system': 'NextcloudSystem',
|
||||||
'nextcloud-user-status': 'NextcloudUserStatus',
|
'nextcloud-user': 'NextcloudUser',
|
||||||
'pi-hole-stats': 'PiHoleStats',
|
'nextcloud-user-status': 'NextcloudUserStatus',
|
||||||
'pi-hole-top-queries': 'PiHoleTopQueries',
|
'pi-hole-stats': 'PiHoleStats',
|
||||||
'pi-hole-traffic': 'PiHoleTraffic',
|
'pi-hole-top-queries': 'PiHoleTopQueries',
|
||||||
'public-holidays': 'PublicHolidays',
|
'pi-hole-traffic': 'PiHoleTraffic',
|
||||||
'public-ip': 'PublicIp',
|
'public-holidays': 'PublicHolidays',
|
||||||
'rss-feed': 'RssFeed',
|
'public-ip': 'PublicIp',
|
||||||
sabnzbd: 'Sabnzbd',
|
'rss-feed': 'RssFeed',
|
||||||
'sports-scores': 'SportsScores',
|
sabnzbd: 'Sabnzbd',
|
||||||
'stat-ping': 'StatPing',
|
'sports-scores': 'SportsScores',
|
||||||
'stock-price-chart': 'StockPriceChart',
|
'stat-ping': 'StatPing',
|
||||||
'synology-download': 'SynologyDownload',
|
'stock-price-chart': 'StockPriceChart',
|
||||||
'system-info': 'SystemInfo',
|
'synology-download': 'SynologyDownload',
|
||||||
'tfl-status': 'TflStatus',
|
'system-info': 'SystemInfo',
|
||||||
'wallet-balance': 'WalletBalance',
|
'tfl-status': 'TflStatus',
|
||||||
weather: 'Weather',
|
'wallet-balance': 'WalletBalance',
|
||||||
'weather-forecast': 'WeatherForecast',
|
weather: 'Weather',
|
||||||
'xkcd-comic': 'XkcdComic',
|
'weather-forecast': 'WeatherForecast',
|
||||||
};
|
'xkcd-comic': 'XkcdComic',
|
||||||
|
};
|
||||||
export default {
|
|
||||||
name: 'Widget',
|
export default {
|
||||||
components: {
|
name: 'Widget',
|
||||||
// Register form elements
|
components: {
|
||||||
Button,
|
// Register form elements
|
||||||
UpdateIcon,
|
Button,
|
||||||
OpenIcon,
|
UpdateIcon,
|
||||||
LoadingAnimation,
|
OpenIcon,
|
||||||
},
|
LoadingAnimation,
|
||||||
props: {
|
},
|
||||||
widget: Object,
|
props: {
|
||||||
index: Number,
|
widget: Object,
|
||||||
},
|
index: Number,
|
||||||
data: () => ({
|
},
|
||||||
loading: false,
|
data: () => ({
|
||||||
error: false,
|
loading: false,
|
||||||
errorMsg: null,
|
error: false,
|
||||||
}),
|
errorMsg: null,
|
||||||
computed: {
|
}),
|
||||||
appConfig() {
|
computed: {
|
||||||
return this.$store.getters.appConfig;
|
appConfig() {
|
||||||
},
|
return this.$store.getters.appConfig;
|
||||||
/* Returns the widget type, shows error if not specified */
|
},
|
||||||
widgetType() {
|
/* Returns the widget type, shows error if not specified */
|
||||||
if (!this.widget.type) {
|
widgetType() {
|
||||||
ErrorHandler('Missing type attribute for widget');
|
if (!this.widget.type) {
|
||||||
return null;
|
ErrorHandler('Missing type attribute for widget');
|
||||||
}
|
return null;
|
||||||
return this.widget.type.toLowerCase();
|
}
|
||||||
},
|
return this.widget.type.toLowerCase();
|
||||||
/* Returns users specified widget options, or empty object */
|
},
|
||||||
widgetOptions() {
|
/* Returns users specified widget options, or empty object */
|
||||||
const options = this.widget.options || {};
|
widgetOptions() {
|
||||||
const timeout = this.widget.timeout || null;
|
const options = this.widget.options || {};
|
||||||
const ignoreErrors = this.widget.ignoreErrors || false;
|
const timeout = this.widget.timeout || null;
|
||||||
const label = this.widget.label || null;
|
const ignoreErrors = this.widget.ignoreErrors || false;
|
||||||
const useProxy = this.appConfig.widgetsAlwaysUseProxy || !!this.widget.useProxy;
|
const label = this.widget.label || null;
|
||||||
const updateInterval = this.widget.updateInterval !== undefined
|
const useProxy = this.appConfig.widgetsAlwaysUseProxy || !!this.widget.useProxy;
|
||||||
? this.widget.updateInterval : null;
|
const updateInterval = this.widget.updateInterval !== undefined
|
||||||
return {
|
? this.widget.updateInterval : null;
|
||||||
timeout, ignoreErrors, label, useProxy, updateInterval, ...options,
|
return {
|
||||||
};
|
timeout, ignoreErrors, label, useProxy, updateInterval, ...options,
|
||||||
},
|
};
|
||||||
/* A unique string to reference the widget by */
|
},
|
||||||
widgetRef() {
|
/* A unique string to reference the widget by */
|
||||||
return `widget-${this.widgetType}-${this.index}`;
|
widgetRef() {
|
||||||
},
|
return `widget-${this.widgetType}-${this.index}`;
|
||||||
hideControls() {
|
},
|
||||||
return this.widget.hideControls;
|
hideControls() {
|
||||||
},
|
return this.widget.hideControls;
|
||||||
component() {
|
},
|
||||||
const type = COMPAT[this.widgetType] || this.widget.type;
|
component() {
|
||||||
if (!type) {
|
const type = COMPAT[this.widgetType] || this.widget.type;
|
||||||
ErrorHandler('Widget type was not found');
|
if (!type) {
|
||||||
return null;
|
ErrorHandler('Widget type was not found');
|
||||||
}
|
return null;
|
||||||
// eslint-disable-next-line prefer-template
|
}
|
||||||
return () => import('@/components/Widgets/' + type + '.vue').catch(() => import('@/components/Widgets/Blank.vue'));
|
// eslint-disable-next-line prefer-template
|
||||||
},
|
return () => import('@/components/Widgets/' + type + '.vue').catch(() => import('@/components/Widgets/Blank.vue'));
|
||||||
},
|
},
|
||||||
methods: {
|
},
|
||||||
/* Calls update data method on widget */
|
methods: {
|
||||||
update() {
|
/* Calls update data method on widget */
|
||||||
this.error = false;
|
update() {
|
||||||
this.$refs[this.widgetRef].update();
|
this.error = false;
|
||||||
},
|
this.$refs[this.widgetRef].update();
|
||||||
/* Shows message when error occurred */
|
},
|
||||||
handleError(msg) {
|
/* Shows message when error occurred */
|
||||||
this.error = true;
|
handleError(msg) {
|
||||||
this.errorMsg = msg;
|
this.error = true;
|
||||||
},
|
this.errorMsg = msg;
|
||||||
/* Opens current widget in full-page */
|
},
|
||||||
fullScreenWidget() {
|
/* Opens current widget in full-page */
|
||||||
this.$emit('navigateToSection');
|
fullScreenWidget() {
|
||||||
},
|
this.$emit('navigateToSection');
|
||||||
/* Toggles loading state */
|
},
|
||||||
setLoaderState(loading) {
|
/* Toggles loading state */
|
||||||
this.loading = loading;
|
setLoaderState(loading) {
|
||||||
},
|
this.loading = loading;
|
||||||
},
|
},
|
||||||
};
|
},
|
||||||
</script>
|
};
|
||||||
|
</script>
|
||||||
<style scoped lang="scss">
|
|
||||||
@import '@/styles/media-queries.scss';
|
<style scoped lang="scss">
|
||||||
.widget-base {
|
@import '@/styles/media-queries.scss';
|
||||||
position: relative;
|
.widget-base {
|
||||||
padding: 0.75rem 0.5rem 0.5rem 0.5rem;
|
position: relative;
|
||||||
background: var(--widget-base-background);
|
padding: 0.75rem 0.5rem 0.5rem 0.5rem;
|
||||||
box-shadow: var(--widget-base-shadow, none);
|
background: var(--widget-base-background);
|
||||||
// Refresh and full-page action buttons
|
box-shadow: var(--widget-base-shadow, none);
|
||||||
button.action-btn {
|
// Refresh and full-page action buttons
|
||||||
height: 1rem;
|
button.action-btn {
|
||||||
min-width: auto;
|
height: 1rem;
|
||||||
width: 1.75rem;
|
min-width: auto;
|
||||||
margin: 0;
|
width: 1.75rem;
|
||||||
padding: 0.1rem 0;
|
margin: 0;
|
||||||
position: absolute;
|
padding: 0.1rem 0;
|
||||||
top: 0;
|
position: absolute;
|
||||||
border: none;
|
top: 0;
|
||||||
opacity: var(--dimming-factor);
|
border: none;
|
||||||
color: var(--widget-text-color);
|
opacity: var(--dimming-factor);
|
||||||
&:hover {
|
color: var(--widget-text-color);
|
||||||
opacity: 1;
|
&:hover {
|
||||||
color: var(--widget-background-color);
|
opacity: 1;
|
||||||
}
|
color: var(--widget-background-color);
|
||||||
&.update-btn {
|
}
|
||||||
right: -0.25rem;
|
&.update-btn {
|
||||||
}
|
right: -0.25rem;
|
||||||
&.open-btn {
|
}
|
||||||
right: 1.75rem;
|
&.open-btn {
|
||||||
}
|
right: 1.75rem;
|
||||||
}
|
}
|
||||||
// Optional widget label
|
}
|
||||||
.widget-label {
|
// Optional widget label
|
||||||
color: var(--widget-text-color);
|
.widget-label {
|
||||||
}
|
color: var(--widget-text-color);
|
||||||
// Actual widget container
|
}
|
||||||
.widget-wrap {
|
// Actual widget container
|
||||||
&.has-error {
|
.widget-wrap {
|
||||||
cursor: not-allowed;
|
&.has-error {
|
||||||
opacity: 0.5;
|
cursor: not-allowed;
|
||||||
border-radius: var(--curve-factor);
|
opacity: 0.5;
|
||||||
background: #ffff0040;
|
border-radius: var(--curve-factor);
|
||||||
&:hover { background: none; }
|
background: #ffff0040;
|
||||||
}
|
&:hover { background: none; }
|
||||||
}
|
}
|
||||||
// Error message output
|
}
|
||||||
.widget-error {
|
// Error message output
|
||||||
p.error-msg {
|
.widget-error {
|
||||||
color: var(--warning);
|
p.error-msg {
|
||||||
font-weight: bold;
|
color: var(--warning);
|
||||||
font-size: 1rem;
|
font-weight: bold;
|
||||||
margin: 0 auto 0.5rem auto;
|
font-size: 1rem;
|
||||||
}
|
margin: 0 auto 0.5rem auto;
|
||||||
p.error-output {
|
}
|
||||||
font-family: var(--font-monospace);
|
p.error-output {
|
||||||
color: var(--widget-text-color);
|
font-family: var(--font-monospace);
|
||||||
font-size: 0.85rem;
|
color: var(--widget-text-color);
|
||||||
margin: 0.5rem auto;
|
font-size: 0.85rem;
|
||||||
}
|
margin: 0.5rem auto;
|
||||||
p.retry-link {
|
}
|
||||||
cursor: pointer;
|
p.retry-link {
|
||||||
text-decoration: underline;
|
cursor: pointer;
|
||||||
color: var(--widget-text-color);
|
text-decoration: underline;
|
||||||
font-size: 0.85rem;
|
color: var(--widget-text-color);
|
||||||
margin: 0;
|
font-size: 0.85rem;
|
||||||
}
|
margin: 0;
|
||||||
}
|
}
|
||||||
// Loading spinner
|
}
|
||||||
.loading {
|
// Loading spinner
|
||||||
margin: 0.2rem auto;
|
.loading {
|
||||||
text-align: center;
|
margin: 0.2rem auto;
|
||||||
svg.loader {
|
text-align: center;
|
||||||
width: 100px;
|
svg.loader {
|
||||||
}
|
width: 100px;
|
||||||
}
|
}
|
||||||
// Hide widget contents while loading
|
}
|
||||||
&.is-loading {
|
// Hide widget contents while loading
|
||||||
.widget-wrap {
|
&.is-loading {
|
||||||
display: none;
|
.widget-wrap {
|
||||||
}
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
</style>
|
|
||||||
|
</style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user