Skip to content

Commit 10c4c13

Browse files
Merge pull request #2457 from ReliefApplications/2.x.x
2.x.x
2 parents 9d1ffb9 + 84a1f05 commit 10c4c13

File tree

164 files changed

+4206
-1094
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+4206
-1094
lines changed

.devops/dev-CD.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ steps:
2828
- script: |
2929
npx nx run front-office:build:azure-dev
3030
npx nx run back-office:build:azure-dev
31+
npx nx run web-widgets:build:azure-dev
32+
node .scripts/build-widgets.js
3133
displayName: 'build the apps'
3234

3335
- task: ArchiveFiles@2
@@ -46,6 +48,32 @@ steps:
4648
archiveFile: '$(Build.ArtifactStagingDirectory)/dev/back-office/$(Build.BuildId).zip'
4749
replaceExistingArchive: true
4850

51+
- task: CopyFiles@2
52+
inputs:
53+
SourceFolder: '$(System.DefaultWorkingDirectory)/widgets'
54+
Contents: 'app-builder.js' # Only copy a single file
55+
TargetFolder: '$(Build.ArtifactStagingDirectory)/temp/web-widgets'
56+
57+
- task: CopyFiles@2
58+
inputs:
59+
SourceFolder: '$(System.DefaultWorkingDirectory)/dist/apps/front-office/tinymce'
60+
Contents: '**'
61+
TargetFolder: '$(Build.ArtifactStagingDirectory)/temp/web-widgets/tinymce'
62+
63+
- task: CopyFiles@2
64+
inputs:
65+
SourceFolder: '$(System.DefaultWorkingDirectory)/dist/apps/front-office/assets/i18n'
66+
Contents: '**'
67+
TargetFolder: '$(Build.ArtifactStagingDirectory)/temp/web-widgets/i18n'
68+
69+
- task: ArchiveFiles@2
70+
inputs:
71+
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/temp/web-widgets'
72+
includeRootFolder: false
73+
archiveType: 'zip'
74+
archiveFile: '$(Build.ArtifactStagingDirectory)/dev/web-widgets/$(Build.BuildId).zip'
75+
replaceExistingArchive: true
76+
4977
- task: PublishBuildArtifacts@1
5078
inputs:
5179
PathtoPublish: '$(Build.ArtifactStagingDirectory)/dev/front-office/$(Build.BuildId).zip'
@@ -57,3 +85,9 @@ steps:
5785
PathtoPublish: '$(Build.ArtifactStagingDirectory)/dev/back-office/$(Build.BuildId).zip'
5886
ArtifactName: 'dev-back-office'
5987
publishLocation: 'Container'
88+
89+
- task: PublishBuildArtifacts@1
90+
inputs:
91+
PathtoPublish: '$(Build.ArtifactStagingDirectory)/temp/web-widgets'
92+
ArtifactName: 'dev-web-widgets'
93+
publishLocation: 'Container'

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# [2.10.0](https://github.com/ReliefApplications/ems-frontend/compare/v2.9.0...v2.10.0) (2024-03-01)
2+
3+
4+
### Bug Fixes
5+
6+
* due to query params some components could be duplicated in sui ([faf3986](https://github.com/ReliefApplications/ems-frontend/commit/faf39869bc4244652a9ebef90535697a056360c0))
7+
* fullscreen control would not work in web elements mode ([#2425](https://github.com/ReliefApplications/ems-frontend/issues/2425)) ([4f0dd92](https://github.com/ReliefApplications/ems-frontend/commit/4f0dd9278739affd64cdfaaf46bec90711c67846))
8+
* layers overlay could be hidden on maps, when using fullscreen & web elements ([#2424](https://github.com/ReliefApplications/ems-frontend/issues/2424)) ([49e6db7](https://github.com/ReliefApplications/ems-frontend/commit/49e6db7135137ca4d361e46a8e5dfbfaf2ff74a4))
9+
* map could sometimes disappear on some browsers due to a browser limitation ([79d1a1c](https://github.com/ReliefApplications/ems-frontend/commit/79d1a1cb5bf0a63c0283a9e4db19fc4de6944fd2))
10+
* only one mutation instance supported ([#2419](https://github.com/ReliefApplications/ems-frontend/issues/2419)) ([2b80a9f](https://github.com/ReliefApplications/ems-frontend/commit/2b80a9ff984a6c071480f58619dde678c56e560d))
11+
* selecting some reference data in questions in dashboard filter, using web elements, could not reflect on other pages ([#2420](https://github.com/ReliefApplications/ems-frontend/issues/2420)) ([729957a](https://github.com/ReliefApplications/ems-frontend/commit/729957a69f2b612b19e4edc44d68a6bff2c6395b))
12+
13+
14+
### Features
15+
16+
* allow widgets to build automation rules ([#2422](https://github.com/ReliefApplications/ems-frontend/issues/2422)) ([9457fd4](https://github.com/ReliefApplications/ems-frontend/commit/9457fd4662243216e9145b82d555b901492357c8))
17+
118
# [2.9.0](https://github.com/ReliefApplications/ems-frontend/compare/v2.8.3...v2.9.0) (2024-02-23)
219

320

README.md

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -138,29 +138,20 @@ To test web components, you can:
138138
- execute: `npm i && npm run start`
139139
You should find under the form widget dropdown some form types in order to test the form web component.
140140

141-
<!-- ## Build the web components
141+
### Build the web components
142142

143-
We first need to generate the elements, using this command:
143+
You can use the makefile command:
144144
```
145-
npm run build:elem
145+
make bundle-widgets
146146
```
147147

148-
Then, a bundle can be generated from the files using this command:
148+
By default, the target is azure-dev project, but you can change it like that:
149+
```
150+
make bundle-widgets project=azure-prod
149151
```
150-
npm run bundle:elem
151-
``` -->
152-
153-
<!-- ## Running unit tests
154-
155-
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
156-
157-
## Running end-to-end tests
158-
159-
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). -->
160-
161-
<!-- ## Further help
162152

163-
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). -->
153+
The command will generate a file under the `widgets` folder, called `app-builder.js`.
154+
This is the file you'll need to deploy on Azure blob storage to provide the code.
164155

165156
If you need to upload files to the blob storage where we store shared assets, you can use the az commands.
166157
First, build the front-office in production mode ( any environment, but same version ).

apps/back-office/project.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
"node_modules/leaflet/dist/leaflet.css",
6262
"node_modules/leaflet.markercluster/dist/MarkerCluster.css",
6363
"node_modules/leaflet.markercluster/dist/MarkerCluster.Default.css",
64-
"node_modules/leaflet-fullscreen/dist/leaflet.fullscreen.css",
6564
"node_modules/leaflet-measure/dist/leaflet-measure.css",
6665
"node_modules/esri-leaflet-geocoder/dist/esri-leaflet-geocoder.css",
6766
"node_modules/@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.css"

apps/back-office/src/app/dashboard/pages/dashboard/dashboard.component.ts

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
OnInit,
1010
Output,
1111
Renderer2,
12-
ViewChild,
1312
} from '@angular/core';
1413
import { ActivatedRoute, NavigationEnd, Router } from '@angular/router';
1514
import {
@@ -18,15 +17,15 @@ import {
1817
WorkflowService,
1918
DashboardService,
2019
Application,
21-
UnsubscribeComponent,
22-
WidgetGridComponent,
2320
ConfirmService,
2421
ReferenceDataService,
2522
Record,
2623
ButtonActionT,
2724
ResourceRecordsNodesQueryResponse,
2825
DashboardQueryResponse,
2926
EditDashboardMutationResponse,
27+
DashboardComponent as SharedDashboardComponent,
28+
DashboardAutomationService,
3029
} from '@oort-front/shared';
3130
import { EDIT_DASHBOARD } from './graphql/mutations';
3231
import { GET_DASHBOARD_BY_ID, GET_RESOURCE_RECORDS } from './graphql/queries';
@@ -61,16 +60,20 @@ const ITEMS_PER_PAGE = 10;
6160
selector: 'app-dashboard',
6261
templateUrl: './dashboard.component.html',
6362
styleUrls: ['./dashboard.component.scss'],
63+
providers: [
64+
{
65+
provide: SharedDashboardComponent,
66+
useClass: DashboardComponent,
67+
},
68+
DashboardAutomationService,
69+
],
6470
})
6571
export class DashboardComponent
66-
extends UnsubscribeComponent
72+
extends SharedDashboardComponent
6773
implements OnInit, OnDestroy
6874
{
6975
/** Change step event ( in workflow ) */
7076
@Output() changeStep: EventEmitter<number> = new EventEmitter();
71-
/** Widget grid reference */
72-
@ViewChild(WidgetGridComponent)
73-
widgetGridComponent!: WidgetGridComponent;
7477
/** Is dashboard in fullscreen mode */
7578
public isFullScreen = false;
7679
/** Dashboard id */
@@ -79,8 +82,6 @@ export class DashboardComponent
7982
public applicationId?: string;
8083
/** Is dashboard loading */
8184
public loading = true;
82-
/** List of widgets */
83-
public widgets: any[] = [];
8485
/** Current dashboard */
8586
public dashboard?: Dashboard;
8687
/** Show dashboard filter */
@@ -150,6 +151,7 @@ export class DashboardComponent
150151
* @param layoutService Shared layout service
151152
* @param document Document
152153
* @param clipboard Angular clipboard service
154+
* @param dashboardAutomationService Dashboard automation service
153155
*/
154156
constructor(
155157
private applicationService: ApplicationService,
@@ -168,9 +170,11 @@ export class DashboardComponent
168170
private elementRef: ElementRef,
169171
private layoutService: UILayoutService,
170172
@Inject(DOCUMENT) private document: Document,
171-
private clipboard: Clipboard
173+
private clipboard: Clipboard,
174+
private dashboardAutomationService: DashboardAutomationService
172175
) {
173176
super();
177+
this.dashboardAutomationService.dashboard = this;
174178
}
175179

176180
ngOnInit(): void {
@@ -277,6 +281,7 @@ export class DashboardComponent
277281
return widget;
278282
}) || []
279283
);
284+
this.dashboardService.widgets.next(this.widgets);
280285
this.applicationId = this.dashboard.page
281286
? this.dashboard.page.application?.id
282287
: this.dashboard.step
@@ -486,10 +491,14 @@ export class DashboardComponent
486491
})
487492
.subscribe({
488493
next: ({ errors }) => {
489-
this.applicationService.handleEditionMutationResponse(
490-
errors,
491-
this.translate.instant('common.dashboard.one')
492-
);
494+
if (errors) {
495+
this.applicationService.handleEditionMutationResponse(
496+
errors,
497+
this.translate.instant('common.dashboard.one')
498+
);
499+
} else {
500+
this.dashboardService.widgets.next(this.widgets);
501+
}
493502
},
494503
complete: () => (this.loading = false),
495504
});

apps/back-office/src/app/dashboard/pages/resource/aggregations-tab/aggregations-tab.component.html

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,8 @@
55
[dataSource]="aggregations"
66
[canUpdate]="resource.canUpdate ?? false"
77
[displayedColumns]="displayedColumnsAggregations"
8+
[pageInfo]="pageInfo"
9+
(pageChange)="onPage($event)"
810
(itemAction)="handleAction($event)"
911
>
10-
<ng-container ngProjectAs="pagination">
11-
<ui-paginator
12-
[disabled]="loading"
13-
[pageIndex]="pageInfo.pageIndex"
14-
[pageSize]="pageInfo.pageSize"
15-
[pageSizeOptions]="[10, 25, 50]"
16-
[totalItems]="pageInfo.length"
17-
(pageChange)="onPage($event)"
18-
>
19-
</ui-paginator>
20-
</ng-container>
2112
</app-data-presentation-list>

apps/back-office/src/app/dashboard/pages/resource/aggregations-tab/aggregations-tab.module.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { AggregationsTabRoutingModule } from './aggregations-tab-routing.module'
44
import { OverlayModule } from '@angular/cdk/overlay';
55
import { AggregationBuilderModule } from '@oort-front/shared';
66
import { AggregationsTabComponent } from './aggregations-tab.component';
7-
import { PaginatorModule } from '@oort-front/ui';
87
import { DataPresentationListComponent } from '../components/data-presentation-list/data-presentation-list.component';
98

109
/**
@@ -17,7 +16,6 @@ import { DataPresentationListComponent } from '../components/data-presentation-l
1716
AggregationsTabRoutingModule,
1817
AggregationBuilderModule,
1918
OverlayModule,
20-
PaginatorModule,
2119
DataPresentationListComponent,
2220
],
2321
})

apps/back-office/src/app/dashboard/pages/resource/components/data-presentation-list/data-presentation-list.component.html

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,15 @@
7373
</div>
7474
</div>
7575
<!-- Pagination -->
76-
<ng-content select="pagination"></ng-content>
76+
<ui-paginator
77+
[disabled]="loading"
78+
[pageIndex]="pageInfo.pageIndex"
79+
[pageSize]="pageInfo.pageSize"
80+
[pageSizeOptions]="[10, 25, 50]"
81+
[totalItems]="pageInfo.length"
82+
(pageChange)="onPage($event)"
83+
>
84+
</ui-paginator>
7785
</ng-container>
7886
<ng-template #emptyTmpl>
7987
<!-- Empty indicator -->

apps/back-office/src/app/dashboard/pages/resource/components/data-presentation-list/data-presentation-list.component.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ import {
1313
DividerModule,
1414
IconModule,
1515
MenuModule,
16+
PaginatorModule,
1617
TableModule,
1718
TooltipModule,
19+
UIPageChangeEvent,
1820
} from '@oort-front/ui';
1921

2022
/**
@@ -35,6 +37,7 @@ import {
3537
TranslateModule,
3638
TooltipModule,
3739
DateModule,
40+
PaginatorModule,
3841
],
3942
templateUrl: './data-presentation-list.component.html',
4043
styleUrls: ['./data-presentation-list.component.scss'],
@@ -65,6 +68,16 @@ export class DataPresentationListComponent {
6568
*/
6669
@Input() displayedColumns: string[] = [];
6770

71+
/**
72+
* Page information of the current displayed list
73+
*/
74+
@Input() pageInfo = {
75+
pageIndex: 0,
76+
pageSize: 10,
77+
length: 0,
78+
endCursor: '',
79+
};
80+
6881
/**
6982
* Event emitter for the item action
7083
*/
@@ -76,6 +89,12 @@ export class DataPresentationListComponent {
7689
item: Aggregation | Layout | null | undefined;
7790
}>();
7891

92+
/**
93+
* Page change event emit from pagination
94+
*/
95+
@Output()
96+
pageChange = new EventEmitter<UIPageChangeEvent>();
97+
7998
/** @returns True if the dataSource tab is empty */
8099
get empty(): boolean {
81100
return !this.loading && this.dataSource.length === 0;
@@ -93,4 +112,13 @@ export class DataPresentationListComponent {
93112
) {
94113
this.itemAction.emit({ type, item });
95114
}
115+
116+
/**
117+
* Emit pagination change event to parent component
118+
*
119+
* @param event Current UI page change event
120+
*/
121+
onPage(event: UIPageChangeEvent) {
122+
this.pageChange.emit(event);
123+
}
96124
}

apps/back-office/src/app/dashboard/pages/resource/layouts-tab/layouts-tab.component.html

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,8 @@
55
[dataSource]="layouts"
66
[canUpdate]="resource.canUpdate ?? false"
77
[displayedColumns]="displayedColumnsLayouts"
8+
[pageInfo]="pageInfo"
9+
(pageChange)="onPage($event)"
810
(itemAction)="handleAction($event)"
911
>
10-
<ng-container ngProjectAs="pagination">
11-
<ui-paginator
12-
[disabled]="loading"
13-
[pageIndex]="pageInfo.pageIndex"
14-
[pageSize]="pageInfo.pageSize"
15-
[pageSizeOptions]="[10, 25, 50]"
16-
[totalItems]="pageInfo.length"
17-
(pageChange)="onPage($event)"
18-
>
19-
</ui-paginator>
20-
</ng-container>
2112
</app-data-presentation-list>

0 commit comments

Comments
 (0)