diff --git a/src/components/Widgets/WidgetBase.vue b/src/components/Widgets/WidgetBase.vue index 7abb9790..353b2768 100644 --- a/src/components/Widgets/WidgetBase.vue +++ b/src/components/Widgets/WidgetBase.vue @@ -20,463 +20,13 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{{ handleError('Widget type was not found') }}
@@ -489,6 +39,74 @@ import UpdateIcon from '@/assets/interface-icons/widget-update.svg'; import OpenIcon from '@/assets/interface-icons/open-new-tab.svg'; import LoadingAnimation from '@/assets/interface-icons/loader.svg'; +const COMPAT = { + 'adguard-dns-info': 'AdGuardDnsInfo', + 'adguard-filter-status': 'AdGuardFilterStatus', + 'adguard-stats': 'AdGuardStats', + 'adguard-top-domains': 'AdGuardTopDomains', + anonaddy: 'AnonAddy', + apod: 'Apod', + 'blacklist-check': 'BlacklistCheck', + clock: 'Clock', + 'crypto-price-chart': 'CryptoPriceChart', + 'crypto-watch-list': 'CryptoWatchList', + 'cve-vulnerabilities': 'CveVulnerabilities', + 'domain-monitor': 'DomainMonitor', + 'code-stats': 'CodeStats', + 'covid-stats': 'CovidStats', + embed: 'EmbedWidget', + 'eth-gas-prices': 'EthGasPrices', + 'exchange-rates': 'ExchangeRates', + 'flight-data': 'Flights', + 'github-profile-stats': 'GitHubProfile', + 'github-trending-repos': 'GitHubTrending', + 'gl-alerts': 'GlAlerts', + 'gl-current-cores': 'GlCpuCores', + 'gl-current-cpu': 'GlCpuGauge', + 'gl-cpu-history': 'GlCpuHistory', + 'gl-disk-io': 'GlDiskIo', + 'gl-disk-space': 'GlDiskSpace', + 'gl-ip-address': 'GlIpAddress', + 'gl-load-history': 'GlLoadHistory', + 'gl-current-mem': 'GlMemGauge', + 'gl-mem-history': 'GlMemHistory', + 'gl-network-interfaces': 'GlNetworkInterfaces', + 'gl-network-traffic': 'GlNetworkTraffic', + 'gl-system-load': 'GlSystemLoad', + 'gl-cpu-temp': 'GlCpuTemp', + 'health-checks': 'HealthChecks', + iframe: 'IframeWidget', + image: 'ImageWidget', + joke: 'Jokes', + 'mullvad-status': 'MullvadStatus', + 'nd-cpu-history': 'NdCpuHistory', + 'nd-load-history': 'NdLoadHistory', + 'nd-ram-history': 'NdRamHistory', + 'news-headlines': 'NewsHeadlines', + 'nextcloud-notifications': 'NextcloudNotifications', + 'nextcloud-php-opcache': 'NextcloudPhpOpcache', + 'nextcloud-stats': 'NextcloudStats', + 'nextcloud-system': 'NextcloudSystem', + 'nextcloud-user': 'NextcloudUser', + 'nextcloud-user-status': 'NextcloudUserStatus', + 'pi-hole-stats': 'PiHoleStats', + 'pi-hole-top-queries': 'PiHoleTopQueries', + 'pi-hole-traffic': 'PiHoleTraffic', + 'public-holidays': 'PublicHolidays', + 'public-ip': 'PublicIp', + 'rss-feed': 'RssFeed', + 'sports-scores': 'SportsScores', + 'stat-ping': 'StatPing', + 'stock-price-chart': 'StockPriceChart', + 'synology-download': 'SynologyDownload', + 'system-info': 'SystemInfo', + 'tfl-status': 'TflStatus', + 'wallet-balance': 'WalletBalance', + weather: 'Weather', + 'weather-forecast': 'WeatherForecast', + 'xkcd-comic': 'XkcdComic', +}; + export default { name: 'Widget', components: { @@ -497,72 +115,6 @@ export default { UpdateIcon, OpenIcon, LoadingAnimation, - // Register widget components - AdGuardDnsInfo: () => import('@/components/Widgets/AdGuardDnsInfo.vue'), - AdGuardFilterStatus: () => import('@/components/Widgets/AdGuardFilterStatus.vue'), - AdGuardStats: () => import('@/components/Widgets/AdGuardStats.vue'), - AdGuardTopDomains: () => import('@/components/Widgets/AdGuardTopDomains.vue'), - AnonAddy: () => import('@/components/Widgets/AnonAddy.vue'), - Apod: () => import('@/components/Widgets/Apod.vue'), - BlacklistCheck: () => import('@/components/Widgets/BlacklistCheck.vue'), - Clock: () => import('@/components/Widgets/Clock.vue'), - CodeStats: () => import('@/components/Widgets/CodeStats.vue'), - CovidStats: () => import('@/components/Widgets/CovidStats.vue'), - CryptoPriceChart: () => import('@/components/Widgets/CryptoPriceChart.vue'), - CryptoWatchList: () => import('@/components/Widgets/CryptoWatchList.vue'), - CveVulnerabilities: () => import('@/components/Widgets/CveVulnerabilities.vue'), - DomainMonitor: () => import('@/components/Widgets/DomainMonitor.vue'), - EmbedWidget: () => import('@/components/Widgets/EmbedWidget.vue'), - EthGasPrices: () => import('@/components/Widgets/EthGasPrices.vue'), - ExchangeRates: () => import('@/components/Widgets/ExchangeRates.vue'), - Flights: () => import('@/components/Widgets/Flights.vue'), - GitHubTrending: () => import('@/components/Widgets/GitHubTrending.vue'), - GitHubProfile: () => import('@/components/Widgets/GitHubProfile.vue'), - GlAlerts: () => import('@/components/Widgets/GlAlerts.vue'), - GlCpuCores: () => import('@/components/Widgets/GlCpuCores.vue'), - GlCpuGauge: () => import('@/components/Widgets/GlCpuGauge.vue'), - GlCpuHistory: () => import('@/components/Widgets/GlCpuHistory.vue'), - GlDiskIo: () => import('@/components/Widgets/GlDiskIo.vue'), - GlDiskSpace: () => import('@/components/Widgets/GlDiskSpace.vue'), - GlIpAddress: () => import('@/components/Widgets/GlIpAddress.vue'), - GlLoadHistory: () => import('@/components/Widgets/GlLoadHistory.vue'), - GlMemGauge: () => import('@/components/Widgets/GlMemGauge.vue'), - GlMemHistory: () => import('@/components/Widgets/GlMemHistory.vue'), - GlNetworkInterfaces: () => import('@/components/Widgets/GlNetworkInterfaces.vue'), - GlNetworkTraffic: () => import('@/components/Widgets/GlNetworkTraffic.vue'), - GlSystemLoad: () => import('@/components/Widgets/GlSystemLoad.vue'), - GlCpuTemp: () => import('@/components/Widgets/GlCpuTemp.vue'), - HealthChecks: () => import('@/components/Widgets/HealthChecks.vue'), - IframeWidget: () => import('@/components/Widgets/IframeWidget.vue'), - ImageWidget: () => import('@/components/Widgets/ImageWidget.vue'), - Jokes: () => import('@/components/Widgets/Jokes.vue'), - MullvadStatus: () => import('@/components/Widgets/MullvadStatus.vue'), - NdCpuHistory: () => import('@/components/Widgets/NdCpuHistory.vue'), - NdLoadHistory: () => import('@/components/Widgets/NdLoadHistory.vue'), - NdRamHistory: () => import('@/components/Widgets/NdRamHistory.vue'), - NewsHeadlines: () => import('@/components/Widgets/NewsHeadlines.vue'), - NextcloudNotifications: () => import('@/components/Widgets/NextcloudNotifications.vue'), - NextcloudPhpOpcache: () => import('@/components/Widgets/NextcloudPhpOpcache.vue'), - NextcloudStats: () => import('@/components/Widgets/NextcloudStats.vue'), - NextcloudSystem: () => import('@/components/Widgets/NextcloudSystem.vue'), - NextcloudUser: () => import('@/components/Widgets/NextcloudUser.vue'), - NextcloudUserStatus: () => import('@/components/Widgets/NextcloudUserStatus.vue'), - PiHoleStats: () => import('@/components/Widgets/PiHoleStats.vue'), - PiHoleTopQueries: () => import('@/components/Widgets/PiHoleTopQueries.vue'), - PiHoleTraffic: () => import('@/components/Widgets/PiHoleTraffic.vue'), - PublicHolidays: () => import('@/components/Widgets/PublicHolidays.vue'), - PublicIp: () => import('@/components/Widgets/PublicIp.vue'), - RssFeed: () => import('@/components/Widgets/RssFeed.vue'), - SportsScores: () => import('@/components/Widgets/SportsScores.vue'), - StatPing: () => import('@/components/Widgets/StatPing.vue'), - StockPriceChart: () => import('@/components/Widgets/StockPriceChart.vue'), - SynologyDownload: () => import('@/components/Widgets/SynologyDownload.vue'), - SystemInfo: () => import('@/components/Widgets/SystemInfo.vue'), - TflStatus: () => import('@/components/Widgets/TflStatus.vue'), - WalletBalance: () => import('@/components/Widgets/WalletBalance.vue'), - Weather: () => import('@/components/Widgets/Weather.vue'), - WeatherForecast: () => import('@/components/Widgets/WeatherForecast.vue'), - XkcdComic: () => import('@/components/Widgets/XkcdComic.vue'), }, props: { widget: Object, @@ -603,6 +155,15 @@ export default { hideControls() { return this.widget.hideControls; }, + component() { + const type = COMPAT[this.widgetType] || this.widget.type; + if (!type) { + ErrorHandler('Widget type was not found'); + return null; + } + // eslint-disable-next-line prefer-template + return () => import('@/components/Widgets/' + type + '.vue'); + }, }, methods: { /* Calls update data method on widget */