+
+
+
+
+
+
+ {{ $t('layout.loadMore') }}
+
+
@@ -56,7 +74,38 @@ export default {
data: () => ({
drawer: false,
expanded: 0,
+ canLoadMore: true,
+ layoutAllAppsDrawer: eXo.env.portal.layoutAllAppsDrawer,
+ allApplications: [],
}),
+ computed: {
+ applicationCategories() {
+ const applicationCategories = this.$root.applicationCategories.slice();
+ applicationCategories.forEach(c => c.label = this.$te(`layout.${c.name}`) ? this.$t(`layout.${c.name}`) : c.name);
+ return applicationCategories;
+ },
+ applications() {
+ return this.applicationCategories.flatMap(c => c.applications);
+ },
+ otherApplications() {
+ return this.allApplications.filter(a => !this.applications.find(app => app.contentId === a.contentId));
+ },
+ otherCategories() {
+ return this.otherApplications.reduce((otherCategories, application) => {
+ const category = otherCategories.find(c => c.name === application.categoryName);
+ if (category) {
+ category.applications.push(application);
+ } else {
+ otherCategories.push({
+ name: application.categoryName,
+ label: `
${this.$t('layout.otherApplications')}: ${this.$te(`layout.${application.categoryName}`) ? this.$t(`layout.${application.categoryName}`) : application.categoryName}`,
+ applications: [application],
+ });
+ }
+ return otherCategories;
+ }, []);
+ },
+ },
methods: {
open() {
this.$refs.drawer.endLoading();
@@ -69,6 +118,15 @@ export default {
this.close();
}, 200);
},
+ loadMore() {
+ this.$refs.drawer.startLoading();
+ this.$applicationRegistryService.getApplications('supportedModes')
+ .then(applications => this.allApplications = applications)
+ .finally(() => {
+ this.canLoadMore = false;
+ this.$refs.drawer.endLoading();
+ });
+ },
close() {
this.$refs.drawer.close();
},
diff --git a/layout-webapp/src/main/webapp/vue-app/layout-editor/components/drawer/PageTemplateDrawer.vue b/layout-webapp/src/main/webapp/vue-app/layout-editor/components/drawer/PageTemplateDrawer.vue
index 61a7d90a..1d6fbb50 100644
--- a/layout-webapp/src/main/webapp/vue-app/layout-editor/components/drawer/PageTemplateDrawer.vue
+++ b/layout-webapp/src/main/webapp/vue-app/layout-editor/components/drawer/PageTemplateDrawer.vue
@@ -150,7 +150,7 @@ export default {
this.$refs.drawer.close();
},
save() {
- const pageLayout = this.$layoutUtils.cleanAttributes(this.$root.layout, true);
+ const pageLayout = this.$layoutUtils.cleanAttributes(this.$root.layout, true, true);
const savePageRequest =
this.templateId ? this.$pageTemplateService.updatePageTemplate(pageLayout, this.templateId)
: this.$pageTemplateService.createPageTemplate(pageLayout);
diff --git a/layout-webapp/src/main/webapp/vue-app/layout-editor/components/toolbar/actions/SaveButton.vue b/layout-webapp/src/main/webapp/vue-app/layout-editor/components/toolbar/actions/SaveButton.vue
index 6a4f672e..8a05803f 100644
--- a/layout-webapp/src/main/webapp/vue-app/layout-editor/components/toolbar/actions/SaveButton.vue
+++ b/layout-webapp/src/main/webapp/vue-app/layout-editor/components/toolbar/actions/SaveButton.vue
@@ -43,7 +43,7 @@ export default {
methods: {
savePage() {
this.loading = true;
- const layoutToUpdate = this.$layoutUtils.cleanAttributes(this.$root.layout);
+ const layoutToUpdate = this.$layoutUtils.cleanAttributes(this.$root.layout, false, true);
return this.$pageLayoutService.updatePageLayout(this.$root.pageRef, layoutToUpdate, 'contentId', true)
.then(() => this.$root.$emit('layout-page-saved'))
.catch(() => this.$root.$emit('alert-message', this.$t('layout.pageSavingError'), 'error'))
diff --git a/layout-webapp/src/main/webapp/vue-app/layout-editor/js/LayoutUtils.js b/layout-webapp/src/main/webapp/vue-app/layout-editor/js/LayoutUtils.js
index 8e70dbd0..4ee874be 100644
--- a/layout-webapp/src/main/webapp/vue-app/layout-editor/js/LayoutUtils.js
+++ b/layout-webapp/src/main/webapp/vue-app/layout-editor/js/LayoutUtils.js
@@ -531,12 +531,14 @@ export function isValidTargetMovingCell(section, movingCell, targetRowIndex, tar
export function isBetween(value, b0, b1) {
return value >= b0 && value <= b1;
}
-
-export function cleanAttributes(container, cleanStorage) {
+
+export function cleanAttributes(container, cleanStorage, cleanStyle) {
container = JSON.parse(JSON.stringify(container));
- applyDesktopStyle(container);
+ if (cleanStyle) {
+ applyDesktopStyle(container);
+ }
if (container.children?.length) {
- container.children = container.children.map(c => cleanAttributes(c, cleanStorage));
+ container.children = container.children.map(c => cleanAttributes(c, cleanStorage, cleanStyle));
}
if (container.randomId || cleanStorage) {
delete container.storageId;