Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit 2e35541

Browse files
committed
Initial Commit
1 parent e2d89e5 commit 2e35541

34 files changed

+21424
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+
.idea

README.md

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,81 @@
1-
# cumulocity-device-chart-widget-plugin
1+
# Cumulocity Device Chart Widget Plugin [<img width="35" src="https://user-images.githubusercontent.com/67993842/97668428-f360cc80-1aa7-11eb-8801-da578bda4334.png"/>](https://github.com/SoftwareAG/cumulocity-device-chart-widget-plugin/releases/download/1.0.0-beta/cumulocity-device-chart-widget-plugin-1.0.0-beta.zip)
2+
3+
This Device Chart Widget is the Cumulocity module federation plugin created using c8ycli. This plugin can be used in Application Builder or Cockpit. It displays the chart based on the device-specific inventory data.
4+
By Default the chart displays the count based on the input in the group by field of configuration. But if the input is provided in the value field of the widget configuration it gives the value sum of the provided field from device managed object.
5+
6+
The widget also comes with an inbuilt color picker, which helps one to customize chart/border colors. The charts available include
7+
8+
Vertical Bar Chart
9+
10+
Horizontal Bar Chart
11+
12+
Donut Chart
13+
14+
Pie Chart
15+
16+
Radar Chart
17+
18+
Polar Chart
19+
20+
Scatter Chart (Data set not ideal for this chart)
21+
22+
Bubble Chart (Data set not ideal for this chart)
23+
24+
### Please note that this plugin is in currently under BETA mode.
25+
26+
### Please choose Device Chart Widget release based on Cumulocity/Application builder version:
27+
28+
|APPLICATION BUILDER | CUMULOCITY | DEVICE CHART WIDGET PLUGIN |
29+
|--------------------|------------|-----------------------------|
30+
| 1.4.x(coming soon) | >= 1015.x.x| 1.x.x |
31+
32+
33+
## Prerequisites:
34+
Cumulocity c8ycli >=1014.x.x
35+
36+
## Installation
37+
38+
39+
### Runtime Deployment?
40+
41+
* This widget support runtime deployment. Download [Runtime Binary](https://github.com/SoftwareAG/cumulocity-device-chart-widget-plugin/releases/download/1.0.0-beta/cumulocity-device-chart-widget-plugin-1.0.0-beta.zip) and install via Administrations(Beta mode) --> Ecosystems --> Applications --> Packages
42+
43+
### Local Development?
44+
45+
**Requirements:**
46+
* Git
47+
* NodeJS (release builds are currently built with `v14.18.0`)
48+
* NPM (Included with NodeJS)
49+
50+
**Instructions**
51+
1. Clone the repository:
52+
```
53+
git clone https://github.com/SoftwareAG/cumulocity-device-chart-widget-plugin.git
54+
```
55+
2. Change directory:
56+
```
57+
cd cumulocity-device-chart-widget-plugin
58+
```
59+
3. Install the dependencies:
60+
```
61+
npm install
62+
```
63+
4. (Optional) Local development server:
64+
```
65+
npm start -- --shell cockpit
66+
```
67+
5. Build the app:
68+
```
69+
npm run build
70+
```
71+
6. Deploy the app:
72+
```
73+
npm run deploy
74+
```
75+
76+
77+
------------------------------
78+
79+
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.
80+
_____________________
81+
For more information you can Ask a Question in the [TECH Community Forums](https://tech.forums.softwareag.com/tag/Cumulocity-IoT).

app.module.spec.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { TestBed } from '@angular/core/testing';
2+
3+
describe('Example test', () => {
4+
/*let testComponent;
5+
6+
beforeEach(() => {
7+
TestBed.configureTestingModule({
8+
imports: [ExampleModule]
9+
});
10+
testComponent = TestBed.createComponent(TestComponent);
11+
});*/
12+
13+
test('Always true', () => {
14+
expect(true).toBe(true);
15+
});
16+
});

app.module.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { NgModule } from '@angular/core';
2+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
3+
import { RouterModule as ngRouterModule } from '@angular/router';
4+
import {
5+
BootstrapComponent,
6+
CoreModule, RouterModule
7+
} from '@c8y/ngx-components';
8+
import { BsModalRef } from 'ngx-bootstrap/modal';
9+
import { GpLibDeviceChartModule } from './widget/gp-lib-device-chart.module';
10+
11+
@NgModule({
12+
imports: [
13+
BrowserAnimationsModule,
14+
ngRouterModule.forRoot([], { enableTracing: false, useHash: true }),
15+
RouterModule.forRoot(),
16+
CoreModule.forRoot(),
17+
GpLibDeviceChartModule
18+
],
19+
providers: [
20+
BsModalRef
21+
],
22+
bootstrap: [BootstrapComponent]
23+
})
24+
export class AppModule {}

gulpfile.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
const {src, dest, series} = require('gulp');
2+
const zip = require('gulp-zip');
3+
const del = require('del');
4+
const pkgJson = require('./package.json');
5+
6+
function clean() {
7+
return del(['dist']);
8+
}
9+
10+
const bundle = series(
11+
function createZip() {
12+
return src(`./dist/apps/${pkgJson.c8y.application.contextPath}/**/*`)
13+
.pipe(zip(`${pkgJson.c8y.application.contextPath}-${pkgJson.version}.zip`))
14+
.pipe(dest('dist/'))
15+
}
16+
)
17+
18+
exports.clean = clean;
19+
exports.bundle = bundle;
20+
exports.default = series(bundle, async function success() {
21+
console.log("Build Finished Successfully!");
22+
console.log(`PluginOutput (Install in the browser): dist/${pkgJson.c8y.application.contextPath}-${pkgJson.version}.zip`);
23+
});

index.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import './polyfills';
2+
3+
import { enableProdMode } from '@angular/core';
4+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
5+
import { AppModule } from './app.module';
6+
7+
declare const __MODE__: string;
8+
if (__MODE__ === 'production') {
9+
enableProdMode();
10+
}
11+
12+
export function bootstrap() {
13+
platformBrowserDynamic()
14+
.bootstrapModule(AppModule)
15+
.catch(err => console.log(err));
16+
}

jest.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// jest.config.js
2+
module.exports = {
3+
preset: 'jest-preset-angular',
4+
setupFilesAfterEnv: ['<rootDir>/setup-jest.js'],
5+
transformIgnorePatterns: ['/!node_modules\\/lodash-es/']
6+
};

0 commit comments

Comments
 (0)