Bug 1921227 - Fix issues related to consuming new extensions in Console static plugins
Summary: Fix issues related to consuming new extensions in Console static plugins
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Management Console
Version: 4.7
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: ---
: 4.8.0
Assignee: Vojtech Szocs
QA Contact: Yadan Pei
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-01-27 18:38 UTC by Vojtech Szocs
Modified: 2021-07-27 22:37 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-07-27 22:36:45 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift console pull 7898 0 None closed Bug 1921227: Improve code reference handling for Console dynamic plugins 2021-02-18 02:13:21 UTC
Github openshift console pull 7919 0 None closed Bug 1921227: Avoid require()'ing modules when generating @console/active-plugins 2021-02-18 02:13:21 UTC
Red Hat Product Errata RHSA-2021:2438 0 None None None 2021-07-27 22:37:15 UTC

Description Vojtech Szocs 2021-01-27 18:38:41 UTC
There are two technical issues that prevent us from using new extension types via `console-extensions.json` file in Console static plugins:

(1) generated code ref functions are missing the `CodeRef` symbol, which is used to differentiate between regular functions vs. executable code refs

(2) validation of code refs based on Node.js `require()` breaks the build when the exposed module isn't strictly plain JavaScript

Comment 2 Vojtech Szocs 2021-02-02 18:58:58 UTC
This bug does not affect existing code in 4.7 so re-targeting to 4.8 release.

Comment 5 Yadan Pei 2021-02-25 09:41:14 UTC
1. clone latest 'master' branch of console code

# build a one-time development build of Console web app
cd frontend ; yarn dev-once

Build bridge command and run console bridge server
# cd /path/to/console_repo
# ./build-backend.sh
# oc login -u kubeadmin -p $(cat /path/to/install-dir/auth/kubeadmin-password)
# source ./contrib/oc-environment.sh
# ./bin/bridge


2. Open browser console and execute 
> window.pluginStore.getAllExtensions().filter((e) => e.pluginID === '@console/kubevirt-plugin') 

// this returns all extensions contributed by the existing Kubevirt plugin. At the end of the array, there is extension with type console.page/route/standalone 

> inspect the last element in array, Symbol(CodeRef): true is there

{type: "console.page/route/standalone", properties: {…}, flags: {…}, pluginID: "@console/kubevirt-plugin", pluginName: "@console/kubevirt-plugin", …}
flags: {required: Array(0), disallowed: Array(0)}
pluginID: "@console/kubevirt-plugin"
pluginName: "@console/kubevirt-plugin"
properties:
component: () => {…}
Symbol(CodeRef): true
arguments: (...)
caller: (...)
length: 0
name: ""
__proto__: ƒ ()
[[FunctionLocation]]: active-plugins.js:92
[[Scopes]]: Scopes[2]
exact: false
path: "/standalone/k8s/ns/:ns/virtualmachineinstances/:name/console"
__proto__:
constructor: ƒ Object()
hasOwnProperty: ƒ hasOwnProperty()
isPrototypeOf: ƒ isPrototypeOf()
propertyIsEnumerable: ƒ propertyIsEnumerable()
toLocaleString: ƒ toLocaleString()
toString: ƒ toString()
valueOf: ƒ valueOf()
__defineGetter__: ƒ __defineGetter__()
__defineSetter__: ƒ __defineSetter__()
__lookupGetter__: ƒ __lookupGetter__()
__lookupSetter__: ƒ __lookupSetter__()
get __proto__: ƒ __proto__()
set __proto__: ƒ __proto__()
type: "console.page/route/standalone"
uid: "@console/kubevirt-plugin[37]"
__proto__: Object


also run `yarn build` within frontend directory succeeded without errors

Moving to VERIFIED

Comment 8 errata-xmlrpc 2021-07-27 22:36:45 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.8.2 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:2438


Note You need to log in before you can comment on or make changes to this bug.