@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
|
@@ -0,0 +1,25 @@
|
|
|
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-content-projection',
|
|
10
|
+
loadComponent: () =>
|
|
11
|
+
import('./breadcrumbs-content-projection-example.component').then(
|
|
12
|
+
m => m.BreadcrumbsContentProjectionExampleComponents
|
|
13
|
+
)
|
|
14
|
+
}),
|
|
15
|
+
hookNavigator(
|
|
16
|
+
new NavigatorNode({
|
|
17
|
+
path: 'breadcrumbs-content-projection',
|
|
18
|
+
icon: 'notification',
|
|
19
|
+
label: 'Breadcrumbs content projection',
|
|
20
|
+
parent: 'Breadcrumbs'
|
|
21
|
+
})
|
|
22
|
+
)
|
|
23
|
+
]
|
|
24
|
+
})
|
|
25
|
+
export class BreadcrumbsContentProjectionExampleModule {}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<c8y-title>Breadcrumb</c8y-title>
|
|
2
|
+
|
|
3
|
+
<div class="card">
|
|
4
|
+
<!-- important -->
|
|
5
|
+
|
|
6
|
+
<c8y-breadcrumb>
|
|
7
|
+
<c8y-breadcrumb-item
|
|
8
|
+
[icon]="'cog'"
|
|
9
|
+
[label]="'Group A'"
|
|
10
|
+
></c8y-breadcrumb-item>
|
|
11
|
+
</c8y-breadcrumb>
|
|
12
|
+
|
|
13
|
+
<c8y-breadcrumb>
|
|
14
|
+
<c8y-breadcrumb-item
|
|
15
|
+
[icon]="'cog'"
|
|
16
|
+
[label]="'Group B'"
|
|
17
|
+
></c8y-breadcrumb-item>
|
|
18
|
+
</c8y-breadcrumb>
|
|
19
|
+
<!-- /important -->
|
|
20
|
+
|
|
21
|
+
<div
|
|
22
|
+
class="card-block"
|
|
23
|
+
style="height: 70px"
|
|
24
|
+
>
|
|
25
|
+
<c8y-breadcrumb-outlet
|
|
26
|
+
class="app-breadcrumbs"
|
|
27
|
+
[breadcrumbs]="breadcrumbService.items$ | async"
|
|
28
|
+
></c8y-breadcrumb-outlet>
|
|
29
|
+
</div>
|
|
30
|
+
</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-expand-example',
|
|
7
|
+
templateUrl: './breadcrumbs-expand-example.component.html',
|
|
8
|
+
standalone: true,
|
|
9
|
+
imports: [CommonModule, CoreModule]
|
|
10
|
+
})
|
|
11
|
+
export class BreadcrumbsExpandExampleComponents {
|
|
12
|
+
constructor(public breadcrumbService: BreadcrumbService) {}
|
|
13
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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-expand',
|
|
10
|
+
loadComponent: () =>
|
|
11
|
+
import('./breadcrumbs-expand-example.component').then(
|
|
12
|
+
m => m.BreadcrumbsExpandExampleComponents
|
|
13
|
+
)
|
|
14
|
+
}),
|
|
15
|
+
hookNavigator(
|
|
16
|
+
new NavigatorNode({
|
|
17
|
+
path: 'breadcrumbs-expand',
|
|
18
|
+
icon: 'notification',
|
|
19
|
+
label: 'Breadcrumbs expand',
|
|
20
|
+
parent: 'Breadcrumbs'
|
|
21
|
+
})
|
|
22
|
+
)
|
|
23
|
+
]
|
|
24
|
+
})
|
|
25
|
+
export class BreadcrumbsExpandExampleModule {}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './basic-example/breadcrumbs-example.module';
|
|
2
|
+
export * from './expand-example/breadcrumbs-expand-example.module';
|
|
3
|
+
export * from './outlet/breadcrumbs-outlet-example.module';
|
|
4
|
+
export * from './content-projection/breadcrumbs-content-projection-example.module';
|
|
5
|
+
export * from './breadcrumbs.module';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<c8y-title>Breadcrumb outlet</c8y-title>
|
|
2
|
+
|
|
3
|
+
<div class="card">
|
|
4
|
+
<c8y-breadcrumb>
|
|
5
|
+
<c8y-breadcrumb-item
|
|
6
|
+
[icon]="'cog'"
|
|
7
|
+
[label]="'Group A'"
|
|
8
|
+
></c8y-breadcrumb-item>
|
|
9
|
+
</c8y-breadcrumb>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
<div class="card-block">
|
|
13
|
+
<!-- important -->
|
|
14
|
+
|
|
15
|
+
<c8y-breadcrumb-outlet
|
|
16
|
+
class="app-breadcrumbs"
|
|
17
|
+
[breadcrumbs]="breadcrumbService.items$ | async"
|
|
18
|
+
></c8y-breadcrumb-outlet>
|
|
19
|
+
<!-- /important -->
|
|
20
|
+
</div>
|
|
21
|
+
</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-outlet-example',
|
|
7
|
+
templateUrl: './breadcrumbs-outlet-example.component.html',
|
|
8
|
+
standalone: true,
|
|
9
|
+
imports: [CommonModule, CoreModule]
|
|
10
|
+
})
|
|
11
|
+
export class BreadcrumbsOutletExampleComponent {
|
|
12
|
+
constructor(public breadcrumbService: BreadcrumbService) {}
|
|
13
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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-outlet',
|
|
10
|
+
loadComponent: () =>
|
|
11
|
+
import('./breadcrumbs-outlet-example.component').then(
|
|
12
|
+
m => m.BreadcrumbsOutletExampleComponent
|
|
13
|
+
)
|
|
14
|
+
}),
|
|
15
|
+
hookNavigator(
|
|
16
|
+
new NavigatorNode({
|
|
17
|
+
path: 'breadcrumbs-outlet',
|
|
18
|
+
icon: 'notification',
|
|
19
|
+
label: 'Breadcrumbs outlet',
|
|
20
|
+
parent: 'Breadcrumbs'
|
|
21
|
+
})
|
|
22
|
+
)
|
|
23
|
+
]
|
|
24
|
+
})
|
|
25
|
+
export class BreadcrumbsOutletExampleModule {}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
<c8y-title>Device connection status</c8y-title>
|
|
2
|
+
<div class="container-fluid p-t-16">
|
|
3
|
+
<c8y-list-group class="no-border-last">
|
|
4
|
+
<c8y-li>
|
|
5
|
+
<div class="content-flex-50">
|
|
6
|
+
<div class="col-4 text-medium">Connection status</div>
|
|
7
|
+
<div class="col-3 text-medium">
|
|
8
|
+
Size
|
|
9
|
+
<code>20</code>
|
|
10
|
+
<small class="text-muted"><em>(default)</em></small>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="col-3 text-medium">
|
|
13
|
+
Size
|
|
14
|
+
<code>32</code>
|
|
15
|
+
</div>
|
|
16
|
+
<div class="col-2 text-medium">
|
|
17
|
+
Size
|
|
18
|
+
<code>64</code>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</c8y-li>
|
|
22
|
+
<c8y-li>
|
|
23
|
+
<div class="content-flex-50">
|
|
24
|
+
<div class="col-4">
|
|
25
|
+
<span>Send connection: available</span>
|
|
26
|
+
<br />
|
|
27
|
+
<span>Push connection: active</span>
|
|
28
|
+
</div>
|
|
29
|
+
<div class="col-3 a-s-center">
|
|
30
|
+
<!-- important -->
|
|
31
|
+
<c8y-device-status [mo]="connectedAndAvailableDeviceExample"></c8y-device-status>
|
|
32
|
+
<!-- /important -->
|
|
33
|
+
</div>
|
|
34
|
+
<div class="col-3">
|
|
35
|
+
<!-- important -->
|
|
36
|
+
<c8y-device-status
|
|
37
|
+
[size]="32"
|
|
38
|
+
[mo]="connectedAndAvailableDeviceExample"
|
|
39
|
+
></c8y-device-status>
|
|
40
|
+
<!-- /important -->
|
|
41
|
+
</div>
|
|
42
|
+
<div class="col-2">
|
|
43
|
+
<!-- important -->
|
|
44
|
+
<c8y-device-status
|
|
45
|
+
[size]="64"
|
|
46
|
+
[mo]="connectedAndAvailableDeviceExample"
|
|
47
|
+
></c8y-device-status>
|
|
48
|
+
<!-- /important -->
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</c8y-li>
|
|
52
|
+
<c8y-li>
|
|
53
|
+
<div class="content-flex-50">
|
|
54
|
+
<div class="col-4">
|
|
55
|
+
<span>Send connection: available</span>
|
|
56
|
+
<br />
|
|
57
|
+
<span>Push connection: inactive</span>
|
|
58
|
+
</div>
|
|
59
|
+
<div class="col-3 a-s-center">
|
|
60
|
+
<c8y-device-status [mo]="disconnectedAndAvailableExample"></c8y-device-status>
|
|
61
|
+
</div>
|
|
62
|
+
<div class="col-3">
|
|
63
|
+
<c8y-device-status
|
|
64
|
+
[size]="32"
|
|
65
|
+
[mo]="disconnectedAndAvailableExample"
|
|
66
|
+
></c8y-device-status>
|
|
67
|
+
</div>
|
|
68
|
+
<div class="col-2">
|
|
69
|
+
<c8y-device-status
|
|
70
|
+
[size]="64"
|
|
71
|
+
[mo]="disconnectedAndAvailableExample"
|
|
72
|
+
></c8y-device-status>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
</c8y-li>
|
|
76
|
+
<c8y-li>
|
|
77
|
+
<div class="content-flex-50">
|
|
78
|
+
<div class="col-4">
|
|
79
|
+
<span>Send connection: unavailable</span>
|
|
80
|
+
<br />
|
|
81
|
+
<span>Push connection: inactive</span>
|
|
82
|
+
</div>
|
|
83
|
+
<div class="col-3 a-s-center">
|
|
84
|
+
<c8y-device-status [mo]="disconnectedAndUnavailableDeviceExample"></c8y-device-status>
|
|
85
|
+
</div>
|
|
86
|
+
<div class="col-3">
|
|
87
|
+
<c8y-device-status
|
|
88
|
+
[size]="32"
|
|
89
|
+
[mo]="disconnectedAndUnavailableDeviceExample"
|
|
90
|
+
></c8y-device-status>
|
|
91
|
+
</div>
|
|
92
|
+
<div class="col-2">
|
|
93
|
+
<c8y-device-status
|
|
94
|
+
[size]="64"
|
|
95
|
+
[mo]="disconnectedAndUnavailableDeviceExample"
|
|
96
|
+
></c8y-device-status>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
</c8y-li>
|
|
100
|
+
<c8y-li>
|
|
101
|
+
<div class="content-flex-50">
|
|
102
|
+
<div class="col-4">
|
|
103
|
+
<span>Send connection: not monitored</span>
|
|
104
|
+
<br />
|
|
105
|
+
<span>Push connection: inactive</span>
|
|
106
|
+
</div>
|
|
107
|
+
<div class="col-3 a-s-center">
|
|
108
|
+
<c8y-device-status [mo]="notMonitoredDeviceExample"></c8y-device-status>
|
|
109
|
+
</div>
|
|
110
|
+
<div class="col-3">
|
|
111
|
+
<c8y-device-status
|
|
112
|
+
[size]="32"
|
|
113
|
+
[mo]="notMonitoredDeviceExample"
|
|
114
|
+
></c8y-device-status>
|
|
115
|
+
</div>
|
|
116
|
+
<div class="col-2">
|
|
117
|
+
<c8y-device-status
|
|
118
|
+
[size]="64"
|
|
119
|
+
[mo]="notMonitoredDeviceExample"
|
|
120
|
+
></c8y-device-status>
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</c8y-li>
|
|
124
|
+
<c8y-li>
|
|
125
|
+
<div class="content-flex-50">
|
|
126
|
+
<div class="col-4">Maintenance</div>
|
|
127
|
+
<div class="col-3 a-s-center">
|
|
128
|
+
<c8y-device-status [mo]="inMaintenanceDeviceExample"></c8y-device-status>
|
|
129
|
+
</div>
|
|
130
|
+
<div class="col-3">
|
|
131
|
+
<c8y-device-status
|
|
132
|
+
[size]="32"
|
|
133
|
+
[mo]="inMaintenanceDeviceExample"
|
|
134
|
+
></c8y-device-status>
|
|
135
|
+
</div>
|
|
136
|
+
<div class="col-2">
|
|
137
|
+
<c8y-device-status
|
|
138
|
+
[size]="64"
|
|
139
|
+
[mo]="inMaintenanceDeviceExample"
|
|
140
|
+
></c8y-device-status>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
</c8y-li>
|
|
144
|
+
</c8y-list-group>
|
|
145
|
+
</div>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { CoreModule, DeviceStatusModule } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'tut-device-connection-status-example',
|
|
6
|
+
templateUrl: `./device-connection-status-example.component.html`,
|
|
7
|
+
standalone: true,
|
|
8
|
+
imports: [CoreModule, DeviceStatusModule]
|
|
9
|
+
})
|
|
10
|
+
export class DeviceConnectionStatusExampleComponent {
|
|
11
|
+
private readonly CONNECTED_AND_AVAILABLE_DEVICE_EXAMPLE = {
|
|
12
|
+
c8y_RequiredAvailability: {},
|
|
13
|
+
c8y_Availability: {
|
|
14
|
+
lastMessage: '2024-01-01T00:00:00.000Z',
|
|
15
|
+
status: 'AVAILABLE'
|
|
16
|
+
},
|
|
17
|
+
c8y_Connection: {
|
|
18
|
+
status: 'CONNECTED'
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
private readonly DISCONNECTED_AND_AVAILABLE_DEVICE_EXAMPLE = {
|
|
23
|
+
c8y_RequiredAvailability: {},
|
|
24
|
+
c8y_Availability: {
|
|
25
|
+
lastMessage: '2024-01-01T00:00:00.000Z',
|
|
26
|
+
status: 'AVAILABLE'
|
|
27
|
+
},
|
|
28
|
+
c8y_Connection: {
|
|
29
|
+
status: 'DISCONNECTED'
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
private readonly DISCONNECTED_AND_UNAVAILABLE_DEVICE_EXAMPLE = {
|
|
34
|
+
c8y_RequiredAvailability: {},
|
|
35
|
+
c8y_Availability: {
|
|
36
|
+
lastMessage: '2024-01-01T00:00:00.000Z',
|
|
37
|
+
status: 'UNAVAILABLE'
|
|
38
|
+
},
|
|
39
|
+
c8y_Connection: {
|
|
40
|
+
status: 'DISCONNECTED'
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
private readonly NOT_MONITORED_DEVICE_EXAMPLE = {
|
|
45
|
+
c8y_RequiredAvailability: {}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
private readonly IN_MAINTENANCE_DEVICE_EXAMPLE = {
|
|
49
|
+
c8y_RequiredAvailability: {},
|
|
50
|
+
c8y_Availability: {
|
|
51
|
+
status: 'MAINTENANCE'
|
|
52
|
+
},
|
|
53
|
+
c8y_Connection: {}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
connectedAndAvailableDeviceExample = this.CONNECTED_AND_AVAILABLE_DEVICE_EXAMPLE;
|
|
57
|
+
disconnectedAndAvailableExample = this.DISCONNECTED_AND_AVAILABLE_DEVICE_EXAMPLE;
|
|
58
|
+
disconnectedAndUnavailableDeviceExample = this.DISCONNECTED_AND_UNAVAILABLE_DEVICE_EXAMPLE;
|
|
59
|
+
notMonitoredDeviceExample = this.NOT_MONITORED_DEVICE_EXAMPLE;
|
|
60
|
+
inMaintenanceDeviceExample = this.IN_MAINTENANCE_DEVICE_EXAMPLE;
|
|
61
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { NavigatorNode, hookNavigator, hookRoute } from '@c8y/ngx-components';
|
|
3
|
+
|
|
4
|
+
@NgModule({
|
|
5
|
+
providers: [
|
|
6
|
+
hookRoute({
|
|
7
|
+
path: 'device-connection-status',
|
|
8
|
+
loadComponent: () =>
|
|
9
|
+
import('./device-connection-status-example.component').then(
|
|
10
|
+
m => m.DeviceConnectionStatusExampleComponent
|
|
11
|
+
)
|
|
12
|
+
}),
|
|
13
|
+
hookNavigator(
|
|
14
|
+
new NavigatorNode({
|
|
15
|
+
path: '/device-connection-status',
|
|
16
|
+
label: 'Device connection status',
|
|
17
|
+
icon: 'realtime',
|
|
18
|
+
priority: 15
|
|
19
|
+
})
|
|
20
|
+
)
|
|
21
|
+
]
|
|
22
|
+
})
|
|
23
|
+
export class DeviceConnectionStatusExampleModule {}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Component } from '@angular/core';
|
|
2
|
+
// eslint-disable-next-line
|
|
2
3
|
import { CoreModule, LoginService } from '@c8y/ngx-components';
|
|
3
4
|
|
|
4
5
|
@Component({
|
|
@@ -10,9 +11,12 @@ import { CoreModule, LoginService } from '@c8y/ngx-components';
|
|
|
10
11
|
imports: [CoreModule]
|
|
11
12
|
})
|
|
12
13
|
export class LogoutActionComponent {
|
|
13
|
-
|
|
14
|
+
// Uncomment to see the effect.
|
|
15
|
+
// constructor(private loginService: LoginService) {}
|
|
14
16
|
|
|
15
17
|
logout() {
|
|
16
|
-
|
|
18
|
+
console.log('Logout action triggered!');
|
|
19
|
+
// Uncomment to see the effect.
|
|
20
|
+
// this.loginService.logout();
|
|
17
21
|
}
|
|
18
22
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component } from '@angular/core';
|
|
2
|
-
import { CoreModule } from '@c8y/ngx-components';
|
|
2
|
+
import { BreadcrumbService, CoreModule } from '@c8y/ngx-components';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* This is a standard angular component.
|
|
@@ -15,4 +15,6 @@ export class BasicViewComponent {
|
|
|
15
15
|
/**
|
|
16
16
|
* Your content of the Basic View goes in here!
|
|
17
17
|
*/
|
|
18
|
+
|
|
19
|
+
constructor(public breadcrumbService: BreadcrumbService) {}
|
|
18
20
|
}
|
|
@@ -1,69 +1,58 @@
|
|
|
1
|
-
import { Component
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
2
|
import {
|
|
3
|
-
ConfirmModalComponent,
|
|
4
3
|
CoreModule,
|
|
5
4
|
FormsModule,
|
|
6
|
-
|
|
5
|
+
gettext,
|
|
7
6
|
ModalModule,
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
ModalService,
|
|
8
|
+
Status
|
|
10
9
|
} from '@c8y/ngx-components';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { BsModalService } from 'ngx-bootstrap/modal';
|
|
11
|
+
import { DeleteModalExampleComponent } from './delete-modal-example.component';
|
|
13
12
|
|
|
14
13
|
@Component({
|
|
15
|
-
selector: 'confirm-modal',
|
|
16
|
-
template: `<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<span></span>
|
|
30
|
-
<span class="text-break-word">
|
|
31
|
-
{{ 'Also delete all devices inside asset and its subassets' }}
|
|
32
|
-
</span>
|
|
33
|
-
</label>
|
|
34
|
-
</c8y-form-group>
|
|
35
|
-
</form>
|
|
36
|
-
</c8y-confirm-modal>`,
|
|
14
|
+
selector: 'tut-confirm-modal',
|
|
15
|
+
template: `<div class="p-t-24">
|
|
16
|
+
<c8y-title>Confirm modal example</c8y-title>
|
|
17
|
+
<div class="p-b-24 text-center">
|
|
18
|
+
<button class="btn btn-default" (click)="deleteConfigurationSnapshot()">
|
|
19
|
+
Confirm modal using <code>ModalService.confirm</code>
|
|
20
|
+
</button>
|
|
21
|
+
</div>
|
|
22
|
+
<div class="p-b-24 text-center">
|
|
23
|
+
<button class="btn btn-default" (click)="deleteDevice()">
|
|
24
|
+
Confirm modal using <code>c8y-confirm-modal</code> component
|
|
25
|
+
</button>
|
|
26
|
+
</div>
|
|
27
|
+
</div>`,
|
|
37
28
|
standalone: true,
|
|
38
|
-
imports: [ModalModule, FormsModule, CoreModule]
|
|
29
|
+
imports: [ModalModule, FormsModule, CoreModule, DeleteModalExampleComponent]
|
|
39
30
|
})
|
|
40
31
|
export class ConfirmModalExampleComponent {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
config: DeleteModalCheckboxes = {
|
|
46
|
-
cascade: false
|
|
47
|
-
};
|
|
32
|
+
constructor(
|
|
33
|
+
private bsModalService: BsModalService,
|
|
34
|
+
private modalService: ModalService
|
|
35
|
+
) {}
|
|
48
36
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
await this.modalRef.result;
|
|
52
|
-
this.onClose();
|
|
53
|
-
} catch (error) {
|
|
54
|
-
this.onDismiss();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
onClose() {
|
|
59
|
-
console.log('You have clicked "Delete" button the modal!');
|
|
60
|
-
this.closeSubject.next(this.config);
|
|
61
|
-
console.log('cascade is true -> you checked the checkbox', this.config);
|
|
62
|
-
this.closeSubject.complete();
|
|
37
|
+
deleteDevice() {
|
|
38
|
+
this.bsModalService.show(DeleteModalExampleComponent);
|
|
63
39
|
}
|
|
64
40
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
41
|
+
async deleteConfigurationSnapshot() {
|
|
42
|
+
try {
|
|
43
|
+
await this.modalService.confirm(
|
|
44
|
+
'Delete configuration snapshot',
|
|
45
|
+
'You are about to delete the configuration snapshot DeviceA.',
|
|
46
|
+
Status.DANGER,
|
|
47
|
+
{
|
|
48
|
+
ok: gettext('Delete')
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
// eslint-disable-next-line no-console
|
|
52
|
+
console.log('Delete clicked');
|
|
53
|
+
} catch (e) {
|
|
54
|
+
// eslint-disable-next-line no-console
|
|
55
|
+
console.log('Cancel clicked');
|
|
56
|
+
}
|
|
68
57
|
}
|
|
69
58
|
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { AfterViewInit, Component, EventEmitter, Output, ViewChild } from '@angular/core';
|
|
2
|
+
import {
|
|
3
|
+
ConfirmModalComponent,
|
|
4
|
+
CoreModule,
|
|
5
|
+
FormsModule,
|
|
6
|
+
ModalLabels,
|
|
7
|
+
ModalModule,
|
|
8
|
+
Status,
|
|
9
|
+
StatusType
|
|
10
|
+
} from '@c8y/ngx-components';
|
|
11
|
+
import { DeleteModalCheckboxes } from '@c8y/ngx-components/sub-assets';
|
|
12
|
+
import { Subject } from 'rxjs';
|
|
13
|
+
|
|
14
|
+
@Component({
|
|
15
|
+
selector: 'tut-delete-modal',
|
|
16
|
+
template: ` <c8y-confirm-modal
|
|
17
|
+
[title]="'Delete device'"
|
|
18
|
+
[status]="status"
|
|
19
|
+
[labels]="labels"
|
|
20
|
+
#modalRef
|
|
21
|
+
>
|
|
22
|
+
<form>
|
|
23
|
+
<p class="text-wrap m-b-16">
|
|
24
|
+
{{ 'You are about to delete device. Do you want to proceed?' }}
|
|
25
|
+
</p>
|
|
26
|
+
<c8y-form-group class="m-b-0">
|
|
27
|
+
<label class="c8y-checkbox" title="{{ 'Delete devices' }}">
|
|
28
|
+
<input name="cascade" type="checkbox" [(ngModel)]="config.cascade" />
|
|
29
|
+
<span></span>
|
|
30
|
+
<span class="text-break-word">
|
|
31
|
+
{{ 'Also delete all devices inside asset and its subassets' }}
|
|
32
|
+
</span>
|
|
33
|
+
</label>
|
|
34
|
+
</c8y-form-group>
|
|
35
|
+
</form>
|
|
36
|
+
</c8y-confirm-modal>`,
|
|
37
|
+
standalone: true,
|
|
38
|
+
imports: [ModalModule, FormsModule, CoreModule]
|
|
39
|
+
})
|
|
40
|
+
export class DeleteModalExampleComponent implements AfterViewInit {
|
|
41
|
+
@ViewChild('modalRef', { static: false }) modalRef: ConfirmModalComponent;
|
|
42
|
+
labels: ModalLabels = { ok: 'Delete', cancel: 'Cancel' };
|
|
43
|
+
status: StatusType = Status.DANGER;
|
|
44
|
+
closeSubject: Subject<DeleteModalCheckboxes> = new Subject();
|
|
45
|
+
config: DeleteModalCheckboxes = {
|
|
46
|
+
cascade: false
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
@Output() hideModal = new EventEmitter();
|
|
50
|
+
|
|
51
|
+
async ngAfterViewInit() {
|
|
52
|
+
try {
|
|
53
|
+
await this.modalRef.result;
|
|
54
|
+
this.onClose();
|
|
55
|
+
} catch (error) {
|
|
56
|
+
this.onDismiss();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
onClose() {
|
|
61
|
+
// eslint-disable-next-line no-console
|
|
62
|
+
console.log('You have clicked the "Delete" button!');
|
|
63
|
+
// eslint-disable-next-line no-console
|
|
64
|
+
console.log('Config value:', this.config);
|
|
65
|
+
this.hideModal.emit();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
onDismiss() {
|
|
69
|
+
// eslint-disable-next-line no-console
|
|
70
|
+
console.log('You have clicked "Cancel" button the modal!');
|
|
71
|
+
this.hideModal.emit();
|
|
72
|
+
}
|
|
73
|
+
}
|