@c8y/tutorial 1021.81.0 → 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 +16 -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/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,7 +1,13 @@
|
|
|
1
1
|
import { Component, Input } from '@angular/core';
|
|
2
|
-
import { ControlContainer, NgForm } from '@angular/forms';
|
|
3
|
-
import {
|
|
2
|
+
import { ControlContainer, NgForm, FormsModule } from '@angular/forms';
|
|
3
|
+
import {
|
|
4
|
+
DynamicComponent,
|
|
5
|
+
OnBeforeSave,
|
|
6
|
+
AlertService,
|
|
7
|
+
FormGroupComponent
|
|
8
|
+
} from '@c8y/ngx-components';
|
|
4
9
|
import { omit } from 'lodash';
|
|
10
|
+
import { JsonPipe } from '@angular/common';
|
|
5
11
|
import { WidgetConfig } from './widget-config.model';
|
|
6
12
|
|
|
7
13
|
@Component({
|
|
@@ -30,7 +36,9 @@ import { WidgetConfig } from './widget-config.model';
|
|
|
30
36
|
// We connect our parent Form to this form (for disabling the save button)
|
|
31
37
|
// you can also enable the button by using ContextServiceDashboard.formDisabled
|
|
32
38
|
// property instead (by default it is enabled).
|
|
33
|
-
viewProviders: [{ provide: ControlContainer, useExisting: NgForm }]
|
|
39
|
+
viewProviders: [{ provide: ControlContainer, useExisting: NgForm }],
|
|
40
|
+
standalone: true,
|
|
41
|
+
imports: [FormGroupComponent, FormsModule, JsonPipe]
|
|
34
42
|
})
|
|
35
43
|
export class WidgetConfigDemo implements DynamicComponent, OnBeforeSave {
|
|
36
44
|
/**
|
|
@@ -3,8 +3,10 @@ import {
|
|
|
3
3
|
DismissAlertStrategy,
|
|
4
4
|
DynamicComponentAlert,
|
|
5
5
|
DynamicComponentAlertAggregator,
|
|
6
|
-
gettext
|
|
6
|
+
gettext,
|
|
7
|
+
DatePipe
|
|
7
8
|
} from '@c8y/ngx-components';
|
|
9
|
+
import { NgIf } from '@angular/common';
|
|
8
10
|
import { WidgetConfig } from './widget-config.model';
|
|
9
11
|
|
|
10
12
|
@Component({
|
|
@@ -31,7 +33,9 @@ import { WidgetConfig } from './widget-config.model';
|
|
|
31
33
|
font-size: 2em;
|
|
32
34
|
}
|
|
33
35
|
`
|
|
34
|
-
]
|
|
36
|
+
],
|
|
37
|
+
standalone: true,
|
|
38
|
+
imports: [NgIf, DatePipe]
|
|
35
39
|
})
|
|
36
40
|
export class WidgetDemo implements OnChanges {
|
|
37
41
|
@Input() config: WidgetConfig;
|
package/src/widget/index.ts
CHANGED
|
@@ -1 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
import { DynamicComponentErrorStrategy, hookWidget } from '@c8y/ngx-components';
|
|
2
|
+
import { WidgetDemo } from './demo-widget.component';
|
|
3
|
+
import { WidgetConfigDemo } from './demo-widget-config.component';
|
|
4
|
+
|
|
5
|
+
export function provideDemoWidget() {
|
|
6
|
+
return [
|
|
7
|
+
/**
|
|
8
|
+
* This demo widget provides an example on how
|
|
9
|
+
* to use the hookWidget. The component itself
|
|
10
|
+
* is implemented in the dashboard on the
|
|
11
|
+
* ../hello/hello.component.html by using the
|
|
12
|
+
* dynamic-component tag.
|
|
13
|
+
*/
|
|
14
|
+
hookWidget({
|
|
15
|
+
id: 'angular.widget.demo',
|
|
16
|
+
label: 'My angular widget',
|
|
17
|
+
description: 'This is a description from angular',
|
|
18
|
+
component: WidgetDemo,
|
|
19
|
+
configComponent: WidgetConfigDemo,
|
|
20
|
+
errorStrategy: DynamicComponentErrorStrategy.OVERLAY_ERROR,
|
|
21
|
+
/** new Angular-Dashboard definition */
|
|
22
|
+
data: {
|
|
23
|
+
schema: () => import('c8y-schema-loader?interfaceName=WidgetConfig!./widget-config.model'),
|
|
24
|
+
// The settings object can be used to configure the configComponent
|
|
25
|
+
settings: {
|
|
26
|
+
noNewWidgets: false, // Set this to true, to don't allow adding new widgets.
|
|
27
|
+
ng1: {
|
|
28
|
+
options: {
|
|
29
|
+
noDeviceTarget: false, // Set this to true to hide the AngularJS device selector.
|
|
30
|
+
groupsSelectable: false // Set this, if not only devices should be selectable.
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
// Settings that are attached to the display component (in this case: WidgetDemo)
|
|
35
|
+
displaySettings: {
|
|
36
|
+
globalTimeContext: true // Set this to true, to add a global time context binding
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
];
|
|
41
|
+
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Injectable } from '@angular/core';
|
|
2
2
|
import { EventService } from '@c8y/client';
|
|
3
3
|
import { IEvent } from '@c8y/client';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
DynamicBulkIIdentifiedResolver,
|
|
6
|
+
DynamicResolverService,
|
|
7
|
+
gettext
|
|
8
|
+
} from '@c8y/ngx-components';
|
|
5
9
|
|
|
6
10
|
/**
|
|
7
11
|
* An short alternative to the DynamicEventResolver class using the abstract class DynamicBulkIIdentifiedResolver.
|
|
@@ -10,7 +14,9 @@ import { DynamicBulkIIdentifiedResolver, DynamicResolverService } from '@c8y/ngx
|
|
|
10
14
|
export class SimpleDynamicEventResolver extends DynamicBulkIIdentifiedResolver<
|
|
11
15
|
IEvent & { id: string | number }
|
|
12
16
|
> {
|
|
13
|
-
protected
|
|
17
|
+
protected errorMessage = gettext(
|
|
18
|
+
'Unable to retrieve the following event: "{{entityName}}" ({{entityId}}).'
|
|
19
|
+
);
|
|
14
20
|
|
|
15
21
|
constructor(
|
|
16
22
|
protected dynamicResolver: DynamicResolverService,
|
|
@@ -1 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
import {
|
|
2
|
+
DynamicComponentErrorStrategy,
|
|
3
|
+
DynamicManagedObjectResolver,
|
|
4
|
+
DynamicWidgetDefinition,
|
|
5
|
+
hookWidget
|
|
6
|
+
} from '@c8y/ngx-components';
|
|
7
|
+
import { DynamicEventResolver } from './event.resolver';
|
|
8
|
+
import { SimpleDynamicEventResolver } from './alternative-event.resolver';
|
|
9
|
+
import { PropertiesLibraryResolver } from './event-property.resolver';
|
|
10
|
+
|
|
11
|
+
export function provideWidgetsResolverSample() {
|
|
12
|
+
return [
|
|
13
|
+
hookWidget({
|
|
14
|
+
loadComponent: () =>
|
|
15
|
+
import('./widget-resolvers.component').then(m => m.WidgetResolversComponent),
|
|
16
|
+
loadConfigComponent: () =>
|
|
17
|
+
import('./widget-resolvers-config/widget-resolvers-config.component').then(
|
|
18
|
+
m => m.WidgetResolversConfigComponent
|
|
19
|
+
),
|
|
20
|
+
id: 'widget-resolvers',
|
|
21
|
+
label: 'Demo Resolver Widget',
|
|
22
|
+
description: 'Widget demonstrating resolvers.',
|
|
23
|
+
resolve: {
|
|
24
|
+
source: DynamicManagedObjectResolver,
|
|
25
|
+
event: DynamicEventResolver || SimpleDynamicEventResolver,
|
|
26
|
+
property: PropertiesLibraryResolver
|
|
27
|
+
},
|
|
28
|
+
errorStrategy: DynamicComponentErrorStrategy.OVERLAY_ERROR,
|
|
29
|
+
data: {
|
|
30
|
+
schema: () => import('c8y-schema-loader?interfaceName=WidgetConfig!./widget-config.model'),
|
|
31
|
+
settings: {
|
|
32
|
+
noNewWidgets: false,
|
|
33
|
+
widgetDefaults: {
|
|
34
|
+
_width: 2,
|
|
35
|
+
_height: 2
|
|
36
|
+
},
|
|
37
|
+
ng1: {
|
|
38
|
+
options: {
|
|
39
|
+
noDeviceTarget: true,
|
|
40
|
+
groupsSelectable: false
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
} satisfies DynamicWidgetDefinition)
|
|
46
|
+
];
|
|
47
|
+
}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { Component, Input, OnInit } from '@angular/core';
|
|
2
|
-
import { ControlContainer, NgForm } from '@angular/forms';
|
|
2
|
+
import { ControlContainer, NgForm, FormsModule } from '@angular/forms';
|
|
3
3
|
import { EventService, IEvent, IManagedObject, InventoryService } from '@c8y/client';
|
|
4
4
|
import {
|
|
5
5
|
DynamicComponent,
|
|
6
6
|
DynamicComponentAlert,
|
|
7
|
-
DynamicComponentAlertAggregator
|
|
7
|
+
DynamicComponentAlertAggregator,
|
|
8
|
+
FormGroupComponent
|
|
8
9
|
} from '@c8y/ngx-components';
|
|
10
|
+
import { NgFor } from '@angular/common';
|
|
9
11
|
|
|
10
12
|
@Component({
|
|
11
13
|
selector: 'app-widget-resolvers-config',
|
|
12
14
|
templateUrl: './widget-resolvers-config.component.html',
|
|
13
|
-
viewProviders: [{ provide: ControlContainer, useExisting: NgForm }]
|
|
15
|
+
viewProviders: [{ provide: ControlContainer, useExisting: NgForm }],
|
|
16
|
+
standalone: true,
|
|
17
|
+
imports: [FormGroupComponent, FormsModule, NgFor]
|
|
14
18
|
})
|
|
15
19
|
export class WidgetResolversConfigComponent implements OnInit, DynamicComponent {
|
|
16
20
|
events: IEvent[];
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { Component, Input, OnInit } from '@angular/core';
|
|
2
2
|
import { IEvent, IManagedObject } from '@c8y/client';
|
|
3
3
|
import { DynamicComponentAlertAggregator, DynamicComponent } from '@c8y/ngx-components';
|
|
4
|
+
import { FormsModule } from '@angular/forms';
|
|
5
|
+
import { JsonPipe } from '@angular/common';
|
|
4
6
|
import { WidgetConfig } from './widget-config.model';
|
|
5
7
|
|
|
6
8
|
@Component({
|
|
7
9
|
selector: 'app-widget-resolvers',
|
|
8
|
-
templateUrl: './widget-resolvers.component.html'
|
|
10
|
+
templateUrl: './widget-resolvers.component.html',
|
|
11
|
+
standalone: true,
|
|
12
|
+
imports: [FormsModule, JsonPipe]
|
|
9
13
|
})
|
|
10
14
|
export class WidgetResolversComponent implements OnInit, DynamicComponent {
|
|
11
15
|
@Input() config: WidgetConfig;
|
|
@@ -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 {}
|