Skip to content

Commit ea8dcfc

Browse files
committed
Fix detail view
1 parent b5555fb commit ea8dcfc

21 files changed

+110
-54
lines changed

application/controllers/DaemonsetController.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Icinga\Module\Kubernetes\Web\Controller;
1111
use Icinga\Module\Kubernetes\Web\DaemonSetDetail;
1212
use Icinga\Module\Kubernetes\Web\DaemonSetList;
13+
use Icinga\Module\Kubernetes\Web\ViewModeSwitcher;
1314
use ipl\Stdlib\Filter;
1415
use Ramsey\Uuid\Uuid;
1516

@@ -33,7 +34,12 @@ public function indexAction(): void
3334
$this->httpNotFound($this->translate('Daemon Set not found'));
3435
}
3536

36-
$this->addControl((new DaemonSetList([$daemonSet]))->setActionList(false));
37+
$this->addControl((new DaemonSetList([$daemonSet])));
38+
$this->addControl(
39+
(new DaemonSetList([$daemonSet]))
40+
->setActionList(false)
41+
->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)
42+
);
3743

3844
$this->addContent(new DaemonSetDetail($daemonSet));
3945
}

application/controllers/DeploymentController.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Icinga\Module\Kubernetes\Web\Controller;
1111
use Icinga\Module\Kubernetes\Web\DeploymentDetail;
1212
use Icinga\Module\Kubernetes\Web\DeploymentList;
13+
use Icinga\Module\Kubernetes\Web\ViewModeSwitcher;
1314
use ipl\Stdlib\Filter;
1415
use Ramsey\Uuid\Uuid;
1516

@@ -33,7 +34,11 @@ public function indexAction(): void
3334
$this->httpNotFound($this->translate('Deployment not found'));
3435
}
3536

36-
$this->addControl((new DeploymentList([$deployment]))->setActionList(false));
37+
$this->addControl(
38+
(new DeploymentList([$deployment]))
39+
->setActionList(false)
40+
->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)
41+
);
3742

3843
$this->addContent(new DeploymentDetail($deployment));
3944
}

application/controllers/JobController.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Icinga\Module\Kubernetes\Web\Controller;
1111
use Icinga\Module\Kubernetes\Web\JobDetail;
1212
use Icinga\Module\Kubernetes\Web\JobList;
13+
use Icinga\Module\Kubernetes\Web\ViewModeSwitcher;
1314
use ipl\Stdlib\Filter;
1415
use Ramsey\Uuid\Uuid;
1516

@@ -33,7 +34,11 @@ public function indexAction(): void
3334
$this->httpNotFound($this->translate('Job not found'));
3435
}
3536

36-
$this->addControl((new JobList([$job]))->setActionList(false));
37+
$this->addControl(
38+
(new JobList([$job]))
39+
->setActionList(false)
40+
->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)
41+
);
3742

3843
$this->addContent(new JobDetail($job));
3944
}

application/controllers/NodeController.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Icinga\Module\Kubernetes\Web\Controller;
1111
use Icinga\Module\Kubernetes\Web\NodeDetail;
1212
use Icinga\Module\Kubernetes\Web\NodeList;
13+
use Icinga\Module\Kubernetes\Web\ViewModeSwitcher;
1314
use ipl\Stdlib\Filter;
1415
use Ramsey\Uuid\Uuid;
1516

@@ -33,7 +34,11 @@ public function indexAction(): void
3334
$this->httpNotFound($this->translate('Node not found'));
3435
}
3536

36-
$this->addControl((new NodeList([$node]))->setActionList(false));
37+
$this->addControl(
38+
(new NodeList([$node]))
39+
->setActionList(false)
40+
->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)
41+
);
3742

3843
$this->addContent(new NodeDetail($node));
3944
}

application/controllers/PodController.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Icinga\Module\Kubernetes\Web\Controller;
1111
use Icinga\Module\Kubernetes\Web\PodDetail;
1212
use Icinga\Module\Kubernetes\Web\PodList;
13+
use Icinga\Module\Kubernetes\Web\ViewModeSwitcher;
1314
use ipl\Stdlib\Filter;
1415
use Ramsey\Uuid\Uuid;
1516

@@ -33,7 +34,11 @@ public function indexAction(): void
3334
$this->httpNotFound($this->translate('Pod not found'));
3435
}
3536

36-
$this->addControl((new PodList([$pod]))->setActionList(false));
37+
$this->addControl(
38+
(new PodList([$pod]))
39+
->setActionList(false)
40+
->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)
41+
);
3742

3843
$this->addContent(new PodDetail($pod));
3944
}

application/controllers/ReplicasetController.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Icinga\Module\Kubernetes\Web\Controller;
1111
use Icinga\Module\Kubernetes\Web\ReplicaSetDetail;
1212
use Icinga\Module\Kubernetes\Web\ReplicaSetList;
13+
use Icinga\Module\Kubernetes\Web\ViewModeSwitcher;
1314
use ipl\Stdlib\Filter;
1415
use Ramsey\Uuid\Uuid;
1516

@@ -33,7 +34,11 @@ public function indexAction(): void
3334
$this->httpNotFound($this->translate('Replica Set not found'));
3435
}
3536

36-
$this->addControl((new ReplicaSetList([$replicaSet]))->setActionList(false));
37+
$this->addControl(
38+
(new ReplicaSetList([$replicaSet]))
39+
->setActionList(false)
40+
->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)
41+
);
3742

3843
$this->addContent(new ReplicaSetDetail($replicaSet));
3944
}

application/controllers/StatefulsetController.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Icinga\Module\Kubernetes\Web\Controller;
1111
use Icinga\Module\Kubernetes\Web\StatefulSetDetail;
1212
use Icinga\Module\Kubernetes\Web\StatefulSetList;
13+
use Icinga\Module\Kubernetes\Web\ViewModeSwitcher;
1314
use ipl\Stdlib\Filter;
1415
use Ramsey\Uuid\Uuid;
1516

@@ -33,7 +34,11 @@ public function indexAction(): void
3334
$this->httpNotFound($this->translate('Stateful Set not found'));
3435
}
3536

36-
$this->addControl((new StatefulSetList([$statefulSet]))->setActionList(false));
37+
$this->addControl(
38+
(new StatefulSetList([$statefulSet]))
39+
->setActionList(false)
40+
->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)
41+
);
3742

3843
$this->addContent(new StatefulSetDetail($statefulSet));
3944
}

library/Kubernetes/Common/BaseItemList.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ protected function assemble(): void
8888
Filter::equal('id', Uuid::fromBytes($item->uuid)->toString())
8989
)
9090
]);
91-
$listItem->setViewMode($this->getViewMode());
91+
92+
if ($this->getViewMode() !== null) {
93+
$listItem->setViewMode($this->getViewMode());
94+
}
9295

9396
$this->addHtml(
9497
$listItem

library/Kubernetes/Web/CronJobDetail.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@ protected function assemble(): void
6868
'section',
6969
null,
7070
new HtmlElement('h2', null, new Text($this->translate('Jobs'))),
71-
new JobList(Auth::getInstance()->withRestrictions(
71+
(new JobList(Auth::getInstance()->withRestrictions(
7272
Auth::SHOW_JOBS,
7373
$this->cronJob->job
74-
))
74+
)))
75+
->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)
7576
));
7677
}
7778

@@ -80,8 +81,9 @@ protected function assemble(): void
8081
'section',
8182
null,
8283
new HtmlElement('h2', null, new Text($this->translate('Events'))),
83-
new EventList(Event::on(Database::connection())
84-
->filter(Filter::equal('reference_uuid', $this->cronJob->uuid)))
84+
(new EventList(Event::on(Database::connection())
85+
->filter(Filter::equal('reference_uuid', $this->cronJob->uuid))))
86+
->setViewMode(ViewModeSwitcher::VIEW_MODE_COMMON)
8587
));
8688
}
8789

library/Kubernetes/Web/DaemonSetDetail.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,11 @@ protected function assemble(): void
8989
'section',
9090
null,
9191
new HtmlElement('h2', null, new Text($this->translate('Pods'))),
92-
new PodList(Auth::getInstance()->withRestrictions(
92+
(new PodList(Auth::getInstance()->withRestrictions(
9393
Auth::SHOW_PODS,
9494
$this->daemonSet->pod->with(['node'])
95-
))
95+
)))
96+
->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)
9697
));
9798
}
9899

@@ -101,8 +102,9 @@ protected function assemble(): void
101102
'section',
102103
null,
103104
new HtmlElement('h2', null, new Text($this->translate('Events'))),
104-
new EventList(Event::on(Database::connection())
105-
->filter(Filter::equal('reference_uuid', $this->daemonSet->uuid)))
105+
(new EventList(Event::on(Database::connection())
106+
->filter(Filter::equal('reference_uuid', $this->daemonSet->uuid))))
107+
->setViewMode(ViewModeSwitcher::VIEW_MODE_COMMON)
106108
));
107109
}
108110

library/Kubernetes/Web/DeploymentDetail.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,11 @@ protected function assemble(): void
9191
'section',
9292
null,
9393
new HtmlElement('h2', null, new Text($this->translate('Replica Sets'))),
94-
new ReplicaSetList(Auth::getInstance()->withRestrictions(
94+
(new ReplicaSetList(Auth::getInstance()->withRestrictions(
9595
Auth::SHOW_REPLICA_SETS,
9696
$this->deployment->replica_set
97-
))
97+
)))
98+
->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)
9899
));
99100
}
100101

@@ -103,8 +104,9 @@ protected function assemble(): void
103104
'section',
104105
null,
105106
new HtmlElement('h2', null, new Text($this->translate('Events'))),
106-
new EventList(Event::on(Database::connection())
107-
->filter(Filter::equal('reference_uuid', $this->deployment->uuid)))
107+
(new EventList(Event::on(Database::connection())
108+
->filter(Filter::equal('reference_uuid', $this->deployment->uuid))))
109+
->setViewMode(ViewModeSwitcher::VIEW_MODE_COMMON)
108110
));
109111
}
110112

library/Kubernetes/Web/EventDetail.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ protected function assemble(): void
5858
'section',
5959
null,
6060
new HtmlElement('h2', null, new Text($this->translate('Referent'))),
61-
Factory::createList($this->event->reference_kind, Filter::equal('uuid', $this->event->reference_uuid))
61+
Factory::createList($this->event->reference_kind, Filter::equal('uuid', $this->event->reference_uuid)) // TODO fix with restrictions
6262
)
6363
);
6464

library/Kubernetes/Web/JobDetail.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,11 @@ protected function assemble(): void
8787
'section',
8888
null,
8989
new HtmlElement('h2', null, new Text($this->translate('Pods'))),
90-
new PodList(Auth::getInstance()->withRestrictions(
90+
(new PodList(Auth::getInstance()->withRestrictions(
9191
Auth::SHOW_PODS,
9292
$this->job->pod->with(['node'])
93-
))
93+
)))
94+
->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)
9495
));
9596
}
9697

@@ -99,8 +100,9 @@ protected function assemble(): void
99100
'section',
100101
null,
101102
new HtmlElement('h2', null, new Text('Events')),
102-
new EventList(Event::on(Database::connection())
103-
->filter(Filter::equal('reference_uuid', $this->job->uuid)))
103+
(new EventList(Event::on(Database::connection())
104+
->filter(Filter::equal('reference_uuid', $this->job->uuid))))
105+
->setViewMode(ViewModeSwitcher::VIEW_MODE_COMMON)
104106
));
105107
}
106108

library/Kubernetes/Web/NamespaceDetail.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ protected function assemble(): void
5555
'section',
5656
null,
5757
new HtmlElement('h2', null, new Text($this->translate('Events'))),
58-
new EventList(Event::on(Database::connection())
59-
->filter(Filter::equal('reference_uuid', $this->namespace->uuid)))
58+
(new EventList(Event::on(Database::connection())
59+
->filter(Filter::equal('reference_uuid', $this->namespace->uuid))))
60+
->setViewMode(ViewModeSwitcher::VIEW_MODE_COMMON)
6061
));
6162
}
6263

library/Kubernetes/Web/NodeDetail.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,9 @@ protected function assemble(): void
101101
'section',
102102
null,
103103
new HtmlElement('h2', null, new Text($this->translate('Events'))),
104-
new EventList(Event::on(Database::connection())
105-
->filter(Filter::equal('reference_uuid', $this->node->uuid)))
104+
(new EventList(Event::on(Database::connection())
105+
->filter(Filter::equal('reference_uuid', $this->node->uuid))))
106+
->setViewMode(ViewModeSwitcher::VIEW_MODE_COMMON)
106107
));
107108
}
108109

library/Kubernetes/Web/PersistentVolumeClaimDetail.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,11 @@ protected function assemble(): void
7373
'section',
7474
null,
7575
new HtmlElement('h2', null, new Text($this->translate('Pods'))),
76-
new PodList(Auth::getInstance()->withRestrictions(
76+
(new PodList(Auth::getInstance()->withRestrictions(
7777
Auth::SHOW_PODS,
7878
$this->pvc->pod
79-
))
79+
)))
80+
->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)
8081
));
8182
}
8283

@@ -85,8 +86,9 @@ protected function assemble(): void
8586
'section',
8687
null,
8788
new HtmlElement('h2', null, new Text($this->translate('Events'))),
88-
new EventList(Event::on(Database::connection())
89-
->filter(Filter::equal('reference_uuid', $this->pvc->uuid)))
89+
(new EventList(Event::on(Database::connection())
90+
->filter(Filter::equal('reference_uuid', $this->pvc->uuid))))
91+
->setViewMode(ViewModeSwitcher::VIEW_MODE_COMMON)
9092
));
9193
}
9294

library/Kubernetes/Web/PersistentVolumeDetail.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,11 @@ protected function assemble(): void
6767
'section',
6868
new Attributes(['class' => 'persistent-volume-claims']),
6969
new HtmlElement('h2', null, new Text($this->translate('Claims'))),
70-
new PersistentVolumeClaimList(Auth::getInstance()->withRestrictions(
70+
(new PersistentVolumeClaimList(Auth::getInstance()->withRestrictions(
7171
Auth::SHOW_PERSISTENT_VOLUME_CLAIMS,
7272
$this->persistentVolume->pvc
73-
))
73+
)))
74+
->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)
7475
));
7576
}
7677

@@ -79,8 +80,9 @@ protected function assemble(): void
7980
'section',
8081
null,
8182
new HtmlElement('h2', null, new Text($this->translate('Events'))),
82-
new EventList(Event::on(Database::connection())
83-
->filter(Filter::equal('reference_uuid', $this->persistentVolume->uuid)))
83+
(new EventList(Event::on(Database::connection())
84+
->filter(Filter::equal('reference_uuid', $this->persistentVolume->uuid))))
85+
->setViewMode(ViewModeSwitcher::VIEW_MODE_COMMON)
8486
));
8587
}
8688

library/Kubernetes/Web/PodDetail.php

+5-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use Icinga\Module\Kubernetes\Model\Container;
1414
use Icinga\Module\Kubernetes\Model\Event;
1515
use Icinga\Module\Kubernetes\Model\Pod;
16-
use Icinga\Module\Kubernetes\Model\PodOwner;
1716
use ipl\Html\Attributes;
1817
use ipl\Html\BaseHtmlElement;
1918
use ipl\Html\HtmlDocument;
@@ -24,7 +23,6 @@
2423
use ipl\Web\Widget\EmptyState;
2524
use ipl\Web\Widget\Icon;
2625
use ipl\Web\Widget\StateBall;
27-
use Ramsey\Uuid\Uuid;
2826

2927
class PodDetail extends BaseHtmlElement
3028
{
@@ -123,10 +121,10 @@ protected function assemble(): void
123121
'section',
124122
null,
125123
new HtmlElement('h2', null, new Text($this->translate('Persistent Volume Claims'))),
126-
new PersistentVolumeClaimList(Auth::getInstance()->withRestrictions(
124+
(new PersistentVolumeClaimList(Auth::getInstance()->withRestrictions(
127125
Auth::SHOW_PERSISTENT_VOLUME_CLAIMS,
128126
$this->pod->pvc
129-
))
127+
)))->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)
130128
));
131129
}
132130

@@ -135,8 +133,9 @@ protected function assemble(): void
135133
'section',
136134
null,
137135
new HtmlElement('h2', null, new Text('Events')),
138-
new EventList(Event::on(Database::connection())
139-
->filter(Filter::equal('reference_uuid', $this->pod->uuid)))
136+
(new EventList(Event::on(Database::connection())
137+
->filter(Filter::equal('reference_uuid', $this->pod->uuid))))
138+
->setViewMode(ViewModeSwitcher::VIEW_MODE_COMMON)
140139
));
141140
}
142141

0 commit comments

Comments
 (0)