diff --git a/model/alarm.go b/model/alarm.go
index 34f9d51..1453b9d 100644
--- a/model/alarm.go
+++ b/model/alarm.go
@@ -149,7 +149,6 @@ type AlarmRepeated struct {
FollowingRoutines []Identifier `json:"routines"`
IgnoreExceptions bool `json:"ignore_exceptions"`
Comment string `json:"comment,omitempty"`
- Disabled bool `json:"disabled,omitempty"`
Excepts Exceptions `json:"excepts,omitempty"`
NextTime *time.Time `json:"next_time,omitempty"`
}
@@ -186,10 +185,6 @@ func (a *AlarmRepeated) FillExcepts(cfg *config.Config, db *LevelDBStorage) erro
}
func (a *AlarmRepeated) GetNextOccurence(cfg *config.Config, db *LevelDBStorage) *time.Time {
- if a.Disabled {
- return nil
- }
-
if len(a.Excepts) == 0 {
a.FillExcepts(cfg, db)
}
@@ -244,19 +239,16 @@ func GetAlarmsRepeated(db *LevelDBStorage) (alarms []*AlarmRepeated, err error)
func PutAlarmRepeated(db *LevelDBStorage, alarm *AlarmRepeated) (err error) {
var key string
+ var id Identifier
if alarm.Id.IsEmpty() {
- var id Identifier
-
key, id, err = db.findBytesKey("alarm-repeated-", IDENTIFIER_LEN)
if err != nil {
return err
}
- alarm.Id = id
- } else {
- key = fmt.Sprintf("alarm-repeated-%s", alarm.Id.ToString())
}
+ alarm.Id = id
// Don't store this, this is autocalculated
alarm.Excepts = nil
alarm.NextTime = nil
@@ -301,19 +293,17 @@ func GetAlarmsSingle(db *LevelDBStorage) (alarms []*AlarmSingle, err error) {
func PutAlarmSingle(db *LevelDBStorage, alarm *AlarmSingle) (err error) {
var key string
+ var id Identifier
if alarm.Id.IsEmpty() {
- var id Identifier
-
key, id, err = db.findBytesKey("alarm-single-", IDENTIFIER_LEN)
if err != nil {
return err
}
- alarm.Id = id
- } else {
- key = fmt.Sprintf("alarm-single-%s", alarm.Id.ToString())
}
+ alarm.Id = id
+
return db.put(key, alarm)
}
@@ -373,19 +363,17 @@ func GetAlarmExceptions(db *LevelDBStorage) (alarms []*AlarmException, err error
func PutAlarmException(db *LevelDBStorage, alarm *AlarmException) (err error) {
var key string
+ var id Identifier
if alarm.Id.IsEmpty() {
- var id Identifier
-
key, id, err = db.findBytesKey("alarm-exception-", IDENTIFIER_LEN)
if err != nil {
return err
}
- alarm.Id = id
- } else {
- key = fmt.Sprintf("alarm-exception-%s", alarm.Id.ToString())
}
+ alarm.Id = id
+
return db.put(key, alarm)
}
diff --git a/ui/src/lib/alarmrepeated.js b/ui/src/lib/alarmrepeated.js
index fa16855..27002fe 100644
--- a/ui/src/lib/alarmrepeated.js
+++ b/ui/src/lib/alarmrepeated.js
@@ -5,18 +5,15 @@ export class AlarmRepeated {
}
}
- update({ id, weekday, time, routines, disabled, ignore_exceptions, comment, excepts, next_time }) {
+ update({ id, weekday, time, routines, ignore_exceptions, comment, excepts, next_time }) {
this.id = id;
this.weekday = weekday;
this.time = time;
this.routines = routines == null ? [] : routines;
this.ignore_exceptions = ignore_exceptions;
this.comment = comment;
- this.disabled = disabled == true;
- if (excepts !== undefined)
- this.excepts = excepts;
- if (next_time !== undefined)
- this.next_time = next_time;
+ this.excepts = excepts;
+ this.next_time = next_time;
if (this.routines.length < 1) {
this.routines.push("");
diff --git a/ui/src/lib/components/AlarmRepeatedList.svelte b/ui/src/lib/components/AlarmRepeatedList.svelte
index 95e61c2..a1c93cf 100644
--- a/ui/src/lib/components/AlarmRepeatedList.svelte
+++ b/ui/src/lib/components/AlarmRepeatedList.svelte
@@ -35,8 +35,6 @@
href="alarms/repeated/{alarm.id}"
class="list-group-item list-group-item-action"
class:active={$page.params.kind === "repeated" && $page.params.aid === alarm.id}
- class:text-muted={alarm.disabled}
- style:text-decoration={alarm.disabled?"line-through":null}
>
Les {weekdayStr(alarm.weekday)}s à {alarm.time}
diff --git a/ui/src/routes/alarms/[kind]/[aid]/+page.svelte b/ui/src/routes/alarms/[kind]/[aid]/+page.svelte
index fb73c63..7448f2a 100644
--- a/ui/src/routes/alarms/[kind]/[aid]/+page.svelte
+++ b/ui/src/routes/alarms/[kind]/[aid]/+page.svelte
@@ -4,7 +4,6 @@
Col,
Container,
Icon,
- Input,
ListGroup,
ListGroupItem,
Row,
@@ -118,17 +117,12 @@
Heure du réveil {alarm.time}
-
- Alarme active ?
- {obj.disabled = !obj.disabled; obj.save().then(() => {obj.next_time = null; alarmsRepeated.refresh()});}} checked={!obj.disabled} /> {!obj.disabled?"oui":"non"}
-
-
- Ignorer les exceptions ?
- {obj.ignore_exceptions = !obj.ignore_exceptions; obj.save();}} checked={obj.ignore_exceptions} /> {obj.ignore_exceptions?"oui":"non"}
+
+ Ignorer les exceptions ? {alarm.ignore_exceptions?"oui":"non"}
{#if alarm.next_time}
- Prochaine occurrence
+ Prochaine occurrence
{/if}