mirror of
https://github.com/fabioformosa/quartz-manager.git
synced 2026-05-14 22:00:30 +09:00
Compare commits
344 Commits
v1.x.x
...
dependabot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c6eb261d52 | ||
|
|
694e199709 | ||
|
|
77cf0a06d6 | ||
|
|
d9c7bcaad9 | ||
|
|
d9469b7dcc | ||
|
|
1a57a4b04e | ||
|
|
10d871be2e | ||
|
|
8b75cc1891 | ||
|
|
f6522a9a79 | ||
|
|
96449c8aeb | ||
|
|
1d03027efe | ||
|
|
69750267f6 | ||
|
|
2640e91055 | ||
|
|
9ccefe90ee | ||
|
|
c538ea95ee | ||
|
|
933975ce70 | ||
|
|
d189feea87 | ||
|
|
9637658b89 | ||
|
|
c3c6265dc6 | ||
|
|
63f871f649 | ||
|
|
a9259fd30d | ||
|
|
43e1fd3f04 | ||
|
|
8e1e4344e4 | ||
|
|
2186b0b007 | ||
|
|
9f7238021b | ||
|
|
db2a5949dc | ||
|
|
73293095f6 | ||
|
|
879fae55ce | ||
|
|
b2da564469 | ||
|
|
b52834a2d8 | ||
|
|
c8c4ad37c8 | ||
|
|
6fa7375f13 | ||
|
|
9127a50433 | ||
|
|
cabbec3d3b | ||
|
|
e42b26fa73 | ||
|
|
018c0f18dc | ||
|
|
a4b0a1bafb | ||
|
|
6eededed2c | ||
|
|
b62455836a | ||
|
|
9dfe06e346 | ||
|
|
461c31e7ea | ||
|
|
29a1903b21 | ||
|
|
83401a2ecb | ||
|
|
3242457cce | ||
|
|
12f91fa85c | ||
|
|
85ba371b72 | ||
|
|
014c348a89 | ||
|
|
a44d041e93 | ||
|
|
9ea4afcaef | ||
|
|
9b32f5e598 | ||
|
|
f4dd8519a9 | ||
|
|
1b1be180c6 | ||
|
|
026bdc6f18 | ||
|
|
1207a646c7 | ||
|
|
3e90a9b22c | ||
|
|
459aa136c1 | ||
|
|
d164cb9363 | ||
|
|
a8fb990966 | ||
|
|
121f2e364f | ||
|
|
b968329fb3 | ||
|
|
d9ff379d59 | ||
|
|
5c9a8d21a3 | ||
|
|
9d24c1587f | ||
|
|
436821a831 | ||
|
|
ecb07dc682 | ||
|
|
8f08927aad | ||
|
|
e29fd8dc92 | ||
|
|
3af5eb076e | ||
|
|
c190c15889 | ||
|
|
540bdf35a5 | ||
|
|
33b4d88d52 | ||
|
|
ad3eec4abe | ||
|
|
7b87a9485e | ||
|
|
a8a027ed88 | ||
|
|
69b62032b2 | ||
|
|
f411659ad6 | ||
|
|
0c33eda68c | ||
|
|
4013c4c08f | ||
|
|
ae3c2d72a1 | ||
|
|
5a96f81338 | ||
|
|
31208f9883 | ||
|
|
a64a06d663 | ||
|
|
02a73762b0 | ||
|
|
2ca24a9aae | ||
|
|
fc1ea9166c | ||
|
|
71ee075cfa | ||
|
|
33f4a7544c | ||
|
|
d16b681362 | ||
|
|
5547b7e868 | ||
|
|
3722d0ca24 | ||
|
|
41d11372ce | ||
|
|
3582ef4125 | ||
|
|
8e32fe531a | ||
|
|
17201aad08 | ||
|
|
4fb70ac8e8 | ||
|
|
425de89469 | ||
|
|
5746cb43c3 | ||
|
|
704f31581f | ||
|
|
7cb7dde65d | ||
|
|
bdc86b5510 | ||
|
|
59816c9693 | ||
|
|
4f8b75a8f9 | ||
|
|
5ea8f2adb1 | ||
|
|
80cd607d17 | ||
|
|
488916bcd7 | ||
|
|
b5abeac093 | ||
|
|
ed266dea15 | ||
|
|
65558c7ee8 | ||
|
|
e5d2c33d9a | ||
|
|
7f00f5de99 | ||
|
|
b2906d09f4 | ||
|
|
3f0d036dad | ||
|
|
9d66cd85f0 | ||
|
|
0a21920ad9 | ||
|
|
bda37213f8 | ||
|
|
c725871a4e | ||
|
|
39a10681bf | ||
|
|
381cfa1486 | ||
|
|
4d4385b7ba | ||
|
|
ec7debe8c5 | ||
|
|
05591546b3 | ||
|
|
2b0644b495 | ||
|
|
a30bd9e2c7 | ||
|
|
6eed819364 | ||
|
|
a1780b1087 | ||
|
|
c70dc3181e | ||
|
|
8ee0435738 | ||
|
|
72e1415038 | ||
|
|
65c3653494 | ||
|
|
304a1e7f71 | ||
|
|
6972915a5c | ||
|
|
77ea248457 | ||
|
|
14c1f7ea85 | ||
|
|
0652a6ec5e | ||
|
|
cecd30309f | ||
|
|
22762d7d84 | ||
|
|
6715665072 | ||
|
|
b92d8275db | ||
|
|
b4acc378e3 | ||
|
|
a313d8b19d | ||
|
|
93152f8157 | ||
|
|
1e99602c68 | ||
|
|
1571ab6d12 | ||
|
|
44d6854bc5 | ||
|
|
727403d420 | ||
|
|
b06b130d20 | ||
|
|
94107f2210 | ||
|
|
adb8e06f0a | ||
|
|
8cb0ac09e8 | ||
|
|
8935d77d0f | ||
|
|
0adb8bf94b | ||
|
|
7e21437dfc | ||
|
|
bfba79448b | ||
|
|
5be49a4090 | ||
|
|
e0b0378329 | ||
|
|
5f3ae667b0 | ||
|
|
b14cf64124 | ||
|
|
d9f9ee96af | ||
|
|
a644dd6052 | ||
|
|
3e5b25b37a | ||
|
|
a693e2aa0c | ||
|
|
599b6fb0b4 | ||
|
|
9638667368 | ||
|
|
21f3f7dca2 | ||
|
|
b4bb16130c | ||
|
|
f1c9fba68e | ||
|
|
09df7795a9 | ||
|
|
6bb768de59 | ||
|
|
86badb8f41 | ||
|
|
54999ce735 | ||
|
|
851100b774 | ||
|
|
3ba2bafc55 | ||
|
|
cbd3066f57 | ||
|
|
f3506304d9 | ||
|
|
c9b90478dd | ||
|
|
2ca2ba7ffc | ||
|
|
3df1abd46e | ||
|
|
34f21a58c9 | ||
|
|
233b56f282 | ||
|
|
1cd7f605e3 | ||
|
|
efee7b575f | ||
|
|
870a813c61 | ||
|
|
24285c7885 | ||
|
|
69e2ab3977 | ||
|
|
8218c63bba | ||
|
|
d89a2af1aa | ||
|
|
09e9b18f96 | ||
|
|
e70bbcff62 | ||
|
|
085d2f1706 | ||
|
|
4746ba9489 | ||
|
|
27fab8acca | ||
|
|
734bb1b087 | ||
|
|
81d9e92450 | ||
|
|
5d794536e3 | ||
|
|
4f3efc50fc | ||
|
|
37ad22090c | ||
|
|
95fa102720 | ||
|
|
f37ad1ae58 | ||
|
|
fb2d8da53d | ||
|
|
87ee4bebb3 | ||
|
|
9bf0871ff6 | ||
|
|
70827393b7 | ||
|
|
c4e8eb94d6 | ||
|
|
e50a48bd4c | ||
|
|
10df1116bd | ||
|
|
03f45346a7 | ||
|
|
6170e8f1ae | ||
|
|
0a718e897b | ||
|
|
d243c3a8e8 | ||
|
|
49020d9bd0 | ||
|
|
1457f3fdea | ||
|
|
42c63b963f | ||
|
|
aecc1cab68 | ||
|
|
4e63e0a833 | ||
|
|
4540165157 | ||
|
|
a56f5284d1 | ||
|
|
eb675f59a3 | ||
|
|
35f8b6b52a | ||
|
|
6c76f0a067 | ||
|
|
48b626c08e | ||
|
|
b2f796cf73 | ||
|
|
b01f4b99e4 | ||
|
|
d11089c451 | ||
|
|
8ecdb4f5a6 | ||
|
|
86c2e86a12 | ||
|
|
54662a1b8a | ||
|
|
6cdee3ba5d | ||
|
|
c6df1e2093 | ||
|
|
663b3f4e09 | ||
|
|
2b6dadd5f1 | ||
|
|
bce1be698c | ||
|
|
c29af8c593 | ||
|
|
a7a86f960a | ||
|
|
56c81caf05 | ||
|
|
8c5b349196 | ||
|
|
1f631529d9 | ||
|
|
6f50f45aa8 | ||
|
|
e23343d7ed | ||
|
|
ef4ffca2bd | ||
|
|
382fe244c5 | ||
|
|
d374be5eee | ||
|
|
e28787d29b | ||
|
|
b7d152a42a | ||
|
|
79e080ea1f | ||
|
|
0087488d5f | ||
|
|
e56ac71d60 | ||
|
|
fc64f07d7f | ||
|
|
b0868de37b | ||
|
|
d950ff29b2 | ||
|
|
10bea2311e | ||
|
|
25a5e808f2 | ||
|
|
9d52c880c6 | ||
|
|
e5adf65f88 | ||
|
|
c1b5056bc9 | ||
|
|
837aef50c3 | ||
|
|
3446d1bfbc | ||
|
|
6bea2ac169 | ||
|
|
c675f4cdb5 | ||
|
|
be04f20b5b | ||
|
|
101968e2b5 | ||
|
|
67983961ca | ||
|
|
732c3c5e5c | ||
|
|
6ebbc62127 | ||
|
|
bb2ec8aadc | ||
|
|
b650cff080 | ||
|
|
a81bb20acd | ||
|
|
b40e880b70 | ||
|
|
b5b6ccc254 | ||
|
|
df417e425a | ||
|
|
3e702c6501 | ||
|
|
ea0b9c07ec | ||
|
|
c6c5bfa96b | ||
|
|
34c569baeb | ||
|
|
fef99920ed | ||
|
|
c110e6d0b1 | ||
|
|
7687def758 | ||
|
|
bf276d0073 | ||
|
|
6dea0f1054 | ||
|
|
061f2dc3e0 | ||
|
|
8ed3210996 | ||
|
|
d315699102 | ||
|
|
7d2e15a831 | ||
|
|
25028774d7 | ||
|
|
1bc52a26b7 | ||
|
|
d0f391f539 | ||
|
|
ca4c8244d5 | ||
|
|
25afc76ced | ||
|
|
f5b046f7eb | ||
|
|
563257930c | ||
|
|
b8b88a6879 | ||
|
|
166244a67b | ||
|
|
f50b0d204e | ||
|
|
0db3bea4ef | ||
|
|
98e7d651c3 | ||
|
|
75d4ac9827 | ||
|
|
2f3dadc186 | ||
|
|
f7b5753e7d | ||
|
|
3b51cd5504 | ||
|
|
53a21067e5 | ||
|
|
4b7de03050 | ||
|
|
88c7408276 | ||
|
|
ccdbc58ca8 | ||
|
|
d5493be261 | ||
|
|
04da4556b1 | ||
|
|
17c4a87ad3 | ||
|
|
8440a431d0 | ||
|
|
3334d36105 | ||
|
|
77c101e077 | ||
|
|
d3967c5dab | ||
|
|
54766dc3a2 | ||
|
|
8ce79fe5b2 | ||
|
|
82372886eb | ||
|
|
45b6819d10 | ||
|
|
b1e0638945 | ||
|
|
f1e47f36af | ||
|
|
3bb85c40eb | ||
|
|
8c37b7509e | ||
|
|
13c1bf71d1 | ||
|
|
f500844cbe | ||
|
|
c5bc1a0b25 | ||
|
|
8eee065aea | ||
|
|
289ea48588 | ||
|
|
f39db9728c | ||
|
|
92745495ef | ||
|
|
df59999034 | ||
|
|
1e6f89678c | ||
|
|
4103779e4e | ||
|
|
919393e58c | ||
|
|
a1f279c161 | ||
|
|
03a4d68993 | ||
|
|
cb6dd7933a | ||
|
|
bcff3ebce7 | ||
|
|
8ec980763b | ||
|
|
139e6871bf | ||
|
|
bde642cf52 | ||
|
|
fc8101aa40 | ||
|
|
8dfd627c23 | ||
|
|
3199437c8c | ||
|
|
615761f0f3 | ||
|
|
dc081a1bed | ||
|
|
e04311914b | ||
|
|
bacd6401a3 | ||
|
|
f88bd50768 | ||
|
|
0b4dc4a1de |
9
.editorconfig
Normal file
9
.editorconfig
Normal file
@@ -0,0 +1,9 @@
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
max_line_length = 120
|
||||
tab_width = 2
|
||||
ij_continuation_indent_size = 2
|
||||
46
.github/workflows/maven-release.yml
vendored
Normal file
46
.github/workflows/maven-release.yml
vendored
Normal 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@v3
|
||||
|
||||
- name: Set up Java 11 for publishing to Maven Central Repository
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'temurin'
|
||||
server-id: ossrh
|
||||
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
|
||||
|
||||
- name: Publish to maven central
|
||||
run: mvn deploy --batch-mode -P release-maven-central, build-webjar
|
||||
env:
|
||||
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
|
||||
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
|
||||
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
|
||||
|
||||
- name: Set up Java 11 for publishing to GitHub Packages
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '11'
|
||||
distribution: 'temurin'
|
||||
- name: Publish to GitHub Packages Apache Maven
|
||||
run: mvn deploy -P deploy-github, build-webjar
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
36
.github/workflows/maven.yml
vendored
Normal file
36
.github/workflows/maven.yml
vendored
Normal 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@v3
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '11'
|
||||
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
44
.github/workflows/npm.yml
vendored
Normal 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: [16.x]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
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
|
||||
39
.github/workflows/sonar-java.yml
vendored
Normal file
39
.github/workflows/sonar-java.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
name: SonarCloud Analysis for Java
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
# paths: [ 'quartz-manager-parent/**' ]
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and analyze
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
- name: Cache SonarCloud packages
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.sonar/cache
|
||||
key: ${{ runner.os }}-sonar
|
||||
restore-keys: ${{ runner.os }}-sonar
|
||||
- name: Cache Maven packages
|
||||
uses: actions/cache@v1
|
||||
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
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/.project
|
||||
3
.travis.yml
Normal file
3
.travis.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
language: java
|
||||
jdk: openjdk8
|
||||
before_script: cd quartz-manager-parent
|
||||
8
CHANGELOG.md
Normal file
8
CHANGELOG.md
Normal file
@@ -0,0 +1,8 @@
|
||||
## **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
|
||||
201
LICENSE
Normal file
201
LICENSE
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
318
README.md
318
README.md
@@ -1,41 +1,287 @@
|
||||
# quartz-manager
|
||||
GUI Manager for Quartz Scheduler.
|
||||
Through this webapp you can launch and control your scheduled job.
|
||||
GUI Console is composed by a managament panel to set trigger, start/stop scheduler and by a log panel with progress bar to get job output.
|
||||
[](https://github.com/fabioformosa/quartz-manager/actions/workflows/maven.yml)
|
||||
[](https://github.com/fabioformosa/quartz-manager/actions/workflows/npm.yml)
|
||||
[](https://maven-badges.herokuapp.com/maven-central/it.fabioformosa.quartz-manager/quartz-manager-starter-api)
|
||||
|
||||
## SCREENSHOT
|
||||

|
||||
# QUARTZ MANAGER
|
||||
In the last decade, the [Quartz Scheduler](http://www.quartz-scheduler.org/) has become the most adopted opensource job scheduling library for Java applications.
|
||||
|
||||
## 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.
|
||||
**Quartz Manager** enriches it with a **REST API** layer and a handy **UI console** to easily control and monitor a Quartz Scheduler.
|
||||
|
||||
## HOW IT RUNS
|
||||
1. Quartz-Manager is a Spring Boot Application. To run by CLI `mvn spring-boot:run` or through your IDE. For more details [spring boot ref.](http://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-running-your-application.html)
|
||||
1. Open quartz-manager at the link: [http://localhost:9000/quartz-manager/manager](http://localhost:9000/quartz-manager/manager)
|
||||
1. Log in with default credentials: `admin/admin`
|
||||
|
||||
## HOW TO RUN YOUR JOB
|
||||
By default, quartz-manager executes the dummy job that logs "hello world!".
|
||||
Replace the dummy job (class: `it.fabioformosa.quartzmanager.jobs.SampleJob`) with yours. Follow these steps:
|
||||
|
||||
1. Let extend the super class `it.fabioformosa.quartzmanager.jobs.AbstractLoggingJob`
|
||||
1. Change the scheduler settings, providing the class name of your job. Open class `it.fabioformosa.quartzmanager.configuration.SchedulerConfig` and for the method `jobDetail` replace SampleJob.class with YourJob.class
|
||||
|
||||
## HOW TO CHANGE SETTINGS
|
||||
* Num of Threads: `/quartz-manager/src/main/resources/quartz.properties`
|
||||
* Credentials: `it.fabioformosa.quartzmanager.configuration.WebSecurityConfig`
|
||||
* Server context path (default `/quartz-manager`) and port (default `9000`): `/quartz-manager/src/main/resources/application.properties`
|
||||
|
||||
## Tech Overview
|
||||
|
||||
**Backend Stack** Java 8, Spring Boot 1.5.9 (Spring MVC 4.3.13, Spring Security 4.2.3, Spring AOP 4.3.13), Quartz Scheduler 2.2.2
|
||||
|
||||
**Application Server** Tomcat (embedded)
|
||||
|
||||
**Frontend** Angularjs 1.6.7, Thymeleaf 2.1.4, Web-Socket (sockjs 0.3.4, stompjs)
|
||||
|
||||
**Style** Bootstrap 3.3.4, animated.css, FontAwesome
|
||||
Quartz Manager is a Java library you can import in your Spring-Based Web Application to run scheduled jobs, start&stop them and get the job outcomes. You can do it through HTTP calls to the the Quartz Manager API or in a visual manner through the Quartz Manager UI dashboard.
|
||||
|
||||
|
||||
## QUARTZ MANAGER UI
|
||||
The **Quartz Manager UI** is a dashboard in the form of a single-page-application provided by the Quartz Manager Java library itself. You can have it embedded in your project, as well as you get embedded the Swagger UI.
|
||||
It leverages the websockets to receive in real-time the trigger updates and the outcomes of the job executions.
|
||||
|
||||

|
||||
|
||||
## QUARTZ MANAGER API
|
||||
Quart-Manager exposes REST endpoints to interact with the Quartz Scheduler. This endpoints are invoked by Quartz Manager UI also.
|
||||
The REST API are documented by an OpenAPI Specification interface.
|
||||
|
||||

|
||||
|
||||
|
||||
# HOW IT WORKS
|
||||
Quartz Manager can either coexist with your existing instance of Quartz or it can import itself the Quartz dependency.
|
||||
|
||||
In the first case, Quartz Manager is compatible with Quartz v2.3.x . Quartz Manager creates and configures its own instance of Quartz Scheduler and it manages only the jobs and the triggers created through it. Your other jobs and triggers, running in the existing quartz instance, are out of the scope of Quartz Manager.
|
||||
|
||||
In the latter case, in which there isn't an existing quartz instance, you can rely on Quartz Manager to speed up the setup of a Quartz instance, with a persistent storage also if you need it. Futhermore, if you start a bare project from scratch, just to run scheduled jobs, Quartz Manager comes with the option to enable a security layer to protect the API and the UI with an authentication model based on [JWT](https://jwt.io).
|
||||
|
||||
**FEATURES**
|
||||
* You can schedule a [Quartz Simple Trigger](http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/tutorial-lesson-05.html) which allows you to start a job now or in a specific date-time, to set it as a recurring job with a certain time frequency, unlimited or limited on the number of fires and within a certain end date.
|
||||
* You can start, pause and resume the quartz scheduler via API or clicking the start/stop buttons at the UI console.
|
||||
* Leveraging on an active web-socket, the `Quartz-Manager-UI` updates in real time the progress bar and it displays the list of the latest logs produced by your quartz job.
|
||||
* You can enable a secure layer, if your project doesn't have any, to give access at the API and the UI only to authenticated users.
|
||||
* You can enable a persistent layer, to persist the config and the progress of your trigger, in a postgresql database.
|
||||
|
||||
# QUICK START
|
||||
|
||||
**Requirements**
|
||||
Java 9+, Spring Framework 5+ (Spring Boot 2.x)
|
||||
|
||||
Quart Manager is a modular library:
|
||||
* quartz-manager-starter-api (mandatory)
|
||||
* quartz-manager-starter-ui (optional)
|
||||
* quartz-manager-starter-security (optional)
|
||||
* quartz-manager-starter-persistence (optional)
|
||||
|
||||
In order to decrease the overall configuration time for the project, all modules of the library follow the approach of Spring Starters. Thus, it's enough to import the dependency to get started.
|
||||
|
||||
Below the list of the quartz-manager modules you can import.
|
||||
|
||||
## Quartz Manager API Lib
|
||||
This is the only mandatory module of the library.
|
||||
Add the dependency, make eligible for Quart Manager the job classes and set the props in your `application.properties` file.
|
||||
|
||||
### Step 1. Dependency
|
||||
|
||||
#### Maven
|
||||
```
|
||||
<dependency>
|
||||
<groupId>it.fabioformosa.quartz-manager</groupId>
|
||||
<artifactId>quartz-manager-starter-api</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
```
|
||||
#### Gradle
|
||||
```
|
||||
implementation group: 'it.fabioformosa.quartz-manager', name: 'quartz-manager-starter-api', version: '4.0.0'
|
||||
```
|
||||
|
||||
### Step 2. Quartz Manager Job Classes
|
||||
The job classes, which can be eligible for triggers managed by Quartz Manager, must extend the super-class `AbstractLoggingJob`.
|
||||
In this way, Quartz Manager is able to collect and display the outcomes at the UI console.
|
||||
|
||||
```
|
||||
public class SampleJob extends AbstractLoggingJob {
|
||||
|
||||
@Override
|
||||
public LogRecord doIt(JobExecutionContext jobExecutionContext) {
|
||||
... do stuff ...
|
||||
return new LogRecord(LogType.INFO, "Hello from QuartManagerDemo!");
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
### Step 3. Quartz Manager API - App Props
|
||||
|
||||
| Property | Values |Mandatory | Default | Description |
|
||||
| :--- |:--- |:--- |:--- |:-- |
|
||||
| quartz-manager.jobClassPackages | string | Yes | |java base package which contains your job classes |
|
||||
| quartz-manager.oas.enabled | boolean | No | false |whether to create an OpenAPI instance to expose the OAS and the Swagger UI |
|
||||
|
||||
|
||||
### REST API & OpenAPI Specification
|
||||
Set the app prop `quartz-manager.oas.enabled=true` you want to expose the OpenApi Specification of the Quartz Manager APIs.
|
||||
Reach out the swagger-ui at the URL:
|
||||
[http://localhost:8080/swagger-ui.html](http://localhost:8080/swagger-ui.html)
|
||||
|
||||
If your project has already an OpenAPI instance and you've set `quartz-manager.oas.enabled=true`, then make sure to add an OpenApiGroup to group the API of your application. Quart Manager exposes its API in group called "Quartz Manager".
|
||||
|
||||
### QUARTZ SETTINGS
|
||||
Quartz Manager creates its own instance of a [Quartz Scheduler](http://www.quartz-scheduler.org/).
|
||||
|
||||
By default, the managed quartz instance is instantiated with the following props:
|
||||
|
||||
```
|
||||
org.quartz.scheduler.instanceName=quartz-manager-scheduler
|
||||
org.quartz.threadPool.threadCount=1
|
||||
```
|
||||
|
||||
You can customize the configuration of the Quartz managed by Quartz Manager creating a file `managed-quartz.properties` in the classpath (`src/main/resources`).
|
||||
For further details about the quartz properties, click [here](http://www.quartz-scheduler.org/documentation/quartz-2.3.0/configuration/).
|
||||
|
||||
#### Existing Quartz Instance
|
||||
Quarz Manager imports transitively the [Quartz Scheduler library](https://mvnrepository.com/artifact/org.quartz-scheduler/quartz) ver 2.3.2.
|
||||
However, Quartz Manager can be imported even thought you've already imported the quartz scheduler lib. Indeed Quartz Manager coexists with the existing Quarz Scheduler Instance you've created in your project. In that case, Quartz Manager will manage the triggers created by it and it won't interfere with the other quartz instances.
|
||||
The prerequesite is that you've imported a quartz scheduler ver 2.3.x.
|
||||
|
||||
You can configure the Quartz instance managed by Quartz Manager through the file `managed-quartz.properties` and your own Quartz instance through the file `quartz.properties`.
|
||||
|
||||
If you've created a `SchedulerFactoryBean`, tag it as @Primary to avoid conflicts in-type, since Quartz Manager creates another bean of the same type.
|
||||
|
||||
```
|
||||
@Primary
|
||||
@Bean
|
||||
public SchedulerFactoryBean schedulerFactoryBean( JobFactory jobFactory, Properties quartzProperties) {
|
||||
SchedulerFactoryBean factory = new SchedulerFactoryBean();
|
||||
...
|
||||
return factory;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Quartz Manager UI Lib
|
||||
You can optionally import the following dependency to have the UI Dashboard to interact with the Quartz Manager API.
|
||||
|
||||
### Dependency
|
||||
|
||||
#### Maven
|
||||
```
|
||||
<dependency>
|
||||
<groupId>it.fabioformosa.quartz-manager</groupId>
|
||||
<artifactId>quartz-manager-starter-ui</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
```
|
||||
#### Gradle
|
||||
```
|
||||
implementation group: 'it.fabioformosa.quartz-manager', name: 'quartz-manager-starter-ui', version: '4.0.0'
|
||||
```
|
||||
|
||||
### Reach out the UI Console at URL
|
||||
if you run locally [http://localhost:8080/quartz-manager-ui/index.html](http://localhost:8080/quartz-manager-ui/index.html)
|
||||
|
||||
|
||||
|
||||
## Quartz Manager Security Lib
|
||||
|
||||
Import this optional dependency, if you want to enable a security layer and allow the access to the REST API and UI only to authenticated users.
|
||||
The authentication model of Quartz Manager is based on [JWT](https://jwt.io/).
|
||||
|
||||
If you're going to import Quartz Manager in a project with an existing configuration of Spring Security, consider the following:
|
||||
- Only if your existing security is cookie-based, actually you don't need to import the module `quartz-manager-security-lib`. Simply, Quartz Manager will be under the hat of your security setup. In all other cases (based on HTTP headers, query params, etc) Quartz Manager is not aware about your auth token and it will implement its own authentication model.
|
||||
- Quartz Manager Security relies on Spring Security upon a dedicated *HTTP Spring Security Chain* applied to the base path `/quartz-manager`. So it doesn't interfere with your existing security setup.
|
||||
- Quartz Manager Security keeps simple the authentication, adopting the InMemory Model. You have to define the users (in terms of username/credentials passed via `application.properties`) can access to Quartz Manager.
|
||||
- By default, the UI attaches the JWT Token to each request in the authorization header in the "Bearer" format.
|
||||
|
||||
Future development: the Quart Manager Security OAuth2 client.
|
||||
|
||||
|
||||
### Dependency
|
||||
|
||||
#### Maven
|
||||
|
||||
```
|
||||
<dependency>
|
||||
<groupId>it.fabioformosa.quartz-manager</groupId>
|
||||
<artifactId>quartz-manager-starter-security</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
#### Gradle
|
||||
|
||||
```
|
||||
compile group: 'it.fabioformosa.quartz-manager', name: 'quartz-manager-starter-security', version: '4.0.0'
|
||||
```
|
||||
|
||||
|
||||
### Quartz Manager Security Lib - App Props
|
||||
|
||||
| Property | Values |Mandatory | Default | Description |
|
||||
| :--- |:--- |:--- |:--- |:-- |
|
||||
| quartz-manager.security.jwt.secret | string | | | Secret to sign the JWT Token |
|
||||
| quartz-manager.security.jwt.expiration-in-sec | number | no | 28800 | |
|
||||
| quartz-manager.security.accounts.in-memory.enabled | boolean | no | true | |
|
||||
|quartz-manager.security.accounts.in-memory.users[0].username | string | yes (if enabled) | | |
|
||||
|quartz-manager.security.accounts.in-memory.users[0].password | string | yes | | |
|
||||
|quartz-manager.security.accounts.in-memory.users[0].roles[0] | string | yes | | set the value ADMIN |
|
||||
|
||||
|
||||
## Quart Manager Persistence Lib
|
||||
|
||||
By default, Quartz Manager runs with a `org.quartz.simpl.RAMJobStore` that stores your managed scheduler in memory. The RAMJobStore is the simplest store and also the most performant. However it comes with the drawback that all scheduling data are lost if your applications ends or crashes. In case of a restarting of your app, you can't resume the scheduler from the point it stopped.
|
||||
Import the Quartz Manager Persistence Module if you want to persist your scheduler data.
|
||||
The pre-requesite is the availability of Postgresql database where Quartz Manager can store its information. You have to provide it a bare database and a postresql user granted for DDL and DML queries. About the DDL, consider that Quartz Manager Persistence will create all tables it needs to work at the bootstrap.
|
||||
|
||||
### Dependency
|
||||
|
||||
#### Maven
|
||||
|
||||
```
|
||||
<dependency>
|
||||
<groupId>it.fabioformosa.quartz-manager</groupId>
|
||||
<artifactId>quartz-manager-starter-persistence</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
#### Gradle
|
||||
|
||||
```
|
||||
compile group: 'it.fabioformosa.quartz-manager', name: 'quartz-manager-starter-persistence', version: '4.0.0'
|
||||
```
|
||||
|
||||
### Quartz Manager Persistence Lib - App Props
|
||||
|
||||
| Property | Values |Mandatory | Default | Description |
|
||||
| :--- |:--- |:--- |:--- |:-- |
|
||||
| quartz-manager.persistence.quartz.datasource.url | string | yes | |eg. jdbc:postgresql://localhost:5432/quartzmanager |
|
||||
| quartz-manager.persistence.quartz.datasource.user | string | yes | | |
|
||||
| quartz-manager.persistence.quartz.datasource.password | string | yes | | |
|
||||
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
You can find some examples of different scenarios of projects which import Quartz Manager at the repository [quartz-manager-use-cases] (https://github.com/fabioformosa/quartz-manager-use-cases)
|
||||
* *simply-spring* - tipical scenario in which you create a minimal spring project from scratch dedicated to launch your scheduled jobs. Imported libraries: Quartz Manager API, Quartz Manager UI and Quartz Manager security.
|
||||
* *simply-spring-no-security* - as simple-spring, without the security
|
||||
* *existing-security-cookie-based* - It demonstrates how Quartz Manager stays under the security of your project, in case of an auth model based on cookies
|
||||
* *existing-security-header-based* - It demonstrates how Quartz Manager Security can coexists with another Spring Security Config present in your project
|
||||
* *existing-quartz* - It demonstrates how to Quartz Manager can coexist with a Quartz instance already present in your project
|
||||
* *existing-quartz-and-storage* - It demonstrates how to Quartz Manager Persistence can coexist with a Quartz instance already present in your project
|
||||
|
||||
|
||||
## Limitations
|
||||
|
||||
> Step by step, day by day
|
||||
|
||||
Quartz Manager has a work-in-progress roadmap to be full-fledged library to manage a [Quartz Scheduler](http://www.quartz-scheduler.org/).
|
||||
|
||||
At this stage of the roadmap, these are the limitations:
|
||||
* Currently you cannot start multiple triggers or multiple jobs. At the moment a workaround is to launch multiple projects based on Quartz Manager.
|
||||
* Currently you can only start [Quartz Simple Trigger](http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/tutorial-lesson-05.html). The support to other kind of triggers will come soon: [Calendar Interval Trigger](https://www.quartz-scheduler.org/api/2.3.0/org/quartz/CalendarIntervalTrigger.html), [Cron Interval Trigger](https://www.quartz-scheduler.org/api/2.3.0/org/quartz/CronTrigger.html), [Daily Interval Trigger](https://www.quartz-scheduler.org/api/2.3.0/org/quartz/DailyTimeIntervalTrigger.html)
|
||||
* Currently the cluster mode is not supported
|
||||
* Currently the persistence of Quartz Manager supports only the PostgreSQL. The support to other king of triggers will come soon: MySQL, MariaDB, SqlServer, Oracle, H2.
|
||||
|
||||
## ROADMAP
|
||||
|
||||
Take a look a the [Project Roadmap](https://github.com/users/fabioformosa/projects/1).
|
||||
Don't hesitate to give your feedback, your opinion is important to understand the priority.
|
||||
|
||||
Next steps in the roadmap are:
|
||||
* Manage multiple triggers and jobs
|
||||
* Cluster mode support
|
||||
* Support to other all types of Quartz Triggers: [Calendar Interval Trigger](https://www.quartz-scheduler.org/api/2.3.0/org/quartz/CalendarIntervalTrigger.html), [Cron Interval Trigger](https://www.quartz-scheduler.org/api/2.3.0/org/quartz/CronTrigger.html), [Daily Interval Trigger](https://www.quartz-scheduler.org/api/2.3.0/org/quartz/DailyTimeIntervalTrigger.html)
|
||||
* UI Re-styling
|
||||
* OAuth Client
|
||||
* Support to other DBMS than PostreSQL: MySQL, MariaDB, SqlServer, Oracle, H2.
|
||||
|
||||
## Repository
|
||||
|
||||
Checkout the **master branch** to get the sourcecode of the latest released versions.
|
||||
Checkout the **develop branch** to take a look at the sourcecode of the incoming release.
|
||||
|
||||
## HOW-TO CONTRIBUTE
|
||||
|
||||
For tech details, how-to run locally the project and how-to contribute, reach out this other [README.md](https://github.com/fabioformosa/quartz-manager/blob/develop/quartz-manager-parent/README.md)
|
||||
|
||||
## ❤️ SUPPORT THE PROJECT ❤️
|
||||
|
||||
Sometimes it's a matter of a kind action. You can support Quartz Manager and its continuous improvement turning on a github star on this project ⭐
|
||||
|
||||
13
quartz-manager-frontend/.editorconfig
Normal file
13
quartz-manager-frontend/.editorconfig
Normal file
@@ -0,0 +1,13 @@
|
||||
# Editor configuration, see http://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
||||
42
quartz-manager-frontend/.gitignore
vendored
Normal file
42
quartz-manager-frontend/.gitignore
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
# 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
|
||||
119
quartz-manager-frontend/angular.json
Normal file
119
quartz-manager-frontend/angular.json
Normal file
@@ -0,0 +1,119 @@
|
||||
{
|
||||
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||
"version": 1,
|
||||
"newProjectRoot": "projects",
|
||||
"projects": {
|
||||
"angular-spring-starter": {
|
||||
"root": "",
|
||||
"prefix": "qrzmng",
|
||||
"sourceRoot": "src",
|
||||
"projectType": "application",
|
||||
"architect": {
|
||||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:browser",
|
||||
"options": {
|
||||
"aot": true,
|
||||
"outputPath": "dist",
|
||||
"index": "src/index.html",
|
||||
"main": "src/main.ts",
|
||||
"tsConfig": "src/tsconfig.app.json",
|
||||
"polyfills": "src/polyfills.ts",
|
||||
"assets": [
|
||||
"src/assets",
|
||||
"src/favicon.ico"
|
||||
],
|
||||
"styles": [
|
||||
"src/styles.css"
|
||||
],
|
||||
"scripts": []
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"budgets": [
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "6kb"
|
||||
}
|
||||
],
|
||||
"optimization": true,
|
||||
"outputHashing": "all",
|
||||
"sourceMap": false,
|
||||
"extractCss": true,
|
||||
"namedChunks": false,
|
||||
"aot": true,
|
||||
"extractLicenses": true,
|
||||
"vendorChunk": false,
|
||||
"buildOptimizer": true,
|
||||
"fileReplacements": [
|
||||
{
|
||||
"replace": "src/environments/environment.ts",
|
||||
"with": "src/environments/environment.prod.ts"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"serve": {
|
||||
"builder": "@angular-devkit/build-angular:dev-server",
|
||||
"options": {
|
||||
"browserTarget": "angular-spring-starter:build"
|
||||
},
|
||||
"configurations": {
|
||||
"production": {
|
||||
"browserTarget": "angular-spring-starter:build:production"
|
||||
}
|
||||
}
|
||||
},
|
||||
"extract-i18n": {
|
||||
"builder": "@angular-devkit/build-angular:extract-i18n",
|
||||
"options": {
|
||||
"browserTarget": "angular-spring-starter:build"
|
||||
}
|
||||
},
|
||||
"lint": {
|
||||
"builder": "@angular-devkit/build-angular:tslint",
|
||||
"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": []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultProject": "angular-spring-starter",
|
||||
"schematics": {
|
||||
"@schematics/angular:component": {
|
||||
"prefix": "qrzmng",
|
||||
"style": "css"
|
||||
},
|
||||
"@schematics/angular:directive": {
|
||||
"prefix": "qrzmng"
|
||||
}
|
||||
}
|
||||
}
|
||||
12
quartz-manager-frontend/browserslist
Normal file
12
quartz-manager-frontend/browserslist
Normal file
@@ -0,0 +1,12 @@
|
||||
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
||||
# For additional information regarding the format and rule options, please see:
|
||||
# https://github.com/browserslist/browserslist#queries
|
||||
|
||||
# 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'.
|
||||
14
quartz-manager-frontend/e2e/app.e2e-spec.ts
Normal file
14
quartz-manager-frontend/e2e/app.e2e-spec.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { WebUiPage } from './app.po';
|
||||
|
||||
describe('web-ui App', () => {
|
||||
let page: WebUiPage;
|
||||
|
||||
beforeEach(() => {
|
||||
page = new WebUiPage();
|
||||
});
|
||||
|
||||
it('should display message saying app works', () => {
|
||||
page.navigateTo();
|
||||
expect(page.getParagraphText()).toContain('ANGULAR-SPRING-JWT-STARTER');
|
||||
});
|
||||
});
|
||||
11
quartz-manager-frontend/e2e/app.po.ts
Normal file
11
quartz-manager-frontend/e2e/app.po.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { browser, element, by } from 'protractor';
|
||||
|
||||
export class WebUiPage {
|
||||
navigateTo() {
|
||||
return browser.get('/');
|
||||
}
|
||||
|
||||
getParagraphText() {
|
||||
return element(by.css('app-root app-header span')).getText();
|
||||
}
|
||||
}
|
||||
12
quartz-manager-frontend/e2e/tsconfig.e2e.json
Normal file
12
quartz-manager-frontend/e2e/tsconfig.e2e.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/e2e",
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"types":[
|
||||
"jasmine",
|
||||
"node"
|
||||
]
|
||||
}
|
||||
}
|
||||
1
quartz-manager-frontend/jest.setup.ts
Normal file
1
quartz-manager-frontend/jest.setup.ts
Normal file
@@ -0,0 +1 @@
|
||||
import 'jest-preset-angular';
|
||||
42
quartz-manager-frontend/karma.conf.js
Normal file
42
quartz-manager-frontend/karma.conf.js
Normal file
@@ -0,0 +1,42 @@
|
||||
// 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
|
||||
});
|
||||
};
|
||||
18628
quartz-manager-frontend/package-lock.json
generated
Normal file
18628
quartz-manager-frontend/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
76
quartz-manager-frontend/package.json
Normal file
76
quartz-manager-frontend/package.json
Normal file
@@ -0,0 +1,76 @@
|
||||
{
|
||||
"name": "quartz-manager-ui",
|
||||
"version": "0.1.1",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve --proxy-config proxy.conf.json",
|
||||
"build": "ng build --prod",
|
||||
"test": "jest",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@angular-material-components/datetime-picker": "2.0.4",
|
||||
"@angular-material-components/moment-adapter": "2.0.2",
|
||||
"@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",
|
||||
"@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",
|
||||
"@types/jest": "^27.0.2",
|
||||
"core-js": "2.5.1",
|
||||
"hammerjs": "2.0.8",
|
||||
"moment": "^2.29.1",
|
||||
"net": "^1.0.2",
|
||||
"rxjs": "6.5.5",
|
||||
"stompjs": "^2.3.3",
|
||||
"tslib": "^1.10.0",
|
||||
"zone.js": "~0.10.2"
|
||||
},
|
||||
"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",
|
||||
"@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"
|
||||
]
|
||||
}
|
||||
}
|
||||
30
quartz-manager-frontend/protractor.conf.js
Normal file
30
quartz-manager-frontend/protractor.conf.js
Normal file
@@ -0,0 +1,30 @@
|
||||
// Protractor configuration file, see link for more information
|
||||
// https://github.com/angular/protractor/blob/master/lib/config.ts
|
||||
|
||||
const { SpecReporter } = require('jasmine-spec-reporter');
|
||||
|
||||
exports.config = {
|
||||
allScriptsTimeout: 11000,
|
||||
specs: [
|
||||
'./e2e/**/*.e2e-spec.ts'
|
||||
],
|
||||
capabilities: {
|
||||
'browserName': 'chrome'
|
||||
},
|
||||
directConnect: true,
|
||||
baseUrl: 'http://localhost:4200/',
|
||||
framework: 'jasmine',
|
||||
jasmineNodeOpts: {
|
||||
showColors: true,
|
||||
defaultTimeoutInterval: 30000,
|
||||
print: function() {}
|
||||
},
|
||||
beforeLaunch: function() {
|
||||
require('ts-node').register({
|
||||
project: 'e2e/tsconfig.e2e.json'
|
||||
});
|
||||
},
|
||||
onPrepare() {
|
||||
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
|
||||
}
|
||||
};
|
||||
8
quartz-manager-frontend/proxy.conf.json
Normal file
8
quartz-manager-frontend/proxy.conf.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"/quartz-manager": {
|
||||
"target": "http://localhost:8080",
|
||||
"secure": false,
|
||||
"cookiePathRewrite": "/",
|
||||
"ws":true
|
||||
}
|
||||
}
|
||||
32
quartz-manager-frontend/src/_test.ts
Normal file
32
quartz-manager-frontend/src/_test.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
// 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();
|
||||
7
quartz-manager-frontend/src/animate.css
vendored
Normal file
7
quartz-manager-frontend/src/animate.css
vendored
Normal file
File diff suppressed because one or more lines are too long
54
quartz-manager-frontend/src/app/app-routing.module.ts
Normal file
54
quartz-manager-frontend/src/app/app-routing.module.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
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';
|
||||
|
||||
export const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: ManagerComponent,
|
||||
canActivate: [AdminGuard],
|
||||
pathMatch: 'full'
|
||||
},
|
||||
{
|
||||
path: 'manager',
|
||||
component: ManagerComponent,
|
||||
canActivate: [AdminGuard],
|
||||
pathMatch: 'full'
|
||||
},
|
||||
{
|
||||
path: 'login',
|
||||
component: LoginComponent,
|
||||
canActivate: [GuestGuard]
|
||||
},
|
||||
{
|
||||
path: '404',
|
||||
component: NotFoundComponent
|
||||
},
|
||||
{
|
||||
path: '403',
|
||||
component: ForbiddenComponent
|
||||
},
|
||||
{
|
||||
path: 'error',
|
||||
component: GenericErrorComponent
|
||||
},
|
||||
{
|
||||
path: '**',
|
||||
redirectTo: '/404'
|
||||
}
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forRoot(routes, {
|
||||
initialNavigation: false
|
||||
})],
|
||||
exports: [RouterModule],
|
||||
providers: []
|
||||
})
|
||||
export class AppRoutingModule { }
|
||||
8
quartz-manager-frontend/src/app/app.component.html
Normal file
8
quartz-manager-frontend/src/app/app.component.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<div fxLayout="column" fxLayoutAlign="space-between stretch" fxFill>
|
||||
<app-header fxFlex="0 0 auto"></app-header>
|
||||
<div class="content" fxFlex="100" fxFill>
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
<app-footer fxFlex="0 0 auto"></app-footer>
|
||||
</div>
|
||||
|
||||
10
quartz-manager-frontend/src/app/app.component.scss
Normal file
10
quartz-manager-frontend/src/app/app.component.scss
Normal file
@@ -0,0 +1,10 @@
|
||||
:host {
|
||||
display: block;
|
||||
color: rgba(0,0,0,.54);
|
||||
font-family: Roboto,"Helvetica Neue";
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 20px;
|
||||
}
|
||||
51
quartz-manager-frontend/src/app/app.component.spec.ts
Normal file
51
quartz-manager-frontend/src/app/app.component.spec.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import { TestBed, async } from '@angular/core/testing';
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { AppComponent } from './app.component';
|
||||
import { MockApiService } from './services/mocks/api.service.mock';
|
||||
|
||||
import { FooterComponent} from './components';
|
||||
|
||||
import {MatIconRegistry} from '@angular/material/icon';
|
||||
import {MatToolbarModule} from '@angular/material/toolbar';
|
||||
|
||||
|
||||
import {
|
||||
ApiService,
|
||||
AuthService,
|
||||
UserService,
|
||||
ConfigService
|
||||
} from './services';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
FooterComponent,
|
||||
],
|
||||
imports: [
|
||||
RouterTestingModule,
|
||||
MatToolbarModule
|
||||
],
|
||||
providers: [
|
||||
MatIconRegistry,
|
||||
{
|
||||
provide: ApiService,
|
||||
useClass: MockApiService
|
||||
},
|
||||
AuthService,
|
||||
UserService,
|
||||
ConfigService
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
it('should create the app', async(() => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
}));
|
||||
|
||||
});
|
||||
15
quartz-manager-frontend/src/app/app.component.ts
Normal file
15
quartz-manager-frontend/src/app/app.component.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import {Component} from '@angular/core';
|
||||
|
||||
// I remove temporary fontawesome5 and downgrade to fontawesome4
|
||||
import fontawesome from '@fortawesome/fontawesome';
|
||||
import solid from '@fortawesome/fontawesome-free-solid/';
|
||||
fontawesome.library.add(solid);
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.scss']
|
||||
})
|
||||
|
||||
export class AppComponent {
|
||||
}
|
||||
187
quartz-manager-frontend/src/app/app.module.ts
Normal file
187
quartz-manager-frontend/src/app/app.module.ts
Normal file
@@ -0,0 +1,187 @@
|
||||
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 {JWT_OPTIONS, JwtModule} from '@auth0/angular-jwt';
|
||||
|
||||
// material
|
||||
import {MatIconRegistry} from '@angular/material/icon';
|
||||
import {MatInputModule} from '@angular/material/input';
|
||||
import {MatChipsModule} from '@angular/material/chips';
|
||||
import {MatTooltipModule} from '@angular/material/tooltip';
|
||||
import {MatProgressBarModule} from '@angular/material/progress-bar';
|
||||
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
|
||||
import {MatMenuModule} from '@angular/material/menu';
|
||||
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 {MatDatepickerModule} from '@angular/material/datepicker';
|
||||
import {MatSelectModule} from '@angular/material/select';
|
||||
import {MatListModule} from '@angular/material/list';
|
||||
import {MatSidenavModule} from '@angular/material/sidenav';
|
||||
|
||||
import {MatNativeDateModule} from '@angular/material/core';
|
||||
import { NgxMatTimepickerModule, NgxMatDatetimePickerModule} from '@angular-material-components/datetime-picker';
|
||||
import { NgxMatMomentModule } from '@angular-material-components/moment-adapter';
|
||||
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||
import { AppComponent } from './app.component';
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { ManagerComponent } from './views/manager';
|
||||
import { LoginComponent } from './views/login';
|
||||
import { LoginGuard, GuestGuard, AdminGuard } from './guards';
|
||||
import { NotFoundComponent } from './views/not-found';
|
||||
import { AccountMenuComponent } from './components/header/account-menu/account-menu.component';
|
||||
|
||||
import {
|
||||
HeaderComponent,
|
||||
FooterComponent,
|
||||
GithubComponent,
|
||||
SchedulerControlComponent,
|
||||
LogsPanelComponent,
|
||||
ProgressPanelComponent,
|
||||
TriggerListComponent
|
||||
} from './components';
|
||||
|
||||
import {
|
||||
ApiService,
|
||||
AuthService,
|
||||
UserService,
|
||||
SchedulerService,
|
||||
ConfigService,
|
||||
ProgressWebsocketService,
|
||||
LogsWebsocketService,
|
||||
getHtmlBaseUrl,
|
||||
TriggerService
|
||||
} from './services';
|
||||
import { ForbiddenComponent } from './views/forbidden/forbidden.component';
|
||||
import { APP_BASE_HREF } from '@angular/common';
|
||||
import {SimpleTriggerConfigComponent} from './components/simple-trigger-config';
|
||||
import JobService from './services/job.service';
|
||||
import {GenericErrorComponent} from './views/error/genericError.component';
|
||||
|
||||
export function initUserFactory(userService: UserService) {
|
||||
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']
|
||||
}
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
HeaderComponent,
|
||||
FooterComponent,
|
||||
ManagerComponent,
|
||||
GithubComponent,
|
||||
LoginComponent,
|
||||
NotFoundComponent,
|
||||
AccountMenuComponent,
|
||||
SimpleTriggerConfigComponent,
|
||||
SchedulerControlComponent,
|
||||
LogsPanelComponent,
|
||||
ProgressPanelComponent,
|
||||
ForbiddenComponent,
|
||||
GenericErrorComponent,
|
||||
TriggerListComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserAnimationsModule,
|
||||
BrowserModule,
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
HttpClientModule,
|
||||
AppRoutingModule,
|
||||
JwtModule.forRoot({
|
||||
jwtOptionsProvider: {
|
||||
provide: JWT_OPTIONS,
|
||||
useFactory: jwtOptionsFactory,
|
||||
deps: [ApiService]
|
||||
}
|
||||
}),
|
||||
MatMenuModule,
|
||||
MatTooltipModule,
|
||||
MatButtonModule,
|
||||
MatChipsModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatSelectModule,
|
||||
MatToolbarModule,
|
||||
MatCardModule,
|
||||
MatListModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatProgressBarModule,
|
||||
MatDatepickerModule, MatNativeDateModule,
|
||||
NgxMatMomentModule,
|
||||
NgxMatDatetimePickerModule,
|
||||
MatSidenavModule,
|
||||
FlexLayoutModule
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
provide: APP_BASE_HREF,
|
||||
useValue: getHtmlBaseUrl()
|
||||
},
|
||||
{
|
||||
'provide': APP_INITIALIZER,
|
||||
'useFactory': initUserFactory,
|
||||
'deps': [UserService],
|
||||
'multi': true
|
||||
},
|
||||
LoginGuard,
|
||||
GuestGuard,
|
||||
AdminGuard,
|
||||
SchedulerService,
|
||||
JobService,
|
||||
TriggerService,
|
||||
ProgressWebsocketService,
|
||||
LogsWebsocketService,
|
||||
AuthService,
|
||||
ApiService,
|
||||
UserService,
|
||||
ConfigService,
|
||||
MatIconRegistry
|
||||
// StompService,
|
||||
// ServerSocket
|
||||
// {
|
||||
// provide: StompConfig,
|
||||
// useValue: stompConfig
|
||||
// }
|
||||
],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule { }
|
||||
@@ -0,0 +1,8 @@
|
||||
<mat-toolbar id="footer" style="color: rgba(255, 255, 255, 0.541176);" fxLayout="row" fxLayoutAlign="center center">
|
||||
<a mat-icon-button href="https://github.com/fabioformosa/quartz-manager">
|
||||
<img src="assets/image/github.png"/>
|
||||
Quartz Manager
|
||||
</a>
|
||||
<!-- Hand crafted with love by -->
|
||||
<!-- <a href="https://github.com/fabioformosa" style="color: rgba(255, 255, 255, 0.870588);">Fabio Formosa</a>-->
|
||||
</mat-toolbar>
|
||||
@@ -0,0 +1,27 @@
|
||||
:host{
|
||||
//position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 64px;
|
||||
}
|
||||
|
||||
#footer{
|
||||
background-color: rgb(33, 33, 33);
|
||||
font-size: 15px;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
a {
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
font-weight: 300;
|
||||
font-size: 22px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-footer',
|
||||
templateUrl: './footer.component.html',
|
||||
styleUrls: ['./footer.component.scss']
|
||||
})
|
||||
export class FooterComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './footer.component';
|
||||
@@ -0,0 +1,4 @@
|
||||
<h3>Want to help make this project? Check out repo.</h3>
|
||||
<a href="https://github.com/fabioformosa/quartz-manager" color="accent" mat-raised-button mat-ripple>
|
||||
<span>GITHUB</span>
|
||||
</a>
|
||||
@@ -0,0 +1,20 @@
|
||||
:host {
|
||||
display: block;
|
||||
height: 236px;
|
||||
padding: 72px 24px;
|
||||
box-sizing: border-box;
|
||||
background-color: rgb(238, 238, 238);
|
||||
text-align: center
|
||||
}
|
||||
|
||||
:host h3 {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
font-weight: 300;
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
:host a {
|
||||
color: #000;
|
||||
margin-top: 32px;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-github',
|
||||
templateUrl: './github.component.html',
|
||||
styleUrls: ['./github.component.scss']
|
||||
})
|
||||
export class GithubComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './github.component';
|
||||
@@ -0,0 +1 @@
|
||||
<button mat-menu-item (click)="logout()">Logout</button>
|
||||
@@ -0,0 +1,53 @@
|
||||
import { async, ComponentFixture, TestBed, inject } from '@angular/core/testing';
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
||||
import {
|
||||
AuthService,
|
||||
ConfigService,
|
||||
ApiService,
|
||||
UserService
|
||||
} from '../../../services';
|
||||
import {
|
||||
MockUserService,
|
||||
MockApiService
|
||||
} from '../../../services/mocks';
|
||||
import { AccountMenuComponent } from './account-menu.component';
|
||||
|
||||
describe('AccountMenuComponent', () => {
|
||||
let component: AccountMenuComponent;
|
||||
let fixture: ComponentFixture<AccountMenuComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
RouterTestingModule
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
provide: UserService,
|
||||
useClass: MockUserService
|
||||
},
|
||||
{
|
||||
provide: ApiService,
|
||||
useClass: MockApiService
|
||||
},
|
||||
AuthService,
|
||||
ConfigService
|
||||
],
|
||||
declarations: [AccountMenuComponent],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AccountMenuComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,35 @@
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import {
|
||||
ConfigService,
|
||||
AuthService,
|
||||
UserService
|
||||
} from '../../../services';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-account-menu',
|
||||
templateUrl: './account-menu.component.html',
|
||||
styleUrls: ['./account-menu.component.scss']
|
||||
})
|
||||
export class AccountMenuComponent implements OnInit {
|
||||
|
||||
// TODO define user interface
|
||||
user: any;
|
||||
|
||||
constructor(
|
||||
private config: ConfigService,
|
||||
private authService: AuthService,
|
||||
private router: Router,
|
||||
private userService: UserService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.user = this.userService.currentUser;
|
||||
}
|
||||
|
||||
logout() {
|
||||
this.authService.logout().subscribe(res => {
|
||||
this.router.navigate(['/login']);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<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() && !noAuthenticationRequired()" 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>
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
:host {
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
// The menu popup is rendered outside the header component
|
||||
// so we will restyle a couple things inside a global /deep/ selector
|
||||
|
||||
.app-navbar {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.right {
|
||||
margin-left: auto;
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
|
||||
.app-navbar span {
|
||||
text-transform: uppercase !important;
|
||||
}
|
||||
|
||||
.app-angular-logo {
|
||||
margin: 0 4px 3px 0;
|
||||
height: 26px;
|
||||
}
|
||||
|
||||
.greeting-hamburger {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
::ng-deep {
|
||||
.app-header-accountMenu.mat-menu-panel {
|
||||
border-radius: 3px;
|
||||
max-width: initial;
|
||||
overflow: visible;
|
||||
|
||||
.mat-menu-content {
|
||||
max-width: initial;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
display: inline-block;
|
||||
margin-bottom: -6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 600px) {
|
||||
.greeting-hamburger {
|
||||
display: block;
|
||||
}
|
||||
.greeting-button {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import {
|
||||
UserService,
|
||||
AuthService,
|
||||
// NO_AUTH
|
||||
} from '../../services';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-header',
|
||||
templateUrl: './header.component.html',
|
||||
styleUrls: ['./header.component.scss']
|
||||
})
|
||||
export class HeaderComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private userService: UserService,
|
||||
private authService: AuthService,
|
||||
private router: Router
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
logout() {
|
||||
this.authService.logout().subscribe(res => {
|
||||
this.router.navigate(['/login']);
|
||||
});
|
||||
}
|
||||
|
||||
hasSignedIn() {
|
||||
return !!this.userService.currentUser;
|
||||
}
|
||||
|
||||
noAuthenticationRequired = () => !this.hasSignedIn() && this.userService.isAnAnonymousUser === true;
|
||||
|
||||
|
||||
userName() {
|
||||
const user = this.userService.currentUser;
|
||||
return user.username;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './header.component';
|
||||
7
quartz-manager-frontend/src/app/components/index.ts
Normal file
7
quartz-manager-frontend/src/app/components/index.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export * from './header';
|
||||
export * from './github';
|
||||
export * from './footer';
|
||||
export * from './logs-panel';
|
||||
export * from './scheduler-control';
|
||||
export * from './progress-panel';
|
||||
export * from './trigger-list';
|
||||
@@ -0,0 +1 @@
|
||||
export * from './logs-panel.component';
|
||||
@@ -0,0 +1,35 @@
|
||||
<mat-card fxFlex="1 1 auto">
|
||||
<mat-card-header fxLayout="row" fxLayoutAlign="space-between none" style="padding-right: 1em;">
|
||||
<mat-card-subtitle><b>JOB LOGS</b></mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
<mat-card-content style="position: relative; height: calc(100% - 3em);">
|
||||
<div *ngIf="!logs || logs.length == 0" fxLayout="row" fxFlexAlign="center stretch" style="text-align: center">
|
||||
<div fxFill style="height: 100%;">
|
||||
<img src="assets/image/logs.svg" alt="no logs" width="320" style="margin-top: 6em;" />
|
||||
</div>
|
||||
</div>
|
||||
<div id="logs" style="overflow-y: auto; position: absolute; left: 0; right: 0; top: 0; bottom: 0; overflow: auto;">
|
||||
<div
|
||||
*ngFor = "let log of logs; let first = first" fxLayout="row" fxLayout.xs="column" fxLayoutAlign="start" fxLayoutGap="10px">
|
||||
<div fxFlex="0 1 300px">
|
||||
<span [ngClass]="{'animate__animated animate__zoomIn zoomIn firstLog': first}"> [{{log.time|date:'medium'}}]</span>
|
||||
</div>
|
||||
<div fxFlex="1 1 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 fxFlex="0 1 250px">
|
||||
<span [ngClass]="{'animate__animated animate__zoomIn zoomIn firstLog': first}">
|
||||
{{log.threadName}}
|
||||
</span>
|
||||
</div>
|
||||
<div fxFlex="1 1">
|
||||
<span [ngClass]="{'animate__animated animate__zoomIn zoomIn firstLog': first}"> {{log.msg}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
@@ -0,0 +1,36 @@
|
||||
.red{
|
||||
color: red;
|
||||
}
|
||||
.green{
|
||||
color: green;
|
||||
}
|
||||
|
||||
.yellow{
|
||||
color: gold;
|
||||
}
|
||||
|
||||
#logs{
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
/* ===== 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;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import {Component, OnInit, Input, Output, EventEmitter} from '@angular/core';
|
||||
|
||||
import {LogsWebsocketService, ApiService} from '../../services';
|
||||
import {Observable} from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'logs-panel',
|
||||
templateUrl: './logs-panel.component.html',
|
||||
styleUrls: ['./logs-panel.component.scss']
|
||||
})
|
||||
export class LogsPanelComponent implements OnInit {
|
||||
|
||||
MAX_LOGS = 30;
|
||||
|
||||
logs = new Array();
|
||||
|
||||
constructor(
|
||||
private logsWebsocketService: LogsWebsocketService,
|
||||
private apiService: ApiService
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
const 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
|
||||
};
|
||||
|
||||
_showNewLog = (logRecord) => {
|
||||
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
|
||||
});
|
||||
}
|
||||
|
||||
_refreshSession = () => {
|
||||
this.apiService.get('/quartz-manager/session/refresh')
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './progress-panel.component';
|
||||
@@ -0,0 +1,43 @@
|
||||
<!-- <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">
|
||||
<mat-card-header>
|
||||
<mat-card-subtitle><b>JOB PROGRESS</b></mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
<mat-card-content>
|
||||
<div id="progressBarBox" *ngIf="progress.percentage !== -1">
|
||||
<mat-progress-bar mode="determinate" value="{{progress.percentage}}"></mat-progress-bar>
|
||||
{{percentageStr}}
|
||||
</div>
|
||||
|
||||
<div id="counterBox" fxLayout="row" fxLayoutAlign="center" *ngIf="progress.timesTriggered">
|
||||
<span id="timesTriggeredCounter" class="animated pulse">{{progress.timesTriggered}}</span>
|
||||
<span id="totCounter" *ngIf="progress.repeatCount > 0"> / {{progress.repeatCount}} </span>
|
||||
</div>
|
||||
<mat-divider *ngIf="progress.timesTriggered"></mat-divider>
|
||||
|
||||
<div fxLayout="row" fxLayoutAlign="space-around center">
|
||||
<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>
|
||||
@@ -0,0 +1,33 @@
|
||||
#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;
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'
|
||||
import {ProgressWebsocketService, QuartzManagerWebsocketMessage} from '../../services';
|
||||
|
||||
import { Observable } from 'rxjs';
|
||||
import TriggerFiredBundle from '../../model/trigger-fired-bundle.model';
|
||||
// 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']
|
||||
})
|
||||
export class ProgressPanelComponent implements OnInit {
|
||||
|
||||
progress: TriggerFiredBundle = new TriggerFiredBundle();
|
||||
percentageStr: string;
|
||||
|
||||
// // 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 progressWebsocketService: ProgressWebsocketService,
|
||||
// private _stompService: StompService,
|
||||
// private serverSocket : ServerSocket
|
||||
) { }
|
||||
|
||||
onNewProgressMsg = (receivedMsg: QuartzManagerWebsocketMessage) => {
|
||||
if (receivedMsg.type === 'SUCCESS') {
|
||||
const newStatus = receivedMsg.message;
|
||||
this.progress = newStatus;
|
||||
this.percentageStr = this.progress.percentage + '%';
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
const 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);
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './scheduler-control.component';
|
||||
@@ -0,0 +1,26 @@
|
||||
<mat-card>
|
||||
<mat-card-content>
|
||||
<div fxLayout="row" fxLayoutAlign="left stretch" fxLayoutGap="30px">
|
||||
<button id="schedulerControllerBtn" mat-raised-button class="btn btn-default large-btn" (click)="startOrPause()">
|
||||
<span *ngIf = "scheduler?.status === 'RUNNING'">
|
||||
<i class="fas fa-pause red"></i>
|
||||
</span>
|
||||
<span *ngIf = "scheduler?.status === 'STOPPED' || scheduler?.status === 'PAUSED'">
|
||||
<i class="fas fa-play green"></i>
|
||||
</span>
|
||||
</button>
|
||||
<div fxLayout="column center">
|
||||
<mat-card-subtitle style="margin: auto;"><b>SCHEDULER</b></mat-card-subtitle>
|
||||
</div>
|
||||
<mat-divider [vertical]="true"></mat-divider>
|
||||
<div fxLayout="column">
|
||||
<div><label>Name</label></div>
|
||||
<div><span id="scheduler-name">{{scheduler?.name}}</span></div>
|
||||
</div>
|
||||
<div fxLayout="column">
|
||||
<div><label>Instance ID</label></div>
|
||||
<div><span id="scheduler-instance">{{scheduler?.instanceId}}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
@@ -0,0 +1,17 @@
|
||||
.red{
|
||||
color: red;
|
||||
}
|
||||
.green{
|
||||
color: green;
|
||||
}
|
||||
|
||||
label{
|
||||
color: grey;
|
||||
font-variant: small-caps;
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
#scheduler-name{
|
||||
text-transform: capitalize;
|
||||
font-size: larger;
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
import {async, ComponentFixture, TestBed} 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', () => {
|
||||
|
||||
let component: SchedulerControlComponent;
|
||||
let fixture: ComponentFixture<SchedulerControlComponent>;
|
||||
|
||||
let httpClient: HttpClient;
|
||||
let httpTestingController: HttpTestingController;
|
||||
|
||||
beforeEach(async(() => {
|
||||
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('/quartz-manager/scheduler');
|
||||
const mockScheduler = new Scheduler('test-scheduler', 'test-id', 'STOPPED', []);
|
||||
getSchedulerReq.flush(mockScheduler);
|
||||
|
||||
expect(component.scheduler).toEqual(mockScheduler);
|
||||
expect(component.scheduler.status).toEqual('STOPPED');
|
||||
fixture.detectChanges();
|
||||
|
||||
const schedulerControlComponentDe: DebugElement = fixture.debugElement;
|
||||
const schedulerBtnDe = schedulerControlComponentDe.query(By.css('#schedulerControllerBtn'));
|
||||
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('/quartz-manager/scheduler');
|
||||
const mockScheduler = new Scheduler('test-scheduler', 'test-id', 'STOPPED', []);
|
||||
getSchedulerReq.flush(mockScheduler);
|
||||
fixture.detectChanges();
|
||||
|
||||
const schedulerControlComponentDe: DebugElement = fixture.debugElement;
|
||||
let schedulerBtnDe = schedulerControlComponentDe.query(By.css('#schedulerControllerBtn'));
|
||||
expect(schedulerBtnDe).toBeTruthy();
|
||||
const playIconDe = schedulerBtnDe.query(By.css('.fa-play'));
|
||||
expect(playIconDe).toBeTruthy();
|
||||
|
||||
schedulerBtnDe.nativeElement.click();
|
||||
const startSchedulerReq = httpTestingController.expectOne('/quartz-manager/scheduler/run');
|
||||
startSchedulerReq.flush(null);
|
||||
fixture.detectChanges();
|
||||
|
||||
schedulerBtnDe = schedulerControlComponentDe.query(By.css('#schedulerControllerBtn'));
|
||||
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('/quartz-manager/scheduler');
|
||||
const mockScheduler = new Scheduler('test-scheduler', 'test-id', 'RUNNING', []);
|
||||
getSchedulerReq.flush(mockScheduler);
|
||||
fixture.detectChanges();
|
||||
|
||||
const schedulerControlComponentDe: DebugElement = fixture.debugElement;
|
||||
let schedulerBtnDe = schedulerControlComponentDe.query(By.css('#schedulerControllerBtn'));
|
||||
expect(schedulerBtnDe).toBeTruthy();
|
||||
const pauseIconDe = schedulerBtnDe.query(By.css('.fa-pause'));
|
||||
expect(pauseIconDe).toBeTruthy();
|
||||
|
||||
schedulerBtnDe.nativeElement.click();
|
||||
const startSchedulerReq = httpTestingController.expectOne('/quartz-manager/scheduler/pause');
|
||||
startSchedulerReq.flush(null);
|
||||
fixture.detectChanges();
|
||||
|
||||
schedulerBtnDe = schedulerControlComponentDe.query(By.css('#schedulerControllerBtn'));
|
||||
const playIconDe = schedulerBtnDe.query(By.css('.fa-play'));
|
||||
expect(playIconDe).toBeTruthy();
|
||||
|
||||
})
|
||||
|
||||
});
|
||||
@@ -0,0 +1,81 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {SchedulerService, UserService} from '../../services';
|
||||
import {Scheduler} from '../../model/scheduler.model';
|
||||
|
||||
@Component({
|
||||
selector: 'qrzmng-scheduler-control',
|
||||
templateUrl: './scheduler-control.component.html',
|
||||
styleUrls: ['./scheduler-control.component.scss']
|
||||
})
|
||||
export class SchedulerControlComponent implements OnInit {
|
||||
|
||||
scheduler: Scheduler;
|
||||
|
||||
constructor(
|
||||
private userService: UserService,
|
||||
private schedulerService: SchedulerService
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this._getScheduler();
|
||||
}
|
||||
|
||||
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.scheduler.status = 'STOPPED'
|
||||
}, (res) => {
|
||||
console.log(JSON.stringify(res))
|
||||
});
|
||||
};
|
||||
|
||||
pauseScheduler = function () {
|
||||
this.schedulerService.pauseScheduler().subscribe((res) => {
|
||||
this.scheduler.status = 'PAUSED'
|
||||
}, (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.scheduler.status !== 'STOPPED') {
|
||||
this.stopScheduler();
|
||||
}
|
||||
}
|
||||
|
||||
startOrPause = function () {
|
||||
switch (this.scheduler.status) {
|
||||
case 'RUNNING':
|
||||
this.pauseScheduler();
|
||||
break;
|
||||
case 'PAUSED':
|
||||
this.resumeScheduler();
|
||||
break;
|
||||
default:
|
||||
this.startScheduler();
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './simple-trigger-config.component';
|
||||
export {SimpleTriggerCommand} from '../../model/simple-trigger.command';
|
||||
@@ -0,0 +1,198 @@
|
||||
<mat-card fxFlex="1 1 auto">
|
||||
<mat-card-header>
|
||||
<mat-card-subtitle><b>TRIGGER DETAILS</b></mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
<mat-divider></mat-divider>
|
||||
<mat-card-content *ngIf="shouldShowTheTriggerCardContent()" style="position: relative; height: 100%">
|
||||
<div fxLayout="column" style="overflow-y: auto; position: absolute; left: 0; right: 0; top: 0; bottom: 0;
|
||||
overflow: auto;height: calc(100% - 3em); padding-top: 1em;">
|
||||
<mat-card id="noEligibleJobsAlert" *ngIf="jobs?.length === 0" style="background-color: #ff6385">
|
||||
<mat-card-content>
|
||||
<i class="fas fa-exclamation-circle" style="color: #fff"></i> <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" fxFlex="1 1 100%"
|
||||
[formGroup]="simpleTriggerReactiveForm" (ngSubmit)="onSubmitTriggerConfig()">
|
||||
<div>
|
||||
<mat-form-field
|
||||
[appearance]="enabledTriggerForm && !trigger ? 'standard': 'none'"
|
||||
class="full-size-input">
|
||||
<mat-label>Trigger Name *</mat-label>
|
||||
<input id="triggerName"
|
||||
[readonly]="!enabledTriggerForm || trigger"
|
||||
matInput placeholder="name of the trigger (unique)"
|
||||
formControlName="triggerName" name="triggerName">
|
||||
<mat-error *ngIf="simpleTriggerReactiveForm.controls.triggerName.errors?.required">
|
||||
Name is <strong>required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<mat-form-field
|
||||
[appearance]="enabledTriggerForm ? 'standard': 'none'"
|
||||
class="full-size-input"
|
||||
>
|
||||
<mat-label>Job Class *</mat-label>
|
||||
<mat-select id="jobClass" name="jobClass" formControlName="jobClass" [disabled]="!enabledTriggerForm">
|
||||
<mat-option *ngFor="let job of jobs" [value]="job" style="font-size: 0.8em">
|
||||
{{job}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="simpleTriggerReactiveForm.controls.jobClass.errors?.required">
|
||||
Job is <strong>required</strong>
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<mat-form-field
|
||||
[appearance]="enabledTriggerForm ? 'standard': 'none'"
|
||||
class="full-size-input"
|
||||
>
|
||||
<mat-label>Misfire Instruction *</mat-label>
|
||||
<mat-select id="misfireInstruction" name="misfireInstruction" formControlName="misfireInstruction"
|
||||
[disabled]="!enabledTriggerForm" style="font-size: 0.8em">
|
||||
<mat-option value="MISFIRE_INSTRUCTION_FIRE_NOW">FIRE NOW</mat-option>
|
||||
<mat-option value="MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT">RESCHEDULE NOW WITH
|
||||
EXISTING REPEAT COUNT
|
||||
</mat-option>
|
||||
<mat-option value="MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT">RESCHEDULE NOW WITH
|
||||
REMAINING REPEAT COUNT
|
||||
</mat-option>
|
||||
<mat-option value="MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT">RESCHEDULE NEXT WITH
|
||||
REMAINING COUNT
|
||||
</mat-option>
|
||||
<mat-option value="MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT">RESCHEDULE NEXT WITH EXISTING
|
||||
COUNT
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
<mat-error *ngIf="simpleTriggerReactiveForm.controls.misfireInstruction.errors?.required">
|
||||
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
|
||||
[appearance]="enabledTriggerForm ? 'standard': 'none'"
|
||||
class="full-size-input"
|
||||
>
|
||||
<mat-label>Start Date (optional)</mat-label>
|
||||
<input id="startDate"
|
||||
[readonly]="!enabledTriggerForm"
|
||||
matInput
|
||||
[ngxMatDatetimePicker]="startDatePicker" placeholder="Choose a start date"
|
||||
formControlName="startDate" name="startDate">
|
||||
<mat-datepicker-toggle matSuffix [for]="startDatePicker"></mat-datepicker-toggle>
|
||||
<ngx-mat-datetime-picker #startDatePicker showSpinners="true" showSeconds="true">
|
||||
<!-- [stepHour]="stepHour"-->
|
||||
<!-- [stepMinute]="stepMinute" [stepSecond]="stepSecond" [touchUi]="touchUi" [color]="color"-->
|
||||
<!-- [enableMeridian]="enableMeridian" [disableMinute]="disableMinute" [hideTime]="hideTime">-->
|
||||
</ngx-mat-datetime-picker>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<mat-form-field
|
||||
[appearance]="enabledTriggerForm ? 'standard': 'none'"
|
||||
class="full-size-input"
|
||||
>
|
||||
<mat-label>End Date (optional)</mat-label>
|
||||
<input id="endDate"
|
||||
[readonly]="!enabledTriggerForm"
|
||||
matInput
|
||||
[ngxMatDatetimePicker]="endDatePicker" placeholder="Choose a end date"
|
||||
formControlName="endDate" name="endDate"
|
||||
>
|
||||
<mat-datepicker-toggle matSuffix [for]="endDatePicker"></mat-datepicker-toggle>
|
||||
<ngx-mat-datetime-picker #endDatePicker showSpinners="true" showSeconds="true">
|
||||
<!-- [stepHour]="stepHour"-->
|
||||
<!-- [stepMinute]="stepMinute" [stepSecond]="stepSecond" [touchUi]="touchUi" [color]="color"-->
|
||||
<!-- [enableMeridian]="enableMeridian" [disableMinute]="disableMinute" [hideTime]="hideTime">-->
|
||||
</ngx-mat-datetime-picker>
|
||||
</mat-form-field>
|
||||
<mat-error *ngIf="simpleTriggerReactiveForm.controls.triggerPeriod.errors?.invalidTriggerPeriod" 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
|
||||
[appearance]="enabledTriggerForm ? 'standard': 'none'"
|
||||
class="full-size-input"
|
||||
>
|
||||
<mat-label>Repeat Interval [in mills]</mat-label>
|
||||
<input id="repeatInterval"
|
||||
[readonly]="!enabledTriggerForm"
|
||||
matInput placeholder="Repeat Interval [in mills]" type="number"
|
||||
formControlName="repeatInterval" name="repeatInterval"
|
||||
>
|
||||
<mat-error *ngIf="simpleTriggerReactiveForm.controls.triggerRecurrence.errors?.invalidTriggerRecurrence">
|
||||
repeatCount and repeatInterval must be <strong>both</strong> set or unset
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<!-- <mat-error *ngIf="simpleTriggerReactiveForm.controls.triggerRecurrence.errors?.invalidTriggerRecurrence" style="font-size: small">-->
|
||||
<!-- repeatCount and repeatInterval must be <strong>both</strong> set or unset-->
|
||||
<!-- </mat-error>-->
|
||||
</div>
|
||||
<div>
|
||||
<mat-form-field
|
||||
[appearance]="enabledTriggerForm ? 'standard': 'none'"
|
||||
class="full-size-input"
|
||||
>
|
||||
<mat-label>Repeat Count</mat-label>
|
||||
<input id="repeatCount"
|
||||
[readonly]="!enabledTriggerForm"
|
||||
matInput placeholder="Repeat Count (-1 REPEAT INDEFINITELY)" type="number"
|
||||
formControlName="repeatCount" name="repeatCount"
|
||||
>
|
||||
<mat-error *ngIf="simpleTriggerReactiveForm.controls.triggerRecurrence.errors?.invalidTriggerRecurrence">
|
||||
repeatCount and repeatInterval must be <strong>both</strong> set or unset
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
|
||||
<div fxLayout="row" fxFlexAlign="space-evenly center" style="padding-bottom: 1em;">
|
||||
<div fxFlex="1 1 auto" style="text-align: center" *ngIf="enabledTriggerForm">
|
||||
<button mat-raised-button
|
||||
type="button"
|
||||
*ngIf="enabledTriggerForm"
|
||||
(click)="onResetReactiveForm()">
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
<div fxFlex="1 1 auto" style="text-align: center" *ngIf="enabledTriggerForm">
|
||||
<button mat-raised-button
|
||||
type="submit" color="primary"
|
||||
[disabled]="simpleTriggerReactiveForm.invalid"
|
||||
*ngIf="enabledTriggerForm">
|
||||
Submit
|
||||
</button>
|
||||
</div>
|
||||
<div fxFlex="1 1 auto" style="text-align: center" *ngIf="!enabledTriggerForm">
|
||||
<button mat-raised-button type="button"
|
||||
*ngIf="!enabledTriggerForm"
|
||||
(click)="enabledTriggerForm = true">
|
||||
Reschedule
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
@@ -0,0 +1,29 @@
|
||||
.small{
|
||||
font-size: 0.8em;
|
||||
}
|
||||
|
||||
.full-size-input{
|
||||
width: 100%;
|
||||
}
|
||||
/* ===== 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;
|
||||
}
|
||||
@@ -0,0 +1,247 @@
|
||||
import {async, ComponentFixture, TestBed} 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 {BrowserAnimationsModule} 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', () => {
|
||||
|
||||
let component: SimpleTriggerConfigComponent;
|
||||
let fixture: ComponentFixture<SimpleTriggerConfigComponent>;
|
||||
|
||||
let httpClient: HttpClient;
|
||||
let httpTestingController: HttpTestingController;
|
||||
|
||||
beforeEach(async( () => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [FormsModule, MatFormFieldModule, MatFormFieldModule, MatSelectModule, MatInputModule, BrowserAnimationsModule,
|
||||
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/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-select-panel')).queryAll(By.css('.mat-option'));
|
||||
matOptionDe[index].nativeElement.click();
|
||||
fixture.detectChanges();
|
||||
}
|
||||
|
||||
function openFormAndFillAllMandatoryFields() {
|
||||
component.openTriggerForm();
|
||||
fixture.detectChanges();
|
||||
|
||||
const getJobsReq = httpTestingController.expectOne(`${CONTEXT_PATH}/jobs`);
|
||||
getJobsReq.flush(['TestJob']);
|
||||
|
||||
const componentDe: DebugElement = fixture.debugElement;
|
||||
|
||||
const submitButton = componentDe.query(By.css('form button[color="primary"]'));
|
||||
expect(submitButton.nativeElement.textContent.trim()).toEqual('Submit');
|
||||
expect(submitButton.nativeElement.getAttribute('disabled')).toEqual('');
|
||||
|
||||
setInputValue(componentDe, '#triggerName', 'test-trigger');
|
||||
expect(component.simpleTriggerReactiveForm.controls.triggerName.value).toEqual('test-trigger');
|
||||
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, '#repeatInterval', '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', () => {
|
||||
const componentDe: DebugElement = fixture.debugElement;
|
||||
const mockTrigger = new Trigger();
|
||||
mockTrigger.triggerKeyDTO = new TriggerKey('test-trigger', null);
|
||||
mockTrigger.jobDetailDTO = <JobDetail>{jobClassName: 'TestJob', description: null};
|
||||
mockTrigger.misfireInstruction = MisfireInstruction.MISFIRE_INSTRUCTION_FIRE_NOW;
|
||||
|
||||
openFormAndFillAllMandatoryFields();
|
||||
|
||||
setInputValue(componentDe, '#repeatInterval', '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('form button[color="primary"]'));
|
||||
expect(submitButton.nativeElement.textContent.trim()).toEqual('Submit');
|
||||
|
||||
let actualNewTrigger;
|
||||
component.onNewTrigger.subscribe(simpleTrigger => actualNewTrigger = simpleTrigger);
|
||||
|
||||
submitButton.nativeElement.click();
|
||||
|
||||
const postSimpleTriggerReq = httpTestingController.expectOne(`${CONTEXT_PATH}/simple-triggers/test-trigger`);
|
||||
postSimpleTriggerReq.flush(mockTrigger);
|
||||
|
||||
expect(actualNewTrigger).toEqual(mockTrigger);
|
||||
});
|
||||
|
||||
it('should not emit an event when an existing trigger is edited', () => {
|
||||
const mockTriggerKey = new TriggerKey('test-trigger', null);
|
||||
component.triggerKey = mockTriggerKey;
|
||||
fixture.detectChanges();
|
||||
|
||||
const mockTrigger = new SimpleTrigger();
|
||||
mockTrigger.triggerKeyDTO = new TriggerKey('test-trigger', null);
|
||||
mockTrigger.jobDetailDTO = <JobDetail>{jobClassName: 'TestJob', description: null};
|
||||
mockTrigger.mayFireAgain = true;
|
||||
mockTrigger.misfireInstruction = MisfireInstruction.MISFIRE_INSTRUCTION_FIRE_NOW;
|
||||
const getSimpleTriggerReq = httpTestingController.expectOne(`${CONTEXT_PATH}/simple-triggers/test-trigger`);
|
||||
getSimpleTriggerReq.flush(mockTrigger);
|
||||
|
||||
component.simpleTriggerReactiveForm.setValue({
|
||||
triggerName: 'test-trigger',
|
||||
jobClass: 'TestJob',
|
||||
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, '#repeatInterval', '4000');
|
||||
expect(component.simpleTriggerReactiveForm.controls.triggerRecurrence.value.repeatInterval).toEqual(4000);
|
||||
|
||||
const submitButton = componentDe.query(By.css('form button[color="primary"]'));
|
||||
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/test-trigger`);
|
||||
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;
|
||||
fixture.detectChanges();
|
||||
|
||||
const mockTrigger = new Trigger();
|
||||
mockTrigger.triggerKeyDTO = mockTriggerKey;
|
||||
mockTrigger.jobDetailDTO = <JobDetail>{jobClassName: 'TestJob', description: null};
|
||||
const getSimpleTriggerReq = httpTestingController.expectOne(`${CONTEXT_PATH}/simple-triggers/my-simple-trigger`);
|
||||
getSimpleTriggerReq.flush(mockTrigger);
|
||||
|
||||
const componentDe: DebugElement = fixture.debugElement;
|
||||
const submitButton = componentDe.query(By.css('form button'));
|
||||
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('form button[color="primary"]'));
|
||||
expect(submitButton.nativeElement.textContent.trim()).toEqual('Submit');
|
||||
});
|
||||
|
||||
it('should display the warning if there are no eligible jobs', () => {
|
||||
fixture.detectChanges();
|
||||
const getJobsReq = httpTestingController.expectOne(`${CONTEXT_PATH}/jobs`);
|
||||
getJobsReq.flush([]);
|
||||
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}/jobs`);
|
||||
getJobsReq.flush(['sampleJob']);
|
||||
fixture.detectChanges();
|
||||
|
||||
const componentDe: DebugElement = fixture.debugElement;
|
||||
const warningCard = componentDe.query(By.css('#noEligibleJobsAlert'));
|
||||
expect(warningCard).toBeFalsy();
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
@@ -0,0 +1,196 @@
|
||||
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 {SimpleTriggerForm} from '../../model/simple-trigger.form';
|
||||
import * as moment from 'moment';
|
||||
import {TriggerKey} from '../../model/triggerKey.model';
|
||||
import JobService from '../../services/job.service';
|
||||
import {MisfireInstruction, MisfireInstructionCaption} from '../../model/misfire-instruction.model';
|
||||
import {AbstractControl, FormBuilder, FormControl, FormGroup, ValidationErrors, ValidatorFn, Validators} from '@angular/forms';
|
||||
|
||||
@Component({
|
||||
selector: 'qrzmng-simple-trigger-config',
|
||||
templateUrl: './simple-trigger-config.component.html',
|
||||
styleUrls: ['./simple-trigger-config.component.scss']
|
||||
})
|
||||
export class SimpleTriggerConfigComponent implements OnInit {
|
||||
|
||||
trigger: SimpleTrigger;
|
||||
|
||||
simpleTriggerReactiveForm: FormGroup = 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 && moment(this.trigger?.startTime)],
|
||||
endDate: [this.trigger?.endTime && moment(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 = true;
|
||||
|
||||
private fetchedTriggers = false;
|
||||
private triggerInProgress = false;
|
||||
|
||||
private selectedTriggerKey: TriggerKey;
|
||||
|
||||
private jobs: Array<String>;
|
||||
|
||||
enabledTriggerForm = false;
|
||||
|
||||
@Output()
|
||||
onNewTrigger = new EventEmitter<SimpleTrigger>();
|
||||
|
||||
constructor(
|
||||
private formBuilder: FormBuilder,
|
||||
private schedulerService: SchedulerService,
|
||||
private jobService: JobService
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.fetchJobs();
|
||||
}
|
||||
|
||||
private fetchJobs() {
|
||||
this.jobService.fetchJobs().subscribe(jobs => this.jobs = jobs);
|
||||
}
|
||||
|
||||
openTriggerForm() {
|
||||
this.enabledTriggerForm = true;
|
||||
}
|
||||
|
||||
private closeTriggerForm() {
|
||||
this.enabledTriggerForm = false;
|
||||
}
|
||||
|
||||
@Input()
|
||||
set triggerKey(triggerKey: TriggerKey) {
|
||||
this.selectedTriggerKey = {...triggerKey} as TriggerKey;
|
||||
this.fetchSelectedTrigger();
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
})
|
||||
}
|
||||
|
||||
shouldShowTheTriggerCardContent = (): boolean => this.trigger !== null || this.enabledTriggerForm;
|
||||
|
||||
existsATriggerInProgress = (): boolean => this.trigger && this.triggerInProgress;
|
||||
|
||||
onResetReactiveForm = () => {
|
||||
this.simpleTriggerReactiveForm.setValue(this._fromTriggerToReactiveForm(this.trigger));
|
||||
this.closeTriggerForm();
|
||||
};
|
||||
|
||||
onSubmitTriggerConfig = () => {
|
||||
const schedulerServiceCall = this.existsATriggerInProgress() ?
|
||||
this.schedulerService.updateSimpleTriggerConfig : this.schedulerService.saveSimpleTriggerConfig;
|
||||
|
||||
const simpleTriggerCommand = this._fromReactiveFormToCommand();
|
||||
schedulerServiceCall(simpleTriggerCommand)
|
||||
.subscribe((retTrigger: SimpleTrigger) => {
|
||||
this.trigger = retTrigger;
|
||||
|
||||
this.simpleTriggerReactiveForm.setValue(this._fromTriggerToReactiveForm(retTrigger));
|
||||
|
||||
this.fetchedTriggers = true;
|
||||
this.triggerInProgress = this.trigger.mayFireAgain;
|
||||
|
||||
if (schedulerServiceCall === this.schedulerService.saveSimpleTriggerConfig) {
|
||||
this.onNewTrigger.emit(retTrigger);
|
||||
}
|
||||
|
||||
this.closeTriggerForm();
|
||||
}, error => {
|
||||
this.simpleTriggerReactiveForm.setValue(this._fromTriggerToReactiveForm(this.trigger));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private _triggerPeriodValidator(control: AbstractControl): ValidationErrors | null {
|
||||
const startDate = control.get('startDate');
|
||||
const endDate = control.get('endDate');
|
||||
if (startDate.value && endDate.value) {
|
||||
return endDate.value.isBefore(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 && moment(simpleTrigger.startTime)) || null;
|
||||
simpleTriggerReactiveForm.triggerPeriod.endDate = (simpleTrigger.endTime && moment(simpleTrigger.endTime)) || null;
|
||||
simpleTriggerReactiveForm.misfireInstruction = (simpleTrigger.misfireInstruction
|
||||
&& MisfireInstruction[simpleTrigger.misfireInstruction]) || null;
|
||||
return simpleTriggerReactiveForm;
|
||||
};
|
||||
|
||||
private _fromReactiveFormToCommand = (): SimpleTriggerCommand => {
|
||||
const reactiveFormValue = this.simpleTriggerReactiveForm.value;
|
||||
const simpleTriggerCommand = new SimpleTriggerCommand();
|
||||
simpleTriggerCommand.triggerName = reactiveFormValue.triggerName;
|
||||
simpleTriggerCommand.jobClass = reactiveFormValue.jobClass;
|
||||
simpleTriggerCommand.repeatCount = reactiveFormValue.triggerRecurrence.repeatCount;
|
||||
simpleTriggerCommand.repeatInterval = reactiveFormValue.triggerRecurrence.repeatInterval;
|
||||
simpleTriggerCommand.startDate = reactiveFormValue.triggerPeriod.startDate?.toDate();
|
||||
simpleTriggerCommand.endDate = reactiveFormValue.triggerPeriod.endDate?.toDate();
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './trigger-list.component'
|
||||
@@ -0,0 +1,17 @@
|
||||
<mat-card fxFlex="1 1 auto" style="padding-left: 0; padding-right: 0">
|
||||
<mat-card-header fxLayout="row" fxLayoutAlign="space-between none" style="padding-right: 1em;" >
|
||||
<mat-card-subtitle><b>TRIGGERS</b></mat-card-subtitle>
|
||||
<button *ngIf="!triggerFormIsOpen" mat-raised-button style="top: -0.5em" color="primary" (click)="onNewTriggerBtnClicked()">
|
||||
new
|
||||
</button>
|
||||
</mat-card-header>
|
||||
<mat-divider></mat-divider>
|
||||
<mat-card-content style="position: relative; height: 100%">
|
||||
<mat-nav-list style="overflow-y: auto; position: absolute; left: 0; right: 0; top: 0; bottom: 0; overflow: auto; height: calc(100% - 3em)">
|
||||
<mat-list-item *ngFor="let triggerKey of getTriggerKeyList()" class="triggerItemList"
|
||||
[ngClass]="{'selectedTrigger': selectedTrigger && selectedTrigger.name==triggerKey.name}">
|
||||
<a matLine>{{ triggerKey.name }}</a>
|
||||
</mat-list-item>
|
||||
</mat-nav-list>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
@@ -0,0 +1,25 @@
|
||||
/* ===== 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;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
import {async, ComponentFixture, TestBed} 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(async(() => {
|
||||
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();
|
||||
});
|
||||
|
||||
});
|
||||
@@ -0,0 +1,85 @@
|
||||
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} from '@angular/material/dialog';
|
||||
|
||||
@Component({
|
||||
template: 'Multiple jobs not supported yet - Coming Soon...',
|
||||
})
|
||||
// tslint:disable-next-line:component-class-suffix
|
||||
export class UnsupportedMultipleJobsDialog {
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'qrzmng-trigger-list',
|
||||
templateUrl: './trigger-list.component.html',
|
||||
styleUrls: ['./trigger-list.component.scss']
|
||||
})
|
||||
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() {
|
||||
if (this.triggerKeys && this.triggerKeys.length > 0) {
|
||||
this.dialog.open(UnsupportedMultipleJobsDialog)
|
||||
} else {
|
||||
this.onNewTriggerClicked.emit();
|
||||
}
|
||||
}
|
||||
|
||||
onNewTrigger(newTrigger: SimpleTrigger) {
|
||||
this.newTriggers = [newTrigger, ...this.newTriggers];
|
||||
this.selectedTrigger = newTrigger.triggerKeyDTO;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
31
quartz-manager-frontend/src/app/guards/admin.guard.ts
Normal file
31
quartz-manager-frontend/src/app/guards/admin.guard.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Router, CanActivate, 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) {
|
||||
}
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||||
if (this.userService.isAnAnonymousUser) {
|
||||
return true;
|
||||
}
|
||||
if (this.userService.currentUser) {
|
||||
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}});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
19
quartz-manager-frontend/src/app/guards/guest.guard.ts
Normal file
19
quartz-manager-frontend/src/app/guards/guest.guard.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Router, CanActivate } from '@angular/router';
|
||||
import { UserService } from '../services';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class GuestGuard implements CanActivate {
|
||||
|
||||
constructor(private router: Router, private userService: UserService) {}
|
||||
|
||||
canActivate(): boolean {
|
||||
if (this.userService.currentUser) {
|
||||
this.router.navigate(['/']);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
4
quartz-manager-frontend/src/app/guards/index.ts
Normal file
4
quartz-manager-frontend/src/app/guards/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from './login.guard';
|
||||
export * from './guest.guard';
|
||||
export * from './admin.guard';
|
||||
|
||||
19
quartz-manager-frontend/src/app/guards/login.guard.ts
Normal file
19
quartz-manager-frontend/src/app/guards/login.guard.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Router, CanActivate } from '@angular/router';
|
||||
import { UserService } from '../services';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export class LoginGuard implements CanActivate {
|
||||
|
||||
constructor(private router: Router, private userService: UserService) {}
|
||||
|
||||
canActivate(): boolean {
|
||||
if (this.userService.currentUser) {
|
||||
return true;
|
||||
} else {
|
||||
this.router.navigate(['/']);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import SockJS from 'sockjs-client';
|
||||
import Stomp from 'stompjs';
|
||||
|
||||
export class SocketEndpoint {
|
||||
client: SockJS;
|
||||
stomp: Stomp;
|
||||
}
|
||||
20
quartz-manager-frontend/src/app/model/SocketOption.model.ts
Normal file
20
quartz-manager-frontend/src/app/model/SocketOption.model.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
export class SocketOption {
|
||||
socketUrl: string;
|
||||
topicName: string;
|
||||
brokerName: string;
|
||||
reconnectionTimeout = 30000
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
4
quartz-manager-frontend/src/app/model/jobDetail.model.ts
Normal file
4
quartz-manager-frontend/src/app/model/jobDetail.model.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export class JobDetail {
|
||||
jobClassName: string;
|
||||
description: string;
|
||||
}
|
||||
4
quartz-manager-frontend/src/app/model/jobKey.model.ts
Normal file
4
quartz-manager-frontend/src/app/model/jobKey.model.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export class JobKeyModel {
|
||||
name: string;
|
||||
group: string;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
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.`
|
||||
]
|
||||
]);
|
||||
15
quartz-manager-frontend/src/app/model/scheduler.model.ts
Normal file
15
quartz-manager-frontend/src/app/model/scheduler.model.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import {TriggerKey} from './triggerKey.model';
|
||||
|
||||
export class Scheduler {
|
||||
name: string;
|
||||
instanceId: string;
|
||||
status: string;
|
||||
triggerKeys: TriggerKey[];
|
||||
|
||||
constructor(name: string, instanceId: string, status: string, triggerKeys: TriggerKey[]) {
|
||||
this.name = name;
|
||||
this.status = status;
|
||||
this.instanceId = instanceId;
|
||||
this.triggerKeys = triggerKeys;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
export class SimpleTriggerCommand {
|
||||
triggerName: string;
|
||||
jobClass: string;
|
||||
startDate: Date;
|
||||
endDate: Date;
|
||||
repeatCount: number;
|
||||
repeatInterval: number;
|
||||
misfireInstruction: string;
|
||||
}
|
||||
11
quartz-manager-frontend/src/app/model/simple-trigger.form.ts
Normal file
11
quartz-manager-frontend/src/app/model/simple-trigger.form.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import {Moment} from 'moment/moment';
|
||||
|
||||
export class SimpleTriggerForm {
|
||||
triggerName: string;
|
||||
jobClass: string;
|
||||
startDate: Moment;
|
||||
endDate: Moment;
|
||||
repeatCount: number;
|
||||
repeatInterval: number;
|
||||
misfireInstruction: string;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import {Trigger} from './trigger.model';
|
||||
|
||||
export class SimpleTrigger extends Trigger {
|
||||
repeatCount: number;
|
||||
repeatInterval: number;
|
||||
timesTriggered: number;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
export default class TriggerFiredBundle {
|
||||
timesTriggered: number;
|
||||
repeatCount: number;
|
||||
finalFireTime: string;
|
||||
nextFireTime: string;
|
||||
previousFireTime: string;
|
||||
jobKey: string;
|
||||
jobClass: string;
|
||||
percentage: number;
|
||||
}
|
||||
17
quartz-manager-frontend/src/app/model/trigger.model.ts
Normal file
17
quartz-manager-frontend/src/app/model/trigger.model.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
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;
|
||||
jobKeyDTO: JobKeyModel;
|
||||
jobDetailDTO: JobDetail = new JobDetail();
|
||||
mayFireAgain: boolean;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
export class TriggerKey {
|
||||
name: string;
|
||||
group: string;
|
||||
|
||||
constructor(name?: string, group?: string) {
|
||||
this.name = name;
|
||||
this.group = group;
|
||||
}
|
||||
}
|
||||
74
quartz-manager-frontend/src/app/polyfills.ts
Normal file
74
quartz-manager-frontend/src/app/polyfills.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* 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';
|
||||
83
quartz-manager-frontend/src/app/services/api.service.spec.ts
Normal file
83
quartz-manager-frontend/src/app/services/api.service.spec.ts
Normal file
@@ -0,0 +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 {jest} from '@jest/globals'
|
||||
|
||||
class Data {
|
||||
name: string
|
||||
}
|
||||
|
||||
class HttpResponseMock {
|
||||
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;
|
||||
|
||||
const SAMPLE_URL = '/sample-url';
|
||||
const URL_401 = '/url-response-401';
|
||||
const testData: Data = {name: 'Test Data'};
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
imports: [HttpClientTestingModule],
|
||||
providers: [ApiService, {provide: Router, useValue: routerSpy}]
|
||||
});
|
||||
apiService = TestBed.inject(ApiService);
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
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();
|
||||
});
|
||||
|
||||
});
|
||||
108
quartz-manager-frontend/src/app/services/api.service.ts
Normal file
108
quartz-manager-frontend/src/app/services/api.service.ts
Normal file
@@ -0,0 +1,108 @@
|
||||
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';
|
||||
|
||||
export enum RequestMethod {
|
||||
Get = 'GET',
|
||||
Head = 'HEAD',
|
||||
Post = 'POST',
|
||||
Put = 'PUT',
|
||||
Delete = 'DELETE',
|
||||
Options = 'OPTIONS',
|
||||
Patch = 'PATCH'
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class ApiService {
|
||||
|
||||
headers = new HttpHeaders({
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
});
|
||||
|
||||
private jwtToken: string;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
getToken = () => this.jwtToken;
|
||||
|
||||
get(path: string, args?: any): Observable<any> {
|
||||
const options = {
|
||||
headers: this.headers,
|
||||
withCredentials: true
|
||||
};
|
||||
|
||||
if (args) {
|
||||
options['params'] = serialize(args);
|
||||
}
|
||||
|
||||
return this.http.get(path, options)
|
||||
.pipe(catchError(this.checkError.bind(this)));
|
||||
}
|
||||
|
||||
post(path: string, body: any, customHeaders?: HttpHeaders): Observable<any> {
|
||||
return this.request(path, body, RequestMethod.Post, customHeaders);
|
||||
}
|
||||
|
||||
put(path: string, body: any): Observable<any> {
|
||||
return this.request(path, body, RequestMethod.Put);
|
||||
}
|
||||
|
||||
delete(path: string, body?: any): Observable<any> {
|
||||
return this.request(path, body, RequestMethod.Delete);
|
||||
}
|
||||
|
||||
private request(path: string, body: any, method = RequestMethod.Post, customHeaders?: HttpHeaders): Observable<any> {
|
||||
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>) => {
|
||||
const jwtToken = ApiService.extractTokenFromHttpResponse(resp);
|
||||
if (jwtToken) {
|
||||
this.setToken(jwtToken);
|
||||
}
|
||||
}),
|
||||
map((response: HttpResponse<any>) => response.body),
|
||||
catchError(error => this.checkError(error))
|
||||
)
|
||||
}
|
||||
|
||||
// Display error if logged in, otherwise redirect to IDP
|
||||
private checkError(error: any): any {
|
||||
if (error && error.status === 401) {
|
||||
this.router.navigate(['/login']);
|
||||
} else {
|
||||
// this.displayError(error);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
41
quartz-manager-frontend/src/app/services/auth.service.ts
Normal file
41
quartz-manager-frontend/src/app/services/auth.service.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
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';
|
||||
|
||||
@Injectable()
|
||||
export class AuthService {
|
||||
|
||||
constructor(
|
||||
private apiService: ApiService,
|
||||
private userService: UserService,
|
||||
private config: ConfigService,
|
||||
) {
|
||||
}
|
||||
|
||||
login(user) {
|
||||
const loginHeaders = new HttpHeaders({
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
});
|
||||
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.getUserInfo().subscribe();
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
logout() {
|
||||
return this.apiService.post(this.config.logout_url, {})
|
||||
.pipe(map(() => {
|
||||
this.apiService.setToken(null);
|
||||
this.userService.currentUser = null;
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
57
quartz-manager-frontend/src/app/services/config.service.ts
Normal file
57
quartz-manager-frontend/src/app/services/config.service.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {environment} from '../../environments/environment';
|
||||
|
||||
|
||||
const WEBJAR_PATH = '/quartz-manager-ui/';
|
||||
|
||||
export const CONTEXT_PATH = '/quartz-manager';
|
||||
|
||||
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 _auth_url = getBaseUrl() + `${CONTEXT_PATH}/auth`
|
||||
|
||||
private _refresh_token_url = this._auth_url + '/refresh';
|
||||
|
||||
private _login_url = this._auth_url + '/login';
|
||||
|
||||
private _logout_url = this._auth_url + '/logout';
|
||||
|
||||
private _whoami_url = this._auth_url + '/whoami';
|
||||
|
||||
get refresh_token_url(): string {
|
||||
return this._refresh_token_url;
|
||||
}
|
||||
|
||||
get whoami_url(): string {
|
||||
return this._whoami_url;
|
||||
}
|
||||
|
||||
get login_url(): string {
|
||||
return this._login_url;
|
||||
}
|
||||
|
||||
get logout_url(): string {
|
||||
return this._logout_url;
|
||||
}
|
||||
|
||||
}
|
||||
12
quartz-manager-frontend/src/app/services/index.ts
Normal file
12
quartz-manager-frontend/src/app/services/index.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
export * from './api.service';
|
||||
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 './trigger.service'
|
||||
export * from './job.service'
|
||||
|
||||
|
||||
18
quartz-manager-frontend/src/app/services/job.service.ts
Normal file
18
quartz-manager-frontend/src/app/services/job.service.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {ApiService} from './api.service';
|
||||
import {CONTEXT_PATH, getBaseUrl} from './config.service';
|
||||
import {Observable} from 'rxjs';
|
||||
|
||||
@Injectable()
|
||||
export default class JobService {
|
||||
|
||||
constructor(
|
||||
private apiService: ApiService
|
||||
) {
|
||||
}
|
||||
|
||||
fetchJobs = (): Observable<string[]> => {
|
||||
return this.apiService.get(getBaseUrl() + `${CONTEXT_PATH}/jobs`)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {WebsocketService, ApiService, getBaseUrl, CONTEXT_PATH} from '.';
|
||||
import {SocketOption} from '../model/SocketOption.model';
|
||||
|
||||
@Injectable()
|
||||
export class LogsWebsocketService extends WebsocketService {
|
||||
|
||||
constructor(private apiService: ApiService) {
|
||||
super(new SocketOption(getBaseUrl() + `${CONTEXT_PATH}/logs`, '/topic/logs', apiService.getToken))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
const MockObservable = {
|
||||
mergeMap: (cb) => {
|
||||
return cb({ id: 123 });
|
||||
},
|
||||
toPromise: () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve('resolved');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export class MockApiService {
|
||||
get(path: string) {
|
||||
return MockObservable;
|
||||
}
|
||||
post(path: string, body) {}
|
||||
put(path: string, body) {}
|
||||
anonGet(path: string) {
|
||||
return MockObservable;
|
||||
}
|
||||
}
|
||||
2
quartz-manager-frontend/src/app/services/mocks/index.ts
Normal file
2
quartz-manager-frontend/src/app/services/mocks/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './api.service.mock';
|
||||
export * from './user.service.mock';
|
||||
@@ -0,0 +1,5 @@
|
||||
export class MockUserService {
|
||||
|
||||
currentUser = {};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {WebsocketService, ApiService, getBaseUrl, CONTEXT_PATH} from '.';
|
||||
import {SocketOption} from '../model/SocketOption.model';
|
||||
|
||||
@Injectable()
|
||||
export class ProgressWebsocketService extends WebsocketService {
|
||||
|
||||
constructor(private apiService: ApiService) {
|
||||
super(new SocketOption(getBaseUrl() + `${CONTEXT_PATH}/progress`, '/topic/progress', apiService.getToken))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {CONTEXT_PATH, getBaseUrl} from '.';
|
||||
import {ApiService} from './api.service';
|
||||
import {Trigger} from '../model/trigger.model';
|
||||
import {Observable} from 'rxjs';
|
||||
import {SimpleTriggerCommand} from '../model/simple-trigger.command';
|
||||
import {Scheduler} from '../model/scheduler.model';
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class SchedulerService {
|
||||
|
||||
constructor(
|
||||
private apiService: ApiService
|
||||
) { }
|
||||
|
||||
startScheduler = (): Observable<void> => {
|
||||
return this.apiService.get(getBaseUrl() + `${CONTEXT_PATH}/scheduler/run`);
|
||||
}
|
||||
|
||||
stopScheduler = (): Observable<void> => {
|
||||
return this.apiService.get(getBaseUrl() + `${CONTEXT_PATH}/scheduler/stop`);
|
||||
}
|
||||
|
||||
pauseScheduler = (): Observable<void> => {
|
||||
return this.apiService.get(getBaseUrl() + `${CONTEXT_PATH}/scheduler/pause`);
|
||||
}
|
||||
|
||||
resumeScheduler = (): Observable<void> => {
|
||||
return this.apiService.get(getBaseUrl() + `${CONTEXT_PATH}/scheduler/resume`);
|
||||
}
|
||||
|
||||
getStatus = () => {
|
||||
return this.apiService.get(getBaseUrl() + `${CONTEXT_PATH}/scheduler/status`);
|
||||
}
|
||||
|
||||
getScheduler = (): Observable<Scheduler> => {
|
||||
return this.apiService.get(getBaseUrl() + `${CONTEXT_PATH}/scheduler`);
|
||||
}
|
||||
|
||||
getSimpleTriggerConfig = (triggerName: string): Observable<Trigger> => {
|
||||
return this.apiService.get(getBaseUrl() + `${CONTEXT_PATH}/simple-triggers/${triggerName}`);
|
||||
}
|
||||
|
||||
saveSimpleTriggerConfig = (config: SimpleTriggerCommand) => {
|
||||
return this.apiService.post(getBaseUrl() + `${CONTEXT_PATH}/simple-triggers/${config.triggerName}`, config)
|
||||
}
|
||||
|
||||
updateSimpleTriggerConfig = (config: SimpleTriggerCommand) => {
|
||||
return this.apiService.put(getBaseUrl() + `${CONTEXT_PATH}/simple-triggers/${config.triggerName}`, config)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user