Bug 2059674

Summary: Demo plugin fails to build
Product: OpenShift Container Platform Reporter: Samuel Padgett <spadgett>
Component: Management ConsoleAssignee: Andrew Ballantyne <aballant>
Status: CLOSED ERRATA QA Contact: Xiyun Zhao <xiyuzhao>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.11CC: aos-bugs, yapei
Target Milestone: ---   
Target Release: 4.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-08-10 10:51:27 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:
Bug Depends On:    
Bug Blocks: 2055814    

Description Samuel Padgett 2022-03-01 17:16:03 UTC
I get the following type errors building the dynamic demo plugin:

$ cd dynamic-demo-plugin
$ yarn install
$ yarn run build

ERROR in /Users/sam/work/console/dynamic-demo-plugin/src/components/k8sConsumer/K8sAPIConsumer.tsx
95:12-59
[tsl] ERROR in /Users/sam/work/console/dynamic-demo-plugin/src/components/k8sConsumer/K8sAPIConsumer.tsx(95,13)
      TS2345: Argument of type '{ model: K8sModel; queryParams: { ns: string; }; }' is not assignable to parameter of type 'OptionsList'.
  Property 'requestInit' is missing in type '{ model: K8sModel; queryParams: { ns: string; }; }' but required in type 'OptionsList'.

ERROR in /Users/sam/work/console/dynamic-demo-plugin/src/components/k8sConsumer/K8sAPIConsumer.tsx
97:21-29
[tsl] ERROR in /Users/sam/work/console/dynamic-demo-plugin/src/components/k8sConsumer/K8sAPIConsumer.tsx(97,22)
      TS2345: Argument of type 'K8sResourceCommon[] | (K8sResourceCommon & { items: K8sResourceCommon[]; })' is not assignable to parameter of type 'SetStateAction<K8sResourceCommon[]>'.
  Type 'K8sResourceCommon & { items: K8sResourceCommon[]; }' is not assignable to type 'SetStateAction<K8sResourceCommon[]>'.
    Type 'K8sResourceCommon & { items: K8sResourceCommon[]; }' is not assignable to type '(prevState: K8sResourceCommon[]) => K8sResourceCommon[]'.
      Type 'K8sResourceCommon & { items: K8sResourceCommon[]; }' provides no match for the signature '(prevState: K8sResourceCommon[]): K8sResourceCommon[]'.

ERROR in /Users/sam/work/console/dynamic-demo-plugin/src/components/k8sConsumer/K8sAPIConsumer.tsx
107:14-60
[tsl] ERROR in /Users/sam/work/console/dynamic-demo-plugin/src/components/k8sConsumer/K8sAPIConsumer.tsx(107,15)
      TS2345: Argument of type '{ model: K8sModel; resource: { apiVersion: string; kind: string; metadata: { name: string; namespace: string; labels: { app: string; }; }; spec: { selector: { matchLabels: { app: string; }; }; replicas: number; template: { ...; }; }; }; }' is not assignable to parameter of type 'OptionsDelete<{ apiVersion: string; kind: string; metadata: { name: string; namespace: string; labels: { app: string; }; }; spec: { selector: { matchLabels: { app: string; }; }; replicas: number; template: { metadata: { labels: { ...; }; }; spec: { ...; }; }; }; }>'.
  Type '{ model: K8sModel; resource: { apiVersion: string; kind: string; metadata: { name: string; namespace: string; labels: { app: string; }; }; spec: { selector: { matchLabels: { app: string; }; }; replicas: number; template: { ...; }; }; }; }' is missing the following properties from type '{ model: K8sModel; resource: { apiVersion: string; kind: string; metadata: { name: string; namespace: string; labels: { app: string; }; }; spec: { selector: { matchLabels: { app: string; }; }; replicas: number; template: { ...; }; }; }; requestInit: RequestInit; json: Record<...>; }': requestInit, json

Comment 1 Samuel Padgett 2022-03-01 17:27:47 UTC
Raising severity as the types look incorrect in the SDK.

Comment 3 Xiyun Zhao 2022-03-09 05:54:26 UTC
This bug has been verified on payload 4.11.0-0.nightly-2022-03-04-063157

Verification Steps:
1. Prepare(download) the newest code of console
2. Go to 'dynamic-demo-plugin' folder
   $ cd dynamic-demo-plugin
3. Execute below command, verified if it is able to build successfully
   $ yarn install
   $ yarn run build

Result:
3. The dynamic-demo-plugin is built successfully without any error

Comment 5 errata-xmlrpc 2022-08-10 10:51:27 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 (Important: OpenShift Container Platform 4.11.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-2022:5069