Skip to content

Commit

Permalink
Merge branch '28177-uve-dot-wizard-component-is-rendering-behind-prim…
Browse files Browse the repository at this point in the history
…eng-dialog' of https://github.com/dotCMS/core into 28177-uve-dot-wizard-component-is-rendering-behind-primeng-dialog
  • Loading branch information
kevindaviladev committed Aug 8, 2024
2 parents 8478369 + 5b159a4 commit 2f7336a
Show file tree
Hide file tree
Showing 67 changed files with 1,602 additions and 742 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/publish-starter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ jobs:
- uses: jfrog/setup-jfrog-cli@v4
env:
JF_URL: ${{ vars.ARTIFACTORY_URL }}
JF_ACCESS_TOKEN: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}

JF_USER: ${{ secrets.EE_REPO_USERNAME }}
JF_PASSWORD: ${{ secrets.EE_REPO_PASSWORD }}

- name: 'JFrog CLI context'
run: |
echo "::group::JFrog CLI context"
Expand Down
7 changes: 7 additions & 0 deletions .mvn/extensions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<extensions>
<extension>
<groupId>org.apache.maven.extensions</groupId>
<artifactId>maven-build-cache-extension</artifactId>
<version>1.2.0</version>
</extension>
</extensions>
34 changes: 34 additions & 0 deletions .mvn/maven-build-cache-config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!--
Opted for a simple configuration to cache the build output of the project.
For a full featured example, see:
https://maven.apache.org/extensions/maven-build-cache-extension/maven-build-cache-config.xml
-->

<cache xmlns="http://maven.apache.org/BUILD-CACHE-CONFIG/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/BUILD-CACHE-CONFIG/1.0.0 https://maven.apache.org/xsd/build-cache-config-1.0.0.xsd">
<configuration>
<enabled>true</enabled>
<hashAlgorithm>SHA-256</hashAlgorithm>
<validateXml>true</validateXml>
<local>
<maxBuildsCached>3</maxBuildsCached>
</local>
<projectVersioning adjustMetaInf="true"/>
</configuration>
<input>
<global>
<glob> {*.java,*.yaml,*.properties,*.js,*.ts,*.json,*.xml,*.mjs,*.jsp} </glob>
<includes>
<include>src/</include>
</includes>
<excludes>
<exclude>temp.out</exclude>
</excludes>
</global>
</input>
</cache>
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,29 @@ describe('DotEditLayoutComponent', () => {
fixture.detectChanges();
});

it('should change pageState', () => {
const res: DotPageRender = new DotPageRender({
...mockDotRenderedPage(),
layout: fakeLayout
});

spyOn(dotPageLayoutService, 'save').and.returnValue(of(res));

layoutDesignerDe.triggerEventHandler('save', {
themeId: '123',
layout: fakeLayout,
title: null
});

// The initial value
expect(component.pageState).not.toEqual(PAGE_STATE);
});

it('should save the layout', () => {
const res: DotPageRender = new DotPageRender(mockDotRenderedPage());
const res: DotPageRender = new DotPageRender({
...mockDotRenderedPage(),
layout: fakeLayout
});
spyOn(dotPageLayoutService, 'save').and.returnValue(of(res));

layoutDesignerDe.triggerEventHandler('save', {
Expand All @@ -238,11 +259,15 @@ describe('DotEditLayoutComponent', () => {
'/default/': processedContainers[0].container,
'/banner/': processedContainers[1].container
});
expect(component.pageState).toEqual(new DotPageRender(mockDotRenderedPage()));

expect(component.pageState).toEqual(res);
});

it(`should save the layout after ${DEBOUNCE_TIME}`, fakeAsync(() => {
const res: DotPageRender = new DotPageRender(mockDotRenderedPage());
const res: DotPageRender = new DotPageRender({
...mockDotRenderedPage(),
layout: fakeLayout
});
spyOn(dotPageLayoutService, 'save').and.returnValue(of(res));

layoutDesignerDe.triggerEventHandler('updateTemplate', {
Expand All @@ -265,11 +290,14 @@ describe('DotEditLayoutComponent', () => {
'/default/': processedContainers[0].container,
'/banner/': processedContainers[1].container
});
expect(component.pageState).toEqual(new DotPageRender(mockDotRenderedPage()));
expect(component.pageState).toEqual(res);
}));

it('should save the layout instantly when closeEditLayout is true', () => {
const res: DotPageRender = new DotPageRender(mockDotRenderedPage());
const res: DotPageRender = new DotPageRender({
...mockDotRenderedPage(),
layout: fakeLayout
});
spyOn(dotPageLayoutService, 'save').and.returnValue(of(res));

layoutDesignerDe.triggerEventHandler('updateTemplate', {
Expand All @@ -293,11 +321,14 @@ describe('DotEditLayoutComponent', () => {
'/default/': processedContainers[0].container,
'/banner/': processedContainers[1].container
});
expect(component.pageState).toEqual(new DotPageRender(mockDotRenderedPage()));
expect(component.pageState).toEqual(res);
});

it('should not save the layout when observable is destroy', fakeAsync(() => {
const res: DotPageRender = new DotPageRender(mockDotRenderedPage());
const res: DotPageRender = new DotPageRender({
...mockDotRenderedPage(),
layout: fakeLayout
});
spyOn(dotPageLayoutService, 'save').and.returnValue(of(res));

// Destroy should be true.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ export class DotEditLayoutComponent implements OnInit, OnDestroy {
.subscribe((state: DotPageRenderState) => {
this.updatePageState(state);

this.containerMap = this.pageState.containerMap; // containerMap from pageState is a get property, which causes to trigger a function everytime the Angular change detection runs.

const mappedContainers = this.getRemappedContainers(state.containers);
this.templateContainersCacheService.set(mappedContainers);
});
Expand Down Expand Up @@ -102,9 +100,10 @@ export class DotEditLayoutComponent implements OnInit, OnDestroy {
* @param {DotPageRenderState} newState
* @memberof DotEditLayoutComponent
*/
updatePageState(newState: DotPageRenderState) {
updatePageState(newState: DotPageRenderState | DotPageRender) {
this.pageState = newState;
this.templateIdentifier.set(newState.template.identifier);
this.containerMap = newState.containerMap;
}

/**
Expand Down Expand Up @@ -204,7 +203,8 @@ export class DotEditLayoutComponent implements OnInit, OnDestroy {
this.dotMessageService.get('dot.common.message.saved')
);
this.templateIdentifier.set(updatedPage.template.identifier);
this.containerMap = updatedPage.containerMap; // containerMap from pageState is a get property, which causes to trigger a function everytime the Angular change detection runs.
// We need to pass the new layout to the template builder to sync the value with the backend
this.updatePageState(updatedPage);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ describe('DotEmaShellComponent', () => {
get({ language_id }) {
return PAGE_RESPONSE_BY_LANGUAGE_ID[language_id];
},
getClientPage({ language_id }, _clientConfig) {
return PAGE_RESPONSE_BY_LANGUAGE_ID[language_id];
},
save() {
return of({});
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { DotMessagePipe } from '@dotcms/ui';

import { DEFAULT_PERSONA } from '../../../shared/consts';
import { UVEStore } from '../../../store/dot-uve.store';
import { compareUrlPaths } from '../../../utils';
import { DotEditEmaWorkflowActionsComponent } from '../dot-edit-ema-workflow-actions/dot-edit-ema-workflow-actions.component';
import { DotEmaBookmarksComponent } from '../dot-ema-bookmarks/dot-ema-bookmarks.component';
import { DotEmaInfoDisplayComponent } from '../dot-ema-info-display/dot-ema-info-display.component';
Expand Down Expand Up @@ -202,8 +203,10 @@ export class EditEmaToolbarComponent {
language_id: languageId?.toString()
};

if (this.shouldReload(params)) {
if (this.shouldNavigateToNewPage(params)) {
this.updateQueryParams(params);
} else {
this.uveStore.reload();
}
}

Expand Down Expand Up @@ -250,10 +253,10 @@ export class EditEmaToolbarComponent {
});
}

private shouldReload(params: Params): boolean {
private shouldNavigateToNewPage(params: Params): boolean {
const { url: newUrl, language_id: newLanguageId } = params;
const { url, language_id } = this.uveStore.params();

return newUrl != url || newLanguageId != language_id;
return !compareUrlPaths(newUrl, url) || newLanguageId != language_id;
}
}
Loading

0 comments on commit 2f7336a

Please sign in to comment.