Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Devcontainers frontend plugin] Make the component hidden if no annotation is present #145

@ipe4647

Description

@ipe4647

If the annotation is not present, make the DevcontainersProvider component hidden.

This should be working in packages/app/src/components/catalog/EntityPage.tsx:

    <EntitySwitch>
    <EntitySwitch.Case if={isDevContainersAvailable}>
    <Grid item md={6} xs={12}>
      <DevcontainersProvider config={devcontainersConfig}>
        <ExampleDevcontainersComponent/>
      </DevcontainersProvider>
    </Grid>
    </EntitySwitch.Case>
    </EntitySwitch>

The isDevContainersAvailavble function should check if the correct annotations are in place like (pseudocode):

export const isDevContainersAvailable = (entity: Entity) =>
  Boolean(entity.metadata.annotations?.[DEVCONTAINERS_ANNOTATION]);

This way the item can be hidden and the page can be cleaner.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions