From fb534a8b7c064edd9c23c1c4c3fd6aa3aa679293 Mon Sep 17 00:00:00 2001 From: "Damian A. Pastorini" Date: Tue, 23 Jul 2024 06:59:26 +0200 Subject: [PATCH] - Reldens - v4.0.0 - Maps Wizard WIP. --- lib/admin/server/admin-manager.js | 51 +++++++++++++++++- lib/admin/server/admin-translations.js | 1 + lib/admin/server/templates-list.js | 1 + theme/admin/reldens-admin-client.scss | 16 ++++++ theme/admin/templates/maps-wizard.html | 72 ++++++++++++++++++++++++++ 5 files changed, 139 insertions(+), 2 deletions(-) create mode 100644 theme/admin/templates/maps-wizard.html diff --git a/lib/admin/server/admin-manager.js b/lib/admin/server/admin-manager.js index 48f3da52..d4680961 100644 --- a/lib/admin/server/admin-manager.js +++ b/lib/admin/server/admin-manager.js @@ -60,6 +60,7 @@ class AdminManager this.savePath = '/save'; this.deletePath = '/delete'; this.managementPath = '/management'; + this.mapsWizardPath = '/maps-wizard'; this.adminEntitiesGenerator = new AdminEntitiesGenerator(); this.uploaderFactory = new UploaderFactory(); } @@ -139,6 +140,7 @@ class AdminManager this.adminContents.login = await this.buildLogin(); this.adminContents.dashboard = await this.buildDashboard(); this.adminContents.management = await this.buildManagement(); + this.adminContents.mapsWizard = await this.buildMapsWizard(); this.adminContents.entities = await this.buildEntitiesContents(); } @@ -160,7 +162,14 @@ class AdminManager async buildSideBar() { - let navigationContents = {}; + let navigationContents = { + 'Wizards': { + [this.translations.labels['mapsWizard']]: await this.render( + this.adminFilesContents.sideBarItem, + {name: this.translations.labels['mapsWizard'], path: this.rootPath+this.mapsWizardPath} + ) + } + }; for(let driverResource of this.resources){ let navigation = driverResource.options?.navigation; let name = this.translations.labels[driverResource.id()] || this.translations.labels[driverResource.entityKey]; @@ -180,7 +189,7 @@ class AdminManager {name, path} ); } - navigationContents['Server'] = {'Maintenance': await this.render( + navigationContents['Server'] = {'Management': await this.render( this.adminFilesContents.sideBarItem, {name: this.translations.labels['management'], path: this.rootPath+this.managementPath} )}; @@ -265,6 +274,27 @@ class AdminManager ); } + async buildMapsWizard() + { + let pageContent = await this.render( + this.adminFilesContents.mapsWizard, + { + actionPath: this.rootPath+this.mapsWizardPath + } + ); + return await this.render( + this.adminContents.layout, + { + sideBar: this.adminContents.sideBar, + pageContent, + stylesFilePath: this.stylesFilePath, + scriptsFilePath: this.scriptsFilePath, + brandingCompanyName: this.branding.companyName, + copyRight: this.branding.copyRight + } + ); + } + async buildEntitiesContents() { let entitiesContents = {}; @@ -571,6 +601,23 @@ class AdminManager return res.redirect(redirectManagementPath+'?result=success'); } ); + // maps-wizard routes: + this.adminRouter.get( + this.mapsWizardPath, + this.isAuthenticated.bind(this), + async (req, res) => { + let rendererContent = await this.render(this.adminContents.mapsWizard, this.fetchShuttingDownData()); + return res.send(rendererContent); + } + ); + this.adminRouter.post( + this.mapsWizardPath, + this.isAuthenticated.bind(this), + async (req, res) => { + let redirectManagementPath = this.rootPath+this.mapsWizardPath; + return res.redirect(redirectManagementPath+'?result=success'); + } + ); // apply the adminRouter to the /admin path: this.app.use(this.rootPath, this.adminRouter); } diff --git a/lib/admin/server/admin-translations.js b/lib/admin/server/admin-translations.js index 134a1512..a78412a7 100644 --- a/lib/admin/server/admin-translations.js +++ b/lib/admin/server/admin-translations.js @@ -29,6 +29,7 @@ class AdminTranslations loginWelcome: 'Reldens', pages: 'Server Management', management: 'Management', + mapsWizard: 'Maps Generation', shuttingDown: 'Server is shutting down in:', submitShutdownLabel: 'Shutdown Server', submitCancelLabel: 'Cancel Server Shutdown', diff --git a/lib/admin/server/templates-list.js b/lib/admin/server/templates-list.js index 17592419..dc94fc4d 100644 --- a/lib/admin/server/templates-list.js +++ b/lib/admin/server/templates-list.js @@ -8,6 +8,7 @@ module.exports.TemplatesList = { login: 'login.html', dashboard: 'dashboard.html', management: 'management.html', + mapsWizard: 'maps-wizard.html', list: 'list.html', listContent: 'list-content.html', view: 'view.html', diff --git a/theme/admin/reldens-admin-client.scss b/theme/admin/reldens-admin-client.scss index 90ddf7da..6ea61b2d 100644 --- a/theme/admin/reldens-admin-client.scss +++ b/theme/admin/reldens-admin-client.scss @@ -500,6 +500,22 @@ $darkGreen: #27ae60; } } + + textarea { + position: relative; + display: block; + width: 98%; + padding: 1%; + margin: 1rem 0; + } + } + + .maps-wizard { + .main-option { + display: inline-block; + cursor: pointer; + margin-bottom: 1rem; + } } .entity-view, .entity-edit { diff --git a/theme/admin/templates/maps-wizard.html b/theme/admin/templates/maps-wizard.html new file mode 100644 index 00000000..2707bc10 --- /dev/null +++ b/theme/admin/templates/maps-wizard.html @@ -0,0 +1,72 @@ +

Maps Wizard

+
+
+
+
+

What would you like to do?

+
    +
  • + + +
    +
    + + +
    +
    + + +
    +
    +
  • +
  • + + +
    +
    + + +
    +
    + + +
    +
    +
  • +
  • + + +
  • +
  • + + +
  • + +
+ + +
+
+
+