Bug 1996158

Summary: Dynamic Plugins: Unable to add nav sections to admin perspective
Product: OpenShift Container Platform Reporter: Samuel Padgett <spadgett>
Component: Management ConsoleAssignee: Samuel Padgett <spadgett>
Status: CLOSED ERRATA QA Contact: Yadan Pei <yapei>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.9CC: aos-bugs, jokerman, yapei
Target Milestone: ---Keywords: Reopened
Target Release: 4.9.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-10-18 17:47:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Samuel Padgett 2021-08-20 17:37:08 UTC
I'm able to add a nav section to the dev perspective, but not to the admin perspective. To reproduce, add the following to the dynamic demo plugin console-extensions.json then run the demo plugin following the README here: https://github.com/openshift/console/tree/master/frontend/dynamic-demo-plugin

  {
    "type": "console.navigation/section",
    "properties": {
      "id": "admin-demo-section",
      "perspective": "admin",
      "name": "Demo Plugin"
    }
  },
  {
    "type": "console.navigation/href",
    "properties": {
      "id": "test-consumer",
      "perspective": "admin",
      "section": "admin-demo-section",
      "name": "Test Consumer",
      "href": "/test-consumer"
    },
    "flags": {
      "required": ["OPENSHIFT"]
    }
  },

The nav section does not appear. If I change `admin` to `dev` in the above example, the nav section appears in the dev perspective.

Comment 2 Samuel Padgett 2021-08-25 16:50:14 UTC
Looks like this is happening because `AdminNav` uses different logic:

https://github.com/spadgett/console/blob/c317d0619b360b973d9747dbf6348137fbeeeb77/frontend/public/components/nav/perspective-nav.tsx#L48-L51

This should be covered by https://issues.redhat.com/browse/CONSOLE-2943 and is not expected to work yet.

Comment 3 Samuel Padgett 2021-08-25 17:03:11 UTC
Reopening, I have a smaller fix until we can move the admin perspective to a plugin.

Comment 6 Yadan Pei 2021-08-31 08:44:40 UTC
1. build dynamic plugin image following https://github.com/openshift/console/tree/master/frontend/dynamic-demo-plugin#docker-image based on latest console code in which console-extension.json has added both navigation menu in Admin and Developer perspective

  {
    "type": "console.navigation/section",
    "properties": {
      "id": "admin-demo-section",
      "perspective": "admin",
      "name": "Demo Plugin"
    }
  },
  {
    "type": "console.navigation/href",
    "properties": {
      "id": "test-consumer",
      "perspective": "admin",
      "section": "admin-demo-section",
      "name": "Test Consumer",
      "href": "/test-consumer"
    },
    "flags": {
      "required": ["OPENSHIFT"]
    }
  },
  {
    "type": "console.navigation/section",
    "properties": {
      "id": "dev-demo-section",
      "perspective": "dev",
      "name": "Demo Plugin"
    }
  },
  {
    "type": "console.navigation/href",
    "properties": {
      "id": "test-consumer",
      "perspective": "dev",
      "section": "dev-demo-section",
      "name": "Test Consumer",
      "href": "/test-consumer"
    },
    "flags": {
      "required": ["OPENSHIFT"]
    }
  },
https://github.com/openshift/console/blob/master/frontend/dynamic-demo-plugin/console-extensions.json#L35~L76

2. Deploy dynamic plugin to the cluster and enable it

3. `Demo Plugin` primary navigation menu appears and `Test Consumer` secondary menu exists too

4. `Demo Plugin` primary navigation menu and `Test Consumer` secondary menu also shown in Developer perspective

Verified on 4.9.0-0.nightly-2021-08-30-192239

Comment 9 errata-xmlrpc 2021-10-18 17:47:54 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Container Platform 4.9.0 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:3759