From 6faa389febf461a166ffd2304c596eb0afd36618 Mon Sep 17 00:00:00 2001 From: Tobias Klika Date: Tue, 7 Dec 2021 15:59:29 +0100 Subject: [PATCH] phew --- zero.Api/ZeroApiEntityStoreController.cs | 2 + zero.Backoffice.UI/app/_about.vue | 15 ++ zero.Backoffice.UI/app/_root.vue | 15 ++ zero.Backoffice.UI/app/app.vue | 49 ++++- .../axios.config.js => app/axios.config.ts} | 15 +- .../app/components/generic/index.ts | 7 - zero.Backoffice.UI/app/components/index.ts | 29 +++ zero.Backoffice.UI/app/components/register.ts | 11 +- .../app/components/tabs/index.ts | 10 - .../app/components/tabs/register.ts | 13 -- .../components/ui-button.vue} | 14 +- .../app/components/{generic => }/ui-date.vue | 0 .../components/ui-dot-button.vue} | 0 .../error.vue => app/components/ui-error.vue} | 7 +- .../components/ui-icon-button.vue} | 0 .../app/components/{generic => }/ui-icon.vue | 0 .../components/{tabs => }/ui-inline-tabs.vue | 0 .../components/{generic => }/ui-loading.vue | 0 .../components/ui-message.vue} | 0 .../components/ui-pagination.vue} | 0 .../components/ui-select-button.vue} | 8 +- .../components/ui-state-button.vue} | 2 - .../app/components/{tabs => }/ui-tab.vue | 2 +- .../app/components/{tabs => }/ui-tabs.vue | 0 .../components/ui/ui-add-button.vue} | 2 - .../app/core/createZeroPlugin.ts | 5 +- zero.Backoffice.UI/app/core/index.ts | 3 +- .../app/core/router/formDirtyGuard.ts | 18 ++ .../app/core/router/routerConfig.ts | 47 +++++ .../app/core/router/titleGuard.ts | 43 ++++ zero.Backoffice.UI/app/core/types/zero.ts | 4 +- .../app/core/types/zeroPlugin.ts | 3 +- .../app/core/types/zeroPluginOptions.ts | 28 +++ zero.Backoffice.UI/app/core/zeroRuntime.ts | 57 ++++- zero.Backoffice.UI/app/editor/types.ts | 36 ++++ .../app/forms/components/index.ts | 11 + .../generic => forms/components}/register.ts | 0 .../forms/components/ui-check-list.vue} | 26 +-- .../app/forms/components/ui-rte/rte.config.ts | 174 +++++++++++++++ .../forms/components/ui-rte/rte.extensions.ts | 73 +++++++ .../forms/components/ui-rte/rte.menubar.ts} | 2 +- .../forms/components/ui-rte/ui-rte.vue} | 123 +++++------ .../forms/components/ui-search.vue} | 5 +- .../forms/components/ui-select.vue} | 10 +- .../forms/components/ui-toggle.vue} | 16 +- zero.Backoffice.UI/app/main.ts | 1 + .../app/modules/countries/_page.vue | 30 +++ .../app/modules/countries/api.ts | 16 ++ .../modules/countries}/countries.vue | 0 .../modules/countries}/country.vue | 0 .../modules/countries/editor.ts} | 0 .../modules/countries/list.ts} | 0 .../app/modules/countries/plugin.ts | 15 ++ .../modules/countries/ui-countrypicker.vue | 61 ++++++ zero.Backoffice.UI/app/services/request.ts | 147 +++++++------ zero.Backoffice.UI/app/utils/index.ts | 3 +- zero.Backoffice.UI/app/utils/timing.ts | 10 + zero.Backoffice.UI/index.html | 3 + zero.Backoffice.UI/old_app/api/countries.js | 10 - .../old_app/components/forms/alias.vue | 135 ------------ .../old_app/components/forms/check-list.vue | 139 ------------ .../old_app/components/forms/quill.vue | 199 ------------------ .../pickers/countryPicker/countrypicker.vue | 61 ------ .../old_app/dashboard/element.vue | 103 --------- .../old_app/pages/dashboard/dashboard.vue | 7 +- zero.Backoffice.UI/package.json | 4 +- zero.Backoffice.UI/vite.config.js | 14 +- 67 files changed, 950 insertions(+), 893 deletions(-) create mode 100644 zero.Backoffice.UI/app/_about.vue create mode 100644 zero.Backoffice.UI/app/_root.vue rename zero.Backoffice.UI/{old_app/config/axios.config.js => app/axios.config.ts} (69%) delete mode 100644 zero.Backoffice.UI/app/components/generic/index.ts create mode 100644 zero.Backoffice.UI/app/components/index.ts delete mode 100644 zero.Backoffice.UI/app/components/tabs/index.ts delete mode 100644 zero.Backoffice.UI/app/components/tabs/register.ts rename zero.Backoffice.UI/{old_app/components/buttons/button.vue => app/components/ui-button.vue} (94%) rename zero.Backoffice.UI/app/components/{generic => }/ui-date.vue (100%) rename zero.Backoffice.UI/{old_app/components/buttons/dot-button.vue => app/components/ui-dot-button.vue} (100%) rename zero.Backoffice.UI/{old_app/components/forms/error.vue => app/components/ui-error.vue} (89%) rename zero.Backoffice.UI/{old_app/components/buttons/icon-button.vue => app/components/ui-icon-button.vue} (100%) rename zero.Backoffice.UI/app/components/{generic => }/ui-icon.vue (100%) rename zero.Backoffice.UI/app/components/{tabs => }/ui-inline-tabs.vue (100%) rename zero.Backoffice.UI/app/components/{generic => }/ui-loading.vue (100%) rename zero.Backoffice.UI/{old_app/components/messages/message.vue => app/components/ui-message.vue} (100%) rename zero.Backoffice.UI/{old_app/components/pagination.vue => app/components/ui-pagination.vue} (100%) rename zero.Backoffice.UI/{old_app/components/buttons/select-button.vue => app/components/ui-select-button.vue} (82%) rename zero.Backoffice.UI/{old_app/components/buttons/state-button.vue => app/components/ui-state-button.vue} (97%) rename zero.Backoffice.UI/app/components/{tabs => }/ui-tab.vue (96%) rename zero.Backoffice.UI/app/components/{tabs => }/ui-tabs.vue (100%) rename zero.Backoffice.UI/{old_app/components/buttons/add-button.vue => app/components/ui/ui-add-button.vue} (98%) create mode 100644 zero.Backoffice.UI/app/core/router/formDirtyGuard.ts create mode 100644 zero.Backoffice.UI/app/core/router/routerConfig.ts create mode 100644 zero.Backoffice.UI/app/core/router/titleGuard.ts create mode 100644 zero.Backoffice.UI/app/core/types/zeroPluginOptions.ts create mode 100644 zero.Backoffice.UI/app/editor/types.ts create mode 100644 zero.Backoffice.UI/app/forms/components/index.ts rename zero.Backoffice.UI/app/{components/generic => forms/components}/register.ts (100%) rename zero.Backoffice.UI/{old_app/components/forms/input-list.vue => app/forms/components/ui-check-list.vue} (86%) create mode 100644 zero.Backoffice.UI/app/forms/components/ui-rte/rte.config.ts create mode 100644 zero.Backoffice.UI/app/forms/components/ui-rte/rte.extensions.ts rename zero.Backoffice.UI/{old_app/components/forms/rte.menubar.js => app/forms/components/ui-rte/rte.menubar.ts} (98%) rename zero.Backoffice.UI/{old_app/components/forms/rte.vue => app/forms/components/ui-rte/ui-rte.vue} (68%) rename zero.Backoffice.UI/{old_app/components/forms/search.vue => app/forms/components/ui-search.vue} (88%) rename zero.Backoffice.UI/{old_app/components/forms/select.vue => app/forms/components/ui-select.vue} (78%) rename zero.Backoffice.UI/{old_app/components/forms/toggle.vue => app/forms/components/ui-toggle.vue} (84%) create mode 100644 zero.Backoffice.UI/app/modules/countries/_page.vue create mode 100644 zero.Backoffice.UI/app/modules/countries/api.ts rename zero.Backoffice.UI/{old_app/pages/settings => app/modules/countries}/countries.vue (100%) rename zero.Backoffice.UI/{old_app/pages/settings => app/modules/countries}/country.vue (100%) rename zero.Backoffice.UI/{old_app/renderers/editors/country.js => app/modules/countries/editor.ts} (100%) rename zero.Backoffice.UI/{old_app/renderers/lists/countries.js => app/modules/countries/list.ts} (100%) create mode 100644 zero.Backoffice.UI/app/modules/countries/plugin.ts create mode 100644 zero.Backoffice.UI/app/modules/countries/ui-countrypicker.vue create mode 100644 zero.Backoffice.UI/app/utils/timing.ts delete mode 100644 zero.Backoffice.UI/old_app/api/countries.js delete mode 100644 zero.Backoffice.UI/old_app/components/forms/alias.vue delete mode 100644 zero.Backoffice.UI/old_app/components/forms/check-list.vue delete mode 100644 zero.Backoffice.UI/old_app/components/forms/quill.vue delete mode 100644 zero.Backoffice.UI/old_app/components/pickers/countryPicker/countrypicker.vue delete mode 100644 zero.Backoffice.UI/old_app/dashboard/element.vue diff --git a/zero.Api/ZeroApiEntityStoreController.cs b/zero.Api/ZeroApiEntityStoreController.cs index 52b306c1..089476d4 100644 --- a/zero.Api/ZeroApiEntityStoreController.cs +++ b/zero.Api/ZeroApiEntityStoreController.cs @@ -54,6 +54,7 @@ public abstract class ZeroApiEntityStoreController : ZeroApiCont protected async Task> GetModels(ListQuery query) where T : BasicModel { query.OrderQuery ??= q => q.OrderByDescending(x => x.CreatedDate); + query.SearchSelector ??= x => x.Name; Paged result = await Store.Load(query.Page, query.PageSize, q => q.Filter(query)); return Mapper.Map(result, (src, dest) => @@ -66,6 +67,7 @@ public abstract class ZeroApiEntityStoreController : ZeroApiCont protected async Task> GetModels(ListQuery query) where T : BasicModel where TIndex : AbstractCommonApiForIndexes, new() { query.OrderQuery ??= q => q.OrderByDescending(x => x.CreatedDate); + query.SearchSelector ??= x => x.Name; Paged result = await Store.Load(query.Page, query.PageSize, q => q.Filter(query)); return Mapper.Map(result, (src, dest) => diff --git a/zero.Backoffice.UI/app/_about.vue b/zero.Backoffice.UI/app/_about.vue new file mode 100644 index 00000000..424aa40f --- /dev/null +++ b/zero.Backoffice.UI/app/_about.vue @@ -0,0 +1,15 @@ + + + + \ No newline at end of file diff --git a/zero.Backoffice.UI/app/_root.vue b/zero.Backoffice.UI/app/_root.vue new file mode 100644 index 00000000..d25a8132 --- /dev/null +++ b/zero.Backoffice.UI/app/_root.vue @@ -0,0 +1,15 @@ + + + + \ No newline at end of file diff --git a/zero.Backoffice.UI/app/app.vue b/zero.Backoffice.UI/app/app.vue index 15d89068..af015311 100644 --- a/zero.Backoffice.UI/app/app.vue +++ b/zero.Backoffice.UI/app/app.vue @@ -1,6 +1,14 @@  @@ -38,19 +68,24 @@ data: () => ({ input: null, name: localize('@name'), - tabLabel: 'Settings' + tabLabel: 'Settings', + rte: '

Hallo
Das ist schön

Ciao Tobi

', + toggled: true, + search: null }), - created() - { - console.info(this.zero.version); - }, - computed: { output() { return selectorToArray(this.input); } + }, + + methods: { + searchSubmit(ev) + { + console.info('searched: ' + ev); + } } } diff --git a/zero.Backoffice.UI/old_app/config/axios.config.js b/zero.Backoffice.UI/app/axios.config.ts similarity index 69% rename from zero.Backoffice.UI/old_app/config/axios.config.js rename to zero.Backoffice.UI/app/axios.config.ts index ee1571ab..15b2aa1f 100644 --- a/zero.Backoffice.UI/old_app/config/axios.config.js +++ b/zero.Backoffice.UI/app/axios.config.ts @@ -1,13 +1,13 @@ import Axios from 'axios'; -import Auth from 'zero/helpers/auth.js'; +//import Auth from 'zero/helpers/auth.js'; import Qs from 'qs'; -if (!__zero || !__zero.apiPath) -{ - throw Exception('window.zero and zero.apiPath (= base path to the backoffice API) have to be configured'); -} +//if (!__zero || !__zero.apiPath) +//{ +// throw Exception('window.zero and zero.apiPath (= base path to the backoffice API) have to be configured'); +//} -Axios.defaults.baseURL = __zero.apiPath; +Axios.defaults.baseURL = '/zero/api/'; Axios.defaults.withCredentials = true; Axios.defaults.paramsSerializer = (params) => @@ -21,7 +21,8 @@ Axios.interceptors.response.use(response => response, error => { if (error.response.status === 401) { - Auth.rejectUser("@login.rejectReasons.inactive"); + console.error('[zero.axios] Auth failed. Please login again.'); + //Auth.rejectUser("@login.rejectReasons.inactive"); //Notification.error('Authentication failed. Please login again.', 3); } } diff --git a/zero.Backoffice.UI/app/components/generic/index.ts b/zero.Backoffice.UI/app/components/generic/index.ts deleted file mode 100644 index db8af7de..00000000 --- a/zero.Backoffice.UI/app/components/generic/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import uiIcon from './ui-icon.vue'; -import uiLoading from './ui-loading.vue'; - -export { - uiIcon, - uiLoading -}; \ No newline at end of file diff --git a/zero.Backoffice.UI/app/components/index.ts b/zero.Backoffice.UI/app/components/index.ts new file mode 100644 index 00000000..0bffd90b --- /dev/null +++ b/zero.Backoffice.UI/app/components/index.ts @@ -0,0 +1,29 @@ +import uiIcon from './ui-icon.vue'; +import uiLoading from './ui-loading.vue'; +import uiTab from './ui-tab.vue'; +import uiTabs from './ui-tabs.vue'; +import uiInlineTabs from './ui-inline-tabs.vue'; +import uiButton from './ui-button.vue'; +import uiDotButton from './ui-dot-button.vue'; +import uiIconButton from './ui-icon-button.vue'; +import uiSelectButton from './ui-select-button.vue'; +import uiStateButton from './ui-state-button.vue'; +import uiMessage from './ui-message.vue'; +import uiPagination from './ui-pagination.vue'; +import uiError from './ui-error.vue'; + +export { + uiIcon, + uiLoading, + uiTab, + uiTabs, + uiInlineTabs, + uiButton, + uiDotButton, + uiIconButton, + uiSelectButton, + uiStateButton, + uiMessage, + uiPagination, + uiError +}; \ No newline at end of file diff --git a/zero.Backoffice.UI/app/components/register.ts b/zero.Backoffice.UI/app/components/register.ts index 72f52c6f..8e137b10 100644 --- a/zero.Backoffice.UI/app/components/register.ts +++ b/zero.Backoffice.UI/app/components/register.ts @@ -1,10 +1,13 @@ import { App } from 'vue'; -import registerGeneric from './generic/register'; -import registerTabs from './tabs/register'; +import * as components from './index'; export default function (app: App) { - registerGeneric(app); - registerTabs(app); + for (var key in components) + { + let component = components[key]; + + app.component(key, component.default || component); + } }; \ No newline at end of file diff --git a/zero.Backoffice.UI/app/components/tabs/index.ts b/zero.Backoffice.UI/app/components/tabs/index.ts deleted file mode 100644 index a855bba3..00000000 --- a/zero.Backoffice.UI/app/components/tabs/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -import uiTab from './ui-tab.vue'; -import uiTabs from './ui-tabs.vue'; -import uiInlineTabs from './ui-inline-tabs.vue'; - -export -{ - uiTab, - uiTabs, - uiInlineTabs -}; \ No newline at end of file diff --git a/zero.Backoffice.UI/app/components/tabs/register.ts b/zero.Backoffice.UI/app/components/tabs/register.ts deleted file mode 100644 index 8e137b10..00000000 --- a/zero.Backoffice.UI/app/components/tabs/register.ts +++ /dev/null @@ -1,13 +0,0 @@ - -import { App } from 'vue'; -import * as components from './index'; - -export default function (app: App) -{ - for (var key in components) - { - let component = components[key]; - - app.component(key, component.default || component); - } -}; \ No newline at end of file diff --git a/zero.Backoffice.UI/old_app/components/buttons/button.vue b/zero.Backoffice.UI/app/components/ui-button.vue similarity index 94% rename from zero.Backoffice.UI/old_app/components/buttons/button.vue rename to zero.Backoffice.UI/app/components/ui-button.vue index c7aba92c..21f18281 100644 --- a/zero.Backoffice.UI/old_app/components/buttons/button.vue +++ b/zero.Backoffice.UI/app/components/ui-button.vue @@ -1,5 +1,5 @@