[#341] Adapted alarm UI to the changes to the ProcedureEditor component.

This commit is contained in:
Fabio Manganiello 2024-09-23 03:17:20 +02:00
parent b6c0029208
commit d1da4803cf
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774
4 changed files with 40 additions and 18 deletions

View file

@ -146,6 +146,7 @@ export default {
'drop', 'drop',
'input', 'input',
'reset', 'reset',
'update',
], ],
components: { components: {
@ -921,6 +922,14 @@ export default {
this.syncValue() this.syncValue()
this.syncSpacers() this.syncSpacers()
}, },
updated() {
if (!this.hasChanges) {
return
}
this.$emit('update', this.newValue)
},
} }
</script> </script>

View file

@ -176,7 +176,7 @@ export default {
toggle(event) { toggle(event) {
event.stopPropagation() event.stopPropagation()
this.$emit('click') this.$emit('click', event)
this.visible ? this.close() : this.open() this.visible ? this.close() : this.open()
}, },

View file

@ -370,16 +370,13 @@ $icon-width: 2em;
cursor: default; cursor: default;
.content { .content {
width: 50em;
max-width: 90%;
.body { .body {
width: 100%; width: 100%;
} }
} }
.alarm-running-modal { .alarm-running-modal {
width: 100%; min-width: 90vw;
height: 100%; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -387,6 +384,10 @@ $icon-width: 2em;
justify-content: center; justify-content: center;
padding: 1em; padding: 1em;
@include from($tablet) {
min-width: 40em;
}
.icon { .icon {
font-size: 3.5em; font-size: 3.5em;
color: $selected-fg; color: $selected-fg;

View file

@ -85,7 +85,7 @@
</span> </span>
</div> </div>
<div class="value"> <div class="value file-selector">
<FileSelector :value="editForm.media" @input="editForm.media = $event" /> <FileSelector :value="editForm.media" @input="editForm.media = $event" />
</div> </div>
</div> </div>
@ -127,7 +127,7 @@
<div class="value"> <div class="value">
<ToggleSwitch :value="editForm.media_repeat" <ToggleSwitch :value="editForm.media_repeat"
@input="editForm.media_repeat = $event.target.checked" /> @input="editForm.media_repeat = !!$event.target.checked" />
</div> </div>
</label> </label>
</div> </div>
@ -208,9 +208,7 @@
</div> </div>
<div class="value"> <div class="value">
<ProcedureEditor :value="procedure" <ActionsList :value="procedure" @update="onActionsUpdate($event)" />
:with-name="false"
@input="onActionsInput($event)" />
</div> </div>
</div> </div>
</div> </div>
@ -219,8 +217,8 @@
</template> </template>
<script> <script>
import Loading from "@/components/Loading"; import ActionsList from "@/components/Action/ActionsList"
import ProcedureEditor from "@/components/Procedure/ProcedureEditor" import Loading from "@/components/Loading"
import Slider from "@/components/elements/Slider" import Slider from "@/components/elements/Slider"
import CronEditor from "@/components/elements/CronEditor" import CronEditor from "@/components/elements/CronEditor"
import FileSelector from "@/components/elements/FileSelector" import FileSelector from "@/components/elements/FileSelector"
@ -232,10 +230,10 @@ export default {
emits: ['input'], emits: ['input'],
mixins: [Utils], mixins: [Utils],
components: { components: {
ActionsList,
CronEditor, CronEditor,
FileSelector, FileSelector,
Loading, Loading,
ProcedureEditor,
Slider, Slider,
TimeInterval, TimeInterval,
ToggleSwitch, ToggleSwitch,
@ -262,9 +260,7 @@ export default {
computed: { computed: {
procedure() { procedure() {
return { return [...(this.editForm.actions || [])]
actions: [...(this.editForm.actions || [])],
}
}, },
audioVolume() { audioVolume() {
@ -338,8 +334,12 @@ export default {
this.editForm.condition_type = type this.editForm.condition_type = type
}, },
onActionsInput(procedure) { onActionsUpdate(actions) {
this.editForm.actions = procedure.actions actions = [...(actions ?? [])]
if (JSON.stringify(this.editForm.actions) === JSON.stringify(actions))
return
this.editForm.actions = actions
}, },
onVolumeChange(event) { onVolumeChange(event) {
@ -498,5 +498,17 @@ $header-height: 3.5em;
input[type=text] { input[type=text] {
min-height: 2em; min-height: 2em;
} }
:deep(.file-selector) {
.modal {
.body {
min-width: 95vw;
@include from($tablet) {
min-width: 40em;
}
}
}
}
} }
</style> </style>