Skip to content

Commit e927d9d

Browse files
committed
update readme
1 parent 2611131 commit e927d9d

16 files changed

+37
-54
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Cumulocity Operation Button Widget Plugin
1+
# Cumulocity Operation Widget
22

33
## Purpose
44

cumulocity.config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ export default {
77
description,
88
version,
99
name,
10-
key: 'c8y-pkg-widget-operation-button-key',
10+
key: 'c8y-pkg-operation-widget-key',
1111
contentSecurityPolicy:
1212
"base-uri 'none'; default-src 'self' 'unsafe-inline' http: https: ws: wss:; connect-src 'self' http: https: ws: wss:; script-src 'self' *.bugherd.com *.twitter.com *.twimg.com *.aptrinsic.com 'unsafe-inline' 'unsafe-eval' data:; style-src * 'unsafe-inline' blob:; img-src * data: blob:; font-src * data:; frame-src *; worker-src 'self' blob:;",
1313
dynamicOptionsUrl: true,
14+
contextPath: 'c8y-pkg-operation-button-widget',
1415
remotes: {
1516
[name]: ['OperationButtonWidgetModule']
1617
},
@@ -20,7 +21,7 @@ export default {
2021
license,
2122
exports: [
2223
{
23-
name: "Operation Button Widget Plugin",
24+
name: "Operation Button Widget",
2425
module: 'OperationButtonWidgetModule',
2526
path: './src/app/index.ts',
2627
readmePath: './src/app/README.md',

src/app/README.md

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,10 @@
1-
# SAMPLE-PLUGIN Readme Example
1+
# Cumulocity Operation Widget
22

3-
## Adding a Readme File to Your Plugin
3+
## Purpose
44

5-
Follow these steps to include a readme file in your plugin:
5+
This widget plugin allows you to send operations to a selected device in Cumulocity. Key features include:
66

7-
1. Add the `readmePath` property to the `exports` array in your `cumulocity.config.ts` file.
8-
2. Place the readme file in the same folder as your `index.ts` file.
9-
10-
### Example
11-
12-
```ts
13-
exports: [
14-
{
15-
name: 'Example sample plugin view',
16-
module: 'OperationButtonWidgetModule',
17-
path: './src/app/index.ts',
18-
readmePath: './src/app/README.md',
19-
description: 'Adds a custom widget and navigator node to the shell application'
20-
}
21-
];
22-
```
23-
24-
### What Happens When You Build?
25-
26-
When you build your plugin (e.g., by running `ng build sample-plugin`), the generated zip file will include the readme file. It will be placed in a folder named after your module, such as `SamplePluginModule` or `OperationButtonWidgetModule`.
7+
- **Device Selection**: Choose a target device to send operations to
8+
- **Configurable Parameters**: Define custom parameters for each operation
9+
- **Dynamic UI**: Update parameter values directly in the UI when invoking the operation
10+
- **Easy Integration**: Install as a plugin to any Cumulocity application

src/app/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ import {
77
importConfigWithDevice
88
} from '@c8y/ngx-components/widgets/import-export-config';
99
import { assetPaths } from '../assets/assets';
10-
import { OperationButtonComponent } from './operation-button-widget/widget/operation-button.component';
11-
import { OperationButtonConfigComponent } from './operation-button-widget/widget-config/operation-button-config.component';
10+
import { OperationWidgetComponent } from './operation-widget/widget/operation-widget.component';
11+
import { OperationWidgetConfigComponent } from './operation-widget/widget-config/operation-widget-config.component';
1212

1313
export const samplePluginWidgetDefinition = {
1414
id: 'operation-button-widget',
1515
label: 'Operation Button Widget',
1616
description: gettext('Widget to create an operation'),
17-
component: OperationButtonComponent,
18-
configComponent: OperationButtonConfigComponent,
17+
component: OperationWidgetComponent,
18+
configComponent: OperationWidgetConfigComponent,
1919
previewImage: assetPaths.previewImage,
2020
data: {
2121
schema: () =>

src/app/operation-button-widget/button-instance/button-instance.component.html renamed to src/app/operation-widget/button/operation-button.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
<button
23
class="btn"
34
[ngClass]="classes"

src/app/operation-button-widget/button-instance/button-instance.component.ts renamed to src/app/operation-widget/button/operation-button.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ import {
88
Output,
99
TemplateRef,
1010
} from '@angular/core';
11-
import { IOperationButtonConfig } from '../models/IOperationButtonConfig';
11+
import { IOperationButtonConfig } from '../models/operation-widget-model';
1212
import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal';
1313
import { CommonModule, NgClass } from '@angular/common';
1414
import { IconDirective } from '@c8y/ngx-components';
1515

1616
@Component({
17-
selector: 'app-button-instance',
18-
templateUrl: './button-instance.component.html',
17+
selector: 'app-operation-button',
18+
templateUrl: './operation-button.component.html',
1919
standalone: true,
2020
imports: [
2121
CommonModule, NgClass, IconDirective
2222
]
2323
})
24-
export class ButtonInstanceComponent implements OnInit, OnChanges {
24+
export class OperationButtonComponent implements OnInit, OnChanges {
2525
@Input() config: IOperationButtonConfig = {
2626
buttonLabel: '',
2727
operationFragment: '',

src/app/operation-button-widget/models/IOperationButtonConfig.ts renamed to src/app/operation-widget/models/operation-widget-model.ts

File renamed without changes.

src/app/operation-button-widget/widget-config/icons-constant.ts renamed to src/app/operation-widget/widget-config/icons-constant.ts

File renamed without changes.

src/app/operation-button-widget/widget-config/operation-button-config.component.css renamed to src/app/operation-widget/widget-config/operation-widget-config.component.css

File renamed without changes.

src/app/operation-button-widget/widget-config/operation-button-config.component.html renamed to src/app/operation-widget/widget-config/operation-widget-config.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
'btn btn-default dropdown-toggle c8y-dropdown ' +
7575
(item.buttonSize || 'btn-warning')
7676
">
77-
<span><i [c8yIcon]="item.icon"></i>
77+
<span><i [c8yIcon]="item.buttonIcon"></i>
7878
{{
7979
item.buttonSize ? item.buttonSize : 'Choose size'
8080
}}</span>
@@ -263,6 +263,6 @@
263263
</div>
264264

265265
<ng-template #sampleWidgetPreview>
266-
<app-operation-button-widget [config]="config"></app-operation-button-widget>
266+
<app-operation-widget [config]="config"></app-operation-widget>
267267
</ng-template>
268268
</div>

0 commit comments

Comments
 (0)