Giter Club home page Giter Club logo

dynamic-plugin-sdk's Introduction

OpenShift Dynamic Plugin SDK

Provides APIs, utilities and types to develop and run dynamic plugins in host web applications.

Overview

Host applications can load and interpret plugins from remote sources at runtime by utilizing webpack module federation. Module federation allows a JavaScript application to load additional code while sharing common runtime dependencies.

Both host applications and plugins can be built, released and deployed independently from each other. This reduces the coupling between an application and its plugins and allows individual plugins to be updated more frequently.

Tools provided by this SDK are React focused. Host applications are React web apps built with webpack. Plugins use React APIs (hooks, components, etc.) to extend the functionality of the application itself and/or other plugins.

Quick References

Distributable Packages

Following SDK packages are distributed via npmjs:

Package Name Sources
@openshift/dynamic-plugin-sdk packages/lib-core
@openshift/dynamic-plugin-sdk-extensions packages/lib-extensions
@openshift/dynamic-plugin-sdk-utils packages/lib-utils
@openshift/dynamic-plugin-sdk-webpack packages/lib-webpack

Each package is versioned and published independently from other packages.

dynamic-plugin-sdk's People

Contributors

admbk avatar andrewballantyne avatar blakeholifield avatar christianvogt avatar fhlavac avatar florkbr avatar hyperkid123 avatar jenny-s51 avatar karelhala avatar kdoberst avatar openshift-ci[bot] avatar openshift-merge-bot[bot] avatar openshift-merge-robot avatar rhamilto avatar vidyanambiar avatar vojtechszocs avatar

Stargazers

 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

dynamic-plugin-sdk's Issues

@openshift/dynamic-plugin-sdk or @openshift-console/dynamic-plugin-sdk

Which is correct to use, @openshift/dynamic-plugin-sdk or @openshift-console/dynamic-plugin-sdk?

The OpenShift 4.12 docs here point to the openshift/console-plugin-template repo. That repo is using @openshift-console/dynamic-plugin-sdk.

I noticed that @openshift-console/dynamic-plugin-sdk is missing implementations of documented functions like k8sListResource, k8sCreateResource, etc. The types are there but the implementation isn't. Those functions are implemented in this repo though.

Modal dialog functions do not support generics

The documentation for the new modal dialogs show them being called with generics however the dynamic SDK doesn't actually export them with generics as far as I can tell. For example the dynamic SDK reference page shows the following example for useLabelModels:

const PodLabelsButton = ({ pod }) => {
  const { t } = useTranslation();
  const launchLabelsModal = useLabelsModal<PodKind>(pod);
  return <button onClick={launchLabelsModal}>{t('Edit Pod Labels')}</button>
}

https://docs.openshift.com/container-platform/4.14/web_console/dynamic-plugin/dynamic-plugins-reference.html

Trying to call the function with a generic results in a compilation failure with the error:

TS2558: Expected 0 type arguments, but got 1.

The useDeleteModal does actually need to support generics since AFAIK it uses the type to determine whether non-cascading deletes are supported and shows a checkbox to enable this.

filter by annotation value i.e. in k8sListResource

@florkbr Is is possible at all to filter by annotation instead of only label in k8sListResource?

In Openshift, default storage class is only marked and handled via an annotation, so getting the default one out of many is a pain currently without helper tools like jq or node-jq https://www.baeldung.com/linux/kubernetes-labels-annotations

Background: Red Hat Open Data Hub odh-dashboard is using this library here for interactions with the openshift API.

Incompatible with hot module replacement?

When I'm developing a remote plugin, I want to enable webpack HMR feature, but when I edit the codes, an error will be emitted:

ERROR in [entry] [initial] dp-remote-starter.d4404b9346b30617fed9.hot-update.js
Missing call to __load_plugin_entry__

So I have to disable HMR for now, is that possible to support HMR?

Issue while trying to setup storybook using dynamic plugin sdk

We are using the dynamic plugin sdk to develop a self-provisioning ui for amq broker. In this, we are using storybook(https://storybook.js.org/) to ease the development of the UI. While trying to build the storybook components, the following error is seen

ERR! ModuleNotFoundError: Module not found: Error: Can't resolve '@console/dynamic-plugin-sdk/src/perspective/useActivePerspective' in '/Users/ajay/Work/KIE/activemq-artemis-self-provisioning-plugin/node_modules/@openshift-console/dynamic-plugin-sdk/lib/api'
ERR!     at /Users/ajay/Work/KIE/activemq-artemis-self-provisioning-plugin/node_modules/webpack/lib/Compilation.js:2016:28
ERR!     at /Users/ajay/Work/KIE/activemq-artemis-self-provisioning-plugin/node_modules/webpack/lib/NormalModuleFactory.js:798:13

Any help is much appreciated! Thanks in advance

Upgrade PatternFly to v5

The PF versions in dynamic-plugin-sdk are causing conflicting dependency issues in the v5 migration for various products such as OCP and ODH, cc @nicolethoen .

I am currently working on upgrading dynamic-plugin-sdk to PFv5 and adding the corresponding PF-related code changes.

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.