Skip to content

Commit

Permalink
Rule edit: Code clean-ups (#2471)
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
  • Loading branch information
florian-h05 committed Mar 13, 2024
1 parent c41aa38 commit 5ec8fc8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 80 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -567,12 +567,6 @@ export default {
this.$f7router.navigate('/settings/rules/' + this.rule.uid + '/script/' + mod.id, { transition: this.$theme.aurora ? 'f7-cover-v' : '' })
})
},
updateScript (value) {
if (this.isEditable) this.currentModule.configuration.script = value
},
updateCronExpression (value) {
this.currentModule.configuration.cronExpression = value
},
toYaml () {
this.ruleYaml = YAML.stringify({
configuration: this.rule.configuration,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</f7-nav-right>
</f7-navbar>
<f7-block v-if="ruleModule" class="no-margin no-padding">
<f7-col v-if="!isSceneModule && currentRuleModuleType" class="margin-top">
<f7-col v-if="!currentRuleModuleType" class="margin-top">
<f7-list inline-labels no-hairlines-md class="no-margin">
<f7-list-input type="text" :placeholder="moduleTitleSuggestion" :value="ruleModule.label" required
@input="ruleModule.label = $event.target.value" clear-button />
Expand All @@ -28,6 +28,7 @@
</f7-col>
<!-- <f7-block-footer class="no-margin padding-left"><small>Tip: leave fields blank to set automatically to the suggested name and description. <f7-link @click="ruleModule.label = null; ruleModule.description = null">Clear</f7-link></small></f7-block-footer> -->

<!-- module type picker -->
<div v-if="ruleModule.new">
<f7-block-title class="no-margin padding-horizontal margin-vertical" v-if="!advancedTypePicker" medium>
{{ SectionLabels[currentSection][0] }}
Expand All @@ -46,7 +47,9 @@
<condition-module-wizard v-else-if="!advancedTypePicker && currentSection === 'conditions'" :current-module="ruleModule" :current-module-type="currentRuleModuleType" @typeSelect="setModuleType" @showAdvanced="advancedTypePicker = true" @startScript="startScripting" />
<action-module-wizard v-else-if="!advancedTypePicker && currentSection === 'actions'" :current-module="ruleModule" :current-module-type="currentRuleModuleType" @typeSelect="setModuleType" @showAdvanced="advancedTypePicker = true" @startScript="startScripting" />
</div>
<f7-list v-if="!isSceneModule && ruleModule.type && (!ruleModule.new || advancedTypePicker)">

<!-- module configuration -->
<f7-list v-if="ruleModule.type && (!ruleModule.new || advancedTypePicker)">
<f7-list-item :title="SectionLabels[currentSection][0]" ref="ruleModuleTypeSmartSelect" smart-select :smart-select-params="{ view: $f7.views.main, openIn: 'popup', closeOnSelect: true }">
<select name="ruleModuleType"
@change="setModuleType(moduleTypes[currentSection].find((t) => t.uid === $refs.ruleModuleTypeSmartSelect.f7SmartSelect.getValue()), true)">
Expand All @@ -59,7 +62,7 @@
</select>
</f7-list-item>
</f7-list>
<f7-block-title v-if="!isSceneModule && ruleModule && currentRuleModuleType && (!ruleModule.new || advancedTypePicker)" style="margin-bottom: calc(var(--f7-block-title-margin-bottom) - var(--f7-list-margin-vertical))">
<f7-block-title v-if="ruleModule && currentRuleModuleType && (!ruleModule.new || advancedTypePicker)" style="margin-bottom: calc(var(--f7-block-title-margin-bottom) - var(--f7-list-margin-vertical))">
Configuration
</f7-block-title>
<f7-col v-if="ruleModule && currentRuleModuleType && (!ruleModule.new || advancedTypePicker)">
Expand Down Expand Up @@ -100,7 +103,7 @@ export default {
ActionModuleWizard,
ConfigSheet
},
props: ['rule', 'ruleModule', 'ruleModuleType', 'moduleTypes', 'currentSection', 'isSceneModule'],
props: ['rule', 'ruleModule', 'ruleModuleType', 'moduleTypes', 'currentSection'],
data () {
return {
currentRuleModuleType: this.ruleModuleType,
Expand Down

0 comments on commit 5ec8fc8

Please sign in to comment.