Fix ApiDoc insert update failure (#276)
* Fix ApiDoc insertion update failure
* Modify the array traversal method
---------
Co-authored-by: hezc <hezc@hzwangda.com>
diff --git a/src/routes/Document/components/AddAndUpdateApiDoc.js b/src/routes/Document/components/AddAndUpdateApiDoc.js
index 9138232..06083b7 100644
--- a/src/routes/Document/components/AddAndUpdateApiDoc.js
+++ b/src/routes/Document/components/AddAndUpdateApiDoc.js
@@ -17,7 +17,7 @@
/* eslint-disable no-unused-expressions */
/* eslint-disable radix */
-import { Modal, Form, Input, Select, message } from "antd";
+import { Modal, Form, Input, Select, message,Radio } from "antd";
import React, { Component } from "react";
import PropTypes from "prop-types";
import { Method } from "./globalData";
@@ -42,6 +42,11 @@
"import swagger",
"import yapi"
];
+const STATE_TYPE = [
+ "unpublished",
+ "published",
+ "offline"
+];
class AddAndUpdateApiDoc extends Component {
static defaultProps = {
@@ -254,7 +259,7 @@
initialValue: rpcType
})(
<Select>
- {Object.values(RPCTYPE).map((e, i) => {
+ {RPCTYPE.map((e, i) => {
return (
<Select.Option key={`${e} ${i}`} value={e}>
{e}
@@ -277,9 +282,16 @@
],
initialValue: state
})(
- <Input
- placeholder={getIntlContent("SHENYU.DOCUMENT.APIDOC.STATE")}
- />
+ <Radio.Group buttonStyle="solid">
+ {STATE_TYPE.map((e, i) => {
+ return (
+ <Radio.Button key={`${e} ${i}`} value={i}>
+ {e}
+ </Radio.Button>
+ );
+ })}
+
+ </Radio.Group>
)}
</Form.Item>
<Form.Item
@@ -350,7 +362,7 @@
initialValue: apiSource
})(
<Select>
- {Object.values(API_SOURCE_TYPE).map((e, i) => {
+ {API_SOURCE_TYPE.map((e, i) => {
return (
<Select.Option key={`${e} ${i}`} value={i}>
{e}