Giter Site home page Giter Site logo

insights-frontend-components's Introduction

Build Status npm version codecov

This repository is archived and moved to a new one RedHatInsights/frontend-components

Red Hat Insights Components for applications in a React.js environment

Usage

npm install: npm install @red-hat-insights/insights-frontend-components

Imports

Component import { Component } from 'node_modules/@red-hat-insights/insights-frontend-components

SCSS @import '~@red-hat-insights/insights-frontend-components/index.css';

Development

Create a component inside of the PresentationalComponent folder

Structure

PresentationalComponents
└───YourComponent
    ├─── index.js
    ├─── YourComponent.js
    └─── your-component.scss

Build: npm run build Test: npm run test

There is also a playground for any development npm run playground

Documentation Links

Hot-loadable components

Conbribution

Adding to index.js

Make sure that when you finish your component, you import it in the src/index.js file

If you're using any kind of pixel variable, be sure to use the px converter inside the Utilities

Commit format

Semantic release is used in this project, so to trigger new release you should add specific format into your commit messages and new release will be triggered when PR is merged.

Used formatter

Commit analyzer wildcard is used for parsing commit messages so to trigger new release add one of these strings into your commit and new release is triggered

  • Major - <x.x.x> or <x.x.?> or <x.?.x> or <x.?.?>
  • Minor - <?.x.x> or <?.x.?>
  • Bug - <?.?.x>
  • No release - <no>

insights-frontend-components's People

Contributors

akofink avatar allenbw avatar bmclaughlin avatar bsquizz avatar dkuc avatar dlobatog avatar ehelms avatar hyperkid123 avatar janelznic avatar jharting avatar jiridostal avatar karelhala avatar kruai avatar martinpovolny avatar mattnolting avatar priley86 avatar rvsia avatar ryelo avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

insights-frontend-components's Issues

Fix the title font size

Trying to replicate what PF does with their title in their page demo. Right now, the page-header-title does not have a larger font size.

Cannot import CSS for Dropdown

According to https://github.com/RedHatInsights/insights-frontend-components/blob/master/doc/components/dropdown.md I should be importing a CSS file for Dropdown. I don't think that css file is available anymore, but even importing the CSS like it did, @import '~@patternfly/patternfly-next/components/Dropdown/styles.scss';, I get quite an odd button:

screenshot from 2018-12-17 10-07-56
screenshot from 2018-12-17 10-11-13

Notice the icon has no left padding, it's the same if I write some text instead of the icon, and the DropdownItems seem to render in a strange way.

Inventory should not show all systems when items=[]

When providing "items" parameter, empty array should not be treated as "show all". It should show empty table instead or some kind of message that tells the user that there are no systems to be listed. ie. Vulnerability -> CVE -> affected systems table.

Inventory Table with starter app can be confusing to implement

I'll start by saying I am not sure if this is a bug or a docs issue when trying to use the inventory table component from a project that started with the insights-frontend-starter-app. I will give my best explanation and understanding of what I experienced.

The insights-frontend-starter-app includes a base integration with the ReducerRegistry for applications to get started registering their reducers with the store. Assuming an application begins using this integration, and decides to add the use of the insights-frontend-components inventory table per the instructions an error is encountered:

0.js:4959 Uncaught (in promise) TypeError: Cannot read property 'register' of undefined
    at SystemsTable._callee$ (0.js:4959)
    at tryCatch (runtime.js:62)
    at Generator.invoke [as _invoke] (runtime.js:288)
    at Generator.prototype.(:1337/insights/platform/drift/anonymous function) [as next] (https://ci.foo.redhat.com:1337/insights/platform/drift/js/vendor.js:2696:21)
    at asyncGeneratorStep (asyncToGenerator.js:3)
    at _next (asyncToGenerator.js:25)

This led me to re-read the integration page and see the following:

These examples count on using insight's registry, if you are using different make sure that you pass along correct one and don't use registryDecorator

To which I assumed, based on my use of the insights-frontend-starter-app I needed to use the registry created in store/index.js. If I switch to importing the local registry and attempting to register with it, a new error is encountered:

asyncToGenerator.js:6 Uncaught (in promise) TypeError: Cannot read property 'params' of undefined
    at o.value (Inventory.83193bc9.js:5)
    at commitLifeCycles (react-dom.development.js:14532)
    at commitAllLifeCycles (react-dom.development.js:15738)
    at HTMLUnknownElement.callCallback (react-dom.development.js:145)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:195)
    at invokeGuardedCallback (react-dom.development.js:248)
    at commitRoot (react-dom.development.js:15908)
    at completeRoot (react-dom.development.js:17296)
    at performWorkOnRoot (react-dom.development.js:17224)
    at performWork (react-dom.development.js:17128)

After some experimenting, turns out that what is missing a specific reducer in the registry from here. Which, if I add to to the insights-frontend-starter-app then everything links up and works, e.g.

    registry = new ReducerRegistry({}, [
        promiseMiddleware(),
        ...middleware
    ]);

    registry.register({
        routerData: (state, { type, payload }) => {
            return ({
                ...state,
                ...type === '@@INSIGHTS-CORE/NAVIGATION' ? payload : {}
            })
        }
    })

The other way I solved this was to switch away from ReducerRegistry per the starter app and instead use the registry directly. That is, changing the store.index.js code from the starter app to the following instead:

import promiseMiddleware from 'redux-promise-middleware';
import { getRegistry } from '@red-hat-insights/insights-frontend-components';

import { reducers } from '../SmartComponents/modules';

let registry;

export function init (...middleware) {
    if (registry) {
        throw new Error('store already initialized');
    }

    registry = getRegistry({}, [
        promiseMiddleware(),
        ...middleware
    ]);

    registry.register({
        compareReducer: reducers.compareReducer,
        statusReducer: reducers.statusReducer
    });

    return registry;
}

This then enabled me to use the inventory table instructions as is without any modification.

  1. Is this a bug?
  2. If not a bug, I would recommend updating either the store/index.js for the insights-frontend-stater-app to use getRegistry or the inventory table docs to expand on required changes to the registry in an app based on the starter app

The goal here being to improve the experience for developers and allow using the inventory components out of the box.

Add more variables

Now that the variables are working, let's communicate with teams what other variables they will need and add them.

For sure we need standardized colors (ROC, Severities, etc.)

File Naming

@karelhala @Kinlaw

How do we want to handle naming of files?

I was thinking:

PresentationalComponents
└───YourComponent
    ├─── index.js
    ├─── YourComponent.js
    └─── styles.scss <- literally named styles.scss

Add global variables

Based on feedback from other teams, they would like a set of global variables to easily reference. We'll just consume Patternfly variables into our own to serve to the apps.

Add widget types and IDs to Components

Charts

  • Donut
  • Gauge
  • Matrix
  • Pie

Components

  • Ansible
    • won't need unique ID because it should be wrapped in a component with an ID already.
  • Battery (needs unique ID)
  • Breadcrumbs
  • Dropdown (needs unique ID)
  • Input (needs unique ID)
  • PageHeader
  • Pagination
  • SimpleTableFilter (needs unique ID)
  • TabLayout
  • Table (needs unique ID)

Change TabLayout to allow to render outside of Header

Currently, the TabLayout header forces you to render a react-router route inside the same div as the Tabs themselves. This does not allow to put the tabs on the PageHeader and the content (react-router Switch in my case) outside, as far as I know.

Here's what I'm asked to do: (this is a mock made with Invision)

screenshot from 2018-12-17 09-58-57

Notice the tabs are the ones from https://pf-next.com/components/Tabs/examples/, which are different from the Nav components in http://patternfly-react.surge.sh/patternfly-4/components/nav , but that's a secondary issue.

But the only 2 possible ways I can use the TabLayout component are the following:

screenshot from 2018-12-17 10-00-39
screenshot from 2018-12-17 09-59-10

z index documentation

With components and chroming using different z indexes, we need docs to show what goes where and what indexes we should/should not be using.

export widget

I had previously opened #178 to create a common widget. What was implemented looks like my mocks. Yay! But my mocks were not PF4 approved. So sorry about that.

  • Apparently in PF4 we are not using the caret when an icon as a dropdown. So the behavior should be like a kebab.
  • We should also be using the font awesome file-export icon, not the download icon.

[BUG] Inventory (in vulnerability) toolbar wrapping strange

Describe the bug
Toolbar is wrapping incorrectly,
Mockup: https://redhat.invisionapp.com/share/YGOT8VL5HBU#/351085803_CVE_Detail_Page

To Reproduce
Open a CVE from Vulnerability

Expected behavior
Toolbar should wrap more sensibly. Paging should respond to collapse to the results count before wrapping. Actions on the left should stick together (not wrap as seen) until after the paging responds. See PF pagination: https://www.patternfly.org/v4/documentation/react/components/pagination/#examples

Screenshots
Xnip2019-05-13_15-33-26

[BUG] Notification alert is reappearing after dismiss.

Describe the bug
When the notification is displayed and dismissed, redirecting to other page will cause the notification to appear again. This process duplicates the notifications multiple times and causes flooding by alerts.

To Reproduce
Steps to reproduce the behavior:

  1. Dispatch "@@INSIGHTS-CORE/NOTIFICATIONS/ADD_NOTIFICATION" action.
  2. Dismiss the notification or wait for it to disappear
  3. Navigate to other page withing single page APP
  4. See notification again

Expected behavior
No reappearing of the notification

Desktop (please complete the following information):

  • OS: Fedora 28
  • Browser: Firefox
  • Version: 64

Additional context
Should not be Vulnerability specific thing as I tried to reproduce using different apps and the behavior was identical.

Add doc for notifications

Since we have easy way of adding notifications to app we should also document such thing

  • Adding notifications to app
  • Managing notifications trough middleware

Common export/download widget

Several of the apps on the platform have requirements to download tables in CSV and JSON formats (with other formats coming later). It would be nice to have a common widget for this use case that apps can pull in.

screen shot 2018-12-19 at 9 58 47 am

It's the download icon and a caret, no outline. Interaction should be the same as the kebab.

[BUG] Casing issue in Inventory

Describe the bug
All text should be sentence case. There is an instance of title case in the inventory. (see pic)

To Reproduce
Open any inventory screen

Expected behavior
Should be sentence case: "Last sync"

Screenshots
image (1)

Set up environment for developing components

My thought is that if we want to develop a component, there should probably be a sandbox page where you can import whatever js and scss you want to test styling and interaction.

Something like
npm run sandbox will render a sandbox.js page and then throw it into localhost or something.

Thoughts @karelhala @jharting @Kinlaw ?

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.