From 2304f37cbec7e2f183b929af106f2634be85a4d7 Mon Sep 17 00:00:00 2001 From: advplyr Date: Wed, 17 Aug 2022 18:44:21 -0500 Subject: [PATCH] Add:Schedule periodic library scans #655 --- .../components/modals/libraries/EditModal.vue | 9 ++- .../modals/libraries/ScheduleScan.vue | 7 ++- client/components/ui/TextInput.vue | 5 +- .../widgets/CronExpressionBuilder.vue | 19 ++++-- server/Server.js | 5 +- server/controllers/LibraryController.js | 3 + server/libs/nodeCron/scheduler.js | 16 ++--- server/managers/BackupManager.js | 4 +- server/managers/CronManager.js | 61 +++++++++++++++++++ server/routers/ApiRouter.js | 3 +- 10 files changed, 112 insertions(+), 20 deletions(-) create mode 100644 server/managers/CronManager.js diff --git a/client/components/modals/libraries/EditModal.vue b/client/components/modals/libraries/EditModal.vue index 6d52a3b1..e0652d9f 100644 --- a/client/components/modals/libraries/EditModal.vue +++ b/client/components/modals/libraries/EditModal.vue @@ -12,7 +12,7 @@
- +
@@ -144,6 +144,13 @@ export default { submit() { if (!this.validate()) return + // If custom expression input is focused then unfocus it instead of submitting + if (this.$refs.tabComponent && this.$refs.tabComponent.checkBlurExpressionInput) { + if (this.$refs.tabComponent.checkBlurExpressionInput()) { + return + } + } + if (this.library) { this.submitUpdateLibrary() } else { diff --git a/client/components/modals/libraries/ScheduleScan.vue b/client/components/modals/libraries/ScheduleScan.vue index 743b6970..df664722 100644 --- a/client/components/modals/libraries/ScheduleScan.vue +++ b/client/components/modals/libraries/ScheduleScan.vue @@ -4,7 +4,7 @@

Schedule Automatic Library Scans

- +
@@ -25,6 +25,11 @@ export default { }, computed: {}, methods: { + checkBlurExpressionInput() { + // returns true if advanced cron input is focused + if (!this.$refs.cronExpressionBuilder) return false + return this.$refs.cronExpressionBuilder.checkBlurExpressionInput() + }, toggleEnableAutoScan(v) { if (!v) this.updatedCron(null) else if (!this.cronExpression) { diff --git a/client/components/ui/TextInput.vue b/client/components/ui/TextInput.vue index 7943e288..5ae15663 100644 --- a/client/components/ui/TextInput.vue +++ b/client/components/ui/TextInput.vue @@ -36,7 +36,8 @@ export default { data() { return { showPassword: false, - isHovering: false + isHovering: false, + isFocused: false } }, computed: { @@ -66,9 +67,11 @@ export default { this.inputValue = '' }, focused() { + this.isFocused = true this.$emit('focus') }, blurred() { + this.isFocused = false this.$emit('blur') }, change(e) { diff --git a/client/components/widgets/CronExpressionBuilder.vue b/client/components/widgets/CronExpressionBuilder.vue index 3e3f261b..31cb4761 100644 --- a/client/components/widgets/CronExpressionBuilder.vue +++ b/client/components/widgets/CronExpressionBuilder.vue @@ -24,7 +24,7 @@