@c8y/tutorial 1019.6.10 → 1019.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cumulocity.config.ts +64 -8
- package/package.json +6 -6
- package/src/__mocks/scoped-mocks/device-data-grid.ts +47 -9
- package/src/__mocks/utils/common.ts +24 -6
- package/src/__mocks/utils/grid.ts +14 -0
- package/src/app/app.module.ts +3 -1
- package/src/app-icon/app-icon-example.component.html +109 -0
- package/src/app-icon/app-icon-example.component.ts +56 -0
- package/src/app-icon/app-icon-example.module.ts +22 -0
- package/src/breadcrumbs/basic-example/breadcrumbs-example.component.html +23 -0
- package/src/breadcrumbs/basic-example/breadcrumbs-example.component.ts +13 -0
- package/src/breadcrumbs/basic-example/breadcrumbs-example.module.ts +23 -0
- package/src/breadcrumbs/breadcrumbs.module.ts +14 -0
- package/src/breadcrumbs/content-projection/breadcrumbs-content-projection-example.component.html +28 -0
- package/src/breadcrumbs/content-projection/breadcrumbs-content-projection-example.component.ts +13 -0
- package/src/breadcrumbs/content-projection/breadcrumbs-content-projection-example.module.ts +25 -0
- package/src/breadcrumbs/expand-example/breadcrumbs-expand-example.component.html +30 -0
- package/src/breadcrumbs/expand-example/breadcrumbs-expand-example.component.ts +13 -0
- package/src/breadcrumbs/expand-example/breadcrumbs-expand-example.module.ts +25 -0
- package/src/breadcrumbs/index.ts +5 -0
- package/src/breadcrumbs/outlet/breadcrumbs-outlet-example.component.html +21 -0
- package/src/breadcrumbs/outlet/breadcrumbs-outlet-example.component.ts +13 -0
- package/src/breadcrumbs/outlet/breadcrumbs-outlet-example.module.ts +25 -0
- package/src/device-connection-status/device-connection-status-example.component.html +145 -0
- package/src/device-connection-status/device-connection-status-example.component.ts +61 -0
- package/src/device-connection-status/device-connection-status-example.module.ts +23 -0
- package/src/hooks/action/logout-action/logout-action.component.ts +6 -2
- package/src/hooks/breadcrumbs/basic-view/basic-view.component.ts +3 -1
- package/src/modal/confirm-modal/confirm-modal-example.component.ts +43 -54
- package/src/modal/confirm-modal/delete-modal-example.component.ts +73 -0
- package/src/modal/ngx-modal/ngx-modal-example.component.ts +73 -21
- package/src/modal/ngx-modal/ngx-modal-example.module.ts +1 -1
- package/src/modal/ngx-modal/simple-modal-example.component.ts +45 -0
- package/src/modal/ngx-modal-accessibility/ngx-modal-accessibility-example.component.ts +47 -0
- package/src/modal/ngx-modal-accessibility/ngx-modal-accessibility-example.module.ts +24 -0
- package/src/modal/ngx-modal-accessibility/simple-modal-accessibility-example.component.ts +49 -0
- package/src/modal/ngx-modal-selectors/ngx-modal-selectors-example.component.ts +47 -0
- package/src/modal/ngx-modal-selectors/ngx-modal-selectors-example.module.ts +24 -0
- package/src/modal/ngx-modal-selectors/simple-modal-example-with-content-selectors.component.ts +72 -0
- package/src/modal/ngx-modal-sizes/large-modal-example.component.ts +45 -0
- package/src/modal/ngx-modal-sizes/medium-modal-example.component.ts +45 -0
- package/src/modal/ngx-modal-sizes/ngx-modal-sizes-example.component.ts +66 -0
- package/src/modal/ngx-modal-sizes/ngx-modal-sizes-example.module.ts +22 -0
- package/src/modal/ngx-modal-sizes/small-modal-example.component.ts +49 -0
- package/src/modal/simple-modal/modal-example.component.ts +0 -34
- package/src/modal/simple-modal/modal.example.module.ts +0 -21
package/cumulocity.config.ts
CHANGED
|
@@ -173,11 +173,35 @@ export default {
|
|
|
173
173
|
description: 'A sample for action bar hook.'
|
|
174
174
|
},
|
|
175
175
|
{
|
|
176
|
-
name: 'Breadcrumbs',
|
|
176
|
+
name: 'Breadcrumbs hook',
|
|
177
177
|
module: 'BreadcrumbsModule',
|
|
178
178
|
path: './src/hooks/breadcrumbs/breadcrumbs.module.ts',
|
|
179
179
|
description: 'A sample for breadcrumbs hook.'
|
|
180
180
|
},
|
|
181
|
+
{
|
|
182
|
+
name: 'Breadcrumbs expand',
|
|
183
|
+
module: 'BreadcrumbsExpandExampleModule',
|
|
184
|
+
path: './src/breadcrumbs/expand-example/breadcrumbs-expand-example.module.ts',
|
|
185
|
+
description: 'A sample for breadcrumbs.'
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: 'Breadcrumbs outlet',
|
|
189
|
+
module: 'BreadcrumbsOutletExampleModule',
|
|
190
|
+
path: './src/breadcrumbs/outlet/breadcrumbs-outlet-example.module.ts',
|
|
191
|
+
description: 'A sample for breadcrumb outlet.'
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: 'Breadcrumbs basic',
|
|
195
|
+
module: 'BreadcrumbsExampleModule',
|
|
196
|
+
path: './src/breadcrumbs/basic-example/breadcrumbs-example.module.ts',
|
|
197
|
+
description: 'A sample for breadcrumbs.'
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: 'Breadcrumbs content projection',
|
|
201
|
+
module: 'BreadcrumbsContentProjectionExampleModule',
|
|
202
|
+
path: './src/breadcrumbs/content-projection/breadcrumbs-content-projection-example.module.ts',
|
|
203
|
+
description: 'A sample for breadcrumbs content projection.'
|
|
204
|
+
},
|
|
181
205
|
{
|
|
182
206
|
name: 'Component',
|
|
183
207
|
module: 'ComponentModule',
|
|
@@ -298,6 +322,12 @@ export default {
|
|
|
298
322
|
path: './src/alert/alert-example.module.ts',
|
|
299
323
|
description: 'A sample for alerts.'
|
|
300
324
|
},
|
|
325
|
+
{
|
|
326
|
+
name: 'App icon example',
|
|
327
|
+
module: 'AppIconExampleModule',
|
|
328
|
+
path: './src/app-icon/app-icon-example.module.ts',
|
|
329
|
+
description: 'An example for App Icon component.'
|
|
330
|
+
},
|
|
301
331
|
{
|
|
302
332
|
name: 'Client grid example',
|
|
303
333
|
module: 'ClientGridExampleModule',
|
|
@@ -358,12 +388,6 @@ export default {
|
|
|
358
388
|
path: './src/properties-list/properties-list-example.module.ts',
|
|
359
389
|
description: 'An example of using properties list.'
|
|
360
390
|
},
|
|
361
|
-
{
|
|
362
|
-
name: 'Modal example',
|
|
363
|
-
module: 'ModalExampleModule',
|
|
364
|
-
path: './src/modal/simple-modal/modal.example.module.ts',
|
|
365
|
-
description: 'An example for using Modal.'
|
|
366
|
-
},
|
|
367
391
|
{
|
|
368
392
|
name: 'Confirm modal example',
|
|
369
393
|
module: 'ConfirmModalExampleModule',
|
|
@@ -382,6 +406,24 @@ export default {
|
|
|
382
406
|
path: './src/modal/ngx-modal/ngx-modal-example.module.ts',
|
|
383
407
|
description: 'An example for ngx modal.'
|
|
384
408
|
},
|
|
409
|
+
{
|
|
410
|
+
name: 'Example of ngx modal sizes',
|
|
411
|
+
module: 'NgxModalSizesExampleModule',
|
|
412
|
+
path: './src/modal/ngx-modal-sizes/ngx-modal-sizes-example.module.ts',
|
|
413
|
+
description: 'An example for ngx modal of different sizes.'
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
name: 'Example of ngx modal selectors',
|
|
417
|
+
module: 'NgxModalSelectorsExampleModule',
|
|
418
|
+
path: './src/modal/ngx-modal-selectors/ngx-modal-selectors-example.module.ts',
|
|
419
|
+
description: 'An example for ngx modal using ng-content selectors.'
|
|
420
|
+
},
|
|
421
|
+
{
|
|
422
|
+
name: 'Example of ngx modal accessibility',
|
|
423
|
+
module: 'NgxModalAccessibilityExampleModule',
|
|
424
|
+
path: './src/modal/ngx-modal-accessibility/ngx-modal-accessibility-example.module.ts',
|
|
425
|
+
description: 'An example for ngx modal accessibility.'
|
|
426
|
+
},
|
|
385
427
|
{
|
|
386
428
|
name: 'Example of realtime',
|
|
387
429
|
module: 'RealtimeTutorialModule',
|
|
@@ -538,6 +580,12 @@ export default {
|
|
|
538
580
|
path: './src/hooks/state/hook-state.module.ts',
|
|
539
581
|
description: 'This is an example for an Action added via service or factory.'
|
|
540
582
|
},
|
|
583
|
+
{
|
|
584
|
+
name: 'Device connection status',
|
|
585
|
+
module: 'DeviceConnectionStatusExampleModule',
|
|
586
|
+
path: './src/device-connection-status/device-connection-status-example.module.ts',
|
|
587
|
+
description: 'This is an example of Device connection status icons.'
|
|
588
|
+
},
|
|
541
589
|
{
|
|
542
590
|
name: 'Pagination',
|
|
543
591
|
module: 'PaginationExampleModule',
|
|
@@ -550,6 +598,9 @@ export default {
|
|
|
550
598
|
'FormsTutorialModule',
|
|
551
599
|
'TextTranslationNgnonbindableModule',
|
|
552
600
|
'NgxModalExampleModule',
|
|
601
|
+
'NgxModalSizesExampleModule',
|
|
602
|
+
'NgxModalSelectorsExampleModule',
|
|
603
|
+
'NgxModalAccessibilityExampleModule',
|
|
553
604
|
'JsonSchemaExampleModule',
|
|
554
605
|
'IntroductionExampleModule',
|
|
555
606
|
'CustomElementExampleModule',
|
|
@@ -562,6 +613,10 @@ export default {
|
|
|
562
613
|
'ActionModule',
|
|
563
614
|
'ActionBarModule',
|
|
564
615
|
'BreadcrumbsModule',
|
|
616
|
+
'BreadcrumbsExampleModule',
|
|
617
|
+
'BreadcrumbsExpandExampleModule',
|
|
618
|
+
'BreadcrumbsOutletExampleModule',
|
|
619
|
+
'BreadcrumbsContentProjectionExampleModule',
|
|
565
620
|
'ComponentModule',
|
|
566
621
|
'WizardModule',
|
|
567
622
|
'StepperHookModule',
|
|
@@ -590,13 +645,13 @@ export default {
|
|
|
590
645
|
'ServiceDashboardModule',
|
|
591
646
|
'NamedContextDashboardModule',
|
|
592
647
|
'AlertExampleModule',
|
|
648
|
+
'AppIconExampleModule',
|
|
593
649
|
'RightDrawerModule',
|
|
594
650
|
'LeftDrawerModule',
|
|
595
651
|
'AssetSelectorExampleModule',
|
|
596
652
|
'AssetSelectorMillerExampleModule',
|
|
597
653
|
'AssetSelectorTreeExampleModule',
|
|
598
654
|
'DatapointSelectionExampleModule',
|
|
599
|
-
'ModalExampleModule',
|
|
600
655
|
'ConfirmModalExampleModule',
|
|
601
656
|
'TutorialVersionModule',
|
|
602
657
|
'PopConfirmExampleModule',
|
|
@@ -629,6 +684,7 @@ export default {
|
|
|
629
684
|
'StepperModule',
|
|
630
685
|
'ApplicationCardExampleModule',
|
|
631
686
|
'HookStateModule',
|
|
687
|
+
'DeviceConnectionStatusExampleModule',
|
|
632
688
|
'PaginationExampleModule'
|
|
633
689
|
]
|
|
634
690
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c8y/tutorial",
|
|
3
|
-
"version": "1019.
|
|
3
|
+
"version": "1019.7.10",
|
|
4
4
|
"description": "This package is used to scaffold a tutorial for Cumulocity IoT Web SDK which explains a lot of concepts.",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@c8y/devkit": "1019.
|
|
7
|
-
"@c8y/style": "1019.
|
|
8
|
-
"@c8y/ngx-components": "1019.
|
|
9
|
-
"@c8y/client": "1019.
|
|
10
|
-
"@c8y/bootstrap": "1019.
|
|
6
|
+
"@c8y/devkit": "1019.7.10",
|
|
7
|
+
"@c8y/style": "1019.7.10",
|
|
8
|
+
"@c8y/ngx-components": "1019.7.10",
|
|
9
|
+
"@c8y/client": "1019.7.10",
|
|
10
|
+
"@c8y/bootstrap": "1019.7.10",
|
|
11
11
|
"@angular/cdk": "^16.2.11",
|
|
12
12
|
"ngx-bootstrap": "11.0.2",
|
|
13
13
|
"leaflet": "1.7.1",
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { IFetchResponse } from '@c8y/client';
|
|
2
2
|
import { ApiCall, HttpHandler, HttpInterceptor } from '@c8y/ngx-components/api';
|
|
3
|
+
import { filterObjectBySearchText, filterObjects } from '../utils/grid';
|
|
3
4
|
import { generateResponse, handleRequest } from '../utils/common';
|
|
4
5
|
import { Observable } from 'rxjs';
|
|
5
6
|
import { generateDevice } from '../../__mocks/utils/generators/managedObjects';
|
|
6
7
|
|
|
7
8
|
export class DeviceDataGridInterceptor implements HttpInterceptor {
|
|
9
|
+
// Check handleTotalPagesRequest
|
|
10
|
+
private totalPages = 100;
|
|
8
11
|
intercept(req: ApiCall, next: HttpHandler): Observable<IFetchResponse> {
|
|
9
12
|
return handleRequest(req, next, 'inventory/managedObjects', {
|
|
10
13
|
POST: this.mockPOST.bind(this),
|
|
@@ -20,25 +23,60 @@ export class DeviceDataGridInterceptor implements HttpInterceptor {
|
|
|
20
23
|
mockPUT(_requestDescriptor: string) {
|
|
21
24
|
return null;
|
|
22
25
|
}
|
|
23
|
-
private mockGET(_requestDescriptor: string) {
|
|
24
|
-
const
|
|
26
|
+
private mockGET(_requestDescriptor: string, statistics) {
|
|
27
|
+
const mockedQueryStringParameters = this.getMockedQueryStringParameters();
|
|
25
28
|
|
|
26
|
-
for (const urlPart in
|
|
29
|
+
for (const urlPart in mockedQueryStringParameters) {
|
|
27
30
|
if (_requestDescriptor.includes(urlPart)) {
|
|
28
|
-
const generatorResult =
|
|
31
|
+
const generatorResult = mockedQueryStringParameters[urlPart];
|
|
29
32
|
if (generatorResult) {
|
|
30
|
-
|
|
33
|
+
if (statistics?.pageSize === 1) {
|
|
34
|
+
return this.handleTotalPagesRequest(statistics);
|
|
35
|
+
}
|
|
36
|
+
return this.handleDataRequest(_requestDescriptor, statistics);
|
|
31
37
|
}
|
|
32
38
|
}
|
|
33
39
|
}
|
|
34
40
|
return null;
|
|
35
41
|
}
|
|
36
42
|
|
|
37
|
-
|
|
43
|
+
// Sets the totalPages number to 100. Enables pagination in the device grid.
|
|
44
|
+
// The device grid needs to know the total number of items.
|
|
45
|
+
private handleTotalPagesRequest(statistics) {
|
|
46
|
+
statistics.totalPages = this.totalPages;
|
|
47
|
+
return generateResponse(
|
|
48
|
+
() => ({
|
|
49
|
+
managedObjects: [],
|
|
50
|
+
...(statistics?.next && { next: statistics.next.toString() })
|
|
51
|
+
}),
|
|
52
|
+
statistics
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Handles the data request. Returns data that populates the device grid.
|
|
57
|
+
private handleDataRequest(_requestDescriptor, statistics) {
|
|
58
|
+
// statistics?.pageSize depends on the "Items per page" dropdown, where pageSize can be set to 25, 50, or 100.
|
|
59
|
+
const devices = [...Array(statistics?.pageSize || 25)].map(() => generateDevice());
|
|
60
|
+
|
|
61
|
+
const filteredDevices = filterObjects(devices, _requestDescriptor);
|
|
62
|
+
|
|
63
|
+
const filteredDevicesByTextSearch = filterObjectBySearchText(
|
|
64
|
+
filteredDevices,
|
|
65
|
+
_requestDescriptor
|
|
66
|
+
);
|
|
67
|
+
return generateResponse(
|
|
68
|
+
() => ({
|
|
69
|
+
managedObjects: [...filteredDevicesByTextSearch],
|
|
70
|
+
...(statistics?.next && { next: statistics.next.toString() })
|
|
71
|
+
}),
|
|
72
|
+
statistics
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
private getMockedQueryStringParameters() {
|
|
38
77
|
return {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
})
|
|
78
|
+
// Mock only requests that include a `pageSize` parameter.
|
|
79
|
+
pageSize: true
|
|
42
80
|
};
|
|
43
81
|
}
|
|
44
82
|
}
|
|
@@ -12,8 +12,6 @@ import { from } from 'rxjs';
|
|
|
12
12
|
* @param urlPath - The URL path which will be used to determine if the request should be handled. If the request URL includes this path, a handler will be searched for.
|
|
13
13
|
* @param handlers - An object mapping HTTP methods to their respective handlers. These handlers are functions that accept a string argument (requestDescriptor), which is a combination of the request URL and any parameters or body, and return either a Promise or an object of `IFetchResponse` type.
|
|
14
14
|
*
|
|
15
|
-
* For example:
|
|
16
|
-
*
|
|
17
15
|
* ```typescript
|
|
18
16
|
* {
|
|
19
17
|
* POST: mockPOSTFunction,
|
|
@@ -25,7 +23,7 @@ import { from } from 'rxjs';
|
|
|
25
23
|
* If a handler is found for the HTTP method of the request, the handler function is called with the `requestDescriptor` as its argument.
|
|
26
24
|
* @returns An Observable which will either contain the response from the matched handler function or, if no handler is matched, the result of the `next.handle(req)` call.
|
|
27
25
|
*
|
|
28
|
-
*
|
|
26
|
+
*
|
|
29
27
|
* In the example below, all requests to inventory/managedObjects will pass through the interceptor.
|
|
30
28
|
*
|
|
31
29
|
* ```typescript
|
|
@@ -45,7 +43,6 @@ import { from } from 'rxjs';
|
|
|
45
43
|
* mockPUT(_requestDescriptor: string) {
|
|
46
44
|
* return null;
|
|
47
45
|
* }
|
|
48
|
-
* ...
|
|
49
46
|
* }
|
|
50
47
|
* ```
|
|
51
48
|
*/
|
|
@@ -72,8 +69,10 @@ export function handleRequest(
|
|
|
72
69
|
const { method = 'GET' } = req?.options || {};
|
|
73
70
|
|
|
74
71
|
if (requestDescriptor.includes(urlPath) && handlers[method]) {
|
|
75
|
-
const
|
|
76
|
-
|
|
72
|
+
const statistics = generateStatistics(req?.options?.params);
|
|
73
|
+
const mockedResponse = handlers[method](requestDescriptor, statistics);
|
|
74
|
+
|
|
75
|
+
return mockedResponse ? from(Promise.resolve(mockedResponse)) : next.handle(req);
|
|
77
76
|
}
|
|
78
77
|
return next.handle(req);
|
|
79
78
|
}
|
|
@@ -112,3 +111,22 @@ export function generateResponse<T>(bodyGenerator: () => T, statistics = DEFAULT
|
|
|
112
111
|
});
|
|
113
112
|
return newResponse as ResponseWithType<T & { statistics: typeof DEFAULT_STATISTICS }>;
|
|
114
113
|
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Generates statistics by merging default statistics with external statistics.
|
|
117
|
+
*
|
|
118
|
+
* @param params A `Record<string, any>` object containing optional statistics parameters such as `totalPages`, `pageSize`, and `currentPage`.
|
|
119
|
+
* - `totalPages` specifies the total number of pages.
|
|
120
|
+
* - `pageSize` specifies the number of items per page.
|
|
121
|
+
* - `currentPage` specifies the current page number.
|
|
122
|
+
* @returns A statistics object that enables and handles pagination in the mocked response.
|
|
123
|
+
*/
|
|
124
|
+
function generateStatistics(params: Record<string, any>): typeof DEFAULT_STATISTICS {
|
|
125
|
+
return {
|
|
126
|
+
...DEFAULT_STATISTICS,
|
|
127
|
+
...(params?.totalPages && { totalPages: params.totalPages }),
|
|
128
|
+
...(params?.pageSize && { pageSize: params.pageSize }),
|
|
129
|
+
...(params?.currentPage && { currentPage: params.currentPage }),
|
|
130
|
+
...(params?.currentPage && { next: params.currentPage + 1 })
|
|
131
|
+
} as typeof DEFAULT_STATISTICS;
|
|
132
|
+
}
|
|
@@ -58,6 +58,20 @@ export function filterObjects(objects: IManagedObject[], query: string): IManage
|
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Filters objects based on the provided search text
|
|
63
|
+
*/
|
|
64
|
+
export function filterObjectBySearchText(objects: IManagedObject[], query: string) {
|
|
65
|
+
const regex = /"text":"(.*?)"/;
|
|
66
|
+
const match = query.match(regex);
|
|
67
|
+
|
|
68
|
+
if (match) {
|
|
69
|
+
const textValue = match[1];
|
|
70
|
+
return objects.filter(object => filterByName(object, textValue));
|
|
71
|
+
}
|
|
72
|
+
return objects;
|
|
73
|
+
}
|
|
74
|
+
|
|
61
75
|
/**
|
|
62
76
|
* Filters object by name
|
|
63
77
|
*/
|
package/src/app/app.module.ts
CHANGED
|
@@ -24,6 +24,7 @@ import { WidgetResolversModule } from '../widget-resolvers';
|
|
|
24
24
|
import { MockModule } from '../__mocks';
|
|
25
25
|
import { IntroductionModule } from '../provider-configuration';
|
|
26
26
|
import { TranslationsModule } from '../translations';
|
|
27
|
+
import { BreadcrumbsNodeModule } from '../breadcrumbs/breadcrumbs.module';
|
|
27
28
|
|
|
28
29
|
@NgModule({
|
|
29
30
|
declarations: [],
|
|
@@ -57,7 +58,8 @@ import { TranslationsModule } from '../translations';
|
|
|
57
58
|
widgets: [...cockpitDefaultWidgets, ...deviceManagementDefaultWidgets]
|
|
58
59
|
}),
|
|
59
60
|
RedirectToLastRouteModule,
|
|
60
|
-
MockModule
|
|
61
|
+
MockModule,
|
|
62
|
+
BreadcrumbsNodeModule
|
|
61
63
|
],
|
|
62
64
|
|
|
63
65
|
providers: [BsModalRef],
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<div class="container-fluid">
|
|
2
|
+
<div class="content-flex-50 separator-bottom p-t-16 p-b-16">
|
|
3
|
+
<p class="col-2 a-s-center text-medium">Default icon</p>
|
|
4
|
+
<div class="col-2 d-col a-i-center">
|
|
5
|
+
<!-- important -->
|
|
6
|
+
<c8y-app-icon
|
|
7
|
+
class="icon-36"
|
|
8
|
+
[app]="defaultApp1"
|
|
9
|
+
[contextPath]="defaultApp1.contextPath"
|
|
10
|
+
[name]="defaultApp1.name"
|
|
11
|
+
></c8y-app-icon>
|
|
12
|
+
<!-- /important -->
|
|
13
|
+
<p class="text-center">{{defaultApp1.name}}</p>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="col-2 d-col a-i-center">
|
|
16
|
+
<c8y-app-icon
|
|
17
|
+
class="icon-36"
|
|
18
|
+
[app]="defaultApp2"
|
|
19
|
+
[contextPath]="defaultApp2.contextPath"
|
|
20
|
+
[name]="defaultApp2.name"
|
|
21
|
+
></c8y-app-icon>
|
|
22
|
+
<p class="text-center">{{defaultApp2.name}}</p>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="col-2 d-col a-i-center">
|
|
25
|
+
<c8y-app-icon
|
|
26
|
+
class="icon-36"
|
|
27
|
+
[app]="defaultApp3"
|
|
28
|
+
[contextPath]="defaultApp3.contextPath"
|
|
29
|
+
[name]="defaultApp3.name"
|
|
30
|
+
></c8y-app-icon>
|
|
31
|
+
<p class="text-center">{{defaultApp3.name}}</p>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="col-2 d-col a-i-center">
|
|
34
|
+
<c8y-app-icon
|
|
35
|
+
class="icon-36"
|
|
36
|
+
[app]="defaultApp4"
|
|
37
|
+
[contextPath]="defaultApp4.contextPath"
|
|
38
|
+
[name]="defaultApp4.name"
|
|
39
|
+
></c8y-app-icon>
|
|
40
|
+
<p class="text-center">{{defaultApp4.name}}</p>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="col-2 d-col a-i-center">
|
|
43
|
+
<c8y-app-icon
|
|
44
|
+
class="icon-36"
|
|
45
|
+
[app]="defaultApp5"
|
|
46
|
+
[contextPath]="defaultApp5.contextPath"
|
|
47
|
+
[name]="defaultApp5.name"
|
|
48
|
+
></c8y-app-icon>
|
|
49
|
+
<p class="text-center">{{defaultApp5.name}}</p>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<div class="content-flex-50 separator-bottom p-t-16 p-b-16" >
|
|
54
|
+
<p class="col-2 a-s-center text-medium">Custom icon</p>
|
|
55
|
+
<div class="col-2 d-col a-i-center">
|
|
56
|
+
<!-- important -->
|
|
57
|
+
<c8y-app-icon
|
|
58
|
+
class="icon-36"
|
|
59
|
+
[app]="customApp1"
|
|
60
|
+
[contextPath]="customApp1.contextPath"
|
|
61
|
+
[name]="customApp1.name"
|
|
62
|
+
></c8y-app-icon>
|
|
63
|
+
<!-- /important -->
|
|
64
|
+
<p class="text-center">{{customApp1.name}}</p>
|
|
65
|
+
</div>
|
|
66
|
+
<div class="col-2 d-col a-i-center">
|
|
67
|
+
<c8y-app-icon
|
|
68
|
+
class="icon-36"
|
|
69
|
+
[app]="customApp2"
|
|
70
|
+
[contextPath]="customApp2.contextPath"
|
|
71
|
+
[name]="customApp2.name"
|
|
72
|
+
></c8y-app-icon>
|
|
73
|
+
<p class="text-center">{{customApp2.name}}</p>
|
|
74
|
+
</div>
|
|
75
|
+
<div class="col-2 d-col a-i-center">
|
|
76
|
+
<c8y-app-icon
|
|
77
|
+
class="icon-36"
|
|
78
|
+
[app]="customApp3"
|
|
79
|
+
[contextPath]="customApp3.contextPath"
|
|
80
|
+
[name]="customApp3.name"
|
|
81
|
+
></c8y-app-icon>
|
|
82
|
+
<p class="text-center">{{customApp3.name}}</p>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
<div class="content-flex-50 p-t-16 p-b-16" >
|
|
87
|
+
<p class="col-2 text-medium a-s-center">Fallback icon</p>
|
|
88
|
+
<div class="col-2 d-col a-i-center">
|
|
89
|
+
<!-- important -->
|
|
90
|
+
<c8y-app-icon
|
|
91
|
+
[app]="appExample1"
|
|
92
|
+
class="icon-36"
|
|
93
|
+
[contextPath]="appExample1.contextPath"
|
|
94
|
+
[name]="appExample1.name"
|
|
95
|
+
></c8y-app-icon>
|
|
96
|
+
<!-- /important -->
|
|
97
|
+
<p class="text-center">{{appExample1.name}}</p>
|
|
98
|
+
</div>
|
|
99
|
+
<div class="col-2 d-col a-i-center">
|
|
100
|
+
<c8y-app-icon
|
|
101
|
+
[app]="appExample2"
|
|
102
|
+
class="icon-36"
|
|
103
|
+
[contextPath]="appExample2.contextPath"
|
|
104
|
+
[name]="appExample2.name"
|
|
105
|
+
></c8y-app-icon>
|
|
106
|
+
<p class="text-center">{{appExample2.name}}</p>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { IApplication } from '@c8y/client';
|
|
3
|
+
import { CoreModule } from '@c8y/ngx-components';
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'tut-app-icon-example',
|
|
6
|
+
templateUrl: './app-icon-example.component.html',
|
|
7
|
+
standalone: true,
|
|
8
|
+
imports: [CoreModule]
|
|
9
|
+
})
|
|
10
|
+
export class AppIconExampleComponents {
|
|
11
|
+
appExample1: IApplication = {
|
|
12
|
+
name: 'Chat',
|
|
13
|
+
contextPath: 'chat'
|
|
14
|
+
};
|
|
15
|
+
appExample2: IApplication = {
|
|
16
|
+
name: 'Fleet Manager',
|
|
17
|
+
contextPath: 'fleetmanager'
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
customApp1: IApplication = {
|
|
21
|
+
name: 'Digital Twin Manager',
|
|
22
|
+
contextPath: 'dtm',
|
|
23
|
+
icon: { class: 'c8y-icon-enterprise' }
|
|
24
|
+
};
|
|
25
|
+
customApp2: IApplication = {
|
|
26
|
+
name: 'DataHub',
|
|
27
|
+
contextPath: 'datahub',
|
|
28
|
+
icon: { class: 'c8y-icon-data-hub ' }
|
|
29
|
+
};
|
|
30
|
+
customApp3: IApplication = {
|
|
31
|
+
name: 'OEE',
|
|
32
|
+
contextPath: 'oee',
|
|
33
|
+
icon: { class: 'c8y-icon-oee' }
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
defaultApp1: IApplication = {
|
|
37
|
+
name: 'Cockpit',
|
|
38
|
+
contextPath: 'cockpit'
|
|
39
|
+
};
|
|
40
|
+
defaultApp2: IApplication = {
|
|
41
|
+
name: 'Device Management',
|
|
42
|
+
contextPath: 'devicemanagement'
|
|
43
|
+
};
|
|
44
|
+
defaultApp3: IApplication = {
|
|
45
|
+
name: 'Administration',
|
|
46
|
+
contextPath: 'administration'
|
|
47
|
+
};
|
|
48
|
+
defaultApp4: IApplication = {
|
|
49
|
+
name: 'Analytics Builder',
|
|
50
|
+
contextPath: 'analyticsbuilder'
|
|
51
|
+
};
|
|
52
|
+
defaultApp5: IApplication = {
|
|
53
|
+
name: 'Apama EPL',
|
|
54
|
+
contextPath: 'apamaepl'
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
|
|
4
|
+
|
|
5
|
+
@NgModule({
|
|
6
|
+
imports: [CommonModule],
|
|
7
|
+
providers: [
|
|
8
|
+
hookRoute({
|
|
9
|
+
path: 'app-icon',
|
|
10
|
+
loadComponent: () =>
|
|
11
|
+
import('./app-icon-example.component').then(m => m.AppIconExampleComponents)
|
|
12
|
+
}),
|
|
13
|
+
hookNavigator(
|
|
14
|
+
new NavigatorNode({
|
|
15
|
+
path: 'app-icon',
|
|
16
|
+
icon: 'notification',
|
|
17
|
+
label: 'App icon'
|
|
18
|
+
})
|
|
19
|
+
)
|
|
20
|
+
]
|
|
21
|
+
})
|
|
22
|
+
export class AppIconExampleModule {}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<c8y-title>Breadcrumb</c8y-title>
|
|
2
|
+
|
|
3
|
+
<div class="card">
|
|
4
|
+
<!-- important -->
|
|
5
|
+
<c8y-breadcrumb>
|
|
6
|
+
<c8y-breadcrumb-item
|
|
7
|
+
[icon]="'cog'"
|
|
8
|
+
[label]="'Breadcrumb'"
|
|
9
|
+
></c8y-breadcrumb-item>
|
|
10
|
+
<c8y-breadcrumb-item
|
|
11
|
+
[label]="'Breadcrumb expand'"
|
|
12
|
+
[path]="'/breadcrumbs-expand'"
|
|
13
|
+
></c8y-breadcrumb-item>
|
|
14
|
+
</c8y-breadcrumb>
|
|
15
|
+
<!-- /important -->
|
|
16
|
+
|
|
17
|
+
<div class="card-block">
|
|
18
|
+
<c8y-breadcrumb-outlet
|
|
19
|
+
class="app-breadcrumbs"
|
|
20
|
+
[breadcrumbs]="breadcrumbService.items$ | async"
|
|
21
|
+
></c8y-breadcrumb-outlet>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { BreadcrumbService, CoreModule } from '@c8y/ngx-components';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'tut-breadcrumbs-example',
|
|
7
|
+
templateUrl: './breadcrumbs-example.component.html',
|
|
8
|
+
standalone: true,
|
|
9
|
+
imports: [CommonModule, CoreModule]
|
|
10
|
+
})
|
|
11
|
+
export class BreadcrumbsExampleComponents {
|
|
12
|
+
constructor(public breadcrumbService: BreadcrumbService) {}
|
|
13
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
|
|
4
|
+
|
|
5
|
+
@NgModule({
|
|
6
|
+
imports: [CommonModule],
|
|
7
|
+
providers: [
|
|
8
|
+
hookRoute({
|
|
9
|
+
path: 'breadcrumbs-basic',
|
|
10
|
+
loadComponent: () =>
|
|
11
|
+
import('./breadcrumbs-example.component').then(m => m.BreadcrumbsExampleComponents)
|
|
12
|
+
}),
|
|
13
|
+
hookNavigator(
|
|
14
|
+
new NavigatorNode({
|
|
15
|
+
path: 'breadcrumbs-basic',
|
|
16
|
+
icon: 'notification',
|
|
17
|
+
label: 'Breadcrumbs basic',
|
|
18
|
+
parent: 'Breadcrumbs'
|
|
19
|
+
})
|
|
20
|
+
)
|
|
21
|
+
]
|
|
22
|
+
})
|
|
23
|
+
export class BreadcrumbsExampleModule {}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { NavigatorNode, hookNavigator } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@NgModule({
|
|
5
|
+
providers: [
|
|
6
|
+
hookNavigator(
|
|
7
|
+
new NavigatorNode({
|
|
8
|
+
icon: 'notification',
|
|
9
|
+
label: 'Breadcrumbs'
|
|
10
|
+
})
|
|
11
|
+
)
|
|
12
|
+
]
|
|
13
|
+
})
|
|
14
|
+
export class BreadcrumbsNodeModule {}
|
package/src/breadcrumbs/content-projection/breadcrumbs-content-projection-example.component.html
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!-- The c8y-title component will display the given string (here: "Breadcrumb hook example") in the header as title -->
|
|
2
|
+
<c8y-title>Breadcrumb</c8y-title>
|
|
3
|
+
|
|
4
|
+
<div class="card">
|
|
5
|
+
<!-- important -->
|
|
6
|
+
|
|
7
|
+
<c8y-breadcrumb>
|
|
8
|
+
<c8y-breadcrumb-item
|
|
9
|
+
[icon]="'cog'"
|
|
10
|
+
[label]="'Settings'"
|
|
11
|
+
></c8y-breadcrumb-item>
|
|
12
|
+
<c8y-breadcrumb-item
|
|
13
|
+
[icon]="'cog'"
|
|
14
|
+
[label]="'Authentication'"
|
|
15
|
+
>
|
|
16
|
+
<span>Projected content</span>
|
|
17
|
+
<span></span>
|
|
18
|
+
</c8y-breadcrumb-item>
|
|
19
|
+
</c8y-breadcrumb>
|
|
20
|
+
<!-- /important -->
|
|
21
|
+
|
|
22
|
+
<div class="card-block">
|
|
23
|
+
<c8y-breadcrumb-outlet
|
|
24
|
+
class="app-breadcrumbs"
|
|
25
|
+
[breadcrumbs]="breadcrumbService.items$ | async"
|
|
26
|
+
></c8y-breadcrumb-outlet>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
package/src/breadcrumbs/content-projection/breadcrumbs-content-projection-example.component.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { BreadcrumbService, CoreModule } from '@c8y/ngx-components';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'tut-breadcrumbs-example',
|
|
7
|
+
templateUrl: './breadcrumbs-content-projection-example.component.html',
|
|
8
|
+
standalone: true,
|
|
9
|
+
imports: [CommonModule, CoreModule]
|
|
10
|
+
})
|
|
11
|
+
export class BreadcrumbsContentProjectionExampleComponents {
|
|
12
|
+
constructor(public breadcrumbService: BreadcrumbService) {}
|
|
13
|
+
}
|