You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by ju...@apache.org on 2020/05/21 03:54:44 UTC

[incubator-apisix-dashboard] branch feat-layout updated (311f2d3 -> a5447bf)

This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a change to branch feat-layout
in repository https://gitbox.apache.org/repos/asf/incubator-apisix-dashboard.git.


    from 311f2d3  feat: added initial state
     new a1f8367  feat: update global
     new 55e0d6b  feat: update layout
     new 8a892fd  feat: update typings
     new a5447bf  fix: routes

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 config/config.ts          | 65 +++++++++++++++++------------------------------
 config/defaultSettings.ts | 21 ++++++---------
 src/global.tsx            | 24 ++++++++---------
 src/services/API.d.ts     |  7 -----
 src/services/login.ts     | 10 +++++---
 src/services/user.ts      |  3 +++
 6 files changed, 54 insertions(+), 76 deletions(-)


[incubator-apisix-dashboard] 03/04: feat: update typings

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch feat-layout
in repository https://gitbox.apache.org/repos/asf/incubator-apisix-dashboard.git

commit 8a892fd6b4f0c308da10f7a3e0992710bcc962ea
Author: juzhiyuan <jj...@gmail.com>
AuthorDate: Thu May 21 11:51:00 2020 +0800

    feat: update typings
---
 src/services/API.d.ts | 7 -------
 src/services/login.ts | 8 ++++++--
 src/services/user.ts  | 2 ++
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/services/API.d.ts b/src/services/API.d.ts
index dccbbd9..d31fb9e 100644
--- a/src/services/API.d.ts
+++ b/src/services/API.d.ts
@@ -2,13 +2,6 @@ declare namespace API {
   export interface CurrentUser {
     avatar?: string;
     name?: string;
-    title?: string;
-    group?: string;
-    signature?: string;
-    tags?: {
-      key: string;
-      label: string;
-    }[];
     userid?: string;
     access?: 'user' | 'guest' | 'admin';
     unreadCount?: number;
diff --git a/src/services/login.ts b/src/services/login.ts
index e5c918d..bac9179 100644
--- a/src/services/login.ts
+++ b/src/services/login.ts
@@ -10,8 +10,12 @@ export interface LoginParamsType {
 export async function fakeAccountLogin() {
   // NOTE: APISIX doesn‘t support user login currently, we return fake data directly.
   return {
-    status: 'ok',
-    type: 'account',
+    name: 'APISIX User',
+    avatar:
+      'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxzdmcgdmlld0JveD0iMCAwIDUwMCA1MDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQogIDxkZWZzPg0KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0iaWQwIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjI1MTE5LjgiIHkxPSIxMTA1Mi41IiB4Mj0iMjE3MjUuNyIgeTI9IjIxNTUxLjciIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMC4wMjgwOTUsIDAsIDAsIDAuMDI4MDk1LCAtNDkyLjg2NzA5NiwgLTE0NC43Njk4MjEpIj4NCiAgICAgIDxzdG9wIG9mZnNldD0iMCIgc3R5bGU9InN0b3AtY29 [...]
+    userid: '00000001',
+    notifyCount: 12,
+    unreadCount: 11,
     access: 'admin',
   };
 }
diff --git a/src/services/user.ts b/src/services/user.ts
index a0589ba..3189a54 100644
--- a/src/services/user.ts
+++ b/src/services/user.ts
@@ -11,6 +11,8 @@ export async function queryCurrent() {
     avatar:
       'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxzdmcgdmlld0JveD0iMCAwIDUwMCA1MDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQogIDxkZWZzPg0KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0iaWQwIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjI1MTE5LjgiIHkxPSIxMTA1Mi41IiB4Mj0iMjE3MjUuNyIgeTI9IjIxNTUxLjciIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMC4wMjgwOTUsIDAsIDAsIDAuMDI4MDk1LCAtNDkyLjg2NzA5NiwgLTE0NC43Njk4MjEpIj4NCiAgICAgIDxzdG9wIG9mZnNldD0iMCIgc3R5bGU9InN0b3AtY29 [...]
     userid: '00000001',
+    notifyCount: 12,
+    unreadCount: 11,
     access: 'admin',
   });
 }


[incubator-apisix-dashboard] 04/04: fix: routes

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch feat-layout
in repository https://gitbox.apache.org/repos/asf/incubator-apisix-dashboard.git

commit a5447bf47f76d38a34189ee7857d7aaedbe44e74
Author: juzhiyuan <jj...@gmail.com>
AuthorDate: Thu May 21 11:54:22 2020 +0800

    fix: routes
---
 config/config.ts | 65 +++++++++++++++++++++-----------------------------------
 1 file changed, 24 insertions(+), 41 deletions(-)

diff --git a/config/config.ts b/config/config.ts
index f2cfca2..1acf0fe 100644
--- a/config/config.ts
+++ b/config/config.ts
@@ -41,51 +41,34 @@ export default defineConfig({
     },
     {
       path: '/',
+      redirect: '/settings',
+    },
+    {
+      name: 'settings',
+      path: '/settings',
+      icon: 'setting',
+      component: './Settings',
+    },
+    {
+      name: 'ssl',
+      path: '/ssl',
+      icon: 'BarsOutlined',
       routes: [
         {
-          path: '/',
-          access: 'canAdmin',
-          routes: [
-            {
-              path: '/',
-              redirect: '/settings',
-            },
-            {
-              name: 'settings',
-              path: '/settings',
-              icon: 'setting',
-              component: './Settings',
-            },
-            {
-              name: 'ssl',
-              path: '/ssl',
-              icon: 'BarsOutlined',
-              routes: [
-                {
-                  path: '/ssl',
-                  redirect: '/ssl/list',
-                },
-                {
-                  path: '/ssl/list',
-                  name: 'list',
-                  component: './ssl/List',
-                  hideInMenu: true,
-                },
-                {
-                  name: 'create',
-                  path: '/ssl/create',
-                  component: './ssl/Create',
-                  hideInMenu: true,
-                },
-              ],
-            },
-            {
-              component: './404',
-            },
-          ],
+          path: '/ssl',
+          redirect: '/ssl/list',
+        },
+        {
+          path: '/ssl/list',
+          name: 'list',
+          component: './ssl/List',
+          hideInMenu: true,
         },
         {
-          component: './404',
+          name: 'create',
+          path: '/ssl/create',
+          component: './ssl/Create',
+          hideInMenu: true,
         },
       ],
     },


[incubator-apisix-dashboard] 02/04: feat: update layout

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch feat-layout
in repository https://gitbox.apache.org/repos/asf/incubator-apisix-dashboard.git

commit 55e0d6b292ed2c36b3ec9310e5868769315390db
Author: juzhiyuan <jj...@gmail.com>
AuthorDate: Thu May 21 11:48:10 2020 +0800

    feat: update layout
---
 config/config.ts          |  2 +-
 config/defaultSettings.ts | 21 ++++++++-------------
 src/services/login.ts     |  2 +-
 src/services/user.ts      |  1 +
 4 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/config/config.ts b/config/config.ts
index 8339d2f..f2cfca2 100644
--- a/config/config.ts
+++ b/config/config.ts
@@ -44,7 +44,7 @@ export default defineConfig({
       routes: [
         {
           path: '/',
-          authority: ['admin', 'user'],
+          access: 'canAdmin',
           routes: [
             {
               path: '/',
diff --git a/config/defaultSettings.ts b/config/defaultSettings.ts
index a98401c..6b6349a 100644
--- a/config/defaultSettings.ts
+++ b/config/defaultSettings.ts
@@ -1,26 +1,21 @@
-import { Settings as ProSettings } from '@ant-design/pro-layout';
+import { Settings as LayoutSettings } from '@ant-design/pro-layout';
 
-type DefaultSettings = ProSettings & {
-  pwa: boolean;
-};
-
-const defaultSettings: DefaultSettings = {
-  navTheme: 'dark',
+export default {
+  navTheme: 'light',
   // 拂晓蓝
   primaryColor: '#1890ff',
-  layout: 'side',
+  layout: 'mix',
   contentWidth: 'Fluid',
   fixedHeader: false,
+  autoHideHeader: false,
   fixSiderbar: false,
   colorWeak: false,
   menu: {
     locale: true,
   },
-  title: 'APISIX',
+  title: 'APISIX Dashboard',
   pwa: false,
   iconfontUrl: '',
+} as LayoutSettings & {
+  pwa: boolean;
 };
-
-export { DefaultSettings };
-
-export default defaultSettings;
diff --git a/src/services/login.ts b/src/services/login.ts
index a4e081e..e5c918d 100644
--- a/src/services/login.ts
+++ b/src/services/login.ts
@@ -12,7 +12,7 @@ export async function fakeAccountLogin() {
   return {
     status: 'ok',
     type: 'account',
-    currentAuthority: 'admin',
+    access: 'admin',
   };
 }
 
diff --git a/src/services/user.ts b/src/services/user.ts
index 870c4c7..a0589ba 100644
--- a/src/services/user.ts
+++ b/src/services/user.ts
@@ -11,6 +11,7 @@ export async function queryCurrent() {
     avatar:
       'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxzdmcgdmlld0JveD0iMCAwIDUwMCA1MDAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+DQogIDxkZWZzPg0KICAgIDxsaW5lYXJHcmFkaWVudCBpZD0iaWQwIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjI1MTE5LjgiIHkxPSIxMTA1Mi41IiB4Mj0iMjE3MjUuNyIgeTI9IjIxNTUxLjciIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMC4wMjgwOTUsIDAsIDAsIDAuMDI4MDk1LCAtNDkyLjg2NzA5NiwgLTE0NC43Njk4MjEpIj4NCiAgICAgIDxzdG9wIG9mZnNldD0iMCIgc3R5bGU9InN0b3AtY29 [...]
     userid: '00000001',
+    access: 'admin',
   });
 }
 


[incubator-apisix-dashboard] 01/04: feat: update global

Posted by ju...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch feat-layout
in repository https://gitbox.apache.org/repos/asf/incubator-apisix-dashboard.git

commit a1f83670a33fe75087bda958d324adc712594b64
Author: juzhiyuan <jj...@gmail.com>
AuthorDate: Thu May 21 11:38:11 2020 +0800

    feat: update global
---
 src/global.tsx | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/global.tsx b/src/global.tsx
index 4c9014c..f7620c4 100644
--- a/src/global.tsx
+++ b/src/global.tsx
@@ -1,15 +1,15 @@
 import { Button, message, notification } from 'antd';
+
 import React from 'react';
-import { useIntl } from 'umi';
+import { formatMessage } from 'umi';
 import defaultSettings from '../config/defaultSettings';
 
 const { pwa } = defaultSettings;
-
 // if pwa is true
 if (pwa) {
   // Notify user if offline now
   window.addEventListener('sw.offline', () => {
-    message.warning(useIntl().formatMessage({ id: 'app.pwa.offline' }));
+    message.warning(formatMessage({ id: 'app.pwa.offline' }));
   });
 
   // Pop up a prompt on the page asking the user if they want to use the latest version
@@ -25,7 +25,7 @@ if (pwa) {
       // Send skip-waiting event to waiting SW with MessageChannel
       await new Promise((resolve, reject) => {
         const channel = new MessageChannel();
-        channel.port1.onmessage = msgEvent => {
+        channel.port1.onmessage = (msgEvent) => {
           if (msgEvent.data.error) {
             reject(msgEvent.data.error);
           } else {
@@ -47,12 +47,12 @@ if (pwa) {
           reloadSW();
         }}
       >
-        {useIntl().formatMessage({ id: 'app.pwa.serviceworker.updated.ok' })}
+        {formatMessage({ id: 'app.pwa.serviceworker.updated.ok' })}
       </Button>
     );
     notification.open({
-      message: useIntl().formatMessage({ id: 'app.pwa.serviceworker.updated' }),
-      description: useIntl().formatMessage({ id: 'app.pwa.serviceworker.updated.hint' }),
+      message: formatMessage({ id: 'app.pwa.serviceworker.updated' }),
+      description: formatMessage({ id: 'app.pwa.serviceworker.updated.hint' }),
       btn,
       key,
       onClose: async () => {},
@@ -62,20 +62,20 @@ if (pwa) {
   // unregister service worker
   const { serviceWorker } = navigator;
   if (serviceWorker.getRegistrations) {
-    serviceWorker.getRegistrations().then(sws => {
-      sws.forEach(sw => {
+    serviceWorker.getRegistrations().then((sws) => {
+      sws.forEach((sw) => {
         sw.unregister();
       });
     });
   }
-  serviceWorker.getRegistration().then(sw => {
+  serviceWorker.getRegistration().then((sw) => {
     if (sw) sw.unregister();
   });
 
   // remove all caches
   if (window.caches && window.caches.keys) {
-    caches.keys().then(keys => {
-      keys.forEach(key => {
+    caches.keys().then((keys) => {
+      keys.forEach((key) => {
         caches.delete(key);
       });
     });