Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions workspaces/orchestrator/.changeset/gentle-foxes-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@red-hat-developer-hub/backstage-plugin-orchestrator': patch
---

Fix unintended Workflows tab on User profile pages by converting the entity tab condition from a React hook-based component to a plain predicate function and using the built-in hasAnnotation checker in dynamic plugin config
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ dynamicPlugins:
gridColumn: '1 / -1'
if:
anyOf:
- IsOrchestratorCatalogTabAvailable
- hasAnnotation: orchestrator.io/workflows
8 changes: 4 additions & 4 deletions workspaces/orchestrator/plugins/orchestrator/report.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@

```ts
import { BackstagePlugin } from '@backstage/core-plugin-api';
import { Entity } from '@backstage/catalog-model';
import { JSX as JSX_2 } from 'react/jsx-runtime';
import { RouteRef } from '@backstage/core-plugin-api';
import { SvgIconProps } from '@mui/material/SvgIcon';
import { TranslationRef } from '@backstage/frontend-plugin-api';
import { TranslationResource } from '@backstage/frontend-plugin-api';

// @public (undocumented)
export const IsOrchestratorCatalogTabAvailable: () => boolean;
// @public
export const IsOrchestratorCatalogTabAvailable: (entity: Entity) => boolean;

// Warning: (ae-missing-release-tag) "OrchestratorCatalogTab" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
Expand Down Expand Up @@ -229,8 +230,7 @@ export const orchestratorTranslations: TranslationResource<'plugin.orchestrator'

// Warnings were encountered during analysis:
//
// src/components/catalogComponents/CatalogTab.d.ts:5:22 - (ae-undocumented) Missing documentation for "IsOrchestratorCatalogTabAvailable".
// src/components/catalogComponents/CatalogTab.d.ts:6:22 - (ae-undocumented) Missing documentation for "OrchestratorCatalogTab".
// src/components/catalogComponents/CatalogTab.d.ts:12:22 - (ae-undocumented) Missing documentation for "OrchestratorCatalogTab".

// (No @packageDocumentation comment for this package)
```
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Entity } from '@backstage/catalog-model';
import { useEntity } from '@backstage/plugin-catalog-react';

import { WorkflowsTabContent } from '../OrchestratorPage/WorkflowsTabContent';

/**
* @public
* @returns True if the entity has the orchestrator.io/workflows annotation
* Predicate that returns true when the entity carries the
* `orchestrator.io/workflows` annotation.
*
* Compatible with both the legacy `EntityLayout.Route` `if` prop
* and the RHDH dynamic-plugin `if.anyOf` condition system, which
* call it as a plain function with the entity as the first argument.
*/
export const IsOrchestratorCatalogTabAvailable = () => {
const { entity } = useEntity();
return Boolean(entity.metadata.annotations?.['orchestrator.io/workflows']);
};
export const IsOrchestratorCatalogTabAvailable = (entity: Entity): boolean =>
Boolean(entity.metadata.annotations?.['orchestrator.io/workflows']);

export const OrchestratorCatalogTab = () => {
const { entity } = useEntity();
Expand Down
Loading