mirror of
https://github.com/fabioformosa/quartz-manager.git
synced 2026-05-14 22:00:30 +09:00
#52 added the jobClass selection
This commit is contained in:
@@ -18,6 +18,7 @@ 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';
|
||||
|
||||
@@ -50,6 +51,7 @@ import {
|
||||
AuthService,
|
||||
UserService,
|
||||
SchedulerService,
|
||||
JobService,
|
||||
ConfigService,
|
||||
ProgressWebsocketService,
|
||||
LogsWebsocketService,
|
||||
@@ -138,6 +140,7 @@ export function jwtOptionsFactory(apiService: ApiService) {
|
||||
MatChipsModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatSelectModule,
|
||||
MatToolbarModule,
|
||||
MatCardModule,
|
||||
MatListModule,
|
||||
@@ -164,6 +167,7 @@ export function jwtOptionsFactory(apiService: ApiService) {
|
||||
GuestGuard,
|
||||
AdminGuard,
|
||||
SchedulerService,
|
||||
JobService,
|
||||
TriggerService,
|
||||
ProgressWebsocketService,
|
||||
LogsWebsocketService,
|
||||
|
||||
@@ -20,10 +20,11 @@
|
||||
<div>
|
||||
<mat-form-field [appearance]="enabledTriggerForm ? 'standard': 'none'">
|
||||
<mat-label>Job Class</mat-label>
|
||||
<input id="jobClass"
|
||||
[readonly]="!enabledTriggerForm"
|
||||
matInput placeholder="Job Class Name" name="jobClass"
|
||||
[(ngModel)]="simpleTriggerForm.jobClass">
|
||||
<mat-select name="jobClass" [(ngModel)]="simpleTriggerForm.jobClass" [disabled]="!enabledTriggerForm">
|
||||
<mat-option *ngFor="let job of jobs" [value]="job">
|
||||
{{job}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import {Trigger} from '../../model/trigger.model';
|
||||
import {JobDetail} from '../../model/jobDetail.model';
|
||||
import {SimpleTriggerForm} from '../../model/simple-trigger.form';
|
||||
import {SimpleTrigger} from '../../model/simple-trigger.model';
|
||||
import JobService from '../../services/job.service';
|
||||
|
||||
describe('SimpleTriggerConfig', () => {
|
||||
|
||||
@@ -33,7 +34,7 @@ describe('SimpleTriggerConfig', () => {
|
||||
MatNativeDateModule,
|
||||
MatCardModule, MatIconModule, HttpClientTestingModule, RouterTestingModule],
|
||||
declarations: [SimpleTriggerConfigComponent],
|
||||
providers: [SchedulerService, ApiService, ConfigService],
|
||||
providers: [SchedulerService, ApiService, ConfigService, JobService],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).compileComponents();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
||||
import {SchedulerService} from '../../services';
|
||||
import {JobService, SchedulerService} from '../../services';
|
||||
import {Scheduler} from '../../model/scheduler.model';
|
||||
import {SimpleTriggerCommand} from '../../model/simple-trigger.command';
|
||||
import {SimpleTrigger} from '../../model/simple-trigger.model';
|
||||
@@ -27,16 +27,24 @@ export class SimpleTriggerConfigComponent implements OnInit {
|
||||
|
||||
private selectedTriggerKey: TriggerKey;
|
||||
|
||||
private jobs: Array<String>;
|
||||
|
||||
enabledTriggerForm = false;
|
||||
|
||||
@Output()
|
||||
onNewTrigger = new EventEmitter<SimpleTrigger>();
|
||||
|
||||
constructor(
|
||||
private schedulerService: SchedulerService
|
||||
private schedulerService: SchedulerService,
|
||||
private jobService: JobService
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.fetchJobs();
|
||||
}
|
||||
|
||||
private fetchJobs() {
|
||||
this.jobService.fetchJobs().subscribe(jobs => this.jobs = jobs);
|
||||
}
|
||||
|
||||
openTriggerForm() {
|
||||
@@ -109,6 +117,7 @@ export class SimpleTriggerConfigComponent implements OnInit {
|
||||
private _fromFormToCommand = (simpleTriggerForm: SimpleTriggerForm): SimpleTriggerCommand => {
|
||||
const simpleTriggerCommand = new SimpleTriggerCommand();
|
||||
simpleTriggerCommand.triggerName = simpleTriggerForm.triggerName;
|
||||
simpleTriggerCommand.jobClass = simpleTriggerForm.jobClass;
|
||||
simpleTriggerCommand.repeatCount = simpleTriggerForm.repeatCount;
|
||||
simpleTriggerCommand.repeatInterval = simpleTriggerForm.repeatInterval;
|
||||
simpleTriggerCommand.startDate = simpleTriggerForm.startDate?.toDate();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export class SimpleTriggerCommand {
|
||||
triggerName: string;
|
||||
jobClass: string;
|
||||
startDate: Date;
|
||||
endDate: Date;
|
||||
repeatCount: number;
|
||||
|
||||
@@ -1,24 +1,28 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { environment } from '../../environments/environment';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {environment} from '../../environments/environment';
|
||||
|
||||
|
||||
const WEBJAR_PATH = '/quartz-manager-ui/';
|
||||
|
||||
export function getHtmlBaseUrl(){
|
||||
const baseUrl = getBaseUrl() || '/';
|
||||
return environment.production ? getBaseUrl() + WEBJAR_PATH: '/';
|
||||
}
|
||||
export const CONTEXT_PATH = '/quartz-manager';
|
||||
|
||||
export function getBaseUrl(){
|
||||
if(environment.production){
|
||||
let contextPath: string = window.location.pathname.split('/')[1] || '';
|
||||
if(contextPath && ('/' + contextPath + '/') === WEBJAR_PATH)
|
||||
return '';
|
||||
if(contextPath)
|
||||
contextPath = '/' + contextPath;
|
||||
return contextPath;
|
||||
}
|
||||
return '';
|
||||
export function getHtmlBaseUrl() {
|
||||
const baseUrl = getBaseUrl() || '/';
|
||||
return environment.production ? getBaseUrl() + WEBJAR_PATH : '/';
|
||||
}
|
||||
|
||||
export function getBaseUrl() {
|
||||
if (environment.production) {
|
||||
let contextPath: string = window.location.pathname.split('/')[1] || '';
|
||||
if (contextPath && ('/' + contextPath + '/') === WEBJAR_PATH) {
|
||||
return '';
|
||||
}
|
||||
if (contextPath) {
|
||||
contextPath = '/' + contextPath;
|
||||
}
|
||||
return contextPath;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
@@ -45,35 +49,35 @@ export class ConfigService {
|
||||
private _signup_url = this._api_url + '/signup';
|
||||
|
||||
get reset_credentials_url(): string {
|
||||
return this._reset_credentials_url;
|
||||
return this._reset_credentials_url;
|
||||
}
|
||||
|
||||
get refresh_token_url(): string {
|
||||
return this._refresh_token_url;
|
||||
return this._refresh_token_url;
|
||||
}
|
||||
|
||||
get whoami_url(): string {
|
||||
return this._whoami_url;
|
||||
return this._whoami_url;
|
||||
}
|
||||
|
||||
get users_url(): string {
|
||||
return this._users_url;
|
||||
return this._users_url;
|
||||
}
|
||||
|
||||
get login_url(): string {
|
||||
return this._login_url;
|
||||
return this._login_url;
|
||||
}
|
||||
|
||||
get logout_url(): string {
|
||||
return this._logout_url;
|
||||
return this._logout_url;
|
||||
}
|
||||
|
||||
get change_password_url(): string {
|
||||
return this._change_password_url;
|
||||
return this._change_password_url;
|
||||
}
|
||||
|
||||
get signup_url():string {
|
||||
return this._signup_url;
|
||||
get signup_url(): string {
|
||||
return this._signup_url;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,4 +7,6 @@ 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 class JobService {
|
||||
|
||||
constructor(
|
||||
private apiService: ApiService
|
||||
) {
|
||||
}
|
||||
|
||||
fetchJobs = (): Observable<string[]> => {
|
||||
return this.apiService.get(getBaseUrl() + `${CONTEXT_PATH}/jobs`)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,18 +1,15 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { getBaseUrl } from '.';
|
||||
import { ApiService } from './api.service';
|
||||
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 {SchedulerConfig} from '../model/schedulerConfig.model';
|
||||
import {Scheduler} from '../model/scheduler.model';
|
||||
|
||||
const CONTEXT_PATH = '/quartz-manager';
|
||||
|
||||
@Injectable()
|
||||
export class SchedulerService {
|
||||
|
||||
|
||||
constructor(
|
||||
private apiService: ApiService
|
||||
) { }
|
||||
|
||||
Reference in New Issue
Block a user