diff --git a/interface/src/app/main/Dashboard.tsx b/interface/src/app/main/Dashboard.tsx index 60908ff8e..137a29b9b 100644 --- a/interface/src/app/main/Dashboard.tsx +++ b/interface/src/app/main/Dashboard.tsx @@ -1,9 +1,9 @@ import { useContext, useEffect, useState } from 'react'; import { IconContext } from 'react-icons/lib'; +import { Link } from 'react-router'; import { toast } from 'react-toastify'; import ChevronRightIcon from '@mui/icons-material/ChevronRight'; -import ConstructionIcon from '@mui/icons-material/Construction'; import EditIcon from '@mui/icons-material/Edit'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import UnfoldLessIcon from '@mui/icons-material/UnfoldLess'; @@ -22,7 +22,7 @@ import { Body, Cell, Row, Table } from '@table-library/react-table-library/table import { useTheme } from '@table-library/react-table-library/theme'; import { CellTree, useTree } from '@table-library/react-table-library/tree'; import { useRequest } from 'alova/client'; -import { FormLoader, SectionContent, useLayoutTitle } from 'components'; +import { FormLoader, MessageBox, SectionContent, useLayoutTitle } from 'components'; import { AuthenticatedContext } from 'contexts/authentication'; import { useI18nContext } from 'i18n/i18n-react'; import { useInterval, usePersistState } from 'utils'; @@ -224,6 +224,10 @@ const Dashboard = () => { return ; } + const hasFavEntities = data.filter( + (item: DashboardItem) => item.id <= 90 + ).length; + return ( <> { - {LL.DASHBOARD_1()}  - + {LL.DASHBOARD_1()} @@ -262,27 +263,40 @@ const Dashboard = () => { - - + + {LL.NO_DATA_1()}  + + {LL.CUSTOMIZATIONS()} + +  {LL.NO_DATA_2()}  + {LL.NO_DATA_3()}  + + {LL.DEVICES()} + + . + + + )} + + {data.length > 0 && ( + - {!loading && data.length === 0 ? ( - - {LL.NO_DATA()} - - ) : ( + { )}
- )} -
-
+
+
+ )} ); }; diff --git a/interface/src/i18n/cz/index.ts b/interface/src/i18n/cz/index.ts index 99ede30c3..086709801 100644 --- a/interface/src/i18n/cz/index.ts +++ b/interface/src/i18n/cz/index.ts @@ -340,11 +340,12 @@ const cz: Translation = { RESTARTING_POST: 'Příprava', AUTO_SCROLL: 'Automatické rolování', DASHBOARD: 'Dashboard', - NO_DATA: 'Žádná data nejsou k dispozici', DASHBOARD_1: 'Přizpůsobte si dashboard označením EMS entit jako Oblíbené pomocí modulu Přizpůsobení', DEVELOPER_MODE: 'Režim vývojáře', DUPLICATE: 'Duplicate', // TODO translate - UPGRADE: 'Upgrade' // TODO translate + NO_DATA_1: 'No favourite EMS entities found. Use the', // TODO translate + NO_DATA_2: 'module to mark them.', // TODO translate + NO_DATA_3: 'To see all available entities go to' // TODO translate }; export default cz; diff --git a/interface/src/i18n/de/index.ts b/interface/src/i18n/de/index.ts index a5af94ea1..0e3259d54 100644 --- a/interface/src/i18n/de/index.ts +++ b/interface/src/i18n/de/index.ts @@ -340,11 +340,13 @@ const de: Translation = { RESTARTING_POST: 'Vorbereitung', AUTO_SCROLL: 'Automatisches Scrollen', DASHBOARD: 'Dashboard', - NO_DATA: 'Keine Daten verfügbar', DASHBOARD_1: 'Passen Sie Ihr Dashboard an, indem Sie EMS-Entitäten mithilfe des Moduls „Anpassungen“ als Favorit markieren', DEVELOPER_MODE: 'Entwicklermodus', DUPLICATE: 'Kopieren', - UPGRADE: 'Aktualisieren' + UPGRADE: 'Aktualisieren', + NO_DATA_1: 'No favourite EMS entities found. Use the', // TODO translate + NO_DATA_2: 'module to mark them.', // TODO translate + NO_DATA_3: 'To see all available entities go to' // TODO translate }; export default de; diff --git a/interface/src/i18n/en/index.ts b/interface/src/i18n/en/index.ts index d86b05756..611d5e9bb 100644 --- a/interface/src/i18n/en/index.ts +++ b/interface/src/i18n/en/index.ts @@ -340,11 +340,13 @@ const en: Translation = { RESTARTING_POST: 'Preparing', AUTO_SCROLL: 'Auto Scroll', DASHBOARD: 'Dashboard', - NO_DATA: 'No data available', - DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module', + DASHBOARD_1: 'The Dashboard shows all EMS entities that are active and marked as a Favorite, plus any Custom Entities, Schedules and external Sensors.', DEVELOPER_MODE: 'Developer Mode', DUPLICATE: 'Duplicate', - UPGRADE: 'Upgrade' + UPGRADE: 'Upgrade', + NO_DATA_1: 'No favourite EMS entities found. Use the', + NO_DATA_2: 'module to mark them.', + NO_DATA_3: 'To see all available entities go to' }; export default en; diff --git a/interface/src/i18n/fr/index.ts b/interface/src/i18n/fr/index.ts index b27817de4..a2202c765 100644 --- a/interface/src/i18n/fr/index.ts +++ b/interface/src/i18n/fr/index.ts @@ -340,11 +340,13 @@ const fr: Translation = { RESTARTING_POST: 'Preparing', // TODO translate AUTO_SCROLL: 'Auto Scroll', // TODO translate DASHBOARD: 'Dashboard', // TODO translate - NO_DATA: 'No data available', // TODO translate DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module', // TODO translate DEVELOPER_MODE: 'Developer Mode', // TODO translate DUPLICATE: 'Duplicate', // TODO translate - UPGRADE: 'Upgrade' // TODO translate + UPGRADE: 'Upgrade', // TODO translate + NO_DATA_1: 'No favourite EMS entities found. Use the', // TODO translate + NO_DATA_2: 'module to mark them.', // TODO translate + NO_DATA_3: 'To see all available entities go to' // TODO translate }; export default fr; diff --git a/interface/src/i18n/it/index.ts b/interface/src/i18n/it/index.ts index 8d4393880..cbeaea58f 100644 --- a/interface/src/i18n/it/index.ts +++ b/interface/src/i18n/it/index.ts @@ -340,11 +340,13 @@ const it: Translation = { RESTARTING_POST: 'Preparing', // TODO translate AUTO_SCROLL: 'Auto Scroll', // TODO translate DASHBOARD: 'Dashboard', // TODO translate - NO_DATA: 'No data available', // TODO translate DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module', // TODO translate DEVELOPER_MODE: 'Developer Mode', // TODO translate DUPLICATE: 'Duplicate', // TODO translate - UPGRADE: 'Upgrade' // TODO translate + UPGRADE: 'Upgrade', // TODO translate + NO_DATA_1: 'No favourite EMS entities found. Use the', // TODO translate + NO_DATA_2: 'module to mark them.', // TODO translate + NO_DATA_3: 'To see all available entities go to' // TODO translate }; export default it; diff --git a/interface/src/i18n/nl/index.ts b/interface/src/i18n/nl/index.ts index 6ace3dfe7..d04a1191a 100644 --- a/interface/src/i18n/nl/index.ts +++ b/interface/src/i18n/nl/index.ts @@ -340,11 +340,13 @@ const nl: Translation = { RESTARTING_POST: 'Voorbereiding', AUTO_SCROLL: 'Automatisch Scrollen', DASHBOARD: 'Dashboard', - NO_DATA: 'Geen data beschikbaar', DASHBOARD_1: 'Pas uw dashboard aan door EMS-entiteiten als favoriet te markeren met behulp van de module Aanpassingen', DEVELOPER_MODE: 'Ontwikkelaarsmodus', DUPLICATE: 'Duplicaat', - UPGRADE: 'Upgraden' + UPGRADE: 'Upgraden', + NO_DATA_1: 'Geen favorite EMS entiteiten gevonden. Gebruik de', + NO_DATA_2: 'module om ze te markeren.', + NO_DATA_3: 'Om alle beschikbare entiteiten te bekijken ga naar' }; export default nl; \ No newline at end of file diff --git a/interface/src/i18n/no/index.ts b/interface/src/i18n/no/index.ts index b89980c65..b22ea8e64 100644 --- a/interface/src/i18n/no/index.ts +++ b/interface/src/i18n/no/index.ts @@ -340,11 +340,13 @@ const no: Translation = { RESTARTING_POST: 'Preparing', // TODO translate AUTO_SCROLL: 'Auto Scroll', // TODO translate DASHBOARD: 'Dashboard', // TODO translate - NO_DATA: 'No data available', // TODO translate DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module', // TODO translate DEVELOPER_MODE: 'Developer Mode', // TODO translate DUPLICATE: 'Duplicate', // TODO translate - UPGRADE: 'Upgrade' // TODO translate + UPGRADE: 'Upgrade', // TODO translate + NO_DATA_1: 'No favourite EMS entities found. Use the', // TODO translate + NO_DATA_2: 'module to mark them.', // TODO translate + NO_DATA_3: 'To see all available entities go to' // TODO translate }; export default no; diff --git a/interface/src/i18n/pl/index.ts b/interface/src/i18n/pl/index.ts index 978680149..92c4c6c27 100644 --- a/interface/src/i18n/pl/index.ts +++ b/interface/src/i18n/pl/index.ts @@ -340,11 +340,13 @@ const pl: BaseTranslation = { RESTARTING_POST: 'Preparing', // TODO translate AUTO_SCROLL: 'Auto Scroll', // TODO translate DASHBOARD: 'Dashboard', // TODO translate - NO_DATA: 'No data available', // TODO translate DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module', // TODO translate DEVELOPER_MODE: 'Developer Mode', // TODO translate DUPLICATE: 'Duplicate', // TODO translate - UPGRADE: 'Upgrade' // TODO translate + UPGRADE: 'Upgrade', // TODO translate + NO_DATA_1: 'No favourite EMS entities found. Use the', // TODO translate + NO_DATA_2: 'module to mark them.', // TODO translate + NO_DATA_3: 'To see all available entities go to' // TODO translate }; export default pl; diff --git a/interface/src/i18n/sk/index.ts b/interface/src/i18n/sk/index.ts index fdde77ad7..56b0147df 100644 --- a/interface/src/i18n/sk/index.ts +++ b/interface/src/i18n/sk/index.ts @@ -340,11 +340,13 @@ const sk: Translation = { RESTARTING_POST: 'Príprava', AUTO_SCROLL: 'Automatické rolovanie', DASHBOARD: 'Panel', - NO_DATA: 'Nie sú k dispozícii žiadne údaje', DASHBOARD_1: 'Prispôsobte si svoj informačný panel tak, že označíte entity EMS ako Obľúbené pomocou modulu Prispôsobenia', DEVELOPER_MODE: 'Režim vývojára', DUPLICATE: 'Duplicitné', - UPGRADE: 'Inovovať' + UPGRADE: 'Inovovať', + NO_DATA_1: 'No favourite EMS entities found. Use the', // TODO translate + NO_DATA_2: 'module to mark them.', // TODO translate + NO_DATA_3: 'To see all available entities go to' // TODO translate }; export default sk; diff --git a/interface/src/i18n/sv/index.ts b/interface/src/i18n/sv/index.ts index 151aa9ccc..149446670 100644 --- a/interface/src/i18n/sv/index.ts +++ b/interface/src/i18n/sv/index.ts @@ -340,11 +340,13 @@ const sv: Translation = { RESTARTING_POST: 'Förbereder', AUTO_SCROLL: 'Autoskrolla', DASHBOARD: 'Kontrollpanel', - NO_DATA: 'Ingen data tillgänglig', DASHBOARD_1: 'Anpassa din kontrollpanel genom att markera EMS enheter som Favorit i modulen Anpassningar', DEVELOPER_MODE: 'Utvecklarläge', DUPLICATE: 'Dublett', - UPGRADE: 'Uppgradera' + UPGRADE: 'Uppgradera', + NO_DATA_1: 'Inga EMS entiteter har markeras som Favorit. Använd', + NO_DATA_2: 'modulen Anpassningar för att markera dem.', + NO_DATA_3: 'För att se alla tillgängliga entiteter gå till' }; export default sv; diff --git a/interface/src/i18n/tr/index.ts b/interface/src/i18n/tr/index.ts index 21f6deeea..371ea6919 100644 --- a/interface/src/i18n/tr/index.ts +++ b/interface/src/i18n/tr/index.ts @@ -340,11 +340,13 @@ const tr: Translation = { RESTARTING_POST: 'Preparing', // TODO translate AUTO_SCROLL: 'Auto Scroll', // TODO translate DASHBOARD: 'Dashboard', // TODO translate - NO_DATA: 'No data available', // TODO translate DASHBOARD_1: 'Customize your dashboard by marking EMS entities as Favorite using the Customizations module', // TODO translate DEVELOPER_MODE: 'Developer Mode', // TODO translate DUPLICATE: 'Duplicate', // TODO translate - UPGRADE: 'Upgrade' // TODO translate + UPGRADE: 'Upgrade', // TODO translate + NO_DATA_1: 'No favourite EMS entities found. Use the', // TODO translate + NO_DATA_2: 'module to mark them.', // TODO translate + NO_DATA_3: 'To see all available entities go to' // TODO translate }; export default tr; diff --git a/mock-api/rest_server.ts b/mock-api/rest_server.ts index 41c2360e1..68e82e2b6 100644 --- a/mock-api/rest_server.ts +++ b/mock-api/rest_server.ts @@ -4507,7 +4507,7 @@ router let fake = false; - // fake = true; // for testing + // fake = true; // for testing, shows a subset of data if (!fake) { // pick EMS devices from coredata @@ -4603,35 +4603,37 @@ router // for testing only // add the custom entity data - // dashboard_object = { - // id: DeviceTypeUniqueID.CUSTOM_UID, // unique ID for custom entities - // t: DeviceType.CUSTOM, - // nodes: getDashboardEntityData(99) - // }; - // // only add to dashboard if we have values - // if ((dashboard_object.nodes ?? []).length > 0) { - // dashboard_data.push(dashboard_object); - // } - - let scheduler_data = emsesp_schedule.schedule.filter((item) => item.name); - let scheduler_data2 = scheduler_data.map((item, index) => ({ - id: DeviceTypeUniqueID.SCHEDULER_UID * 100 + index, - dv: { - id: '00' + item.name, - v: item.active ? 'on' : 'off', - c: item.name, - l: ['off', 'on'] - } - })); dashboard_object = { - id: DeviceTypeUniqueID.SCHEDULER_UID, - t: DeviceType.SCHEDULER, - nodes: scheduler_data2 + id: DeviceTypeUniqueID.CUSTOM_UID, // unique ID for custom entities + t: DeviceType.CUSTOM, + nodes: getDashboardEntityData(DeviceTypeUniqueID.CUSTOM_UID) }; // only add to dashboard if we have values if ((dashboard_object.nodes ?? []).length > 0) { dashboard_data.push(dashboard_object); } + + // add the scheduler data + // let scheduler_data = emsesp_schedule.schedule.filter((item) => item.name); + // let scheduler_data2 = scheduler_data.map((item, index) => ({ + // id: DeviceTypeUniqueID.SCHEDULER_UID * 100 + index, + // dv: { + // id: '00' + item.name, + // v: item.active ? 'on' : 'off', + // c: item.name, + // l: ['off', 'on'] + // } + // })); + // dashboard_object = { + // id: DeviceTypeUniqueID.SCHEDULER_UID, + // t: DeviceType.SCHEDULER, + // nodes: scheduler_data2 + // }; + + // only add to dashboard if we have values + // if ((dashboard_object.nodes ?? []).length > 0) { + // dashboard_data.push(dashboard_object); + // } } // console.log('dashboard_data: ', dashboard_data);