Giter VIP home page Giter VIP logo

insights-chrome's Introduction

Insights Chrome

The "wrapper" around your application!

Insights Chrome provides:

  • Standard header and navigation
  • Base CSS/style
  • A Javascript library for interacting with Insights Chrome

For more detailed information about chrome and what it provides, look through the detailed documentation.

JavaScript API

Insights Chrome comes with a Javacript API that allows applications to control navigation, global filters, etc.

Check out the useChrome hook docs

Running the build

There are a few scripts for building this application.

To run a script you have to install dependencies npm install. Then you are free to use any task you want.

  1. Building assets

    > npm run build
  2. Building assets and watching files when they change

    > npm run build --watch
  3. Running tests

    > npm run test

Running chrome locally

  1. Install all dependencies

    > npm install
  2. Run dev command in watch mode

    > npm run dev
  3. Open browser at https://stage.foo.redhat.com:1337/ or Open browser at https://stage.foo.redhat.com:1337/preview.

Running chrome with other applications locally

You can spin chrome locally together with other applications. Use LOCAL_APPS to list the locally deployed applications.

Example 1 (using LOCAL_APPS)

For illustration, to deploy Advisor together with Insights Chrome, you would require to

  1. Run Advisor on any available port with npm run start -- --port=8004 or npm run start:beta -- --port=8004,
  2. Run Chrome and list the Advisor's port: LOCAL_APPS=advisor:8004:http npm run dev or LOCAL_APPS=advisor:8004:http npm run dev:beta.

Example 2 (using devServer route)

You can also specify deployed applications through devServer.routes field:

  1. Run Advisor with --port=8004 (or any other available port number),
  2. Update the webpack config in the following way:
...
devServer: {
    ...
    routes: {
        '/apps/ocp-advisor': {
            host: 'https://localhost:8004',
        },
    },
}
...
  1. Run insights-chrome with npm run dev or npm run dev:beta.

LocalStorage Debugging

There are some localStorage values for you to enable debuging information or enable some values that are in experimental state. If you want to enable them call const iqe = insights.chrome.enable.iqe() for instance to enable such service. This function will return callback to disable such feature so calling iqe() will remove such item from localStorage.

Available function:

  • iqe - to enable some iqe functions for QE purposes
  • invTags - to enable experimental tags in inventory
  • jwtDebug - to enable debugging of JWT
  • remediationsDebug - to enable debug buttons in remediations app
  • shortSession - to enable short session in order to test automatic logouts
  • forcePendo - to force Pendo initializtion
  • appFilter - to enable new application filter in any environment

Futher reading

More detailed documentation can be found in the docs section

insights-chrome's People

Contributors

adamrdrew avatar adonispuente avatar aneelac22 avatar apinkert avatar arivepr avatar blakeholifield avatar codywmitchell avatar dependabot-preview[bot] avatar dependabot[bot] avatar depfu[bot] avatar epwinchell avatar fhlavac avatar florkbr avatar gkarat avatar hyperkid123 avatar insanezein avatar iphands avatar jharting avatar john-dupuy avatar jschuler avatar karelhala avatar kruai avatar panspagetka avatar psav avatar radekkaluzik avatar rsun19 avatar rvsia avatar ryelo avatar tahmidefaz avatar victoria-dos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

insights-chrome's Issues

User should be able to click outside "About" modal to close

Currently, the user has to click the 'x' button to close the modal. We should implement a way to dismiss the modal by clicking outside of it because the 'x' doesn't stay in the top right on scroll. If a user scrolls down, they lose the 'x'. Adding this would allow the user to dismiss without scrolling again.

Provide all PatternFly utilities and layouts

It appears that the Insights chrome does not provide all pf-next utilities and layouts. Specifically, the .pf-l-split layout and .pf-u-display-* utilities.

It's possible Insights may selectively include individual utilities and layouts? However, providing all utilities and layouts would allow us to remove all of the custom CSS for the Cost management overview page.

See https://github.com/project-koku/koku-ui/issues/271 for additional details.

Left hand nav and main content scroll together

The left hand navigation pane, header, and main page content scroll together for Cost Management. I noticed other apps under Insights do not do this. Is this an Insights issue or something missed in Cost Management?

To Reproduce
Steps to reproduce the behavior:

  1. Go to Cost Management
  2. Go to AWS/OpenShift Details
  3. Scroll down
  4. See Left hand nav, page header, & main page content scroll together

Expected behavior*
We should only be scrolling the app/table data.

Screenshots
screenshot from 2019-02-24 23-53-57

Navigation pane does not highlight properly

The Insights navigation pane does to highlight properly when navigating between pages. For example, the user can jump from the Cost Management's overview page via a link to the OpenShift details page. Is there something the Cost Management UI needs to do in order for Insights to understand which route the user has jumped to?

Navigation menu doesn't follow PatternFly Next

Main navigation menu doesn't fully follow PatternFly Next https://pf-next.com/components/Nav/examples/.

  • the navigation menu should follow "Nav Mixed" example
  • elements such as <li class="pf-c-nav__item active" id="advisor"> shouldn't have active class, instead they should look like this: <li class="pf-c-nav__item pf-m-current" id="advisor">
  • expandable items should have respectful class pf-m-expandable
  • there shouldn't be navigation-secondary, subitems should be wrapped by section element as it shown in the example
  • end nodes of the menu should be a element, not li

Current markup:

<nav class="pf-c-nav" role="navigation" aria-label="Insights Global Navigation">
  <ul class="pf-c-nav__list" id="navigation">
    <li class="pf-c-nav__item" id="dashboard">
      <a class="pf-c-nav__link" href="/insights/platform/dashboard" widget-type="InsightsNavItem" widget-id="dashboard">
        <span class="pf-c-nav__link-text">Dashboard</span>
      </a>
    </li>
    <li class="pf-c-nav__item active" id="advisor">
      <a class="pf-m-active pf-c-nav__link" aria-current="page" href="/insights/platform/advisor" widget-type="InsightsNavItem" widget-id="advisor">
        <span class="pf-c-nav__link-text">Advisor</span>
       </a>
       <ul class="navigation-secondary">
         <li class="active">
          <span>Actions</span>
        </li>
        <li>
          <span>Rules</span>
        </li>
      </ul>
    </li>
  </ul>
</nav>

Desired markup:

<nav class="pf-c-nav" role="navigation" aria-label="Insights Global Navigation">
  <ul class="pf-c-nav__list" id="navigation">
    <li class="pf-c-nav__item" id="dashboard">
      <a class="pf-c-nav__link" href="/insights/platform/dashboard" widget-type="InsightsNavItem" widget-id="dashboard">
        Dashboard
      </a>
    </li>
    <li class="pf-c-nav__item pf-m-expandable pf-m-expanded pf-m-current" id="advisor">
      <a class="pf-m-active pf-c-nav__link" aria-current="page" href="/insights/platform/advisor" widget-type="InsightsNavItem" widget-id="advisor">
        Advisor
        <span class="pf-c-nav__toggle" tabindex="-1" aria-disabled="true">
          <i class="fas fa-angle-right"></i>
        </span>
      </a>
      <section class="pf-c-nav__subnav" aria-labelledby="advisor">
        <ul class="pf-c-nav__simple-list">
          <li class="pf-c-nav__item">
            <a href="/insights/platform/advisor/actions" class="pf-c-nav__link pf-m-current">
              Actions
            </a>
          </li>
          <li class="pf-c-nav__item">
            <a href="/insights/platform/advisor/rules" class="pf-c-nav__link">
              Rules
            </a>
          </li>
        </ul>
      </section>
    </li>
  </ul>
</nav>

chrome step in readme fails

centos7 vm

cc: @thomasmckay

$ npm run build

> [email protected] build /home/vagrant/code/insights/insights-chrome
> npm-run-all build:*


> [email protected] build:images /home/vagrant/code/insights/insights-chrome
> cpx 'node_modules/@patternfly/patternfly-next/assets/images/*' build/assets/images


> [email protected] build:js /home/vagrant/code/insights/insights-chrome
> parcel build src/js/chrome.js -d build/js

✨  Built in 5.61s.

build/js/chrome.map    259.12 KB     33ms
build/js/chrome.js      78.46 KB    5.28s

> [email protected] build:pug /home/vagrant/code/insights/insights-chrome
> pug src/pug -o build/snippets


  rendered /home/vagrant/code/insights/insights-chrome/build/snippets/footer.html
  rendered /home/vagrant/code/insights/insights-chrome/build/snippets/globalNav.html
  rendered /home/vagrant/code/insights/insights-chrome/build/snippets/head.html
  rendered /home/vagrant/code/insights/insights-chrome/build/snippets/header.html
  rendered /home/vagrant/code/insights/insights-chrome/build/snippets/insights-logo.html
  rendered /home/vagrant/code/insights/insights-chrome/build/snippets/redhat-logo.html
  rendered /home/vagrant/code/insights/insights-chrome/build/snippets/sidebar.html

> [email protected] build:sass /home/vagrant/code/insights/insights-chrome
> node-sass src/sass/chrome.scss -o build/

{
  "status": 1,
  "file": "/home/vagrant/code/insights/insights-chrome/src/sass/chrome.scss",
  "line": 10,
  "column": 1,
  "message": "File to import not found or unreadable: node_modules/@patternfly/patternfly-next/components/NavSystem/styles.scss.",
  "formatted": "Error: File to import not found or unreadable: node_modules/@patternfly/patternfly-next/components/NavSystem/styles.scss.\n        on line 10 of src/sass/chrome.scss\n>> @import 'node_modules/@patternfly/patternfly-next/components/NavSystem/style\n   ^\n"
}

npm ERR! Linux 3.10.0-862.2.3.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/lib/node_modules/npm/bin/npm-cli.js" "run" "build:sass"
npm ERR! node v6.14.3
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build:sass: `node-sass src/sass/chrome.scss -o build/`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build:sass script 'node-sass src/sass/chrome.scss -o build/'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the insights-chrome package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-sass src/sass/chrome.scss -o build/
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs insights-chrome
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls insights-chrome
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/vagrant/code/insights/insights-chrome/npm-debug.log
ERROR: "build:sass" exited with 1.

npm ERR! Linux 3.10.0-862.2.3.el7.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
npm ERR! node v6.14.3
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build: `npm-run-all build:*`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script 'npm-run-all build:*'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the insights-chrome package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm-run-all build:*
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs insights-chrome
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls insights-chrome
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/vagrant/code/insights/insights-chrome/npm-debug.log

The text-transform: capitalize; statement could interfere with IP such as the names/trademarks of other companies

I noticed this issue when doing some comparisons of current subscription watch left navigation menus:

Specifically, I noticed the change from "IBM Z systems" (as listed on the IBM Z product pages) to "IBM Z Systems." I mentioned it to my UX team, who pointed me to the code change.

For the insights-chrome/src/js/App/Sidenav/Navigation.scss file, the following code could interfere with the intellectual property of other companies.

.ins-c-sidebar .pf-c-nav .pf-c-nav__link { text-transform: capitalize; // All nav links should be in title case, remove CSC as a dependent for this }

RE the usage of other company/product name trademarks (and non-trademarked names of products) in the nav menu, has the potential legal impact of this change been reviewed?

Refreshing HCCM OpenShift Charge or Cloud Cost page results in 'File not found'

Describe the bug
On production if you navigate to either HCCM OCP/AWS cost details; then refresh, the Insights console shows a blank page with 'File not found' text.

To Reproduce
Steps to reproduce the behavior:

  1. Go to HCCM OpenShift Charge or Cloud Cost
  2. Click on refresh
  3. See error

Expected behavior
Pages should reload correctly

Screenshots
screen shot 2019-01-24 at 11 24 15 am

Additional context
This is only an issue with the production environment. I'm not able to reproduce with a local CI or Insights beta.

It was suggested its related to akamai?

See the kpku-ui issue here: https://github.com/project-koku/koku-ui/issues/429

actions.js appNavClick error

Hi,

I noticed in my console.log that I see the following error:

TypeError: item is undefined

which directs me to this code:

export function appNavClick(item, event) {
    return { type: actionTypes.APP_NAV_CLICK, payload: { id: item.id, event } };
}

I am not sure it's a problem on our side or not.

Reading again the README.md file it looks like we follow the instruction correctly:

  public componentDidMount() {
    insights.chrome.init();
    insights.chrome.identifyApp('cost-management');
    insights.chrome.navigation(buildNavigation());

    this.appNav = insights.chrome.on('APP_NAVIGATION', event =>
      this.props.history.push(`/${event.navId}`)
    );
    ...
}

EDIT

I just realized Dan opened an issue that is similar to mine.
duplicate #89

Normal UI shouldn't be available when logged in user has no valid Red Hat account

If you log in to the platform UI via SSO with a user that has no Red Hat account number associated with their user ID, the UI still "works" but all the backend queries fail because 3scale does not pass the account_number in the x-rh-identity header.

If a user logs in who does not have a valid account number, we should display some kind of error page.

Unable to logout of UI

Description
After login you are unable to log out again using username -> logout

To Reproduce

  1. Go to CI environment dashboard
  2. Login to UI
  3. Click on username
  4. Try to click 'logout'

Expected behavior
User should get logged out.

Screenshots
screenshot from 2018-11-07 10-29-09

Desktop (please complete the following information):
OS: fedora
Browser firefox
Version 63

App can't be identified in the secondary nav

Recent discussions confirmed that "Vulnerability" and "Compliance" should be put together under "Security". Currently app is not identified when the "id" for app is in the secondary nav.

Navigation links not enabled properly

There is an "All Services" link on the Cost Management dashboard. This takes the user directly to the Cloud Cost page. However, the link in the Insights navigation pane is not activated. Instead, the "Overview" link remains active.

Is there an Insights API that we should be using when navigating to other pages?

screen shot 2018-12-07 at 12 06 00 pm

Buttons on chroming do not work

Describe the bug
The buttons on the chroming do not work

To Reproduce
Always

Expected behavior
They work

Screenshots
image

Desktop (please complete the following information):

  • OS: Mac OS X
  • Browser: Chrome
  • Version latest

Additional context
Add any other context about the problem here.

Sources navigation

New application wants to be plugged in to insights called Sources, let's welcome them with correct navigation chrome item.

Is it feasible to vendor Pendo JS instead of loading directly from 3rd party?

Hi, I see the Pendo "agent" javascript is loaded directly from https://cdn.pendo.io/agent/static/${API_KEY}/pendo.js.
Loading JS directly from 3rd party domains is IMO suboptimal for security:

  1. If their domain / certificates / cdn are somehow compromised by another attacker, they can serve malicious code to our users with no trace of it left to audit later.
  2. We have no way of knowing whether the same JS is served to all users.
    If somebody in Pendo goes evil and attacks our users, again, no trace left.
  3. We do not control upgrades, have no process for auditing their code.

A better practice for proprietary analytics would be to vendor some frozen version of their code, and update it manually.
Does Pendo offer a non-obfuscated version of their client JS at all? Has anyone ever looked at what it does / sends? Even if we don't review their code before using, having it publicly available and open for potential future audit would be better than nothing...

[Off-topic: in an ideal world, we'd use open-source analytics, hosting user data ourselves.]

https://www.pendo.io/data-privacy-security/ has this to say about their CDN:

The JavaScript code is hosted and deployed in Amazon’s Cloudfront Content Distribution Network (CDN)

  1. Well to be realistic, if anyone compromises Cloudfront, half the world is pwned :-)
  2. Does Cloudfront guarantee same response for same URL to all users (which in our case is all cloud.redhat.com users)? That could make a narrowly targetted attack harder. But it doesn't exactly, depends on Vary header etc... Also if they push an evil version for a short time, then replace it, nobody would notice.

To be clear, I'm not talking about our business relationship with Pendo, and whether their promises are legally sufficient. Merely about the technical ability to inspect their code & control when it changes.

Briefly looking at pendo docs e.g. https://developers.pendo.io/docs/?bash#installation, there is little mention of alternatives to the "snippet" loading JS from the CDN 😦
However https://support.pendo.io/hc/en-us/articles/360022819711-Snippet-Install#InstallFAQ says 😄 :

Can I Host The Agent Locally?

The installation snippet pulls in pendo.js which contains the Pendo agent code. pendo.js can be downloaded and hosted via your application if you do not want it to be pulled from Pendo’s CDN. Admins can download this code on the Subscription Settings page by clicking on the desired Web App, clicking the "Agent Settings" tab, clicking on "Manage Staging/Prouction Settings" and then by clicking the "Download" link under your currently selected "Guide Delivery Settings". Note that you will need to update this reference in the installation snippet to point to your hosted pendo.js file.

Sidebar drop-down "Migration Services" becomes "Migration"

When I access to Migration Analytics I can see a drop-down in the left sidebar of the page; when I select the option "Migration Services" it navigates to "Migration Analytics" but the value of the dropdown becomes "Migration" rather than "Migration Services". See the gift attached.

Is this a bug or it is the expected behavior?

Peek 2020-07-10 12-27

Service portal navigation

New application wants to be plugged in to insights called Service catalog portal, let's welcome them with correct navigation chrome item.

npm install failed with Error: write after end

events.js:160░░░░░░⸩ ⠸ extract:patternfly-react: sill extract [email protected]
      throw er; // Unhandled 'error' event
      ^

Error: write after end
    at writeAfterEnd (_stream_writable.js:193:12)
    at PassThrough.Writable.write (_stream_writable.js:240:5)
    at PassThrough.Writable.end (_stream_writable.js:477:10)
    at ReadEntry.entry.on (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/extract-stream.js:19:41)
    at emitOne (events.js:101:20)
    at ReadEntry.emit (events.js:188:7)
    at ReadEntry.emit (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:287:25)
    at ReadEntry.[maybeEmitEnd] (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:240:12)
    at ReadEntry.end (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:153:27)
    at Unpack.[consumeBody] (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:210:13)
    at Unpack.[consumeChunkSub] (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:391:40)
    at Unpack.[consumeChunk] (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:362:30)
    at Unzip.(anonymous function).on.chunk (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:291:59)
    at emitOne (events.js:96:13)
    at Unzip.emit (events.js:188:7)
    at Unzip.emit (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:287:25)
events.js:160
      throw er; // Unhandled 'error' event

The end of debug.log

15740 silly saveTree   ├── [email protected]
15740 silly saveTree   └── [email protected]
15741 verbose type ProcessTerminatedError
15742 verbose stack ProcessTerminatedError: cancel after 1 retries!
15742 verbose stack     at Farm.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js:87:25)
15742 verbose stack     at Array.forEach (native)
15742 verbose stack     at Farm.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/worker-farm/lib/farm.js:81:36)
15742 verbose stack     at ontimeout (timers.js:386:11)
15742 verbose stack     at tryOnTimeout (timers.js:250:5)
15742 verbose stack     at Timer.listOnTimeout (timers.js:214:5)
15743 verbose cwd /Users/bwei/redhat/bzwei/insights/insights-chrome
15744 verbose Darwin 17.6.0
15745 verbose argv "/usr/local/Cellar/node@6/6.11.3/bin/node" "/usr/local/bin/npm" "install"
15746 verbose node v6.11.3
15747 verbose npm  v5.8.0
15748 error cancel after 1 retries!
15749 verbose exit [ 1, true ]

Multiple refresh attempts before data is displayed

The Insights team has provided a promise that we can wrap our API calls in to make sure we always have a token; however, this no longer seems to be working for the Koku UI. We still need to refresh the page in order to see data.

It appears that the token is requested after our providers API call.

Insights promise doc:
https://docs.google.com/document/d/1xjITNYbp1aw9Xu3lYLQppKQl-Rtj6_BaThwy1Zkazm4/edit#heading=h.8aucqk7x2oqb

Koku UI providers API call:
https://github.com/project-koku/koku-ui/blob/master/src/api/providers.ts#L76

Network requests:
screen shot 2018-11-30 at 9 32 08 am

Problem with Inisghts & onClick events

I'm encountering an issue with Inisghts and onClick events.

  1. Navigate to the "Cloud Cost" page of Cost Management
  2. Choose the "Group By" menu -- this is a PF4 dropdown
  3. Choose the "Sort By" menu in the toolbar -- this is a PF3 Sort.TypeSelector
  4. Insights renders a blank page

In order to fix the issue with the PF4 dropdown, I was able to add event.preventDefault(), like so:

  <Dropdown
    onClick={event => event.preventDefault()} <<<
    dropdownItems={groupByOptions.map(option => (
      <DropdownItem
        onClick={event =>
          this.handleGroupByItemClick(event, option.value)
        }
      >
    ...

I have not found a workaround for the PF3 Sort.TypeSelector component.

The error in the browser console is:
screen shot 2018-12-06 at 12 06 41 pm

Multiple window/tabs issue

While testing Cost Management, in an existing browser window, I opened a new incognito window using a similar URL. Then, I clicked on the navigation pane, under Cost Management. This unexpectedly controls both windows and/or tabs.

Not only does this happen on both Chrome and Firefox, but I was able to use the Firefox window to control Chrome.

Below is a recording of a Firefox (private) window controlling two other windows; Firefox and Chrome.
3windows

I suspect this is related to running a local proxy, so feel free to close if this is not considered an issue?

OCP on Aws: Cannot group by tag

Describe the bug
When attempting OCP on AWS is groupped by tag, the API returns a "400 Bad Request". The specific message is "Unsupported parameter" message.

/reports/openshift/infrastructures/aws/costs/?delta=cost&filter[limit]=10&filter[offset]=0&filter[resolution]=monthly&filter[time_scope_units]=month&filter[time_scope_value]=-1&group_by[tag:app]=*&order_by[cost]=desc

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'OpenShift on Aws'
  2. Group by 'Tag: app'
  3. See error

Expected behavior
Need to use the AWS tags API. See https://github.com/project-koku/koku/issues/773

Broken Cost Management "Overview" link

Clicking on the Cost Management "Overview" link, in the left navigation pane, no longer functions.

To reproduce, navigate to "Cloud Cost" or "OpenShift Charge", then click on the "Overview" link.

Rename Cost Management navigation links

Please change the Cost Management "Cloud Cost" and "OpenShift Charge" links, in the left navigation pane, to read "Cloud Details" and "OpenShift Details".

insights is not defined

How to reproduce

  1. Connect to VPN (I'm using Amsterdam)
  2. Run insights-proxy
    a. git clone https://github.com/RedHatInsights/insights-proxy
    b. cd insights-proxy
    c. bash scripts/patch-etc-hosts.sh
    d. bash scripts/run.sh
  3. Open another terminal and run koku-ui
    a. git clone https://github.com/boaz1337/koku-ui
    b. cd koku-ui
    c. yarn
    d. yarn start:dev
  4. Open Chrome and go to https://ci.foo.redhat.com:1337/insights/platform/cost-management/

What I got

It seems like insights is not defined here and that's confusing because when I am going to https://prod.foo.redhat.com:1337/insights/platform/cost-management/ it works.

So I am not sure what injects the insights object, maybe you know and can help me.

Blank page and in the console log I see the following messages:

Uncaught ReferenceError: insights is not defined
Uncaught ReferenceError: insights is not defined
    at ProxyComponent.componentDidMount (app.tsx:38)
    at ProxyComponent.componentDidMount (react-hot-loader.development.js:572)
    at commitLifeCycles (react-dom.development.js:14361)
    at commitAllLifeCycles (react-dom.development.js:15462)
    at HTMLUnknownElement.callCallback (react-dom.development.js:100)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:138)
    at invokeGuardedCallback (react-dom.development.js:187)
    at commitRoot (react-dom.development.js:15603)
    at completeRoot (react-dom.development.js:16618)
    at performWorkOnRoot (react-dom.development.js:16563)
componentDidMount @ app.tsx:38
componentDidMount @ react-hot-loader.development.js:572
commitLifeCycles @ react-dom.development.js:14361
commitAllLifeCycles @ react-dom.development.js:15462
callCallback @ react-dom.development.js:100
invokeGuardedCallbackDev @ react-dom.development.js:138
invokeGuardedCallback @ react-dom.development.js:187
commitRoot @ react-dom.development.js:15603
completeRoot @ react-dom.development.js:16618
performWorkOnRoot @ react-dom.development.js:16563
performWork @ react-dom.development.js:16482
performSyncWork @ react-dom.development.js:16454
requestWork @ react-dom.development.js:16354
scheduleWork$1 @ react-dom.development.js:16218
scheduleRootUpdate @ react-dom.development.js:16785
updateContainerAtExpirationTime @ react-dom.development.js:16812
updateContainer @ react-dom.development.js:16839
ReactRoot.render @ react-dom.development.js:17122
(anonymous) @ react-dom.development.js:17262
unbatchedUpdates @ react-dom.development.js:16679
legacyRenderSubtreeIntoContainer @ react-dom.development.js:17258
render @ react-dom.development.js:17317
(anonymous) @ index.tsx:34
(anonymous) @ index.tsx:51
./src/index.tsx @ main.bundle.js:15311
__webpack_require__ @ main.bundle.js:785
fn @ main.bundle.js:148
(anonymous) @ client:8
0 @ main.bundle.js:15957
__webpack_require__ @ main.bundle.js:785
checkDeferredModules @ main.bundle.js:46
(anonymous) @ main.bundle.js:923
(anonymous) @ main.bundle.js:926
app.tsx:53 Uncaught TypeError: this.appNav is not a function
    at ProxyComponent.componentWillUnmount (app.tsx:53)
    at ProxyComponent.componentWillUnmount (react-hot-loader.development.js:572)
    at callComponentWillUnmountWithTimer (react-dom.development.js:14280)
    at HTMLUnknownElement.callCallback (react-dom.development.js:100)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:138)
    at invokeGuardedCallback (react-dom.development.js:187)
    at safelyCallComponentWillUnmount (react-dom.development.js:14287)
    at commitUnmount (react-dom.development.js:14494)
    at unmountHostComponents (react-dom.development.js:14796)
    at commitDeletion (react-dom.development.js:14827)
componentWillUnmount @ app.tsx:53
componentDidMount @ react-hot-loader.development.js:572
callComponentWillUnmountWithTimer @ react-dom.development.js:14280
callCallback @ react-dom.development.js:100
invokeGuardedCallbackDev @ react-dom.development.js:138
invokeGuardedCallback @ react-dom.development.js:187
safelyCallComponentWillUnmount @ react-dom.development.js:14287
commitUnmount @ react-dom.development.js:14494
unmountHostComponents @ react-dom.development.js:14796
commitDeletion @ react-dom.development.js:14827
commitAllHostEffects @ react-dom.development.js:15416
callCallback @ react-dom.development.js:100
invokeGuardedCallbackDev @ react-dom.development.js:138
invokeGuardedCallback @ react-dom.development.js:187
commitRoot @ react-dom.development.js:15568
completeRoot @ react-dom.development.js:16618
performWorkOnRoot @ react-dom.development.js:16563
performWork @ react-dom.development.js:16482
performSyncWork @ react-dom.development.js:16454
requestWork @ react-dom.development.js:16354
scheduleWork$1 @ react-dom.development.js:16218
scheduleRootUpdate @ react-dom.development.js:16785
updateContainerAtExpirationTime @ react-dom.development.js:16812
updateContainer @ react-dom.development.js:16839
ReactRoot.render @ react-dom.development.js:17122
(anonymous) @ react-dom.development.js:17262
unbatchedUpdates @ react-dom.development.js:16679
legacyRenderSubtreeIntoContainer @ react-dom.development.js:17258
render @ react-dom.development.js:17317
(anonymous) @ index.tsx:34
(anonymous) @ index.tsx:51
./src/index.tsx @ main.bundle.js:15311
__webpack_require__ @ main.bundle.js:785
fn @ main.bundle.js:148
(anonymous) @ client:8
0 @ main.bundle.js:15957
__webpack_require__ @ main.bundle.js:785
checkDeferredModules @ main.bundle.js:46
(anonymous) @ main.bundle.js:923
(anonymous) @ main.bundle.js:926
react-dom.development.js:14226 The above error occurred in the <App> component:
    in App (created by Connect(App))
    in Connect(App) (created by Route)
    in Route (created by withRouter(Connect(App)))
    in withRouter(Connect(App)) (created by HotExportedwithRouter(Connect(App)))
    in AppContainer (created by HotExportedwithRouter(Connect(App)))
    in HotExportedwithRouter(Connect(App))
    in Router (created by BrowserRouter)
    in BrowserRouter
    in Provider

React will try to recreate this component tree from scratch using the error boundary you provided, AppContainer.
logCapturedError @ react-dom.development.js:14226
logError @ react-dom.development.js:14265
callback @ react-dom.development.js:14947
callCallback @ react-dom.development.js:10878
commitUpdateQueue @ react-dom.development.js:10911
commitLifeCycles @ react-dom.development.js:14377
commitAllLifeCycles @ react-dom.development.js:15462
callCallback @ react-dom.development.js:100
invokeGuardedCallbackDev @ react-dom.development.js:138
invokeGuardedCallback @ react-dom.development.js:187
commitRoot @ react-dom.development.js:15603
completeRoot @ react-dom.development.js:16618
performWorkOnRoot @ react-dom.development.js:16563
performWork @ react-dom.development.js:16482
performSyncWork @ react-dom.development.js:16454
requestWork @ react-dom.development.js:16354
scheduleWork$1 @ react-dom.development.js:16218
scheduleRootUpdate @ react-dom.development.js:16785
updateContainerAtExpirationTime @ react-dom.development.js:16812
updateContainer @ react-dom.development.js:16839
ReactRoot.render @ react-dom.development.js:17122
(anonymous) @ react-dom.development.js:17262
unbatchedUpdates @ react-dom.development.js:16679
legacyRenderSubtreeIntoContainer @ react-dom.development.js:17258
render @ react-dom.development.js:17317
(anonymous) @ index.tsx:34
(anonymous) @ index.tsx:51
./src/index.tsx @ main.bundle.js:15311
__webpack_require__ @ main.bundle.js:785
fn @ main.bundle.js:148
(anonymous) @ client:8
0 @ main.bundle.js:15957
__webpack_require__ @ main.bundle.js:785
checkDeferredModules @ main.bundle.js:46
(anonymous) @ main.bundle.js:923
(anonymous) @ main.bundle.js:926
react-hot-loader.development.js:175 ReferenceError: insights is not defined
    at ProxyComponent.componentDidMount (app.tsx:38)
    at ProxyComponent.componentDidMount (react-hot-loader.development.js:572)
    at commitLifeCycles (react-dom.development.js:14361)
    at commitAllLifeCycles (react-dom.development.js:15462)
    at HTMLUnknownElement.callCallback (react-dom.development.js:100)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:138)
    at invokeGuardedCallback (react-dom.development.js:187)
    at commitRoot (react-dom.development.js:15603)
    at completeRoot (react-dom.development.js:16618)
    at performWorkOnRoot (react-dom.development.js:16563)
error @ react-hot-loader.development.js:175
componentDidCatch @ react-hot-loader.development.js:1564
componentDidCatch @ react-hot-loader.development.js:582
callback @ react-dom.development.js:14948
callCallback @ react-dom.development.js:10878
commitUpdateQueue @ react-dom.development.js:10911
commitLifeCycles @ react-dom.development.js:14377
commitAllLifeCycles @ react-dom.development.js:15462
callCallback @ react-dom.development.js:100
invokeGuardedCallbackDev @ react-dom.development.js:138
invokeGuardedCallback @ react-dom.development.js:187
commitRoot @ react-dom.development.js:15603
completeRoot @ react-dom.development.js:16618
performWorkOnRoot @ react-dom.development.js:16563
performWork @ react-dom.development.js:16482
performSyncWork @ react-dom.development.js:16454
requestWork @ react-dom.development.js:16354
scheduleWork$1 @ react-dom.development.js:16218
scheduleRootUpdate @ react-dom.development.js:16785
updateContainerAtExpirationTime @ react-dom.development.js:16812
updateContainer @ react-dom.development.js:16839
ReactRoot.render @ react-dom.development.js:17122
(anonymous) @ react-dom.development.js:17262
unbatchedUpdates @ react-dom.development.js:16679
legacyRenderSubtreeIntoContainer @ react-dom.development.js:17258
render @ react-dom.development.js:17317
(anonymous) @ index.tsx:34
(anonymous) @ index.tsx:51
./src/index.tsx @ main.bundle.js:15311
__webpack_require__ @ main.bundle.js:785
fn @ main.bundle.js:148
(anonymous) @ client:8
0 @ main.bundle.js:15957
__webpack_require__ @ main.bundle.js:785
checkDeferredModules @ main.bundle.js:46
(anonymous) @ main.bundle.js:923
(anonymous) @ main.bundle.js:926
react-dom.development.js:14226 The above error occurred in the <App> component:
    in App (created by Connect(App))
    in Connect(App) (created by Route)
    in Route (created by withRouter(Connect(App)))
    in withRouter(Connect(App)) (created by HotExportedwithRouter(Connect(App)))
    in AppContainer (created by HotExportedwithRouter(Connect(App)))
    in HotExportedwithRouter(Connect(App))
    in Router (created by BrowserRouter)
    in BrowserRouter
    in Provider

React will try to recreate this component tree from scratch using the error boundary you provided, AppContainer.
logCapturedError @ react-dom.development.js:14226
logError @ react-dom.development.js:14265
callback @ react-dom.development.js:14947
callCallback @ react-dom.development.js:10878
commitUpdateQueue @ react-dom.development.js:10911
commitLifeCycles @ react-dom.development.js:14377
commitAllLifeCycles @ react-dom.development.js:15462
callCallback @ react-dom.development.js:100
invokeGuardedCallbackDev @ react-dom.development.js:138
invokeGuardedCallback @ react-dom.development.js:187
commitRoot @ react-dom.development.js:15603
completeRoot @ react-dom.development.js:16618
performWorkOnRoot @ react-dom.development.js:16563
performWork @ react-dom.development.js:16482
performSyncWork @ react-dom.development.js:16454
requestWork @ react-dom.development.js:16354
scheduleWork$1 @ react-dom.development.js:16218
scheduleRootUpdate @ react-dom.development.js:16785
updateContainerAtExpirationTime @ react-dom.development.js:16812
updateContainer @ react-dom.development.js:16839
ReactRoot.render @ react-dom.development.js:17122
(anonymous) @ react-dom.development.js:17262
unbatchedUpdates @ react-dom.development.js:16679
legacyRenderSubtreeIntoContainer @ react-dom.development.js:17258
render @ react-dom.development.js:17317
(anonymous) @ index.tsx:34
(anonymous) @ index.tsx:51
./src/index.tsx @ main.bundle.js:15311
__webpack_require__ @ main.bundle.js:785
fn @ main.bundle.js:148
(anonymous) @ client:8
0 @ main.bundle.js:15957
__webpack_require__ @ main.bundle.js:785
checkDeferredModules @ main.bundle.js:46
(anonymous) @ main.bundle.js:923
(anonymous) @ main.bundle.js:926
react-hot-loader.development.js:175 TypeError: this.appNav is not a function
    at ProxyComponent.componentWillUnmount (app.tsx:53)
    at ProxyComponent.componentWillUnmount (react-hot-loader.development.js:572)
    at callComponentWillUnmountWithTimer (react-dom.development.js:14280)
    at HTMLUnknownElement.callCallback (react-dom.development.js:100)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:138)
    at invokeGuardedCallback (react-dom.development.js:187)
    at safelyCallComponentWillUnmount (react-dom.development.js:14287)
    at commitUnmount (react-dom.development.js:14494)
    at unmountHostComponents (react-dom.development.js:14796)
    at commitDeletion (react-dom.development.js:14827)
error @ react-hot-loader.development.js:175
componentDidCatch @ react-hot-loader.development.js:1564
componentDidCatch @ react-hot-loader.development.js:582
callback @ react-dom.development.js:14948
callCallback @ react-dom.development.js:10878
commitUpdateQueue @ react-dom.development.js:10911
commitLifeCycles @ react-dom.development.js:14377
commitAllLifeCycles @ react-dom.development.js:15462
callCallback @ react-dom.development.js:100
invokeGuardedCallbackDev @ react-dom.development.js:138
invokeGuardedCallback @ react-dom.development.js:187
commitRoot @ react-dom.development.js:15603
completeRoot @ react-dom.development.js:16618
performWorkOnRoot @ react-dom.development.js:16563
performWork @ react-dom.development.js:16482
performSyncWork @ react-dom.development.js:16454
requestWork @ react-dom.development.js:16354
scheduleWork$1 @ react-dom.development.js:16218
scheduleRootUpdate @ react-dom.development.js:16785
updateContainerAtExpirationTime @ react-dom.development.js:16812
updateContainer @ react-dom.development.js:16839
ReactRoot.render @ react-dom.development.js:17122
(anonymous) @ react-dom.development.js:17262
unbatchedUpdates @ react-dom.development.js:16679
legacyRenderSubtreeIntoContainer @ react-dom.development.js:17258
render @ react-dom.development.js:17317
(anonymous) @ index.tsx:34
(anonymous) @ index.tsx:51
./src/index.tsx @ main.bundle.js:15311
__webpack_require__ @ main.bundle.js:785
fn @ main.bundle.js:148
(anonymous) @ client:8
0 @ main.bundle.js:15957
__webpack_require__ @ main.bundle.js:785
checkDeferredModules @ main.bundle.js:46
(anonymous) @ main.bundle.js:923
(anonymous) @ main.bundle.js:926
sockjs.js:1601 GET https://localhost:8002/sockjs-node/info?t=1544012010593 net::ERR_SSL_PROTOCOL_ERROR
AbstractXHRObject._start @ sockjs.js:1601
(anonymous) @ sockjs.js:1490
setTimeout (async)
AbstractXHRObject @ sockjs.js:1489
XHRCorsObject @ sockjs.js:2867
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:730
initSocket @ socket.js:9
(anonymous) @ client:205
(anonymous) @ client:248
./node_modules/webpack-dev-server/client/index.js?http://localhost:8002 @ main.bundle.js:15009
__webpack_require__ @ main.bundle.js:785
fn @ main.bundle.js:148
(anonymous) @ client:1
0 @ main.bundle.js:15957
__webpack_require__ @ main.bundle.js:785
checkDeferredModules @ main.bundle.js:46
(anonymous) @ main.bundle.js:923
(anonymous) @ main.bundle.js:926
client:170 [WDS] Disconnected!
close @ client:170
onclose @ socket.js:17
EventTarget.dispatchEvent @ sockjs.js:170
(anonymous) @ sockjs.js:965
setTimeout (async)
SockJS._close @ sockjs.js:953
SockJS._receiveInfo @ sockjs.js:786
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:567
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:374
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
xhr.onreadystatechange @ sockjs.js:1593
XMLHttpRequest.send (async)
AbstractXHRObject._start @ sockjs.js:1601
(anonymous) @ sockjs.js:1490
setTimeout (async)
AbstractXHRObject @ sockjs.js:1489
XHRCorsObject @ sockjs.js:2867
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:730
initSocket @ socket.js:9
(anonymous) @ client:205
(anonymous) @ client:248
./node_modules/webpack-dev-server/client/index.js?http://localhost:8002 @ main.bundle.js:15009
__webpack_require__ @ main.bundle.js:785
fn @ main.bundle.js:148
(anonymous) @ client:1
0 @ main.bundle.js:15957
__webpack_require__ @ main.bundle.js:785
checkDeferredModules @ main.bundle.js:46
(anonymous) @ main.bundle.js:923
(anonymous) @ main.bundle.js:926
warning.js:33 Warning: Can't call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
    in Async (created by Route)
    in Route (created by Routes)
    in Switch (created by Routes)
    in Routes (created by App)
    in I18nextProvider (created by I18nProvider)
    in I18nProvider (created by App)
    in App (created by Connect(App))
    in Connect(App) (created by Route)
    in Route (created by withRouter(Connect(App)))
    in withRouter(Connect(App)) (created by HotExportedwithRouter(Connect(App)))

Thanks.

BTW, I am blocked - I can't work if I can't have a working development environment.

OpenShift on cloud: details navigation link

Cost Management needs a new navigation link, named 'OpenShift on cloud details'. The link should route to insights/platform/cost-management/ocp-on-aws.

Please also rename the 'OpenShift details' and 'AWS details' links as 'OpenShift details' and 'Cloud details' -- all sentence case.

FYI, we need to rename 'AWS' as 'Cloud' for summit demos.

PatternFly's GridItem color is overridden as white text

Insights appears to be overriding the GridItem component of @patternfly/react-core.

I've added a bullet chart to the OCP details page for Cost Management, but all the text (labels, legend, etc.) is white. Looking at the HTML elements output by GridItem, I can confirm that chrome.css is setting the color to white.

Before:
before

When I deactivate the color style, I can see the text in my bullet chart. Also, if I don't place the chart in the GridItem, I can see the text.

After:
after

My workaround is to set the color manually, but prefer not to do that.

OpenShift on cloud: settings navigation link

Per the recent sources meeting (on 3/27), the Cost Management needs a new navigation link, under the bundle 'settings' area. The new page will allow users add and remove sources unique to Cost Management. This link should be named 'Cost Management Sources' and route to /cost-management/sources.

For summit, the left hand nav is expected to look something like this:

Catalog
Cost Management
Settings
 > Catalog Sources
 > Cost Management Sources

Note that the Catalog team will have their own page for sources, with a similar link under the bundle 'settings'. Post summit, it's expected that the Catalog team will combine sources onto one page.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.