Skip to content

Commit

Permalink
feat: improve the config plugin button enable disable status (#1610)
Browse files Browse the repository at this point in the history
Co-authored-by: 琚致远 <juzhiyuan@apache.org>
  • Loading branch information
stu01509 and juzhiyuan committed Apr 18, 2021
1 parent 17ff973 commit c9d2bd3
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
});
Expand All @@ -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,
});
});
Expand All @@ -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,
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion web/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
});
Expand Down
13 changes: 7 additions & 6 deletions web/src/components/Plugin/PluginPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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={[
Expand Down
2 changes: 2 additions & 0 deletions web/src/components/Plugin/locales/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 2 additions & 0 deletions web/src/components/Plugin/locales/zh-CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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': '流量控制',
Expand Down

0 comments on commit c9d2bd3

Please sign in to comment.