Compare commits

...

425 Commits

Author SHA1 Message Date
Fabio Formosa
71bc29df2a released v5.0.1 2026-05-15 01:21:03 +02:00
Fabio Formosa
59a8b39305 added screenshots to be linked to the readme 2026-05-15 00:26:11 +02:00
Fabio Formosa
ab1c3b5606 Merge pull request #140 from fabioformosa/develop
Releasing v5.0.0
2026-05-15 00:21:51 +02:00
Fabio Formosa
1ae381e842 #94 temporary excluded a sonar rule 2026-05-15 00:18:34 +02:00
Fabio Formosa
7677947447 switched to ver 5.0.0-SNAPSHOT 2026-05-14 23:33:38 +02:00
Fabio Formosa
0a62366fa4 updated the README file 2026-05-14 23:25:08 +02:00
Fabio Formosa
cc433bb531 Merge pull request #136 from fabioformosa/feature/#9x_trigger_types
Feature/#9x trigger types
2026-05-14 08:26:03 +02:00
Fabio Formosa
501ef6c062 fixed sonar issues 2026-05-14 08:22:33 +02:00
Fabio Formosa
b6529b453a fixed the coverage 2026-05-14 00:48:08 +02:00
Fabio Formosa
40d8c952a0 fixed the coverage 2026-05-14 00:47:39 +02:00
Fabio Formosa
c1511b54f8 fixed tests and github actions 2026-05-14 00:17:54 +02:00
Fabio Formosa
9a50949fcc fixed tests and github actions 2026-05-14 00:06:34 +02:00
Fabio Formosa
699e661d81 restyled the login page 2026-05-13 22:48:56 +02:00
Fabio Formosa
93990a5994 #90 #91 #92 #93 supported all trigger types 2026-05-12 22:53:11 +02:00
Fabio Formosa
82e684f0a7 #135 added scheduled job management 2026-05-12 22:13:03 +02:00
Fabio Formosa
7d481247bc #132 #133 refactored some existing endpoint and added new ones to manage triggers 2026-05-12 21:41:31 +02:00
Fabio Formosa
e24c5bc62a #134 added the new UI layout and style 2026-05-12 00:59:14 +02:00
Fabio Formosa
29fff2a6cd #130 imported the new version of metamorphosis lib and reverted the conversion service 2026-05-09 15:54:43 +02:00
Fabio Formosa
2a20b930f0 #130 upgraded github actions 2026-05-09 12:06:11 +02:00
Fabio Formosa
b0ba230abe #130 upgraded Spring Boot to 4.0.6 2026-05-09 11:48:39 +02:00
Fabio Formosa
1e48e1803f #130 upgraded Spring Boot to 4.0.6 2026-05-09 11:48:24 +02:00
Fabio Formosa
e90648c027 #131 upgraded Angular to v21 2026-05-09 10:51:18 +02:00
Fabio Formosa
23417fa6a2 Merge branch 'feature/#101_angular15_update' into develop 2026-05-09 00:11:12 +02:00
Fabio Formosa
57d5ebd641 set the new snapshot version 4.1.1-SNAPSHOT 2026-05-08 23:52:34 +02:00
Fabio Formosa
da8c9d5707 Remove Maven Central badge from README
Removed Maven Central badge from README.
2026-05-08 22:53:46 +02:00
Fabio Formosa
6b245c7eec released v4.1.1 2026-05-08 22:36:40 +02:00
Fabio Formosa
d7653dc73e released v4.1.0 2026-05-08 21:50:38 +02:00
Fabio Formosa
e6a7b35f6a released v4.1.0 2026-05-08 21:48:57 +02:00
Fabio Formosa
f6e02ae181 #103 fixed log retrieval through websocket 2026-05-08 21:41:04 +02:00
Fabio Formosa
f6d6cd16e7 Merge branch 'develop' into feature/#101_angular15_update
# Conflicts:
#	quartz-manager-frontend/package-lock.json
#	quartz-manager-frontend/src/app/components/logs-panel/logs-panel.component.html
#	quartz-manager-frontend/src/app/components/progress-panel/progress-panel.component.html
#	quartz-manager-frontend/src/app/components/simple-trigger-config/simple-trigger-config.component.ts
#	quartz-manager-frontend/src/app/views/manager/manager.component.html
#	quartz-manager-frontend/src/app/views/manager/manager.component.ts
2026-05-08 00:59:59 +02:00
Fabio Formosa
87901fe6a7 #103 fixed some font sizes 2026-05-08 00:42:08 +02:00
Fabio Formosa
3088a2fec1 Merge pull request #129 from fabioformosa/develop
Develop for releasing 4.1.0
2026-05-08 00:39:01 +02:00
Fabio Formosa
bdd0caa026 Merge pull request #128 from fabioformosa/feature/#103_multiple_triggers
Feature/#103 multiple triggers
2026-05-06 23:46:02 +02:00
Fabio Formosa
068b0eed34 #103 fixed a test 2026-05-06 23:43:35 +02:00
Fabio Formosa
b2f9692815 #103 fixed a test 2026-05-06 23:41:08 +02:00
Fabio Formosa
5fc6c56409 Merge branch 'develop' into feature/#103_multiple_triggers
# Conflicts:
#	quartz-manager-parent/.gitignore
2026-05-06 23:26:40 +02:00
Fabio Formosa
d7a78c57ae #103 minor enhancements 2026-05-06 23:13:44 +02:00
Fabio Formosa
31658416f5 #103 final step into multi-trigger feature 2026-05-06 01:22:30 +02:00
Fabio Formosa
1d81e88684 Merge remote-tracking branch 'origin/master' into develop 2026-04-27 23:13:05 +02:00
Fabio Formosa
f55a58b100 Add workflow_dispatch trigger to sonar-java.yml
added the workflow_dispatch to the GitHub Action
2026-04-23 23:26:20 +02:00
Fabio Formosa
902542e480 Update sonar-java.yml
added the workflow_dispatch trigger for the sonar action
2026-04-23 22:39:34 +02:00
Fabio Formosa
c198d32bd5 bump to version 4.0.11-SNAPSHOT 2025-05-23 23:06:34 +02:00
Fabio Formosa
56d9f5d94f bump to version 4.0.10 2025-05-23 23:04:28 +02:00
Fabio Formosa
45f66d51fe Merge remote-tracking branch 'origin/master' into develop 2025-05-23 23:00:37 +02:00
Fabio Formosa
95769248a3 migrated to the new maven central repo 2025-05-23 21:52:30 +02:00
Fabio Formosa
dcbf3eb277 migrated to the new maven central repo 2025-05-23 20:10:53 +02:00
Fabio Formosa
fab977fd7d added the staging and prod env to the delivery pipeline 2024-07-27 17:41:31 +02:00
Fabio Formosa
9d2a01ebbe added the staging and prod env to the delivery pipeline 2024-07-27 17:33:31 +02:00
Fabio Formosa
9a0789cab0 minor commit 2024-07-27 17:08:11 +02:00
Fabio Formosa
e5a6b8b32b minor commit 2024-07-27 16:33:24 +02:00
Fabio Formosa
4537c8e304 minor commit 2024-07-18 23:53:27 +02:00
Fabio Formosa
82ac821b34 minor commit 2024-07-17 00:30:49 +02:00
Fabio Formosa
0a4a31ae65 fixed the chart path 2024-07-17 00:21:24 +02:00
Fabio Formosa
3b325536e8 fixed the dev cluster reference 2024-07-17 00:06:58 +02:00
Fabio Formosa
307c6eab98 fixed the docker image in the cloud deploy pipeline 2024-07-16 23:49:38 +02:00
Fabio Formosa
b1ff70265f added verbosity to cloudbuild.yaml 2024-07-16 23:15:54 +02:00
Fabio Formosa
226296737d added verbosity to cloudbuild.yaml 2024-07-16 23:05:34 +02:00
Fabio Formosa
a5750d1d0d duplicated the helm props replacements 2024-07-16 00:24:10 +02:00
Fabio Formosa
f71c9b20ab minor commit 2024-07-16 00:15:05 +02:00
Fabio Formosa
9cc55492dc fixed the pipeline name 2024-07-15 23:58:08 +02:00
Fabio Formosa
6d36e4620c fixed the path of the pipeline file 2024-07-15 23:47:32 +02:00
Fabio Formosa
4d5e8f62c3 added a google deploy pipeline 2024-07-15 23:39:51 +02:00
Fabio Formosa
8ba33f25b4 fixed copy path in the Dockerfile 2024-07-13 16:00:44 +02:00
Fabio Formosa
7a742d5aea fixed copy path in the Dockerfile 2024-07-13 15:52:40 +02:00
Fabio Formosa
abd25d6158 fixed a wrong path in cloudbuild.yaml 2024-07-13 15:33:10 +02:00
Fabio Formosa
9f46e52564 added a logging policy to cloudbuild.yaml and pushed skaffold.yaml 2024-07-13 15:28:24 +02:00
Fabio Formosa
e6927209e5 added a helm chart to the web-showcase module and cloudbuild.yaml and skaffold.yaml 2024-07-13 13:00:12 +02:00
Fabio Formosa
63fbedbdc8 moved the web-showcase from war to jar and added a dockerfile 2024-07-12 00:36:47 +02:00
Fabio Formosa
6ec886686f #101 added smaller fonts for job class and misfire instructions 2024-03-25 23:29:32 +01:00
Fabio Formosa
f96e356c8a Merge branch 'feature/#101_angular15_update' of github.com:fabioformosa/quartz-manager into feature/#101_angular15_update
# Conflicts:
#	.gitignore
#	quartz-manager-frontend/src/styles.css
2024-03-25 22:40:54 +01:00
Fabio Formosa
c646624e45 Merge pull request #122 from ChistaDATA/feature/#101_angular15_update
fix: update footer font size
2024-03-25 22:39:37 +01:00
Fabio Formosa
0148056b1f Update README.md 2024-03-07 23:32:51 +01:00
Midhun A Darvin
e9542352b5 feat: update footer font size 2024-03-04 20:14:34 +05:30
Midhun A Darvin
7cef35517b fix: style regression issues
- add Roboto font face as dependency
- fix font size regression issue in select inputs
- fix scroll regression issue
- fix triggerName not disabled during reschedule
2024-02-19 23:42:37 +01:00
Midhun A Darvin
bc0619a92a feat: update padding & styles
- apply padding fixes
- remove `enableTrigger` variable and directly use `simpleTriggerReactiveForm.enabled`
-  apply default styles of matInput
2024-02-19 23:42:37 +01:00
Midhun A Darvin
2debf6c63f feat: update angular version from 14 to 15
- update package.json dependencies
- npm audit force fix
- add `MatDialogModule` to app module imports
- mat-form-field has appearance property `outline` and `fill` now
- update unit tests
2024-02-19 23:42:32 +01:00
Fabio Formosa
baa01d10cb Merge pull request #121 from ChistaDATA/feature/#101_angular15_update
fix: style regression issues
2024-02-19 23:34:30 +01:00
Midhun A Darvin
adb4864c85 fix: style regression issues
- add Roboto font face as dependency
- fix font size regression issue in select inputs
- fix scroll regression issue
- fix triggerName not disabled during reschedule
2024-02-09 20:23:19 +05:30
Fabio Formosa
c6f10e04eb Merge pull request #114 from ChistaDATA/feature/#101_angular15_update
feat: update padding & styles
2024-02-08 22:56:02 +01:00
Fabio Formosa
ad6a61f3df Update README.md
added a new example for the repo quartz-manager-use-cases
2024-02-07 00:24:21 +01:00
Fabio Formosa
5cb73019de bump version to 4.0.10-SNAPSHOT 2024-02-07 00:19:17 +01:00
Fabio Formosa
8a8e878e47 Update README.md
updated all references to the last release
2024-02-07 00:16:40 +01:00
Fabio Formosa
fae82e1d4e Merge pull request #118 from fabioformosa/develop
Develop to Master
2024-02-07 00:15:44 +01:00
Fabio Formosa
e0011913c2 bump version to 4.0.9 2024-02-06 23:58:07 +01:00
Fabio Formosa
a59b6a6c96 #115 fixed the liquibase DB migration execution 2024-02-06 23:43:54 +01:00
Fabio Formosa
68aaab6ac4 #115 fixed the liquibase DB migration execution 2024-02-06 23:42:38 +01:00
Midhun A Darvin
c75190513a feat: update padding & styles
- apply padding fixes
- remove `enableTrigger` variable and directly use `simpleTriggerReactiveForm.enabled`
-  apply default styles of matInput
2024-02-03 12:00:37 +05:30
Fabio Formosa
1421c52c34 Merge pull request #111 from midhunadarvin/feat/angular-update
feat: update angular version from 14 to 15
2024-02-03 00:11:11 +01:00
Fabio Formosa
b2942737af Merge branch 'feature/#101_angular15_update' into feat/angular-update 2024-02-03 00:07:25 +01:00
Fabio Formosa
a1d8b12e98 Merge pull request #112 from fabioformosa/feature/#109_configure_trigger_job_data
Feature/#109 configure trigger job data
2024-02-02 23:59:20 +01:00
Fabio Formosa
45d6a4c59a Merge branch 'feature/#109_configure_trigger_job_data' of github.com:fabioformosa/quartz-manager into feature/#109_configure_trigger_job_data 2024-02-02 23:54:31 +01:00
Midhun A Darvin
e6f6fb5f06 feat: configure Trigger JobData
- add `jobDataMap` property to SimpleTriggerInputDTO
- update SimpleTriggerCommandDTOToSimpleTrigger converter
- update SimpleTriggerToSimpleTriggerDTO converter
- update unit tests
- add .idea and .iml to .gitignore for ignoring intellij files
2024-02-02 23:43:27 +01:00
Fabio Formosa
13c438d097 Merge branch 'master' into develop 2024-02-02 23:38:22 +01:00
Fabio Formosa
412e455907 #103 step into accomodating the new trigger logic 2024-02-02 22:58:56 +01:00
Fabio Formosa
75d630aad0 Merge pull request #110 from midhunadarvin/feat/configure-trigger-job-data
feat: configure `Trigger` JobDataMap
2024-02-02 22:56:20 +01:00
Midhun A Darvin
2105e289ac feat: update angular version from 14 to 15
- update package.json dependencies
- npm audit force fix
- add `MatDialogModule` to app module imports
- mat-form-field has appearance property `outline` and `fill` now
- update unit tests
2024-02-02 16:05:54 +05:30
Midhun A Darvin
9eddc0b1fd feat: configure Trigger JobData
- add `jobDataMap` property to SimpleTriggerInputDTO
- update SimpleTriggerCommandDTOToSimpleTrigger converter
- update SimpleTriggerToSimpleTriggerDTO converter
- update unit tests
- add .idea and .iml to .gitignore for ignoring intellij files
2024-02-02 13:11:00 +05:30
Fabio Formosa
fa4ede5179 Merge pull request #108 from midhunadarvin/feat/configure-auto-startup
feat: make autoStartup configurable for SchedulerFactoryBean
2024-02-01 00:24:21 +01:00
Fabio Formosa
3aa672031a Updated the sonarcloud.io integration 2024-01-31 23:40:26 +01:00
Midhun A Darvin
82ca186bff feat: make autoStartup configurable for SchedulerFactoryBean
- check property `org.quartz.scheduler.isAutoStartup` and enable autoStartup if it is true
2024-01-31 13:28:15 +05:30
Fabio Formosa
727a11fcea #103 fixed a test 2022-12-21 00:03:39 +01:00
Fabio Formosa
7106dc0fbb #103 clean up 2022-12-21 00:00:29 +01:00
Fabio Formosa
a2c8ecb227 #103 migrated the progress websocket to rx-stomp 2022-12-20 23:59:30 +01:00
Fabio Formosa
e4c771e364 #103 migrated the progress websocket to rx-stomp 2022-12-20 23:58:51 +01:00
Fabio Formosa
261dd8b624 #103 appended the trigger key to the websocket topic 2022-12-20 20:51:10 +01:00
Fabio Formosa
ac63576704 #103 migrated the logs websocket to rx-stomp 2022-12-18 11:58:24 +01:00
Fabio Formosa
a3b92443c4 #103 enabled a dev profile in the angular.json 2022-12-18 11:53:32 +01:00
Fabio Formosa
527ee1200a #103 added some comments 2022-12-11 20:38:55 +01:00
Fabio Formosa
82a60eb651 Update README.md 2022-12-10 16:59:31 +01:00
Fabio Formosa
7fd174b313 bump version to 4.0.9-SNAPSHOT 2022-12-10 16:56:05 +01:00
Fabio Formosa
7c910196e1 upgraded README and CHANGELOG 2022-12-10 16:54:50 +01:00
Fabio Formosa
554e7e5e25 #80 bump version to 4.0.8 2022-12-10 16:39:26 +01:00
Fabio Formosa
8b70319436 #80 upgraded node and npm into the quartz-manager-starter-ui 2022-12-10 16:38:34 +01:00
Fabio Formosa
053f196b6b Merge pull request #100 from fabioformosa/develop
v4.0.7
2022-12-10 16:29:16 +01:00
Fabio Formosa
86f8cc8347 bump version to 4.0.7 2022-12-10 16:25:17 +01:00
Fabio Formosa
e91d02ba9f #80 added moment to the allowed commonJS module 2022-12-10 16:19:39 +01:00
Fabio Formosa
109d2868d9 #80 upgraded to the new linter and added prettier 2022-12-10 16:15:00 +01:00
Fabio Formosa
4673e41fc5 #80 removed unnecessary asterisks 2022-12-10 14:53:35 +01:00
Fabio Formosa
a2122351d6 #80 removed extractCss 2022-12-10 13:31:45 +01:00
Fabio Formosa
375aaf71d3 #80 fixed the build command as angular v14 2022-12-10 13:25:14 +01:00
Fabio Formosa
b752af948d #80 downgraded jest to v28 2022-12-10 13:21:18 +01:00
Fabio Formosa
52ed016073 #80 fixed tests 2022-12-10 12:20:57 +01:00
Fabio Formosa
632288726b #80 upgraded some deps 2022-12-10 11:55:00 +01:00
Fabio Formosa
1dc9bee987 #80 upgraded to angular v14 2022-12-10 11:27:14 +01:00
Fabio Formosa
387c440e06 #80 step into angular v14 2022-12-10 11:20:01 +01:00
Fabio Formosa
136afa0fca #80 step into angular v14 2022-12-10 11:17:39 +01:00
Fabio Formosa
8ba3daa2f0 #80 upgraded angular to v13 2022-12-08 00:15:48 +01:00
Fabio Formosa
b3fe337203 #80 upgraded angular to v13 2022-12-08 00:15:39 +01:00
Fabio Formosa
da7375ea0d #80 first step to angular v13 2022-12-07 00:38:30 +01:00
Fabio Formosa
d9487d1106 #80 completed the migration to angular12 2022-12-07 00:37:25 +01:00
Fabio Formosa
3110496630 #80 completed the migration to angular12 2022-12-07 00:36:59 +01:00
Fabio Formosa
22e90dc7d1 #80 step into angular v12 2022-12-07 00:29:20 +01:00
Fabio Formosa
5943243e62 #80 step into angular v12 2022-12-07 00:27:20 +01:00
Fabio Formosa
1244a64d34 #80 fixes for angular v11 2022-12-07 00:25:50 +01:00
Fabio Formosa
40a6ecd159 #80 fixes for angular v11 2022-12-07 00:24:56 +01:00
Fabio Formosa
9df68dccac #80 first step to angular v11 2022-12-06 23:35:35 +01:00
Fabio Formosa
72bba6f80c #80 reverted deps to angular 10 2022-12-06 23:29:29 +01:00
Fabio Formosa
cf803bb1dd #80 reverted deps to angular 10 2022-12-06 23:29:13 +01:00
Fabio Formosa
13c78ed5d3 #80 removed the package-lock.json 2022-12-06 23:19:08 +01:00
Fabio Formosa
3bd878a978 #80 reverted deps to angular 10 2022-12-06 23:14:45 +01:00
Fabio Formosa
c9d3528f4b #80 reverted deps to angular 10 2022-12-06 23:14:32 +01:00
Fabio Formosa
3b2f8fc780 #80 reverted deps to angular 10 2022-12-06 23:08:17 +01:00
Fabio Formosa
bc3da09d60 #80 step into angular upgrade to v11 2022-12-06 19:33:42 +01:00
Fabio Formosa
284f56302c #80 fixed tests 2022-12-06 01:08:17 +01:00
Fabio Formosa
cdd5047bbc #80 jest setup fix for angular 10 2022-12-06 00:39:45 +01:00
Fabio Formosa
5d3ba95bd9 #80 upgraded angular to v10 2022-12-05 23:42:36 +01:00
Fabio Formosa
ec384113eb angular material upgrade to v4 2022-12-05 23:36:36 +01:00
Fabio Formosa
8b2651876c new package-lock.json 2022-12-05 23:31:55 +01:00
Fabio Formosa
a3852c421e bump version to 4.0.7-SNAPSHOT 2022-12-05 23:09:51 +01:00
Fabio Formosa
e1e1bdbd01 bump version to 4.0.6 2022-12-04 12:15:51 +01:00
Fabio Formosa
6757511de3 #62 added a missing test 2022-12-04 12:07:20 +01:00
Fabio Formosa
f5b717ec36 Update README.md 2022-12-04 11:54:06 +01:00
Fabio Formosa
6b491d9949 Update README.md 2022-12-04 11:52:54 +01:00
Fabio Formosa
cf382db49f Update README.md 2022-12-04 11:52:24 +01:00
Fabio Formosa
ee2f80e582 Update README.md
added a table of contents
2022-12-04 11:49:26 +01:00
Fabio Formosa
4453d62515 Update README.md
Added sonar quality badges
2022-12-04 11:33:47 +01:00
Fabio Formosa
72068818d7 #62 fixed sonar smells 2022-12-04 11:25:21 +01:00
Fabio Formosa
92bb94b9fa #62 added coverage exclusion 2022-12-04 11:15:53 +01:00
Fabio Formosa
7a2098e9ce #62 added coverage exclusion 2022-12-04 11:08:48 +01:00
Fabio Formosa
56b81f4f48 #62 added some exclusion from coverage 2022-12-03 19:54:07 +01:00
Fabio Formosa
82c060c2a7 #62 set jacoco properties 2022-12-03 19:46:14 +01:00
Fabio Formosa
fba35b796d #62 set jacoco properties 2022-12-03 19:42:12 +01:00
Fabio Formosa
5f6fc1fa6f #62 set jacoco properties 2022-12-03 19:16:28 +01:00
Fabio Formosa
a9c227cd05 Merge branch 'develop' 2022-12-03 19:11:49 +01:00
Fabio Formosa
a8330e062f #62 set jacoco properties 2022-12-03 19:07:29 +01:00
Fabio Formosa
30d0cbf6de Merge pull request #97 from fabioformosa/develop
v4.0.6
2022-12-03 17:17:00 +01:00
Fabio Formosa
3063e08eb3 #62 solved a couple of sonar smells 2022-12-03 17:10:34 +01:00
Fabio Formosa
f7054b160f #62 added missing tests 2022-12-03 16:46:27 +01:00
Fabio Formosa
98b5d0e37a #62 fixed the job class name in the TriggerFiredBundleDTO 2022-12-03 16:21:13 +01:00
Fabio Formosa
6348bac11a #62 added missing tests 2022-12-03 12:19:41 +01:00
Fabio Formosa
c2a26c97a8 #62 added some coverage exclusion 2022-12-02 00:37:56 +01:00
Fabio Formosa
cd6e01109b #62 added some coverage exclusion 2022-12-02 00:32:52 +01:00
Fabio Formosa
7553efdc3b #62 added missing tests 2022-12-02 00:21:23 +01:00
Fabio Formosa
6578dc312a #62 added missing tests 2022-12-01 23:52:48 +01:00
Fabio Formosa
c490a7ab28 #62 added missing tests 2022-12-01 23:48:16 +01:00
Fabio Formosa
0969a406c6 #62 fixed a failing test 2022-12-01 00:55:38 +01:00
Fabio Formosa
eed3021373 #62 fixed a failing test 2022-12-01 00:35:40 +01:00
Fabio Formosa
5b33bd4dca #62 added missing tests 2022-12-01 00:30:47 +01:00
Fabio Formosa
6d22207e27 #62 added missing tests 2022-11-29 23:39:14 +01:00
Fabio Formosa
249cf49873 #62 added missing tests 2022-11-29 23:12:54 +01:00
Fabio Formosa
b17d487c8b #62 added missing tests 2022-11-29 20:29:55 +01:00
Fabio Formosa
fedb2b50b6 #62 clean up 2022-11-29 18:44:46 +01:00
Fabio Formosa
4b18313e2d #62 removed unused security filter 2022-11-23 20:54:37 +01:00
Fabio Formosa
8387f587b3 bump version to 4.0.6-SNAPSHOT 2022-11-20 14:02:45 +01:00
Fabio Formosa
c7b64dbdf3 Update README.md 2022-11-20 14:01:24 +01:00
Fabio Formosa
085d61cf29 Merge pull request #95 from fabioformosa/develop
v4.0.5
2022-11-20 14:00:34 +01:00
Fabio Formosa
e6cf2e9390 bump version to 4.0.5 2022-11-20 13:43:07 +01:00
Fabio Formosa
4bcea96789 Merge remote-tracking branch 'origin/master' into develop 2022-11-20 13:42:52 +01:00
Fabio Formosa
866062bdcb #62 added a missing test for the MisfireTestJob 2022-11-20 13:36:25 +01:00
Fabio Formosa
53a54ddbda #62 added a missing test to the UserController 2022-11-20 13:16:42 +01:00
Fabio Formosa
8bdb85b878 Update README.md 2022-11-20 12:50:26 +01:00
Fabio Formosa
9a26be41a8 #78 excluded lombok annotations from the coverage 2022-11-19 18:59:24 +01:00
Fabio Formosa
5cf39b3861 #78 fixed sonar errors 2022-11-19 18:53:13 +01:00
Fabio Formosa
99d87636d2 #78 removed an unused CORS config 2022-11-19 18:45:47 +01:00
Fabio Formosa
bccd50ac4a #78 put a secureRandom value as default value for the JWT token 2022-11-19 18:28:39 +01:00
Fabio Formosa
3bb30accfd #78 fixed some sonar warnings 2022-11-19 16:34:36 +01:00
Fabio Formosa
5d2b71652c #78 fixed 2 sonar warnings 2022-11-19 16:25:53 +01:00
Fabio Formosa
b70af4dafe Merge remote-tracking branch 'origin/master' into develop 2022-11-19 16:21:07 +01:00
Fabio Formosa
a95cf20c6b bump version to 4.0.5-SNAPSHOT 2022-11-19 13:54:25 +01:00
Fabio Formosa
b58a5dbe9f Update README.md 2022-11-19 13:31:52 +01:00
Fabio Formosa
f7222d65ae moved the nexus plugin under the maven profile 2022-11-19 13:29:14 +01:00
Fabio Formosa
ff43103f37 Merge pull request #89 from fabioformosa/develop
v4.0.4
2022-11-19 13:01:44 +01:00
Fabio Formosa
93ab9c55bc bump version to 4.0.4 2022-11-19 13:00:39 +01:00
Fabio Formosa
28715cdf62 enhanced the info message within the UnsupportedMultipleJobsDialog 2022-11-19 12:40:23 +01:00
Fabio Formosa
bd5276116b fixed the redirect to the login in case of security layer enabled 2022-11-19 12:18:36 +01:00
Fabio Formosa
b20fb9e9c3 bump version to 4.0.4-SNAPSHOT 2022-11-19 12:09:41 +01:00
Fabio Formosa
d3a406a382 Update maven-release.yml 2022-11-19 11:38:35 +01:00
Fabio Formosa
c70fe687e1 Update README.md 2022-11-19 11:37:55 +01:00
Fabio Formosa
fc81685044 Update README.md 2022-11-19 11:22:00 +01:00
Fabio Formosa
6e24d7caf5 bump version to 4.0.3 2022-11-19 11:05:57 +01:00
Fabio Formosa
6786cffb4d fixed the maven-release.yml 2022-11-19 11:05:23 +01:00
Fabio Formosa
1805705ff2 bump version to 4.0.2 2022-11-19 10:57:48 +01:00
Fabio Formosa
64fbabba4d fixed the maven-release.yml 2022-11-19 10:55:38 +01:00
Fabio Formosa
0db13872a1 Update maven-release.yml 2022-11-19 10:46:40 +01:00
Fabio Formosa
694e199709 Merge pull request #84 from fabioformosa/develop
v4.0.0
2022-11-19 10:36:20 +01:00
Fabio Formosa
77cf0a06d6 bump version to 4.0.0 2022-11-18 00:34:07 +01:00
Fabio Formosa
d9c7bcaad9 added mvn bin 2022-11-18 00:31:33 +01:00
Fabio Formosa
d9469b7dcc preparing for releasing 2022-11-18 00:24:02 +01:00
Fabio Formosa
1a57a4b04e Update README.md 2022-11-16 23:20:46 +01:00
Fabio Formosa
10d871be2e Update README.md 2022-11-15 00:19:55 +01:00
Fabio Formosa
8b75cc1891 Update README.md 2022-11-15 00:18:40 +01:00
Fabio Formosa
f6522a9a79 Update README.md 2022-11-15 00:15:42 +01:00
Fabio Formosa
96449c8aeb resized the swagger screenshot 2022-11-15 00:15:03 +01:00
Fabio Formosa
1d03027efe Update README.md 2022-11-14 23:01:31 +01:00
Fabio Formosa
69750267f6 Update README.md 2022-11-14 23:01:18 +01:00
Fabio Formosa
2640e91055 added a README file within the multi-module maven proj 2022-11-14 22:59:05 +01:00
Fabio Formosa
9ccefe90ee Update README.md 2022-11-14 20:30:21 +01:00
Fabio Formosa
c538ea95ee fixed some compiler warnings 2022-11-12 20:43:33 +01:00
Fabio Formosa
933975ce70 Update README.md 2022-11-12 17:49:32 +01:00
Fabio Formosa
d189feea87 Update README.md 2022-11-12 17:16:15 +01:00
Fabio Formosa
9637658b89 Update README.md 2022-11-12 16:50:49 +01:00
Fabio Formosa
c3c6265dc6 Update README.md 2022-11-12 16:25:20 +01:00
Fabio Formosa
63f871f649 Update README.md 2022-11-12 16:09:28 +01:00
Fabio Formosa
a9259fd30d Update README.md 2022-11-12 00:11:42 +01:00
Fabio Formosa
43e1fd3f04 Update README.md 2022-11-11 00:21:10 +01:00
Fabio Formosa
8e1e4344e4 Update README.md 2022-11-11 00:19:32 +01:00
Fabio Formosa
2186b0b007 Update README.md 2022-11-11 00:02:43 +01:00
Fabio Formosa
9f7238021b Update README.md 2022-11-11 00:01:12 +01:00
Fabio Formosa
db2a5949dc Update README.md 2022-11-10 23:56:27 +01:00
Fabio Formosa
73293095f6 Update README.md 2022-11-10 23:43:48 +01:00
Fabio Formosa
879fae55ce Update README.md 2022-11-10 20:45:38 +01:00
Fabio Formosa
b2da564469 Update README.md 2022-11-10 00:21:11 +01:00
Fabio Formosa
b52834a2d8 Update README.md 2022-11-10 00:18:59 +01:00
Fabio Formosa
c8c4ad37c8 #64 added the swagger screenshot 2022-11-09 23:03:47 +01:00
Fabio Formosa
6fa7375f13 Update README.md 2022-11-09 20:26:40 +01:00
Fabio Formosa
9127a50433 Update README.md 2022-11-09 19:43:53 +01:00
Fabio Formosa
cabbec3d3b #64 added the new screenshot 2022-11-09 19:40:42 +01:00
Fabio Formosa
e42b26fa73 #78 fixed some smells 2022-11-08 23:53:24 +01:00
Fabio Formosa
018c0f18dc #78 fixed some smells 2022-11-08 23:38:48 +01:00
Fabio Formosa
a4b0a1bafb #78 fixed some smells 2022-11-08 22:59:07 +01:00
Fabio Formosa
6eededed2c #78 fixed some smells 2022-11-08 22:41:24 +01:00
Fabio Formosa
b62455836a #78 fixed a smell 2022-11-08 22:34:50 +01:00
Fabio Formosa
9dfe06e346 #74 added an alert in case of no eligible jobs 2022-11-08 00:35:54 +01:00
Fabio Formosa
461c31e7ea #71 added illustrations for 403 and 404 also 2022-11-06 13:02:40 +01:00
Fabio Formosa
29a1903b21 #71 added an illustration when there a no logs to display 2022-11-05 20:53:55 +01:00
Fabio Formosa
83401a2ecb #71 added a generic error view 2022-11-05 20:28:56 +01:00
Fabio Formosa
3242457cce #57 fixed tests 2022-11-05 17:53:21 +01:00
Fabio Formosa
12f91fa85c #57 enhanced the layout of the trigger form 2022-11-05 17:47:50 +01:00
Fabio Formosa
85ba371b72 #57 enhanced the layout of the trigger form 2022-11-05 17:43:48 +01:00
Fabio Formosa
014c348a89 #57 added custom validations to the trigger form 2022-11-05 17:04:08 +01:00
Fabio Formosa
a44d041e93 #57 attempt to fix the flaky tests 2022-11-05 13:47:07 +01:00
Fabio Formosa
9ea4afcaef #57 attempt to fix the flaky tests 2022-11-05 13:36:39 +01:00
Fabio Formosa
9b32f5e598 #57 attempt to fix the flaky tests 2022-11-05 13:26:35 +01:00
Fabio Formosa
f4dd8519a9 #57 attempt to fix the flaky tests 2022-11-05 13:19:45 +01:00
Fabio Formosa
1b1be180c6 #57 clean up 2022-11-05 13:15:33 +01:00
Fabio Formosa
026bdc6f18 #57 attempt to solve the flaky test 2022-11-04 23:12:55 +01:00
Fabio Formosa
1207a646c7 #57 temporary disabled a flaky assertion 2022-11-04 00:21:42 +01:00
Fabio Formosa
3e90a9b22c #57 fixed a test 2022-11-04 00:18:22 +01:00
Fabio Formosa
459aa136c1 #57 added an error message for required fields 2022-11-03 23:58:17 +01:00
Fabio Formosa
d164cb9363 #57 fixed tests 2022-11-03 23:24:59 +01:00
Fabio Formosa
a8fb990966 #57 fixed tests 2022-11-03 22:11:44 +01:00
Fabio Formosa
121f2e364f #57 converted template-driven form in reactive form 2022-11-02 20:18:50 +01:00
Fabio Formosa
b968329fb3 #57 added new validation checks to the simple trigger input 2022-10-29 11:31:28 +02:00
Fabio Formosa
d9ff379d59 #57 improved some oas captions 2022-10-29 10:29:19 +02:00
Fabio Formosa
5c9a8d21a3 #78 fixed the sonar props 2022-10-29 10:28:52 +02:00
Fabio Formosa
9d24c1587f #78 fixed the sonar props 2022-10-29 00:55:23 +02:00
Fabio Formosa
436821a831 #78 fixed the sonar props 2022-10-29 00:45:01 +02:00
Fabio Formosa
ecb07dc682 #78 fixed the sonar props 2022-10-29 00:35:43 +02:00
Fabio Formosa
8f08927aad #78 fixed sonar smells 2022-10-29 00:24:38 +02:00
Fabio Formosa
e29fd8dc92 #78 fixed sonar smells 2022-10-29 00:18:55 +02:00
Fabio Formosa
3af5eb076e #78 fixed sonar smells 2022-10-29 00:07:15 +02:00
Fabio Formosa
c190c15889 #78 fixed sonar smells 2022-10-29 00:04:48 +02:00
Fabio Formosa
540bdf35a5 #78 fixed sonar smells 2022-10-28 23:53:33 +02:00
Fabio Formosa
33b4d88d52 #57 added validation checks onto the SimpleTrigger 2022-10-28 01:14:53 +02:00
Fabio Formosa
ad3eec4abe #78 fixed a major sonar finding 2022-10-27 23:55:49 +02:00
Fabio Formosa
7b87a9485e #78 fixed a major sonar finding 2022-10-27 23:46:39 +02:00
Fabio Formosa
a8a027ed88 #62 added the jacoco plugin 2022-10-27 23:39:42 +02:00
Fabio Formosa
69b62032b2 #57 #62 fixed an integration tests 2022-10-27 23:36:40 +02:00
Fabio Formosa
f411659ad6 #57 #62 added an integration test to check the mandatory fields in scheduling a simple trigger 2022-10-27 23:29:28 +02:00
Fabio Formosa
0c33eda68c added a test for DateUtils 2022-10-27 22:58:56 +02:00
Fabio Formosa
4013c4c08f added the sonar github action 2022-10-27 20:04:42 +02:00
Fabio Formosa
ae3c2d72a1 added a github action for sonar 2022-10-27 19:57:41 +02:00
Fabio Formosa
5a96f81338 added a github action for sonar 2022-10-27 19:56:33 +02:00
Fabio Formosa
31208f9883 Update README.md
Added the npm github badge to the README
2022-10-27 19:41:56 +02:00
Fabio Formosa
a64a06d663 tuned the npm github action 2022-10-27 19:40:36 +02:00
Fabio Formosa
02a73762b0 added the working directory in the npm github action 2022-10-27 01:26:29 +02:00
Fabio Formosa
2ca24a9aae added the working directory in the npm github action 2022-10-27 01:17:41 +02:00
Fabio Formosa
fc1ea9166c added the working directory in the npm github action 2022-10-27 01:08:56 +02:00
Fabio Formosa
71ee075cfa added the working directory in the npm github action 2022-10-27 01:06:20 +02:00
Fabio Formosa
33f4a7544c added the working directory in the npm github action 2022-10-27 01:04:53 +02:00
Fabio Formosa
d16b681362 added the working directory in the npm github action 2022-10-27 00:59:38 +02:00
Fabio Formosa
5547b7e868 added the working directory in the npm github action 2022-10-27 00:51:16 +02:00
Fabio Formosa
3722d0ca24 removed the package-lock.json from the gitignore 2022-10-27 00:47:28 +02:00
Fabio Formosa
41d11372ce minor commit 2022-10-27 00:45:55 +02:00
Fabio Formosa
3582ef4125 fixed the npm github action 2022-10-27 00:40:44 +02:00
Fabio Formosa
8e32fe531a added npm github action 2022-10-27 00:39:42 +02:00
Fabio Formosa
17201aad08 Update README.md
replace travis badge with github badge
2022-10-27 00:18:42 +02:00
Fabio Formosa
4fb70ac8e8 minor commit 2022-10-26 23:57:19 +02:00
Fabio Formosa
425de89469 fixed the maven github action 2022-10-26 23:54:21 +02:00
Fabio Formosa
5746cb43c3 fixing the maven github action 2022-10-26 23:22:34 +02:00
Fabio Formosa
704f31581f fixing the maven github action 2022-10-26 23:19:46 +02:00
Fabio Formosa
7cb7dde65d added a github action 2022-10-26 23:07:35 +02:00
Fabio Formosa
bdc86b5510 added a missing dep 2022-10-26 23:04:02 +02:00
Fabio Formosa
59816c9693 #48 fixed some tests 2022-10-26 22:02:11 +02:00
Fabio Formosa
4f8b75a8f9 #48 made configurable the misfire instruction 2022-10-26 21:56:02 +02:00
Fabio Formosa
5ea8f2adb1 #58 hidden the progress bar in case of endless repeat count 2022-10-22 20:12:32 +02:00
Fabio Formosa
80cd607d17 #66 made the log panel fixed height 2022-10-22 18:03:05 +02:00
Fabio Formosa
488916bcd7 #66 increased the font size of the logs 2022-10-22 16:13:22 +02:00
Fabio Formosa
b5abeac093 #66 removed the hint in the login page 2022-10-22 16:12:57 +02:00
Fabio Formosa
ed266dea15 removed a dependency from spring security in the module web-showcase 2022-10-22 15:31:36 +02:00
Fabio Formosa
65558c7ee8 #66 fixed a divider 2022-10-22 15:27:19 +02:00
Fabio Formosa
e5d2c33d9a #77 made the oas dependency optional and conditional 2022-10-22 13:56:48 +02:00
Fabio Formosa
7f00f5de99 #77 made the oas dependency optional and conditional 2022-10-22 00:27:29 +02:00
Fabio Formosa
b2906d09f4 #77 added a validation test on the in-memory user props and renamed the username field 2022-10-15 18:03:53 +02:00
Fabio Formosa
3f0d036dad #76 upgraded the java version to 9 2022-10-15 18:03:15 +02:00
Fabio Formosa
9d66cd85f0 #75 renamed the main security config class 2022-10-15 18:02:37 +02:00
Fabio Formosa
0a21920ad9 #75 removed the deprecated WebSecurityConfigurerAdapter 2022-10-15 18:02:17 +02:00
Fabio Formosa
bda37213f8 #75 removed the deprecated WebSecurityConfigurerAdapter 2022-10-15 15:38:44 +02:00
Fabio Formosa
c725871a4e minor refactoring of packages 2022-10-15 15:38:16 +02:00
Fabio Formosa
39a10681bf #75 removed the deprecated WebSecurityConfigurerAdapter 2022-10-14 00:16:44 +02:00
Fabio Formosa
381cfa1486 added a docker-compose.yml file to the web-showcase module 2022-10-12 00:23:08 +02:00
Fabio Formosa
4d4385b7ba #40 customized the quartz.properties file for quartz-manager in managed-quartz.properties 2022-10-08 13:05:01 +02:00
Fabio Formosa
ec7debe8c5 #40 customized the quartz.properties file for quartz-manager in managed-quartz.properties 2022-10-08 12:23:23 +02:00
Fabio Formosa
05591546b3 #67 put a qualifier name to the quartz-scheduler instance 2022-10-07 23:44:35 +02:00
Fabio Formosa
2b0644b495 #67 declouped the basePackageScanning from the schedulerConfig 2022-10-07 23:09:54 +02:00
Fabio Formosa
a30bd9e2c7 #63 temporary commented the ROLE_ADMIN 2022-10-07 22:33:00 +02:00
Fabio Formosa
6eed819364 #63 added a missing log 2022-10-07 22:32:35 +02:00
Fabio Formosa
a1780b1087 #73 made optional the quartz.properties 2022-10-07 22:32:18 +02:00
Fabio Formosa
c70dc3181e #63 fixed a circular spring dependency 2022-10-07 22:31:46 +02:00
Fabio Formosa
8ee0435738 #63 added missing logs 2022-10-07 19:54:06 +02:00
Fabio Formosa
72e1415038 #63 extracted a constant 2022-10-07 19:53:56 +02:00
Fabio Formosa
65c3653494 #63 added a missing js dep 2022-10-07 19:53:31 +02:00
Fabio Formosa
304a1e7f71 #63 renamed the base package of the api module 2022-10-06 23:54:04 +02:00
Fabio Formosa
6972915a5c #63 fixed tests 2022-10-06 22:57:36 +02:00
Fabio Formosa
77ea248457 #63 added sql script to create a local postgresql db 2022-10-06 20:15:50 +02:00
Fabio Formosa
14c1f7ea85 #63 fixed the injection of the quartz properties of the modules 2022-10-06 20:15:24 +02:00
Fabio Formosa
0652a6ec5e #63 fixed the appearance of the login button 2022-10-06 20:14:54 +02:00
Fabio Formosa
cecd30309f #63 replaced some "any" with actual type and conformed the log notifier to the progress notifier 2022-10-06 01:13:33 +02:00
Fabio Formosa
22762d7d84 #66 fixed lint errors 2022-10-05 00:43:18 +02:00
Fabio Formosa
6715665072 #63 clean up 2022-10-04 23:30:09 +02:00
Fabio Formosa
b92d8275db #63 renamed a DTO 2022-10-04 23:26:16 +02:00
Fabio Formosa
b4acc378e3 #63 removed unused app prop 2022-10-04 23:23:36 +02:00
Fabio Formosa
a313d8b19d #63 ui gets 404 calling whoami in case of no sec config 2022-10-04 20:17:57 +02:00
Fabio Formosa
93152f8157 #63 tested the default name assignment to the scheduler instance 2022-10-01 17:29:05 +02:00
Fabio Formosa
1e99602c68 #63 tested the default name assignment to the scheduler instance 2022-10-01 17:20:41 +02:00
Fabio Formosa
1571ab6d12 #63 made as default behaviour the creation of a scheduler instance 2022-10-01 16:12:26 +02:00
Fabio Formosa
44d6854bc5 #63 added security test to test the whitelisted endpoints 2022-10-01 15:48:01 +02:00
Fabio Formosa
727403d420 #63 left the main security config class in the spring.factories 2022-10-01 00:50:24 +02:00
Fabio Formosa
b06b130d20 #63 clean up 2022-10-01 00:45:01 +02:00
Fabio Formosa
94107f2210 #63 removed properties which have a default value from the showcase 2022-10-01 00:40:58 +02:00
Fabio Formosa
adb8e06f0a #63 added mvc tests on security 2022-09-30 23:42:30 +02:00
Fabio Formosa
8cb0ac09e8 #63 removed the app name which has a default value 2022-09-29 19:31:19 +02:00
Fabio Formosa
8935d77d0f #63 extracted a constant for the quartz-manager 2022-09-29 19:28:52 +02:00
Fabio Formosa
0adb8bf94b #59 fixed tests 2022-09-29 00:34:07 +02:00
Fabio Formosa
7e21437dfc #63 #66 clean up 2022-09-29 00:34:07 +02:00
Fabio Formosa
bfba79448b Update README.md 2022-09-24 16:46:21 +02:00
Fabio Formosa
5be49a4090 #59 fixed animation on logs 2022-09-16 23:39:49 +02:00
Fabio Formosa
e0b0378329 #59 changed the layout of the job progress card 2022-09-15 00:37:54 +02:00
Fabio Formosa
5f3ae667b0 #52 removed an unused app property 2022-09-14 20:26:31 +02:00
Fabio Formosa
b14cf64124 #59 reduced the size of the trigger form 2022-09-14 20:26:10 +02:00
Fabio Formosa
d9f9ee96af #52 added the jobClass selection 2022-09-13 23:38:31 +02:00
Fabio Formosa
a644dd6052 #52 made read-only the trigger name of an existing trigger 2022-09-07 20:45:34 +02:00
Fabio Formosa
3e5b25b37a #52 selected a new trigger once created 2022-09-07 20:36:27 +02:00
Fabio Formosa
a693e2aa0c #52 no changes at the trigger list in case of rescheduling of an existing trigger 2022-09-07 00:26:34 +02:00
Fabio Formosa
599b6fb0b4 #52 added the job className to the trigger detail view 2022-09-03 16:30:51 +02:00
Fabio Formosa
9638667368 #52 added the trigger name to the trigger form 2022-09-03 15:50:34 +02:00
Fabio Formosa
21f3f7dca2 #59 highlighted the selected trigger into the list 2022-09-02 00:19:23 +02:00
Fabio Formosa
b4bb16130c #59 added unit tests for the new trigger 2022-08-31 23:46:53 +02:00
Fabio Formosa
f1c9fba68e #56 step into layout revamp 2022-08-04 00:43:53 +02:00
Fabio Formosa
09df7795a9 #56 minor commit 2022-07-05 19:06:21 +02:00
Fabio Formosa
6bb768de59 #56 added a new FE component to schedule a simple trigger 2022-03-05 20:50:23 +01:00
Fabio Formosa
86badb8f41 #56 added the simpleTrigger to the API 2022-03-05 20:49:24 +01:00
Fabio Formosa
54999ce735 #56 added the simpleTrigger to the API 2022-03-05 20:48:53 +01:00
Fabio Formosa
851100b774 added a .editorconfig file 2022-03-05 20:44:04 +01:00
Fabio Formosa
3ba2bafc55 #55 fixed mockMvcTests 2021-12-07 23:56:50 +01:00
Fabio Formosa
cbd3066f57 #55 migrated the API doc from swagger2 to OpenAPI 3 2021-12-04 17:14:06 +01:00
Fabio Formosa
f3506304d9 #44 added the login operation to the OpenApi doc 2021-12-04 17:11:10 +01:00
Fabio Formosa
c9b90478dd #55 migrated swagger2 to openApi specification 3 2021-11-10 01:16:36 +01:00
Fabio Formosa
2ca2ba7ffc #55 migrated swagger2 to openApi specification 3 2021-11-09 23:39:38 +01:00
Fabio Formosa
3df1abd46e #37 added input validation to the trigger rescheduling 2021-11-09 00:14:49 +01:00
Fabio Formosa
34f21a58c9 #37 added input validation to the trigger creation 2021-11-09 00:11:47 +01:00
Fabio Formosa
233b56f282 #37 added some mockMvcTest to TriggerController 2021-11-06 01:17:50 +01:00
Fabio Formosa
1cd7f605e3 upgraded spring boot version to 2.5.6 2021-11-06 01:17:10 +01:00
Fabio Formosa
efee7b575f Merge remote-tracking branch 'origin/master' into develop 2021-11-06 01:14:22 +01:00
Fabio Formosa
870a813c61 Update README.md 2021-11-03 00:09:21 +01:00
Fabio Formosa
24285c7885 Update README.md 2021-11-03 00:01:45 +01:00
Fabio Formosa
69e2ab3977 Merge pull request #50 from fabioformosa/develop
Develop
2021-11-02 23:03:32 +01:00
Fabio Formosa
8218c63bba [maven-release-plugin] prepare for next development iteration 2021-11-01 23:28:05 +01:00
Fabio Formosa
d89a2af1aa [maven-release-plugin] prepare release 3.1.0 2021-11-01 23:28:04 +01:00
Fabio Formosa
09e9b18f96 [maven-release-plugin] rollback the release of quartz-manager-parent-3.1.0 2021-11-01 23:26:06 +01:00
Fabio Formosa
e70bbcff62 [maven-release-plugin] prepare release quartz-manager-parent-3.1.0 2021-11-01 23:25:44 +01:00
Fabio Formosa
085d2f1706 [maven-release-plugin] rollback the release of quartz-manager-parent-3.1.0 2021-11-01 23:24:43 +01:00
Fabio Formosa
4746ba9489 [maven-release-plugin] prepare release quartz-manager-parent-3.1.0 2021-11-01 23:18:00 +01:00
Fabio Formosa
27fab8acca #39 cleanUp 2021-11-01 19:15:25 +01:00
Fabio Formosa
734bb1b087 [maven-release-plugin] rollback the release of quartz-manager-parent-3.1.0 2021-11-01 19:13:23 +01:00
Fabio Formosa
81d9e92450 [maven-release-plugin] prepare for next development iteration 2021-11-01 18:39:34 +01:00
Fabio Formosa
5d794536e3 [maven-release-plugin] prepare release quartz-manager-parent-3.1.0 2021-11-01 18:39:32 +01:00
Fabio Formosa
4f3efc50fc temporary disabled a test 2021-11-01 16:35:49 +01:00
Fabio Formosa
37ad22090c Merge pull request #49 from fabioformosa/feature/#14
Feature/#14
2021-11-01 16:20:23 +01:00
Fabio Formosa
95fa102720 #39 changed the appearance of the fields in the config param form 2021-11-01 16:17:29 +01:00
Fabio Formosa
f37ad1ae58 #37 added the mockMvcTest for the TriggerController 2021-11-01 13:02:31 +01:00
Fabio Formosa
fb2d8da53d #14 cleanup 2021-10-30 16:22:21 +02:00
Fabio Formosa
87ee4bebb3 #14 added a new line to the .gitignore 2021-10-30 00:56:08 +02:00
Fabio Formosa
9bf0871ff6 #14 imported quartz-manager-persistence into the web-showcase 2021-10-30 00:55:24 +02:00
Fabio Formosa
70827393b7 #14 fixed the trigger rescheduling 2021-10-30 00:22:44 +02:00
Fabio Formosa
c4e8eb94d6 #14 clean up 2021-10-26 00:32:38 +02:00
fabio.formosa
e50a48bd4c Changed API and frontend to handle stored triggers and jobs 2021-10-17 13:15:54 +02:00
fabio.formosa
10df1116bd #14 added a new module for persistence 2021-07-24 19:44:24 +02:00
fabio.formosa
03f45346a7 #38 changed misfire instruction 2021-03-05 00:59:02 +01:00
fabio.formosa
6170e8f1ae #38 changed misfire instruction 2021-03-05 00:57:53 +01:00
fabio.formosa
0a718e897b #35 fixes config retrieve 2021-02-27 17:11:53 +01:00
Fabio Formosa
d243c3a8e8 Update README.md 2021-02-07 13:47:20 +01:00
Fabio Formosa
49020d9bd0 Update README.md 2021-02-07 13:42:17 +01:00
Fabio Formosa
1457f3fdea Update README.md 2021-02-07 13:39:52 +01:00
Fabio Formosa
42c63b963f Create CHANGELOG.md 2021-02-07 13:37:20 +01:00
380 changed files with 40587 additions and 5072 deletions

2
.dockerignore Normal file
View File

@@ -0,0 +1,2 @@
# .dockerignore
quartz-manager-frontend/node_modules

46
.github/workflows/maven-release.yml vendored Normal file
View File

@@ -0,0 +1,46 @@
name: Publish package to the Maven Central Repository
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set up Java 21 for publishing to Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
server-id: maven-central-release
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Build with Maven
run: mvn -B package --file quartz-manager-parent/pom.xml
- name: Publish to maven central
run: mvn deploy --file quartz-manager-parent/pom.xml --batch-mode -P "release-maven-central,build-webjar"
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_TOKEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
- name: Set up Java 21 for publishing to GitHub Packages
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Publish to GitHub Packages Apache Maven
run: mvn deploy --file quartz-manager-parent/pom.xml -P "deploy-github,build-webjar"
env:
GITHUB_TOKEN: ${{ github.token }}

36
.github/workflows/maven.yml vendored Normal file
View File

@@ -0,0 +1,36 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Java CI with Maven
on:
push:
branches:
- develop
- master
paths: [ 'quartz-manager-parent/**' ]
pull_request:
branches:
- develop
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Build and test with Maven
run: mvn -B package --file quartz-manager-parent/pom.xml

44
.github/workflows/npm.yml vendored Normal file
View File

@@ -0,0 +1,44 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: npm CI
on:
push:
branches:
- develop
- master
paths: [ 'quartz-manager-frontend/**' ]
pull_request:
branches:
- develop
- master
defaults:
run:
working-directory: ./quartz-manager-frontend
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
cache-dependency-path: ./quartz-manager-frontend/package-lock.json
- name: 'install'
run: npm ci
- name: 'test'
run: npm test
- name: 'build'
run: npm run build --if-present

40
.github/workflows/sonar-java.yml vendored Normal file
View File

@@ -0,0 +1,40 @@
name: SonarCloud Analysis for Java
on:
push:
branches:
- master
- develop
# paths: [ 'quartz-manager-parent/**' ]
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:
jobs:
build:
name: Build and analyze
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'zulu' # Alternative distribution options are available.
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=fabioformosa_quartz-manager --file quartz-manager-parent/pom.xml

3
.gitignore vendored
View File

@@ -1 +1,4 @@
/.project
.idea
*.iml
.DS_Store

58
CHANGELOG.md Normal file
View File

@@ -0,0 +1,58 @@
## **v5.0.1**
### New Features
* Added full job management: list eligible job classes, create stored jobs, update jobs, delete jobs, and trigger jobs on demand.
* Added trigger management APIs and UI flows to inspect, create, reschedule, pause, resume, and unschedule triggers.
* Added support for Quartz trigger types beyond simple triggers: cron, daily time interval, and calendar interval triggers.
* Added Quartz calendar management for annual, cron, daily, holiday, monthly, and weekly calendars.
* Added calendar-aware scheduling support, including calendar assignment to triggers and included-time checks.
* Redesigned the Quartz Manager dashboard with a broader operations view for scheduler, jobs, triggers, calendars, progress, and logs.
* Updated the embedded UI to Angular 21.
* Added support for Spring Boot 4 applications.
### Breaking Changes
* Quartz Manager now requires Java 21+ and Spring Boot 4.x.
* Applications using Quartz Manager APIs must migrate from `javax.*` validation/annotation dependencies to `jakarta.*` equivalents through the Spring Boot 4 stack.
* Scheduler command endpoints now use `POST` operations and clearer action names: `/scheduler/start`, `/scheduler/standby`, `/scheduler/resume`, and `/scheduler/shutdown` replace the previous `GET` command endpoints.
* Simple trigger endpoints now include the trigger group in the path: `/simple-triggers/{group}/{name}`.
* New trigger creation should use the generalized `/triggers/{group}/{name}` API when working with cron, daily time interval, or calendar interval triggers.
### Fixes
* Fixed WebSocket log retrieval for job execution logs.
* Fixed UI style regressions and improved readability in the dashboard, login page, job class display, and misfire instruction display.
* Improved API error handling for missing jobs, missing triggers, missing calendars, unsupported trigger types, and scheduling conflicts.
## **v4.1.1**
**NEW FEATURE** support for multiple triggers
## **v4.0.10**
Migrated to the new maven central repo
## **v4.0.9**
Fixed a bug which prevented to run the liquibase migration scripts in case of usage of quartz-manager-starter-persistence
## **v4.0.8**
Upgraded the frontend to angular v14
## **v4.0.6**
Minor bug fixes
## **v4.0.5**
Fixed potential security issues
## **v4.0.4**
* Conformed the trigger configuration to the Simple Trigger of Quartz
* **BREAKING CHANGE** Changed accordingly the API and the UI
* Made Quartz Manager embeddable in projects with existing quartz instance, security layer, swagger ui.
## **v3.1.0**
* Added a new persistence module to persist the quartz triggers in a postgresql database
## **v3.0.1**
Quartz-Manager is now publicly available into the maven central repo into 3 different packages.
You can import:
* `quartz-manager-starter-api` to have a REST API layer to control your scheduler
* `quartz-manager-starter-ui` to import the UI also, in your spring webapp.
* `quartz-manager-starter-security` if you want to give access to the quartz-manager UI and API only to authenticated users

34
Dockerfile Normal file
View File

@@ -0,0 +1,34 @@
FROM maven:3.9.8-eclipse-temurin-21 AS build
# Set the working directory
WORKDIR /app
# Copy the pom.xml and download dependencies
COPY quartz-manager-parent/pom.xml ./quartz-manager-parent/
COPY quartz-manager-parent/lombok.config ./quartz-manager-parent/
COPY quartz-manager-parent/quartz-manager-common ./quartz-manager-parent/quartz-manager-common/
COPY quartz-manager-parent/quartz-manager-starter-api ./quartz-manager-parent/quartz-manager-starter-api/
COPY quartz-manager-parent/quartz-manager-starter-persistence ./quartz-manager-parent/quartz-manager-starter-persistence/
COPY quartz-manager-parent/quartz-manager-starter-security ./quartz-manager-parent/quartz-manager-starter-security/
COPY quartz-manager-parent/quartz-manager-starter-ui ./quartz-manager-parent/quartz-manager-starter-ui/
COPY quartz-manager-parent/quartz-manager-web-showcase ./quartz-manager-parent/quartz-manager-web-showcase/
COPY quartz-manager-parent/lombok.config ./quartz-manager-parent/
COPY quartz-manager-frontend ./quartz-manager-frontend/
WORKDIR /app/quartz-manager-parent
RUN mvn clean package -DskipTests -P=build-webjar
# Stage 2: Create the final image
FROM openjdk:11-jre-slim
# Set the working directory
WORKDIR /app
# Copy the JAR file from the build stage
COPY --from=build /app/quartz-manager-parent/quartz-manager-web-showcase/target/*-SNAPSHOT.jar app.jar
# Expose the application port
EXPOSE 8080
# Run the application
ENTRYPOINT ["java", "-jar", "app.jar"]

437
README.md
View File

@@ -1,249 +1,340 @@
[![Build Status](https://travis-ci.org/fabioformosa/quartz-manager.svg?branch=master)](https://travis-ci.org/fabioformosa/quartz-manager)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/it.fabioformosa.quartz-manager/quartz-manager-starter-api/badge.svg)](https://maven-badges.herokuapp.com/maven-central/it.fabioformosa.quartz-manager/quartz-manager-starter-api)
[![Gitter](https://badges.gitter.im/quartz-manager/community.svg)](https://gitter.im/quartz-manager/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
<div align="center">
# QUARTZ MANAGER
Quartz Manager is a library you can import in your spring webapp to easily enable the [Quartz Scheduler](http://www.quartz-scheduler.org/) and to control it by REST APIs or by a UI Manager Panel (angular-based).
# Quartz Manager
Your Spring Webapp should provide the java class of the job you want schedule. Importing the Quartz Manager your project will have the REST API and (optionally) the UI to launch and control the job.
The UI Dashboard is composed by a management panel to set the quartz trigger, to start/stop the scheduler and a log panel with a progress bar to display the job output.
**A Spring Boot library and standalone web app that adds REST API and dashboard management to Quartz Scheduler.**
![](https://github.com/fabioformosa/quartz-manager/blob/master/quartz-manager-parent/quartz-manager-web-showcase/src/main/resources/quartz-manager-2-screenshot_800.PNG)
[![Java CI with Maven](https://github.com/fabioformosa/quartz-manager/actions/workflows/maven.yml/badge.svg)](https://github.com/fabioformosa/quartz-manager/actions/workflows/maven.yml)
[![npm CI](https://github.com/fabioformosa/quartz-manager/actions/workflows/npm.yml/badge.svg)](https://github.com/fabioformosa/quartz-manager/actions/workflows/npm.yml)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=fabioformosa_quartz-manager&metric=coverage)](https://sonarcloud.io/summary/new_code?id=fabioformosa_quartz-manager)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=fabioformosa_quartz-manager&metric=bugs)](https://sonarcloud.io/summary/new_code?id=fabioformosa_quartz-manager)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=fabioformosa_quartz-manager&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=fabioformosa_quartz-manager)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=fabioformosa_quartz-manager&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=fabioformosa_quartz-manager)
## HOW IT WORKS
* Set up the trigger into the left sidebar in terms of: daily frequency and and max occurrences.
* Press the start button
* The GUI manager updates the progress bar and reports all logs of your quartz job.
[Choose Your Path](#choose-your-path) • [Features](#features) • [Quick Start](#quick-start) • [REST API](#rest-api) • [Security](#security) • [Persistence](#persistence) • [Roadmap](#roadmap)
## QUICK START
</div>
* **Requirements**
Java 8+
[Quartz Scheduler](https://www.quartz-scheduler.org/) is powerful, but it does not ship with a REST API or an operations dashboard. Quartz Manager fills that gap for Spring Boot applications and can also run as a standalone scheduler web app.
* **add the dependency**
Use it to start and stop a scheduler, create jobs, schedule triggers, manage calendars, inspect executions, and monitor job progress from HTTP endpoints or from a browser UI.
MAVEN
![Quartz Manager dashboard](https://github.com/fabioformosa/quartz-manager/blob/master/docs/assets/quartz-manager-dashboard.png)
```
## Choose Your Path
### 1. Add API And UI To Your Existing App
Use this path when you already have a Spring Boot application and want to add a Quartz management API, an embedded management panel, or both.
Current behavior: Quartz Manager creates and manages its own scheduler bean named `quartzManagerScheduler` by default. It can coexist with other Quartz schedulers in the same application, but it does not automatically take control of an arbitrary existing scheduler instance.
If you want Quartz Manager to manage an existing scheduler today, disable the default scheduler configuration with `quartz-manager.quartz.enabled=false` and provide a compatible bean named `quartzManagerScheduler`. First-class existing-scheduler integration is planned on the roadmap.
Your managed jobs must extend `AbstractQuartzManagerJob` so Quartz Manager can expose them as eligible jobs and stream their execution logs/progress to the UI.
If you also want the browser dashboard, see [Add The UI](#add-the-ui).
### 2. Add A New Scheduler To Your App
Use this path when your Spring Boot application does not have Quartz yet and you want to add a scheduler managed by Quartz Manager.
The easiest setup is to let Quartz Manager import, initialize, and manage a Quartz Scheduler for you. Import the API starter, create jobs extending `AbstractQuartzManagerJob`, configure the package that contains your jobs, and use the REST API or UI to create jobs and triggers.
You can later add optional modules for the embedded UI, JWT security, and PostgreSQL persistence.
If you also want the browser dashboard, see [Add The UI](#add-the-ui).
### 3. Run Quartz Manager As A Standalone App
Use this path when you want a standalone scheduler web application instead of embedding Quartz Manager into an existing product.
The `quartz-manager-web-showcase` application imports Quartz Manager API, UI, and security modules and runs with an embedded Quartz scheduler. It is useful as a ready-to-run management console, as a demo, and as a reference application.
Even in standalone mode, the jobs managed by Quartz Manager must extend `AbstractQuartzManagerJob`.
## Features
- REST API for scheduler, job, trigger, and calendar management.
- Embeddable management UI provided as a webjar: import it as a Maven dependency and open `/quartz-manager-ui` in the browser.
- Scheduler commands: start, standby, resume, and shutdown.
- Job management: list eligible job classes, create stored jobs, update jobs, delete jobs, and trigger jobs manually.
- Trigger management: create, inspect, reschedule, pause, resume, and unschedule triggers.
- Trigger types: simple, cron, daily time interval, and calendar interval.
- Calendar management: annual, cron, daily, holiday, monthly, and weekly calendars.
- Misfire handling for supported trigger types.
- WebSocket updates for job execution progress and logs.
- Optional OpenAPI/Swagger UI documentation.
- Optional JWT-based security with in-memory users.
- Optional PostgreSQL persistence using Quartz JDBC job store and Liquibase-managed schema creation.
In dependency snippets, replace `VERSION` with the version you want to use.
## Requirements
- Java 21+
- Spring Boot 4.x
- Maven 3.9+
- Node.js and npm only if you build the frontend locally
## Modules
| Module | Required | Purpose |
| --- | --- | --- |
| `quartz-manager-starter-api` | Required | REST API, managed scheduler integration, jobs, triggers, calendars, OpenAPI support, and WebSocket updates |
| `quartz-manager-starter-ui` | Optional | Embeddable management UI provided as a webjar |
| `quartz-manager-starter-security` | Optional | JWT authentication for Quartz Manager API and UI |
| `quartz-manager-starter-persistence` | Optional | PostgreSQL-backed Quartz persistence and Liquibase schema setup |
| `quartz-manager-web-showcase` | Optional | Standalone/demo Spring Boot application using the Quartz Manager modules |
## Quick Start
### Path 1: Existing Spring Boot App
Add the API starter:
```xml
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-starter-api</artifactId>
<version>3.0.1</version>
</dependency>
<!-- OPTIONALLY -->
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-starter-ui</artifactId>
<version>3.0.1</version>
<version>VERSION</version>
</dependency>
```
GRADLE
Create jobs by extending `AbstractQuartzManagerJob`:
```java
import it.fabioformosa.quartzmanager.api.jobs.AbstractQuartzManagerJob;
import it.fabioformosa.quartzmanager.api.jobs.entities.LogRecord;
import org.quartz.JobExecutionContext;
public class SampleJob extends AbstractQuartzManagerJob {
@Override
public LogRecord doIt(JobExecutionContext context) {
return new LogRecord(LogRecord.LogType.INFO, "Hello from Quartz Manager");
}
}
```
compile group: 'it.fabioformosa.quartz-manager', name: 'quartz-manager-starter-api', version: '3.0.1'
//optionally
compile group: 'it.fabioformosa.quartz-manager', name: 'quartz-manager-starter-ui', version: '3.0.1'
Configure job discovery:
```properties
quartz-manager.jobClassPackages=com.example.jobs
quartz-manager.oas.enabled=true
```
Import `quartz-manager-starter-ui` as well, if you want use the Quartz Manager API by the angular frontend.
* **add a `quartz.properties` file in the classpath (`src/main/resources`)**
By default, Quartz Manager creates a dedicated scheduler named `quartz-manager-scheduler`. If your app already has another Quartz scheduler, both can coexist.
Advanced existing-scheduler setup:
```properties
quartz-manager.quartz.enabled=false
```
org.quartz.scheduler.instanceName=example
org.quartz.scheduler.instanceId=AUTO
Then provide a `Scheduler` bean named `quartzManagerScheduler`. This is the current integration point; a more explicit existing-scheduler mode is planned.
To add the browser dashboard to your application, see [Add The UI](#add-the-ui).
### Path 2: New Scheduler In Your App
Use the same API starter setup as Path 1, then let Quartz Manager create its managed scheduler.
Create one or more jobs extending `AbstractQuartzManagerJob`, configure `quartz-manager.jobClassPackages`, then create stored jobs and triggers through the REST API, Swagger UI, or the dashboard.
Default managed Quartz properties:
```properties
org.quartz.scheduler.instanceName=quartz-manager-scheduler
org.quartz.threadPool.threadCount=1
```
To customize the managed scheduler, add `managed-quartz.properties` to your classpath.
* **Create the job class that you want to schedule**
```
public class SampleJob extends AbstractLoggingJob {
To add the browser dashboard to your application, see [Add The UI](#add-the-ui).
@Override
public LogRecord doIt(JobExecutionContext jobExecutionContext) {
return new LogRecord(LogType.INFO, "Hello from QuartManagerDemo!");
}
### Path 3: Standalone Quartz Manager App
}
```
Extend the super-class `AbstractLoggingJob`
Run the standalone showcase application when you want Quartz Manager as a ready-to-use scheduler web app.
* **Enable quartz-manager adding into the application.yml**
```
quartz:
enabled: true
job:
frequency: 4000
repeatCount: 19
quartz-manager:
jobClass: <QUALIFIED NAME OF THE YOUR JOB CLASS>
```bash
git clone https://github.com/fabioformosa/quartz-manager.git
cd quartz-manager/quartz-manager-parent
mvn install -Pbuild-webjar
cd quartz-manager-web-showcase
mvn spring-boot:run
```
* **REST API**
You can access the REST API, through the swagger-ui. Open the URL:
[http://localhost:8080/swagger-ui.html](http://localhost:8080/swagger-ui.html)
(Change the port and the contextPath accordingly with the setup of your webapp)
* **Frontend**
If you've imported the `quartz-manager-starter-ui` you can open the UI at URL:
[http://localhost:8080/quartz-manager-ui/index.html](http://localhost:8080/quartz-manager-ui/index.html)
(Change the port and the contextPath accordingly with the setup of your webapp)
* **Security**
If you want enable a security layer and allow the access to the REST API and to the UI only to authenticated users, add the dependency:
MAVEN
Open the dashboard:
```text
http://localhost:8080/quartz-manager-ui/index.html
```
Open Swagger UI when OpenAPI is enabled:
```text
http://localhost:8080/swagger-ui.html
```
Default showcase credentials:
```text
admin / admin
```
To plug in your own jobs today, add your job classes inside the cloned repository, rebuild the standalone application, and configure `quartz-manager.jobClassPackages` to include their package.
A Docker-based standalone distribution is planned. It will provide a supported mechanism to attach external job classes without modifying the cloned repository.
## Add The UI
Add the UI starter when you want the embedded management panel in your Spring Boot app:
```xml
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-starter-security</artifactId>
<version>3.0.1</version>
<artifactId>quartz-manager-starter-ui</artifactId>
<version>VERSION</version>
</dependency>
```
GRADLE
The UI is served from:
```
compile group: 'it.fabioformosa.quartz-manager', name: 'quartz-manager-starter-security', version: '3.0.1'
```text
http://localhost:8080/quartz-manager-ui/index.html
```
and in your application.yml:
## REST API
Quartz Manager exposes its API under `/quartz-manager`.
| Area | Endpoints |
| --- | --- |
| Scheduler | `GET /quartz-manager/scheduler`, `POST /quartz-manager/scheduler/start`, `POST /quartz-manager/scheduler/standby`, `POST /quartz-manager/scheduler/resume`, `POST /quartz-manager/scheduler/shutdown` |
| Job classes | `GET /quartz-manager/job-classes` |
| Jobs | `GET /quartz-manager/jobs`, `POST /quartz-manager/jobs/{group}/{name}`, `PUT /quartz-manager/jobs/{group}/{name}`, `POST /quartz-manager/jobs/{group}/{name}/trigger`, `DELETE /quartz-manager/jobs/{group}/{name}` |
| Triggers | `GET /quartz-manager/triggers`, `POST /quartz-manager/triggers/{group}/{name}`, `PUT /quartz-manager/triggers/{group}/{name}`, `POST /quartz-manager/triggers/{group}/{name}/pause`, `POST /quartz-manager/triggers/{group}/{name}/resume`, `DELETE /quartz-manager/triggers/{group}/{name}` |
| Calendars | `GET /quartz-manager/calendars`, `POST /quartz-manager/calendars/{name}`, `PUT /quartz-manager/calendars/{name}`, `DELETE /quartz-manager/calendars/{name}`, `POST /quartz-manager/calendars/{name}/included-time-test` |
Enable OpenAPI and Swagger UI with:
```properties
quartz-manager.oas.enabled=true
```
Then open:
```text
http://localhost:8080/swagger-ui.html
```
## Security
Add the security starter when you want Quartz Manager API and UI protected by JWT authentication:
```xml
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-starter-security</artifactId>
<version>VERSION</version>
</dependency>
```
Example configuration:
```yaml
quartz-manager:
security:
login-model:
form-login-enabled: true
userpwd-filter-enabled : false
jwt:
enabled: true
secret: "PLEASE_TYPE_HERE_A_SECRET"
expiration-in-sec: 28800 # 8 hours
secret: "change-me"
expiration-in-sec: 28800
header-strategy:
enabled: false
header: "Authorization"
cookie-strategy:
enabled: true
header: Authorization
cookie-strategy:
enabled: false
cookie: AUTH-TOKEN
accounts:
in-memory:
enabled: true
users:
- name: admin
password: admin
roles:
- ADMIN
accounts:
in-memory:
enabled: true
users:
- username: admin
password: admin
roles:
- ADMIN
```
* **DEMO**
Security is applied to `/quartz-manager/**`. The UI webjar path is ignored by the security filter chain, while API calls require authentication.
Take a loot to the project [Quartz-Manager Demo](https://github.com/fabioformosa/quartz-manager-demo), it is an example of how-to:
* import the quartz-manager-api library in your webapp
* include the quartz-manager frontend (angular based) through a webjar
* set properties into the application.yml
* add a secure layer to allow the API only to logged users
* schedule a custom job (a dummy `hello world`)
## Persistence
## ROADMAP
Open the [Project Roadmap](https://github.com/fabioformosa/quartz-manager/projects) to take a look at the plan of Quartz Manager.
By default, Quartz Manager uses Quartz's in-memory job store. Scheduling data is lost when the application stops.
Next steps in the roadmap are:
* to add a persistent layer to save all job setup.
* to add a complete setup UI panel for quartz, in term of cronjobs and multiple jobs.
* to add CI/CD pipeline to ease the deploy pulling a docker container.
* Enabling adapters for integrations: kafka, etc.
## HOW-TO CONTRIBUTE
### PROJECT STRUCTURE
* **quartz-parent/quartz-manager-starter-api** is the library that can be imported in webapp to have the quartz-manager API.
* **quartz-parent/quartz-manager-starter-ui** is a maven module to build and package the angular frontend in a webjar.
* **quartz-parent/quartz-manager-starter-security** is ther library that can be imported in a webapp to have a security layer (login) over the quartz-manager API.
* **quartz-parent/quartz-manager-web-showcase** is an example of webapp that imports quartz-manager-api. Useful to develop the frontend started locally with the webpack dev server.
* **quartz-frontend** is the angular app that interacts with the Quartz Manager API.
### PROJECT DETAILS
**[requirements]** Make sure you have installed
* [Java 8](https://java.com/download/) or greater
* [Maven](https://maven.apache.org/)
* [npm](https://www.npmjs.com/get-npm), [node](https://nodejs.org) and [angular-cli](https://cli.angular.io/)
To build&run quartz-manager in your machine:
```
#CLONE REPOSITORY
git clone https://github.com/fabioformosa/quartz-manager.git
# START QUARTZ-MANAGER-WEB
cd quartz-manager/quartz-parent
mvn install
cd quartz-manager/quartz-parent/quartz-manager-web-showcase
mvn spring-boot:run
# START QUARTZ-MANAGER-FRONTEND
cd quartz-manager/quartz-manager-frontend
npm install
npm start
Add the persistence starter when you want Quartz Manager's managed scheduler to use PostgreSQL-backed Quartz persistence:
```xml
<dependency>
<groupId>it.fabioformosa.quartz-manager</groupId>
<artifactId>quartz-manager-starter-persistence</artifactId>
<version>VERSION</version>
</dependency>
```
1. Open browser at [http://localhost:4200](http://localhost:4200)
1. Log in with **default credentials**: `admin/admin`
Configure the Quartz Manager datasource:
If you are not confident with maven CLI, you can start it by your IDE. For more details [spring boot ref.](http://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-running-your-application.html)
```yaml
quartz-manager:
persistence:
quartz:
datasource:
url: jdbc:postgresql://localhost:5432/quartzmanager
user: quartzmanager
password: quartzmanager
```
The persistence module configures Quartz `JobStoreTX`, uses the PostgreSQL delegate, and creates the required Quartz tables through Liquibase.
## HOW TO RUN YOUR SCHEDULED JOB
By default, `quartz-manager-web-showcase` executes the dummy job that logs "hello world!".
Replace the dummy job (class: `it.fabioformosa.quartzmanager.jobs.SampleJob`) with yours. Follow these steps:
## Examples
1. Extend the super class `it.fabioformosa.quartzmanager.jobs.AbstractLoggingJob`
1. set property `quartz-manager.jobClass` with qualified name of your custom Job Class (default job is SampleJob.class)
Example integrations are available in [quartz-manager-use-cases](https://github.com/fabioformosa/quartz-manager-use-cases).
## HOW TO CHANGE SETTINGS
* Num of Threads: `/quartz-manager-parent/quartz-manager-web/src/main/resources/quartz.properties`
* Credentials: To change admin's password, set ENV var `quartz-manager.account.pwd`
* quartz-manager backend context path (default `/quartz-manager`) and port (default `8080`): `/quartz-manager/src/main/resources/application.properties`
The use cases cover simple Spring applications, secured and unsecured setups, existing application security, existing Quartz scenarios, and persistence.
## HOW TO BROWSE REST API DOC
Swagger has been added as library. So, you can get REST API doc opening: [http://localhost:8080/quartz-manager/swagger-ui.html](http://localhost:8080/quartz-manager/swagger-ui.html)
## Current Limitations
## Tech Overview
- Quartz Manager creates and manages its own scheduler by default. Automatic discovery and first-class management of an arbitrary existing scheduler is not yet supported.
- Existing applications that want Quartz Manager to manage a pre-existing scheduler must currently provide it as a bean named `quartzManagerScheduler` and disable Quartz Manager's default scheduler creation.
- Persistence currently targets PostgreSQL.
- Cluster mode is not currently documented as a supported production mode.
- Managed jobs must extend `AbstractQuartzManagerJob` to be eligible for job discovery and UI log/progress streaming.
**Backend Stack** Java 8, Spring Boot 2.1.4 (Spring MVC 5.1.6, Spring Security 5.1.5, Spring AOP 5.1.6), Quartz Scheduler 2.3.1
## Roadmap
**Application Server** Tomcat (embedded)
The next priorities are tracked in the [project roadmap](https://github.com/users/fabioformosa/projects/1).
**Frontend** Angular 9.1.4, Web-Socket (stompjs 2.3.3)
Planned improvements include:
**Style** angular material, FontAwesome 5
- First-class support for managing an existing Quartz Scheduler instance.
- Cluster mode support.
- Additional persistence targets beyond PostgreSQL.
- OAuth2 client support.
- Continued UI improvements.
From quartz manager ver 2.x.x, the new structure of project is:
* REST API backend
* Single Page Application frontend (angular 9)
## Development
(The previous version of quartz manager was a monolithic backend that provided also frontend developed with angularjs 1.6.x. You can find it at the branch 1.x.x)
This repository contains the backend modules and the frontend application.
## Contributes
For local development, repository structure, build commands, and contribution details, see [quartz-manager-parent/README.md](https://github.com/fabioformosa/quartz-manager/blob/develop/quartz-manager-parent/README.md).
Every contribution is welcome. Open a issue, so we can discuss about new features and implement them.
## Contributing
## Credits
Contributions are welcome. Open an issue to discuss bugs, questions, or feature proposals before starting larger changes.
* this project has been created from [angular-spring-starter](https://github.com/bfwg/angular-spring-starter)
## License
Quartz Manager is released under the [Apache License 2.0](LICENSE).
## Support
If Quartz Manager is useful to you, consider starring the repository to support the project.

45
cloudbuild.yaml Normal file
View File

@@ -0,0 +1,45 @@
substitutions:
_REGION: europe-west8
steps:
# Step 1: Google Cloud Build - Docker build&push
- name: 'gcr.io/k8s-skaffold/skaffold'
entrypoint: 'sh'
args:
- -xe
- -c
- |
# Build and push images
sed -i s/_IMAGE_TAG_POLICY/$SHORT_SHA/g skaffold.yaml
sed -i s/_HELM_APP_VERSION/$SHORT_SHA/g ./quartz-manager-parent/quartz-manager-web-showcase/helm/Chart.yaml
skaffold build --file-output=/workspace/artifacts.json \
--default-repo=${_REGION}-docker.pkg.dev/quartz-manager-test/quartz-manager/quartz-manager-standalone \
--push=true
# Step 2: Google Cloud Deploy - deploy
- name: 'google/cloud-sdk:latest'
entrypoint: 'sh'
args:
- -xe
- -c
- |
sed -i s/_HELM_APP_VERSION/$SHORT_SHA/g ./quartz-manager-parent/quartz-manager-web-showcase/helm/Chart.yaml
gcloud config set deploy/region ${_REGION}
gcloud deploy apply --file ./quartz-manager-parent/quartz-manager-web-showcase/deploy/pipeline.yaml
gcloud deploy apply --file ./quartz-manager-parent/quartz-manager-web-showcase/deploy/dev.yaml
gcloud deploy apply --file ./quartz-manager-parent/quartz-manager-web-showcase/deploy/staging.yaml
gcloud deploy apply --file ./quartz-manager-parent/quartz-manager-web-showcase/deploy/prod.yaml
gcloud deploy releases create rel-${SHORT_SHA} \
--delivery-pipeline quartz-manager-pipeline \
--description "$(git log -1 --pretty='%s')" \
--build-artifacts /workspace/artifacts.json \
--verbosity=debug \
--annotations "commit_ui=https://source.cloud.google.com/$PROJECT_ID/quartz-manager-standalone/+/$COMMIT_SHA"
artifacts:
objects:
location: 'gs://$PROJECT_ID-gcdeploy-artifacts/'
paths:
- '/workspace/artifacts.json'
options:
logging: CLOUD_LOGGING_ONLY

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

View File

@@ -5,8 +5,8 @@
# You can see what browsers were selected by your queries by running:
# npx browserslist
> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.
last 2 Chrome versions
last 2 Firefox versions
last 2 Edge versions
last 2 Safari versions
last 2 iOS versions

View File

@@ -0,0 +1,178 @@
/*
👋 Hi! This file was autogenerated by tslint-to-eslint-config.
https://github.com/typescript-eslint/tslint-to-eslint-config
It represents the closest reasonable ESLint configuration to this
project's original TSLint configuration.
We recommend eventually switching this configuration to extend from
the recommended rulesets in typescript-eslint.
https://github.com/typescript-eslint/tslint-to-eslint-config/blob/master/docs/FAQs.md
Happy linting! 💖
*/
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": [
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
"sourceType": "module"
},
"plugins": [
"eslint-plugin-import",
"@angular-eslint/eslint-plugin",
"@typescript-eslint"
],
"root": true,
"rules": {
"@angular-eslint/component-class-suffix": "off",
"@angular-eslint/component-selector": "off",
"@angular-eslint/directive-class-suffix": "error",
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/no-input-rename": "error",
"@angular-eslint/no-inputs-metadata-property": "error",
"@angular-eslint/no-output-rename": "error",
"@angular-eslint/no-outputs-metadata-property": "error",
"@angular-eslint/use-lifecycle-interface": "error",
"@angular-eslint/use-pipe-transform-interface": "error",
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/dot-notation": "off",
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
"accessibility": "explicit"
}
],
"@typescript-eslint/indent": "off",
"@typescript-eslint/member-delimiter-style": [
"off",
{
"multiline": {
"delimiter": "none",
"requireLast": true
},
"singleline": {
"delimiter": "semi",
"requireLast": false
}
}
],
"@typescript-eslint/member-ordering": "off",
"@typescript-eslint/naming-convention": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-inferrable-types": [
"error",
{
"ignoreParameters": true
}
],
"@typescript-eslint/no-shadow": [
"error",
{
"hoist": "all"
}
],
"@typescript-eslint/no-unused-expressions": "error",
"@typescript-eslint/prefer-function-type": "error",
"@typescript-eslint/semi": [
"off",
null
],
"@typescript-eslint/type-annotation-spacing": "off",
"@typescript-eslint/unified-signatures": "error",
"brace-style": [
"error",
"1tbs"
],
"curly": "error",
"dot-notation": "off",
"eol-last": "off",
"eqeqeq": [
"error",
"smart"
],
"guard-for-in": "error",
"id-denylist": "off",
"id-match": "off",
"import/no-deprecated": "warn",
"indent": "off",
"max-len": [
"error",
{
"code": 140
}
],
"no-bitwise": "error",
"no-caller": "error",
"no-console": [
"error",
{
"allow": [
"log",
"warn",
"dir",
"timeLog",
"assert",
"clear",
"count",
"countReset",
"group",
"groupEnd",
"table",
"dirxml",
"error",
"groupCollapsed",
"Console",
"profile",
"profileEnd",
"timeStamp",
"context"
]
}
],
"no-debugger": "error",
"no-empty": "off",
"no-empty-function": "off",
"no-eval": "error",
"no-fallthrough": "error",
"no-new-wrappers": "error",
"no-redeclare": "error",
"no-restricted-imports": "error",
"no-shadow": "off",
"no-throw-literal": "error",
"no-trailing-spaces": "off",
"no-underscore-dangle": "off",
"no-unused-expressions": "off",
"no-unused-labels": "error",
"no-var": "error",
"prefer-const": "error",
"quotes": "off",
"radix": "error",
"semi": "off",
"spaced-comment": [
"error",
"always",
{
"markers": [
"/"
]
}
],
"valid-typeof": "error"
}
}

View File

@@ -0,0 +1,19 @@
{
"env": {
"browser": true,
"es6": true,
"node": true
},
"extends": [
"plugin:sonarjs/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "tsconfig.json",
"sourceType": "module"
},
"plugins": [
"sonarjs"
],
"root": true
}

View File

@@ -40,6 +40,4 @@ testem.log
# System Files
.DS_Store
Thumbs.db
#package-lock.json
package-lock.json
/.angular/

View File

@@ -0,0 +1,47 @@
src/polyfills.ts
src/typings.d.ts
_test.ts
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# dependencies
/node_modules
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
testem.log
/typings
# e2e
/e2e/*.js
/e2e/*.map
# System Files
.DS_Store
Thumbs.db
/.angular/

View File

@@ -0,0 +1,11 @@
{
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"semi": true,
"bracketSpacing": true,
"arrowParens": "avoid",
"trailingComma": "es5",
"bracketSameLine": true,
"printWidth": 80
}

View File

@@ -3,8 +3,9 @@
"version": 1,
"newProjectRoot": "projects",
"projects": {
"angular-spring-starter": {
"quartz-manager-ui": {
"root": "",
"prefix": "qrzmng",
"sourceRoot": "src",
"projectType": "application",
"architect": {
@@ -17,16 +18,28 @@
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"allowedCommonJsDependencies": [
"@stomp/stompjs", "stompjs", "sockjs-client", "angular2-uuid"
],
"assets": [
"src/assets",
"src/favicon.ico"
],
"styles": [
"src/styles.css"
"src/styles.css",
"node_modules/roboto-fontface/css/roboto/roboto-fontface.css"
],
"scripts": []
},
"configurations": {
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
},
"production": {
"budgets": [
{
@@ -37,7 +50,6 @@
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
@@ -55,64 +67,60 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "angular-spring-starter:build"
"buildTarget": "quartz-manager-ui:build:development"
},
"configurations": {
"production": {
"browserTarget": "angular-spring-starter:build:production"
"buildTarget": "quartz-manager-ui:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "angular-spring-starter:build"
"buildTarget": "quartz-manager-ui:build"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@angular-eslint/builder:lint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": []
}
}
}
},
"angular-spring-starter-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "angular-spring-starter:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": []
"eslintConfig": ".eslintrc.json",
"lintFilePatterns": ["**/*.spec.ts", "**/*.ts"]
}
}
}
}
},
"defaultProject": "angular-spring-starter",
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"style": "css"
"prefix": "qrzmng",
"style": "css",
"type": "component"
},
"@schematics/angular:directive": {
"prefix": "app"
"prefix": "qrzmng",
"type": "directive"
},
"@schematics/angular:service": {
"type": "service"
},
"@schematics/angular:guard": {
"typeSeparator": "."
},
"@schematics/angular:interceptor": {
"typeSeparator": "."
},
"@schematics/angular:module": {
"typeSeparator": "."
},
"@schematics/angular:pipe": {
"typeSeparator": "."
},
"@schematics/angular:resolver": {
"typeSeparator": "."
}
},
"cli": {
"analytics": false
}
}
}

View File

@@ -0,0 +1,30 @@
import sonarjs from 'eslint-plugin-sonarjs';
import tsParser from '@typescript-eslint/parser';
export default [
{
files: ['src/**/*.ts'],
languageOptions: {
parser: tsParser,
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module'
}
},
plugins: {
sonarjs
},
rules: {
...sonarjs.configs.recommended.rules,
'sonarjs/deprecation': 'off',
'sonarjs/no-commented-code': 'off',
'sonarjs/no-dead-store': 'off',
'sonarjs/no-incomplete-assertions': 'off',
'sonarjs/no-primitive-wrappers': 'off',
'sonarjs/no-unused-vars': 'off',
'sonarjs/prefer-promise-shorthand': 'off',
'sonarjs/todo-tag': 'off',
'sonarjs/unused-import': 'off'
}
}
];

View File

@@ -0,0 +1,20 @@
const {createEsmPreset} = require('jest-preset-angular/presets');
module.exports = {
...createEsmPreset({
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$'
}),
moduleNameMapper: {
'^tslib$': '<rootDir>/node_modules/tslib/tslib.es6.mjs',
'^rxjs$': '<rootDir>/node_modules/rxjs/dist/cjs/index.js',
'^rxjs/operators$': '<rootDir>/node_modules/rxjs/dist/cjs/operators/index.js',
'^rxjs/(.*)$': '<rootDir>/node_modules/rxjs/dist/cjs/$1',
'^@fortawesome/fontawesome$': '<rootDir>/node_modules/@fortawesome/fontawesome/index.js',
'^@fortawesome/fontawesome-free-solid$': '<rootDir>/node_modules/@fortawesome/fontawesome-free-solid/index.js'
},
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
transformIgnorePatterns: [
'node_modules/(?!(@angular|@fortawesome|@stomp/rx-stomp|@stomp/stompjs|.*\\.mjs$)/)'
]
};

View File

@@ -1 +1,3 @@
import 'jest-preset-angular';
import {setupZoneTestEnv} from 'jest-preset-angular/setup-env/zone/index.mjs';
setupZoneTestEnv();

View File

@@ -1,42 +0,0 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
files: [
],
preprocessors: {
},
mime: {
'text/x-typescript': ['ts','tsx']
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true
},
reporters: config.angularCli && config.angularCli.codeCoverage
? ['progress', 'coverage-istanbul']
: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};

23059
quartz-manager-frontend/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -5,66 +5,69 @@
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.conf.json",
"build": "ng build --prod",
"test": "jest",
"build": "ng build --configuration production",
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
"lint": "ng lint",
"e2e": "ng e2e"
"lint:sonar": "eslint -c eslint.sonar.config.mjs \"src/**/*.ts\"",
"lint:sonar:fix": "eslint -c eslint.sonar.config.mjs \"src/**/*.ts\" --fix"
},
"private": true,
"dependencies": {
"@angular/animations": "9.1.4",
"@angular/cdk": "9.2.1",
"@angular/common": "9.1.4",
"@angular/compiler": "9.1.4",
"@angular/core": "9.1.4",
"@angular/flex-layout": "9.0.0-beta.29",
"@angular/forms": "9.1.4",
"@angular/material": "9.2.1",
"@angular/platform-browser": "9.1.4",
"@angular/platform-browser-dynamic": "9.1.4",
"@angular/platform-server": "9.1.4",
"@angular/router": "9.1.4",
"@auth0/angular-jwt": "^4.0.0",
"@angular/animations": "21.2.12",
"@angular/cdk": "21.2.10",
"@angular/common": "21.2.12",
"@angular/compiler": "21.2.12",
"@angular/core": "21.2.12",
"@angular/forms": "21.2.12",
"@angular/material": "21.2.10",
"@angular/platform-browser": "21.2.12",
"@angular/platform-browser-dynamic": "21.2.12",
"@angular/platform-server": "21.2.12",
"@angular/router": "21.2.12",
"@auth0/angular-jwt": "5.2.0",
"@danielmoncada/angular-datetime-picker": "21.0.0",
"@fortawesome/fontawesome": "^1.1.4",
"@fortawesome/fontawesome-free-regular": "^5.0.8",
"@fortawesome/fontawesome-free-solid": "^5.0.8",
"@stomp/ng2-stompjs": "^0.6.3",
"core-js": "2.5.1",
"@stomp/rx-stomp": "2.4.0",
"@stomp/stompjs": "^7.2.0",
"hammerjs": "2.0.8",
"net": "^1.0.2",
"rxjs": "6.5.5",
"roboto-fontface": "^0.10.0",
"rxjs": "^7.8.2",
"sockjs-client": "^1.1.1",
"stompjs": "^2.3.3",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
"tslib": "^2.8.1",
"uuid": "^13.0.0",
"zone.js": "~0.16.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.901.4",
"@angular-devkit/core": "^9.1.4",
"@angular/cli": "9.1.4",
"@angular/compiler-cli": "9.1.4",
"@angular/language-service": "9.1.4",
"@angular-devkit/build-angular": "^21.2.10",
"@angular-devkit/core": "^21.2.10",
"@angular-eslint/builder": "21.3.1",
"@angular-eslint/eslint-plugin": "21.3.1",
"@angular-eslint/eslint-plugin-template": "21.3.1",
"@angular-eslint/schematics": "21.3.1",
"@angular-eslint/template-parser": "21.3.1",
"@angular/cli": "^21.2.10",
"@angular/compiler-cli": "21.2.12",
"@angular/language-service": "21.2.12",
"@types/hammerjs": "2.0.34",
"@types/jasmine": "2.5.54",
"@types/jasminewd2": "2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^5.1.2",
"jasmine-core": "2.6.4",
"jasmine-spec-reporter": "4.1.1",
"jest": "^26.0.1",
"jest-preset-angular": "^8.2.0",
"karma": "1.7.1",
"karma-chrome-launcher": "2.1.1",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "1.3.0",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"protractor": "5.1.2",
"ts-node": "3.0.6",
"tslint": "5.7.0",
"typescript": "3.8.3"
},
"jest": {
"preset": "jest-preset-angular",
"setupFilesAfterEnv": ["<rootDir>/jest.setup.ts"]
"@types/jasmine": "^5.1.13",
"@types/jest": "^30.0.0",
"@types/node": "^22.13.14",
"@typescript-eslint/eslint-plugin": "^8.48.1",
"@typescript-eslint/parser": "^8.48.1",
"eslint": "^9.39.1",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-sonarjs": "^4.0.3",
"jest": "30.4.1",
"jest-environment-jsdom": "^30.2.0",
"jest-preset-angular": "^16.1.5",
"jsdom": "^27.3.0",
"prettier": "^2.8.1",
"prettier-eslint": "^15.0.1",
"typescript": "5.9.3"
}
}

View File

@@ -1,32 +0,0 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/long-stack-trace-zone';
import 'zone.js/dist/proxy.js';
import 'zone.js/dist/sync-test';
import 'zone.js/dist/jasmine-patch';
import 'zone.js/dist/async-test';
import 'zone.js/dist/fake-async-test';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
declare var __karma__: any;
declare var require: any;
// Prevent Karma from running prematurely.
__karma__.loaded = function () {};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);
// Finally, start Karma to run the tests.
__karma__.start();

File diff suppressed because one or more lines are too long

View File

@@ -1,15 +1,13 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
import { LoginComponent } from './views/login';
import { LoginGuard } from './guards';
import { GuestGuard, AdminGuard } from './guards';
import { NotFoundComponent } from './views/not-found';
import { ChangePasswordComponent } from './views/change-password';
import { ForbiddenComponent } from './views/forbidden';
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {LoginComponent} from './views/login';
import {AdminGuard, GuestGuard} from './guards';
import {NotFoundComponent} from './views/not-found';
import {ForbiddenComponent} from './views/forbidden';
import {ManagerComponent} from './views/manager';
import {GenericErrorComponent} from './views/error/genericError.component';
import { ManagerComponent } from './views/manager';
export const routes: Routes = [
{
path: '',
@@ -28,11 +26,6 @@ export const routes: Routes = [
component: LoginComponent,
canActivate: [GuestGuard]
},
// {
// path: 'change-password',
// component: ChangePasswordComponent,
// canActivate: [LoginGuard]
// },
{
path: '404',
component: NotFoundComponent
@@ -41,6 +34,10 @@ export const routes: Routes = [
path: '403',
component: ForbiddenComponent
},
{
path: 'error',
component: GenericErrorComponent
},
{
path: '**',
redirectTo: '/404'
@@ -48,7 +45,9 @@ export const routes: Routes = [
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
imports: [RouterModule.forRoot(routes, {
initialNavigation: 'disabled'
})],
exports: [RouterModule],
providers: []
})

View File

@@ -1,5 +1,11 @@
<app-header></app-header>
<div class="content">
@if (isOperationsConsoleRoute()) {
<router-outlet></router-outlet>
</div>
<app-footer></app-footer>
} @else {
<div class="app-shell flex flex-column justify-space-between h-100">
<app-header class="flex-none"></app-header>
<div class="content flex h-100">
<router-outlet></router-outlet>
</div>
<app-footer class="flex-none"></app-footer>
</div>
}

View File

@@ -2,20 +2,10 @@
display: block;
color: rgba(0,0,0,.54);
font-family: Roboto,"Helvetica Neue";
min-height: 100%;
}
.content {
margin: 50px 70px;
}
@media screen and (min-width: 600px) and (max-width: 1279px) {
.content {
margin: 20px 30px;
}
}
@media screen and (max-width: 599px) {
.content {
margin: 8px 12px;
}
padding: 20px;
max-height: calc(100vh - 169px);
}

View File

@@ -1,4 +1,4 @@
import { TestBed, async } from '@angular/core/testing';
import {TestBed, waitForAsync} from '@angular/core/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
@@ -18,7 +18,7 @@ import {
} from './services';
describe('AppComponent', () => {
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent,
@@ -42,7 +42,7 @@ describe('AppComponent', () => {
}).compileComponents();
}));
it('should create the app', async(() => {
it('should create the app', waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();

View File

@@ -1,15 +1,31 @@
import {Component} from '@angular/core';
import {Component} from '@angular/core';
import {Router} from '@angular/router';
// I remove temporary fontawesome5 and downgrade to fontawesome4
import fontawesome from '@fortawesome/fontawesome';
import solid from '@fortawesome/fontawesome-free-solid/';
fontawesome.library.add(solid);
import fontawesome from '@fortawesome/fontawesome';
import {
faCheckCircle,
faExclamationCircle,
faExclamationTriangle,
faPause,
faPlay,
faTimesCircle
} from '@fortawesome/fontawesome-free-solid';
fontawesome.library.add(faCheckCircle, faExclamationCircle, faExclamationTriangle, faPause, faPlay, faTimesCircle);
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
standalone: false
})
export class AppComponent {
}
export class AppComponent {
constructor(private router: Router) {
}
isOperationsConsoleRoute(): boolean {
const url = this.router.url || '/';
return url === '/' || url.startsWith('/manager');
}
}

View File

@@ -1,9 +1,9 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule, APP_INITIALIZER} from '@angular/core';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import {JWT_OPTIONS, JwtModule} from "@auth0/angular-jwt";
import {JWT_OPTIONS, JwtModule} from '@auth0/angular-jwt';
// material
import {MatIconRegistry} from '@angular/material/icon';
@@ -17,9 +17,14 @@ import {MatToolbarModule} from '@angular/material/toolbar';
import {MatIconModule} from '@angular/material/icon';
import {MatButtonModule} from '@angular/material/button';
import {MatCardModule} from '@angular/material/card';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FlexLayoutModule } from '@angular/flex-layout';
import {MatSelectModule} from '@angular/material/select';
import {MatListModule} from '@angular/material/list';
import {MatSidenavModule} from '@angular/material/sidenav';
import {MatDialogModule} from '@angular/material/dialog';
import {OwlDateTimeModule, OwlNativeDateTimeModule} from '@danielmoncada/angular-datetime-picker';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { ManagerComponent } from './views/manager';
@@ -32,10 +37,11 @@ import {
HeaderComponent,
FooterComponent,
GithubComponent,
SchedulerConfigComponent,
SchedulerControlComponent,
LogsPanelComponent,
ProgressPanelComponent
ProgressPanelComponent,
TriggerListComponent,
SimpleTriggerConfigComponent
} from './components';
import {
@@ -44,125 +50,100 @@ import {
UserService,
SchedulerService,
ConfigService,
ProgressWebsocketService,
LogsWebsocketService,
getHtmlBaseUrl
} from './services';
import { ChangePasswordComponent } from './views/change-password/change-password.component';
getHtmlBaseUrl,
LogsRxWebsocketService,
ProgressRxWebsocketService,
TriggerService,
CalendarService
} from './services';
import { ForbiddenComponent } from './views/forbidden/forbidden.component';
import { APP_BASE_HREF } from '@angular/common';
import { environment } from '../environments/environment';
import JobService from './services/job.service';
import {GenericErrorComponent} from './views/error/genericError.component';
export function initUserFactory(userService: UserService) {
return () => userService.jsessionInitUser();
return () => userService.fetchLoggedUser();
}
// const stompConfig: StompConfig = {
// // Which server?
// url: 'ws://localhost:8080/quartz-manager/progress',
// // Headers
// // Typical keys: login, passcode, host
// headers: {
// login: 'admin',
// passcode: 'admin'
// },
// // How often to heartbeat?
// // Interval in milliseconds, set to 0 to disable
// heartbeat_in: 0, // Typical value 0 - disabled
// heartbeat_out: 20000, // Typical value 20000 - every 20 seconds
// // Wait in milliseconds before attempting auto reconnect
// // Set to 0 to disable
// // Typical value 5000 (5 seconds)
// reconnect_delay: 5000,
// // Will log diagnostics on console
// debug: true
// };
export function jwtOptionsFactory(apiService: ApiService) {
return {
tokenGetter: () => {
return apiService.getToken();
},
whitelistedDomains: ['localhost:8080', 'localhost:4200']
allowedDomains: ['localhost:8080', 'localhost:4200']
}
}
@NgModule({
declarations: [
AppComponent,
HeaderComponent,
FooterComponent,
ManagerComponent,
GithubComponent,
LoginComponent,
NotFoundComponent,
AccountMenuComponent,
SchedulerConfigComponent,
SchedulerControlComponent,
LogsPanelComponent,
ProgressPanelComponent,
ChangePasswordComponent,
ForbiddenComponent
],
imports: [
BrowserAnimationsModule,
BrowserModule,
FormsModule,
ReactiveFormsModule,
HttpClientModule,
AppRoutingModule,
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [ApiService]
}
}),
MatMenuModule,
MatTooltipModule,
MatButtonModule,
MatChipsModule,
MatIconModule,
MatInputModule,
MatToolbarModule,
MatCardModule,
MatProgressSpinnerModule,
MatProgressBarModule,
FlexLayoutModule
],
providers: [
{
provide: APP_BASE_HREF,
useValue: getHtmlBaseUrl()
},
{
'provide': APP_INITIALIZER,
'useFactory': initUserFactory,
'deps': [UserService],
'multi': true
},
LoginGuard,
GuestGuard,
AdminGuard,
SchedulerService,
ProgressWebsocketService,
LogsWebsocketService,
AuthService,
ApiService,
UserService,
ConfigService,
MatIconRegistry
// StompService,
// ServerSocket
// {
// provide: StompConfig,
// useValue: stompConfig
// }
],
bootstrap: [AppComponent]
})
@NgModule({ declarations: [
AppComponent,
HeaderComponent,
FooterComponent,
ManagerComponent,
GithubComponent,
LoginComponent,
NotFoundComponent,
AccountMenuComponent,
SimpleTriggerConfigComponent,
SchedulerControlComponent,
LogsPanelComponent,
ProgressPanelComponent,
ForbiddenComponent,
GenericErrorComponent,
TriggerListComponent
],
bootstrap: [AppComponent], imports: [BrowserAnimationsModule,
BrowserModule,
FormsModule,
ReactiveFormsModule,
AppRoutingModule,
JwtModule.forRoot({
jwtOptionsProvider: {
provide: JWT_OPTIONS,
useFactory: jwtOptionsFactory,
deps: [ApiService]
}
}),
MatDialogModule,
MatMenuModule,
MatTooltipModule,
MatButtonModule,
MatChipsModule,
MatIconModule,
MatInputModule,
MatSelectModule,
MatToolbarModule,
MatCardModule,
MatListModule,
MatProgressSpinnerModule,
MatProgressBarModule,
OwlDateTimeModule,
OwlNativeDateTimeModule,
MatSidenavModule,
], providers: [
{
provide: APP_BASE_HREF,
useValue: getHtmlBaseUrl()
},
{
'provide': APP_INITIALIZER,
'useFactory': initUserFactory,
'deps': [UserService],
'multi': true
},
LoginGuard,
GuestGuard,
AdminGuard,
SchedulerService,
JobService,
TriggerService,
CalendarService,
ProgressRxWebsocketService,
LogsRxWebsocketService,
AuthService,
ApiService,
UserService,
ConfigService,
MatIconRegistry,
provideHttpClient(withInterceptorsFromDi())
] })
export class AppModule { }

View File

@@ -1,7 +1,8 @@
<p style="margin: 0px auto; padding: 0px; color: rgba(255, 255, 255, 0.541176); max-width: 356px;">
Hand crafted with love by
<a href="https://github.com/fabioformosa" style="color: rgba(255, 255, 255, 0.870588);">Fabio Formosa</a>
</p>
<a style="margin-top: 22px;" mat-icon-button href="https://github.com/fabioformosa/quartz-manager">
<img src="assets/image/github.png"/>
</a>
<mat-toolbar id="footer" class="flex flex-row justify-center align-items-center" style="color: rgba(255, 255, 255, 0.541176);">
<a href="https://github.com/fabioformosa/quartz-manager" class="flex flex-row align-items-center" style="gap: 6px">
<div class="flex"><img src="assets/image/github.png"/></div>
<div class="font-size-14 font-weight-500 display-block line-height-100">Quartz Manager</div>
</a>
<!-- Hand crafted with love by &nbsp;-->
<!-- <a href="https://github.com/fabioformosa" style="color: rgba(255, 255, 255, 0.870588);">Fabio Formosa</a>-->
</mat-toolbar>

View File

@@ -1,18 +1,20 @@
:host {
display: block;
font-weight: 300;
font-size: 15px;
display: block;
:host{
//position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 64px;
}
#footer{
background-color: rgb(33, 33, 33);
height: 236px;
padding: 72px 24px;
font-size: 15px;
box-sizing: border-box;
text-align: center;
a {
text-decoration: none;
cursor: auto;
cursor: pointer;
color: #FFFFFF;
margin-top: 32px;
}
h3 {
@@ -21,7 +23,5 @@
font-weight: 300;
font-size: 22px;
}
}

View File

@@ -1,9 +1,10 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-footer',
templateUrl: './footer.component.html',
styleUrls: ['./footer.component.scss']
selector: 'app-footer',
templateUrl: './footer.component.html',
styleUrls: ['./footer.component.scss'],
standalone: false
})
export class FooterComponent implements OnInit {

View File

@@ -1,9 +1,10 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-github',
templateUrl: './github.component.html',
styleUrls: ['./github.component.scss']
selector: 'app-github',
templateUrl: './github.component.html',
styleUrls: ['./github.component.scss'],
standalone: false
})
export class GithubComponent implements OnInit {

View File

@@ -1,2 +1 @@
<button mat-menu-item [routerLink]="['/change-password']">CHANGE PASSWORD</button>
<button mat-menu-item (click)="logout()">SIGN OUT</button>
<button mat-menu-item (click)="logout()">Logout</button>

View File

@@ -1,4 +1,4 @@
import { async, ComponentFixture, TestBed, inject } from '@angular/core/testing';
import { ComponentFixture, TestBed, inject, waitForAsync} from '@angular/core/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { RouterTestingModule } from '@angular/router/testing';
@@ -18,7 +18,7 @@ describe('AccountMenuComponent', () => {
let component: AccountMenuComponent;
let fixture: ComponentFixture<AccountMenuComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule

View File

@@ -7,9 +7,10 @@ import {
import { Router } from '@angular/router';
@Component({
selector: 'app-account-menu',
templateUrl: './account-menu.component.html',
styleUrls: ['./account-menu.component.scss']
selector: 'app-account-menu',
templateUrl: './account-menu.component.html',
styleUrls: ['./account-menu.component.scss'],
standalone: false
})
export class AccountMenuComponent implements OnInit {

View File

@@ -1,35 +1,39 @@
<mat-toolbar color="primary" class="app-navbar">
<button mat-button mat-ripple routerLink="/">
<img alt="Quartz Manager" class="app-angular-logo" src="assets/image/angular-white-transparent.svg">
<span>Quartz Manager</span>
</button>
<div class="right">
<div fxFlex="1 1 auto" fxLayout="row" fxLayoutAlign="flex-end center">
<button *ngIf="!hasSignedIn()" routerLink="/login" mat-button mat-ripple>
<span>Login</span>
</button>
<button
class="greeting-button"
*ngIf="hasSignedIn() && !noAuthenticationRequired()"
mat-button mat-ripple
[matMenuTriggerFor]="accountMenu">
<span>Hi, {{userName()}}</span>
</button>
<button
class="greeting-hamburger"
*ngIf="hasSignedIn()"
mat-icon-button mat-ripple
[matMenuTriggerFor]="accountMenu">
<mat-icon>menu</mat-icon>
</button>
<mat-menu #accountMenu
class="app-header-accountMenu"
yposition="below"
[overlapTrigger]="false">
<app-account-menu ></app-account-menu>
</mat-menu>
</div>
</div>
</mat-toolbar>
<mat-toolbar color="primary" class="app-navbar">
<button mat-button mat-ripple routerLink="/">
<!-- <img alt="Quartz Manager" class="app-angular-logo" src="assets/image/angular-white-transparent.svg">-->
<span>Quartz Manager</span>
</button>
<div class="right">
<div class="flex flex-row flex-1 justify-flex-end align-items-center">
@if (!hasSignedIn() && !noAuthenticationRequired()) {
<button routerLink="/login" mat-button mat-ripple>
<span>Login</span>
</button>
} @if (hasSignedIn() && !noAuthenticationRequired()) {
<button
class="greeting-button"
mat-button
mat-ripple
[matMenuTriggerFor]="accountMenu">
<span>Hi, {{ userName() }}</span>
</button>
} @if (hasSignedIn()) {
<button
class="greeting-hamburger"
mat-icon-button
mat-ripple
[matMenuTriggerFor]="accountMenu">
<mat-icon>menu</mat-icon>
</button>
}
<mat-menu
#accountMenu
class="app-header-accountMenu"
yposition="below"
[overlapTrigger]="false">
<app-account-menu></app-account-menu>
</mat-menu>
</div>
</div>
</mat-toolbar>

View File

@@ -2,14 +2,15 @@ import { Component, OnInit } from '@angular/core';
import {
UserService,
AuthService,
NO_AUTH
// NO_AUTH
} from '../../services';
import { Router } from '@angular/router';
@Component({
selector: 'app-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.scss']
@Component({
selector: 'app-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.scss'],
standalone: false
})
export class HeaderComponent implements OnInit {
@@ -32,8 +33,8 @@ export class HeaderComponent implements OnInit {
return !!this.userService.currentUser;
}
noAuthenticationRequired = () => this.hasSignedIn() && this.userService.currentUser === NO_AUTH;
noAuthenticationRequired = () => !this.hasSignedIn() && this.userService.isAnAnonymousUser === true;
userName() {
const user = this.userService.currentUser;

View File

@@ -2,6 +2,7 @@ export * from './header';
export * from './github';
export * from './footer';
export * from './logs-panel';
export * from './scheduler-config';
export * from './scheduler-control';
export * from './progress-panel';
export * from './trigger-list';
export * from './simple-trigger-config';

View File

@@ -1,29 +1,67 @@
<mat-card>
<mat-card-header>
<mat-card-title><b>JOB LOGS</b></mat-card-title>
</mat-card-header>
<mat-card-content>
<div id="logs">
<div *ngFor = "let log of logs" fxLayout="row" fxLayout.xs="column">
<div fxFlex="1 1 20%">
<span [ngClass]="{'animated zoomIn firstLog': $first}"> [{{log.time|date:'medium'}}]</span>
</div>
<div fxFlex="1 1 10%">
<span [ngClass]="{'animated zoomIn firstLog': $first}">
<i class = "fas" [ngClass]="{'fa-check-circle green': log.type == 'INFO',
'fa-exclamation-triangle yellow': log.type == 'WARN',
'fa-times-circle red': log.type == 'ERROR'}"></i>
</span>
</div>
<div fxFlex="1 1 20%">
<span [ngClass]="{'animated zoomIn firstLog': $first}">
{{log.threadName}}
</span>
</div>
<div fxFlex="1 1 50%">
<span [ngClass]="{'animated zoomIn firstLog': $first}"> {{log.msg}}</span>
</div>
</div>
</div>
</mat-card-content>
</mat-card>
<mat-card class="flex flex-1 max-h-100">
<mat-card-header class="pb-16">
<mat-card-subtitle><b>JOB LOGS</b></mat-card-subtitle>
</mat-card-header>
<mat-card-content class="flex flex-1 overflow-y-auto">
<div class="flex-1">
@if (!selectedTriggerName && (!logs || logs.length == 0)) {
<div class="h-100 w-100" style="text-align: center">
<img
src="assets/image/logs.svg"
alt="no logs"
width="320"
style="margin-top: 6em" />
</div>
} @if (isWaitingForLogs()) {
<div
class="waitingLogs flex flex-column align-items-center justify-center gap-12">
<mat-spinner diameter="36"></mat-spinner>
<div>Waiting for logs from {{ selectedTriggerName }}...</div>
</div>
}
<div id="logs" class="w-100" style="height: 100%">
@for (log of logs; track log; let first = $first) {
<div
class="log-row flex flex-row gap-10">
<div style="flex: 1; max-width: 300px">
<span
[ngClass]="{
'animate__animated animate__zoomIn zoomIn firstLog': first
}">
[{{ log.time | date : 'medium' }}]</span
>
</div>
<div style="flex: 1; max-width: 16px">
<span [ngClass]="{ 'animated zoomIn firstLog': first }">
<i
class="fas"
[ngClass]="{
'fa-check-circle green': log.type == 'INFO',
'fa-exclamation-triangle yellow': log.type == 'WARN',
'fa-times-circle red': log.type == 'ERROR'
}"></i>
</span>
</div>
<div style="flex: 1; max-width: 250px">
<span
[ngClass]="{
'animate__animated animate__zoomIn zoomIn firstLog': first
}">
{{ log.threadName }}
</span>
</div>
<div style="flex: 1">
<span
[ngClass]="{
'animate__animated animate__zoomIn zoomIn firstLog': first
}">
{{ log.msg }}</span
>
</div>
</div>
}
</div>
</div>
</mat-card-content>
</mat-card>

View File

@@ -1,3 +1,9 @@
:host {
flex: 1;
display: flex;
flex-direction: column;
}
.red{
color: red;
}
@@ -7,4 +13,37 @@
.yellow{
color: gold;
}
}
#logs{
font-size: 1em;
}
.waitingLogs {
color: #6b7280;
height: 100%;
min-height: 180px;
text-align: center;
}
/* ===== Scrollbar CSS ===== */
/* Firefox */
* {
scrollbar-width: auto;
scrollbar-color: #b8b8b8 #ffffff;
}
/* Chrome, Edge, and Safari */
*::-webkit-scrollbar {
width: 12px;
}
*::-webkit-scrollbar-track {
background: #ffffff;
}
*::-webkit-scrollbar-thumb {
background-color: #b8b8b8;
border-radius: 10px;
border: 3px solid #ffffff;
}

View File

@@ -0,0 +1,118 @@
import {Subject} from 'rxjs';
import {LogsPanelComponent} from './logs-panel.component';
import {TriggerKey} from '../../model/triggerKey.model';
import {jest} from '@jest/globals';
describe('LogsPanelComponent', () => {
const ngZone = {run: jest.fn((fn: () => void) => fn())};
beforeEach(() => ngZone.run.mockClear());
it('should subscribe to the selected trigger logs topic', () => {
const messages = new Subject<any>();
const logsRxWebsocketService = {
watch: jest.fn(() => messages.asObservable())
};
const component = new LogsPanelComponent(logsRxWebsocketService as any, null, ngZone as any);
component.triggerKey = new TriggerKey('trigger-1', null);
expect(logsRxWebsocketService.watch.mock.calls[0]).toEqual(['/topic/logs/trigger-1']);
expect(component.selectedTriggerName).toEqual('trigger-1');
expect(component.isWaitingForLogs()).toBeTruthy();
const logRecord = {
date: new Date(),
type: 'INFO',
message: 'job completed',
threadName: 'worker-1'
};
messages.next({body: JSON.stringify(logRecord)});
expect(ngZone.run).toHaveBeenCalled();
expect(component.logs[0]).toEqual({
time: logRecord.date.toISOString(),
type: 'INFO',
msg: 'job completed',
threadName: 'worker-1'
});
expect(component.isWaitingForLogs()).toBeFalsy();
});
it('should unsubscribe from the previous topic when the trigger changes', () => {
const firstMessages = new Subject<any>();
const secondMessages = new Subject<any>();
const logsRxWebsocketService = {
watch: jest.fn()
.mockReturnValueOnce(firstMessages.asObservable())
.mockReturnValueOnce(secondMessages.asObservable())
};
const component = new LogsPanelComponent(logsRxWebsocketService as any, null, ngZone as any);
component.triggerKey = new TriggerKey('trigger-1', null);
const firstSubscription = component.topicSubscription;
jest.spyOn(firstSubscription, 'unsubscribe');
component.triggerKey = new TriggerKey('trigger-2', null);
expect(firstSubscription.unsubscribe).toHaveBeenCalled();
expect(logsRxWebsocketService.watch.mock.calls[1]).toEqual(['/topic/logs/trigger-2']);
});
it('should clear logs when the trigger changes', () => {
const firstMessages = new Subject<any>();
const secondMessages = new Subject<any>();
const logsRxWebsocketService = {
watch: jest.fn()
.mockReturnValueOnce(firstMessages.asObservable())
.mockReturnValueOnce(secondMessages.asObservable())
.mockReturnValueOnce(firstMessages.asObservable())
};
const component = new LogsPanelComponent(logsRxWebsocketService as any, null, ngZone as any);
component.triggerKey = new TriggerKey('trigger-1', null);
firstMessages.next({body: JSON.stringify({date: new Date(), type: 'INFO', message: 'first log', threadName: 'worker-1'})});
expect(component.logs.length).toEqual(1);
component.triggerKey = new TriggerKey('trigger-2', null);
expect(component.logs).toEqual([]);
expect(component.selectedTriggerName).toEqual('trigger-2');
expect(component.isWaitingForLogs()).toBeTruthy();
secondMessages.next({body: JSON.stringify({date: new Date(), type: 'INFO', message: 'second log', threadName: 'worker-2'})});
expect(component.logs.length).toEqual(1);
component.triggerKey = new TriggerKey('trigger-1', null);
expect(component.logs).toEqual([]);
expect(component.selectedTriggerName).toEqual('trigger-1');
expect(component.isWaitingForLogs()).toBeTruthy();
});
it('should clear logs when no trigger is selected', () => {
const messages = new Subject<any>();
const logsRxWebsocketService = {
watch: jest.fn(() => messages.asObservable())
};
const component = new LogsPanelComponent(logsRxWebsocketService as any, null, ngZone as any);
component.triggerKey = new TriggerKey('trigger-1', null);
messages.next({body: JSON.stringify({date: new Date(), type: 'INFO', message: 'first log', threadName: 'worker-1'})});
component.triggerKey = null;
expect(component.logs).toEqual([]);
expect(component.selectedTriggerName).toBeNull();
expect(component.isWaitingForLogs()).toBeFalsy();
});
it('should ignore destroy when no topic was selected', () => {
const logsRxWebsocketService = {
watch: jest.fn()
};
const component = new LogsPanelComponent(logsRxWebsocketService as any, null, ngZone as any);
expect(() => component.ngOnDestroy()).not.toThrow();
});
});

View File

@@ -1,48 +1,97 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import {Component, Input, NgZone, OnDestroy, OnInit} from '@angular/core';
import { LogsWebsocketService, ApiService } from '../../services';
import { Observable } from 'rxjs';
import {ApiService} from '../../services';
import {LogsRxWebsocketService} from '../../services/logs.rx-websocket.service';
import {map} from 'rxjs/operators';
import {TriggerKey} from '../../model/triggerKey.model';
@Component({
selector: 'logs-panel',
templateUrl: './logs-panel.component.html',
styleUrls: ['./logs-panel.component.scss']
@Component({
selector: 'logs-panel',
templateUrl: './logs-panel.component.html',
styleUrls: ['./logs-panel.component.scss'],
standalone: false
})
export class LogsPanelComponent implements OnInit {
export class LogsPanelComponent implements OnInit, OnDestroy {
MAX_LOGS : number = 20;
MAX_LOGS = 30;
logs : Array<any> = new Array();
logs = new Array();
selectedTriggerName: string;
constructor(
private logsWebsocketService: LogsWebsocketService,
private apiService : ApiService
) { }
topicSubscription;
private selectedTriggerKey: TriggerKey;
constructor(
private logsRxWebsocketService: LogsRxWebsocketService,
private apiService: ApiService,
private ngZone: NgZone
) {
}
@Input()
set triggerKey(triggerKey: TriggerKey) {
if (!triggerKey || !triggerKey.name) {
this._unsubscribeFromTopic();
this.selectedTriggerKey = null;
this.selectedTriggerName = null;
this._resetLogs();
return;
}
if (this.selectedTriggerKey?.name === triggerKey.name) {
return;
}
this._resetLogs();
this.selectedTriggerKey = {...triggerKey} as TriggerKey;
this.selectedTriggerName = triggerKey.name;
this._subscribeToTheTopic(this.selectedTriggerKey);
}
isWaitingForLogs = (): boolean => !!this.selectedTriggerName && (!this.logs || this.logs.length === 0);
ngOnInit() {
let obs = this.logsWebsocketService.getObservable()
obs.subscribe({
'next' : this.onNewLogMsg,
'error' : (err) => {console.log(err)}
});
}
onNewLogMsg = (receivedMsg) => {
if(receivedMsg.type == 'SUCCESS')
this._showNewLog(receivedMsg.message);
else if(receivedMsg.type == 'ERROR')
this._refreshSession(); //if websocket has been closed for session expiration, try to refresh it
};
private _subscribeToTheTopic = (triggerKey: TriggerKey) => {
this._unsubscribeFromTopic();
this.topicSubscription = this.logsRxWebsocketService.watch(`/topic/logs/${triggerKey.name}`)
.pipe(map((msg: any) => JSON.parse(msg.body)))
.subscribe(logRecord => this.ngZone.run(() => this._showNewLog(logRecord)), (err) => {
console.log(err);
// TODO in case of 401
// this.apiService.get('/quartz-manager/session/refresh');
});
};
ngOnDestroy() {
this._unsubscribeFromTopic();
}
private _unsubscribeFromTopic() {
if (this.topicSubscription) {
this.topicSubscription.unsubscribe();
this.topicSubscription = null;
}
}
private _resetLogs() {
this.logs = [];
}
_showNewLog = (logRecord) => {
if(this.logs.length > this.MAX_LOGS)
if (this.logs.length > this.MAX_LOGS) {
this.logs.pop();
}
this.logs.unshift({
time : logRecord.date,
type : logRecord.type,
msg : logRecord.message,
threadName : logRecord.threadName
time: logRecord.date,
type: logRecord.type,
msg: logRecord.message,
threadName: logRecord.threadName
});
}

View File

@@ -1,36 +1,72 @@
<!-- <div class="progress" [hidden]="progress.percentage < 0">
<div class="progress-bar"
role="progressbar"
[ngStyle]="{width: percentageStr}">
{{percentageStr}}
</div>
</div> -->
<mat-card>
<mat-card-header>
<mat-card-title><b>JOB PROGRESS</b></mat-card-title>
</mat-card-header>
<mat-card-content>
<div>
<mat-progress-bar mode="determinate" value="{{progress.percentage}}"></mat-progress-bar>
{{percentageStr}}
</div>
<br>
<div>
<mat-chip>counter</mat-chip>&nbsp;
<span class="animated pulse">{{progress.timesTriggered}}</span> <span ng-show="progress.repeatCount > 0">/ {{progress.repeatCount}} </span>
<br/><br/>
<mat-chip>job key</mat-chip> <span class="animated pulse">{{progress.jobKey}}</span><br>
<mat-chip>job class</mat-chip> <span class="animated pulse">{{progress.jobClass}}</span><br/>
<br/>
<mat-chip>prev fire time</mat-chip> <span class="animated pulse">{{progress.previousFireTime|date:'dd-MM-yyyy HH:mm:ss'}}</span><br/>
<mat-chip>next fire time</mat-chip> <span class="animated pulse">{{progress.nextFireTime|date:'dd-MM-yyyy HH:mm:ss'}}</span><br/>
<mat-chip>final fire time</mat-chip> <span class="animated pulse">{{progress.finalFireTime|date:'dd-MM-yyyy HH:mm:ss'}}</span><br/>
</div>
</mat-card-content>
</mat-card>
<!-- <div class="progress" [hidden]="progress.percentage < 0">
<div class="progress-bar"
role="progressbar"
[ngStyle]="{width: percentageStr}">
{{percentageStr}}
</div>
</div> -->
<mat-card
style="padding-bottom: 0"
[ngClass]="{ 'progress-updated': progressUpdated }">
<mat-card-header style="padding-bottom: 16px">
<mat-card-subtitle><b>JOB PROGRESS</b></mat-card-subtitle>
</mat-card-header>
<mat-card-content>
@if (progress.percentage !== -1) {
<div id="progressBarBox">
<mat-progress-bar
mode="determinate"
value="{{ progress.percentage }}"></mat-progress-bar>
{{ percentageStr }}
</div>
} @if (progress.timesTriggered) {
<div id="counterBox" class="flex flex-row justify-center">
<span id="timesTriggeredCounter" class="animated pulse">{{
progress.timesTriggered
}}</span>
@if (progress.repeatCount > 0) {
<span id="totCounter">&nbsp;/&nbsp;{{ progress.repeatCount }} </span>
}
</div>
} @if (progress.timesTriggered) {
<mat-divider></mat-divider>
}
<div class="flex flex-row align-items-center justify-space-around">
<div class="fireBox">
<div class="fireBoxHeader">prev fire time</div>
<div class="fireBoxContent">
<span class="animated pulse">{{
progress.previousFireTime | date : 'dd-MM-yyyy HH:mm:ss'
}}</span>
</div>
<div class="fireBoxContent" [hidden]="progress.previousFireTime">
<span>-</span>
</div>
</div>
<div class="fireBox">
<div class="fireBoxHeader">next fire time</div>
<div class="fireBoxContent">
<span class="animated pulse">{{
progress.nextFireTime | date : 'dd-MM-yyyy HH:mm:ss'
}}</span>
</div>
<div class="fireBoxContent" [hidden]="progress.nextFireTime">
<span>-</span>
</div>
</div>
<div class="fireBox">
<div class="fireBoxHeader">final fire time</div>
<div class="fireBoxContent">
<span class="animated pulse">{{
progress.finalFireTime | date : 'dd-MM-yyyy HH:mm:ss'
}}</span>
</div>
<div class="fireBoxContent" [hidden]="progress.finalFireTime">
<span>-</span>
</div>
</div>
</div>
</mat-card-content>
</mat-card>

View File

@@ -0,0 +1,51 @@
#timesTriggeredCounter{
font-size: 2em;
}
#totCounter{
margin-top: auto;
text-align: center;
margin-bottom: 5px;
font-size: 0.8em;
}
#counterBox{
margin-bottom: 1em;
}
.fireBox{
width: 100%;
border-right: 1px solid rgba(0,0,0,.12);
margin: 8px;
}
.fireBox:last-child {
border-right: 0;
}
.fireBoxHeader{
font-size: 0.8em;
text-align: center;
color: grey;
margin-bottom: 0.5em;
}
.fireBoxContent{
text-align: center;
}
.progress-updated {
animation: progressUpdatePulse 700ms ease-out;
}
@keyframes progressUpdatePulse {
0% {
box-shadow: 0 0 0 0 rgba(63, 81, 181, 0.35);
}
45% {
box-shadow: 0 0 0 6px rgba(63, 81, 181, 0.16);
}
100% {
box-shadow: 0 0 0 0 rgba(63, 81, 181, 0);
}
}

View File

@@ -0,0 +1,107 @@
import {Subject} from 'rxjs';
import {ProgressPanelComponent} from './progress-panel.component';
import {TriggerKey} from '../../model/triggerKey.model';
import {jest} from '@jest/globals';
describe('ProgressPanelComponent', () => {
const ngZone = {run: jest.fn((fn: () => void) => fn())};
beforeEach(() => ngZone.run.mockClear());
it('should subscribe to the selected trigger progress topic', () => {
jest.useFakeTimers();
const messages = new Subject<any>();
const progressRxWebsocketService = {
watch: jest.fn(() => messages.asObservable())
};
const component = new ProgressPanelComponent(progressRxWebsocketService as any, ngZone as any);
component.triggerKey = new TriggerKey('trigger-1', null);
expect(progressRxWebsocketService.watch.mock.calls[0]).toEqual(['/topic/progress/trigger-1']);
messages.next({body: JSON.stringify({percentage: 75, timesTriggered: 3})});
jest.runOnlyPendingTimers();
expect(ngZone.run).toHaveBeenCalled();
expect(component.progress.percentage).toEqual(75);
expect(component.percentageStr).toEqual('75%');
expect(component.progressUpdated).toBeTruthy();
jest.useRealTimers();
});
it('should unsubscribe from the previous topic when the trigger changes', () => {
const firstMessages = new Subject<any>();
const secondMessages = new Subject<any>();
const progressRxWebsocketService = {
watch: jest.fn()
.mockReturnValueOnce(firstMessages.asObservable())
.mockReturnValueOnce(secondMessages.asObservable())
};
const component = new ProgressPanelComponent(progressRxWebsocketService as any, ngZone as any);
component.triggerKey = new TriggerKey('trigger-1', null);
const firstSubscription = component.topicSubscription;
jest.spyOn(firstSubscription, 'unsubscribe');
component.triggerKey = new TriggerKey('trigger-2', null);
expect(firstSubscription.unsubscribe).toHaveBeenCalled();
expect(progressRxWebsocketService.watch.mock.calls[1]).toEqual(['/topic/progress/trigger-2']);
});
it('should reset progress when the trigger changes', () => {
const firstMessages = new Subject<any>();
const secondMessages = new Subject<any>();
const progressRxWebsocketService = {
watch: jest.fn()
.mockReturnValueOnce(firstMessages.asObservable())
.mockReturnValueOnce(secondMessages.asObservable())
.mockReturnValueOnce(firstMessages.asObservable())
};
const component = new ProgressPanelComponent(progressRxWebsocketService as any, ngZone as any);
component.triggerKey = new TriggerKey('trigger-1', null);
firstMessages.next({body: JSON.stringify({percentage: 75, timesTriggered: 3})});
expect(component.progress.percentage).toEqual(75);
component.triggerKey = new TriggerKey('trigger-2', null);
expect(component.progress.percentage).toEqual(-1);
expect(component.percentageStr).toBeNull();
expect(component.progressUpdated).toBeFalsy();
secondMessages.next({body: JSON.stringify({percentage: 20, timesTriggered: 1})});
expect(component.progress.percentage).toEqual(20);
component.triggerKey = new TriggerKey('trigger-1', null);
expect(component.progress.percentage).toEqual(-1);
});
it('should reset progress when no trigger is selected', () => {
const messages = new Subject<any>();
const progressRxWebsocketService = {
watch: jest.fn(() => messages.asObservable())
};
const component = new ProgressPanelComponent(progressRxWebsocketService as any, ngZone as any);
component.triggerKey = new TriggerKey('trigger-1', null);
messages.next({body: JSON.stringify({percentage: 75, timesTriggered: 3})});
component.triggerKey = null;
expect(component.progress.percentage).toEqual(-1);
expect(component.percentageStr).toBeNull();
expect(component.progressUpdated).toBeFalsy();
});
it('should ignore destroy when no topic was selected', () => {
const progressRxWebsocketService = {
watch: jest.fn()
};
const component = new ProgressPanelComponent(progressRxWebsocketService as any, ngZone as any);
expect(() => component.ngOnDestroy()).not.toThrow();
});
});

View File

@@ -1,85 +1,93 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'
import { ProgressWebsocketService } from '../../services';
import {Component, Input, NgZone, OnDestroy, OnInit} from '@angular/core'
import TriggerFiredBundle from '../../model/trigger-fired-bundle.model';
import {TriggerKey} from '../../model/triggerKey.model';
import {ProgressRxWebsocketService} from '../../services/progress.rx-websocket.service';
import {map} from 'rxjs/operators';
import { Observable } from 'rxjs';
// import {Message} from '@stomp/stompjs';
// import { Subscription } from 'rxjs/Subscription';
// import {StompService} from '@stomp/ng2-stompjs';
// import { QueueingSubject } from 'queueing-subject'
// import websocketConnect from 'rxjs-websockets'
// import 'rxjs/add/operator/share'
// import {ServerSocket} from '../../services/qz.socket.service'
@Component({
selector: 'progress-panel',
templateUrl: './progress-panel.component.html',
styleUrls: ['./progress-panel.component.scss']
@Component({
selector: 'progress-panel',
templateUrl: './progress-panel.component.html',
styleUrls: ['./progress-panel.component.scss'],
standalone: false
})
export class ProgressPanelComponent implements OnInit {
export class ProgressPanelComponent implements OnInit, OnDestroy {
progress: TriggerFiredBundle = ProgressPanelComponent._buildEmptyProgress();
percentageStr: string;
progressUpdated = false;
progress : any = {}
percentageStr : string
topicSubscription;
private selectedTriggerKey: TriggerKey;
// // Stream of messages
// private subscription: Subscription;
// public messages: Observable<Message>;
// // Subscription status
// public subscribed: boolean;
// // Array of historic message (bodies)
// public mq: Array<string> = [];
constructor(
private progressRxWebsocketService: ProgressRxWebsocketService,
private ngZone: NgZone
) { }
@Input()
set triggerKey(triggerKey: TriggerKey) {
if (!triggerKey || !triggerKey.name) {
this._unsubscribeFromTopic();
this.selectedTriggerKey = null;
this._resetProgress();
return;
}
if (this.selectedTriggerKey?.name === triggerKey.name) {
return;
}
this._resetProgress();
this.selectedTriggerKey = {...triggerKey} as TriggerKey;
this._subscribeToTheTopic(this.selectedTriggerKey);
}
private _subscribeToTheTopic = (triggerKey: TriggerKey) => {
this._unsubscribeFromTopic();
this.topicSubscription = this.progressRxWebsocketService.watch(`/topic/progress/${triggerKey.name}`)
.pipe(map((msg: any) => JSON.parse(msg.body)))
.subscribe(progress => this.ngZone.run(() => this.onNewProgressMsg(progress)), (err) => {
console.log(err);
// TODO in case of 401
// this.apiService.get('/quartz-manager/session/refresh');
});
};
// private socketSubscription
constructor(
private progressWebsocketService: ProgressWebsocketService,
// private _stompService: StompService,
// private serverSocket : ServerSocket
) { }
onNewProgressMsg = (receivedMsg) => {
if (receivedMsg.type == 'SUCCESS') {
var newStatus = receivedMsg.message;
this.progress = newStatus;
this.percentageStr = this.progress.percentage + '%';
}
}
onNewProgressMsg = (receivedMsg) => {
this.progress = receivedMsg;
this.percentageStr = this.progress.percentage + '%';
this._markProgressUpdated();
}
ngOnInit() {
let obs = this.progressWebsocketService.getObservable()
obs.subscribe({
'next' : this.onNewProgressMsg,
'error' : (err) => {console.log(err)}
});
// this.subscribed = false;
// this.subscribe();
// this.serverSocket.connect()
// this.socketSubscription = this.serverSocket.messages.subscribe((message: string) => {
// console.log('received message from server: ', message)
// })
}
// public subscribe() {
// if (this.subscribed) {
// return;
// }
// // Stream of messages
// this.messages = this._stompService.subscribe('/topic/progress');
// // Subscribe a function to be run on_next message
// this.subscription = this.messages.subscribe(this.on_next);
// this.subscribed = true;
// }
// public on_next = (message: Message) => {
// this.mq.push(message.body + '\n');
// console.log(message);
// }
}
}
ngOnDestroy() {
this._unsubscribeFromTopic();
}
private _unsubscribeFromTopic() {
if (this.topicSubscription) {
this.topicSubscription.unsubscribe();
this.topicSubscription = null;
}
}
private _resetProgress() {
this.progress = ProgressPanelComponent._buildEmptyProgress();
this.percentageStr = null;
this.progressUpdated = false;
}
private _markProgressUpdated() {
this.progressUpdated = false;
setTimeout(() => this.progressUpdated = true);
}
private static _buildEmptyProgress() {
const progress = new TriggerFiredBundle();
progress.percentage = -1;
return progress;
}
}

View File

@@ -1 +0,0 @@
export * from './scheduler-config.component';

View File

@@ -1,38 +0,0 @@
<mat-card>
<mat-card-header>
<mat-card-title><b>SCHEDULER CONFIG</b></mat-card-title>
</mat-card-header>
<mat-card-content>
<div fxLayout="column">
<form name="configForm" fxFlex="1 1 100%" #configForm="ngForm">
<mat-form-field>
<input matInput placeholder="Freq [Num per day]" [(ngModel)]="config.triggerPerDay" name="triggerPerDay" type="number">
</mat-form-field>
<mat-form-field>
<input matInput placeholder="Max Occurrences" [(ngModel)]="config.maxCount" name="maxCount" type="number">
</mat-form-field>
<br>
<div>
<h5>Misfire Policy</h5>
<div>RESCHEDULE NEXT WITH EXISTING COUNT</div>
<div class="small">
In case of misfire event, the trigger is re-scheduled to the next scheduled time after 'now' with the repeat count left unchanged (missed events are definitively lost).
<br/>
<strong>Warning:</strong> This policy could cause the trigger to go directly to the complete state if the end-time of the trigger has arrived,
so this misfire instruction doesn't guarantee that the repeat counter reaches your max value, but it guarantees that the end-time doesn't go over the expected final fire time.
</div>
</div>
<br>
<button mat-raised-button
type="button"
(click)="submitConfig()">
Submit
</button>
</form>
</div>
</mat-card-content>
</mat-card>

View File

@@ -1,40 +0,0 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { SchedulerService } from '../../services';
import { SchedulerConfig } from '../../model/schedulerConfig.model'
@Component({
selector: 'scheduler-config',
templateUrl: './scheduler-config.component.html',
styleUrls: ['./scheduler-config.component.scss']
})
export class SchedulerConfigComponent implements OnInit {
constructor(
private schedulerService: SchedulerService
) { }
config : SchedulerConfig = new SchedulerConfig()
configBackup : SchedulerConfig = new SchedulerConfig()
ngOnInit() {
this.retrieveConfig()
}
retrieveConfig = () => {
this.schedulerService.getConfig()
.subscribe(res => {
this.config = new SchedulerConfig(res.triggerPerDay, res.maxCount)
this.configBackup = res
})
}
submitConfig = () => {
this.schedulerService.updateConfig(this.config)
.subscribe(res => {
this.configBackup = this.config;
}, error => {
this.config = this.configBackup;
});
};
}

View File

@@ -1,15 +1,40 @@
<mat-card>
<mat-card-header>
<mat-card-title><b>SCHEDULER CONTROLLER</b></mat-card-title>
</mat-card-header>
<mat-card-content>
<button id="schedulerControllerBtn1" mat-raised-button class="btn btn-default large-btn" (click)="startOrPause()">
<span *ngIf = "schedulerState === 'running'">
<i class="fas fa-pause red"></i>
</span>
<span *ngIf = "schedulerState === 'stopped' || schedulerState === 'paused'">
<i class="fas fa-play green"></i>
</span>
</button>
</mat-card-content>
</mat-card>
<mat-card>
<mat-card-content>
<div class="flex flex-row align-items-stretch gap-30">
<button
id="schedulerControllerBtn"
mat-raised-button
class="btn btn-default large-btn"
(click)="startOrPause()">
@if (scheduler?.status === 'RUNNING') {
<span>
<i class="fas fa-pause red"></i>
</span>
} @if (scheduler?.status === 'STOPPED' || scheduler?.status ===
'PAUSED') {
<span>
<i class="fas fa-play green"></i>
</span>
}
</button>
<div class="flex flex-column align-items-center">
<mat-card-subtitle style="margin: auto"
><b>SCHEDULER</b></mat-card-subtitle
>
</div>
<mat-divider [vertical]="true"></mat-divider>
<div class="flex flex-column justify-space-between">
<div><label>Name</label></div>
<div>
<span id="scheduler-name">{{ scheduler?.name }}</span>
</div>
</div>
<div class="flex flex-column justify-space-between">
<div><label>Instance ID</label></div>
<div>
<span id="scheduler-instance">{{ scheduler?.instanceId }}</span>
</div>
</div>
</div>
</mat-card-content>
</mat-card>

View File

@@ -3,4 +3,20 @@
}
.green{
color: green;
}
}
label{
color: grey;
font-variant: small-caps;
font-size: smaller;
}
#scheduler-name{
text-transform: capitalize;
font-size: 14px;
}
#scheduler-instance {
text-transform: capitalize;
font-size: 14px;
}

View File

@@ -0,0 +1,111 @@
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
import {SchedulerControlComponent} from './scheduler-control.component';
import {ApiService, ConfigService, SchedulerService, UserService} from '../../services';
import {HttpClient} from '@angular/common/http';
import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing';
import {RouterTestingModule} from '@angular/router/testing';
import {DebugElement} from '@angular/core';
import {By} from '@angular/platform-browser';
import {Scheduler} from '../../model/scheduler.model';
import {MatCardModule} from '@angular/material/card';
import {MatIconModule} from '@angular/material/icon';
import {MatDividerModule} from '@angular/material/divider';
describe('SchedulerControlComponent', () => {
const schedulerUrl = '/quartz-manager/scheduler';
const schedulerButtonSelector = '#schedulerControllerBtn';
const schedulerName = 'test-scheduler';
const schedulerId = 'test-id';
const stoppedStatus = 'STOPPED';
let component: SchedulerControlComponent;
let fixture: ComponentFixture<SchedulerControlComponent>;
let httpClient: HttpClient;
let httpTestingController: HttpTestingController;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [MatCardModule, MatDividerModule, MatIconModule, HttpClientTestingModule, RouterTestingModule],
declarations: [SchedulerControlComponent],
providers: [UserService, SchedulerService, ApiService, ConfigService]
}).compileComponents();
httpClient = TestBed.inject(HttpClient);
httpTestingController = TestBed.inject(HttpTestingController);
}));
beforeEach(() => {
fixture = TestBed.createComponent(SchedulerControlComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should display the play button at the beginning since the scheduler is stopped', () => {
expect(component).toBeDefined();
const getSchedulerReq = httpTestingController.expectOne(schedulerUrl);
const mockScheduler = new Scheduler(schedulerName, schedulerId, stoppedStatus, []);
getSchedulerReq.flush(mockScheduler);
expect(component.scheduler).toEqual(mockScheduler);
expect(component.scheduler.status).toEqual(stoppedStatus);
fixture.detectChanges();
const schedulerControlComponentDe: DebugElement = fixture.debugElement;
const schedulerBtnDe = schedulerControlComponentDe.query(By.css(schedulerButtonSelector));
expect(schedulerBtnDe).toBeTruthy();
const playIconDe = schedulerBtnDe.query(By.css('.fa-play'));
expect(playIconDe).toBeTruthy();
});
it('should switch the button to pause when the scheduler is started', () => {
expect(component).toBeDefined();
const getSchedulerReq = httpTestingController.expectOne(schedulerUrl);
const mockScheduler = new Scheduler(schedulerName, schedulerId, stoppedStatus, []);
getSchedulerReq.flush(mockScheduler);
fixture.detectChanges();
const schedulerControlComponentDe: DebugElement = fixture.debugElement;
let schedulerBtnDe = schedulerControlComponentDe.query(By.css(schedulerButtonSelector));
expect(schedulerBtnDe).toBeTruthy();
const playIconDe = schedulerBtnDe.query(By.css('.fa-play'));
expect(playIconDe).toBeTruthy();
schedulerBtnDe.nativeElement.click();
const startSchedulerReq = httpTestingController.expectOne('/quartz-manager/scheduler/start');
startSchedulerReq.flush(null);
fixture.detectChanges();
schedulerBtnDe = schedulerControlComponentDe.query(By.css(schedulerButtonSelector));
const pauseIconDe = schedulerBtnDe.query(By.css('.fa-pause'));
expect(pauseIconDe).toBeTruthy();
})
it('should switch the button to play when the scheduler is stopped', () => {
expect(component).toBeDefined();
const getSchedulerReq = httpTestingController.expectOne(schedulerUrl);
const mockScheduler = new Scheduler(schedulerName, schedulerId, 'RUNNING', []);
getSchedulerReq.flush(mockScheduler);
fixture.detectChanges();
const schedulerControlComponentDe: DebugElement = fixture.debugElement;
let schedulerBtnDe = schedulerControlComponentDe.query(By.css(schedulerButtonSelector));
expect(schedulerBtnDe).toBeTruthy();
const pauseIconDe = schedulerBtnDe.query(By.css('.fa-pause'));
expect(pauseIconDe).toBeTruthy();
schedulerBtnDe.nativeElement.click();
const startSchedulerReq = httpTestingController.expectOne('/quartz-manager/scheduler/standby');
startSchedulerReq.flush(null);
fixture.detectChanges();
schedulerBtnDe = schedulerControlComponentDe.query(By.css(schedulerButtonSelector));
const playIconDe = schedulerBtnDe.query(By.css('.fa-play'));
expect(playIconDe).toBeTruthy();
})
});

View File

@@ -1,54 +1,81 @@
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { UserService, SchedulerService } from '../../services';
import {Component, OnInit} from '@angular/core';
import {SchedulerService, UserService} from '../../services';
import {Scheduler} from '../../model/scheduler.model';
@Component({
selector: 'scheduler-control',
templateUrl: './scheduler-control.component.html',
styleUrls: ['./scheduler-control.component.scss']
@Component({
selector: 'qrzmng-scheduler-control',
templateUrl: './scheduler-control.component.html',
styleUrls: ['./scheduler-control.component.scss'],
standalone: false
})
export class SchedulerControlComponent implements OnInit {
schedulerState;
scheduler: Scheduler;
constructor(
private userService: UserService,
private schedulerService: SchedulerService
) { }
) {
}
ngOnInit() {
this.schedulerService.getStatus().subscribe(res => {this.schedulerState = res.data}, err => {console.log(err)});
this._getScheduler();
}
startScheduler = function(){
this.schedulerService.startScheduler().subscribe((res) => {this.schedulerState = 'running'}, (res) => {console.log(JSON.stringify(res))});
private _getScheduler() {
this.schedulerService.getScheduler()
.subscribe(resp => this.scheduler = resp);
}
startScheduler = function () {
this.schedulerService.startScheduler().subscribe((res) => {
this.scheduler.status = 'RUNNING'
}, (res) => {
console.log(JSON.stringify(res))
});
};
stopScheduler = function(){
this.schedulerService.stopScheduler().subscribe((res) => {this.schedulerState = 'stopped'}, (res) => {console.log(JSON.stringify(res))});
stopScheduler = function () {
this.schedulerService.shutdownScheduler().subscribe((res) => {
this.scheduler.status = 'STOPPED'
}, (res) => {
console.log(JSON.stringify(res))
});
};
pauseScheduler = function(){
this.schedulerService.pauseScheduler().subscribe((res) => {this.schedulerState = 'paused'}, (res) => {console.log(JSON.stringify(res))});
pauseScheduler = function () {
this.schedulerService.standbyScheduler().subscribe((res) => {
this.scheduler.status = 'PAUSED'
}, (res) => {
console.log(JSON.stringify(res))
});
};
resumeScheduler = function(){
this.schedulerService.resumeScheduler().subscribe((res) => {this.schedulerState = 'running'}, (res) => {console.log(JSON.stringify(res))});
resumeScheduler = function () {
this.schedulerService.resumeScheduler().subscribe((res) => {
this.scheduler.status = 'RUNNING'
}, (res) => {
console.log(JSON.stringify(res))
});
};
stop = function(){
if(this.schedulerState != 'stopped')
stop = function () {
if (this.scheduler.status !== 'STOPPED') {
this.stopScheduler();
}
}
startOrPause = function(){
switch (this.schedulerState) {
case 'running': this.pauseScheduler();
break;
case 'paused': this.resumeScheduler();
break;
default:
this.startScheduler();
break;
startOrPause = function () {
switch (this.scheduler.status) {
case 'RUNNING':
this.pauseScheduler();
break;
case 'PAUSED':
this.resumeScheduler();
break;
default:
this.startScheduler();
break;
}
};

View File

@@ -0,0 +1,2 @@
export * from './simple-trigger-config.component';
export {SimpleTriggerCommand} from '../../model/simple-trigger.command';

View File

@@ -0,0 +1,257 @@
<mat-card class="trigger-config-card">
<mat-card-header style="padding-bottom: 16px">
<mat-card-subtitle><b>TRIGGER DETAILS</b></mat-card-subtitle>
</mat-card-header>
<mat-divider></mat-divider>
@if (shouldShowTheTriggerCardContent()) {
<mat-card-content class="trigger-config-content">
<div
class="flex flex-column"
style="
overflow-y: auto;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
overflow: auto;
padding: 1em;
">
@if (jobs?.length === 0) {
<mat-card id="noEligibleJobsAlert" style="background-color: #ff6385">
<mat-card-content>
<i class="fas fa-exclamation-circle" style="color: #fff"></i
>&nbsp;<strong>WARNING</strong> Not found any eligible job classes for
quartz-manager! <br />
<p style="font-size: 0.8em">
Please, make sure you have extended
<i>AbstractQuartzManagerJob</i> and set the app prop
<i>quartz-manager.jobClassPackages</i> with the correct java package
</p>
</mat-card-content>
</mat-card>
}
<form
name="triggerConfigForm"
class="trigger-config-form"
class="flex-1"
[formGroup]="simpleTriggerReactiveForm"
(ngSubmit)="onSubmitTriggerConfig()">
<div>
<mat-form-field class="full-size-input">
<mat-label>Trigger Name</mat-label>
<input
id="triggerName"
matInput
placeholder="name of the trigger (unique)"
formControlName="triggerName"
name="triggerName" />
@if
(simpleTriggerReactiveForm.controls.triggerName.errors?.required) {
<mat-error> Name is <strong>required</strong> </mat-error>
}
</mat-form-field>
</div>
<div>
<mat-form-field class="full-size-input">
<mat-label>Job Class</mat-label>
<mat-select
id="jobClass"
name="jobClass"
formControlName="jobClass">
@for (job of jobs; track job) {
<mat-option [value]="job" class="font-13">
{{ job }}
</mat-option>
}
</mat-select>
@if (simpleTriggerReactiveForm.controls.jobClass.errors?.required) {
<mat-error> Job is <strong>required</strong> </mat-error>
}
</mat-form-field>
</div>
<div>
<mat-form-field class="full-size-input">
<mat-label>Misfire Instruction</mat-label>
<mat-select
id="misfireInstruction"
name="misfireInstruction"
formControlName="misfireInstruction">
<mat-option class="font-13" value="MISFIRE_INSTRUCTION_FIRE_NOW"
>FIRE NOW</mat-option
>
<mat-option
class="font-13"
value="MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT"
>RESCHEDULE NOW WITH EXISTING REPEAT COUNT
</mat-option>
<mat-option
class="font-13"
value="MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT"
>RESCHEDULE NOW WITH REMAINING REPEAT COUNT
</mat-option>
<mat-option
class="font-13"
value="MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT"
>RESCHEDULE NEXT WITH REMAINING COUNT
</mat-option>
<mat-option
class="font-13"
value="MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT"
>RESCHEDULE NEXT WITH EXISTING COUNT
</mat-option>
</mat-select>
@if
(simpleTriggerReactiveForm.controls.misfireInstruction.errors?.required)
{
<mat-error>
The misfire instruction is <strong>required</strong>
</mat-error>
}
</mat-form-field>
<div class="small" [innerHTML]="getMisfireInstructionCaption()"></div>
</div>
<br />
<div formGroupName="triggerPeriod">
<div>
<mat-form-field class="full-size-input">
<mat-label>Start Date (optional)</mat-label>
<input
id="startDate"
matInput
[owlDateTime]="startDatePicker"
[owlDateTimeTrigger]="startDatePicker"
placeholder="Choose a start date"
formControlName="startDate"
name="startDate" />
<button
type="button"
class="datetime-picker-trigger"
mat-icon-button
matSuffix
[owlDateTimeTrigger]="startDatePicker">
<mat-icon>event</mat-icon>
</button>
<owl-date-time
#startDatePicker
[showSecondsTimer]="true">
</owl-date-time>
</mat-form-field>
</div>
<div>
<mat-form-field class="full-size-input">
<mat-label>End Date (optional)</mat-label>
<input
id="endDate"
matInput
[owlDateTime]="endDatePicker"
[owlDateTimeTrigger]="endDatePicker"
placeholder="Choose a end date"
formControlName="endDate"
name="endDate" />
<button
type="button"
class="datetime-picker-trigger"
mat-icon-button
matSuffix
[owlDateTimeTrigger]="endDatePicker">
<mat-icon>event</mat-icon>
</button>
<owl-date-time
#endDatePicker
[showSecondsTimer]="true">
</owl-date-time>
</mat-form-field>
@if
(simpleTriggerReactiveForm.controls.triggerPeriod.errors?.invalidTriggerPeriod)
{
<mat-error style="font-size: small">
the end date cannot be <strong>before</strong> the start date
</mat-error>
}
</div>
</div>
<div formGroupName="triggerRecurrence">
<div>
<mat-form-field class="full-size-input">
<mat-label>Repeat Interval [in mills]</mat-label>
<input
id="repeatInterval"
matInput
placeholder="Repeat Interval [in mills]"
type="number"
formControlName="repeatInterval"
name="repeatInterval" />
@if
(simpleTriggerReactiveForm.controls.triggerRecurrence.errors?.invalidTriggerRecurrence)
{
<mat-error>
repeatCount and repeatInterval must be <strong>both</strong> set
or unset
</mat-error>
}
</mat-form-field>
</div>
<div>
<mat-form-field class="full-size-input">
<mat-label>Repeat Count</mat-label>
<input
id="repeatCount"
matInput
placeholder="Repeat Count (-1 REPEAT INDEFINITELY)"
type="number"
formControlName="repeatCount"
name="repeatCount" />
@if
(simpleTriggerReactiveForm.controls.triggerRecurrence.errors?.invalidTriggerRecurrence)
{
<mat-error>
repeatCount and repeatInterval must be <strong>both</strong> set
or unset
</mat-error>
}
</mat-form-field>
</div>
</div>
<br />
<div
class="flex flex-row align-items-center justify-space-evenly"
style="padding-bottom: 1em">
@if (simpleTriggerReactiveForm.enabled) {
<div class="flex-1" style="text-align: center">
<button
mat-raised-button
type="button"
(click)="onResetReactiveForm()">
Cancel
</button>
</div>
} @if (simpleTriggerReactiveForm.enabled) {
<div class="flex-1" style="text-align: center">
<button
mat-raised-button
type="submit"
color="primary"
[disabled]="simpleTriggerReactiveForm.invalid">
Submit
</button>
</div>
} @if (!simpleTriggerReactiveForm.enabled) {
<div class="flex-1" style="text-align: center">
<button
mat-raised-button
type="button"
(click)="
openTriggerForm();
simpleTriggerReactiveForm.controls['triggerName'].disable()
">
Reschedule
</button>
</div>
}
</div>
</form>
</div>
</mat-card-content>
}
</mat-card>

View File

@@ -0,0 +1,65 @@
:host {
display: flex;
height: 100%;
min-height: 0;
width: 100%;
}
.trigger-config-card {
display: flex;
flex: 1;
flex-direction: column;
min-height: 0;
}
.trigger-config-content {
flex: 1;
min-height: 0;
position: relative;
}
.small{
font-size: 0.8em;
}
.full-size-input{
width: 100%;
}
:host ::ng-deep .trigger-config-form .mat-mdc-form-field {
font-size: 13px;
}
:host ::ng-deep .trigger-config-form .mat-mdc-select-value,
:host ::ng-deep .trigger-config-form .mat-mdc-select-value-text,
:host ::ng-deep .trigger-config-form .mat-mdc-input-element,
:host ::ng-deep .trigger-config-form .mdc-floating-label {
font-size: 13px;
}
:host ::ng-deep .trigger-config-form .mat-mdc-select-trigger {
min-height: 20px;
}
/* ===== Scrollbar CSS ===== */
/* Firefox */
* {
scrollbar-width: auto;
scroll-margin-right: 0;
scrollbar-color: #b8b8b8 #ffffff;
}
/* Chrome, Edge, and Safari */
*::-webkit-scrollbar {
width: 12px;
}
*::-webkit-scrollbar-track {
background: #ffffff;
}
*::-webkit-scrollbar-thumb {
background-color: #b8b8b8;
border-radius: 10px;
border: 3px solid #ffffff;
}

View File

@@ -0,0 +1,302 @@
import {ComponentFixture, fakeAsync, flush, TestBed, waitForAsync} from '@angular/core/testing';
import {MatCardModule} from '@angular/material/card';
import {SimpleTriggerConfigComponent} from './simple-trigger-config.component';
import {ApiService, ConfigService, CONTEXT_PATH, SchedulerService} from '../../services';
import {HttpClient} from '@angular/common/http';
import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing';
import {DebugElement, NO_ERRORS_SCHEMA} from '@angular/core';
import {By} from '@angular/platform-browser';
import {RouterTestingModule} from '@angular/router/testing';
import {MatIconModule} from '@angular/material/icon';
import {FormBuilder, FormsModule, ReactiveFormsModule} from '@angular/forms';
import {MatFormFieldModule} from '@angular/material/form-field';
import {MatNativeDateModule} from '@angular/material/core';
import {MatInputModule} from '@angular/material/input';
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
import {TriggerKey} from '../../model/triggerKey.model';
import {Trigger} from '../../model/trigger.model';
import {JobDetail} from '../../model/jobDetail.model';
import {SimpleTrigger} from '../../model/simple-trigger.model';
import JobService from '../../services/job.service';
import {MatSelectModule} from '@angular/material/select';
import {MisfireInstruction} from '../../model/misfire-instruction.model';
describe('SimpleTriggerConfig', () => {
const submitButtonSelector = 'form button[color="primary"]';
const repeatIntervalSelector = '#repeatInterval';
const testTriggerName = 'test-trigger';
const testJobName = 'TestJob';
let component: SimpleTriggerConfigComponent;
let fixture: ComponentFixture<SimpleTriggerConfigComponent>;
let httpClient: HttpClient;
let httpTestingController: HttpTestingController;
beforeEach(waitForAsync( () => {
TestBed.configureTestingModule({
imports: [FormsModule, MatFormFieldModule, MatFormFieldModule, MatSelectModule, MatInputModule, NoopAnimationsModule,
MatNativeDateModule, ReactiveFormsModule,
MatCardModule, MatIconModule, HttpClientTestingModule, RouterTestingModule],
declarations: [SimpleTriggerConfigComponent],
providers: [SchedulerService, ApiService, ConfigService, JobService, FormBuilder],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents();
httpClient = TestBed.inject(HttpClient);
httpTestingController = TestBed.inject(HttpTestingController);
}));
beforeEach(() => {
fixture = TestBed.createComponent(SimpleTriggerConfigComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should fetch no triggers at the init', () => {
expect(component).toBeTruthy();
httpTestingController.expectNone(`${CONTEXT_PATH}/simple-triggers/DEFAULT/my-simple-trigger`);
});
function setInputValue(componentDe: DebugElement, inputSelector: string, value: string) {
const inputDe = componentDe.query(By.css(inputSelector));
const inputEl = inputDe.nativeElement;
inputEl.value = value;
inputEl.dispatchEvent(new Event('input'));
fixture.detectChanges();
}
function setDropdownValue(componentDe: DebugElement, dropdownSelector: string, value: string) {
const dropdownDe = componentDe.query(By.css(dropdownSelector));
const dropdownEl = dropdownDe.nativeElement;
dropdownEl.value = value;
dropdownEl.dispatchEvent(new Event('change'));
fixture.detectChanges();
}
function setDropdownValueByIndex(componentDe: DebugElement, dropdownSelector: string, index: number) {
const dropdownDe = componentDe.query(By.css(dropdownSelector));
const dropdownEl = dropdownDe.nativeElement;
dropdownEl.value = dropdownEl.options[index].value;
dropdownEl.dispatchEvent(new Event('change'));
fixture.detectChanges();
}
async function setMatSelectValueByIndex(componentDe: DebugElement, dropdownSelector: string, index: number) {
const dropdownDe = componentDe.query(By.css(dropdownSelector));
dropdownDe.nativeElement.click();
fixture.detectChanges();
const matOptionDe = componentDe.query(By.css('.mat-mdc-select-panel')).queryAll(By.css('.mat-mdc-option'));
matOptionDe[index].nativeElement.click();
fixture.detectChanges();
}
function openFormAndFillAllMandatoryFields() {
component.openTriggerForm();
fixture.detectChanges();
const getJobsReq = httpTestingController.expectOne(`${CONTEXT_PATH}/job-classes`);
getJobsReq.flush([testJobName]);
const componentDe: DebugElement = fixture.debugElement;
const submitButton = componentDe.query(By.css(submitButtonSelector));
expect(submitButton.nativeElement.textContent.trim()).toEqual('Submit');
expect(submitButton.nativeElement.getAttribute('disabled')).toEqual('');
setInputValue(componentDe, '#triggerName', testTriggerName);
expect(component.simpleTriggerReactiveForm.controls.triggerName.value).toEqual(testTriggerName);
expect(submitButton.nativeElement.getAttribute('disabled')).toEqual('');
setMatSelectValueByIndex(componentDe, '#misfireInstruction', 0);
expect(component.simpleTriggerReactiveForm.controls.misfireInstruction.value).toEqual('MISFIRE_INSTRUCTION_FIRE_NOW');
expect(submitButton.nativeElement.getAttribute('disabled')).toEqual('');
setMatSelectValueByIndex(componentDe, '#jobClass', 0);
expect(submitButton.nativeElement.getAttribute('disabled')).toEqual(null);
setInputValue(componentDe, '#repeatCount', '1000');
expect(submitButton.nativeElement.getAttribute('disabled')).toEqual('');
setInputValue(componentDe, repeatIntervalSelector, '2000');
expect(submitButton.nativeElement.getAttribute('disabled')).toEqual(null);
}
it('should enabled the submit only when the form is valid', () => {
openFormAndFillAllMandatoryFields();
});
it('should emit an event when a new trigger is submitted', fakeAsync(() => {
const componentDe: DebugElement = fixture.debugElement;
const mockTrigger = new Trigger();
mockTrigger.triggerKeyDTO = new TriggerKey(testTriggerName, null);
mockTrigger.jobDetailDTO = <JobDetail>{jobClassName: testJobName, description: null};
mockTrigger.misfireInstruction = MisfireInstruction.MISFIRE_INSTRUCTION_FIRE_NOW;
openFormAndFillAllMandatoryFields();
setInputValue(componentDe, repeatIntervalSelector, '2000');
expect(component.simpleTriggerReactiveForm.controls.triggerRecurrence.value.repeatInterval).toEqual(2000);
setInputValue(componentDe, '#repeatCount', '100');
expect(component.simpleTriggerReactiveForm.controls.triggerRecurrence.value.repeatCount).toEqual(100);
const submitButton = componentDe.query(By.css(submitButtonSelector));
expect(submitButton.nativeElement.textContent.trim()).toEqual('Submit');
let actualNewTrigger;
component.onNewTrigger.subscribe(simpleTrigger => actualNewTrigger = simpleTrigger);
let submittedTriggerKey: TriggerKey;
component.onTriggerSubmitting.subscribe(triggerKey => submittedTriggerKey = triggerKey);
submitButton.nativeElement.click();
expect(submittedTriggerKey).toEqual(new TriggerKey(testTriggerName, null));
flush();
const postSimpleTriggerReq = httpTestingController.expectOne(`${CONTEXT_PATH}/simple-triggers/DEFAULT/${testTriggerName}`);
postSimpleTriggerReq.flush(mockTrigger);
expect(actualNewTrigger).toEqual(mockTrigger);
}));
it('should not emit an event when an existing trigger is edited', () => {
const mockTriggerKey = new TriggerKey(testTriggerName, null);
component.triggerKey = mockTriggerKey;
fixture.detectChanges();
const mockTrigger = new SimpleTrigger();
mockTrigger.triggerKeyDTO = new TriggerKey(testTriggerName, null);
mockTrigger.jobDetailDTO = <JobDetail>{jobClassName: testJobName, description: null};
mockTrigger.mayFireAgain = true;
mockTrigger.misfireInstruction = MisfireInstruction.MISFIRE_INSTRUCTION_FIRE_NOW;
const getSimpleTriggerReq = httpTestingController.expectOne(`${CONTEXT_PATH}/simple-triggers/DEFAULT/${testTriggerName}`);
getSimpleTriggerReq.flush(mockTrigger);
component.simpleTriggerReactiveForm.setValue({
triggerName: testTriggerName,
jobClass: testJobName,
triggerRecurrence: {
repeatInterval: 2000,
repeatCount: 100,
},
triggerPeriod: {
startDate: null,
endDate: null
},
misfireInstruction: MisfireInstruction.MISFIRE_INSTRUCTION_FIRE_NOW.toString()
});
component.openTriggerForm();
fixture.detectChanges();
const componentDe: DebugElement = fixture.debugElement;
setInputValue(componentDe, repeatIntervalSelector, '4000');
expect(component.simpleTriggerReactiveForm.controls.triggerRecurrence.value.repeatInterval).toEqual(4000);
const submitButton = componentDe.query(By.css(submitButtonSelector));
expect(submitButton.nativeElement.textContent.trim()).toEqual('Submit');
let actualNewTrigger;
component.onNewTrigger.subscribe(simpleTrigger => actualNewTrigger = simpleTrigger);
submitButton.nativeElement.click();
const putSimpleTriggerReq = httpTestingController.expectOne(`${CONTEXT_PATH}/simple-triggers/DEFAULT/${testTriggerName}`);
putSimpleTriggerReq.flush(mockTrigger);
expect(actualNewTrigger).toBeUndefined();
});
it('should fetch and display the trigger when the triggerKey is passed as input', () => {
const mockTriggerKey = new TriggerKey('my-simple-trigger', null);
component.triggerKey = mockTriggerKey;
component.trigger = new SimpleTrigger();
component.trigger.triggerKeyDTO = mockTriggerKey;
const mockTrigger = new Trigger();
mockTrigger.triggerKeyDTO = mockTriggerKey;
mockTrigger.jobDetailDTO = <JobDetail>{jobClassName: 'TestJob', description: null};
const getSimpleTriggerReq = httpTestingController.expectOne(`${CONTEXT_PATH}/simple-triggers/DEFAULT/my-simple-trigger`);
getSimpleTriggerReq.flush(mockTrigger);
fixture.detectChanges();
const componentDe: DebugElement = fixture.debugElement;
const submitButton = componentDe.query(By.css('form button:not(.datetime-picker-trigger)'));
expect(submitButton.nativeElement.textContent.trim()).toEqual('Reschedule');
});
it('should display the form if the openTriggerForm method is called', () => {
component.openTriggerForm();
fixture.detectChanges();
const componentDe: DebugElement = fixture.debugElement;
const submitButton = componentDe.query(By.css(submitButtonSelector));
expect(submitButton.nativeElement.textContent.trim()).toEqual('Submit');
expect(component.simpleTriggerReactiveForm.value.triggerName).toBeNull();
});
it('should reset the form when a new trigger is selected', () => {
const mockTriggerKey = new TriggerKey(testTriggerName, null);
component.triggerKey = mockTriggerKey;
const mockTrigger = new SimpleTrigger();
mockTrigger.triggerKeyDTO = mockTriggerKey;
mockTrigger.jobDetailDTO = <JobDetail>{jobClassName: testJobName, description: null};
mockTrigger.mayFireAgain = true;
mockTrigger.misfireInstruction = MisfireInstruction.MISFIRE_INSTRUCTION_FIRE_NOW;
const getSimpleTriggerReq = httpTestingController.expectOne(`${CONTEXT_PATH}/simple-triggers/DEFAULT/${testTriggerName}`);
getSimpleTriggerReq.flush(mockTrigger);
expect(component.simpleTriggerReactiveForm.value.triggerName).toEqual(testTriggerName);
component.openNewTriggerForm();
expect(component.simpleTriggerReactiveForm.value.triggerName).toBeNull();
expect(component.simpleTriggerReactiveForm.value.jobClass).toBeNull();
expect(component.shouldShowTheTriggerCardContent()).toBeTruthy();
});
it('should not emit form open changes while applying a null trigger input', () => {
let formOpenChangeEmitted = false;
component.triggerFormOpenChange.subscribe(() => formOpenChangeEmitted = true);
component.triggerKey = null;
expect(formOpenChangeEmitted).toBeFalsy();
expect(component.shouldShowTheTriggerCardContent()).toBeFalsy();
});
it('should display the warning if there are no eligible jobs', () => {
fixture.detectChanges();
const getJobsReq = httpTestingController.expectOne(`${CONTEXT_PATH}/job-classes`);
getJobsReq.flush([]);
fixture.detectChanges();
component.openTriggerForm();
fixture.detectChanges();
const componentDe: DebugElement = fixture.debugElement;
const warningCard = componentDe.query(By.css('#noEligibleJobsAlert'));
expect(warningCard).toBeTruthy();
});
it('should not display the warning if there are eligible jobs', () => {
fixture.detectChanges();
const getJobsReq = httpTestingController.expectOne(`${CONTEXT_PATH}/job-classes`);
getJobsReq.flush(['sampleJob']);
fixture.detectChanges();
component.openTriggerForm();
fixture.detectChanges();
const componentDe: DebugElement = fixture.debugElement;
const warningCard = componentDe.query(By.css('#noEligibleJobsAlert'));
expect(warningCard).toBeFalsy();
});
});

View File

@@ -0,0 +1,239 @@
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {SchedulerService} from '../../services';
import {Scheduler} from '../../model/scheduler.model';
import {SimpleTriggerCommand} from '../../model/simple-trigger.command';
import {SimpleTrigger} from '../../model/simple-trigger.model';
import {TriggerKey} from '../../model/triggerKey.model';
import JobService from '../../services/job.service';
import {MisfireInstruction, MisfireInstructionCaption} from '../../model/misfire-instruction.model';
import {AbstractControl, UntypedFormBuilder, UntypedFormGroup, ValidationErrors, Validators} from '@angular/forms';
@Component({
selector: 'qrzmng-simple-trigger-config',
templateUrl: './simple-trigger-config.component.html',
styleUrls: ['./simple-trigger-config.component.scss'],
standalone: false
})
export class SimpleTriggerConfigComponent implements OnInit {
trigger: SimpleTrigger = null;
simpleTriggerReactiveForm: UntypedFormGroup = this.formBuilder.group({
triggerName: [this.trigger?.triggerKeyDTO.name, Validators.required],
jobClass: [this.trigger?.jobDetailDTO.jobClassName, Validators.required],
triggerPeriod: this.formBuilder.group({
startDate: [this.trigger?.startTime && new Date(this.trigger.startTime)],
endDate: [this.trigger?.endTime && new Date(this.trigger.endTime)]
}, {validators: this._triggerPeriodValidator}),
triggerRecurrence: this.formBuilder.group({
repeatCount: [this.trigger?.repeatCount],
repeatInterval: [this.trigger?.repeatInterval]
}, {validators: this._triggerRepetitionValidator}),
misfireInstruction: [MisfireInstruction[this.trigger?.misfireInstruction], Validators.required]
});
scheduler: Scheduler;
triggerLoading = false;
private triggerInProgress = false;
private selectedTriggerKey: TriggerKey;
private jobs: Array<String>;
@Output()
onNewTrigger = new EventEmitter<SimpleTrigger>();
@Output()
triggerFormOpenChange = new EventEmitter<boolean>();
@Output()
onTriggerSubmitting = new EventEmitter<TriggerKey>();
constructor(
private formBuilder: UntypedFormBuilder,
private schedulerService: SchedulerService,
private jobService: JobService
) {
}
ngOnInit() {
this.simpleTriggerReactiveForm.disable();
this.fetchJobs();
}
private fetchJobs() {
this.jobService.fetchJobs().subscribe(jobs => this.jobs = jobs);
}
openTriggerForm() {
this.simpleTriggerReactiveForm.enable();
this.triggerFormOpenChange.emit(true);
}
private closeTriggerForm() {
this.simpleTriggerReactiveForm.disable();
this.triggerFormOpenChange.emit(false);
}
@Input()
set triggerKey(triggerKey: TriggerKey) {
if (!triggerKey) {
return;
} else if (!this.selectedTriggerKey || this.selectedTriggerKey.name !== triggerKey.name) {
this._resetTheTrigger();
this.selectedTriggerKey = {...triggerKey} as TriggerKey;
this.fetchSelectedTrigger();
this.simpleTriggerReactiveForm.disable();
}
}
openNewTriggerForm() {
this._resetTheTrigger();
this.openTriggerForm();
}
private _resetTheTrigger() {
this.trigger = null;
this.triggerInProgress = false;
this.selectedTriggerKey = null;
this.simpleTriggerReactiveForm.reset(new SimpleTriggerReactiveForm());
}
fetchSelectedTrigger = () => {
this.triggerLoading = true;
this.schedulerService.getSimpleTriggerConfig(this.selectedTriggerKey.name)
.subscribe((retTrigger: SimpleTrigger) => {
this.trigger = retTrigger;
this.simpleTriggerReactiveForm.setValue(this._fromTriggerToReactiveForm(retTrigger))
this.triggerLoading = false;
this.triggerInProgress = this.trigger.mayFireAgain;
this.simpleTriggerReactiveForm.disable();
})
}
shouldShowTheTriggerCardContent = (): boolean => this.trigger !== null || this.simpleTriggerReactiveForm.enabled;
existsATriggerInProgress = (): boolean => this.trigger && this.triggerInProgress;
onResetReactiveForm = () => {
if (this.trigger) {
this.simpleTriggerReactiveForm.setValue(this._fromTriggerToReactiveForm(this.trigger));
} else {
this.simpleTriggerReactiveForm.reset(new SimpleTriggerReactiveForm());
}
this.closeTriggerForm();
};
onSubmitTriggerConfig = () => {
const schedulerServiceCall = this.existsATriggerInProgress() ?
this.schedulerService.updateSimpleTriggerConfig : this.schedulerService.saveSimpleTriggerConfig;
const simpleTriggerCommand = this._fromReactiveFormToCommand();
if (!this.trigger) {
this.onTriggerSubmitting.emit(new TriggerKey(simpleTriggerCommand.triggerName, null));
setTimeout(() => this.submitTriggerConfig(schedulerServiceCall, simpleTriggerCommand));
return;
}
this.submitTriggerConfig(schedulerServiceCall, simpleTriggerCommand);
}
private submitTriggerConfig(schedulerServiceCall, simpleTriggerCommand: SimpleTriggerCommand) {
this.triggerLoading = true;
schedulerServiceCall(simpleTriggerCommand)
.subscribe((retTrigger: SimpleTrigger) => {
this.trigger = retTrigger;
this.simpleTriggerReactiveForm.setValue(this._fromTriggerToReactiveForm(retTrigger));
this.triggerInProgress = this.trigger.mayFireAgain;
if (schedulerServiceCall === this.schedulerService.saveSimpleTriggerConfig) {
this.onNewTrigger.emit(retTrigger);
}
this.closeTriggerForm();
}, error => {
if (this.trigger) {
this.simpleTriggerReactiveForm.setValue(this._fromTriggerToReactiveForm(this.trigger));
}
this.triggerLoading = false;
}, () => {
this.triggerLoading = false;
});
}
private _triggerPeriodValidator(control: AbstractControl): ValidationErrors | null {
const startDate = control.get('startDate');
const endDate = control.get('endDate');
if (startDate.value && endDate.value) {
return endDate.value < startDate.value ?
<ValidationErrors>{invalidTriggerPeriod: true} : null;
}
return null;
}
private _triggerRepetitionValidator(control: AbstractControl): ValidationErrors | null {
const repeatInterval = control.get('repeatInterval');
const repeatCount = control.get('repeatCount');
if ((repeatCount.value && repeatInterval.value) || (!repeatCount.value && !repeatInterval.value)) {
repeatInterval.setErrors(null);
repeatCount.setErrors(null);
return null;
}
const errors = <ValidationErrors>{invalidTriggerRecurrence: true};
repeatInterval.setErrors(errors);
repeatCount.setErrors(errors);
return errors;
}
private _fromTriggerToReactiveForm = (simpleTrigger: SimpleTrigger): SimpleTriggerReactiveForm => {
const simpleTriggerReactiveForm = new SimpleTriggerReactiveForm();
simpleTriggerReactiveForm.triggerName = simpleTrigger.triggerKeyDTO.name;
simpleTriggerReactiveForm.jobClass = simpleTrigger.jobDetailDTO.jobClassName;
simpleTriggerReactiveForm.triggerRecurrence.repeatCount = simpleTrigger.repeatCount || null;
simpleTriggerReactiveForm.triggerRecurrence.repeatInterval = simpleTrigger.repeatInterval || null;
simpleTriggerReactiveForm.triggerPeriod.startDate = (simpleTrigger.startTime && new Date(simpleTrigger.startTime)) || null;
simpleTriggerReactiveForm.triggerPeriod.endDate = (simpleTrigger.endTime && new Date(simpleTrigger.endTime)) || null;
simpleTriggerReactiveForm.misfireInstruction = (simpleTrigger.misfireInstruction
&& MisfireInstruction[simpleTrigger.misfireInstruction]) || null;
return simpleTriggerReactiveForm;
};
private _fromReactiveFormToCommand = (): SimpleTriggerCommand => {
const reactiveFormValue = this.simpleTriggerReactiveForm.getRawValue();
const simpleTriggerCommand = new SimpleTriggerCommand();
simpleTriggerCommand.triggerName = reactiveFormValue.triggerName;
simpleTriggerCommand.triggerGroup = this.selectedTriggerKey?.group || 'DEFAULT';
simpleTriggerCommand.jobClass = reactiveFormValue.jobClass;
simpleTriggerCommand.repeatCount = reactiveFormValue.triggerRecurrence.repeatCount;
simpleTriggerCommand.repeatInterval = reactiveFormValue.triggerRecurrence.repeatInterval;
simpleTriggerCommand.startDate = reactiveFormValue.triggerPeriod.startDate;
simpleTriggerCommand.endDate = reactiveFormValue.triggerPeriod.endDate;
simpleTriggerCommand.misfireInstruction = reactiveFormValue.misfireInstruction;
return simpleTriggerCommand;
}
getMisfireInstructionCaption(): string {
const misfireInstructionKey = this.simpleTriggerReactiveForm.controls
.misfireInstruction.value as unknown as keyof typeof MisfireInstruction;
return MisfireInstructionCaption.get(MisfireInstruction[misfireInstructionKey]);
}
}
class SimpleTriggerReactiveForm {
triggerName: string;
jobClass: string;
triggerPeriod: {
startDate?;
endDate?;
} = {};
triggerRecurrence: {
repeatCount?: number;
repeatInterval?: number;
} = {};
misfireInstruction: string;
}

View File

@@ -0,0 +1 @@
export * from './trigger-list.component'

View File

@@ -0,0 +1,42 @@
<mat-card class="trigger-list-card" style="padding-left: 0; padding-right: 0">
<mat-card-header
class="flex flex-row justify-space-between"
style="padding-right: 1em">
<mat-card-subtitle><b>TRIGGERS</b></mat-card-subtitle>
@if (!triggerFormIsOpen) {
<button
mat-raised-button
style="top: -0.5em"
color="primary"
(click)="onNewTriggerBtnClicked()">
new
</button>
}
</mat-card-header>
<mat-divider></mat-divider>
<mat-card-content class="trigger-list-content">
<mat-nav-list
style="
overflow-y: auto;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
overflow: auto;
height: calc(100% - 3em);
">
@for (triggerKey of getTriggerKeyList(); track triggerKey) {
<mat-list-item
class="triggerItemList"
[ngClass]="{
selectedTrigger:
selectedTrigger && selectedTrigger.name == triggerKey.name
}"
(click)="selectTrigger(triggerKey)">
<a matLine>{{ triggerKey.name }}</a>
</mat-list-item>
}
</mat-nav-list>
</mat-card-content>
</mat-card>

View File

@@ -0,0 +1,45 @@
:host {
display: flex;
height: 100%;
min-height: 0;
width: 100%;
}
.trigger-list-card {
display: flex;
flex: 1;
flex-direction: column;
min-height: 0;
}
.trigger-list-content {
flex: 1;
min-height: 0;
position: relative;
}
/* ===== Scrollbar CSS ===== */
/* Firefox */
* {
scrollbar-width: auto;
scrollbar-color: #b8b8b8 #ffffff;
}
/* Chrome, Edge, and Safari */
*::-webkit-scrollbar {
width: 16px;
}
*::-webkit-scrollbar-track {
background: #ffffff;
}
*::-webkit-scrollbar-thumb {
background-color: #b8b8b8;
border-radius: 10px;
border: 3px solid #ffffff;
}
.selectedTrigger{
background-color: #dddddd;
}

View File

@@ -0,0 +1,86 @@
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing';
import {ApiService, ConfigService, CONTEXT_PATH, TriggerService} from '../../services';
import {HttpClient} from '@angular/common/http';
import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing';
import {RouterTestingModule} from '@angular/router/testing';
import {DebugElement} from '@angular/core';
import {By} from '@angular/platform-browser';
import {MatCardModule} from '@angular/material/card';
import {MatIconModule} from '@angular/material/icon';
import {MatDividerModule} from '@angular/material/divider';
import {TriggerListComponent} from './trigger-list.component';
import {MatListModule} from '@angular/material/list';
import {TriggerKey} from '../../model/triggerKey.model';
import {MatDialogModule} from '@angular/material/dialog';
describe('TriggerListComponent', () => {
let component: TriggerListComponent;
let fixture: ComponentFixture<TriggerListComponent>;
let httpClient: HttpClient;
let httpTestingController: HttpTestingController;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [MatCardModule, MatDialogModule, MatDividerModule,
MatIconModule, MatListModule, HttpClientTestingModule, RouterTestingModule],
declarations: [TriggerListComponent],
providers: [TriggerService, ApiService, ConfigService]
}).compileComponents();
httpClient = TestBed.inject(HttpClient);
httpTestingController = TestBed.inject(HttpTestingController);
}));
beforeEach(() => {
fixture = TestBed.createComponent(TriggerListComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should select the first trigger of the list', () => {
expect(component).toBeDefined();
let actualSelectedTrigger: TriggerKey;
component.onSelectedTrigger.subscribe(selectedTrigger => actualSelectedTrigger = selectedTrigger);
const getTriggerListReq = httpTestingController.expectOne(`${CONTEXT_PATH}/triggers`);
const mockExistingTriggers = new Array<TriggerKey>();
const firstTriggerKey = new TriggerKey('trigger1', 'group1');
mockExistingTriggers.push(firstTriggerKey);
const secondTriggerKey = new TriggerKey('trigger2', 'group2');
mockExistingTriggers.push(secondTriggerKey);
getTriggerListReq.flush(mockExistingTriggers);
fixture.detectChanges();
const triggerListComponentDe: DebugElement = fixture.debugElement;
const triggerItemList = triggerListComponentDe.queryAll(By.css('.triggerItemList'));
expect(triggerItemList.length).toEqual(2);
expect(actualSelectedTrigger).toEqual(firstTriggerKey);
});
it('should open the trigger form if the trigger list is empty', () => {
expect(component).toBeDefined();
let actualSelectedTrigger: TriggerKey;
component.onSelectedTrigger.subscribe(selectedTrigger => actualSelectedTrigger = selectedTrigger);
let expectedOpenedNewTriggerFormEvent: boolean;
component.onNewTriggerClicked.subscribe(() => expectedOpenedNewTriggerFormEvent = true);
const getTriggerListReq = httpTestingController.expectOne(`${CONTEXT_PATH}/triggers`);
getTriggerListReq.flush(new Array<TriggerKey>());
fixture.detectChanges();
const triggerListComponentDe: DebugElement = fixture.debugElement;
const triggerItemList = triggerListComponentDe.queryAll(By.css('.triggerItemList'));
expect(triggerItemList.length).toEqual(0);
expect(expectedOpenedNewTriggerFormEvent).toBeTruthy();
expect(actualSelectedTrigger).toBeUndefined();
});
});

View File

@@ -0,0 +1,102 @@
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
import {TriggerService} from '../../services/trigger.service';
import {TriggerKey} from '../../model/triggerKey.model';
import {SimpleTrigger} from '../../model/simple-trigger.model';
import {MatDialog, MatDialogRef} from '@angular/material/dialog';
@Component({
template: `
<div style="padding:16px">
<h3 mat-dialog-title>Coming Soon</h3>
<div mat-dialog-content>
<p>This feature is in roadmap and it will come with the next releases</p>
</div>
<div mat-dialog-actions>
<button mat-button (click)="closeDialog()" style="padding: 0.5em;width: 5em;">Ok</button>
</div>
</div>`,
standalone: false
})
// tslint:disable-next-line:component-class-suffix
export class UnsupportedMultipleJobsDialog {
constructor(public dialogRef: MatDialogRef<UnsupportedMultipleJobsDialog>) {
}
closeDialog(): void {
this.dialogRef.close();
}
}
@Component({
selector: 'qrzmng-trigger-list',
templateUrl: './trigger-list.component.html',
styleUrls: ['./trigger-list.component.scss'],
standalone: false
})
export class TriggerListComponent implements OnInit {
newTriggers: Array<SimpleTrigger> = new Array<SimpleTrigger>();
loading = true;
triggerKeys: Array<TriggerKey> = new Array<TriggerKey>();
@Output() onNewTriggerClicked = new EventEmitter<void>();
triggerFormIsOpen = false;
selectedTrigger: TriggerKey;
@Output() onSelectedTrigger = new EventEmitter<TriggerKey>();
constructor(
private triggerService: TriggerService,
public dialog: MatDialog
) {
}
ngOnInit() {
this.loading = true;
this.fetchTriggers();
}
@Input()
set openedNewTriggerForm(triggerFormIsOpen: boolean) {
this.triggerFormIsOpen = triggerFormIsOpen;
}
getTriggerKeyList = () => {
const newTriggerKeys = this.newTriggers.map(simpleTrigger => simpleTrigger.triggerKeyDTO);
return newTriggerKeys.concat(this.triggerKeys);
}
private fetchTriggers() {
this.triggerService.fetchTriggers()
.subscribe((triggerKeys: Array<TriggerKey>) => {
this.triggerKeys = triggerKeys;
if (!triggerKeys || triggerKeys.length === 0) {
this.onNewTriggerBtnClicked();
} else {
this.selectTrigger(this.triggerKeys[0]);
}
})
}
selectTrigger(triggerKey: TriggerKey) {
this.selectedTrigger = triggerKey;
this.onSelectedTrigger.emit(triggerKey);
}
onNewTriggerBtnClicked() {
this.onNewTriggerClicked.emit();
// if (this.getTriggerKeyList() && this.getTriggerKeyList().length > 0) {
// this.dialog.open(UnsupportedMultipleJobsDialog)
// } else {
// this.onNewTriggerClicked.emit();
// }
}
onNewTrigger(newTrigger: SimpleTrigger) {
this.newTriggers = [newTrigger, ...this.newTriggers];
this.selectTrigger(newTrigger.triggerKeyDTO);
}
}

View File

@@ -1,105 +0,0 @@
import { TestBed, async, inject } from '@angular/core/testing';
import { Router } from '@angular/router';
import { NO_AUTH, UserService } from '../services';
import { AdminGuard } from './admin.guard';
import {jest} from '@jest/globals'
export class RouterStub {
navigate(commands?: any[], extras?: any) {}
}
const RouterSpy = jest.spyOn(RouterStub.prototype, 'navigate');
const MockUserServiceNoAuth = jest.fn(() => ({currentUser: NO_AUTH}));
const MockUserService = jest.fn(() => ({
currentUser: {
authorities: ['ROLE_ADMIN']
}
}));
const MockUserServiceForbidden = jest.fn(() => ({
currentUser: {
authorities: ['ROLE_GUEST']
}
}));
describe('AdminGuard NoAuth', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [
AdminGuard,
{
provide: Router,
useClass: RouterStub
},
{
provide: UserService,
useClass: MockUserServiceNoAuth
}
]
});
});
it('should run', inject([AdminGuard], (guard: AdminGuard) => {
expect(guard).toBeTruthy();
}));
it('returns true if user is NO_AUTH',inject([AdminGuard], (guard: AdminGuard) => {
expect(guard.canActivate(null, null)).toBeTruthy();
}));
});
describe('AdminGuard activates the route', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [
AdminGuard,
{
provide: Router,
useClass: RouterStub
},
{
provide: UserService,
useClass: MockUserService
}
]
});
});
it('should run', inject([AdminGuard], (guard: AdminGuard) => {
expect(guard).toBeTruthy();
}));
it('returns true if user has admin role',inject([AdminGuard], (guard: AdminGuard) => {
expect(guard.canActivate(null, null)).toBeTruthy();
}));
});
describe('AdminGuard redirects to 403', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [
AdminGuard,
{
provide: Router,
useClass: RouterStub
},
{
provide: UserService,
useClass: MockUserServiceForbidden
}
]
});
});
it('should run', inject([AdminGuard], (guard: AdminGuard) => {
expect(guard).toBeTruthy();
}));
it('returns false if user is not authorized',inject([AdminGuard], (guard: AdminGuard) => {
expect(guard.canActivate(null, null)).toBeFalsy();
expect(RouterSpy).toHaveBeenCalledTimes(1);
}));
});

View File

@@ -1,25 +1,29 @@
import { Injectable } from '@angular/core';
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { UserService } from '../services';
import { Observable } from 'rxjs';
import {Injectable} from '@angular/core';
import { Router, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import {UserService} from '../services';
import {Observable} from 'rxjs';
@Injectable()
export class AdminGuard implements CanActivate {
constructor(private router: Router, private userService: UserService) {}
export class AdminGuard {
constructor(private router: Router, private userService: UserService) {
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
if (this.userService.isAnAnonymousUser) {
return true;
}
if (this.userService.currentUser) {
if(this.userService.currentUser === 'NO_AUTH')
return true;
if (JSON.stringify(this.userService.currentUser.authorities).search('ROLE_ADMIN') !== -1)
return true;
else {
this.router.navigate(['/403']);
return false;
}
return true;
// to be enable again in the scope of the card #65
// if (JSON.stringify(this.userService.currentUser.authorities).search('ROLE_ADMIN') !== -1) {
// return true;
// } else {
// this.router.navigate(['/403']);
// return false;
// }
} else {
console.log('NOT AN ADMIN ROLE');
this.router.navigate(['/login'], { queryParams: { returnUrl: state.url }});
this.router.navigate(['/login'], {queryParams: {returnUrl: state.url}});
return false;
}
}

View File

@@ -1,10 +1,10 @@
import { Injectable } from '@angular/core';
import { Router, CanActivate } from '@angular/router';
import { Router } from '@angular/router';
import { UserService } from '../services';
import { Observable } from 'rxjs';
@Injectable()
export class GuestGuard implements CanActivate {
export class GuestGuard {
constructor(private router: Router, private userService: UserService) {}

View File

@@ -1,10 +1,10 @@
import { Injectable } from '@angular/core';
import { Router, CanActivate } from '@angular/router';
import { Router } from '@angular/router';
import { UserService } from '../services';
import { Observable } from 'rxjs';
@Injectable()
export class LoginGuard implements CanActivate {
export class LoginGuard {
constructor(private router: Router, private userService: UserService) {}

View File

@@ -1,4 +1,7 @@
export class SocketEndpoint{
client : any
stomp : any
}
import SockJS from 'sockjs-client';
import Stomp from 'stompjs';
export class SocketEndpoint {
client: SockJS;
stomp: Stomp;
}

View File

@@ -1,17 +1,20 @@
export class SocketOption{
socketUrl : string;
topicName : string;
brokerName : string;
reconnectionTimeout : number = 30000
export class SocketOption {
socketUrl: string;
topicName: string;
brokerName: string;
reconnectionTimeout = 30000
getAccessToken: Function = () => null;
getAccessToken: Function = () => null;
constructor(socketUrl : string, topicName : string, getAccessToken?: Function, brokerName : string = null, reconnectionTimeout : number = 30000){
this.socketUrl = socketUrl;
this.topicName = topicName;
this.brokerName = brokerName;
this.reconnectionTimeout = reconnectionTimeout;
this.getAccessToken = getAccessToken || (() => null);
}
}
constructor(socketUrl: string,
topicName: string,
getAccessToken?: Function,
brokerName: string = null,
reconnectionTimeout: number = 30000) {
this.socketUrl = socketUrl;
this.topicName = topicName;
this.brokerName = brokerName;
this.reconnectionTimeout = reconnectionTimeout;
this.getAccessToken = getAccessToken || (() => null);
}
}

View File

@@ -0,0 +1,24 @@
import {TriggerKey} from './triggerKey.model';
export type CalendarType = 'ANNUAL' | 'CRON' | 'DAILY' | 'HOLIDAY' | 'MONTHLY' | 'WEEKLY';
export class QuartzCalendar {
name: string;
type: CalendarType = 'WEEKLY';
description: string;
cronExpression: string;
timeZone: string;
rangeStartingTime: string;
rangeEndingTime: string;
invertTimeRange: boolean;
excludedDaysOfWeek: number[];
excludedDaysOfMonth: number[];
excludedDates: Date[];
triggerKeys: TriggerKey[];
}
export class CalendarIncludedTimeTest {
time: Date;
included: boolean;
nextIncludedTime: Date;
}

View File

@@ -0,0 +1,4 @@
export class JobDetail {
jobClassName: string;
description: string;
}

View File

@@ -0,0 +1,4 @@
export class JobKeyModel {
name: string;
group: string;
}

View File

@@ -0,0 +1,57 @@
export enum MisfireInstruction {
MISFIRE_INSTRUCTION_FIRE_NOW = 1,
MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT = 2,
MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT = 3 ,
MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT = 4,
MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT = 5
}
export function getMisfireInstructionByIndex(index: number) {
return Object.keys(MisfireInstruction)[index];
}
// function enumFromStringValue<T> (enm: { [s: string]: T}, value: string): T | undefined {
// return (Object.values(enm) as unknown as string[]).includes(value)
// ? value as unknown as T
// : undefined;
// }
//
// export function parseMisfireInstruction(str: string): MisfireInstruction {
// return enumFromStringValue<MisfireInstruction>(MisfireInstruction, str);
// // return (<any>MisfireInstruction)[str]
// // const indexOfStr = Object.values(MisfireInstruction).indexOf(str as unknown as MisfireInstruction);
// // const key = Object.keys(Sizes)[indexOfStr];
// // return MisfireInstruction[k]
// // return Object.values(MisfireInstruction).find(val => val === str);
// }
export const MisfireInstructionCaption = new Map<number, string>([
[MisfireInstruction.MISFIRE_INSTRUCTION_FIRE_NOW,
`The job is executed immediately after the scheduler discovers misfire situation.<br/>
In case of the trigger has been set with a repeat count, this policy is equals to RESCHEDULE NOW WITH REMAINING REPEAT COUNT`
],
[MisfireInstruction.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT,
`First misfired trigger is executed immediately. Then the scheduler waits desired interval and executes all remaining triggers.<br/>
Effectively the first fire time of the misfired trigger is moved to current time with no other changes.`
],
[MisfireInstruction.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT,
`First misfired execution runs immediately. Remaining misfired executions are discarded. Remaining not-yet-fired triggers are executed
with desired interval, starting from the recovered misfired execution.<br/>
Use this policy if your constraint is to honor the end date time.<br/>
<strong>Warning</strong> The actual number of job executions could be less than initially set,
because some of the misfired triggers are ignored. The end date time you set is always `
],
[MisfireInstruction.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT,
`In case of misfire event, the scheduler won't do anything immediately. Instead it will wait for next scheduled time the trigger and
run all triggers with scheduled interval. Misfired trigger are simply post-poned but not ignored.<br/>
Use this policy if your constraint is to execute the job for the all times equals to the repeation counter.<br/>' +
'<strong>Warning</strong> The scheduler can completed over the end date time you set `],
[MisfireInstruction.MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT,
`In case of misfire event, the trigger is re-scheduled to the next scheduled time after 'now'
with the repeat count set to what it would be if it had not missed any firings.<br/>
Use this policy if no jobs must run after the end date time.<br/>
<strong>Warning</strong> The actual number of job executions could be less than initially set,
because the misfired trigger are ignored.<br/>
This policy could cause the Trigger to go directly to the 'COMPLETE' state if all fire-times where missed.`
]
]);

View File

@@ -0,0 +1,7 @@
export class ScheduledJobCommand {
jobClass: string;
description: string;
durable: boolean;
requestsRecovery: boolean;
jobDataMap: {[key: string]: unknown};
}

View File

@@ -0,0 +1,12 @@
import {JobKeyModel} from './jobKey.model';
import {TriggerKey} from './triggerKey.model';
export class ScheduledJob {
jobKeyDTO: JobKeyModel;
jobClassName: string;
description: string;
durable: boolean;
requestsRecovery: boolean;
jobDataMap: {[key: string]: unknown};
triggerKeys: TriggerKey[];
}

View File

@@ -0,0 +1,23 @@
import {TriggerKey} from './triggerKey.model';
export class Scheduler {
name: string;
instanceId: string;
status: string;
triggerKeys: TriggerKey[];
quartzVersion: string;
jobStoreClass: string;
jobStoreSupportsPersistence: boolean;
clustered: boolean;
threadPoolClass: string;
threadPoolSize: number;
runningSince: string;
numberOfJobsExecuted: number;
constructor(name: string, instanceId: string, status: string, triggerKeys: TriggerKey[]) {
this.name = name;
this.status = status;
this.instanceId = instanceId;
this.triggerKeys = triggerKeys;
}
}

View File

@@ -1,11 +0,0 @@
export class SchedulerConfig {
triggerPerDay : number = 0
maxCount : number = 0
constructor(triggerPerDay = 0, maxCount = 0) {
this.triggerPerDay = triggerPerDay
this.maxCount = maxCount
}
}

View File

@@ -0,0 +1,12 @@
export class SimpleTriggerCommand {
triggerName: string;
triggerGroup: string;
jobClass: string;
jobKey: {group: string; name: string};
startDate: Date;
endDate: Date;
repeatCount: number;
repeatInterval: number;
misfireInstruction: string;
jobDataMap: {[key: string]: unknown};
}

View File

@@ -0,0 +1,9 @@
export class SimpleTriggerForm {
triggerName: string;
jobClass: string;
startDate: Date;
endDate: Date;
repeatCount: number;
repeatInterval: number;
misfireInstruction: string;
}

View File

@@ -0,0 +1,7 @@
import {Trigger} from './trigger.model';
export class SimpleTrigger extends Trigger {
repeatCount: number;
repeatInterval: number;
timesTriggered: number;
}

View File

@@ -0,0 +1,26 @@
import {JobKeyModel} from './jobKey.model';
export type TriggerType = 'SIMPLE' | 'CRON' | 'DAILY_TIME_INTERVAL' | 'CALENDAR_INTERVAL';
export class TriggerCommand {
triggerType: TriggerType = 'SIMPLE';
jobClass: string;
jobKey: JobKeyModel;
startDate: Date;
endDate: Date;
description: string;
priority: number;
calendarName: string;
misfireInstruction: string;
jobDataMap: {[key: string]: unknown};
repeatCount: number;
repeatInterval: number;
repeatIntervalUnit: string;
cronExpression: string;
timeZone: string;
startTimeOfDay: string;
endTimeOfDay: string;
daysOfWeek: number[];
preserveHourOfDayAcrossDaylightSavings: boolean;
skipDayIfHourDoesNotExist: boolean;
}

View File

@@ -0,0 +1,10 @@
export default class TriggerFiredBundle {
timesTriggered: number;
repeatCount: number;
finalFireTime: string;
nextFireTime: string;
previousFireTime: string;
jobKey: string;
jobClass: string;
percentage: number;
}

View File

@@ -0,0 +1,32 @@
import {TriggerKey} from './triggerKey.model';
import {JobKeyModel} from './jobKey.model';
import {JobDetail} from './jobDetail.model';
export class Trigger {
triggerKeyDTO: TriggerKey = new TriggerKey();
priority: number;
startTime: Date;
description: string;
endTime: Date;
finalFireTime: Date;
misfireInstruction: number;
nextFireTime: Date;
previousFireTime: Date;
type: string;
state: string;
calendarName: string;
jobKeyDTO: JobKeyModel;
jobDetailDTO: JobDetail = new JobDetail();
mayFireAgain: boolean;
jobDataMap: {[key: string]: unknown};
cronExpression: string;
timeZone: string;
repeatInterval: number;
repeatCount: number;
repeatIntervalUnit: string;
startTimeOfDay: string;
endTimeOfDay: string;
daysOfWeek: number[];
preserveHourOfDayAcrossDaylightSavings: boolean;
skipDayIfHourDoesNotExist: boolean;
}

View File

@@ -0,0 +1,9 @@
export class TriggerKey {
name: string;
group: string;
constructor(name?: string, group?: string) {
this.name = name;
this.group = group;
}
}

View File

@@ -1,74 +0,0 @@
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
// import 'core-js/es6/symbol';
// import 'core-js/es6/object';
// import 'core-js/es6/function';
// import 'core-js/es6/parse-int';
// import 'core-js/es6/parse-float';
// import 'core-js/es6/number';
// import 'core-js/es6/math';
// import 'core-js/es6/string';
// import 'core-js/es6/date';
// import 'core-js/es6/array';
// import 'core-js/es6/regexp';
// import 'core-js/es6/map';
// import 'core-js/es6/set';
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
/** IE10 and IE11 requires the following to support `@angular/animation`. */
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/** Evergreen browsers require these. **/
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
/** ALL Firefox browsers require the following to support `@angular/animation`. **/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/***************************************************************************************************
* Zone JS is required by Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
/**
* Date, currency, decimal and percent pipes.
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
*/
// import 'intl'; // Run `npm install --save intl`.
/***************************************************************************************************
* MATERIAL 2
*/
import 'hammerjs/hammer';

View File

@@ -1,83 +1,83 @@
import { TestBed } from "@angular/core/testing";
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { ApiService } from './api.service';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Router} from '@angular/router';
import {TestBed} from '@angular/core/testing';
import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing';
import {ApiService} from './api.service';
import {HttpClient, HttpHeaders} from '@angular/common/http';
import {Router} from '@angular/router';
import {jest} from '@jest/globals'
class Data{
name: string
class Data {
name: string
}
class HttpResponseMock {
constructor(
public body: unknown,
public opts?: {
headers?:
| HttpHeaders
| {
[name: string]: string | string[];
};
status?: number;
statusText?: string;
}
) {}
constructor(
public body: unknown,
public opts?: {
headers?:
| HttpHeaders
| {
[name: string]: string | string[];
};
status?: number;
statusText?: string;
}
) {
}
}
const routerSpy = jest.spyOn(Router.prototype, 'navigateByUrl');
describe('ApiServiceTest', () => {
let apiService: ApiService;
let httpClient: HttpClient;
let httpTestingController: HttpTestingController;
let apiService: ApiService;
let httpClient: HttpClient;
let httpTestingController: HttpTestingController;
const SAMPLE_URL = '/sample-url';
const URL_401 = '/url-response-401';
const testData: Data = {name: 'Test Data'};
const SAMPLE_URL = '/sample-url';
const URL_401 = '/url-response-401';
const testData: Data = {name: 'Test Data'};
beforeEach(() => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
providers: [ApiService, {provide: Router, useValue: routerSpy}]
});
apiService = TestBed.inject(ApiService);
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
providers: [ApiService, {provide: Router, useValue: routerSpy}]
});
apiService = TestBed.inject(ApiService);
httpClient = TestBed.inject(HttpClient);
httpTestingController = TestBed.inject(HttpTestingController);
httpClient = TestBed.inject(HttpClient);
httpTestingController = TestBed.inject(HttpTestingController);
});
it('should be created', (): void => {
expect(apiService).toBeTruthy();
});
it('can test HttpClient.get', (): void => {
apiService.get(SAMPLE_URL).subscribe((res: Data) => {
expect(res).toEqual(testData);
});
it('should be created', (): void => {
expect(apiService).toBeTruthy();
const req = httpTestingController.expectOne(SAMPLE_URL)
expect(req.request.method).toEqual('GET');
req.flush(new HttpResponseMock(testData));
httpTestingController.verify();
});
it('doesn\'t do anything if 401 is received', (): void => {
apiService.get(URL_401).subscribe((res: Data) => {
expect(false);
}, (error) => {
expect(error.status).toBe(401);
expect(routerSpy).toHaveBeenCalledTimes(1);
});
it('can test HttpClient.get', (): void => {
const req = httpTestingController.expectOne(URL_401)
expect(req.request.method).toEqual('GET');
req.flush(null, {status: 401, statusText: 'unauthenticated'});
httpTestingController.verify();
});
apiService.get(SAMPLE_URL).subscribe((res: Data) => {
expect(res).toEqual(testData);
});
const req = httpTestingController.expectOne(SAMPLE_URL)
expect(req.request.method).toEqual('GET');
req.flush(new HttpResponseMock(testData));
httpTestingController.verify();
});
it('doesn\'t do anything if 401 is received', (): void => {
apiService.get(URL_401).subscribe((res: Data) => {
expect(false);
}, (error) =>
{
expect(error.status).toBe(401);
expect(routerSpy).toHaveBeenCalledTimes(1);
});
const req = httpTestingController.expectOne(URL_401)
expect(req.request.method).toEqual('GET');
req.flush(null, {status: 401, statusText: 'unauthenticated'});
httpTestingController.verify();
});
});
});

View File

@@ -1,9 +1,9 @@
import { HttpClient, HttpHeaders, HttpResponse, HttpRequest, HttpEventType, HttpParams } from '@angular/common/http';
import { Router} from '@angular/router';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { catchError, map, filter, tap } from 'rxjs/operators'
import { serialize } from '../shared/utilities/serialize';
import {Router} from '@angular/router';
import {Injectable} from '@angular/core';
import {Observable} from 'rxjs';
import {catchError, map, filter, tap} from 'rxjs/operators'
import {serialize} from '../shared/utilities/serialize';
export enum RequestMethod {
Get = 'GET',
@@ -18,17 +18,6 @@ export enum RequestMethod {
@Injectable()
export class ApiService {
private static extractTokenFromHttpResponse(res: HttpResponse<any>): string {
let authorization: string = null;
let headers: HttpHeaders = res.headers;
if (headers && headers.has('Authorization')){
authorization = headers.get('Authorization');
if(authorization.startsWith('Bearer '))
authorization = authorization.substring(7);
}
return authorization;
}
headers = new HttpHeaders({
'Accept': 'application/json',
'Content-Type': 'application/json'
@@ -36,7 +25,20 @@ export class ApiService {
private jwtToken: string;
constructor( private http: HttpClient, private router: Router) { }
private static extractTokenFromHttpResponse(res: HttpResponse<any>): string {
let authorization: string = null;
const headers: HttpHeaders = res.headers;
if (headers && headers.has('Authorization')) {
authorization = headers.get('Authorization');
if (authorization.startsWith('Bearer ')) {
authorization = authorization.substring(7);
}
}
return authorization;
}
constructor(private http: HttpClient, private router: Router) {
}
setToken(token: string) {
this.jwtToken = token;
@@ -50,8 +52,9 @@ export class ApiService {
withCredentials: true
};
if (args)
if (args) {
options['params'] = serialize(args);
}
return this.http.get(path, options)
.pipe(catchError(this.checkError.bind(this)));
@@ -73,20 +76,21 @@ export class ApiService {
const options = {
headers: customHeaders || this.headers,
withCredentials: true
}
}
const req = new HttpRequest(method, path, body, options);
return this.http.request(req)
.pipe(
filter(response => response instanceof HttpResponse),
tap((resp: HttpResponse<any>) => {
let jwtToken = ApiService.extractTokenFromHttpResponse(resp);
if(jwtToken)
this.setToken(jwtToken);
}),
map((response: HttpResponse<any>) => response.body),
catchError(error => this.checkError(error))
filter(response => response instanceof HttpResponse),
tap((resp: HttpResponse<any>) => {
const jwtToken = ApiService.extractTokenFromHttpResponse(resp);
if (jwtToken) {
this.setToken(jwtToken);
}
}),
map((response: HttpResponse<any>) => response.body),
catchError(error => this.checkError(error))
)
}
@@ -100,6 +104,5 @@ export class ApiService {
throw error;
}
}

View File

@@ -1,9 +1,9 @@
import { Injectable } from '@angular/core';
import {Injectable} from '@angular/core';
import { HttpHeaders, HttpResponse } from '@angular/common/http';
import { ApiService } from './api.service';
import { UserService } from './user.service';
import { ConfigService } from './config.service';
import { map } from 'rxjs/operators';
import {ApiService} from './api.service';
import {UserService} from './user.service';
import {ConfigService} from './config.service';
import {map} from 'rxjs/operators';
@Injectable()
export class AuthService {
@@ -12,7 +12,8 @@ export class AuthService {
private apiService: ApiService,
private userService: UserService,
private config: ConfigService,
) { }
) {
}
login(user) {
const loginHeaders = new HttpHeaders({
@@ -21,24 +22,14 @@ export class AuthService {
});
const body = `username=${user.username}&password=${user.password}`;
return this.apiService.post(this.config.login_url, body, loginHeaders)
.pipe(
map(() => {
console.log("Login success");
this.userService.getMyInfo().subscribe();
})
);
.pipe(
map(() => {
console.log('Login success');
this.userService.getUserInfo().subscribe();
})
);
}
signup(user){
const signupHeaders = new HttpHeaders({
'Accept': 'application/json',
'Content-Type': 'application/json'
});
return this.apiService.post(this.config.signup_url, JSON.stringify(user), signupHeaders).pipe(map(() =>{
console.log("Sign up success");
}));
}
logout() {
return this.apiService.post(this.config.logout_url, {})
.pipe(map(() => {
@@ -47,9 +38,4 @@ export class AuthService {
}));
}
changePassword(passwordChanger) {
return this.apiService.post(this.config.change_password_url, passwordChanger);
}
}

View File

@@ -0,0 +1,36 @@
import {jest} from '@jest/globals';
import {CalendarService} from './calendar.service';
describe('CalendarService', () => {
let apiService: any;
let calendarService: CalendarService;
beforeEach(() => {
apiService = {
get: jest.fn(),
post: jest.fn(),
put: jest.fn(),
delete: jest.fn()
};
calendarService = new CalendarService(apiService);
});
it('uses calendar registry endpoints', () => {
const calendar: any = {name: 'weekends', type: 'WEEKLY'};
const time = new Date('2026-05-12T12:00:00.000Z');
calendarService.fetchCalendars();
calendarService.getCalendar('weekends');
calendarService.createCalendar('weekends', calendar);
calendarService.updateCalendar('weekends', calendar);
calendarService.deleteCalendar('weekends');
calendarService.testIncludedTime('weekends', time);
expect(apiService.get).toHaveBeenCalledWith('/quartz-manager/calendars');
expect(apiService.get).toHaveBeenCalledWith('/quartz-manager/calendars/weekends');
expect(apiService.post).toHaveBeenCalledWith('/quartz-manager/calendars/weekends', calendar);
expect(apiService.put).toHaveBeenCalledWith('/quartz-manager/calendars/weekends', calendar);
expect(apiService.delete).toHaveBeenCalledWith('/quartz-manager/calendars/weekends');
expect(apiService.post).toHaveBeenCalledWith('/quartz-manager/calendars/weekends/included-time-test', {time});
});
});

View File

@@ -0,0 +1,34 @@
import {Injectable} from '@angular/core';
import {Observable} from 'rxjs';
import {ApiService} from './api.service';
import {CONTEXT_PATH, getBaseUrl} from './config.service';
import {CalendarIncludedTimeTest, QuartzCalendar} from '../model/calendar.model';
@Injectable()
export class CalendarService {
constructor(private apiService: ApiService) {}
fetchCalendars = (): Observable<QuartzCalendar[]> => {
return this.apiService.get(getBaseUrl() + `${CONTEXT_PATH}/calendars`);
}
getCalendar = (name: string): Observable<QuartzCalendar> => {
return this.apiService.get(getBaseUrl() + `${CONTEXT_PATH}/calendars/${name}`);
}
createCalendar = (name: string, calendar: QuartzCalendar): Observable<QuartzCalendar> => {
return this.apiService.post(getBaseUrl() + `${CONTEXT_PATH}/calendars/${name}`, calendar);
}
updateCalendar = (name: string, calendar: QuartzCalendar): Observable<QuartzCalendar> => {
return this.apiService.put(getBaseUrl() + `${CONTEXT_PATH}/calendars/${name}`, calendar);
}
deleteCalendar = (name: string): Observable<void> => {
return this.apiService.delete(getBaseUrl() + `${CONTEXT_PATH}/calendars/${name}`);
}
testIncludedTime = (name: string, time: Date): Observable<CalendarIncludedTimeTest> => {
return this.apiService.post(getBaseUrl() + `${CONTEXT_PATH}/calendars/${name}/included-time-test`, {time});
}
}

View File

@@ -1,79 +1,57 @@
import { Injectable } from '@angular/core';
import { environment } from '../../environments/environment';
import {Injectable} from '@angular/core';
import {environment} from '../../environments/environment';
const WEBJAR_PATH = '/quartz-manager-ui/';
export function getHtmlBaseUrl(){
const baseUrl = getBaseUrl() || '/';
return environment.production ? getBaseUrl() + WEBJAR_PATH: '/';
}
export const CONTEXT_PATH = '/quartz-manager';
export function getBaseUrl(){
if(environment.production){
let contextPath: string = window.location.pathname.split('/')[1] || '';
if(contextPath && ('/' + contextPath + '/') === WEBJAR_PATH)
return '';
if(contextPath)
contextPath = '/' + contextPath;
return contextPath;
}
return '';
export function getHtmlBaseUrl() {
const baseUrl = getBaseUrl() || '/';
return environment.production ? getBaseUrl() + WEBJAR_PATH : '/';
}
export function getBaseUrl() {
if (environment.production) {
let contextPath: string = window.location.pathname.split('/')[1] || '';
if (contextPath && ('/' + contextPath + '/') === WEBJAR_PATH) {
return '';
}
if (contextPath) {
contextPath = '/' + contextPath;
}
return contextPath;
}
return '';
}
@Injectable()
export class ConfigService {
private _api_url = getBaseUrl() + '/quartz-manager/api'
private _auth_url = getBaseUrl() + `${CONTEXT_PATH}/auth`
private _refresh_token_url = this._api_url + '/refresh';
private _refresh_token_url = this._auth_url + '/refresh';
private _login_url = this._api_url + '/login';
private _login_url = this._auth_url + '/login';
private _logout_url = this._api_url + '/logout';
private _logout_url = this._auth_url + '/logout';
private _change_password_url = this._api_url + '/changePassword';
private _whoami_url = this._api_url + '/whoami';
private _user_url = this._api_url + '/user';
private _users_url = this._user_url + '/all';
private _reset_credentials_url = this._user_url + '/reset-credentials';
private _signup_url = this._api_url + '/signup';
get reset_credentials_url(): string {
return this._reset_credentials_url;
}
private _whoami_url = this._auth_url + '/whoami';
get refresh_token_url(): string {
return this._refresh_token_url;
return this._refresh_token_url;
}
get whoami_url(): string {
return this._whoami_url;
}
get users_url(): string {
return this._users_url;
return this._whoami_url;
}
get login_url(): string {
return this._login_url;
return this._login_url;
}
get logout_url(): string {
return this._logout_url;
}
get change_password_url(): string {
return this._change_password_url;
}
get signup_url():string {
return this._signup_url;
return this._logout_url;
}
}

View File

@@ -3,7 +3,10 @@ export * from './user.service';
export * from './config.service';
export * from './auth.service';
export * from './scheduler.service';
export * from './websocket.service';
export * from './progress.websocket.service';
export * from './logs.websocket.service';
export * from './progress.rx-websocket.service';
export * from './logs.rx-websocket.service';
export * from './trigger.service'
export * from './calendar.service'
export * from './job.service'

View File

@@ -0,0 +1,46 @@
import JobService from './job.service';
import {ScheduledJob} from '../model/scheduled-job.model';
import {jest} from '@jest/globals';
describe('JobService', () => {
let apiService: any;
let jobService: JobService;
beforeEach(() => {
apiService = {
get: jest.fn(),
post: jest.fn(),
put: jest.fn(),
delete: jest.fn()
};
jobService = new JobService(apiService);
});
it('uses job class and scheduled job endpoints', () => {
const job = new ScheduledJob();
const command = {
jobClass: 'SampleJob',
description: '',
durable: true,
requestsRecovery: false,
jobDataMap: {}
};
job.jobKeyDTO = {group: 'DEFAULT', name: 'sampleJob'};
jobService.fetchJobs();
jobService.fetchScheduledJobs();
jobService.getScheduledJob('DEFAULT', 'sampleJob');
jobService.createJob('DEFAULT', 'sampleJob', command);
jobService.updateJob('DEFAULT', 'sampleJob', command);
jobService.triggerJob(job);
jobService.deleteJob(job);
expect(apiService.get).toHaveBeenCalledWith('/quartz-manager/job-classes');
expect(apiService.get).toHaveBeenCalledWith('/quartz-manager/jobs');
expect(apiService.get).toHaveBeenCalledWith('/quartz-manager/jobs/DEFAULT/sampleJob');
expect(apiService.post).toHaveBeenCalledWith('/quartz-manager/jobs/DEFAULT/sampleJob', command);
expect(apiService.put).toHaveBeenCalledWith('/quartz-manager/jobs/DEFAULT/sampleJob', command);
expect(apiService.post).toHaveBeenCalledWith('/quartz-manager/jobs/DEFAULT/sampleJob/trigger', {});
expect(apiService.delete).toHaveBeenCalledWith('/quartz-manager/jobs/DEFAULT/sampleJob');
});
});

View File

@@ -0,0 +1,44 @@
import {Injectable} from '@angular/core';
import {ApiService} from './api.service';
import {CONTEXT_PATH, getBaseUrl} from './config.service';
import {Observable} from 'rxjs';
import {ScheduledJob} from '../model/scheduled-job.model';
import {ScheduledJobCommand} from '../model/scheduled-job.command';
@Injectable()
export default class JobService {
constructor(
private apiService: ApiService
) {
}
fetchJobs = (): Observable<string[]> => {
return this.apiService.get(getBaseUrl() + `${CONTEXT_PATH}/job-classes`)
}
fetchScheduledJobs = (): Observable<ScheduledJob[]> => {
return this.apiService.get(getBaseUrl() + `${CONTEXT_PATH}/jobs`)
}
getScheduledJob = (group: string, name: string): Observable<ScheduledJob> => {
return this.apiService.get(getBaseUrl() + `${CONTEXT_PATH}/jobs/${group || 'DEFAULT'}/${name}`)
}
createJob = (group: string, name: string, command: ScheduledJobCommand): Observable<ScheduledJob> => {
return this.apiService.post(getBaseUrl() + `${CONTEXT_PATH}/jobs/${group || 'DEFAULT'}/${name}`, command)
}
updateJob = (group: string, name: string, command: ScheduledJobCommand): Observable<ScheduledJob> => {
return this.apiService.put(getBaseUrl() + `${CONTEXT_PATH}/jobs/${group || 'DEFAULT'}/${name}`, command)
}
triggerJob = (job: ScheduledJob): Observable<void> => {
return this.apiService.post(getBaseUrl() + `${CONTEXT_PATH}/jobs/${job.jobKeyDTO.group}/${job.jobKeyDTO.name}/trigger`, {})
}
deleteJob = (job: ScheduledJob): Observable<void> => {
return this.apiService.delete(getBaseUrl() + `${CONTEXT_PATH}/jobs/${job.jobKeyDTO.group}/${job.jobKeyDTO.name}`)
}
}

Some files were not shown because too many files have changed in this diff Show More