Skip to content

Commit 5a83637

Browse files
Merge pull request #2413 from ReliefApplications/2.x.x
2.x.x
2 parents 98f7b5e + 180c4c3 commit 5a83637

File tree

66 files changed

+1733
-484
lines changed

Some content is hidden

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

66 files changed

+1733
-484
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,12 @@ Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protrac
162162
163163
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). -->
164164

165+
If you need to upload files to the blob storage where we store shared assets, you can use the az commands.
166+
First, build the front-office in production mode ( any environment, but same version ).
167+
Then, run:
168+
169+
az storage blob upload-batch --destination {container} --account-name {accountname} --destination-path {path-to-folder-in-container} --source {path-to-folder-locally}
170+
165171
# Common issues
166172

167173
## Javascript heap out of memory

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
ResourceDropdownComponent,
1010
ResourceSelectTextComponent,
1111
TestServiceDropdownComponent,
12+
CodeEditorComponent,
1213
} from '@oort-front/shared';
1314
import { TranslateService } from '@ngx-translate/core';
1415
import { environment } from '../environments/environment';
@@ -32,6 +33,7 @@ export class AppComponent implements OnInit {
3233
ResourceDropdownComponent,
3334
ResourceSelectTextComponent,
3435
TestServiceDropdownComponent,
36+
CodeEditorComponent,
3537
];
3638
/** Application title */
3739
title = 'back-office';

apps/web-widgets/project.json

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,46 @@
8383
"maximumError": "2mb"
8484
}
8585
],
86+
"fileReplacements": [
87+
{
88+
"replace": "apps/web-widgets/src/environments/environment.ts",
89+
"with": "apps/web-widgets/src/environments/environment.azure.uat.ts"
90+
}
91+
],
92+
"outputHashing": "none",
8693
"stylePreprocessorOptions": {
8794
"includePaths": [
8895
"libs/styles/src/lib/themes/default",
8996
"apps/web-widgets/src/app/styles"
9097
]
91-
},
98+
}
99+
},
100+
"azure-local": {
92101
"fileReplacements": [
93102
{
94103
"replace": "apps/web-widgets/src/environments/environment.ts",
95-
"with": "apps/web-widgets/src/environments/environment.azure.uat.ts"
104+
"with": "apps/web-widgets/src/environments/environment.azure.local.ts"
96105
}
97106
],
98-
"outputHashing": "none"
107+
"budgets": [
108+
{
109+
"type": "initial",
110+
"maximumWarning": "12mb",
111+
"maximumError": "15mb"
112+
},
113+
{
114+
"type": "anyComponentStyle",
115+
"maximumWarning": "1mb",
116+
"maximumError": "2mb"
117+
}
118+
],
119+
"outputHashing": "none",
120+
"stylePreprocessorOptions": {
121+
"includePaths": [
122+
"libs/styles/src/lib/themes/default",
123+
"apps/web-widgets/src/app/styles"
124+
]
125+
}
99126
},
100127
"oort-dev": {
101128
"budgets": [

apps/web-widgets/src/app/widgets/app-widget/app-widget.component.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
EventEmitter,
55
Injector,
66
Input,
7+
OnDestroy,
78
OnInit,
89
Output,
910
ViewEncapsulation,
@@ -18,7 +19,7 @@ import {
1819
WorkflowService,
1920
MapLayersService,
2021
} from '@oort-front/shared';
21-
import { debounceTime } from 'rxjs';
22+
import { Subject, debounceTime, takeUntil } from 'rxjs';
2223
import { isEmpty } from 'lodash';
2324
import { ShadowDomService } from '@oort-front/ui';
2425
import { Router } from '@angular/router';
@@ -41,7 +42,7 @@ import { Router } from '@angular/router';
4142
})
4243
export class AppWidgetComponent
4344
extends ShadowRootExtendedHostComponent
44-
implements OnInit
45+
implements OnInit, OnDestroy
4546
{
4647
/** Application Id */
4748
@Input()
@@ -87,6 +88,8 @@ export class AppWidgetComponent
8788
/** Available pages */
8889
@Output()
8990
pages = new EventEmitter<any[]>();
91+
/** Trigger subscription teardown on component destruction */
92+
private destroy$: Subject<void> = new Subject<void>();
9093

9194
/**
9295
* Application as Web Widget.
@@ -106,7 +109,7 @@ export class AppWidgetComponent
106109
private router: Router,
107110
private shadowDomService: ShadowDomService
108111
) {
109-
console.log('DEBUG: build from 02/14/2023');
112+
console.log('DEBUG: build from 02/22/2023');
110113
super(el, injector);
111114
this.shadowDomService.shadowRoot = el.nativeElement.shadowRoot;
112115
this.contextService.filter$
@@ -115,8 +118,9 @@ export class AppWidgetComponent
115118
this.filterActive$.emit(!isEmpty(current));
116119
this.filter$.emit(current);
117120
});
118-
this.applicationService.application$.subscribe(
119-
(application: Application | null) => {
121+
this.applicationService.application$
122+
.pipe(takeUntil(this.destroy$))
123+
.subscribe((application: Application | null) => {
120124
if (application) {
121125
const pages = application.pages
122126
?.filter((x) => x.content)
@@ -134,8 +138,7 @@ export class AppWidgetComponent
134138
} else {
135139
this.pages.emit([]);
136140
}
137-
}
138-
);
141+
});
139142
}
140143

141144
/**
@@ -196,4 +199,9 @@ export class AppWidgetComponent
196199
return 'dashboard';
197200
}
198201
}
202+
203+
ngOnDestroy(): void {
204+
this.destroy$.next();
205+
this.destroy$.complete();
206+
}
199207
}

apps/web-widgets/src/app/widgets/app-widget/application/pages/dashboard/dashboard.component.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
*ngIf="!loading && showFilter && !isFullScreen"
33
[isFullScreen]="isFullScreen"
44
variant="modern"
5-
[opened]="true"
5+
[opened]="$any(dashboard?.filter?.show)"
6+
[closable]="$any(dashboard?.filter?.closable)"
67
[dashboard]="dashboard"
78
[structure]="dashboard?.filter?.structure"
89
></shared-dashboard-filter>
@@ -17,7 +18,8 @@
1718
*ngIf="!loading && showFilter && isFullScreen"
1819
[editable]="true"
1920
[isFullScreen]="isFullScreen"
20-
[opened]="true"
21+
[opened]="$any(dashboard?.filter?.show)"
22+
[closable]="$any(dashboard?.filter?.closable)"
2123
[dashboard]="dashboard"
2224
[structure]="dashboard?.filter?.structure"
2325
></shared-dashboard-filter>

apps/web-widgets/src/environments/environment.azure.dev.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ export const environment = {
3030
availableLanguages: ['en', 'test'],
3131
authConfig,
3232
theme,
33-
tinymceBaseUrl: 'https://ems-safe-dev.who.int/tinymce',
34-
i18nUrl: 'https://ems-safe-dev.who.int/assets/i18n/',
33+
tinymceBaseUrl: 'https://ems2-dev.who.int/app-builder/tinymce',
34+
i18nUrl: 'https://ems2-dev.who.int/app-builder/i18n/',
3535
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { environment as devEnvironment } from './environment.azure.dev';
2+
3+
/**
4+
* Environment file for local development.
5+
* Similar to dev, but with different urls, so no CORS issues.
6+
*/
7+
export const environment = {
8+
...devEnvironment,
9+
tinymceBaseUrl:
10+
'https://whoemssafedsta03.blob.core.windows.net/shared/dev/tinymce/',
11+
i18nUrl: 'https://whoemssafedsta03.blob.core.windows.net/shared/dev/i18n/',
12+
};

apps/web-widgets/src/environments/environment.azure.uat.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ export const environment = {
2929
availableLanguages: ['en', 'test'],
3030
authConfig,
3131
theme,
32+
tinymceBaseUrl: 'https://ems2-test.who.int/app-builder/tinymce',
33+
i18nUrl: 'https://ems2-test.who.int/app-builder/i18n/',
3234
};

libs/shared/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export * from './lib/survey/components/resource-custom-filters/resource-custom-f
111111
export * from './lib/survey/components/resource-dropdown/resource-dropdown.component';
112112
export * from './lib/survey/components/resource-select-text/resource-select-text.component';
113113
export * from './lib/survey/components/test-service-dropdown/test-service-dropdown.component';
114+
export * from './lib/survey/components/code-editor/code-editor.component';
114115

115116
/** Grid Layouts */
116117
export * from './lib/components/grid-layout/edit-layout-modal/public-api';

libs/shared/src/lib/components/aggregation/aggregation-grid/aggregation-grid.component.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, Input, OnChanges, OnInit } from '@angular/core';
1+
import { Component, ElementRef, Input, OnChanges, OnInit } from '@angular/core';
22
import { GridDataResult, PageChangeEvent } from '@progress/kendo-angular-grid';
33
import { Apollo, QueryRef } from 'apollo-angular';
44
import {
@@ -9,7 +9,7 @@ import { AggregationBuilderService } from '../../../services/aggregation-builder
99
import { AggregationService } from '../../../services/aggregation/aggregation.service';
1010
import { PAGER_SETTINGS } from './aggregation-grid.constants';
1111
import { GET_RESOURCE } from './graphql/queries';
12-
import { Subject, debounceTime, from, merge, takeUntil } from 'rxjs';
12+
import { Subject, debounceTime, filter, from, merge, takeUntil } from 'rxjs';
1313
import { TranslateService } from '@ngx-translate/core';
1414
import { QueryBuilderService } from '../../../services/query-builder/query-builder.service';
1515
import { GridService } from '../../../services/grid/grid.service';
@@ -99,6 +99,7 @@ export class AggregationGridComponent
9999
* @param apollo Apollo service
100100
* @param translate Angular translate service
101101
* @param contextService Shared context service
102+
* @param {ElementRef} el Current components element ref in the DOM
102103
*/
103104
constructor(
104105
private aggregationService: AggregationService,
@@ -107,7 +108,8 @@ export class AggregationGridComponent
107108
private gridService: GridService,
108109
private apollo: Apollo,
109110
private translate: TranslateService,
110-
private contextService: ContextService
111+
private contextService: ContextService,
112+
private el: ElementRef
111113
) {
112114
super();
113115
}
@@ -116,7 +118,19 @@ export class AggregationGridComponent
116118
// Listen to dashboard filters changes if it is necessary
117119
if (this.contextService.filterRegex.test(this.contextFilters as string)) {
118120
this.contextService.filter$
119-
.pipe(debounceTime(500), takeUntil(this.destroy$))
121+
.pipe(
122+
// On working with web components we want to send filter value if this current element is in the DOM
123+
// Otherwise send value always
124+
filter(() =>
125+
this.contextService.shadowDomService.isShadowRoot
126+
? this.contextService.shadowDomService.currentHost.contains(
127+
this.el.nativeElement
128+
)
129+
: true
130+
),
131+
debounceTime(500),
132+
takeUntil(this.destroy$)
133+
)
120134
.subscribe(({ previous, current }) => {
121135
if (
122136
this.contextService.shouldRefresh(this.widget, previous, current)

0 commit comments

Comments
 (0)