From 9e86edcbddb8557586ffc28c114f540b6021f508 Mon Sep 17 00:00:00 2001 From: Tobias Klika Date: Sun, 16 Jan 2022 21:38:47 +0100 Subject: [PATCH] fixes --- .../app/modules/settings/plugin.ts | 2 +- .../app/modules/settings/settings.vue | 22 +++++++++---------- .../app/modules/spaces/views/editor.vue | 5 +++++ zero.Core/Context/ZeroContext.cs | 22 +++++++++++++++++++ 4 files changed, 39 insertions(+), 12 deletions(-) diff --git a/zero.Backoffice.UI/app/modules/settings/plugin.ts b/zero.Backoffice.UI/app/modules/settings/plugin.ts index 3ea2a96d..7a34010c 100644 --- a/zero.Backoffice.UI/app/modules/settings/plugin.ts +++ b/zero.Backoffice.UI/app/modules/settings/plugin.ts @@ -6,7 +6,7 @@ export default { install(app: ZeroPluginOptions) { app.route({ name: 'settings', path: '/settings', component: () => import('./settings.vue') }); - app.route({ name: 'demo', path: '/settings/demo', component: () => import('./demo.vue') }); + //app.route({ name: 'demo', path: '/settings/demo', component: () => import('./demo.vue') }); app.schema('demo', () => import('./demo')); } diff --git a/zero.Backoffice.UI/app/modules/settings/settings.vue b/zero.Backoffice.UI/app/modules/settings/settings.vue index b0a180f8..0e841d3f 100644 --- a/zero.Backoffice.UI/app/modules/settings/settings.vue +++ b/zero.Backoffice.UI/app/modules/settings/settings.vue @@ -45,17 +45,17 @@ this.groups = useUiStore().settingGroups; this.appCount = useAppStore().applications.length; - if (!this.groups[1].items.find(x => x.alias === 'demo')) - { - this.groups[1].items.push({ - alias: "demo", - description: "Demo all editor components", - icon: "fth-box", - isPlugin: true, - name: "Components", - url: "/settings/demo" - }); - } + //if (!this.groups[1].items.find(x => x.alias === 'demo')) + //{ + // this.groups[1].items.push({ + // alias: "demo", + // description: "Demo all editor components", + // icon: "fth-box", + // isPlugin: true, + // name: "Components", + // url: "/settings/demo" + // }); + //} } } diff --git a/zero.Backoffice.UI/app/modules/spaces/views/editor.vue b/zero.Backoffice.UI/app/modules/spaces/views/editor.vue index 7f8260e1..8e06372c 100644 --- a/zero.Backoffice.UI/app/modules/spaces/views/editor.vue +++ b/zero.Backoffice.UI/app/modules/spaces/views/editor.vue @@ -94,6 +94,11 @@ var config = { system: this.$route.query['zero.scope'] == 'system' }; const response = !this.isCreate ? await api.update(this.model, config) : await api.create(this.model, config); await form.handle(response); + + if (response.success) + { + this.model = response.data; + } }, diff --git a/zero.Core/Context/ZeroContext.cs b/zero.Core/Context/ZeroContext.cs index d81c0454..68eb6ced 100644 --- a/zero.Core/Context/ZeroContext.cs +++ b/zero.Core/Context/ZeroContext.cs @@ -134,6 +134,23 @@ public class ZeroContext : IZeroContext /// public void Remove() => ValueCollection.Remove(); + + /// + public void SetScope(Application app) + { + // TODO this is only used for console app as we do not have an HttpRequest there + // needs to be deleted and definitely replaced + + _resolved = true; + IsBackofficeRequest = false; + BackofficeUser = new ClaimsPrincipal(); + IsLoggedIntoBackoffice = false; + Application = app; + AppId = app.Id; + Store.ResolvedDatabase = Application.Database; + Scope = new(Store, Store.ResolvedDatabase, Application); + } + /// public ZeroContextScope CreateScope(Application app) @@ -279,6 +296,11 @@ public interface IZeroContext /// void Remove(); + /// + /// Manually set a scope + /// + void SetScope(Application app); + /// /// Scope the current context to a specific application database ///