✅ Code style improvments, to pass SonarCloud review
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
/**
|
||||
* Mixin for helper functions, used for making chart widgets
|
||||
*/
|
||||
// import ErrorHandler from '@/utils/ErrorHandler';
|
||||
import { Chart } from 'frappe-charts/dist/frappe-charts.min.esm';
|
||||
|
||||
const WidgetMixin = {
|
||||
const ChartingMixin = {
|
||||
props: {},
|
||||
computed: {
|
||||
chartHeight() {
|
||||
@@ -29,15 +28,13 @@ const WidgetMixin = {
|
||||
formatDate(timestamp) {
|
||||
const localFormat = navigator.language;
|
||||
const dateFormat = { weekday: 'short', day: 'numeric', month: 'short' };
|
||||
const date = new Date(timestamp).toLocaleDateString(localFormat, dateFormat);
|
||||
return date;
|
||||
return new Date(timestamp).toLocaleDateString(localFormat, dateFormat);
|
||||
},
|
||||
/* Format the time for a given time stamp */
|
||||
formatTime(timestamp) {
|
||||
const localFormat = navigator.language;
|
||||
const timeFormat = { hour: 'numeric', minute: 'numeric', second: 'numeric' };
|
||||
const time = Intl.DateTimeFormat(localFormat, timeFormat).format(timestamp);
|
||||
return time;
|
||||
return Intl.DateTimeFormat(localFormat, timeFormat).format(timestamp);
|
||||
},
|
||||
/* Given an array of numbers, returns the average of all */
|
||||
average(array) {
|
||||
@@ -46,4 +43,4 @@ const WidgetMixin = {
|
||||
},
|
||||
};
|
||||
|
||||
export default WidgetMixin;
|
||||
export default ChartingMixin;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
/**
|
||||
* Mixin for all homepages (default home, minimal home, workspace, etc)
|
||||
*/
|
||||
// import ErrorHandler from '@/utils/ErrorHandler';
|
||||
|
||||
import Defaults, { localStorageKeys, iconCdns } from '@/utils/defaults';
|
||||
import { searchTiles } from '@/utils/Search';
|
||||
@@ -48,16 +47,14 @@ const HomeMixin = {
|
||||
},
|
||||
/* Checks if any sections or items use icons from a given CDN */
|
||||
checkIfIconLibraryNeeded(prefix) {
|
||||
let isNeeded = false;
|
||||
if (!this.sections) return false;
|
||||
let isNeeded = false; // Will be set to true if prefix found in icon name
|
||||
this.sections.forEach((section) => {
|
||||
if (section) {
|
||||
if (section.icon && section.icon.includes(prefix)) isNeeded = true;
|
||||
if (section.items) {
|
||||
section.items.forEach((item) => {
|
||||
if (item.icon && item.icon.includes(prefix)) isNeeded = true;
|
||||
});
|
||||
}
|
||||
if (section && section.icon && section.icon.includes(prefix)) isNeeded = true;
|
||||
if (section && section.items) {
|
||||
section.items.forEach((item) => {
|
||||
if (item.icon && item.icon.includes(prefix)) isNeeded = true;
|
||||
});
|
||||
}
|
||||
});
|
||||
return isNeeded;
|
||||
|
||||
Reference in New Issue
Block a user