Skip to content
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

Detail View integration won't work if configured custom command uses other custom vars. #455

Open
mkayontour opened this issue Dec 10, 2024 · 2 comments
Labels
enhancement New feature or improvement good first issue Good for newcomers help wanted Contributions are welcome

Comments

@mkayontour
Copy link
Member

mkayontour commented Dec 10, 2024

TLDR; Custom vars may differ while using a custom command for the detail view integration.

Problem

As stated in the documentation, you can use a custom command name for the detail view integration.
detail-view-integration

But with custom commands are custom vars specific for the command as well. As I'm sure many users have had custom commands of this because some started early to check processes before they were integrated in the ITL.

[...]
        $bpName = $service->customvars['icingacli_businessprocess_config'] ?? null;
[...]
        $nodeName = $service->customvars['icingacli_businessprocess_process'] ?? null;
[...]

$bpName = $service->customvars['icingacli_businessprocess_config'] ?? null;
if (! $bpName) {
$bpName = key($this->storage->listProcessNames());
}
$nodeName = $service->customvars['icingacli_businessprocess_process'] ?? null;
if (! $nodeName) {
return HtmlString::create('');
}
$bp = $this->storage->loadProcess($bpName);
$node = $bp->getBpNode($nodeName);
IcingaDbState::apply($bp);
if ($service->customvars['icingaweb_businessprocess_as_tree'] ?? false) {
$renderer = new TreeRenderer($bp, $node);
$tag = 'ul';
} else {
$renderer = new TileRenderer($bp, $node);
$tag = 'div';
}
$renderer->setUrl(Url::fromPath('businessprocess/process/show?config=' . $bpName . '&node=' . $nodeName));
$renderer->ensureAssembled()->getFirst($tag)->setAttribute('data-base-target', '_next');
return (new HtmlDocument())->addHtml(Html::tag('h2', 'Business Process'), $renderer);

Expected behaviour

Have the possibility to allow own custom vars for the detail extension views.

Versions

Businessprocess: 2.5.1

@nilmerg
Copy link
Member

nilmerg commented Dec 10, 2024

As I'm sure many users have had custom commands of this because some started early to check processes before they were integrated in the ITL.

I'm not so sure, icingacli_businessprocess_process was the only option from the beginning.

But it's certainly possible to support custom properties. Someday, or in case a volunteer takes over. 😉

@nilmerg nilmerg added enhancement New feature or improvement help wanted Contributions are welcome good first issue Good for newcomers labels Dec 10, 2024
@mkayontour
Copy link
Member Author

Thanks, I'll try to provide a PR. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement good first issue Good for newcomers help wanted Contributions are welcome
Projects
None yet
Development

No branches or pull requests

2 participants