juzhiyuan commented on a change in pull request #1402:
URL: https://github.com/apache/apisix-dashboard/pull/1402#discussion_r568265974



##########
File path: web/src/components/Plugin/PluginDetail.tsx
##########
@@ -35,8 +35,10 @@ import { LinkOutlined } from '@ant-design/icons';
 import Ajv from 'ajv';
 import type { DefinedError } from 'ajv';
 import addFormats from 'ajv-formats';
+import { omit } from 'lodash';
 
 import { fetchSchema } from './service';
+import { createOrUpdate } from '@/pages/Plugin/service';

Review comment:
       Line41 contains `@/xx`, it should be ahead of Line40.

##########
File path: web/src/components/Plugin/PluginDetail.tsx
##########
@@ -174,24 +178,49 @@ const PluginDetail: React.FC<Props> = ({
             <Button onClick={onClose} key={1}>
               {formatMessage({ id: 'component.global.cancel' })}
             </Button>
-            <Button
-              key={2}
-              type="primary"
-              onClick={() => {
-                try {
-                  const editorData = 
JSON.parse(ref.current?.editor.getValue());
-                  validateData(name, editorData).then((value) => {
-                    onChange({ formData: form.getFieldsValue(), 
codemirrorData: value });
-                  });
-                } catch (error) {
-                  notification.error({
-                    message: 'Invalid JSON data',
+            <Space>
+              <Popconfirm
+                title={formatMessage({ id: 
'page.plugin.drawer.popconfirm.title.delete' })}
+                okText={formatMessage({ id: 'component.global.confirm' })}
+                cancelText={formatMessage({ id: 'component.global.cancel' })}
+                onConfirm={() => {
+                  const plugins = omit(initialData, [`${name}`]);

Review comment:
       ```suggestion
                     const plugins = omit(initialData, name);
   ```

##########
File path: web/src/pages/Plugin/locales/en-US.ts
##########
@@ -14,4 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-export default {};
+export default {
+  'page.plugin.drawer.popconfirm.title.delete': 'Are you sure you want to 
delete all data from this plugin?',

Review comment:
       ```suggestion
     'page.plugin.drawer.popconfirm.title.delete': 'Are you sure to delete this 
item?',
   ```

##########
File path: web/src/pages/Plugin/locales/zh-CN.ts
##########
@@ -14,4 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-export default {};
+export default {
+  'page.plugin.drawer.popconfirm.title.delete': '您确定删除该插件所有数据吗?',

Review comment:
       ```suggestion
     'page.plugin.drawer.popconfirm.title.delete': '确定删除该插件吗?',
   ```




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to