Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix Switch Page From Link to Page - MEED-6882 - Meeds-io/meeds#2019 #68

Merged
merged 1 commit into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ public NodeData createDraftNode(Long nodeId, String username) throws ObjectNotFo
getNodeLabels(nodeId, username).getLabels()),
username);
} else {
NodeState state = clonedNode.getState().builder().pageRef(clonedPageKey).build();
navigationService.updateNode(Long.parseLong(clonedNode.getId()), state);
return navigationService.getNodeById(Long.parseLong(clonedNode.getId()));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</template>
<v-list class="pa-0" dense>
<v-list-item
v-if="canEditPage"
v-if="canEditPageLayout"
class="subtitle-2"
@click="editLayout">
<v-icon
Expand Down Expand Up @@ -234,6 +234,12 @@ export default {
canEditPage() {
return this.navigationNode?.canEditPage && this.pageRef;
},
pageLink() {
return this.navigationNode?.pageLink;
},
canEditPageLayout() {
return this.canEditPage && !this.pageLink;
},
},
watch: {
displayActionMenu() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,13 @@ export default {
this.loading = false;
} else {
this.loading = true;
this.$pageLayoutService.createPage(this.elementName, this.elementTitle, this.navigationNode.siteKey.name, this.navigationNode.siteKey.type, this.elementType, this.elementType === 'LINK' && this.link || null, this.elementType === 'PAGE' && this.pageTemplate?.id)
this.$pageLayoutService.createPage(
this.elementName,
this.elementTitle,
this.navigationNode.siteKey.name,
this.navigationNode.siteKey.type,
this.elementType, this.elementType === 'LINK' && this.link || null,
this.elementType === 'PAGE' && this.pageTemplate?.id || null)
.then((createdPage) => {
const pageRef = createdPage?.key?.ref || `${createdPage?.key.site.typeName}::${createdPage?.key.site.name}::${createdPage?.pageContext?.key.name}`;
this.$root.$emit('save-node-with-page', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ export default {
this.loading = true;
this.$navigationLayoutService.updateNode(this.navigationNode.id, this.nodeLabel, pageRef, this.visible, this.isScheduled, startScheduleDate, endScheduleDate, nodeLabels?.labels, pageData?.nodeTarget || this.navigationNode.target, this.nodeIcon)
.then(() => {
this.openTargetPage(pageData);
this.openTargetPage(pageData, this.navigationNode.id);
this.$root.$emit('refresh-navigation-nodes');
this.$root.$emit('close-add-element-drawer');
this.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default {
return this.getQueryParam('pageId') || this.pageKey?.ref || (this.pageKey && `${this.pageKey.site.typeName}::${this.pageKey.site.name}::${this.pageKey.name}`);
},
nodeId() {
return this.getQueryParam('nodeId') || eXo.env.portal.selectedNodeId;
return this.getQueryParam('nodeId') || (this.pageTemplateId && eXo.env.portal.selectedNodeId);
},
draftNodeId() {
return this.draftNode?.id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ export default {
},
setLayout(layout) {
this.initContainer(layout);
this.isCompatible = this.$layoutUtils.parseSections(layout);
if (!this.isCompatible) {
const isCompatible = this.$layoutUtils.parseSections(layout);
if (!isCompatible) {
const applications = this.$layoutUtils.getApplications(layout);
layout.children = [];
const parentContainer = this.$layoutUtils.newParentContainer(layout);
Expand All @@ -162,6 +162,7 @@ export default {
if (applications?.length && applications?.length > 1) {
this.$layoutUtils.newSection(parentContainer, 1, 1, 2, this.$layoutUtils.flexTemplate);
}
this.isCompatible = !applications?.length;
this.modified = true;
}
if (this.layoutToEdit) {
Expand Down
Loading