-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Host|Service) Detail view: Introduce parents and children tab #1098
base: dependencies
Are you sure you want to change the base?
Conversation
59dc8c9
to
74bb945
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the issue:
The tabs are only visible if the object is linked in the database table dependency_node.
The tabs are always visible right now.
c37ece0
to
9ab8072
Compare
Except for the error in the search bar while trying to apply filter in Parents/Children tabs, everything else seems to work as listed out in the issue. |
@@ -55,13 +66,18 @@ public function init() | |||
} | |||
|
|||
$this->host = $host; | |||
$this->loadTabsForObject($host); | |||
$this->loadTabsForObject($this->host); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, I have reverted the change.
$this->sendMultipartUpdate(); | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->sendMultipartUpdate(); | |
return; | |
$this->sendMultipartUpdate(); | |
return; |
'name' => t('Name'), | ||
'severity desc, last_state_change desc' => t('Severity'), | ||
'state' => t('Current State'), | ||
'last_state_change desc' => t('Last State Change') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use $this->translate()
method instead as you have done in parentsAction
for translation. Also, you seemed to have use the function t()
in some places and $this->translate()
in some places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
protected function createTabs(): Tabs | ||
{ | ||
$hasDependencyNode = DependencyNode::on($this->getDb()) | ||
->columns('1') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
->columns('1') | |
->columns([new ipl\Sql\Expression('1')]) |
protected function createTabs(): Tabs | ||
{ | ||
$hasDependecyNode = DependencyNode::on($this->getDb()) | ||
->columns('1') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
->columns('1') | |
->columns([[new ipl\Sql\Expression('1')]]) |
@@ -63,7 +72,12 @@ public function init() | |||
} | |||
|
|||
$this->service = $service; | |||
$this->loadTabsForObject($service); | |||
$this->loadTabsForObject($this->service); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO this change is not required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have reverted it.
'name' => t('Name'), | ||
'severity desc, last_state_change desc' => t('Severity'), | ||
'state' => t('Current State'), | ||
'last_state_change desc' => t('Last State Change') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in my comment in HostController::childrenAction
, you could also use $this->translate()
method instead as you have done in parentsAction
for translation.
Filter::equal('service_id', $this->service->id), | ||
Filter::equal('host_id', $this->service->host_id) | ||
)) | ||
->first() !== null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, you could either ignore this strict comparison, or you could use ->execute()->hasResult()
that would return boolean.
if ($hasDependencyNode) { | ||
$tabs->add('parents', [ | ||
'label' => t('Parents'), | ||
'url' => Url::fromPath('icingadb/host/parents', ['name' => $this->host->name]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned earlier, you could create and use Link::hostParents
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed offline, Link
class should not be used here.
.title > * { | ||
margin: 0 .28125em; // 0 calculated width | ||
|
||
&:first-child { | ||
margin-left: 0; | ||
} | ||
|
||
&:last-child { | ||
margin-right: 0; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rule is already applied in ipl-web
item-list.less
. Is there a reason why you are doing this here again?
9ab8072
to
fb557c7
Compare
- Otherwise the searchbar uses it as base filter and apply it on the query
- Set the outer tab as active. Previously, the inner tab was activated in the setTitleTab method, but the outer tab does not know about the state of inner tabs. So whenever sendMultipartUpdate() -> getActiveTab() was called, the retured value was always null.
fb557c7
to
03a160d
Compare
No description provided.