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/04/18 10:43:46 UTC
[apisix-dashboard] branch master updated: feat: improve the config
plugin button enable disable status (#1610)
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 c9d2bd3 feat: improve the config plugin button enable disable status (#1610)
c9d2bd3 is described below
commit c9d2bd328a5c7f48f1a7be27d7f0ec0af3748b64
Author: Cliff Su <st...@yahoo.com.tw>
AuthorDate: Sun Apr 18 18:43:36 2021 +0800
feat: improve the config plugin button enable disable status (#1610)
Co-authored-by: 琚致远 <ju...@apache.org>
---
.../create-edit-delete-plugin-template.spec.js | 2 +-
.../route/create-route-with-limit-count-plugin-form.spec.js | 6 +++---
.../integration/service/edit-service-with-upstream.spec.js | 1 +
web/cypress/support/commands.js | 2 +-
web/src/components/Plugin/PluginPage.tsx | 13 +++++++------
web/src/components/Plugin/locales/en-US.ts | 2 ++
web/src/components/Plugin/locales/zh-CN.ts | 2 ++
7 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/web/cypress/integration/pluginTemplate/create-edit-delete-plugin-template.spec.js b/web/cypress/integration/pluginTemplate/create-edit-delete-plugin-template.spec.js
index cd3a2a4..255740c 100644
--- a/web/cypress/integration/pluginTemplate/create-edit-delete-plugin-template.spec.js
+++ b/web/cypress/integration/pluginTemplate/create-edit-delete-plugin-template.spec.js
@@ -41,7 +41,7 @@ context('Create Configure and Delete PluginTemplate', () => {
cy.contains('proxy-rewrite').should('not.exist');
cy.contains(this.domSelector.pluginCard, 'basic-auth').within(() => {
- cy.contains('Enable').click({
+ cy.get('button').click({
force: true,
});
});
diff --git a/web/cypress/integration/route/create-route-with-limit-count-plugin-form.spec.js b/web/cypress/integration/route/create-route-with-limit-count-plugin-form.spec.js
index f9db28b..b1df99e 100644
--- a/web/cypress/integration/route/create-route-with-limit-count-plugin-form.spec.js
+++ b/web/cypress/integration/route/create-route-with-limit-count-plugin-form.spec.js
@@ -57,7 +57,7 @@ context('Create and delete route with limit-count form', () => {
// config limit-count form with local policy
cy.contains(this.domSelector.pluginCard, 'limit-count').within(() => {
- cy.contains('Enable').click({
+ cy.get('button').click({
force: true,
});
});
@@ -75,7 +75,7 @@ context('Create and delete route with limit-count form', () => {
// config limit-count form with redis policy
cy.contains(this.domSelector.pluginCard, 'limit-count').within(() => {
- cy.contains('Enable').click({
+ cy.get('button').click({
force: true,
});
});
@@ -97,7 +97,7 @@ context('Create and delete route with limit-count form', () => {
// config limit-count form with redis policy
cy.contains(this.domSelector.pluginCard, 'limit-count').within(() => {
- cy.contains('Enable').click({
+ cy.get('button').click({
force: true,
});
});
diff --git a/web/cypress/integration/service/edit-service-with-upstream.spec.js b/web/cypress/integration/service/edit-service-with-upstream.spec.js
index 87be509..66e9c2f 100644
--- a/web/cypress/integration/service/edit-service-with-upstream.spec.js
+++ b/web/cypress/integration/service/edit-service-with-upstream.spec.js
@@ -40,6 +40,7 @@ context('Edit Service with Upstream', () => {
it('should create a test service', function () {
cy.visit('/');
+ cy.get('.ant-empty').should('be.visible');
cy.contains('Service').click();
cy.get(this.domSelector.empty).should('be.visible');
cy.contains('Create').click();
diff --git a/web/cypress/support/commands.js b/web/cypress/support/commands.js
index 590243c..4592efb 100644
--- a/web/cypress/support/commands.js
+++ b/web/cypress/support/commands.js
@@ -59,7 +59,7 @@ Cypress.Commands.add('configurePlugins', (cases) => {
cy.contains(name)
.parents(domSelector.parents)
.within(() => {
- cy.contains('Enable').click({
+ cy.get('button').click({
force: true,
});
});
diff --git a/web/src/components/Plugin/PluginPage.tsx b/web/src/components/Plugin/PluginPage.tsx
index 61e9bee..f47f9fd 100644
--- a/web/src/components/Plugin/PluginPage.tsx
+++ b/web/src/components/Plugin/PluginPage.tsx
@@ -183,16 +183,17 @@ const PluginPage: React.FC<Props> = ({
key={item.name}
actions={[
<Button
- type={
- initialData[item.name] && !initialData[item.name].disable
- ? 'primary'
- : 'default'
- }
+ type={initialData[item.name] && !initialData[item.name].disable ? 'primary' : 'default'}
+ danger={initialData[item.name] && !initialData[item.name].disable}
onClick={() => {
setName(item.name);
}}
>
- Enable
+ {
+ initialData[item.name] && !initialData[item.name].disable
+ ? formatMessage({ id: 'component.plugin.disable' })
+ : formatMessage({ id: 'component.plugin.enable' })
+ }
</Button>,
]}
title={[
diff --git a/web/src/components/Plugin/locales/en-US.ts b/web/src/components/Plugin/locales/en-US.ts
index 26fa357..96d2b2b 100644
--- a/web/src/components/Plugin/locales/en-US.ts
+++ b/web/src/components/Plugin/locales/en-US.ts
@@ -21,6 +21,8 @@ export default {
'component.step.select.pluginTemplate.select.option': 'Custom',
'component.plugin.pluginTemplate.tip1': '1. When a route already have plugins field configured, the plugins in the plugin template will be merged into it.',
'component.plugin.pluginTemplate.tip2': '2. The same plugin in the plugin template will override one in the plugins',
+ 'component.plugin.enable': 'Enable',
+ 'component.plugin.disable': 'Disable',
'component.plugin.authentication': 'Authentication',
'component.plugin.security': 'Security',
'component.plugin.traffic': 'Traffic Control',
diff --git a/web/src/components/Plugin/locales/zh-CN.ts b/web/src/components/Plugin/locales/zh-CN.ts
index b88f6e8..b46a413 100644
--- a/web/src/components/Plugin/locales/zh-CN.ts
+++ b/web/src/components/Plugin/locales/zh-CN.ts
@@ -21,6 +21,8 @@ export default {
'component.step.select.pluginTemplate.select.option': '手动配置',
'component.plugin.pluginTemplate.tip1': '1. 若路由已配置插件,则插件模板数据将与已配置的插件数据合并。',
'component.plugin.pluginTemplate.tip2': '2. 插件模板相同的插件会覆盖掉原有的插件。',
+ 'component.plugin.enable': '启用',
+ 'component.plugin.disable': '禁用',
'component.plugin.authentication': '身份验证',
'component.plugin.security': '安全防护',
'component.plugin.traffic': '流量控制',