guoqqqi commented on code in PR #2630:
URL: https://github.com/apache/apisix-dashboard/pull/2630#discussion_r996583502
##########
web/src/pages/Consumer/List.tsx:
##########
@@ -38,7 +38,7 @@ const Page: React.FC = () => {
const [id, setId] = useState('');
const [editorMode, setEditorMode] = useState<'create' | 'update'>('create');
const { paginationConfig, savePageList, checkPageList } = usePagination();
-
+ const [deleteLoading, setDeleteLoading] = useState('');
Review Comment:
`deleteLoading` bad Variable name
##########
web/src/pages/Plugin/List.tsx:
##########
@@ -36,6 +36,7 @@ const Page: React.FC = () => {
const [pluginList, setPluginList] = useState<PluginComponent.Meta[]>([]);
const [name, setName] = useState('');
const { paginationConfig, savePageList, checkPageList } = usePagination();
+ const [deleteLoading, setDeleteLoading] = useState('');
Review Comment:
ditto
##########
web/src/pages/Route/List.tsx:
##########
@@ -108,18 +109,28 @@ const Page: React.FC = () => {
checkPageList(ref);
};
- const handlePublishOffline = (rid: string, status: RouteModule.RouteStatus)
=> {
- updateRouteStatus(rid, status).then(() => {
- const actionName = status
- ? formatMessage({ id: 'page.route.publish' })
- : formatMessage({ id: 'page.route.offline' });
- handleTableActionSuccessResponse(
- `${actionName} ${formatMessage({
- id: 'menu.routes',
- })} ${formatMessage({ id: 'component.status.success' })}`,
- );
- });
- };
+ const [publishOfflineLoading, setPublishOfflineLoading] =
useState<string>('');
Review Comment:
`loading` makes it read like a `boolean`
##########
web/src/pages/Service/Create.tsx:
##########
@@ -62,8 +62,9 @@ const Page: React.FC = (props) => {
});
}
}, []);
-
+ const [submitLoading, setSubmitLoading] = useState(false);
Review Comment:
Usually, we put the Hook at the top of the function scope
##########
web/cypress/e2e/route/create-route-with-search-service-and-set-priority.cy.js:
##########
@@ -171,7 +172,7 @@ context('Create Route with search service name', () => {
cy.contains(data.serviceName).siblings().contains('Delete').click();
cy.contains('button', 'Confirm').click();
cy.get(selector.notification).should('contain', data.deleteServiceSuccess);
-
+ cy.wait(4000);
Review Comment:
You can click here to remove the tip in the upper right corner, we should
try not to waste time by waiting as much as possible:
```
cy.get('.ant-notification-close-icon').click().should('not.exist');
```
##########
web/src/pages/Route/List.tsx:
##########
@@ -59,6 +59,7 @@ import { DebugDrawView } from './components/DebugViews';
import { RawDataEditor } from '@/components/RawDataEditor';
import { EXPORT_FILE_MIME_TYPE_SUPPORTED } from './constants';
import DataLoaderImport from '@/pages/Route/components/DataLoader/Import';
+import { useThrottleFn } from 'ahooks';
Review Comment:
move this line to 45
##########
web/src/pages/Route/Create.tsx:
##########
@@ -32,6 +32,7 @@ import CreateStep4 from './components/CreateStep4';
import { DEFAULT_STEP_1_DATA, DEFAULT_STEP_3_DATA } from './constants';
import ResultView from './components/ResultView';
import styles from './Create.less';
+import { useRequest } from 'ahooks';
Review Comment:
move this line to 22
##########
web/src/pages/Upstream/Create.tsx:
##########
@@ -48,8 +48,10 @@ const Page: React.FC = (props) => {
});
}
}, []);
+ const [submitLoading, setSubmitLoading] = useState(false);
Review Comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]