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 2021/02/06 02:28:19 UTC
[apisix-dashboard] branch master updated: feat: show warning
notification when dashboard version not matching apisix (#1435)
This is an automated email from the ASF dual-hosted git repository.
juzhiyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new 8796fa1 feat: show warning notification when dashboard version not matching apisix (#1435)
8796fa1 is described below
commit 8796fa1b00617f83b495798cc7b86418d1456533
Author: litesun <su...@apache.org>
AuthorDate: Sat Feb 6 10:28:12 2021 +0800
feat: show warning notification when dashboard version not matching apisix (#1435)
Co-authored-by: juzhiyuan <ju...@apache.org>
---
web/src/components/Plugin/PluginDetail.tsx | 26 ++++++++++++--------------
web/src/components/Plugin/PluginPage.tsx | 2 +-
web/src/components/RightContent/index.tsx | 9 ++++++++-
web/src/pages/Plugin/List.tsx | 4 ++--
web/src/services/tool.ts | 19 +++++++++++++++++++
5 files changed, 42 insertions(+), 18 deletions(-)
diff --git a/web/src/components/Plugin/PluginDetail.tsx b/web/src/components/Plugin/PluginDetail.tsx
index b8bed12..dabc73e 100644
--- a/web/src/components/Plugin/PluginDetail.tsx
+++ b/web/src/components/Plugin/PluginDetail.tsx
@@ -182,20 +182,18 @@ const PluginDetail: React.FC<Props> = ({
okText={formatMessage({ id: 'component.global.confirm' })}
cancelText={formatMessage({ id: 'component.global.cancel' })}
onConfirm={() => {
- onChange({ formData: form.getFieldsValue(), codemirrorData: {}, shouldDelete: true });
+ onChange({
+ formData: form.getFieldsValue(),
+ codemirrorData: {},
+ shouldDelete: true,
+ });
}}
>
- {
- initialData[name]
- ? <Button
- key={3}
- type="primary"
- danger
- >
- {formatMessage({ id: 'component.global.delete' })}
- </Button>
- : null
- }
+ {initialData[name] ? (
+ <Button key={3} type="primary" danger>
+ {formatMessage({ id: 'component.global.delete' })}
+ </Button>
+ ) : null}
</Popconfirm>
<Button
key={2}
@@ -250,8 +248,8 @@ const PluginDetail: React.FC<Props> = ({
pluginType === 'auth' && schemaType !== 'consumer' ? (
<Alert message={`${name} does not require configuration`} type="warning" />
) : (
- <>Current plugin: {name}</>
- )
+ <>Current plugin: {name}</>
+ )
}
ghost={false}
extra={[
diff --git a/web/src/components/Plugin/PluginPage.tsx b/web/src/components/Plugin/PluginPage.tsx
index 7a92c6d..6798f5f 100644
--- a/web/src/components/Plugin/PluginPage.tsx
+++ b/web/src/components/Plugin/PluginPage.tsx
@@ -181,7 +181,7 @@ const PluginPage: React.FC<Props> = ({
};
if (shouldDelete === true) {
plugins = omit(plugins, name);
- };
+ }
onChange(plugins);
setName(NEVER_EXIST_PLUGIN_FLAG);
}}
diff --git a/web/src/components/RightContent/index.tsx b/web/src/components/RightContent/index.tsx
index 8f722d7..9a59c08 100644
--- a/web/src/components/RightContent/index.tsx
+++ b/web/src/components/RightContent/index.tsx
@@ -23,8 +23,10 @@
*/
import { Tooltip, Tag, Space } from 'antd';
import { QuestionCircleOutlined } from '@ant-design/icons';
-import React from 'react';
+import React, { useEffect } from 'react';
import { useModel, SelectLang } from 'umi';
+
+import { fetchVersionMatch } from '@/services/tool';
import Avatar from './AvatarDropdown';
import styles from './index.less';
@@ -38,6 +40,10 @@ const ENVTagColor = {
const GlobalHeaderRight: React.FC = () => {
const { initialState } = useModel('@@initialState');
+
+ useEffect(() => {
+ fetchVersionMatch();
+ }, []);
if (!initialState || !initialState.settings) {
return null;
@@ -49,6 +55,7 @@ const GlobalHeaderRight: React.FC = () => {
if ((navTheme === 'dark' && layout === 'top') || layout === 'mix') {
className = `${styles.right} ${styles.dark}`;
}
+
return (
<Space className={className}>
<Tooltip title="Documentation">
diff --git a/web/src/pages/Plugin/List.tsx b/web/src/pages/Plugin/List.tsx
index e7bd4b9..049077d 100644
--- a/web/src/pages/Plugin/List.tsx
+++ b/web/src/pages/Plugin/List.tsx
@@ -121,9 +121,9 @@ const Page: React.FC = () => {
};
if (shouldDelete === true) {
plugins = omit(plugins, name);
- };
+ }
createOrUpdate({
- plugins
+ plugins,
}).then(() => {
setVisible(false);
setName('');
diff --git a/web/src/services/tool.ts b/web/src/services/tool.ts
new file mode 100644
index 0000000..6e9da03
--- /dev/null
+++ b/web/src/services/tool.ts
@@ -0,0 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import { request } from 'umi';
+
+export const fetchVersionMatch = () => request<Res<any>>('/tool/version_match');