Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-editor
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
zeroing-editor
Commits
457bb750
Commit
457bb750
authored
Nov 10, 2020
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复代码冲突手动合并的问题
parent
293825c6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
225 additions
and
225 deletions
+225
-225
config.js
src/config.js
+1
-1
zh-CN.json
src/locales/zh-CN.json
+1
-1
CodeConflictResolveDialog.vue
src/views/Editor/dialogs/CodeConflictResolveDialog.vue
+2
-2
ProjectConflictResolveDialog.vue
src/views/Editor/dialogs/ProjectConflictResolveDialog.vue
+219
-219
yarn.lock
yarn.lock
+2
-2
No files found.
src/config.js
View file @
457bb750
...
...
@@ -7,7 +7,7 @@ if (process.env.NODE_ENV === 'development') {
//API_HOST = '//10.10.95.74:7777';
//API_HOST = '//192.168.1.16:7777';
API_HOST
=
'//0.0.0.0:3000'
;
//API_HOST = '//
localhost
:8080';
//API_HOST = '//
0.0.0.0
:8080';
//API_HOST = window.__data.apiHost;
//API_HOST = 'http://beacon.duiba.com.cn';
//API_HOST = 'http://beacon.duibadev.com.cn';
...
...
src/locales/zh-CN.json
View file @
457bb750
...
...
@@ -240,7 +240,7 @@
"Merge conflicts"
:
"合并冲突"
,
"There are still unresolved conflicts"
:
"还有冲突未解决,不能保存!"
,
"The format of the JSON document is wrong"
:
"JSON文档格式有误,请先更正!"
,
"The conflict has been resolved"
:
"
冲突已解决,确定提交
吗?"
,
"The conflict has been resolved"
:
"
该文件的冲突已解决,继续
吗?"
,
"All conflict has been resolved"
:
"所有冲突已解决,确定保存吗?"
,
"Failed to update operator"
:
"更新权限列表失败"
,
"Error delete self"
:
"连自己都删? 不可以!"
,
...
...
src/views/Editor/dialogs/CodeConflictResolveDialog.vue
View file @
457bb750
...
...
@@ -44,7 +44,7 @@
</div>
<div>
<el-button
size=
"mini"
@
click=
"onCancel"
>
{{
$t
(
'Cancel'
)
}}
</el-button>
<el-button
size=
"mini"
@
click=
"onSave"
type=
"primary"
:disabled=
"step===0"
>
{{
$t
(
'Co
mmit
'
)
}}
</el-button>
<el-button
size=
"mini"
@
click=
"onSave"
type=
"primary"
:disabled=
"step===0"
>
{{
$t
(
'Co
nfirm
'
)
}}
</el-button>
</div>
</div>
</el-dialog>
...
...
@@ -435,4 +435,4 @@
<
style
scoped
>
</
style
>
\ No newline at end of file
</
style
>
src/views/Editor/dialogs/ProjectConflictResolveDialog.vue
View file @
457bb750
<
template
>
<el-dialog
:title=
"$t('Project conflict resolver')"
width=
"80vw"
:visible
.
sync=
"visible"
@
opened=
"onOpen"
@
close=
"onClose"
:close-on-click-modal=
"false"
:append-to-body=
"true"
custom-class=
"flex-dialog project-conflict-resolve-editor"
>
<div
class=
"wrapper"
>
<span>
冲突数:
{{
conflictCounting
}}
</span>
<el-tabs
tab-position=
"left"
class=
"category-tab"
>
<el-tab-pane
v-for=
"(categoryConfig, category) in categories"
:key=
"category"
:label=
"`$
{categoryConfig.label}(${conflictCountingMap[category]})`">
<list-compare-view
class=
"compare-view"
:compares=
"compareGroup[category]"
:category=
"category"
@
merge-conflict=
"mergeConflict"
/>
</el-tab-pane>
</el-tabs>
</div>
<div
slot=
"footer"
class=
"dialog-footer"
>
<div>
</div>
<div>
<el-button
size=
"mini"
@
click=
"onCancel"
>
{{
$t
(
'Cancel'
)
}}
</el-button>
<el-button
size=
"mini"
@
click=
"onSave"
type=
"primary"
:disabled=
"conflictCounting > 0"
>
{{
$t
(
'Save'
)
}}
</el-button>
</div>
</div>
<code-conflict-resolve-dialog
ref=
"codeConflictResolveDialog"
@
resolved=
"onCodeConflictResolved"
/>
</el-dialog>
<el-dialog
:title=
"$t('Project conflict resolver')"
width=
"80vw"
:visible
.
sync=
"visible"
@
opened=
"onOpen"
@
close=
"onClose"
:close-on-click-modal=
"false"
:append-to-body=
"true"
custom-class=
"flex-dialog project-conflict-resolve-editor"
>
<div
class=
"wrapper"
>
<span>
冲突数:
{{
conflictCounting
}}
</span>
<el-tabs
tab-position=
"left"
class=
"category-tab"
>
<el-tab-pane
v-for=
"(categoryConfig, category) in categories"
:key=
"category"
:label=
"`$
{categoryConfig.label}(${conflictCountingMap[category]})`">
<list-compare-view
class=
"compare-view"
:compares=
"compareGroup[category]"
:category=
"category"
@
merge-conflict=
"mergeConflict"
/>
</el-tab-pane>
</el-tabs>
</div>
<div
slot=
"footer"
class=
"dialog-footer"
>
<div>
</div>
<div>
<el-button
size=
"mini"
@
click=
"onCancel"
>
{{
$t
(
'Cancel'
)
}}
</el-button>
<el-button
size=
"mini"
@
click=
"onSave"
type=
"primary"
:disabled=
"conflictCounting > 0"
>
{{
$t
(
'Save'
)
}}
</el-button>
</div>
</div>
<code-conflict-resolve-dialog
ref=
"codeConflictResolveDialog"
@
resolved=
"onCodeConflictResolved"
/>
</el-dialog>
</
template
>
<
script
>
import
ListCompareView
from
"./ProjectConflictResolveDialog/ListCompareView"
;
import
CodeConflictResolveDialog
from
"./CodeConflictResolveDialog"
;
export
default
{
name
:
"ProjectConflictResolveDialog"
,
components
:
{
CodeConflictResolveDialog
,
ListCompareView
},
data
()
{
let
categories
=
this
.
$t
(
'categories'
);
let
conflictCountingMap
=
{};
for
(
let
key
in
categories
)
{
conflictCountingMap
[
key
]
=
0
;
}
return
{
visible
:
false
,
categories
,
compareGroup
:
{},
conflictCountingMap
,
}
},
computed
:
{
conflictCounting
()
{
let
t
=
0
;
for
(
let
count
of
Object
.
values
(
this
.
conflictCountingMap
))
{
t
+=
count
;
}
return
t
;
}
},
methods
:
{
show
(
remoteData
,
localData
)
{
try
{
this
.
analyseCompare
(
remoteData
,
localData
);
}
catch
(
e
)
{
console
.
log
(
e
);
}
this
.
visible
=
true
;
},
onClose
()
{
},
onOpen
()
{
},
async
onSave
()
{
await
this
.
$confirm
(
this
.
$t
(
'All conflict has been resolved'
),
this
.
$t
(
'Alert'
),
{
confirmButtonText
:
this
.
$t
(
'Confirm'
),
cancelButtonText
:
this
.
$t
(
'Cancel'
),
type
:
'warning'
}).
then
(()
=>
{
this
.
step
++
;
this
.
visible
=
false
;
this
.
$emit
(
'resolved'
,
JSON
.
stringify
(
this
.
localObj
));
}).
catch
((
e
)
=>
{
});
this
.
visible
=
false
;
},
onCancel
()
{
this
.
visible
=
false
;
},
analyseCompare
(
remoteData
,
localData
)
{
let
remoteJson
=
remoteData
?
JSON
.
parse
(
remoteData
)
:
{};
let
localJson
=
JSON
.
parse
(
localData
);
this
.
localObj
=
localJson
;
let
that
=
this
;
for
(
let
key
in
this
.
categories
)
{
this
.
conflictCountingMap
[
key
]
=
0
;
}
let
compareGroup
=
{};
for
(
let
category
in
this
.
categories
)
{
let
categoryConfig
=
this
.
categories
[
category
];
let
compares
=
[];
if
(
categoryConfig
.
simple
)
{
addCompare
(
category
,
compares
,
remoteJson
[
category
],
localJson
[
category
]);
}
else
{
let
{
key
,
name
}
=
categoryConfig
;
let
remote
=
remoteJson
[
category
]
||
[];
let
local
=
localJson
[
category
]
||
[];
let
analysedUUIDs
=
[];
for
(
let
remoteItem
of
remote
)
{
const
localItem
=
local
.
find
(
item
=>
item
[
key
]
===
remoteItem
[
key
]);
addCompare
(
category
,
compares
,
remoteItem
,
localItem
,
remoteItem
[
key
],
name
);
analysedUUIDs
.
push
(
remoteItem
[
key
]);
}
for
(
let
localItem
of
local
)
{
if
(
analysedUUIDs
.
includes
(
localItem
[
key
]))
{
continue
;
}
const
remoteItem
=
remote
.
find
(
item
=>
item
[
key
]
===
localItem
[
key
]);
addCompare
(
category
,
compares
,
remoteItem
,
localItem
,
localItem
[
key
],
name
);
analysedUUIDs
.
push
(
localItem
[
key
]);
}
}
compareGroup
[
category
]
=
compares
;
}
this
.
compareGroup
=
compareGroup
;
function
addCompare
(
category
,
compares
,
remote
,
local
,
key
,
name
=
'name'
)
{
let
remoteStr
=
remote
?
JSON
.
stringify
(
remote
)
:
''
;
let
localStr
=
local
?
JSON
.
stringify
(
local
)
:
''
;
let
compare
=
{
key
,
resolved
:
!
((
!
remote
||
!
local
)
||
remoteStr
!==
localStr
),
};
if
(
remote
)
{
compare
.
remote
=
{
name
:
remote
[
name
],
data
:
remoteStr
,
obj
:
remote
};
}
if
(
local
)
{
compare
.
local
=
{
name
:
local
[
name
],
data
:
localStr
,
obj
:
local
};
}
compares
.
push
(
compare
);
if
(
!
compare
.
resolved
)
{
that
.
conflictCountingMap
[
category
]
++
;
}
}
},
mergeConflict
(
action
,
conflict
,
category
)
{
const
{
remote
,
local
}
=
conflict
;
switch
(
action
)
{
case
'remote'
:
this
.
reSaveConflict
(
conflict
,
remote
,
category
);
break
;
case
'local'
:
this
.
reSaveConflict
(
conflict
,
local
,
category
);
break
;
case
'manual'
:
this
.
lastConflict
=
conflict
;
this
.
lastCategory
=
category
;
this
.
$refs
.
codeConflictResolveDialog
.
show
(
remote
?
remote
.
data
:
''
,
local
?
local
.
data
:
''
);
break
;
}
},
onCodeConflictResolved
(
data
)
{
if
(
this
.
lastConflict
)
{
this
.
reSaveConflict
(
this
.
lastConflict
,
data
,
this
.
lastCategory
);
}
},
reSaveConflict
(
conflict
,
result
,
category
)
{
let
resultData
;
if
(
result
)
{
if
(
typeof
result
.
obj
===
'string'
)
{
resultData
=
JSON
.
parse
(
result
.
obj
);
}
else
{
resultData
=
result
.
obj
;
}
}
let
data
=
this
.
localObj
[
category
];
let
categoryConfig
=
this
.
categories
[
category
];
if
(
categoryConfig
.
simple
)
{
if
(
resultData
)
{
this
.
localObj
[
category
]
=
resultData
;
}
else
{
delete
this
.
localObj
[
category
];
}
}
else
{
let
matched
=
false
;
data
.
some
((
item
,
index
)
=>
{
if
(
item
[
categoryConfig
.
key
]
===
conflict
.
key
)
{
if
(
resultData
)
{
data
[
index
]
=
resultData
;
}
else
{
data
.
splice
(
index
,
1
);
}
matched
=
true
;
return
true
;
}
});
if
(
!
matched
)
{
if
(
resultData
)
{
data
.
push
(
resultData
);
}
else
{
}
}
}
this
.
$set
(
conflict
,
'resolved'
,
true
);
this
.
conflictCountingMap
[
category
]
--
;
}
}
}
import
ListCompareView
from
"./ProjectConflictResolveDialog/ListCompareView"
;
import
CodeConflictResolveDialog
from
"./CodeConflictResolveDialog"
;
export
default
{
name
:
"ProjectConflictResolveDialog"
,
components
:
{
CodeConflictResolveDialog
,
ListCompareView
},
data
()
{
let
categories
=
this
.
$t
(
'categories'
);
let
conflictCountingMap
=
{};
for
(
let
key
in
categories
)
{
conflictCountingMap
[
key
]
=
0
;
}
return
{
visible
:
false
,
categories
,
compareGroup
:
{},
conflictCountingMap
,
}
},
computed
:
{
conflictCounting
()
{
let
t
=
0
;
for
(
let
count
of
Object
.
values
(
this
.
conflictCountingMap
))
{
t
+=
count
;
}
return
t
;
}
},
methods
:
{
show
(
remoteData
,
localData
)
{
try
{
this
.
analyseCompare
(
remoteData
,
localData
);
}
catch
(
e
)
{
console
.
log
(
e
);
}
this
.
visible
=
true
;
},
onClose
()
{
},
onOpen
()
{
},
async
onSave
()
{
await
this
.
$confirm
(
this
.
$t
(
'All conflict has been resolved'
),
this
.
$t
(
'Alert'
),
{
confirmButtonText
:
this
.
$t
(
'Confirm'
),
cancelButtonText
:
this
.
$t
(
'Cancel'
),
type
:
'warning'
}).
then
(()
=>
{
this
.
step
++
;
this
.
visible
=
false
;
this
.
$emit
(
'resolved'
,
JSON
.
stringify
(
this
.
localObj
));
}).
catch
((
e
)
=>
{
});
this
.
visible
=
false
;
},
onCancel
()
{
this
.
visible
=
false
;
},
analyseCompare
(
remoteData
,
localData
)
{
let
remoteJson
=
remoteData
?
JSON
.
parse
(
remoteData
)
:
{};
let
localJson
=
JSON
.
parse
(
localData
);
this
.
localObj
=
localJson
;
let
that
=
this
;
for
(
let
key
in
this
.
categories
)
{
this
.
conflictCountingMap
[
key
]
=
0
;
}
let
compareGroup
=
{};
for
(
let
category
in
this
.
categories
)
{
let
categoryConfig
=
this
.
categories
[
category
];
let
compares
=
[];
if
(
categoryConfig
.
simple
)
{
addCompare
(
category
,
compares
,
remoteJson
[
category
],
localJson
[
category
]);
}
else
{
let
{
key
,
name
}
=
categoryConfig
;
let
remote
=
remoteJson
[
category
]
||
[];
let
local
=
localJson
[
category
]
||
[];
let
analysedUUIDs
=
[];
for
(
let
remoteItem
of
remote
)
{
const
localItem
=
local
.
find
(
item
=>
item
[
key
]
===
remoteItem
[
key
]);
addCompare
(
category
,
compares
,
remoteItem
,
localItem
,
remoteItem
[
key
],
name
);
analysedUUIDs
.
push
(
remoteItem
[
key
]);
}
for
(
let
localItem
of
local
)
{
if
(
analysedUUIDs
.
includes
(
localItem
[
key
]))
{
continue
;
}
const
remoteItem
=
remote
.
find
(
item
=>
item
[
key
]
===
localItem
[
key
]);
addCompare
(
category
,
compares
,
remoteItem
,
localItem
,
localItem
[
key
],
name
);
analysedUUIDs
.
push
(
localItem
[
key
]);
}
}
compareGroup
[
category
]
=
compares
;
}
this
.
compareGroup
=
compareGroup
;
function
addCompare
(
category
,
compares
,
remote
,
local
,
key
,
name
=
'name'
)
{
let
remoteStr
=
remote
?
JSON
.
stringify
(
remote
)
:
''
;
let
localStr
=
local
?
JSON
.
stringify
(
local
)
:
''
;
let
compare
=
{
key
,
resolved
:
!
((
!
remote
||
!
local
)
||
remoteStr
!==
localStr
),
};
if
(
remote
)
{
compare
.
remote
=
{
name
:
remote
[
name
],
data
:
remoteStr
,
obj
:
remote
};
}
if
(
local
)
{
compare
.
local
=
{
name
:
local
[
name
],
data
:
localStr
,
obj
:
local
};
}
compares
.
push
(
compare
);
if
(
!
compare
.
resolved
)
{
that
.
conflictCountingMap
[
category
]
++
;
}
}
},
mergeConflict
(
action
,
conflict
,
category
)
{
const
{
remote
,
local
}
=
conflict
;
switch
(
action
)
{
case
'remote'
:
this
.
reSaveConflict
(
conflict
,
remote
,
category
);
break
;
case
'local'
:
this
.
reSaveConflict
(
conflict
,
local
,
category
);
break
;
case
'manual'
:
this
.
lastConflict
=
conflict
;
this
.
lastCategory
=
category
;
this
.
$refs
.
codeConflictResolveDialog
.
show
(
remote
?
remote
.
data
:
''
,
local
?
local
.
data
:
''
);
break
;
}
},
onCodeConflictResolved
(
data
)
{
if
(
this
.
lastConflict
)
{
this
.
reSaveConflict
(
this
.
lastConflict
,
{
obj
:
data
}
,
this
.
lastCategory
);
}
},
reSaveConflict
(
conflict
,
result
,
category
)
{
let
resultData
;
if
(
result
)
{
if
(
typeof
result
.
obj
===
'string'
)
{
resultData
=
JSON
.
parse
(
result
.
obj
);
}
else
{
resultData
=
result
.
obj
;
}
}
let
data
=
this
.
localObj
[
category
];
let
categoryConfig
=
this
.
categories
[
category
];
if
(
categoryConfig
.
simple
)
{
if
(
resultData
)
{
this
.
localObj
[
category
]
=
resultData
;
}
else
{
delete
this
.
localObj
[
category
];
}
}
else
{
let
matched
=
false
;
data
.
some
((
item
,
index
)
=>
{
if
(
item
[
categoryConfig
.
key
]
===
conflict
.
key
)
{
if
(
resultData
)
{
data
[
index
]
=
resultData
;
}
else
{
data
.
splice
(
index
,
1
);
}
matched
=
true
;
return
true
;
}
});
if
(
!
matched
)
{
if
(
resultData
)
{
data
.
push
(
resultData
);
}
else
{
}
}
}
this
.
$set
(
conflict
,
'resolved'
,
true
);
this
.
conflictCountingMap
[
category
]
--
;
}
}
}
</
script
>
<
style
scoped
>
</
style
>
\ No newline at end of file
</
style
>
yarn.lock
View file @
457bb750
...
...
@@ -9053,7 +9053,7 @@ yeast@0.1.2:
props-compute "http://gitlab2.dui88.com/laoqifeng/props-compute.git"
"zeroing-template-fill@http://gitlab2.dui88.com/laoqifeng/zeroing-template-fill.git":
version "1.0.
0
"
resolved "http://gitlab2.dui88.com/laoqifeng/zeroing-template-fill.git#
11f5cc42faea5745a36fc73fc8374419031de783
"
version "1.0.
1
"
resolved "http://gitlab2.dui88.com/laoqifeng/zeroing-template-fill.git#
bd9c85b5baf4bf67a6a661b2af0d31e985d3e7bf
"
dependencies:
camelcase "^5.3.1"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment