Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
cc04a18d
Commit
cc04a18d
authored
Aug 02, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve performance of deleting
parent
3f4aaea2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
11 deletions
+19
-11
app/assets/javascripts/ide/stores/actions.js
app/assets/javascripts/ide/stores/actions.js
+13
-5
app/assets/javascripts/ide/stores/getters.js
app/assets/javascripts/ide/stores/getters.js
+2
-2
app/assets/javascripts/ide/stores/mutations.js
app/assets/javascripts/ide/stores/mutations.js
+2
-1
app/assets/javascripts/ide/stores/utils.js
app/assets/javascripts/ide/stores/utils.js
+2
-3
No files found.
app/assets/javascripts/ide/stores/actions.js
View file @
cc04a18d
...
...
@@ -187,24 +187,32 @@ export const openNewEntryModal = ({ commit }, { type, path = '' }) => {
export
const
deleteEntry
=
({
commit
,
dispatch
,
state
},
path
)
=>
{
const
entry
=
state
.
entries
[
path
];
dispatch
(
'
burstUnusedSeal
'
);
dispatch
(
'
closeFile
'
,
entry
);
if
(
state
.
unusedSeal
)
dispatch
(
'
burstUnusedSeal
'
);
if
(
entry
.
opened
)
dispatch
(
'
closeFile
'
,
entry
);
if
(
entry
.
type
===
'
tree
'
)
{
entry
.
tree
.
forEach
(
f
=>
dispatch
(
'
deleteEntry
'
,
f
.
path
));
}
commit
(
types
.
DELETE_ENTRY
,
path
);
if
(
entry
.
parentPath
&&
state
.
entries
[
entry
.
parentPath
].
tree
.
length
===
0
)
{
dispatch
(
'
deleteEntry
'
,
entry
.
parentPath
);
}
};
export
const
resetOpenFiles
=
({
commit
})
=>
commit
(
types
.
RESET_OPEN_FILES
);
export
const
renameEntry
=
({
dispatch
,
commit
,
state
},
{
path
,
name
,
entryPath
=
null
})
=>
{
const
entry
=
state
.
entries
[
entryPath
||
path
];
commit
(
types
.
RENAME_ENTRY
,
{
path
,
name
,
entryPath
});
state
.
entries
[
entryPath
||
path
].
tree
.
forEach
(
f
=>
dispatch
(
'
renameEntry
'
,
{
path
,
name
,
entryPath
:
f
.
path
}),
);
if
(
entry
.
type
===
'
tree
'
)
{
state
.
entries
[
entryPath
||
path
].
tree
.
forEach
(
f
=>
dispatch
(
'
renameEntry
'
,
{
path
,
name
,
entryPath
:
f
.
path
}),
);
}
if
(
!
entryPath
)
{
dispatch
(
'
deleteEntry
'
,
path
);
...
...
app/assets/javascripts/ide/stores/getters.js
View file @
cc04a18d
...
...
@@ -67,9 +67,9 @@ export const someUncommitedChanges = state =>
!!
(
state
.
changedFiles
.
length
||
state
.
stagedFiles
.
length
);
export
const
getChangesInFolder
=
state
=>
path
=>
{
const
changedFilesCount
=
state
.
changedFiles
.
filter
(
f
=>
filePathMatches
(
f
,
path
)).
length
;
const
changedFilesCount
=
state
.
changedFiles
.
filter
(
f
=>
filePathMatches
(
f
.
path
,
path
)).
length
;
const
stagedFilesCount
=
state
.
stagedFiles
.
filter
(
f
=>
filePathMatches
(
f
,
path
)
&&
!
getChangedFile
(
state
)(
f
.
path
),
f
=>
filePathMatches
(
f
.
path
,
path
)
&&
!
getChangedFile
(
state
)(
f
.
path
),
).
length
;
return
changedFilesCount
+
stagedFilesCount
;
...
...
app/assets/javascripts/ide/stores/mutations.js
View file @
cc04a18d
...
...
@@ -198,7 +198,8 @@ export default {
:
state
.
trees
[
`
${
state
.
currentProjectId
}
/
${
state
.
currentBranchId
}
`
];
entry
.
deleted
=
true
;
parent
.
tree
=
parent
.
tree
.
filter
(
f
=>
f
.
path
!==
entry
.
path
);
parent
.
tree
.
splice
(
parent
.
tree
.
findIndex
(
f
=>
f
.
path
===
entry
.
path
),
1
);
if
(
entry
.
type
===
'
blob
'
)
{
state
.
changedFiles
=
state
.
changedFiles
.
concat
(
entry
);
...
...
app/assets/javascripts/ide/stores/utils.js
View file @
cc04a18d
...
...
@@ -172,8 +172,7 @@ export const sortTree = sortedTree =>
)
.
sort
(
sortTreesByTypeAndName
);
export
const
filePathMatches
=
(
f
,
path
)
=>
f
.
path
.
replace
(
new
RegExp
(
`
${
f
.
name
}
$`
),
''
).
indexOf
(
`
${
path
}
/`
)
===
0
;
export
const
filePathMatches
=
(
filePath
,
path
)
=>
filePath
.
indexOf
(
`
${
path
}
/`
)
===
0
;
export
const
getChangesCountForFiles
=
(
files
,
path
)
=>
files
.
filter
(
f
=>
filePathMatches
(
f
,
path
)).
length
;
files
.
filter
(
f
=>
filePathMatches
(
f
.
path
,
path
)).
length
;
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