npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cumulocity-runtime-widget-loader

v1006.3.0-1.2

Published

Loads packaged widgets into Cumulocity IoT at runtime

Downloads

55

Readme

Cumulocity IoT Runtime Widget Loader

Load packaged Cumulocity IoT custom widgets at runtime, rather than by recompiling your whole application.

Widget Installation

Requires: Application upload permission (usually admin rights)

widget installation

  1. While on a dashboard screen, select the More... -> Install Widget option in the action bar
  2. Upload a widget zip file (Created using the Runtime Widget Template)
  3. Start using your widget

Builds

Using the Application Builder?

This is already included in the latest version of the Application Builder

Want to add Runtime Widgets to the Cumulocity IoT Cockpit?

Pick one of the pre-built images available in the Releases Area.

Build Instructions

  1. (Optional) Create a new Cumulocity IoT web app and initialise it:

    c8ycli new cockpit cockpit -a @c8y/[email protected]
    cd cockpit
    npm install
  2. Install dependencies:

    npm install jszip webpack-external-import

    For the 1006.3.0 version of Cumulocity IoT you also need to install a specific version of ngx-bootstrap:

    npm install [email protected]
  3. Install the runtime widget loader:

    npm install cumulocity-runtime-widget-loader
  4. Edit package.json start and build configurations to include an extraWebpackConfig option:

    {
      ...
      "scripts": {
        "start": "c8ycli server --env.extraWebpackConfig=node_modules/cumulocity-runtime-widget-loader/runtime-widget-webpack.config.js",
        "build": "c8ycli build --env.extraWebpackConfig=node_modules/cumulocity-runtime-widget-loader/runtime-widget-webpack.config.js"
      }
      ...
    }
  5. Update the package.json "main" entry to point to "index.ts" rather than "index.js":

    {
      ...
      "main": "index.ts"
      ...
    }
  6. Add cumulocity-runtime-widget-loader to the app.module.ts:

    import {RuntimeWidgetLoaderService, RuntimeWidgetInstallerModule} from "cumulocity-runtime-widget-loader";
       
    @NgModule({
      imports: [
        ...
        // Adds an "Install widget" button to the action bar when you have a dashboard open.
        // Alternatively, remove the ".forRoot()" and manually invoke the RuntimeWidgetInstallerModalService#show() method
        RuntimeWidgetInstallerModule.forRoot(),
        ...
      ]
    })
    export class AppModule extends HybridAppModule {
      constructor(protected upgrade: NgUpgradeModule, private runtimeWidgetLoaderService: RuntimeWidgetLoaderService) {
        super();
      }
       
      ngDoBootstrap(): void {
        super.ngDoBootstrap();
        // Load the runtime widgets
        // Note: This must be after angularJs is loaded so it is done after bootstrapping
        this.runtimeWidgetLoaderService.loadRuntimeWidgets();
      }
    }
    
  7. Include patches to webpack-external-import and to @c8y/ngx-components.

    Install patch-package:

    npm install --save-dev patch-package

    Edit package.json (to reapply a patch after every install):

    {
      ...
      "scripts": {
        ...
        "postinstall": "patch-package --patch-dir node_modules/cumulocity-runtime-widget-loader/patches"
      }
      ...
    }

    Install the patch, by running:

    npm install
  8. Run the application:

    npm start

These tools are provided as-is and without warranty or support. They do not constitute part of the Software AG product suite. Users are free to use, fork and modify them, subject to the license agreement. While Software AG welcomes contributions, we cannot guarantee to include every contribution in the master project.


For more information you can Ask a Question in the TECHcommunity Forums.

You can find additional information in the Software AG TECHcommunity.