Skip to content

Commit c8e70ee

Browse files
christoph2497Thomas-Gelf
authored andcommitted
fix linting issues and remove irrelevant comments
1 parent ea924e1 commit c8e70ee

File tree

5 files changed

+8
-69
lines changed

5 files changed

+8
-69
lines changed

application/controllers/ConfigurationController.php

Lines changed: 7 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,13 @@
1212
use gipfl\ZfDbStore\DbStorableInterface;
1313
use gipfl\ZfDbStore\NotFoundError;
1414
use gipfl\ZfDbStore\ZfDbStore;
15-
use Icinga\Chart\Inline\Inline;
1615
use Icinga\Module\Eventtracker\Data\PlainObjectRenderer;
1716
use Icinga\Module\Eventtracker\Db\ConfigStore;
1817
use Icinga\Module\Eventtracker\Engine\Downtime\DowntimeRule;
1918
use Icinga\Module\Eventtracker\Engine\Input\KafkaInput;
20-
use Icinga\Module\Eventtracker\Modifier\Modifier;
2119
use Icinga\Module\Eventtracker\Modifier\ModifierRuleStore;
22-
use Icinga\Module\Eventtracker\Modifier\ModifierChain;
23-
use Icinga\Module\Eventtracker\Modifier\RuleStore;
2420
use Icinga\Module\Eventtracker\Modifier\Settings;
25-
use Icinga\Module\Eventtracker\Syslog\SyslogParser;
2621
use Icinga\Module\Eventtracker\Web\Dashboard\ConfigurationDashboard;
27-
use Icinga\Module\Eventtracker\Web\Form\ChannelConfigForm;
2822
use Icinga\Module\Eventtracker\Web\Form\ChannelRuleForm;
2923
use Icinga\Module\Eventtracker\Web\Form\DowntimeForm;
3024
use Icinga\Module\Eventtracker\Web\Form\SimulateRuleForm;
@@ -38,14 +32,10 @@
3832
use Icinga\Module\Eventtracker\Web\WebActions;
3933
use Icinga\Web\Notification;
4034
use Icinga\Web\Session\SessionNamespace;
41-
use ipl\Html\FormElement\SubmitButtonElement;
42-
use ipl\Html\FormElement\SubmitElement;
4335
use ipl\Html\Html;
4436
use ipl\Html\Table;
4537
use Ramsey\Uuid\Uuid;
4638
use Ramsey\Uuid\UuidInterface;
47-
use function _PHPStan_90b10482a\React\Async\waterfall;
48-
use function ipl\Stdlib\get_php_type;
4939

5040
class ConfigurationController extends Controller
5141
{
@@ -175,7 +165,6 @@ public function channelAction()
175165
public function channelrulesAction()
176166
{
177167
$this->notForApi();
178-
// $this->add
179168
$action = $this->actions->get('channels');
180169
$this->channelTabs()->activate('rules');
181170
$this->actions()->add(Link::create($this->translate('Add Modifier'), Url::fromPath(
@@ -217,8 +206,7 @@ public function channelrulesAction()
217206
['uuid' => $this->requireUuid(),
218207
'action' => 'stop_simulation']
219208
)));
220-
}
221-
else if ($this->params->get('action') === 'load_simulation') {
209+
} elseif ($this->params->get('action') === 'load_simulation') {
222210
$simulationForm = new SimulateRuleForm($ns, $sessionKey);
223211
$simulationForm->handleRequest($this->getServerRequest());
224212
if ($simulationForm->hasBeenSubmitted()) {
@@ -665,8 +653,12 @@ protected function putHostListMembers()
665653
$this->sendJsonSuccess(['message' => sprintf('updated %s hosts', $cnt)], 201);
666654
}
667655

668-
protected function showRules(ModifierRuleStore $modifierRuleStore, SessionNamespace $ns, UuidInterface $uuid, UuidObjectForm $form)
669-
{
656+
protected function showRules(
657+
ModifierRuleStore $modifierRuleStore,
658+
SessionNamespace $ns,
659+
UuidInterface $uuid,
660+
UuidObjectForm $form
661+
) {
670662
$sessionKey = 'channelrules/' . $uuid->toString();
671663
$form->addElement('submit', 'add_modifier', []);
672664

@@ -696,7 +688,6 @@ protected function showRules(ModifierRuleStore $modifierRuleStore, SessionNamesp
696688
return;
697689
}
698690
try {
699-
//$modifiers = ModifierChain::fromSerialization($modifierRuleStore->getRules());
700691
$modifiers = $modifierRuleStore->getRules();
701692
} catch (JsonDecodeException $e) {
702693
$this->content()->add(Hint::error(sprintf(
@@ -705,8 +696,6 @@ protected function showRules(ModifierRuleStore $modifierRuleStore, SessionNamesp
705696
)));
706697
return;
707698
}
708-
// $ns->set('channelrules/' . $uuid->toString(), 'test');
709-
// $ns->get()
710699
$url = Url::fromPath('eventtracker/configuration/channelrule', [
711700
'uuid' => $uuid->toString()
712701
]);
@@ -744,46 +733,6 @@ protected function showRules(ModifierRuleStore $modifierRuleStore, SessionNamesp
744733
]);
745734
}
746735

747-
protected function getSampleObject()
748-
{
749-
return SyslogParser::parseLine(
750-
'Jan 11 13:12:54 goj oem_syslog[2837832]: timestamp=2025-01-11T12:12:54.560Z'
751-
. ' hostname=kri.example.com component=kri.example.com id=2837644 state=nok severity=2 oem_clear=false'
752-
. ' oem_host_name=kri.example.com oem_incident_ack_by_owner=no url=https://ip.gelf.net oem_incident_id=4996'
753-
. ' oem_incident_status=new'
754-
. ' oem_issue_type=incident oem_target_name=kri.example.com oem_target_type=host msg=Alert; Value=7;'
755-
. ' String <Returncode:> with values <> 0 found in /var/log/dbms/load_dbclone_for_oracle_mssql.log!'
756-
. ' OEMIncidentID: 4996'
757-
);
758-
return SyslogParser::parseLine(
759-
'Jan 11 13:12:54 goj oem_syslog[2837832]: timestamp=2025-01-11T12:12:54.560Z'
760-
. ' hostname=kri.example.com component=kri.example.com id=2837644 state=nok severity=2 oem_clear=false'
761-
. ' oem_host_name=kri.example.com oem_incident_ack_by_owner=no oem_incident_id=4996 oem_incident_status=new'
762-
. ' oem_issue_type=incident oem_target_name=kri.example.com oem_target_type=host msg=Alert; Value=7;'
763-
. ' String <Returncode:> with values <> 0 found in /var/log/dbms/dbclone_for_oracle_mssql.log!'
764-
. ' OEMIncidentID: 4996'
765-
);
766-
return JsonString::decode(
767-
'{' . "\n"
768-
. ' "host_name": "goj",' . "\n"
769-
. ' "object_name": "oem_syslog",' . "\n"
770-
. ' "object_class": "user",' . "\n"
771-
. ' "severity": "critical",' . "\n"
772-
. ' "priority": null,' . "\n"
773-
. ' "message": "timestamp=2025-02-02T13:24:30.276Z hostname=atb.example.com'
774-
. ' component=DBMS03_SITE1.EXAMPLE id=125690 state=nok severity=1 oem_clear=false'
775-
. ' oem_host_name=atb.example.com oem_incident_ack_by_owner=no oem_incident_id=144826'
776-
. ' oem_incident_status=new oem_issue_type=incident oem_target_name=dbms03_site1.example'
777-
. ' oem_target_type=oracle_pdb msg=The pluggable database DBMS03_SITE1.EXAMPLE is down.'
778-
. ' OEMIncidentID: 144826",' . "\n"
779-
. ' "attributes": {' . "\n"
780-
. ' "syslog_sender_pid": 125795' . "\n"
781-
. ' }' . "\n"
782-
. '}' . "\n"
783-
);
784-
return null;
785-
}
786-
787736
protected function showList(WebAction $action)
788737
{
789738
$this->setAutorefreshInterval(15);

library/Eventtracker/Modifier/ShortenString.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,4 @@ public static function extendSettingsForm(ChannelRuleForm $form): void
4949
'description' => 'The maximum length of the string generated by the shortened string'
5050
]);
5151
}
52-
5352
}

library/Eventtracker/SampleObject.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ public static function getSampleObject($type)
1616
switch ($type) {
1717
case 'syslog':
1818
return self::createSyslogOutput();
19-
break;
2019
case 'json':
2120
return self::createJsonStringOutput();
2221
default:
@@ -58,5 +57,4 @@ private static function createJsonStringOutput()
5857
. '}' . "\n"
5958
);
6059
}
61-
6260
}

library/Eventtracker/Web/Table/ChannelRulesTable.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class ChannelRulesTable extends Table
3131
'id' => 'channel-rules-table',
3232
'class' => [
3333
'common-table',
34-
// 'table-row-selectable',
3534
]
3635
];
3736

@@ -111,14 +110,11 @@ protected function assemble()
111110
'class' => ['collapsible-table-row', 'collapsed']
112111
]),
113112
$this::td([
114-
// $this->disableButton('X' . $row),
115113
$this->deleteButton($row),
116114
$this->moveUpButton($row),
117115
$this->moveDownButton($row),
118-
// Icon::create('angle-down'),
119-
// Icon::create('angle-up'),
120116
])
121-
], ['class' => 'sortable']));
117+
]));
122118
}
123119
}
124120

@@ -146,9 +142,6 @@ protected function deleteButton($key): InstanceInlineForm
146142
$this->modifierChain->removeModifier($key);
147143
$this->modifierRuleStore->setModifierRules($this->modifierChain);
148144
$this->hasBeenModified = true;
149-
150-
// var_dump($this->modifierChain->getModifiers());
151-
// var_dump("KILL $key");
152145
}
153146
return $form;
154147
}

0 commit comments

Comments
 (0)