Code Monkey home page Code Monkey logo

app-services-ui-components's Introduction

@rhoas/app-services-ui-components

@rhoas/app-services-ui-components contains a number of components for the Managed Application Services UI.

npm version codecov

The project is documented using Storybook, published on GitHub Pages.

Usage

import { Something } from '@rhoas/app-services-ui-components';

<Something />

Install

With npm installed, add the package to your peer and development dependencies.

$ npm install --save-dev --save-peer --save-exact @rhoas/app-services-ui-components

It's not recommended installing the package as a direct dependency to avoid having it bundled in your project's bundle.

Finally, make sure to list the dependency as a shared singleton in your federated module section on the Webpack's config file.
Be sure to enable the singleton option in order to have the internationalization layer work correctly.

// webpack.js

const { dependencies, peerDependencies } = require('./package.json');

module.exports = () => {
  return {
    // ...
    plugins: [
      // other plugins
      new webpack.container.ModuleFederationPlugin({
        name: 'my-module',
        filename: 'my-module.js',
        exposes: {
          './MyModule': './src/MyModule',
        },
        shared: {
          ...dependencies,
          ...peerDependencies,
          react: {
            eager: true,
            singleton: true,
            requiredVersion: peerDependencies['react'],
          },
          'react-dom': {
            eager: true,
            singleton: true,
            requiredVersion: peerDependencies['react-dom'],
          },
          'react-router-dom': {
            singleton: true,
            requiredVersion: peerDependencies['react-router-dom'],
          },
          '@rhoas/app-services-ui-components': {
            singleton: true,
            requiredVersion: peerDependencies['@rhoas/app-services-ui-components'],
          },
          '@rhoas/app-services-ui-shared': {
            singleton: true,
            requiredVersion: peerDependencies['@rhoas/app-services-ui-shared'],
          },
          '@patternfly/quickstarts': {
            singleton: true,
            requiredVersion: '*',
          },
        },
      })
    ]
  };
}

i18n

This project implements i18n using react-i18next.

You can translate strings by using one of the methods provided by react-18next, like the useTranslation hook.

To make life easier when developing a new Managed Application Services UI or when writing unit tests that also cover translations, the whole react-i18next library is re-exported by @rhoas/app-services-ui-components.

You can translate your content without directly including react-i18next as a direct dependency of your project by doing:

import { useTranslation } from '@rhoas/app-services-ui-components';

const MyComponent = () => {
    const { t } = useTranslation();
    return <span>{t('common:status')}</span>
}

Refer to the react-i18next documentation for more information.

Optional: set up the shared context providers

This step is required only if you want to run your application without the app-services-ui dev server. Never place the following code in components you make available as a federated module!

// App.tsx

import { VoidFunctionComponent } from "react";
import { I18nProvider, ModalProvider } from "@rhoas/app-services-ui-components";

const App: VoidFunctionComponent = () => (
  <I18nProvider
    lng={'en'}
    resources={{
      en: {
        common: () => import('@rhoas/app-services-ui-components/locales/en/common.json'),
        'create-kafka-instance': () => import('@rhoas/app-services-ui-components/locales/en/create-kafka-instance.json'),
        kafka: () => import('@rhoas/app-services-ui-components/locales/en/kafka.json'),
        metrics: () => import('@rhoas/app-services-ui-components/locales/en/metrics.json'),
        overview: () => import('@rhoas/app-services-ui-components/locales/en/overview.json'),
        datascienceoverview: () => import('@rhoas/app-services-ui-components/locales/en/datascienceoverview.json'),
        kafkaoverview: () => import('@rhoas/app-services-ui-components/locales/en/kafkaoverview.json'),
        topic: () => import("../locales/en/topic.json"),
        apimgmtoverview: () => import('@rhoas/app-services-ui-components/locales/en/apimgmtoverview.json'),
        "manage-kafka-permissions": () => import("@rhoas/app-services-ui-components/locales/en/manage-kafka-permissions.json"),},
    }}
    debug={true}
  >
    <ModalProvider>
      my app goes here
    </ModalProvider>
  </I18nProvider>
);

See Also

License

Apache

app-services-ui-components's People

Contributors

ajaypratap003 avatar aneelac22 avatar anukritijha avatar cfchase avatar cfullam1 avatar daodaonocode avatar dlabaj avatar edewit avatar fbricon avatar gashcrumb avatar hemahg avatar hyperkid123 avatar indraraj avatar kells512 avatar kelvah avatar mmusil avatar pmuir avatar redallen avatar renovate-bot avatar renovate[bot] avatar riccardo-forina avatar simrandhaliw avatar srambach avatar suyash-naithani avatar tiffanynolan avatar wtrocki avatar

Stargazers

 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  avatar

app-services-ui-components's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency lint-staged to v15
  • chore(deps): update dependency node to v20
  • chore(deps): update shared components packages to v10 (major) (chromatic, chromaui/action)
  • chore(deps): update shared components packages to v4 (major) (actions/checkout, actions/setup-node, rollup)
  • chore(deps): update shared components packages to v6 (major) (@testing-library/jest-dom, @typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • chore(deps): update shared components packages to v7 (major) (@patternfly/react-charts, @storybook/addon-a11y, @storybook/addon-actions, @storybook/addon-docs, @storybook/addon-essentials, @storybook/addon-interactions, @storybook/addon-jest, @storybook/addon-links, @storybook/builder-webpack5, @storybook/react, chromatic)
  • chore(deps): update shared components packages to v8 (major) (chromatic, i18next-parser)
  • chore(deps): update shared components packages to v9 (major) (chromatic, chromaui/action, eslint-config-prettier)
  • fix(deps): update dependency @xstate/react to v4
  • fix(deps): update dependency i18next to v23
  • fix(deps): update dependency xstate to v5
  • fix(deps): update shared components packages to v3 (major) (date-fns, prettier, rollup)
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/actions/cache-restore/action.yml
  • actions/setup-node v3
  • actions/cache v3
.github/workflows/lint-pr.yml
  • amannn/action-semantic-pull-request v5@b6bca70dcd3e56e896605356ce09b76f7e1e0d39
.github/workflows/main.yml
  • actions/checkout v3
  • actions/checkout v3.0.2
  • JamesIves/github-pages-deploy-action v4.4.0@13046b614c663b56cba4dda3f30b9736a748b80d
.github/workflows/publish-release.yml
  • actions/checkout v3
  • actions/setup-node v3
.github/workflows/reusable-build.yml
  • actions/checkout v3
  • actions/checkout v3
  • codecov/codecov-action v3@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70
  • actions/checkout v3
  • actions/checkout v3
  • actions/checkout v3
  • chromaui/action v1@d5ecbf7522dc237c97ef746e40e9100e653bd0bf
.github/workflows/storybook-to-pages.yml
  • actions/checkout v3.0.2
  • JamesIves/github-pages-deploy-action v4.4.0@13046b614c663b56cba4dda3f30b9736a748b80d
npm
package.json
  • @swc/helpers 0.4.3
  • @xstate/react 3.0.0
  • byte-size 8.1.0
  • classnames 2.3.1
  • convert ^4.6.2
  • date-fns 2.28.0
  • date-fns-tz 2.0.0
  • i18next 22.0.0
  • react-i18next 11.18.1
  • tslib 2.4.0
  • use-resize-observer 9.0.2
  • xstate 4.32.1
  • @babel/core 7.18.13
  • @patternfly/patternfly 4.222.4
  • @patternfly/react-charts 6.94.15
  • @patternfly/react-core 4.267.6
  • @patternfly/react-icons 4.93.3
  • @patternfly/react-table 4.112.6
  • @rhoas/app-services-ui-shared 0.16.4
  • @rollup/plugin-json 6.0.0
  • @rollup/plugin-replace 5.0.0
  • @storybook/addon-a11y 6.5.9
  • @storybook/addon-actions 6.5.9
  • @storybook/addon-docs 6.5.9
  • @storybook/addon-essentials 6.5.9
  • @storybook/addon-interactions 6.5.9
  • @storybook/addon-jest 6.5.9
  • @storybook/addon-links 6.5.9
  • @storybook/builder-webpack5 6.5.9
  • @storybook/jest 0.0.10
  • @storybook/manager-webpack5 6.5.9
  • @storybook/react 6.5.9
  • @storybook/test-runner 0.9.0
  • @storybook/testing-library 0.0.13
  • @storybook/testing-react 1.3.0
  • @swc/core 1.2.218
  • @testing-library/jest-dom 5.16.4
  • @testing-library/react 12.1.5
  • @types/byte-size 8.1.0
  • @types/jest 27.5.2
  • @types/react 17.0.47
  • @types/react-dom 17.0.17
  • @types/react-router-dom 5.3.3
  • @types/rollup-plugin-auto-external 2.0.2
  • @typescript-eslint/eslint-plugin 5.36.0
  • @typescript-eslint/parser 5.36.0
  • @web/rollup-plugin-import-meta-assets 1.0.7
  • @xstate/inspect 0.7.0
  • chromatic 6.7.0
  • concurrently 8.0.1
  • eslint 8.20.0
  • eslint-config-prettier 8.5.0
  • eslint-plugin-deprecation 1.3.2
  • eslint-plugin-react ^7.31.1
  • eslint-plugin-react-hooks 4.6.0
  • eslint-plugin-storybook 0.6.1
  • http-server 14.1.1
  • husky 8.0.1
  • i18next-parser 7.0.3
  • jest 27.5.1
  • jest-environment-jsdom 27.5.1
  • jest-fail-on-console 3.0.1
  • lint-staged 12.5.0
  • npm-run-all 4.1.5
  • prando 6.0.1
  • prettier 2.7.1
  • react 17.0.2
  • react-dom 17.0.2
  • react-router-dom 5.2.1
  • regenerator-runtime 0.13.9
  • rimraf 4.0.4
  • rollup 2.77.0
  • rollup-plugin-auto-external 2.0.0
  • rollup-plugin-postcss 4.0.2
  • rollup-plugin-swc3 0.3.0
  • rollup-plugin-terser 7.0.2
  • storybook-xstate-addon 2.3.1
  • typescript 4.7.4
  • wait-on 7.0.1
  • @patternfly/patternfly ^4.222.4
  • @patternfly/react-charts ^6.94.15
  • @patternfly/react-core ^4.267.6
  • @patternfly/react-icons ^4.93.3
  • @patternfly/react-table ^4.112.6
  • @patternfly/react-tokens ^4.94.3
  • @rhoas/app-services-ui-shared ^0.16.4
  • react ^17.0.2
  • react-dom ^17.0.2
  • react-router-dom ^5.2.1
nvm
.nvmrc
  • node 16.19.0

  • Check this box to trigger a request for Renovate to run again on this repository

Create Instance modal spuriously erase the Instance Name input

Using the Playwright E2E tests we found and edge case where in the Kafka Creation modal:

  • the Instance name gets filled by Playwright
  • the instance name field gets blanked
  • the Create Instance gets clicked by Playwright

We are under the impression that something async in background is cleaning up the input field before the button is clicked.

Those are the traces trace.zip.

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.