@c8y/tutorial 1019.24.6 → 1020.0.4
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/NOTICES +8357 -6666
- package/cumulocity.config.ts +208 -200
- package/package.json +13 -10
- package/src/__mocks/mock.module.ts +21 -0
- package/src/__mocks/scoped-mocks/lists.ts +70 -0
- package/src/__mocks/utils/generators/alarms.ts +6 -14
- package/src/alert/alert-example.components.html +98 -96
- package/src/app/app.module.ts +5 -1
- package/src/asset-navigator/asset-navigator-example.module.ts +21 -0
- package/src/dashboard/widget-dashboard/widget-dashboard.component.ts +0 -1
- package/src/dashboard-tabs/dashboard-tabs.component.ts +95 -0
- package/src/dashboard-tabs/dashboard-tabs.module.ts +20 -0
- package/src/dashboard-tabs/index.ts +1 -0
- package/src/for-of-directive/for-of-example.component.html +83 -16
- package/src/for-of-directive/for-of-example.component.ts +17 -3
- package/src/grids/async-expandable-rows-grid-example/async-expandable-rows-example.component.ts +21 -0
- package/src/grids/async-expandable-rows-grid-example/async-expandable-rows-grid-example.component.html +28 -0
- package/src/grids/async-expandable-rows-grid-example/async-expandable-rows-grid-example.component.ts +91 -0
- package/src/grids/async-expandable-rows-grid-example/async-expandable-rows-grid-example.module.ts +26 -0
- package/src/grids/client-grid-example/client-grid-example.component.html +1 -0
- package/src/grids/device-grid-example/device-grid-example.component.html +1 -0
- package/src/grids/empty-grid-example/empty-grid-example.component.html +1 -0
- package/src/grids/expandable-rows-grid-example/expandable-rows-example.component.ts +12 -0
- package/src/grids/expandable-rows-grid-example/expandable-rows-grid-example.component.html +18 -0
- package/src/grids/expandable-rows-grid-example/expandable-rows-grid-example.component.ts +84 -0
- package/src/grids/expandable-rows-grid-example/expandable-rows-grid-example.module.ts +24 -0
- package/src/grids/server-grid-example/server-grid-example.component.html +1 -0
- package/src/grids/server-grid-example/server-grid-example.component.ts +2 -1
- package/src/grids/sync-expandable-rows-grid-example/sync-expandable-rows-example.component.ts +12 -0
- package/src/grids/sync-expandable-rows-grid-example/sync-expandable-rows-grid-example.component.html +18 -0
- package/src/grids/sync-expandable-rows-grid-example/sync-expandable-rows-grid-example.component.ts +84 -0
- package/src/grids/sync-expandable-rows-grid-example/sync-expandable-rows-grid-example.module.ts +26 -0
- package/src/hooks/navigator-route/navigator-route.module.ts +2 -2
- package/src/hooks/tabs/tab.ts +1 -1
- package/src/list/list/list-check/list-check.component.html +40 -28
- package/src/list/list/list-check/list-check.component.ts +45 -7
- package/src/list/list/list-timeline/list-timeline.component.html +1 -1
- package/src/list/list/list-timeline/list-timeline.component.ts +7 -3
- package/src/list/list-virtual-scroll/list-virtual-scroll-check/list-virtual-scroll-check.component.ts +7 -12
- package/src/list/list-virtual-scroll/list-virtual-scroll-timeline/list-virtual-scroll-timeline.component.ts +11 -26
- package/src/main.ts +6 -4
- package/src/polyfills.ts +1 -1
- package/src/popconfirm/pop-confirm-example.component.ts +8 -6
- package/src/selector/asset-selector-example/different-root/asset-selector-different-root.component.ts +2 -2
- package/src/selector/asset-selector-example/general-example/asset-selector-example.component.html +58 -68
- package/src/selector/asset-selector-example/multi-select/asset-selector-multi-select.component.ts +1 -1
- package/src/selector/asset-selector-example/single-search/asset-selector-single-search.component.ts +2 -2
- package/src/selector/asset-selector-example/tree-devices/asset-selector-tree-devices.component.ts +12 -16
- package/src/selector/asset-selector-example/tree-search/asset-selector-tree-search.component.ts +14 -18
- package/src/selector/asset-selector-example/tree-single/asset-selector-tree-single.component.ts +17 -21
- package/src/translations/new-translate/new-translation.component.html +3 -3
- package/src/widget/demo-widget-config.component.ts +7 -2
package/package.json
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@c8y/tutorial",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1020.0.4",
|
|
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/
|
|
7
|
-
"@c8y/
|
|
8
|
-
"@c8y/
|
|
9
|
-
"@c8y/
|
|
10
|
-
"@
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"leaflet": "1.7.1",
|
|
6
|
+
"@c8y/style": "1020.0.4",
|
|
7
|
+
"@c8y/ngx-components": "1020.0.4",
|
|
8
|
+
"@c8y/client": "1020.0.4",
|
|
9
|
+
"@c8y/bootstrap": "1020.0.4",
|
|
10
|
+
"@angular/cdk": "^17.3.9",
|
|
11
|
+
"ngx-bootstrap": "12.0.0",
|
|
12
|
+
"leaflet": "1.9.4",
|
|
14
13
|
"rxjs": "^7.4.0"
|
|
15
14
|
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@c8y/options": "1020.0.4",
|
|
17
|
+
"@c8y/devkit": "1020.0.4"
|
|
18
|
+
},
|
|
16
19
|
"peerDependencies": {
|
|
17
|
-
"@angular/common": ">=
|
|
20
|
+
"@angular/common": ">=16 <18"
|
|
18
21
|
},
|
|
19
22
|
"author": "Cumulocity GmbH"
|
|
20
23
|
}
|
|
@@ -17,6 +17,7 @@ import { ServerSideDataGridInterceptor } from './scoped-mocks/server-side-data-g
|
|
|
17
17
|
import { DeviceDataGridInterceptor } from './scoped-mocks/device-data-grid';
|
|
18
18
|
import { ServiceDashboardInterceptor } from './scoped-mocks/service-dashboard';
|
|
19
19
|
import { RealtimeSubjectServiceWithMocking } from './mock.realtime';
|
|
20
|
+
import { ListsInterceptor } from './scoped-mocks/lists';
|
|
20
21
|
// import { BoilerplateInterceptor } from './scoped-mocks/boilerplate';
|
|
21
22
|
@NgModule({
|
|
22
23
|
imports: [CoreModule, CommonModule],
|
|
@@ -42,6 +43,26 @@ import { RealtimeSubjectServiceWithMocking } from './mock.realtime';
|
|
|
42
43
|
} as ApiMockConfig,
|
|
43
44
|
multi: true
|
|
44
45
|
},
|
|
46
|
+
{
|
|
47
|
+
provide: API_MOCK_CONFIG,
|
|
48
|
+
useValue: {
|
|
49
|
+
id: 'list-group-interceptor',
|
|
50
|
+
path: 'lists',
|
|
51
|
+
mockService: ListsInterceptor,
|
|
52
|
+
debug: true
|
|
53
|
+
} as ApiMockConfig,
|
|
54
|
+
multi: true
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
provide: API_MOCK_CONFIG,
|
|
58
|
+
useValue: {
|
|
59
|
+
id: 'for-of-interceptor',
|
|
60
|
+
path: 'for-of',
|
|
61
|
+
mockService: ListsInterceptor,
|
|
62
|
+
debug: true
|
|
63
|
+
} as ApiMockConfig,
|
|
64
|
+
multi: true
|
|
65
|
+
},
|
|
45
66
|
{
|
|
46
67
|
provide: API_MOCK_CONFIG,
|
|
47
68
|
useValue: {
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { IFetchResponse } from '@c8y/client';
|
|
2
|
+
import { ApiCall, HttpHandler, HttpInterceptor } from '@c8y/ngx-components/api';
|
|
3
|
+
import { generateResponse, handleRequest } from '../utils/common';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
import { generateDevice } from '../utils/generators/managedObjects';
|
|
6
|
+
import { filterObjects } from '../utils/grid';
|
|
7
|
+
|
|
8
|
+
export class ListsInterceptor implements HttpInterceptor {
|
|
9
|
+
intercept(req: ApiCall, next: HttpHandler): Observable<IFetchResponse> {
|
|
10
|
+
return handleRequest(req, next, 'inventory/managedObjects', {
|
|
11
|
+
POST: this.mockPOST.bind(this),
|
|
12
|
+
PUT: this.mockPUT.bind(this),
|
|
13
|
+
GET: this.mockGET.bind(this)
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
mockPOST(_requestDescriptor: string) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
mockPUT(_requestDescriptor: string) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
private async mockGET(_requestDescriptor: string) {
|
|
26
|
+
// extra long timeout, to show the usage of c8yFor
|
|
27
|
+
await new Promise(r => setTimeout(r, 500));
|
|
28
|
+
|
|
29
|
+
const responseGenerators = this.getResponseGenerators();
|
|
30
|
+
|
|
31
|
+
for (const urlPart in responseGenerators) {
|
|
32
|
+
if (_requestDescriptor.includes(urlPart)) {
|
|
33
|
+
const pageSize = _requestDescriptor.match(/\"pageSize\"\:(\d+)/)
|
|
34
|
+
? parseInt(_requestDescriptor.match(/\"pageSize\"\:(\d+)/)[1])
|
|
35
|
+
: null;
|
|
36
|
+
|
|
37
|
+
const generatorResult = responseGenerators[urlPart](pageSize);
|
|
38
|
+
if (generatorResult) {
|
|
39
|
+
const filteredData = filterObjects(generatorResult.managedObjects, _requestDescriptor);
|
|
40
|
+
|
|
41
|
+
const currentPage = _requestDescriptor.match(/\"currentPage\"\:(\d+)/)
|
|
42
|
+
? parseInt(_requestDescriptor.match(/\"currentPage\"\:(\d+)/)[1])
|
|
43
|
+
: null;
|
|
44
|
+
|
|
45
|
+
return generateResponse(
|
|
46
|
+
() => ({
|
|
47
|
+
managedObjects: filteredData,
|
|
48
|
+
...(!!currentPage && currentPage !== 30 && { next: `currentPage=${currentPage + 1}` })
|
|
49
|
+
}),
|
|
50
|
+
{
|
|
51
|
+
totalPages: 30,
|
|
52
|
+
...(!!pageSize && { pageSize }),
|
|
53
|
+
...(!!currentPage && { currentPage }),
|
|
54
|
+
...(!!currentPage && currentPage !== 30 && { next: `currentPage=${currentPage + 1}` })
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private getResponseGenerators() {
|
|
64
|
+
return {
|
|
65
|
+
pageSize: pageSize => ({
|
|
66
|
+
managedObjects: [...[...Array(pageSize || 10)].map(() => generateDevice())]
|
|
67
|
+
})
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IAlarm, SeverityType } from '@c8y/client';
|
|
2
2
|
import { generateId, getFakeSource } from '../common';
|
|
3
|
+
import { AlarmStatusType } from '@c8y/client';
|
|
3
4
|
|
|
4
5
|
export function getFakeAlarm(): IAlarm {
|
|
5
|
-
const severities:
|
|
6
|
-
|
|
7
|
-
Severity.MAJOR,
|
|
8
|
-
Severity.MINOR,
|
|
9
|
-
Severity.WARNING
|
|
10
|
-
];
|
|
11
|
-
const statuses: AlarmStatus[] = [
|
|
12
|
-
AlarmStatus.ACKNOWLEDGED,
|
|
13
|
-
AlarmStatus.CLEARED,
|
|
14
|
-
AlarmStatus.ACTIVE
|
|
15
|
-
];
|
|
6
|
+
const severities: SeverityType[] = ['CRITICAL', 'MAJOR', 'MINOR', 'WARNING'];
|
|
7
|
+
const statuses: AlarmStatusType[] = ['ACKNOWLEDGED', 'CLEARED', 'ACTIVE'];
|
|
16
8
|
|
|
17
9
|
return {
|
|
18
|
-
severity: severities[Math.floor(Math.random() * severities.length)]
|
|
10
|
+
severity: severities[Math.floor(Math.random() * severities.length)],
|
|
19
11
|
source: getFakeSource(),
|
|
20
12
|
type: `Type_${Math.floor(Math.random() * 1000)}`,
|
|
21
13
|
time: new Date().toISOString(),
|
|
22
14
|
text: `Text_${Math.floor(Math.random() * 1000)}`,
|
|
23
15
|
id: generateId(),
|
|
24
|
-
status: statuses[Math.floor(Math.random() * statuses.length)]
|
|
16
|
+
status: statuses[Math.floor(Math.random() * statuses.length)],
|
|
25
17
|
count: Math.floor(Math.random() * 100),
|
|
26
18
|
name: `Name_${Math.floor(Math.random() * 1000)}`,
|
|
27
19
|
self: 'https://example.com/self/...}',
|
|
@@ -1,110 +1,112 @@
|
|
|
1
|
-
<
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<button
|
|
9
|
-
class="btn btn-default"
|
|
10
|
-
type="button"
|
|
11
|
-
(click)="successAlert()"
|
|
1
|
+
<div class="p-l-16 p-r-16">
|
|
2
|
+
<c8y-title>Alert</c8y-title>
|
|
3
|
+
<!-- important -->
|
|
4
|
+
<p class="text-medium m-b-8 m-t-24">Basic toast</p>
|
|
5
|
+
<div
|
|
6
|
+
class="d-flex gap-16"
|
|
7
|
+
role="group"
|
|
12
8
|
>
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
<button
|
|
10
|
+
class="btn btn-default"
|
|
11
|
+
type="button"
|
|
12
|
+
(click)="successAlert()"
|
|
13
|
+
>
|
|
14
|
+
Success
|
|
15
|
+
</button>
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
<button
|
|
18
|
+
class="btn btn-default"
|
|
19
|
+
type="button"
|
|
20
|
+
(click)="warningAlert()"
|
|
21
|
+
>
|
|
22
|
+
Warning
|
|
23
|
+
</button>
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
<button
|
|
26
|
+
class="btn btn-default"
|
|
27
|
+
type="button"
|
|
28
|
+
(click)="dangerAlert()"
|
|
29
|
+
>
|
|
30
|
+
Danger
|
|
31
|
+
</button>
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
<button
|
|
34
|
+
class="btn btn-default"
|
|
35
|
+
type="button"
|
|
36
|
+
(click)="infoAlert()"
|
|
37
|
+
>
|
|
38
|
+
Info
|
|
39
|
+
</button>
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
</div>
|
|
41
|
+
<button
|
|
42
|
+
class="btn btn-default"
|
|
43
|
+
type="button"
|
|
44
|
+
(click)="systemAlert()"
|
|
45
|
+
>
|
|
46
|
+
System
|
|
47
|
+
</button>
|
|
48
|
+
</div>
|
|
48
49
|
|
|
49
|
-
<p class="text-medium m-b-8 m-t-24">Advanced toasts</p>
|
|
50
|
-
<div
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
>
|
|
54
|
-
<button
|
|
55
|
-
class="btn btn-default"
|
|
56
|
-
type="button"
|
|
57
|
-
(click)="dangerWithDetails()"
|
|
50
|
+
<p class="text-medium m-b-8 m-t-24">Advanced toasts</p>
|
|
51
|
+
<div
|
|
52
|
+
class="btn-group gap-16 flex-wrap"
|
|
53
|
+
role="group"
|
|
58
54
|
>
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
<button
|
|
56
|
+
class="btn btn-default"
|
|
57
|
+
type="button"
|
|
58
|
+
(click)="dangerWithDetails()"
|
|
59
|
+
>
|
|
60
|
+
Error toast with details
|
|
61
|
+
</button>
|
|
61
62
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
<button
|
|
64
|
+
class="btn btn-default"
|
|
65
|
+
type="button"
|
|
66
|
+
(click)="dangerAlertByText()"
|
|
67
|
+
>
|
|
68
|
+
Warning toast by text
|
|
69
|
+
</button>
|
|
69
70
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
<button
|
|
72
|
+
class="btn btn-default"
|
|
73
|
+
type="button"
|
|
74
|
+
(click)="addAlertByAlertObject()"
|
|
75
|
+
>
|
|
76
|
+
System toast by Alert object
|
|
77
|
+
</button>
|
|
77
78
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
<button
|
|
80
|
+
class="btn btn-default"
|
|
81
|
+
type="button"
|
|
82
|
+
(click)="addAlertWithHtml()"
|
|
83
|
+
>
|
|
84
|
+
Success toast with html
|
|
85
|
+
</button>
|
|
85
86
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
<button
|
|
88
|
+
class="btn btn-default"
|
|
89
|
+
type="button"
|
|
90
|
+
(click)="alertWithTemplateRef()"
|
|
91
|
+
>
|
|
92
|
+
Info toast with template reference
|
|
93
|
+
</button>
|
|
93
94
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
</div>
|
|
95
|
+
<button
|
|
96
|
+
class="btn btn-default"
|
|
97
|
+
type="button"
|
|
98
|
+
(click)="addAlertWithCallbacks()"
|
|
99
|
+
>
|
|
100
|
+
Warning toast with callbacks
|
|
101
|
+
</button>
|
|
102
|
+
</div>
|
|
102
103
|
|
|
103
|
-
<ng-template #templateRef>
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
</ng-template>
|
|
104
|
+
<ng-template #templateRef>
|
|
105
|
+
<h4>This is a template ref</h4>
|
|
106
|
+
<p class="m-b-8 m-t-8">Add your own content to an alert, you can even include</p>
|
|
107
|
+
<button class="btn btn-default btn-sm">Buttons</button>
|
|
108
|
+
<p class="m-t-8">and other interactive elements.</p>
|
|
109
|
+
</ng-template>
|
|
109
110
|
|
|
110
|
-
<!-- /important -->
|
|
111
|
+
<!-- /important -->
|
|
112
|
+
</div>
|
package/src/app/app.module.ts
CHANGED
|
@@ -24,7 +24,9 @@ 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 { DashboardTabsModule } from '../dashboard-tabs';
|
|
27
28
|
import { BreadcrumbsNodeModule } from '../breadcrumbs/breadcrumbs.module';
|
|
29
|
+
import { AlarmsModule } from '@c8y/ngx-components/alarms';
|
|
28
30
|
|
|
29
31
|
@NgModule({
|
|
30
32
|
declarations: [],
|
|
@@ -59,7 +61,9 @@ import { BreadcrumbsNodeModule } from '../breadcrumbs/breadcrumbs.module';
|
|
|
59
61
|
}),
|
|
60
62
|
RedirectToLastRouteModule,
|
|
61
63
|
MockModule,
|
|
62
|
-
|
|
64
|
+
DashboardTabsModule,
|
|
65
|
+
BreadcrumbsNodeModule,
|
|
66
|
+
AlarmsModule.config({ hybrid: false })
|
|
63
67
|
],
|
|
64
68
|
|
|
65
69
|
providers: [BsModalRef],
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { AssetsNavigatorModule, AssetNavigatorConfig } from '@c8y/ngx-components/assets-navigator';
|
|
3
|
+
|
|
4
|
+
@NgModule({
|
|
5
|
+
imports: [
|
|
6
|
+
AssetsNavigatorModule.config({
|
|
7
|
+
// Provide your custom configuration options here
|
|
8
|
+
smartGroups: true,
|
|
9
|
+
openOnStart: true,
|
|
10
|
+
rootNodePriority: 3000,
|
|
11
|
+
disableDragAndDrop: false,
|
|
12
|
+
rootNavigatorNode: {
|
|
13
|
+
label: 'Custom Root Node'
|
|
14
|
+
// You can provide other NavigatorNode properties as needed
|
|
15
|
+
}
|
|
16
|
+
} as AssetNavigatorConfig)
|
|
17
|
+
],
|
|
18
|
+
declarations: [],
|
|
19
|
+
bootstrap: []
|
|
20
|
+
})
|
|
21
|
+
export class AppModule {}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { CoreModule, Tab, TabsService } from '@c8y/ngx-components';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'component1',
|
|
7
|
+
template: 'component1',
|
|
8
|
+
standalone: true
|
|
9
|
+
})
|
|
10
|
+
export class Component1 {
|
|
11
|
+
ngOnInit() {
|
|
12
|
+
console.log('Component 1 initialized');
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
@Component({
|
|
16
|
+
selector: 'component2',
|
|
17
|
+
template: 'component2',
|
|
18
|
+
standalone: true
|
|
19
|
+
})
|
|
20
|
+
export class Component2 {
|
|
21
|
+
ngOnInit() {
|
|
22
|
+
console.log('Component 2 initialized');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
@Component({
|
|
26
|
+
selector: 'component3',
|
|
27
|
+
template: 'component3',
|
|
28
|
+
standalone: true
|
|
29
|
+
})
|
|
30
|
+
export class Component3 {
|
|
31
|
+
ngOnInit() {
|
|
32
|
+
console.log('Component 3 initialized');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@Component({
|
|
37
|
+
selector: 'app-dashboard-tabs',
|
|
38
|
+
template: `<div>
|
|
39
|
+
<c8y-title>Dashboard Tabs</c8y-title>
|
|
40
|
+
<h1>Inline Tabs</h1>
|
|
41
|
+
<div>
|
|
42
|
+
<c8y-tabs-outlet
|
|
43
|
+
[tabs]="tabs$ | async"
|
|
44
|
+
[outletName]="'dashboardTabs'"
|
|
45
|
+
[orientation]="'vertical'"
|
|
46
|
+
>
|
|
47
|
+
</c8y-tabs-outlet>
|
|
48
|
+
<c8y-tab
|
|
49
|
+
[label]="'Tab1'"
|
|
50
|
+
[tabsOutlet]="'dashboardTabs'"
|
|
51
|
+
(onSelect)="selectTab('Tab1')"
|
|
52
|
+
[isActive]="selectedTab === 'Tab1'"
|
|
53
|
+
>
|
|
54
|
+
</c8y-tab>
|
|
55
|
+
<c8y-tab
|
|
56
|
+
[label]="'Tab2'"
|
|
57
|
+
[tabsOutlet]="'dashboardTabs'"
|
|
58
|
+
(onSelect)="selectTab('Tab2')"
|
|
59
|
+
[isActive]="selectedTab === 'Tab2'"
|
|
60
|
+
>
|
|
61
|
+
</c8y-tab>
|
|
62
|
+
<c8y-tab
|
|
63
|
+
[label]="'Tab3'"
|
|
64
|
+
[tabsOutlet]="'dashboardTabs'"
|
|
65
|
+
(onSelect)="selectTab('Tab3')"
|
|
66
|
+
[isActive]="selectedTab === 'Tab3'"
|
|
67
|
+
>
|
|
68
|
+
</c8y-tab>
|
|
69
|
+
|
|
70
|
+
<ng-container [ngSwitch]="selectedTab">
|
|
71
|
+
<component1 *ngSwitchCase="'Tab1'"></component1>
|
|
72
|
+
<component2 *ngSwitchCase="'Tab2'"></component2>
|
|
73
|
+
<component3 *ngSwitchCase="'Tab3'"></component3>
|
|
74
|
+
</ng-container>
|
|
75
|
+
</div>
|
|
76
|
+
</div>`,
|
|
77
|
+
standalone: true,
|
|
78
|
+
imports: [CoreModule, Component1, Component2, Component3]
|
|
79
|
+
})
|
|
80
|
+
export class DashboardTabsComponent {
|
|
81
|
+
tabs$: Observable<Tab[]>;
|
|
82
|
+
selectedTab: string;
|
|
83
|
+
|
|
84
|
+
constructor(private tabsService: TabsService) {}
|
|
85
|
+
|
|
86
|
+
ngOnInit() {
|
|
87
|
+
this.tabs$ = this.tabsService.items$;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
selectTab(selectedTab: string) {
|
|
91
|
+
this.selectedTab = selectedTab;
|
|
92
|
+
console.log(this.selectedTab);
|
|
93
|
+
this.tabsService.refresh();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { hookNavigator, hookRoute, NavigatorNode } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@NgModule({
|
|
5
|
+
providers: [
|
|
6
|
+
hookRoute({
|
|
7
|
+
path: 'dashboard-tabs/dashboardTabs',
|
|
8
|
+
loadComponent: () => import('./dashboard-tabs.component').then(m => m.DashboardTabsComponent)
|
|
9
|
+
}),
|
|
10
|
+
hookNavigator(
|
|
11
|
+
new NavigatorNode({
|
|
12
|
+
path: 'dashboard-tabs/dashboardTabs',
|
|
13
|
+
label: 'Dashboard Tabs',
|
|
14
|
+
icon: 'rocket',
|
|
15
|
+
priority: 1000
|
|
16
|
+
})
|
|
17
|
+
)
|
|
18
|
+
]
|
|
19
|
+
})
|
|
20
|
+
export class DashboardTabsModule {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dashboard-tabs.module';
|
|
@@ -1,19 +1,86 @@
|
|
|
1
1
|
<c8y-title>For of directive</c8y-title>
|
|
2
2
|
|
|
3
|
-
<div class="
|
|
4
|
-
<
|
|
5
|
-
class="form-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
3
|
+
<div class="row d-flex-sm">
|
|
4
|
+
<div class="col-sm-3 p-0">
|
|
5
|
+
<div class="d-col p-t-8 p-l-16 p-b-16 p-r-16 form-group-sm bg-level-1">
|
|
6
|
+
<p class="text-medium p-b-16">Config options</p>
|
|
7
|
+
|
|
8
|
+
<div class="form-group">
|
|
9
|
+
<label for="filterInput">Filter pipe</label>
|
|
10
|
+
<input
|
|
11
|
+
class="form-control"
|
|
12
|
+
id="filterInput"
|
|
13
|
+
placeholder="Enter a known device…"
|
|
14
|
+
type="text"
|
|
15
|
+
[(ngModel)]="config.filter"
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<div class="form-group">
|
|
20
|
+
<label for="pageSizeInput">Page size</label>
|
|
21
|
+
<input
|
|
22
|
+
class="form-control"
|
|
23
|
+
id="pageSizeInput"
|
|
24
|
+
type="number"
|
|
25
|
+
[(ngModel)]="config.pageSize"
|
|
26
|
+
min="1"
|
|
27
|
+
max="2000"
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div class="form-group">
|
|
32
|
+
<label for="maxIterations">Max iterations</label>
|
|
33
|
+
<input
|
|
34
|
+
class="form-control"
|
|
35
|
+
id="maxIterations"
|
|
36
|
+
type="number"
|
|
37
|
+
[(ngModel)]="config.maxIterations"
|
|
38
|
+
min="1"
|
|
39
|
+
/>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div class="form-group">
|
|
43
|
+
<label>Load more option:</label>
|
|
44
|
+
<div class="c8y-select-wrapper">
|
|
45
|
+
<select
|
|
46
|
+
class="form-control"
|
|
47
|
+
type="text"
|
|
48
|
+
[(ngModel)]="config.loadMore"
|
|
49
|
+
>
|
|
50
|
+
<option value="auto">auto - automatically load more items</option>
|
|
51
|
+
<option value="show">show - show a button to load more items.</option>
|
|
52
|
+
<option value="hidden">none - hidden and not loading more items</option>
|
|
53
|
+
<option value="hidden">hidden - hidden but loading more items</option>
|
|
54
|
+
</select>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<button
|
|
59
|
+
class="btn btn-primary"
|
|
60
|
+
(click)="reload()"
|
|
61
|
+
>
|
|
62
|
+
Apply
|
|
63
|
+
</button>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
<div class="col-sm-9">
|
|
67
|
+
<p class="text-medium p-t-8">Preview</p>
|
|
68
|
+
<div class="card m-t-16">
|
|
69
|
+
<div class="card-block d-flex d-col p-0">
|
|
70
|
+
<!-- important -->
|
|
71
|
+
<div
|
|
72
|
+
*c8yFor="
|
|
73
|
+
let device of devices;
|
|
74
|
+
let i = index;
|
|
75
|
+
loadMore: config.loadMore;
|
|
76
|
+
pipe: filterPipe;
|
|
77
|
+
maxIterations: config.maxIterations;
|
|
78
|
+
"
|
|
79
|
+
>
|
|
80
|
+
{{ i + 1 }}. {{ device.name }}
|
|
81
|
+
</div>
|
|
82
|
+
<!-- /important -->
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
18
86
|
</div>
|
|
19
|
-
<!-- /important -->
|