Skip to content

Commit

Permalink
fix import bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Bosn committed Jul 19, 2019
1 parent 52f7b61 commit 3c1c5f5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ yarn-error.log*
# css
src/**/*.css
build
build.zip
20 changes: 18 additions & 2 deletions src/components/editor/Importer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class Importer extends Component<ImporterProps, ImporterState> {
};
// TODO 2.1 待完整测试各种输入
// DONE 2.1 BUG 类型 Number,初始值 '',被解析为随机字符串
handleJSONSchema = (schema: any, parent = { id: '-1' }, memoryProperties: any, siblings?: any) => {
handleJSONSchema = (schema: any, parent = { id: -1 }, memoryProperties: any, siblings?: any) => {
if (!schema) { return }
const { auth, repository, mod, itf, scope } = this.props
const hasSiblings = siblings instanceof Array && siblings.length > 0
Expand Down Expand Up @@ -153,7 +153,23 @@ class Importer extends Component<ImporterProps, ImporterState> {
}
}
}
const property = Object.assign(

type Property = {
name: any;
type: any;
rule: string;
value: any;
descripton: string;
creator: any;
repositoryId: any;
moduleId: any;
interfaceId: any;
scope: any;
parentId: number;
memory: boolean;
id: any;
}
const property: Property = Object.assign(
{
name: schema.name,
type,
Expand Down
2 changes: 2 additions & 0 deletions src/components/editor/InterfaceEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class InterfaceEditor extends Component<
bodyOption={this.state.summaryState.bodyOption}
requestParamsType={this.state.summaryState.requestParamsType}
handleChangeProperty={this.handleChangeProperty}
handleDeleteMemoryProperty={this.handleDeleteMemoryProperty}
/>
<ResponsePropertyList
properties={this.state.properties}
Expand All @@ -136,6 +137,7 @@ class InterfaceEditor extends Component<
mod={mod}
itf={this.state.itf}
handleChangeProperty={this.handleChangeProperty}
handleDeleteMemoryProperty={this.handleDeleteMemoryProperty}
/>
<RModal
when={this.state.moveInterfaceDialogOpen}
Expand Down
2 changes: 1 addition & 1 deletion src/components/editor/PropertyList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ class PropertyList extends Component<any, any> {
}
handleDeleteMemoryProperty = (e: any, property: any) => {
e.preventDefault()
const { handleDeleteMemoryProperty } = this.context
const { handleDeleteMemoryProperty } = this.props
handleDeleteMemoryProperty(property)
}
handleSortProperties = (_: any, sortable: any) => {
Expand Down

0 comments on commit 3c1c5f5

Please sign in to comment.