From a85e5b3408070705063aa66cfe48027d4fc3a22f Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Tue, 5 Mar 2024 09:42:25 +0100 Subject: [PATCH 1/3] 872: Cleaned up documentation --- README.md | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 087dfffa..9bcdffec 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # OS2Display Admin -This is an admin for OS2Display. -This is based on create-react-app. -See [https://github.com/os2display/display-docs/blob/main/admin.md](https://github.com/os2display/display-docs/blob/main/admin.md) for a description of the admin. +This is an admin for OS2Display. This is based on create-react-app. See + for a +description of the admin. ## Docker development setup @@ -11,7 +11,7 @@ See [https://github.com/os2display/display-docs/blob/main/admin.md](https://gith By default the api that is requested is located at `/api/`. This can be configured by: -```bash +```shell cp public/example_config.json public/config.json ``` @@ -25,24 +25,28 @@ And modify the entries to suit your setup. ### Create public/access-config file -This file contains the access config. This file is only required if other access setting are required than what is default. +This file contains the access config. This file is only required if other access +setting are required than what is default. -```bash +```shell cp public/example-access-config.json public/access-config.json ``` ### Up the containers -```bash -docker-compose up -d +```shell +docker compose up --detach ``` ### Install npm packages -```bash -docker-compose run node yarn +```shell +docker compose run --rm node yarn install ``` +**Note**: When to `node` container is running, the JavaScript is continously +being built. + ### Redux Toolkit The communication with the API is generated from an OpenAPI @@ -50,7 +54,7 @@ specification with Redux Toolkit. To regenerate (when the API specification has changed): -```bash +```shell # Action: Replace api.json with the new api.json OpenAPI specification # Install and run scripts to generate ned Redux Api slices. @@ -64,16 +68,16 @@ We use [cypress](https://www.cypress.io/) for testing. To run cypress tests in the cypress container: -```bash -docker-compose run cypress run +```shell +docker compose run --rm cypress run ``` ### Linting -```bash -docker-compose run node yarn check-coding-standards +```shell +docker compose run --rm node yarn check-coding-standards ``` -```bash -docker-compose run node yarn apply-coding-standards +```shell +docker compose run --rm node yarn apply-coding-standards ``` From 65762066c708f541305a48fbd6b28264dca593b5 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Tue, 5 Mar 2024 09:44:38 +0100 Subject: [PATCH 2/3] 872: Fixed handling of time zones? --- .editorconfig | 12 ++++++++++++ CHANGELOG.md | 6 ++++-- src/components/util/schedule/schedule-util.js | 10 +--------- src/components/util/schedule/schedule.jsx | 13 +++---------- 4 files changed, 20 insertions(+), 21 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..f84a7903 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_style = space +indent_size = 2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bcc6f5c..382f164e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +- [#232](https://github.com/os2display/display-admin-client/pull/232) + - Fixed time zone issue in playlist schedules. - [#231](https://github.com/os2display/display-admin-client/pull/231) - Fixed post body of activation POST request. - [#230](https://github.com/os2display/display-admin-client/pull/230) @@ -71,8 +73,8 @@ All notable changes to this project will be documented in this file. - [#205](https://github.com/os2display/display-admin-client/pull/205) - Setup separate image builds for itkdev and os2display - [#204](https://github.com/os2display/display-admin-client/pull/204) - - Change docker image name from `os2display/os2display-admin-client` - to `os2display/display-admin-client` to match image name and + - Change docker image name from `os2display/os2display-admin-client` + to `os2display/display-admin-client` to match image name and repository name - [#200](https://github.com/os2display/display-admin-client/pull/200) - Update docker build to publish to "os2display" org on docker hub. diff --git a/src/components/util/schedule/schedule-util.js b/src/components/util/schedule/schedule-util.js index 7b3b75d7..73138a4e 100644 --- a/src/components/util/schedule/schedule-util.js +++ b/src/components/util/schedule/schedule-util.js @@ -56,15 +56,7 @@ const createNewSchedule = () => { id: ulid(nowTimestamp), duration: 60 * 60 * 24, // Default one day. freq: RRule.WEEKLY, - dtstart: new Date( - Date.UTC( - now.getFullYear(), - now.getMonth(), - now.getDate(), - now.getHours(), - now.getMinutes() - ) - ), + dtstart: new Date(), until: null, wkst: RRule.MO, byhour: null, diff --git a/src/components/util/schedule/schedule.jsx b/src/components/util/schedule/schedule.jsx index 2df3f84c..731ff420 100644 --- a/src/components/util/schedule/schedule.jsx +++ b/src/components/util/schedule/schedule.jsx @@ -119,16 +119,9 @@ function Schedule({ schedules, onChange }) { * @param {object} target - Input target. */ const setDateValue = (scheduleId, target) => { - const date = new Date(target.value); - + const date = target.valueAsDate; const scheduleDate = new Date( - Date.UTC( - date.getFullYear(), - date.getMonth(), - date.getDate(), - date.getHours(), - date.getMinutes() - ) + date.getTime() + 60 * 1000 * date.getTimezoneOffset() ); changeSchedule(scheduleId, target.id, scheduleDate); @@ -141,7 +134,7 @@ function Schedule({ schedules, onChange }) { * @returns {string} - The date formatted for datetime-local. */ const getDateValue = (date) => { - return date ? dayjs(date).utc().format("YYYY-MM-DDTHH:mm") : ""; + return date ? dayjs(date).format("YYYY-MM-DDTHH:mm") : ""; }; /** From a192fcf8ba752ae3b2f69e6a0da29f742ffd1838 Mon Sep 17 00:00:00 2001 From: Mikkel Ricky Date: Tue, 5 Mar 2024 16:46:56 +0100 Subject: [PATCH 3/3] 872: Updated cypress/included --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 88ed8afb..44a90fa9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -46,7 +46,7 @@ services: start_period: 60s cypress: - image: cypress/included:9.5.2 + image: cypress/included:9.5.4 networks: - app - frontend