From bd72cb440b3cf7c661f483db1dbff896d0afad0f Mon Sep 17 00:00:00 2001 From: Kifungo A <45813955+adkif@users.noreply.github.com> Date: Wed, 18 Sep 2024 07:35:38 +0200 Subject: [PATCH 1/5] chore(deps): update electron from 28.1.0 to 30.0.1 and electron builder from 24.6.4 to 24.13.3 --- apps/desktop-timer/package.json | 4 +- apps/desktop/package.json | 4 +- apps/server-api/package.json | 4 +- apps/server/package.json | 4 +- package.json | 80 ++++++++++++++-------------- packages/desktop-libs/package.json | 2 +- packages/desktop-ui-lib/package.json | 2 +- packages/desktop-window/package.json | 2 +- yarn.lock | 19 +++---- 9 files changed, 57 insertions(+), 64 deletions(-) diff --git a/apps/desktop-timer/package.json b/apps/desktop-timer/package.json index e36e9675d1c..380939ed502 100644 --- a/apps/desktop-timer/package.json +++ b/apps/desktop-timer/package.json @@ -21,8 +21,8 @@ "devDependencies": { "@electron/rebuild": "^3.2.10", "@types/moment-duration-format": "^2.2.3", - "electron": "28.1.0", - "electron-builder": "^24.6.4", + "electron": "^30.0.1", + "electron-builder": "^24.13.3", "electron-installer-dmg": "^4.0.0", "electron-packager": "^17.1.1", "electron-reload": "~1.5.0", diff --git a/apps/desktop/package.json b/apps/desktop/package.json index c5370df3f7c..dca949ec575 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -21,8 +21,8 @@ "devDependencies": { "@electron/rebuild": "^3.2.10", "@types/moment-duration-format": "^2.2.3", - "electron": "28.1.0", - "electron-builder": "^24.6.4", + "electron": "^30.0.1", + "electron-builder": "^24.13.3", "electron-installer-dmg": "^4.0.0", "electron-packager": "^17.1.1", "electron-reload": "~1.5.0", diff --git a/apps/server-api/package.json b/apps/server-api/package.json index 96f790cfe21..82d3ca27f09 100644 --- a/apps/server-api/package.json +++ b/apps/server-api/package.json @@ -21,8 +21,8 @@ "devDependencies": { "@electron/rebuild": "^3.2.10", "@types/moment-duration-format": "^2.2.3", - "electron": "28.1.0", - "electron-builder": "^24.6.4", + "electron": "^30.0.1", + "electron-builder": "^24.13.3", "electron-installer-dmg": "^4.0.0", "electron-packager": "^17.1.1", "electron-reload": "~1.5.0", diff --git a/apps/server/package.json b/apps/server/package.json index 37503e345b0..6a2a96582d9 100644 --- a/apps/server/package.json +++ b/apps/server/package.json @@ -21,8 +21,8 @@ "devDependencies": { "@electron/rebuild": "^3.2.10", "@types/moment-duration-format": "^2.2.3", - "electron": "28.1.0", - "electron-builder": "^24.6.4", + "electron": "^30.0.1", + "electron-builder": "^24.13.3", "electron-installer-dmg": "^4.0.0", "electron-packager": "^17.1.1", "electron-reload": "~1.5.0", diff --git a/package.json b/package.json index 5df33fbd58c..3a43560d102 100644 --- a/package.json +++ b/package.json @@ -94,21 +94,21 @@ "postinstall.web": "yarn node ./decorate-angular-cli.js && yarn node tools/web/postinstall", "build:desktop": "cross-env NODE_ENV=production yarn run copy-files-i18n-desktop && yarn run postinstall.electron && yarn build:package:all && yarn run config:prod && yarn run config:desktop:prod && yarn run pack:desktop && yarn run generate:icons:desktop --environment=prod && yarn ng:prod build desktop --prod --base-href ./ && yarn run prepare:desktop && yarn ng:prod build desktop-api --prod && yarn ng:prod build api-desktop --prod --output-path=dist/apps/desktop/desktop-api && yarn ng:prod build desktop-ui --prod --base-href ./ && yarn run copy-files-desktop && yarn run copy-assets-gauzy", "build:desktop:local": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:desktop && electron dist/apps/desktop", - "build:desktop:linux": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:desktop && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --linux --project dist/apps/desktop", - "build:desktop:windows": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:desktop && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 -c.extraMetadata.author.name=Ever build --windows --project dist/apps/desktop", - "build:desktop:mac": "yarn run build:desktop && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --mac --project dist/apps/desktop", - "build:desktop:linux:release": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:desktop && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --linux --publish=always --project dist/apps/desktop", - "build:desktop:linux:release:gh": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=30000 yarn run config:prod && yarn run build:desktop && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --linux --publish=always --project dist/apps/desktop", - "build:desktop:windows:release": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:desktop && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 -c.extraMetadata.author.name=Ever build --windows --publish=always --project dist/apps/desktop", - "build:desktop:windows:release:gh": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=30000 yarn run config:prod && yarn run build:desktop && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 -c.extraMetadata.author.name=Ever build --windows --publish=always --project dist/apps/desktop", - "build:desktop:mac:release": "yarn run build:desktop && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --mac --publish=always --project dist/apps/desktop", + "build:desktop:linux": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:desktop && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --linux --project dist/apps/desktop", + "build:desktop:windows": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:desktop && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 -c.extraMetadata.author.name=Ever build --windows --project dist/apps/desktop", + "build:desktop:mac": "yarn run build:desktop && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --mac --project dist/apps/desktop", + "build:desktop:linux:release": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:desktop && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --linux --publish=always --project dist/apps/desktop", + "build:desktop:linux:release:gh": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=30000 yarn run config:prod && yarn run build:desktop && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --linux --publish=always --project dist/apps/desktop", + "build:desktop:windows:release": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:desktop && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 -c.extraMetadata.author.name=Ever build --windows --publish=always --project dist/apps/desktop", + "build:desktop:windows:release:gh": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=30000 yarn run config:prod && yarn run build:desktop && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 -c.extraMetadata.author.name=Ever build --windows --publish=always --project dist/apps/desktop", + "build:desktop:mac:release": "yarn run build:desktop && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --mac --publish=always --project dist/apps/desktop", "prepare:desktop": "yarn run postinstall.electron && tsc -p apps/desktop/tsconfig.json", "serve:desktop.target": "yarn ng serve desktop", "serve:desktop": "wait-on http-get://localhost:4200/ && electron apps/desktop/src --serve", "start:desktop": "yarn run prepare:desktop && npm-run-all -p serve.electron.gauzy-desktop.target serve.electron.gauzy-desktop", - "build:desktop:mac:quick": "npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --mac --project dist/apps/desktop", + "build:desktop:mac:quick": "npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --mac --project dist/apps/desktop", "build:desktop:local:quick": "yarn electron dist/apps/desktop --prod", - "build:desktop:windows:quick": "npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --windows --project dist/apps/desktop", + "build:desktop:windows:quick": "npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --windows --project dist/apps/desktop", "build:sqlite:mac": "cd node_modules/sqlite3 && HOME=~/.electron-gyp node-pre-gyp rebuild --target=8.3.0 --arch=x64 --dist-url=https://electronjs.org/headers", "build:sqlite:windows": "cd node_modules/sqlite3 && cross-env HOME=~/.electron-gyp node-pre-gyp rebuild --target=8.3.0 --arch=x64 --target_platform=win32 --dist-url=https://electronjs.org/headers", "debug:desktop:app:mac": "lldb ./dist/apps/desktop-packages/mac/GauzyDesktop.app && run", @@ -116,7 +116,7 @@ "build:desktop:ui": "yarn run postinstall.web && yarn ng:prod build desktop-ui --prod --base-href ./", "prepare:desktop:dev": "yarn run postinstall.electron && tsc -p apps/desktop/tsconfig.dev.json", "start:api:desktop": "yarn ng serve api-desktop", - "deploy:desktop:mac": "npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --mac --publish always --project dist/apps/desktop", + "deploy:desktop:mac": "npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --mac --publish always --project dist/apps/desktop", "build:package:ui-auth": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/ui-auth lib:build", "build:package:ui-auth:prod": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/ui-auth lib:build:prod", "build:package:ui-core": "cross-env NODE_ENV=development NODE_OPTIONS=--max-old-space-size=12288 yarn --cwd ./packages/ui-core lib:build", @@ -193,15 +193,15 @@ "copy-files-desktop": "copyfiles -f packages/core/src/**/*.gql dist/apps/desktop/data/", "build:desktop-timer": "cross-env NODE_ENV=production yarn copy-files-i18n-desktop-timer && yarn run postinstall.electron && yarn build:package:all && yarn run config:prod && yarn run config:desktop-timer:prod && yarn run pack:desktop-timer && yarn run generate:icons:desktop-timer --environment=prod && yarn ng:prod build desktop-timer --prod --base-href ./ && yarn run prepare:desktop-timer && yarn ng:prod build api-desktop --prod --output-path=dist/apps/desktop-timer/desktop-api && yarn run copy-assets-gauzy-timer", "prepare:desktop-timer": "yarn run postinstall.electron && tsc -p apps/desktop-timer/tsconfig.json", - "build:desktop-timer:linux": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:desktop-timer && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --linux --project dist/apps/desktop-timer", - "build:desktop-timer:windows": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:desktop-timer && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 -c.extraMetadata.author.name=Ever build --windows --project dist/apps/desktop-timer", - "build:desktop-timer:mac:quick": "yarn run build:desktop-timer && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --mac --config -c.mac.identity=null --project dist/apps/desktop-timer", - "build:desktop-timer:mac": "yarn run build:desktop-timer && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --project dist/apps/desktop-timer", - "build:desktop-timer:linux:release": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:desktop-timer && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --linux --publish=always --project dist/apps/desktop-timer", - "build:desktop-timer:linux:release:gh": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=30000 yarn run config:prod && yarn run build:desktop-timer && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --linux --publish=always --project dist/apps/desktop-timer", - "build:desktop-timer:windows:release": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:desktop-timer && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 -c.extraMetadata.author.name=Ever build --windows --publish=always --project dist/apps/desktop-timer", - "build:desktop-timer:windows:release:gh": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=30000 yarn run config:prod && yarn run build:desktop-timer && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 -c.extraMetadata.author.name=Ever build --windows --publish=always --project dist/apps/desktop-timer", - "build:desktop-timer:mac:release": "yarn run build:desktop-timer && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --mac --publish=always --project dist/apps/desktop-timer", + "build:desktop-timer:linux": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:desktop-timer && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --linux --project dist/apps/desktop-timer", + "build:desktop-timer:windows": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:desktop-timer && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 -c.extraMetadata.author.name=Ever build --windows --project dist/apps/desktop-timer", + "build:desktop-timer:mac:quick": "yarn run build:desktop-timer && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --mac --config -c.mac.identity=null --project dist/apps/desktop-timer", + "build:desktop-timer:mac": "yarn run build:desktop-timer && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --project dist/apps/desktop-timer", + "build:desktop-timer:linux:release": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:desktop-timer && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --linux --publish=always --project dist/apps/desktop-timer", + "build:desktop-timer:linux:release:gh": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=30000 yarn run config:prod && yarn run build:desktop-timer && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --linux --publish=always --project dist/apps/desktop-timer", + "build:desktop-timer:windows:release": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:desktop-timer && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 -c.extraMetadata.author.name=Ever build --windows --publish=always --project dist/apps/desktop-timer", + "build:desktop-timer:windows:release:gh": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=30000 yarn run config:prod && yarn run build:desktop-timer && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 -c.extraMetadata.author.name=Ever build --windows --publish=always --project dist/apps/desktop-timer", + "build:desktop-timer:mac:release": "yarn run build:desktop-timer && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --mac --publish=always --project dist/apps/desktop-timer", "copy-assets-gauzy": "copyfiles -f apps/desktop/src/assets/snapshot-sound.wav dist/apps/desktop/data/sound/", "copy-assets-gauzy-timer": "copyfiles -f apps/desktop/src/assets/snapshot-sound.wav dist/apps/desktop-timer/data/sound/", "config:electron": "yarn ts-node ./.scripts/electron.env.ts", @@ -211,15 +211,15 @@ "prepare:gauzy-server": "yarn run postinstall.electron && tsc -p apps/server/tsconfig.json", "build:gauzy-server": "cross-env NODE_ENV=production yarn run copy-files-i18n-server && yarn run postinstall.electron && yarn build:package:all && yarn run config:prod && yarn run config:server:prod && yarn run pack:server && yarn run generate:icons:server --environment=prod && yarn ng:prod build gauzy-server --prod --base-href ./ && yarn run prepare:gauzy-server && yarn ng:prod build gauzy-server-ui --prod --base-href ./ && yarn ng:prod build gauzy-server-api --prod && yarn run copy-files-gauzy-server", "copy-files-gauzy-server": "copyfiles -f packages/core/src/**/*.gql dist/apps/gauzy-server/data/", - "build:gauzy-server:windows": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:gauzy-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 -c.extraMetadata.author.name=Ever build --windows --project dist/apps/gauzy-server", - "build:gauzy-server:linux": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:gauzy-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --linux --project dist/apps/gauzy-server", - "build:gauzy-server:mac": "yarn run build:gauzy-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --mac --project dist/apps/gauzy-server", - "build:gauzy-server:windows:release": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:gauzy-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 -c.extraMetadata.author.name=Ever build --windows --publish=always --project dist/apps/gauzy-server", - "build:gauzy-server:windows:release:gh": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=30000 yarn run config:prod && yarn run build:gauzy-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 -c.extraMetadata.author.name=Ever build --windows --publish=always --project dist/apps/gauzy-server", - "build:gauzy-server:linux:release": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:gauzy-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --linux --publish=always --project dist/apps/gauzy-server", - "build:gauzy-server:linux:release:gh": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=30000 yarn run config:prod && yarn run build:gauzy-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --linux --publish=always --project dist/apps/gauzy-server", - "build:gauzy-server:mac:release": "yarn run build:gauzy-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --mac --publish=always --project dist/apps/gauzy-server", - "quick:build:gauzy-server": "yarn electron-builder -c.electronVersion=28.1.0 -c.extraMetadata.author.name=Ever build --mac --project dist/apps/gauzy-server", + "build:gauzy-server:windows": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:gauzy-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 -c.extraMetadata.author.name=Ever build --windows --project dist/apps/gauzy-server", + "build:gauzy-server:linux": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:gauzy-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --linux --project dist/apps/gauzy-server", + "build:gauzy-server:mac": "yarn run build:gauzy-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --mac --project dist/apps/gauzy-server", + "build:gauzy-server:windows:release": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:gauzy-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 -c.extraMetadata.author.name=Ever build --windows --publish=always --project dist/apps/gauzy-server", + "build:gauzy-server:windows:release:gh": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=30000 yarn run config:prod && yarn run build:gauzy-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 -c.extraMetadata.author.name=Ever build --windows --publish=always --project dist/apps/gauzy-server", + "build:gauzy-server:linux:release": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:gauzy-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --linux --publish=always --project dist/apps/gauzy-server", + "build:gauzy-server:linux:release:gh": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=30000 yarn run config:prod && yarn run build:gauzy-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --linux --publish=always --project dist/apps/gauzy-server", + "build:gauzy-server:mac:release": "yarn run build:gauzy-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --mac --publish=always --project dist/apps/gauzy-server", + "quick:build:gauzy-server": "yarn electron-builder -c.electronVersion=30.0.1 -c.extraMetadata.author.name=Ever build --mac --project dist/apps/gauzy-server", "copy-files-i18n-desktop-timer": "yarn run download:translations --desktop=desktop-timer", "copy-files-i18n-desktop": "yarn run download:translations --desktop=desktop", "copy-files-i18n-server": "yarn run download:translations --desktop=server", @@ -236,16 +236,16 @@ "prepare:gauzy-api-server": "yarn run postinstall.electron && tsc -p apps/server-api/tsconfig.json", "build:gauzy-api-server": "cross-env NODE_ENV=production yarn run copy-files-i18n-api-server && yarn run postinstall.electron && yarn build:package:all && yarn run config:prod && yarn run config:api-server:prod && yarn run pack:api-server && yarn run generate:icons:server-api --environment=prod && yarn ng:prod build gauzy-api-server --prod --base-href ./ && yarn run prepare:gauzy-api-server && yarn ng:prod build server-api --prod && yarn run copy-files-gauzy-api-server", "copy-files-gauzy-api-server": "copyfiles -f packages/core/src/**/*.gql dist/apps/gauzy-api-server/data/", - "build:gauzy-api-server:windows": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:gauzy-api-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 -c.extraMetadata.author.name=Ever build --windows --project dist/apps/gauzy-api-server", - "build:gauzy-api-server:linux": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:gauzy-api-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --linux --project dist/apps/gauzy-api-server", - "build:gauzy-api-server:mac": "yarn run build:gauzy-api-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --mac --project dist/apps/gauzy-api-server", - "build:gauzy-api-server:windows:release": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:gauzy-api-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 -c.extraMetadata.author.name=Ever build --windows --publish=always --project dist/apps/gauzy-api-server", - "build:gauzy-api-server:windows:release:gh": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=30000 yarn run config:prod && yarn run build:gauzy-api-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 -c.extraMetadata.author.name=Ever build --windows --publish=always --project dist/apps/gauzy-api-server", - "build:gauzy-api-server:linux:release": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:gauzy-api-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --linux --publish=always --project dist/apps/gauzy-api-server", - "build:gauzy-api-server:linux:release:gh": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=30000 yarn run config:prod && yarn run build:gauzy-api-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --linux --publish=always --project dist/apps/gauzy-api-server", - "build:gauzy-api-server:mac:release": "yarn run build:gauzy-api-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=28.1.0 build --mac --publish=always --project dist/apps/gauzy-api-server", + "build:gauzy-api-server:windows": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:gauzy-api-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 -c.extraMetadata.author.name=Ever build --windows --project dist/apps/gauzy-api-server", + "build:gauzy-api-server:linux": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:gauzy-api-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --linux --project dist/apps/gauzy-api-server", + "build:gauzy-api-server:mac": "yarn run build:gauzy-api-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --mac --project dist/apps/gauzy-api-server", + "build:gauzy-api-server:windows:release": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:gauzy-api-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 -c.extraMetadata.author.name=Ever build --windows --publish=always --project dist/apps/gauzy-api-server", + "build:gauzy-api-server:windows:release:gh": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=30000 yarn run config:prod && yarn run build:gauzy-api-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 -c.extraMetadata.author.name=Ever build --windows --publish=always --project dist/apps/gauzy-api-server", + "build:gauzy-api-server:linux:release": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=12288 yarn run config:prod && yarn run build:gauzy-api-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --linux --publish=always --project dist/apps/gauzy-api-server", + "build:gauzy-api-server:linux:release:gh": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=30000 yarn run config:prod && yarn run build:gauzy-api-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --linux --publish=always --project dist/apps/gauzy-api-server", + "build:gauzy-api-server:mac:release": "yarn run build:gauzy-api-server && npm config set cache .cache && yarn electron-builder -c.electronVersion=30.0.1 build --mac --publish=always --project dist/apps/gauzy-api-server", "copy-files-i18n-api-server": "yarn run download:translations --desktop=server-api", - "quick:build:gauzy-api-server": "yarn electron-builder -c.electronVersion=28.1.0 -c.extraMetadata.author.name=Ever build --mac --project dist/apps/gauzy-api-server", + "quick:build:gauzy-api-server": "yarn electron-builder -c.electronVersion=30.0.1 -c.extraMetadata.author.name=Ever build --mac --project dist/apps/gauzy-api-server", "generate:icons:server-api": "yarn run generate:icons --desktop=server-api", "pack:api-server": "yarn run pack --desktop=gauzy-api-server" }, @@ -404,8 +404,8 @@ "cypress-cucumber-preprocessor": "^4.3.1", "cypress-file-upload": "^5.0.8", "cz-conventional-changelog": "^3.3.0", - "electron": "28.1.0", - "electron-builder": "^24.6.4", + "electron": "^30.0.1", + "electron-builder": "^24.13.3", "envalid": "^6.0.2", "esbuild": "^0.15.13", "eslint-plugin-cypress": "2.13.4", diff --git a/packages/desktop-libs/package.json b/packages/desktop-libs/package.json index 867e59680c3..5522384a9ab 100644 --- a/packages/desktop-libs/package.json +++ b/packages/desktop-libs/package.json @@ -58,6 +58,6 @@ "devDependencies": { "@types/node": "^20.14.9", "@types/unzipper": "^0.10.9", - "electron": "28.1.0" + "electron": "^30.0.1" } } diff --git a/packages/desktop-ui-lib/package.json b/packages/desktop-ui-lib/package.json index 12778eddec4..783121698e7 100644 --- a/packages/desktop-ui-lib/package.json +++ b/packages/desktop-ui-lib/package.json @@ -68,7 +68,7 @@ "@types/jest": "^29.4.4", "@types/moment-duration-format": "^2.2.3", "@types/node": "^20.14.9", - "electron": "28.1.0", + "electron": "^30.0.1", "jest-preset-angular": "^13.1.4", "tslint": "^6.1.3" } diff --git a/packages/desktop-window/package.json b/packages/desktop-window/package.json index c1a357a2f1f..de750b39f42 100644 --- a/packages/desktop-window/package.json +++ b/packages/desktop-window/package.json @@ -33,6 +33,6 @@ }, "devDependencies": { "@types/node": "^20.14.9", - "electron": "28.1.0" + "electron": "^30.0.1" } } diff --git a/yarn.lock b/yarn.lock index c702bbf5989..374850e196f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11970,13 +11970,6 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.45.tgz#2c0fafd78705e7a18b7906b5201a522719dc5190" integrity sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw== -"@types/node@^18.11.18": - version "18.19.28" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.28.tgz#c64a2c992c8ebbf61100a4570e4eebc1934ae030" - integrity sha512-J5cOGD9n4x3YGgVuaND6khm5x07MMdAKkRyXnjVR6KFhLMNh2yONGiP7Z+4+tBOt5mK+GvDTiacTOVGGpqiecw== - dependencies: - undici-types "~5.26.4" - "@types/node@^20.14.9": version "20.14.9" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.9.tgz#12e8e765ab27f8c421a1820c99f5f313a933b420" @@ -18823,7 +18816,7 @@ ejs@^3.1.7, ejs@^3.1.8: dependencies: jake "^10.8.5" -electron-builder@^24.6.4: +electron-builder@^24.13.3: version "24.13.3" resolved "https://registry.yarnpkg.com/electron-builder/-/electron-builder-24.13.3.tgz#c506dfebd36d9a50a83ee8aa32d803d83dbe4616" integrity sha512-yZSgVHft5dNVlo31qmJAe4BVKQfFdwpRw7sFp1iQglDRCDD6r22zfRJuZlhtB5gp9FHUxCMEoWGq10SkCnMAIg== @@ -18962,13 +18955,13 @@ electron@*: "@types/node" "^20.9.0" extract-zip "^2.0.1" -electron@28.1.0: - version "28.1.0" - resolved "https://registry.yarnpkg.com/electron/-/electron-28.1.0.tgz#9de1ecdaafcb0ec5753827f14dfb199e6c84545e" - integrity sha512-82Y7o4PSWPn1o/aVwYPsgmBw6Gyf2lVHpaBu3Ef8LrLWXxytg7ZRZr/RtDqEMOzQp3+mcuy3huH84MyjdmP50Q== +electron@^30.0.1: + version "30.5.1" + resolved "https://registry.yarnpkg.com/electron/-/electron-30.5.1.tgz#9f6060ce5b869c3803cbf8064305e9c3056c0744" + integrity sha512-AhL7+mZ8Lg14iaNfoYTkXQ2qee8mmsQyllKdqxlpv/zrKgfxz6jNVtcRRbQtLxtF8yzcImWdfTQROpYiPumdbw== dependencies: "@electron/get" "^2.0.0" - "@types/node" "^18.11.18" + "@types/node" "^20.9.0" extract-zip "^2.0.1" elliptic@^6.5.3, elliptic@^6.5.5: From 6f8798f66d1afd674f98d8bd92ba2c7c4785ae38 Mon Sep 17 00:00:00 2001 From: Kifungo A <45813955+adkif@users.noreply.github.com> Date: Wed, 18 Sep 2024 10:41:52 +0200 Subject: [PATCH 2/5] refactor: Rename event handler `TAKE_CAPTURE` to `COLLECT_ACTIVITIES` and use meaningful method names. --- packages/desktop-libs/src/lib/desktop-ipc.ts | 12 ++++++------ packages/desktop-libs/src/lib/desktop-timer.ts | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/desktop-libs/src/lib/desktop-ipc.ts b/packages/desktop-libs/src/lib/desktop-ipc.ts index caa9645f7f8..6411fa928c3 100644 --- a/packages/desktop-libs/src/lib/desktop-ipc.ts +++ b/packages/desktop-libs/src/lib/desktop-ipc.ts @@ -320,13 +320,13 @@ export function ipcMainHandler(store, startServer, knex, config, timeTrackerWind } }); - ipcMain.handle('TAKE_SCREEN_CAPTURE', async (event, { quitApp }) => { + ipcMain.handle('COLLECT_ACTIVITIES', async (event, { quitApp }) => { try { - log.info('Take Screen Capture'); - return await timerHandler.makeScreenshot(knex, quitApp); + log.info('Collect Activities'); + return await timerHandler.collectAllActivities(knex, quitApp); } catch (error) { - log.error('Error on take screen capture', error); - throw new UIError('500', error, 'IPCTKSCAPTURE'); + log.error('Error collecting activities', error); + throw new UIError('500', error, 'HANDLE ACTIVITIES'); } }); @@ -1195,7 +1195,7 @@ export function removeAllHandlers() { 'UPDATE_SYNCED', 'DESKTOP_CAPTURER_GET_SOURCES', 'FINISH_SYNCED_TIMER', - 'TAKE_SCREEN_CAPTURE', + 'COLLECT_ACTIVITIES', 'START_SERVER' ]; channels.forEach((channel: string) => { diff --git a/packages/desktop-libs/src/lib/desktop-timer.ts b/packages/desktop-libs/src/lib/desktop-timer.ts index 60e91b31969..67ffcef20f1 100644 --- a/packages/desktop-libs/src/lib/desktop-timer.ts +++ b/packages/desktop-libs/src/lib/desktop-timer.ts @@ -635,19 +635,19 @@ export default class TimerHandler { } /* - * Make screenshots and activities after start and stop timer + * Collect All activities after start and stop timer */ - async makeScreenshot(knex, quitApp) { + async collectAllActivities(knex, quitApp) { console.log(`Time Slot Start/End At ${quitApp ? 'End' : 'Beginning'}`, this.timeSlotStart); if (this.timeSlotStart) { - console.log('Make Screenshot Started for: ', this.timeSlotStart); + console.log('Collection Started At: ', this.timeSlotStart); await this._activeWindow.updateActivities(); console.log('Updated Activities'); const activities = await this.getAllActivities(knex, this.timeSlotStart); - console.log('Make Screenshot Ended for: ', this.timeSlotStart); + console.log('Collection Ended At: ', this.timeSlotStart); return activities; } else { From d5283b4eee739106bcee56b56b7ebddd14b22908 Mon Sep 17 00:00:00 2001 From: Kifungo A <45813955+adkif@users.noreply.github.com> Date: Wed, 18 Sep 2024 10:45:09 +0200 Subject: [PATCH 3/5] refactor: Apply SOLID principles to improve the `sendActivities` method for clarity and maintainability. Implement a new thread to capture the screen and send activities on start and stop. --- .../time-tracker/time-tracker.component.ts | 226 ++++++++++-------- 1 file changed, 132 insertions(+), 94 deletions(-) diff --git a/packages/desktop-ui-lib/src/lib/time-tracker/time-tracker.component.ts b/packages/desktop-ui-lib/src/lib/time-tracker/time-tracker.component.ts index fc3153320e9..99bfde90faa 100644 --- a/packages/desktop-ui-lib/src/lib/time-tracker/time-tracker.component.ts +++ b/packages/desktop-ui-lib/src/lib/time-tracker/time-tracker.component.ts @@ -19,6 +19,7 @@ import { ITaskStatus, ITaskUpdateInput, ITimeLog, + ITimeSlotTimeLogs, PermissionsEnum, TaskStatusEnum } from '@gauzy/contracts'; @@ -1167,7 +1168,7 @@ export class TimeTrackerComponent implements OnInit, AfterViewInit { this.electronService.ipcRenderer.on('prepare_activities_screenshot', (event, arg) => this._ngZone.run(async () => { - await this.sendActivities(arg); + await this.takeCaptureAndSendActivities(arg); }) ); @@ -1659,13 +1660,15 @@ export class TimeTrackerComponent implements OnInit, AfterViewInit { if (this._startMode === TimerStartMode.MANUAL) { console.log('Taking screen capture in startTimer'); - const activities = await this.electronService.ipcRenderer.invoke('TAKE_SCREEN_CAPTURE', { + const activities = await this.electronService.ipcRenderer.invoke('COLLECT_ACTIVITIES', { quitApp: this.quitApp }); - console.log('Sending activities', activities); - - await this.sendActivities(activities); + asyncScheduler.schedule(async () => { + this._loggerService.info('Capturing Screen and Sending Activities Start...', activities); + await this.takeCaptureAndSendActivities(activities); + this._loggerService.info('Capturing Screen and Sending Activities Done ✔️'); + }, 1000); } console.log('Updating Task Status'); @@ -1705,11 +1708,13 @@ export class TimeTrackerComponent implements OnInit, AfterViewInit { if (this._startMode === TimerStartMode.MANUAL) { console.log('Taking screen capture'); - const activities = await this.electronService.ipcRenderer.invoke('TAKE_SCREEN_CAPTURE', config); - - console.log('Sending activities'); + const activities = await this.electronService.ipcRenderer.invoke('COLLECT_ACTIVITIES', config); - await this.sendActivities(activities); + asyncScheduler.schedule(async () => { + this._loggerService.info('Capturing Screen and Sending Activities Start...', activities); + await this.takeCaptureAndSendActivities(activities); + this._loggerService.info('Capturing Screen and Sending Activities Done ✔️'); + }, 1000); } console.log('Stopping timer'); @@ -2098,39 +2103,109 @@ export class TimeTrackerComponent implements OnInit, AfterViewInit { } } - public async sendActivities(arg): Promise { - console.log('sendActivities'); + public async takeScreenCapture(arg) { + let HighResolutionScreenshots = []; + let lowResolutionScreenshots = []; + + try { + this._loggerService.info('Take screen capture'); + if (!arg.displays) { + HighResolutionScreenshots = await this.getScreenshot(arg, false); + lowResolutionScreenshots = await this.getScreenshot(arg, true); + } else { + HighResolutionScreenshots = arg.displays; + } + + this._loggerService.info('Update timer last capture'); + this.handleLastCapture(HighResolutionScreenshots); + + // notify + this._loggerService.info('Notify screen capture to user'); + this.screenshotNotify(arg, lowResolutionScreenshots); + + return HighResolutionScreenshots; + } catch (error) { + this._loggerService.error('Error on screenshot', error); + } + } + + public checkSendActivitiesValidationFail(arg) { + this._loggerService.info('sendActivities'); if (this.isRemoteTimer) { - console.log('isRemoteTimer exit from sendActivities'); - return; + this._loggerService.info('isRemoteTimer exit from sendActivities'); + return true; } if (!arg) { this._loggerService.info('No data available to send from sendActivities'); - return; + return true; } - // screenshot process - let screenshotImg = []; + return false; + } - let thumbScreenshotImg = []; + public async handleLastCapture(screenshots: any[]) { + if (!this._isOffline && screenshots.length > 0) { + /* Converting the screenshot image to a base64 string. */ + const original = `data:image/png;base64, ${this.buffToB64(screenshots[0])}`; - try { - if (!arg.displays) { - screenshotImg = await this.getScreenshot(arg, false); - thumbScreenshotImg = await this.getScreenshot(arg, true); - } else { - screenshotImg = arg.displays; - } + /* Compressing the image to 320x200 */ + const compressed = await compressImage(original, 320, 200); - // notify - this.screenshotNotify(arg, thumbScreenshotImg); + /* Saving compressed image to the local storage. */ + await this.localImage(compressed, original); + + /* Update image waiting for server response*/ + this.updateImageUrl(null); + + /* Adding the last screen capture to the screenshots array. */ + this.screenshots$.next([...this.screenshots, this.lastScreenCapture]); + } + } + + public async uploadScreenshots(arg, timeSlotId: string, screenshots: any[]) { + this._loggerService.info('Upload screenshot to TimeSlot api'); + try { + await Promise.all( + screenshots.map(async (img) => { + return await this.uploadsScreenshot(arg, img, timeSlotId); + }) + ); } catch (error) { - this._loggerService.error('Error on screenshot', error); + console.log('ERROR', error); + } + + this._loggerService.info('Get last time slot image'); + await this.getLastTimeSlotImage({ + ...arg, + token: this.token, + apiHost: this.apiHost, + timeSlotId + }); + } + + private handleCreateTimeSlotError(error: any, arg, screenshots) { + const paramActivity = this.buildParamActivity(arg); + this._loggerService.error('Error sending to API timeslot:', error); + + try { + this.electronService.ipcRenderer.send('failed_synced_timeslot', { + params: { + ...paramActivity, + b64Imgs: screenshots.map((img) => ({ + b64img: this.buffToB64(img), + fileName: this.fileNameFormat(img) + })) + } + }); + } catch (e) { + this._loggerService.error('Failed to send failed_synced_timeslot event', e); } + } - const paramActivity = { + private buildParamActivity(arg) { + return { employeeId: arg.employeeId, projectId: arg.projectId, duration: arg.duration, @@ -2148,23 +2223,26 @@ export class TimeTrackerComponent implements OnInit, AfterViewInit { isAw: arg.isAw, isAwConnected: arg.isAwConnected }; + } + public async createTimeSlot(arg, screenshots: any[]) { try { - const resActivities: any = await this.timeTrackerService.pushToTimeSlot(paramActivity); - - console.log('Result of TimeSlot', resActivities); - - const timeLogs = resActivities.timeLogs; + this._loggerService.info('Build Param Activity'); + const paramActivity = this.buildParamActivity(arg); + this._loggerService.info('Create Time Slot'); + const { timeLogs, id: timeSlotId } = (await this.timeTrackerService.pushToTimeSlot( + paramActivity + )) as ITimeSlotTimeLogs; if (!timeLogs?.length) { // Stop process if there is no time logs associate to activity result. this._loggerService.error('[@SendActivities]', 'No time logs'); - return; + return null; } - + this._loggerService.info('Post Create activities'); this.electronService.ipcRenderer.send('return_time_slot', { timerId: arg.timerId, - timeSlotId: resActivities.id, + timeSlotId, quitApp: arg.quitApp, timeLogs: timeLogs }); @@ -2175,70 +2253,30 @@ export class TimeTrackerComponent implements OnInit, AfterViewInit { idsWakatime: arg.idsWakatime }); - if (!this._isOffline && screenshotImg.length > 0) { - /* Converting the screenshot image to a base64 string. */ - const original = `data:image/png;base64, ${this.buffToB64(screenshotImg[0])}`; - - /* Compressing the image to 320x200 */ - const compressed = await compressImage(original, 320, 200); - - /* Saving compressed image to the local storage. */ - await this.localImage(compressed, original); - - /* Update image waiting for server response*/ - this.updateImageUrl(null); - - /* Adding the last screen capture to the screenshots array. */ - this.screenshots$.next([...this.screenshots, this.lastScreenCapture]); - } - - asapScheduler.schedule(async () => { - console.log('upload screenshot to TimeSlot api'); - try { - await Promise.all( - screenshotImg.map(async (img) => { - return await this.uploadsScreenshot(arg, img, resActivities.id); - }) - ); - } catch (error) { - console.log('ERROR', error); - } - - console.log('Get last time slot image'); - await this.getLastTimeSlotImage({ - ...arg, - token: this.token, - apiHost: this.apiHost, - timeSlotId - }); - }); - - const timeSlotId = resActivities.id; - - console.log('Sending create-synced-interval event...'); + this._loggerService.info('Sending create-synced-interval event...'); this.electronService.ipcRenderer.send('create-synced-interval', { ...paramActivity, remoteId: timeSlotId, b64Imgs: [] }); + + return timeSlotId; } catch (error) { - this._loggerService.error('Error send to api timeslot::', error); - try { - console.log('Sending failed_synced_timeslot event...'); - this.electronService.ipcRenderer.send('failed_synced_timeslot', { - params: { - ...paramActivity, - b64Imgs: screenshotImg.map((img) => { - return { - b64img: this.buffToB64(img), - fileName: this.fileNameFormat(img) - }; - }) - } - }); - } catch (e) { - this._loggerService.error('Failed to send failed_synced_timeslot event', e); - } + this.handleCreateTimeSlotError(error, arg, screenshots); + return null; + } + } + + public async takeCaptureAndSendActivities(activities) { + // Check validations + if (this.checkSendActivitiesValidationFail(activities)) return; + // Take Screenshots + const screenshots = await this.takeScreenCapture(activities); + // Create time slot and return time slot ID + const timeslotId = await this.createTimeSlot(activities, screenshots); + // Upload screenshots if available + if (timeslotId && screenshots.length > 0) { + await this.uploadScreenshots(activities, timeslotId, screenshots); } } From 0c67212c02710c9cb9415fddf3ec9e88a1894236 Mon Sep 17 00:00:00 2001 From: Kifungo A <45813955+adkif@users.noreply.github.com> Date: Wed, 18 Sep 2024 12:55:53 +0200 Subject: [PATCH 4/5] fix: add moment import and used moment.tz.guess() to set default timeZone in request.store.ts, monthly.service.ts, and weekly.service.ts. --- .../src/lib/recap/+state/request/request.store.ts | 2 ++ .../src/lib/recap/monthly/+state/monthly.service.ts | 3 ++- .../src/lib/recap/weekly/+state/weekly.service.ts | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/desktop-ui-lib/src/lib/recap/+state/request/request.store.ts b/packages/desktop-ui-lib/src/lib/recap/+state/request/request.store.ts index 9a8eceed71d..030aae00c29 100644 --- a/packages/desktop-ui-lib/src/lib/recap/+state/request/request.store.ts +++ b/packages/desktop-ui-lib/src/lib/recap/+state/request/request.store.ts @@ -1,6 +1,7 @@ import { Injectable } from '@angular/core'; import { Store, StoreConfig } from '@datorama/akita'; import { ITimeLogFilters, TimeLogSourceEnum } from '@gauzy/contracts'; +import { moment } from '../../shared/features/date-range-picker'; export type IRequestState = ITimeLogFilters; @@ -8,6 +9,7 @@ export function createInitialState(): IRequestState { return { source: [TimeLogSourceEnum.DESKTOP], logType: [], + timeZone: moment.tz.guess(), activityLevel: { start: 0, end: 100 diff --git a/packages/desktop-ui-lib/src/lib/recap/monthly/+state/monthly.service.ts b/packages/desktop-ui-lib/src/lib/recap/monthly/+state/monthly.service.ts index 304e652e1b1..ab00e980f76 100644 --- a/packages/desktop-ui-lib/src/lib/recap/monthly/+state/monthly.service.ts +++ b/packages/desktop-ui-lib/src/lib/recap/monthly/+state/monthly.service.ts @@ -4,6 +4,7 @@ import { Observable } from 'rxjs'; import { RequestQuery } from '../../+state/request/request.query'; import { Store, TimeTrackerDateManager, ToastrNotificationService } from '../../../services'; import { TimesheetService, TimesheetStatisticsService } from '../../services/timesheet'; +import { moment } from '../../shared/features/date-range-picker'; import { IDateRangePicker } from '../../shared/features/date-range-picker/date-picker.interface'; import { MonthlyRecapQuery } from './monthly.query'; import { IMonthlyRecapState, MonthlyRecapStore } from './monthly.store'; @@ -51,7 +52,7 @@ export class MonthlyRecapService { this.monthlyStore.setLoading(true); const { organizationId, tenantId, user } = this.store; const employeeIds = [user.employee.id]; - const timeZone = user.timeZone; + const timeZone = user.timeZone || moment.tz.guess(); const timeFormat = user.timeFormat; const request: IGetTimeLogInput = { ...this.requestQuery.request, diff --git a/packages/desktop-ui-lib/src/lib/recap/weekly/+state/weekly.service.ts b/packages/desktop-ui-lib/src/lib/recap/weekly/+state/weekly.service.ts index 7f18365d219..527217ceaf9 100644 --- a/packages/desktop-ui-lib/src/lib/recap/weekly/+state/weekly.service.ts +++ b/packages/desktop-ui-lib/src/lib/recap/weekly/+state/weekly.service.ts @@ -4,6 +4,7 @@ import { Observable } from 'rxjs'; import { RequestQuery } from '../../+state/request/request.query'; import { Store, TimeTrackerDateManager, ToastrNotificationService } from '../../../services'; import { TimesheetService, TimesheetStatisticsService } from '../../services/timesheet'; +import { moment } from '../../shared/features/date-range-picker'; import { IDateRangePicker } from '../../shared/features/date-range-picker/date-picker.interface'; import { WeeklyRecapQuery } from './weekly.query'; import { IWeeklyRecapState, WeeklyRecapStore } from './weekly.store'; @@ -51,7 +52,7 @@ export class WeeklyRecapService { this.weeklyStore.setLoading(true); const { organizationId, tenantId, user } = this.store; const employeeIds = [user.employee.id]; - const timeZone = user.timeZone; + const timeZone = user.timeZone || moment.tz.guess(); const timeFormat = user.timeFormat; const request: IGetTimeLogInput = { ...this.requestQuery.request, From 947c8a6c13bd6faf5a6f92df56e196cd5d1d416f Mon Sep 17 00:00:00 2001 From: Kifungo A <45813955+adkif@users.noreply.github.com> Date: Wed, 18 Sep 2024 17:04:03 +0200 Subject: [PATCH 5/5] fix: time tracker and login page style --- packages/desktop-ui-lib/src/lib/login/login.component.scss | 2 +- .../activity-report/activity-report.component.scss | 2 +- .../src/lib/time-tracker/time-tracker.component.scss | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/desktop-ui-lib/src/lib/login/login.component.scss b/packages/desktop-ui-lib/src/lib/login/login.component.scss index 5b34bb7c326..32bf3510141 100644 --- a/packages/desktop-ui-lib/src/lib/login/login.component.scss +++ b/packages/desktop-ui-lib/src/lib/login/login.component.scss @@ -444,7 +444,7 @@ ::ng-deep { nb-card-body { - padding: .5rem; + padding: 36px 0.5rem 0.5rem; } nb-card-header { diff --git a/packages/desktop-ui-lib/src/lib/recap/shared/features/activity-report/activity-report.component.scss b/packages/desktop-ui-lib/src/lib/recap/shared/features/activity-report/activity-report.component.scss index 1a0ac287f2d..c161f695528 100644 --- a/packages/desktop-ui-lib/src/lib/recap/shared/features/activity-report/activity-report.component.scss +++ b/packages/desktop-ui-lib/src/lib/recap/shared/features/activity-report/activity-report.component.scss @@ -6,7 +6,7 @@ padding-bottom: 10px; background-color: var(--gauzy-card-1); border-radius: var(--border-radius); - height: calc(100vh - 23.75rem); + height: calc(100vh - 22.625rem); overflow-y: auto; .table-row-custom { diff --git a/packages/desktop-ui-lib/src/lib/time-tracker/time-tracker.component.scss b/packages/desktop-ui-lib/src/lib/time-tracker/time-tracker.component.scss index a19862558cd..7e5eebcb0a2 100644 --- a/packages/desktop-ui-lib/src/lib/time-tracker/time-tracker.component.scss +++ b/packages/desktop-ui-lib/src/lib/time-tracker/time-tracker.component.scss @@ -17,7 +17,7 @@ } .timer-window-container { - margin-top: 20px; + margin-top: 28px; display: flex; flex-direction: row; align-items: flex-start; @@ -36,7 +36,7 @@ .timer { min-width: 360px !important; width: auto; - height: calc(100vh - 2.5rem); + height: calc(100vh - 2.5rem - 23px); overflow: hidden; &.expanded { @@ -633,14 +633,13 @@ img { flex-direction: column; padding: 8px 4px; border-radius: var(--border-radius); - height: calc(100vh - 15.75rem); + height: calc(100vh - 16.25rem); width: auto; .table-scroll-container { flex-grow: 10; max-height: unset; padding: 0 4px 0; - margin-bottom: 8px; overflow-x: hidden; } }