diff --git a/src/main/angular/src/app/api/schedule/Schedule.ts b/src/main/angular/src/app/api/schedule/Schedule.ts
index a8f62f9..702c024 100644
--- a/src/main/angular/src/app/api/schedule/Schedule.ts
+++ b/src/main/angular/src/app/api/schedule/Schedule.ts
@@ -17,7 +17,7 @@ export class Schedule {
validateNumberNotNull(json['id']),
validateBooleanNotNull(json['enabled']),
validateStringNotEmptyNotNull(json['title']),
- validateListOrEmpty(json['entries'], ScheduleEntry.fromJson, ScheduleEntry.compare),
+ validateListOrEmpty(json['entries'], ScheduleEntry.fromJson, ScheduleEntry.comparePosition),
);
}
@@ -25,10 +25,6 @@ export class Schedule {
return item.id;
}
- public static compareId(a: Schedule, b: Schedule): number {
- return a.id - b.id;
- }
-
public static compareName(a: Schedule, b: Schedule): number {
return a.title.localeCompare(b.title);
}
diff --git a/src/main/angular/src/app/api/schedule/entry/ScheduleEntry.ts b/src/main/angular/src/app/api/schedule/entry/ScheduleEntry.ts
index 6757612..fd4d667 100644
--- a/src/main/angular/src/app/api/schedule/entry/ScheduleEntry.ts
+++ b/src/main/angular/src/app/api/schedule/entry/ScheduleEntry.ts
@@ -11,6 +11,7 @@ export class ScheduleEntry {
private constructor(
public id: number,
+ public position: number,
public enabled: boolean,
public monday: boolean,
public tuesday: boolean,
@@ -38,6 +39,7 @@ export class ScheduleEntry {
static fromJson(json: any): ScheduleEntry {
return new ScheduleEntry(
validateNumberNotNull(json['id']),
+ validateNumberNotNull(json['position']),
validateBooleanNotNull(json['enabled']),
validateBooleanNotNull(json['monday']),
validateBooleanNotNull(json['tuesday']),
@@ -65,13 +67,8 @@ export class ScheduleEntry {
return item.id;
}
- public static compare(a: ScheduleEntry, b: ScheduleEntry): number {
- if (a.nextFuzzyTimestamp === null) {
- return +1;
- } else if (b.nextFuzzyTimestamp === null) {
- return -1;
- }
- return getDaySeconds(a.nextFuzzyTimestamp.date) - getDaySeconds(b.nextFuzzyTimestamp.date);
+ public static comparePosition(a: ScheduleEntry, b: ScheduleEntry): number {
+ return a.position - b.position;
}
}
diff --git a/src/main/angular/src/app/pages/schedule/editor/schedule-editor.component.html b/src/main/angular/src/app/pages/schedule/editor/schedule-editor.component.html
index be13587..2524db9 100644
--- a/src/main/angular/src/app/pages/schedule/editor/schedule-editor.component.html
+++ b/src/main/angular/src/app/pages/schedule/editor/schedule-editor.component.html
@@ -30,9 +30,11 @@
Nächste Ausführung |
Eingeschaft setzen |
Massenverarbeitung |
- |
+ |
+ |
+ |
-
+
@@ -173,8 +175,16 @@
- |
-
+ |
+
+ |
+
+
+ 0" [icon]="faUp">
+ |
+
+
+
|
diff --git a/src/main/angular/src/app/pages/schedule/editor/schedule-editor.component.ts b/src/main/angular/src/app/pages/schedule/editor/schedule-editor.component.ts
index e3a9d4f..551ef3c 100644
--- a/src/main/angular/src/app/pages/schedule/editor/schedule-editor.component.ts
+++ b/src/main/angular/src/app/pages/schedule/editor/schedule-editor.component.ts
@@ -3,7 +3,7 @@ import {ScheduleService} from "../../../api/schedule/schedule.service";
import {Schedule} from "../../../api/schedule/Schedule";
import {ScheduleEntry} from "../../../api/schedule/entry/ScheduleEntry";
import {ScheduleEntryService} from "../../../api/schedule/entry/schedule-entry.service";
-import {faCheckCircle, faCircle, faTimesCircle} from '@fortawesome/free-regular-svg-icons';
+import {faArrowAltCircleDown, faArrowAltCircleUp, faCheckCircle, faCircle, faTimesCircle} from '@fortawesome/free-regular-svg-icons';
import {ActivatedRoute, Router} from "@angular/router";
import {PropertyService} from "../../../api/property/property.service";
import {Scene} from "../../../api/scene/Scene";
@@ -19,12 +19,18 @@ import {NO_OP} from "../../../api/api.service";
})
export class ScheduleEditorComponent implements OnInit {
+ readonly ScheduleEntry = ScheduleEntry;
+
readonly faCheckCircle = faCheckCircle;
readonly faCircle = faCircle;
readonly faTimes = faTimesCircle;
+ readonly faUp = faArrowAltCircleUp;
+
+ readonly faDown = faArrowAltCircleDown;
+
readonly Schedule = Schedule;
schedule!: Schedule;
diff --git a/src/main/angular/src/styles.less b/src/main/angular/src/styles.less
index 67a72cc..7ec0458 100644
--- a/src/main/angular/src/styles.less
+++ b/src/main/angular/src/styles.less
@@ -79,6 +79,19 @@ table.vertical {
padding: 0;
}
+.noBorderFirst {
+ border-right-width: 0;
+}
+
+.noBorderMiddle {
+ border-right-width: 0;
+ border-left-width: 0;
+}
+
+.noBorderLast {
+ border-left-width: 0;
+}
+
.first {
border-right-width: 0;
padding-right: 0;
diff --git a/src/main/java/de/ph87/homeautomation/schedule/entry/ScheduleEntryDto.java b/src/main/java/de/ph87/homeautomation/schedule/entry/ScheduleEntryDto.java
index f6800b2..e6197e4 100644
--- a/src/main/java/de/ph87/homeautomation/schedule/entry/ScheduleEntryDto.java
+++ b/src/main/java/de/ph87/homeautomation/schedule/entry/ScheduleEntryDto.java
@@ -12,6 +12,8 @@ public class ScheduleEntryDto implements Serializable {
public final long id;
+ public final int position;
+
public final boolean enabled;
public final boolean monday;
@@ -54,6 +56,7 @@ public class ScheduleEntryDto implements Serializable {
public ScheduleEntryDto(final ScheduleEntry entry, final PropertyDto property, final BulkDto bulk) {
this.id = entry.getId();
+ this.position = entry.getPosition();
this.enabled = entry.isEnabled();
this.monday = entry.isMonday();
this.tuesday = entry.isTuesday();