diff --git a/zero.Core/Api/ApplicationContext.cs b/zero.Core/Api/ApplicationContext.cs index e8ccb2e6..967f4f8b 100644 --- a/zero.Core/Api/ApplicationContext.cs +++ b/zero.Core/Api/ApplicationContext.cs @@ -66,7 +66,7 @@ namespace zero.Core.Api if (app == null) { - Logger.LogWarning($"Could not resolve application for host $host", context.Request.Host); + Logger.LogWarning("Could not resolve application for host {host}", context.Request.Host); IList apps = await GetApplications(); app = apps.FirstOrDefault(); } diff --git a/zero.Debug/wwwroot/Assets/zero-icon.png b/zero.Debug/wwwroot/Assets/zero-icon.png new file mode 100644 index 00000000..683dc936 Binary files /dev/null and b/zero.Debug/wwwroot/Assets/zero-icon.png differ diff --git a/zero.Web.UI/App/config/router.config.js b/zero.Web.UI/App/config/router.config.js index 260a099a..e6c330b3 100644 --- a/zero.Web.UI/App/config/router.config.js +++ b/zero.Web.UI/App/config/router.config.js @@ -1,8 +1,9 @@ import Localization from 'zero/services/localization'; +import { isArray as _isArray } from 'underscore'; // set meta title before routing -const beforeEach = () => (to, from, next) => +const beforeEach = (to, from, next) => { let isGuarded = false; @@ -10,24 +11,39 @@ const beforeEach = () => (to, from, next) => let callback = () => { let title = Localization.localize('@zero.name'); + let name = to.meta.name; - if (to.meta.name && to.meta.alias !== __zero.alias.sections.dashboard) + if (!name && to.matched.length > 1) { - let name = to.meta.name; - let nameParts = _isArray(name) ? name : [name]; - let translations = []; - - nameParts.forEach(part => + to.matched.forEach(route => { - if (part) + if (!name && route.meta.name) { - translations.push(Localization.localize(part)); + name = route.meta.name; } }); - - title += ': ' + translations.join(' - '); } + if (!name || to.meta.alias === __zero.alias.sections.dashboard) + { + document.title = title; + next(); + return; + } + + let nameParts = _isArray(name) ? name : [name]; + let translations = []; + + nameParts.forEach(part => + { + if (part) + { + translations.push(Localization.localize(part)); + } + }); + + title += ': ' + translations.join(' - '); + document.title = title; next(); @@ -67,7 +83,7 @@ export default { base: __zero.path, linkActiveClass: 'is-active', linkExactActiveClass: 'is-active-exact', - //beforeEach: beforeEach, + beforeEach: beforeEach, scrollBehavior(to, from, savedPosition) { return savedPosition ? savedPosition : { x: 0, y: 0 }; diff --git a/zero.Web.UI/App/core/zero.js b/zero.Web.UI/App/core/zero.js index 8ae0ee62..e53f59df 100644 --- a/zero.Web.UI/App/core/zero.js +++ b/zero.Web.UI/App/core/zero.js @@ -75,11 +75,11 @@ class Zero routes: this.#routes }); + this.#router.beforeEach(routerConfig.beforeEach); + //const result = await Axios.get('zerovue/config'); //this.config = { ...this.config, ...result.data }; - //console.info(this.#vue.router); - this.#setupDone = true; //EventHub.$emit('zero.setup'); } diff --git a/zero.Web.UI/App/pages/settings/routes.js b/zero.Web.UI/App/pages/settings/routes.js index b1a231e1..5425b851 100644 --- a/zero.Web.UI/App/pages/settings/routes.js +++ b/zero.Web.UI/App/pages/settings/routes.js @@ -33,7 +33,7 @@ const addArea = (areaAlias, component, detailComponent, hasCreate, postCreate) = path: area.url, component: component, meta: { - name: [area.name, section.name] + name: area.name } }); @@ -46,7 +46,7 @@ const addArea = (areaAlias, component, detailComponent, hasCreate, postCreate) = component: detailComponent, meta: { create: true, - name: [area.name, section.name] + name: area.name } }); } @@ -59,7 +59,7 @@ const addArea = (areaAlias, component, detailComponent, hasCreate, postCreate) = props: true, component: detailComponent, meta: { - name: [area.name, section.name] + name: area.name } }); } @@ -105,7 +105,7 @@ if (section) component: UserRole, meta: { create: true, - name: [area.name, section.name] + name: area.name } }); @@ -115,7 +115,7 @@ if (section) props: true, component: UserRole, meta: { - name: [area.name, section.name] + name: area.name } }); }); diff --git a/zero.Web.UI/vue.config.js b/zero.Web.UI/vue.config.js index 87edba85..41b54601 100644 --- a/zero.Web.UI/vue.config.js +++ b/zero.Web.UI/vue.config.js @@ -27,6 +27,11 @@ module.exports = { app: "app.js" }, + devServer: { + sockPath: '/zero/vue-cli/sockjs-node', + public: 'http://localhost:2310/zero/vue-cli' + }, + // webpack configuration chainWebpack: config => { diff --git a/zero.Web/Views/Zero/Index.cshtml b/zero.Web/Views/Zero/Index.cshtml index 3b79cdd0..addcf09b 100644 --- a/zero.Web/Views/Zero/Index.cshtml +++ b/zero.Web/Views/Zero/Index.cshtml @@ -10,6 +10,9 @@ + + +