diff --git a/src/components/Charts/Gauge.vue b/src/components/Charts/Gauge.vue index 63fcf684..d4edc5cb 100644 --- a/src/components/Charts/Gauge.vue +++ b/src/components/Charts/Gauge.vue @@ -8,7 +8,7 @@ - + @@ -192,7 +192,7 @@ export default { { offset: 0, color: '#20e253' }, { offset: 30, color: '#f6f000' }, { offset: 60, color: '#fca016' }, - { offset: 90, color: '#f80363' }, + { offset: 80, color: '#f80363' }, ]), }, /* Color of the base of the gauge */ @@ -200,6 +200,11 @@ export default { type: String, default: '#DDDDDD', }, + /* The inset shadow color */ + shadowColor: { + type: String, + default: '#8787871a', + }, /* Scale interval, won't display any scall if 0 or `null` */ scaleInterval: { type: Number, diff --git a/src/components/Charts/PercentageChart.vue b/src/components/Charts/PercentageChart.vue index 08fc2a9d..339fb8b8 100644 --- a/src/components/Charts/PercentageChart.vue +++ b/src/components/Charts/PercentageChart.vue @@ -40,6 +40,7 @@ export default { blocks() { let startPositionSum = 0; const results = []; + console.log(this.values); const total = this.values.reduce((prev, cur) => (prev.size || prev) + cur.size); const multiplier = this.showAsPercent ? 100 / total : 1; this.values.forEach((value, index) => { diff --git a/src/components/Widgets/GlCpuCores.vue b/src/components/Widgets/GlCpuCores.vue new file mode 100644 index 00000000..6dde6591 --- /dev/null +++ b/src/components/Widgets/GlCpuCores.vue @@ -0,0 +1,93 @@ + + + + + diff --git a/src/components/Widgets/WidgetBase.vue b/src/components/Widgets/WidgetBase.vue index 058a6ec9..cd73b403 100644 --- a/src/components/Widgets/WidgetBase.vue +++ b/src/components/Widgets/WidgetBase.vue @@ -95,6 +95,13 @@ @error="handleError" :ref="widgetRef" /> + - + import('@/components/Widgets/ExchangeRates.vue'), Flights: () => import('@/components/Widgets/Flights.vue'), GitHubTrending: () => import('@/components/Widgets/GitHubTrending.vue'), + GlCpuCores: () => import('@/components/Widgets/GlCpuCores.vue'), + GlCpuGauge: () => import('@/components/Widgets/GlCpuGauge.vue'), GitHubProfile: () => import('@/components/Widgets/GitHubProfile.vue'), HealthChecks: () => import('@/components/Widgets/HealthChecks.vue'), IframeWidget: () => import('@/components/Widgets/IframeWidget.vue'), diff --git a/src/mixins/WidgetMixin.js b/src/mixins/WidgetMixin.js index 4636b93c..d8aa7310 100644 --- a/src/mixins/WidgetMixin.js +++ b/src/mixins/WidgetMixin.js @@ -17,6 +17,7 @@ const WidgetMixin = { data: () => ({ progress: new ProgressBar({ color: 'var(--progress-bar)' }), overrideProxyChoice: false, + disableLoader: false, // Prevent ever showing the loader }), /* When component mounted, fetch initial data */ mounted() { @@ -44,8 +45,10 @@ const WidgetMixin = { }, /* When a data request update starts, show loader */ startLoading() { - this.$emit('loading', true); - this.progress.start(); + if (!this.disableLoader) { + this.$emit('loading', true); + this.progress.start(); + } }, /* When a data request finishes, hide loader */ finishLoading() { diff --git a/src/utils/MiscHelpers.js b/src/utils/MiscHelpers.js index 4edda362..bee89e6f 100644 --- a/src/utils/MiscHelpers.js +++ b/src/utils/MiscHelpers.js @@ -86,7 +86,8 @@ export const showNumAsThousand = (bigNum) => { /* Capitalizes the first letter of each word within a string */ export const capitalize = (str) => { - return str.replace(/\w\S*/g, (w) => (w.replace(/^\w/, (c) => c.toUpperCase()))); + const words = str.replaceAll('_', ' ').replaceAll('-', ' '); + return words.replace(/\w\S*/g, (w) => (w.replace(/^\w/, (c) => c.toUpperCase()))); }; /* Round price to appropriate number of decimals */ @@ -122,6 +123,12 @@ export const getTimeAgo = (dateTime) => { return 'unknown'; }; +/* Given the name of a CSS variable, returns it's value */ +export const getValueFromCss = (colorVar) => { + const cssProps = getComputedStyle(document.documentElement); + return cssProps.getPropertyValue(`--${colorVar}`).trim(); +}; + /* Given a currency code, return the corresponding unicode symbol */ export const findCurrencySymbol = (currencyCode) => { const code = currencyCode.toUpperCase().trim();