@c8y/tutorial 1021.80.1 → 1022.3.2
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 +23 -1
- package/package.json +13 -12
- package/src/__mocks/index.ts +168 -1
- package/src/app/app.config.ts +59 -0
- package/src/bootstrap.ts +13 -9
- package/src/bottom-drawer/bottom-drawer-content-example.component.html +28 -0
- package/src/bottom-drawer/bottom-drawer-content-example.component.ts +33 -0
- package/src/bottom-drawer/bottom-drawer-example.component.html +7 -0
- package/src/bottom-drawer/bottom-drawer-example.component.ts +33 -0
- package/src/bottom-drawer/bottom-drawer.providers.ts +17 -0
- package/src/breadcrumbs/index.ts +13 -1
- package/src/client-interceptor/index.ts +16 -1
- package/src/component-styles/syntactically-awesome-style-sheets-example/syntactically-awesome-style-sheets-example.component.scss +4 -2
- package/src/countdown/countdown-example.module.ts +1 -1
- package/src/dashboard/widget-guide-context-dashboard/widget-guide-context-dashboard.component.ts +1 -9
- package/src/date-time-range/date-time-range-example.component.ts +0 -1
- package/src/dynamic-forms/index.ts +13 -1
- package/src/grids/index.ts +13 -1
- package/src/grids/server-grid-example/last-updated-data-grid-column/last-updated.cell-renderer.component.ts +2 -1
- package/src/grids/server-grid-example/server-grid-example.component.html +2 -1
- package/src/grids/tree-grid-example/client-tree-grid-example.component.html +18 -0
- package/src/grids/tree-grid-example/client-tree-grid-example.component.ts +169 -0
- package/src/grids/tree-grid-example/client-tree-grid.data.ts +147 -0
- package/src/grids/tree-grid-example/server-tree-grid-example.component.html +30 -0
- package/src/grids/tree-grid-example/server-tree-grid-example.component.ts +156 -0
- package/src/grids/tree-grid-example/server-tree-grid-example.service.ts +255 -0
- package/src/grids/tree-grid-example/tree-grid-example-tab.factory.ts +31 -0
- package/src/grids/tree-grid-example/tree-grid-example.module.ts +36 -0
- package/src/hello/index.ts +18 -1
- package/src/hooks/action/logout-action/logout-action.component.ts +3 -4
- package/src/hooks/generic-wizard/minimal-setup/minimal-setup.component.ts +4 -1
- package/src/hooks/generic-wizard/minimal-setup/multiple-entries-one.component.ts +9 -2
- package/src/hooks/generic-wizard/minimal-setup/multiple-entries-two.component.ts +9 -2
- package/src/hooks/generic-wizard/wizard.module.ts +9 -2
- package/src/hooks/index.ts +13 -1
- package/src/hooks/navigator/index.ts +12 -1
- package/src/hooks/route/index.ts +42 -1
- package/src/hooks/stepper/basic-view/basic-view.component.ts +11 -2
- package/src/hooks/stepper/stepper-hook.module.ts +7 -2
- package/src/hooks/stepper/steps/step1.component.ts +26 -3
- package/src/hooks/stepper/steps/step2.component.ts +4 -1
- package/src/hooks/widget-config/additional-config/additional-config.component.ts +16 -0
- package/src/hooks/widget-config/basic-view/basic-edit.component.html +18 -0
- package/src/hooks/widget-config/basic-view/basic-edit.component.ts +31 -0
- package/src/hooks/widget-config/widget-config.providers.ts +59 -0
- package/src/i18n.ts +3 -0
- package/src/lazy/index.ts +38 -1
- package/src/lazy-widget/index.ts +26 -1
- package/src/list/index.ts +13 -1
- package/src/main.ts +7 -10
- package/src/maps/{map-examples.module.ts → index.ts} +4 -9
- package/src/provider-configuration/index.ts +0 -2
- package/src/provider-configuration/introduction-example/{introduction.module.ts → index.ts} +5 -7
- package/src/redirect-to-last-route/index.ts +16 -1
- package/src/redirect-to-last-route/redirect-to-last-route-guard.service.ts +11 -2
- package/src/selector/alarm-event-selector-example/alarm-event-selector.module.ts +1 -1
- package/src/selector/asset-selector-example/general-example/asset-selector-example.component.ts +1 -2
- package/src/translations/index.ts +13 -1
- package/src/user-menu/index.ts +23 -1
- package/src/widget/demo-widget-config.component.ts +11 -3
- package/src/widget/demo-widget.component.ts +6 -2
- package/src/widget/index.ts +41 -1
- package/src/widget-resolvers/alternative-event.resolver.ts +8 -2
- package/src/widget-resolvers/index.ts +47 -1
- package/src/widget-resolvers/widget-resolvers-config/widget-resolvers-config.component.ts +7 -3
- package/src/widget-resolvers/widget-resolvers.component.ts +5 -1
- package/src/__mocks/mock.module.ts +0 -173
- package/src/app/app.module.ts +0 -76
- package/src/breadcrumbs/breadcrumbs.module.ts +0 -14
- package/src/client-interceptor/client-interceptor.module.ts +0 -12
- package/src/dynamic-forms/dynamic-forms.module.ts +0 -16
- package/src/grids/grids.module.ts +0 -17
- package/src/hello/hello.module.ts +0 -20
- package/src/hooks/hooks.module.ts +0 -19
- package/src/hooks/navigator/navigator.module.ts +0 -21
- package/src/hooks/route/route.module.ts +0 -51
- package/src/lazy/lazy-routing.module.ts +0 -21
- package/src/lazy/lazy.hooks.ts +0 -24
- package/src/lazy-widget/lazy-widget.module.ts +0 -30
- package/src/list/lists.module.ts +0 -17
- package/src/redirect-to-last-route/redirect-to-last-route.module.ts +0 -20
- package/src/translations/translations.module.ts +0 -18
- package/src/user-menu/user-menu.module.ts +0 -13
- package/src/user-menu/user-menu.ts +0 -26
- package/src/widget/demo-widget.module.ts +0 -55
- package/src/widget-resolvers/widget-resolvers.module.ts +0 -52
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import { Inject, NgModule } from '@angular/core';
|
|
3
|
-
import { IUser } from '@c8y/client';
|
|
4
|
-
import {
|
|
5
|
-
AppStateService,
|
|
6
|
-
CoreModule,
|
|
7
|
-
OptionsService,
|
|
8
|
-
RealtimeSubjectService
|
|
9
|
-
} from '@c8y/ngx-components';
|
|
10
|
-
import { InventoryInterceptor } from './global-mocks/inventory.interceptor';
|
|
11
|
-
import { MeasurementsInterceptor } from './global-mocks/measurements.interceptor';
|
|
12
|
-
import { API_MOCK_CONFIG, ApiMockConfig } from './mock.model';
|
|
13
|
-
import { RealtimeSubjectServiceWithMocking } from './mock.realtime';
|
|
14
|
-
import { MockService } from './mock.service';
|
|
15
|
-
import { ContextDashboardInterceptor } from './scoped-mocks/context-dashboard';
|
|
16
|
-
import { DeviceDataGridInterceptor } from './scoped-mocks/device-data-grid';
|
|
17
|
-
import { ListsInterceptor } from './scoped-mocks/lists';
|
|
18
|
-
import { NamedContextDashboardInterceptor } from './scoped-mocks/named-context-dashboard';
|
|
19
|
-
import { ServerSideDataGridInterceptor } from './scoped-mocks/server-side-data-grid';
|
|
20
|
-
import { ServiceDashboardInterceptor } from './scoped-mocks/service-dashboard';
|
|
21
|
-
import { TypeaheadInterceptor } from './scoped-mocks/typeahead';
|
|
22
|
-
// import { BoilerplateInterceptor } from './scoped-mocks/boilerplate';
|
|
23
|
-
import { MeasurementsSeriesInterceptor } from './scoped-mocks/measurement-series';
|
|
24
|
-
@NgModule({
|
|
25
|
-
imports: [CoreModule, CommonModule],
|
|
26
|
-
providers: [
|
|
27
|
-
// TODO: ask Jan about mocking clusters maps/cluster
|
|
28
|
-
// {
|
|
29
|
-
// provide: API_MOCK_CONFIG,
|
|
30
|
-
// useValue: {
|
|
31
|
-
// id: 'a-cluster-map-interceptor',
|
|
32
|
-
// path: 'maps/cluster',
|
|
33
|
-
// mockService: BoilerplateInterceptor,
|
|
34
|
-
// debug: true
|
|
35
|
-
// } as ApiMockConfig,
|
|
36
|
-
// multi: true
|
|
37
|
-
// },
|
|
38
|
-
{
|
|
39
|
-
provide: API_MOCK_CONFIG,
|
|
40
|
-
useValue: {
|
|
41
|
-
id: 'a-datapoints-export-selector-interceptor',
|
|
42
|
-
path: 'datapoints-export-selector-example',
|
|
43
|
-
mockService: MeasurementsSeriesInterceptor,
|
|
44
|
-
debug: true
|
|
45
|
-
} as ApiMockConfig,
|
|
46
|
-
multi: true
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
provide: API_MOCK_CONFIG,
|
|
50
|
-
useValue: {
|
|
51
|
-
id: 'a-service-dashboard-interceptor',
|
|
52
|
-
path: 'service-dashboard',
|
|
53
|
-
mockService: ServiceDashboardInterceptor,
|
|
54
|
-
debug: true
|
|
55
|
-
} as ApiMockConfig,
|
|
56
|
-
multi: true
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
provide: API_MOCK_CONFIG,
|
|
60
|
-
useValue: {
|
|
61
|
-
id: 'list-group-interceptor',
|
|
62
|
-
path: 'lists',
|
|
63
|
-
mockService: ListsInterceptor,
|
|
64
|
-
debug: true
|
|
65
|
-
} as ApiMockConfig,
|
|
66
|
-
multi: true
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
provide: API_MOCK_CONFIG,
|
|
70
|
-
useValue: {
|
|
71
|
-
id: 'for-of-interceptor',
|
|
72
|
-
path: 'for-of',
|
|
73
|
-
mockService: ListsInterceptor,
|
|
74
|
-
debug: true
|
|
75
|
-
} as ApiMockConfig,
|
|
76
|
-
multi: true
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
provide: API_MOCK_CONFIG,
|
|
80
|
-
useValue: {
|
|
81
|
-
id: 'typeahaed-interceptor',
|
|
82
|
-
path: 'typeahead',
|
|
83
|
-
mockService: TypeaheadInterceptor,
|
|
84
|
-
debug: true
|
|
85
|
-
} as ApiMockConfig,
|
|
86
|
-
multi: true
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
provide: API_MOCK_CONFIG,
|
|
90
|
-
useValue: {
|
|
91
|
-
id: 'server-side-data-grid-interceptor',
|
|
92
|
-
path: 'server-grid-example',
|
|
93
|
-
mockService: ServerSideDataGridInterceptor
|
|
94
|
-
} as ApiMockConfig,
|
|
95
|
-
multi: true
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
provide: API_MOCK_CONFIG,
|
|
99
|
-
useValue: {
|
|
100
|
-
id: 'device-data-grid-interceptor',
|
|
101
|
-
path: 'device-grid-example',
|
|
102
|
-
mockService: DeviceDataGridInterceptor
|
|
103
|
-
} as ApiMockConfig,
|
|
104
|
-
multi: true
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
provide: API_MOCK_CONFIG,
|
|
108
|
-
useValue: {
|
|
109
|
-
id: 'scoped-dashboard-context-interceptor',
|
|
110
|
-
path: 'dashboards/context',
|
|
111
|
-
mockService: ContextDashboardInterceptor
|
|
112
|
-
} as ApiMockConfig,
|
|
113
|
-
multi: true
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
provide: API_MOCK_CONFIG,
|
|
117
|
-
useValue: {
|
|
118
|
-
id: 'scoped-dashboard-context-interceptor-2',
|
|
119
|
-
path: 'dashboards/widget-guide-context-dashboard',
|
|
120
|
-
mockService: ContextDashboardInterceptor
|
|
121
|
-
} as ApiMockConfig,
|
|
122
|
-
multi: true
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
provide: API_MOCK_CONFIG,
|
|
126
|
-
useValue: {
|
|
127
|
-
path: 'named-context',
|
|
128
|
-
// The interceptors are sorted by their ID, so the scoped interceptors should be before the global ones.
|
|
129
|
-
id: 'named-context-interceptor-example',
|
|
130
|
-
mockService: NamedContextDashboardInterceptor
|
|
131
|
-
} as ApiMockConfig,
|
|
132
|
-
multi: true
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
provide: API_MOCK_CONFIG,
|
|
136
|
-
useValue: {
|
|
137
|
-
// The interceptors are sorted by their ID, so the scoped interceptors should be before the global ones.
|
|
138
|
-
id: 'z-global-inventory-interceptor',
|
|
139
|
-
mockService: InventoryInterceptor
|
|
140
|
-
} as ApiMockConfig,
|
|
141
|
-
multi: true
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
provide: API_MOCK_CONFIG,
|
|
145
|
-
useValue: {
|
|
146
|
-
// The interceptors are sorted by their ID, so the scoped interceptors should be before the global ones.
|
|
147
|
-
id: 'z-global-measurementsInterceptor-interceptor',
|
|
148
|
-
mockService: MeasurementsInterceptor
|
|
149
|
-
} as ApiMockConfig,
|
|
150
|
-
multi: true
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
provide: RealtimeSubjectService,
|
|
154
|
-
useExisting: RealtimeSubjectServiceWithMocking
|
|
155
|
-
}
|
|
156
|
-
]
|
|
157
|
-
})
|
|
158
|
-
export class MockModule {
|
|
159
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
160
|
-
constructor(
|
|
161
|
-
@Inject(MockService) service,
|
|
162
|
-
appStateService: AppStateService,
|
|
163
|
-
private options: OptionsService
|
|
164
|
-
) {
|
|
165
|
-
if (this.options.get('noLogin', false)) {
|
|
166
|
-
appStateService.currentUser.next({
|
|
167
|
-
id: 'NO_LOGIN',
|
|
168
|
-
userName: 'noLogin',
|
|
169
|
-
displayName: 'noLogin'
|
|
170
|
-
} as IUser);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
package/src/app/app.module.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
3
|
-
import { BootstrapComponent, CoreModule, RouterModule, VersionModule } from '@c8y/ngx-components';
|
|
4
|
-
import { BulkOperationSchedulerModule } from '@c8y/ngx-components/operations/bulk-operation-scheduler';
|
|
5
|
-
import { WidgetsModule } from '@c8y/ngx-components/widgets';
|
|
6
|
-
import { cockpitDefaultWidgets } from '@c8y/ngx-components/widgets/cockpit';
|
|
7
|
-
import { deviceManagementDefaultWidgets } from '@c8y/ngx-components/widgets/device-management';
|
|
8
|
-
import { BsModalRef } from 'ngx-bootstrap/modal';
|
|
9
|
-
import { ClientInterceptorModule } from '../client-interceptor';
|
|
10
|
-
import { DynamicFormsTutorialModule } from '../dynamic-forms';
|
|
11
|
-
import { GridsModule } from '../grids';
|
|
12
|
-
import { HelloModule } from '../hello';
|
|
13
|
-
import { HooksModule } from '../hooks';
|
|
14
|
-
import { NavigatorModule } from '../hooks/navigator';
|
|
15
|
-
import { RouteModule } from '../hooks/route';
|
|
16
|
-
import { LazyRoutingModule } from '../lazy';
|
|
17
|
-
import { LazyWidgetModule } from '../lazy-widget';
|
|
18
|
-
import { ListsModule } from '../list';
|
|
19
|
-
import { MapExamplesModule } from '../maps/map-examples.module';
|
|
20
|
-
import { RedirectToLastRouteModule } from '../redirect-to-last-route';
|
|
21
|
-
import { UserMenuModule } from '../user-menu';
|
|
22
|
-
import { DashboardWidgetDemoModule } from '../widget';
|
|
23
|
-
import { WidgetResolversModule } from '../widget-resolvers';
|
|
24
|
-
import { MockModule } from '../__mocks';
|
|
25
|
-
import { IntroductionModule } from '../provider-configuration';
|
|
26
|
-
import { TranslationsModule } from '../translations';
|
|
27
|
-
import { BreadcrumbsNodeModule } from '../breadcrumbs/breadcrumbs.module';
|
|
28
|
-
import { AlarmsModule } from '@c8y/ngx-components/alarms';
|
|
29
|
-
|
|
30
|
-
@NgModule({
|
|
31
|
-
declarations: [],
|
|
32
|
-
imports: [
|
|
33
|
-
BrowserAnimationsModule,
|
|
34
|
-
RouterModule.forRoot([]),
|
|
35
|
-
// Import the CoreModule to add c8y functionality
|
|
36
|
-
CoreModule.forRoot(),
|
|
37
|
-
|
|
38
|
-
// The following modules show examples of how to
|
|
39
|
-
HelloModule,
|
|
40
|
-
RouteModule,
|
|
41
|
-
DashboardWidgetDemoModule,
|
|
42
|
-
HooksModule,
|
|
43
|
-
NavigatorModule,
|
|
44
|
-
ListsModule,
|
|
45
|
-
GridsModule,
|
|
46
|
-
LazyRoutingModule,
|
|
47
|
-
BulkOperationSchedulerModule,
|
|
48
|
-
IntroductionModule,
|
|
49
|
-
DynamicFormsTutorialModule,
|
|
50
|
-
WidgetResolversModule,
|
|
51
|
-
UserMenuModule,
|
|
52
|
-
ClientInterceptorModule,
|
|
53
|
-
MapExamplesModule,
|
|
54
|
-
TranslationsModule,
|
|
55
|
-
// Get rid of a default version factory
|
|
56
|
-
VersionModule.config({ disableWebSDKPluginVersionFactory: true }),
|
|
57
|
-
LazyWidgetModule,
|
|
58
|
-
WidgetsModule.config({
|
|
59
|
-
widgets: [...cockpitDefaultWidgets, ...deviceManagementDefaultWidgets]
|
|
60
|
-
}),
|
|
61
|
-
RedirectToLastRouteModule,
|
|
62
|
-
MockModule,
|
|
63
|
-
BreadcrumbsNodeModule,
|
|
64
|
-
AlarmsModule.config({ hybrid: false })
|
|
65
|
-
],
|
|
66
|
-
|
|
67
|
-
providers: [BsModalRef],
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Bootstrap your application with the BootstrapComponent which will use the `<c8y-bootstrap>`
|
|
71
|
-
* component to initialize the root application. Alternatively you can bootstrap
|
|
72
|
-
* a component of your choice and include that tag into its template or only reuse the given components
|
|
73
|
-
*/
|
|
74
|
-
bootstrap: [BootstrapComponent]
|
|
75
|
-
})
|
|
76
|
-
export class AppModule {}
|
|
@@ -1,14 +0,0 @@
|
|
|
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 {}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { ApiService, DataModule } from '@c8y/ngx-components/api';
|
|
3
|
-
import { ClientInterceptorService } from './client-interceptor.service';
|
|
4
|
-
|
|
5
|
-
@NgModule({
|
|
6
|
-
imports: [DataModule]
|
|
7
|
-
})
|
|
8
|
-
export class ClientInterceptorModule {
|
|
9
|
-
constructor(apiService: ApiService, interceptor: ClientInterceptorService) {
|
|
10
|
-
apiService.addInterceptor(interceptor, 'tutorialAppDemoInterceptor');
|
|
11
|
-
}
|
|
12
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { NavigatorNode, hookNavigator } from '@c8y/ngx-components';
|
|
3
|
-
|
|
4
|
-
@NgModule({
|
|
5
|
-
declarations: [],
|
|
6
|
-
imports: [],
|
|
7
|
-
providers: [
|
|
8
|
-
hookNavigator(
|
|
9
|
-
new NavigatorNode({
|
|
10
|
-
label: 'Dynamic forms',
|
|
11
|
-
icon: 'file-text'
|
|
12
|
-
})
|
|
13
|
-
)
|
|
14
|
-
]
|
|
15
|
-
})
|
|
16
|
-
export class DynamicFormsTutorialModule {}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { hookNavigator, NavigatorNode } from '@c8y/ngx-components';
|
|
3
|
-
|
|
4
|
-
@NgModule({
|
|
5
|
-
imports: [],
|
|
6
|
-
declarations: [],
|
|
7
|
-
providers: [
|
|
8
|
-
hookNavigator(
|
|
9
|
-
new NavigatorNode({
|
|
10
|
-
label: 'Data grid examples',
|
|
11
|
-
icon: 'table',
|
|
12
|
-
priority: 30
|
|
13
|
-
})
|
|
14
|
-
)
|
|
15
|
-
]
|
|
16
|
-
})
|
|
17
|
-
export class GridsModule {}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { RouterModule, Routes } from '@angular/router';
|
|
3
|
-
import { HelloComponent } from './hello.component';
|
|
4
|
-
|
|
5
|
-
const routes: Routes = [
|
|
6
|
-
{
|
|
7
|
-
path: '',
|
|
8
|
-
redirectTo: 'hello',
|
|
9
|
-
pathMatch: 'full'
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
path: 'hello',
|
|
13
|
-
component: HelloComponent
|
|
14
|
-
}
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
@NgModule({
|
|
18
|
-
imports: [RouterModule.forChild(routes)]
|
|
19
|
-
})
|
|
20
|
-
export class HelloModule {}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CoreModule, NavigatorNode, hookNavigator } from '@c8y/ngx-components';
|
|
3
|
-
|
|
4
|
-
@NgModule({
|
|
5
|
-
imports: [CoreModule],
|
|
6
|
-
/**
|
|
7
|
-
* Adding the hooks to the providers:
|
|
8
|
-
*/
|
|
9
|
-
providers: [
|
|
10
|
-
hookNavigator(
|
|
11
|
-
new NavigatorNode({
|
|
12
|
-
priority: 90,
|
|
13
|
-
icon: 'u-turn',
|
|
14
|
-
label: 'Hooks'
|
|
15
|
-
})
|
|
16
|
-
)
|
|
17
|
-
]
|
|
18
|
-
})
|
|
19
|
-
export class HooksModule {}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { hookNavigator } from '@c8y/ngx-components';
|
|
3
|
-
import { ExampleNavigationFactory } from './navigator';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Use our predefined InjectionTokens and provide your own classes to extend behavior
|
|
7
|
-
* and functionality of existing ones. Implement your own NavigationNodes, Tabs, Actions and Breadcrumbs.
|
|
8
|
-
* Note: Hooks should always be implemented in the module where they are used, so that
|
|
9
|
-
* a module can act standalone and has no dependencies on other modules.
|
|
10
|
-
*/
|
|
11
|
-
export const hooks = [hookNavigator(ExampleNavigationFactory)];
|
|
12
|
-
|
|
13
|
-
@NgModule({
|
|
14
|
-
declarations: [],
|
|
15
|
-
imports: [],
|
|
16
|
-
/**
|
|
17
|
-
* Adding the hooks to the providers:
|
|
18
|
-
*/
|
|
19
|
-
providers: [...hooks]
|
|
20
|
-
})
|
|
21
|
-
export class NavigatorModule {}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { ViewContext, hookRoute } from '@c8y/ngx-components';
|
|
3
|
-
import { RandomGuard } from './random.guard';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Route hooks allow you to use routes as child routes on a ViewContext. If used with a context
|
|
7
|
-
* the particular data is resolved automatically and the page is extended by a tab. Contexts
|
|
8
|
-
* are currently Application, Device, Group, Tenant and User. Note: All components used here
|
|
9
|
-
* needs to be used as EntryComponent!
|
|
10
|
-
* This example will add a device tab with all the context information as well as a randomly
|
|
11
|
-
* guarded context tab.
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
|
-
const routeHooks = [
|
|
15
|
-
hookRoute([
|
|
16
|
-
{
|
|
17
|
-
path: 'context',
|
|
18
|
-
context: ViewContext.Device,
|
|
19
|
-
loadComponent: () =>
|
|
20
|
-
import('./device/device-tab-context.component').then(m => m.DeviceTabContextComponent),
|
|
21
|
-
label: 'Context',
|
|
22
|
-
priority: 1000,
|
|
23
|
-
icon: 'bell'
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
path: 'info',
|
|
27
|
-
context: ViewContext.Device,
|
|
28
|
-
loadComponent: () =>
|
|
29
|
-
import('./device/device-info.component').then(m => m.DeviceInfoComponent),
|
|
30
|
-
label: 'Info',
|
|
31
|
-
priority: 0,
|
|
32
|
-
icon: 'info',
|
|
33
|
-
/**
|
|
34
|
-
* An example of an route guard which randomly activates
|
|
35
|
-
* the child route. See Guards documentation from Angular
|
|
36
|
-
* for more details.
|
|
37
|
-
*/
|
|
38
|
-
canActivate: [RandomGuard]
|
|
39
|
-
}
|
|
40
|
-
])
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
@NgModule({
|
|
44
|
-
declarations: [],
|
|
45
|
-
imports: [],
|
|
46
|
-
/**
|
|
47
|
-
* Adding the hooks to the providers:
|
|
48
|
-
*/
|
|
49
|
-
providers: [...routeHooks]
|
|
50
|
-
})
|
|
51
|
-
export class RouteModule {}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule as NgCommonModule } from '@angular/common';
|
|
3
|
-
import { RouterModule, Routes } from '@angular/router';
|
|
4
|
-
import { CoreModule } from '@c8y/ngx-components';
|
|
5
|
-
import { hooks as lazyHooks } from './lazy.hooks';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Angular Routes.
|
|
9
|
-
* Within this array at least path (url) and components are linked.
|
|
10
|
-
*/
|
|
11
|
-
const routes: Routes = [
|
|
12
|
-
{
|
|
13
|
-
path: 'lazy',
|
|
14
|
-
loadChildren: () => import('./lazy-loaded.module').then(m => m.LazyLoadedModule)
|
|
15
|
-
}
|
|
16
|
-
];
|
|
17
|
-
@NgModule({
|
|
18
|
-
imports: [NgCommonModule, RouterModule.forChild(routes), CoreModule],
|
|
19
|
-
providers: [...lazyHooks]
|
|
20
|
-
})
|
|
21
|
-
export class LazyRoutingModule {}
|
package/src/lazy/lazy.hooks.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { NavigatorNode, hookNavigator } from '@c8y/ngx-components';
|
|
2
|
-
|
|
3
|
-
const root = new NavigatorNode({
|
|
4
|
-
label: 'Lazy loaded',
|
|
5
|
-
icon: 'hourglass-start'
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
root.add(
|
|
9
|
-
new NavigatorNode({
|
|
10
|
-
path: '/lazy/one',
|
|
11
|
-
label: 'One',
|
|
12
|
-
icon: 'thermometer'
|
|
13
|
-
})
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
root.add(
|
|
17
|
-
new NavigatorNode({
|
|
18
|
-
path: '/lazy/two',
|
|
19
|
-
label: 'Two',
|
|
20
|
-
icon: 'thermometer-3'
|
|
21
|
-
})
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
export const hooks = [hookNavigator(root)];
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { hookWidget } from '@c8y/ngx-components';
|
|
4
|
-
|
|
5
|
-
async function loadViewComponent() {
|
|
6
|
-
const { LazyWidgetViewComponent } = await import('./lazy-widget-view');
|
|
7
|
-
return LazyWidgetViewComponent;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
async function loadConfigComponent() {
|
|
11
|
-
const { LazyWidgetConfigComponent } = await import('./lazy-widget-config');
|
|
12
|
-
return LazyWidgetConfigComponent;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
@NgModule({
|
|
16
|
-
imports: [CommonModule],
|
|
17
|
-
providers: [
|
|
18
|
-
hookWidget({
|
|
19
|
-
id: 'tutorial-lazy-widget',
|
|
20
|
-
label: 'Lazy Loaded Widget',
|
|
21
|
-
description: 'Lazy Loaded Widget',
|
|
22
|
-
loadComponent: loadViewComponent,
|
|
23
|
-
loadConfigComponent: loadConfigComponent,
|
|
24
|
-
data: {
|
|
25
|
-
schema: () => import('c8y-schema-loader?interfaceName=WidgetConfig!./widget-config.model')
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
]
|
|
29
|
-
})
|
|
30
|
-
export class LazyWidgetModule {}
|
package/src/list/lists.module.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { hookNavigator, NavigatorNode } from '@c8y/ngx-components';
|
|
3
|
-
|
|
4
|
-
@NgModule({
|
|
5
|
-
declarations: [],
|
|
6
|
-
imports: [],
|
|
7
|
-
providers: [
|
|
8
|
-
hookNavigator(
|
|
9
|
-
new NavigatorNode({
|
|
10
|
-
label: 'Lists',
|
|
11
|
-
icon: 'c8y-device',
|
|
12
|
-
priority: 97
|
|
13
|
-
})
|
|
14
|
-
)
|
|
15
|
-
]
|
|
16
|
-
})
|
|
17
|
-
export class ListsModule {}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { NgModule, inject } from '@angular/core';
|
|
2
|
-
import { CanActivateFn, RouterModule } from '@angular/router';
|
|
3
|
-
import { RedirectToLastRouteGuardService } from './redirect-to-last-route-guard.service';
|
|
4
|
-
import { EmptyComponent } from '@c8y/ngx-components';
|
|
5
|
-
|
|
6
|
-
@NgModule({
|
|
7
|
-
imports: [
|
|
8
|
-
RouterModule.forChild([
|
|
9
|
-
{
|
|
10
|
-
path: 'pickLastRoute',
|
|
11
|
-
canActivate: [
|
|
12
|
-
((...args) =>
|
|
13
|
-
inject(RedirectToLastRouteGuardService).canActivate(...args)) as CanActivateFn
|
|
14
|
-
],
|
|
15
|
-
component: EmptyComponent
|
|
16
|
-
}
|
|
17
|
-
])
|
|
18
|
-
]
|
|
19
|
-
})
|
|
20
|
-
export class RedirectToLastRouteModule {}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { NavigatorNode, hookNavigator } from '@c8y/ngx-components';
|
|
3
|
-
|
|
4
|
-
@NgModule({
|
|
5
|
-
declarations: [],
|
|
6
|
-
imports: [],
|
|
7
|
-
exports: [],
|
|
8
|
-
providers: [
|
|
9
|
-
hookNavigator(
|
|
10
|
-
new NavigatorNode({
|
|
11
|
-
priority: 20,
|
|
12
|
-
icon: 'rocket',
|
|
13
|
-
label: 'Translations'
|
|
14
|
-
})
|
|
15
|
-
)
|
|
16
|
-
]
|
|
17
|
-
})
|
|
18
|
-
export class TranslationsModule {}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import { CoreModule } from '@c8y/ngx-components';
|
|
3
|
-
import { ExampleUserMenu } from './user-menu';
|
|
4
|
-
|
|
5
|
-
@NgModule({
|
|
6
|
-
declarations: [],
|
|
7
|
-
imports: [CoreModule],
|
|
8
|
-
providers: [ExampleUserMenu]
|
|
9
|
-
})
|
|
10
|
-
export class UserMenuModule {
|
|
11
|
-
// use dependency injection as otherwise ExampleUserMenu will never be instantiated
|
|
12
|
-
constructor(private userMenu: ExampleUserMenu) {}
|
|
13
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Injectable } from '@angular/core';
|
|
2
|
-
import { AlertService, gettext, UserMenuService } from '@c8y/ngx-components';
|
|
3
|
-
|
|
4
|
-
@Injectable()
|
|
5
|
-
export class ExampleUserMenu {
|
|
6
|
-
// Inject the c8y UserMenuService
|
|
7
|
-
constructor(
|
|
8
|
-
private userMenu: UserMenuService,
|
|
9
|
-
private alert: AlertService
|
|
10
|
-
) {
|
|
11
|
-
// add an item to the user menu
|
|
12
|
-
this.userMenu.add({
|
|
13
|
-
icon: 'notification',
|
|
14
|
-
label: gettext('Notifications'),
|
|
15
|
-
priority: 0,
|
|
16
|
-
click: () => {
|
|
17
|
-
this.onClick();
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// method to be called when button in user menu is clicked
|
|
23
|
-
private onClick() {
|
|
24
|
-
this.alert.info(gettext('Notification button clicked.'));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { NgModule } from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
CommonModule as C8yCommonModule,
|
|
4
|
-
DynamicComponentErrorStrategy,
|
|
5
|
-
DynamicWidgetDefinition,
|
|
6
|
-
FormsModule,
|
|
7
|
-
hookWidget,
|
|
8
|
-
WidgetDataType
|
|
9
|
-
} from '@c8y/ngx-components';
|
|
10
|
-
import { AssetSelectorModule } from '@c8y/ngx-components/assets-navigator';
|
|
11
|
-
import { WidgetConfigDemo } from './demo-widget-config.component';
|
|
12
|
-
import { WidgetDemo } from './demo-widget.component';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* This demo widget provides an example on how
|
|
16
|
-
* to use the hookComponent. The component itself
|
|
17
|
-
* is implemented in the dashboard on the
|
|
18
|
-
* ../hello/hello.component.html by using the
|
|
19
|
-
* dynamic-component tag.
|
|
20
|
-
*/
|
|
21
|
-
@NgModule({
|
|
22
|
-
declarations: [WidgetDemo, WidgetConfigDemo],
|
|
23
|
-
imports: [FormsModule, AssetSelectorModule, C8yCommonModule],
|
|
24
|
-
exports: [],
|
|
25
|
-
providers: [
|
|
26
|
-
hookWidget({
|
|
27
|
-
id: 'angular.widget.demo',
|
|
28
|
-
label: 'My angular widget',
|
|
29
|
-
description: 'This is a description from angular',
|
|
30
|
-
component: WidgetDemo,
|
|
31
|
-
configComponent: WidgetConfigDemo,
|
|
32
|
-
errorStrategy: DynamicComponentErrorStrategy.OVERLAY_ERROR,
|
|
33
|
-
|
|
34
|
-
/** new Angular-Dashboard definition */
|
|
35
|
-
data: {
|
|
36
|
-
schema: () => import('c8y-schema-loader?interfaceName=WidgetConfig!./widget-config.model'),
|
|
37
|
-
// The settings object can be used to configure the configComponent
|
|
38
|
-
settings: {
|
|
39
|
-
noNewWidgets: false, // Set this to true, to don't allow adding new widgets.
|
|
40
|
-
ng1: {
|
|
41
|
-
options: {
|
|
42
|
-
noDeviceTarget: false, // Set this to true to hide the AngularJS device selector.
|
|
43
|
-
groupsSelectable: false // Set this, if not only devices should be selectable.
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
// Settings that are attached to the display component (in this case: WidgetDemo)
|
|
48
|
-
displaySettings: {
|
|
49
|
-
globalTimeContext: true // Set this to true, to add a global time context binding
|
|
50
|
-
}
|
|
51
|
-
} as WidgetDataType
|
|
52
|
-
} as DynamicWidgetDefinition)
|
|
53
|
-
]
|
|
54
|
-
})
|
|
55
|
-
export class DashboardWidgetDemoModule {}
|