mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-01-26 05:27:35 +02:00
fixing frontend task schedule setting bug
This commit is contained in:
parent
2012ec3d91
commit
fd3a59ef3d
@ -7,7 +7,7 @@
|
||||
<div class="card-body">
|
||||
<div [hidden]="!error" class="alert alert-danger" role="alert"><strong>Error: </strong>{{error}}</div>
|
||||
|
||||
<div *ngFor="let schedule of settings.scheduled;let i= index">
|
||||
<div *ngFor="let schedule of settings.scheduled; let i= index">
|
||||
<div class="card bg-light">
|
||||
<div class="card-header ">
|
||||
<div class="d-flex justify-content-between">
|
||||
@ -36,22 +36,25 @@
|
||||
|
||||
<app-timestamp-datepicker
|
||||
[name]="'triggerTime'+i"
|
||||
*ngIf="schedule.trigger.type== TaskTriggerType.scheduled"
|
||||
*ngIf="schedule.trigger.type == TaskTriggerType.scheduled"
|
||||
(timestampChange)="testSettingChanges()"
|
||||
[(timestamp)]="schedule.trigger.time"></app-timestamp-datepicker>
|
||||
|
||||
<select *ngIf="schedule.trigger.type== TaskTriggerType.periodic"
|
||||
class="form-control" [(ngModel)]="schedule.trigger.periodicity" [name]="'periodicity'+i"
|
||||
<select *ngIf="schedule.trigger.type == TaskTriggerType.periodic"
|
||||
class="form-control" [(ngModel)]="schedule.trigger.periodicity" [name]="'periodicity' + i"
|
||||
required>
|
||||
<option *ngFor="let period of periods; let i= index"
|
||||
<option *ngFor="let period of periods; let i = index"
|
||||
[ngValue]="i">
|
||||
<ng-container i18n>every</ng-container>
|
||||
<ng-container i18n>every</ng-container>
|
||||
{{period}}
|
||||
</option>
|
||||
</select>
|
||||
|
||||
<app-timestamp-timepicker
|
||||
[name]="'atTime'+i"
|
||||
(timestampChange)="testSettingChanges()"
|
||||
*ngIf="schedule.trigger.type== TaskTriggerType.periodic"
|
||||
*ngIf="schedule.trigger.type == TaskTriggerType.periodic"
|
||||
[(timestamp)]="schedule.trigger.atTime"></app-timestamp-timepicker>
|
||||
|
||||
</div>
|
||||
|
@ -46,16 +46,17 @@ export class TasksSettingsComponent extends SettingsComponent<TaskConfig, TasksS
|
||||
notification,
|
||||
i18n,
|
||||
s => s.Server.tasks);
|
||||
|
||||
this.hasAvailableSettings = !this.simplifiedMode;
|
||||
this.taskTriggerType = Utils.enumToArray(TaskTriggerType);
|
||||
this.periods = [this.i18n('Monday'),
|
||||
this.i18n('Tuesday'),
|
||||
this.i18n('Wednesday'),
|
||||
this.periods = [this.i18n('Monday'), // 0
|
||||
this.i18n('Tuesday'), // 1
|
||||
this.i18n('Wednesday'), // 2
|
||||
this.i18n('Thursday'),
|
||||
this.i18n('Friday'),
|
||||
this.i18n('Saturday'),
|
||||
this.i18n('Sunday'),
|
||||
this.i18n('day')];
|
||||
this.i18n('day')]; // 7
|
||||
}
|
||||
|
||||
|
||||
@ -147,7 +148,7 @@ export class TasksSettingsComponent extends SettingsComponent<TaskConfig, TasksS
|
||||
remove(id: string) {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
update($event: string, trigger: ScheduledTaskTrigger) {
|
||||
if (!$event) {
|
||||
return;
|
||||
@ -161,7 +162,7 @@ export class TasksSettingsComponent extends SettingsComponent<TaskConfig, TasksS
|
||||
|
||||
toDate(time: number) {
|
||||
return new Date(time);
|
||||
}
|
||||
}*/
|
||||
|
||||
taskTriggerTypeChanged(triggerType: TaskTriggerType, schedule: TaskScheduleDTO) {
|
||||
schedule.trigger = <NeverTaskTrigger>{type: triggerType};
|
||||
|
@ -4,5 +4,5 @@
|
||||
bsDatepicker
|
||||
[ngModel]="date"
|
||||
(ngModelChange)="onChange($event)"
|
||||
[bsConfig]="{ dateInputFormat: 'YYYY.MM.DD, h:mm' }"
|
||||
[bsConfig]="{ dateInputFormat: 'YYYY.MM.DD, HH:mm' }"
|
||||
required>
|
||||
|
@ -7,6 +7,7 @@ import {Component, EventEmitter, Input, Output} from '@angular/core';
|
||||
export class TimeStampTimePickerComponent {
|
||||
|
||||
timestampValue = 0;
|
||||
timezoneOffset = (new Date()).getTimezoneOffset() * 60 * 1000;
|
||||
@Output() timestampChange = new EventEmitter<number>();
|
||||
|
||||
date: Date = new Date();
|
||||
@ -19,7 +20,7 @@ export class TimeStampTimePickerComponent {
|
||||
}
|
||||
|
||||
public set timestamp(val: number) {
|
||||
this.date.setTime(val);
|
||||
this.date.setTime(val + this.timezoneOffset);
|
||||
if (this.timestampValue === val) {
|
||||
return;
|
||||
}
|
||||
@ -27,8 +28,8 @@ export class TimeStampTimePickerComponent {
|
||||
this.timestampChange.emit(this.timestampValue);
|
||||
}
|
||||
|
||||
onChange(date: Date | string) {
|
||||
this.timestamp = (new Date(date)).getTime();
|
||||
onChange(date: Date | string): void {
|
||||
this.timestamp = (new Date(date)).getTime() - this.timezoneOffset;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user