Skip to content

Commit

Permalink
WIP3
Browse files Browse the repository at this point in the history
  • Loading branch information
raviks789 committed Feb 28, 2024
1 parent e152bf2 commit 8e16e7e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
2 changes: 1 addition & 1 deletion application/controllers/EventRuleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ public function indexAction(): void
->on(EventRuleConfigForm::ON_DISCARD, function () use ($config) {
$ruleId = $config['id'];
$this->sessionNamespace->delete($ruleId);
Notification::success(sprintf(t('Successfully discarded changes to event rule %s'), $config['name']));
$this->redirectNow(Links::eventRule($ruleId));
})
->on(EventRuleConfigForm::ON_CHANGE, function (EventRuleConfigForm $form) use ($config) {
$formValues = $form->getValues();
$config = array_merge($config, $form->getValues());
$this->sessionNamespace->set($config['id'], $config);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@

class EventRuleConfigFilter extends FieldsetElement
{
/** @var bool */
public $showSearchBar = false;

/** @var Url The url to open the SearchEditor at */
/** @var Url Url of the search editor */
protected $searchEditorUrl;

/** @var ?string */
/** @var ?string Event rule's object filter*/
protected $objectFilter;

protected $defaultAttributes = ['class' => 'config-filter'];
Expand Down Expand Up @@ -57,7 +54,7 @@ protected function assemble()
} else {
$editorOpener = new Link(
new Icon('cog'),
$this->searchEditorUrl,
$this->getSearchEditorUrl(),
Attributes::create([
'class' => 'search-editor-opener control-button',
'title' => t('Adjust Filter'),
Expand All @@ -82,31 +79,50 @@ protected function assemble()
$this->add($filterElement);
}

/**
* Set the Url of the search editor
*
* @param Url $url
*
* @return $this
*/
public function setSearchEditorUrl(Url $url)
{
$this->searchEditorUrl = $url;

return $this;
}

/**
* Get the search editor's Url
*
* @return Url
*/
public function getSearchEditorUrl()
{
return $this->searchEditorUrl;
}

/**
* Set the event rule's object filter
*
* @param string $filter
*
* @return $this
*/
public function setObjectFilter(string $filter)
public function setObjectFilter(string $filter): self
{
$this->objectFilter = rawurldecode($filter);

return $this;
}

public function getObjectFilter()
/**
* Get the event rule's object filter
*
* @return ?string
*/
public function getObjectFilter(): ?string
{
return $this->objectFilter;
}
Expand Down
1 change: 0 additions & 1 deletion application/forms/EventRuleConfigForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ protected function assemble()
for ($i = 1; $i <= $escalationCount; $i++) {
$escalationCondition = new EscalationCondition('escalation-condition_' . $i);
$escalationRecipient = new EscalationRecipient('escalation-recipient_' . $i);

$this->registerElement($escalationCondition);
$this->registerElement($escalationRecipient);

Expand Down

0 comments on commit 8e16e7e

Please sign in to comment.