Fix some blocked/allow laggards after migrating. Add DuckDB for outstanding analyitcs performance. Start adding an import for all bot networks
This commit is contained in:
36
app/javascript/controllers/rule_form_controller.js
Normal file
36
app/javascript/controllers/rule_form_controller.js
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class RuleFormController extends Controller {
|
||||
static targets = ["actionSelect", "addHeaderSection", "expirationCheckbox", "expirationField"]
|
||||
|
||||
connect() {
|
||||
this.updateActionSections()
|
||||
}
|
||||
|
||||
updateActionSections() {
|
||||
const selectedAction = this.actionSelectTarget.value
|
||||
|
||||
// Hide all action-specific sections
|
||||
this.addHeaderSectionTarget.classList.add('hidden')
|
||||
|
||||
// Show relevant section based on action
|
||||
switch(selectedAction) {
|
||||
case 'add_header':
|
||||
this.addHeaderSectionTarget.classList.remove('hidden')
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
toggleExpiration() {
|
||||
if (this.expirationCheckboxTarget.checked) {
|
||||
this.expirationFieldTarget.classList.remove('hidden')
|
||||
} else {
|
||||
this.expirationFieldTarget.classList.add('hidden')
|
||||
// Clear the datetime field when unchecked
|
||||
const datetimeInput = this.expirationFieldTarget.querySelector('input[type="datetime-local"]')
|
||||
if (datetimeInput) {
|
||||
datetimeInput.value = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user