mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 02:10:59 +00:00
refactoring
This commit is contained in:
parent
9a86750e9d
commit
d4b18eae81
@ -7,8 +7,6 @@ UploadContentButton.propTypes = {
|
|||||||
|
|
||||||
export default function UploadContentButton({ uploadContent }) {
|
export default function UploadContentButton({ uploadContent }) {
|
||||||
|
|
||||||
let fileInput;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<FileChooser
|
<FileChooser
|
||||||
icon="fa-upload"
|
icon="fa-upload"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { Component, PropTypes } from 'react'
|
import React, { Component, PropTypes } from 'react'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
|
|
||||||
export function Divider () { return <hr className="divider"/>}
|
export const Divider = () => <hr className="divider"/>
|
||||||
|
|
||||||
export default class Dropdown extends Component {
|
export default class Dropdown extends Component {
|
||||||
|
|
||||||
|
@ -152,6 +152,5 @@ export function setContent(content){
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function stopEdit(flow, modifiedFlow) {
|
export function stopEdit(flow, modifiedFlow) {
|
||||||
let diff = getDiff(flow, modifiedFlow)
|
return flowsActions.update(flow, getDiff(flow, modifiedFlow))
|
||||||
return flowsActions.update(flow, diff)
|
|
||||||
}
|
}
|
||||||
|
@ -107,14 +107,15 @@ fetchApi.put = (url, json, options) => fetchApi(
|
|||||||
...options
|
...options
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
// deep comparison of two json objects (dicts). arrays are handeled as a single value.
|
||||||
|
// return: json object including only the changed keys value pairs.
|
||||||
export function getDiff(obj1, obj2) {
|
export function getDiff(obj1, obj2) {
|
||||||
let result = {...obj2};
|
let result = {...obj2};
|
||||||
for(let key in obj1) {
|
for(let key in obj1) {
|
||||||
if(_.isEqual(obj2[key], obj1[key]))
|
if(_.isEqual(obj2[key], obj1[key]))
|
||||||
result[key] = undefined
|
result[key] = undefined
|
||||||
else if(!(Array.isArray(obj2[key]) && Array.isArray(obj1[key])) &&
|
else if(Object.prototype.toString.call(obj2[key]) === '[object Object]' &&
|
||||||
typeof obj2[key] == 'object' && typeof obj1[key] == 'object')
|
Object.prototype.toString.call(obj1[key]) === '[object Object]' )
|
||||||
result[key] = getDiff(obj1[key], obj2[key])
|
result[key] = getDiff(obj1[key], obj2[key])
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
|
Loading…
Reference in New Issue
Block a user