-
Notifications
You must be signed in to change notification settings - Fork 21
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
Show root problem list for objects with problem and are part of dependency #1057
Open
raviks789
wants to merge
2
commits into
dependencies
Choose a base branch
from
root-problem-list
base: dependencies
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+569
−64
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,13 +46,6 @@ public function __construct($item) | |
$this->url = $this->getBaseUrl(); | ||
} | ||
|
||
/** | ||
* Get the badge base URL | ||
* | ||
* @return Url | ||
*/ | ||
abstract protected function getBaseUrl(): Url; | ||
|
||
/** | ||
* Get the type of the items | ||
* | ||
|
@@ -67,14 +60,27 @@ abstract protected function getType(): string; | |
*/ | ||
abstract protected function getPrefix(): string; | ||
|
||
/** | ||
* Get the badge base URL | ||
* | ||
* @return ?Url | ||
*/ | ||
protected function getBaseUrl(): ?Url | ||
{ | ||
return null; | ||
} | ||
|
||
/** | ||
* Get the integer of the given state text | ||
* | ||
* @param string $state | ||
* | ||
* @return int | ||
*/ | ||
abstract protected function getStateInt(string $state): int; | ||
protected function getStateInt(string $state): int | ||
{ | ||
return 0; | ||
} | ||
|
||
/** | ||
* Get the badge URL | ||
|
@@ -132,18 +138,25 @@ public function createLink($content, Filter\Rule $filter = null): Link | |
* Create a state bade | ||
* | ||
* @param string $state | ||
* @param bool $createLink Create link for the badge if true | ||
* | ||
* @return ?BaseHtmlElement | ||
*/ | ||
protected function createBadge(string $state) | ||
protected function createBadge(string $state, bool $createLink = true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Drop |
||
{ | ||
$key = $this->prefix . "_{$state}"; | ||
|
||
if (isset($this->item->$key) && $this->item->$key) { | ||
return Html::tag('li', $this->createLink( | ||
new StateBadge($this->item->$key, $state), | ||
Filter::equal($this->type . '.state.soft_state', $this->getStateInt($state)) | ||
)); | ||
$stateBadge = new StateBadge($this->item->$key, $state); | ||
|
||
if ($createLink) { | ||
$this->createLink( | ||
$stateBadge, | ||
Filter::equal($this->type . '.state.soft_state', $this->getStateInt($state)) | ||
); | ||
} | ||
|
||
return Html::tag('li', $stateBadge); | ||
} | ||
|
||
return null; | ||
|
@@ -153,37 +166,50 @@ protected function createBadge(string $state) | |
* Create a state group | ||
* | ||
* @param string $state | ||
* @param bool $createLink Create link for the badge if true | ||
* | ||
* @return ?BaseHtmlElement | ||
*/ | ||
protected function createGroup(string $state) | ||
protected function createGroup(string $state, bool $createLink = true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Drop |
||
{ | ||
$content = []; | ||
$handledKey = $this->prefix . "_{$state}_handled"; | ||
$unhandledKey = $this->prefix . "_{$state}_unhandled"; | ||
|
||
if (isset($this->item->$unhandledKey) && $this->item->$unhandledKey) { | ||
$content[] = Html::tag('li', $this->createLink( | ||
new StateBadge($this->item->$unhandledKey, $state), | ||
Filter::all( | ||
Filter::equal($this->type . '.state.soft_state', $this->getStateInt($state)), | ||
Filter::equal($this->type . '.state.is_handled', 'n'), | ||
Filter::equal($this->type . '.state.is_reachable', 'y') | ||
) | ||
)); | ||
$unhandledStateBadge = new StateBadge($this->item->$unhandledKey, $state); | ||
|
||
if ($createLink) { | ||
$unhandledStateBadge = $this->createLink( | ||
$unhandledStateBadge, | ||
Filter::all( | ||
Filter::equal($this->type . '.state.soft_state', $this->getStateInt($state)), | ||
Filter::equal($this->type . '.state.is_handled', 'n'), | ||
Filter::equal($this->type . '.state.is_reachable', 'y') | ||
) | ||
); | ||
} | ||
|
||
$content[] = Html::tag('li', $unhandledStateBadge); | ||
} | ||
|
||
if (isset($this->item->$handledKey) && $this->item->$handledKey) { | ||
$content[] = Html::tag('li', $this->createLink( | ||
new StateBadge($this->item->$handledKey, $state, true), | ||
Filter::all( | ||
Filter::equal($this->type . '.state.soft_state', $this->getStateInt($state)), | ||
Filter::any( | ||
Filter::equal($this->type . '.state.is_handled', 'y'), | ||
Filter::equal($this->type . '.state.is_reachable', 'n') | ||
$handledStateBadge = new StateBadge($this->item->$handledKey, $state, true); | ||
|
||
if ($createLink) { | ||
$handledStateBadge = $this->createLink( | ||
$handledStateBadge, | ||
Filter::all( | ||
Filter::equal($this->type . '.state.soft_state', $this->getStateInt($state)), | ||
Filter::any( | ||
Filter::equal($this->type . '.state.is_handled', 'y'), | ||
Filter::equal($this->type . '.state.is_reachable', 'n') | ||
) | ||
) | ||
) | ||
)); | ||
); | ||
} | ||
|
||
$content[] = Html::tag('li', $handledStateBadge); | ||
} | ||
|
||
if (empty($content)) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Throw
InvalidArgumentException
instead