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
2a7fedaf
Commit
2a7fedaf
authored
Mar 16, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed closeAll & discardAll specs
parent
4d2180d0
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
178 additions
and
136 deletions
+178
-136
ee/app/assets/javascripts/ide/stores/actions.js
ee/app/assets/javascripts/ide/stores/actions.js
+46
-35
spec/javascripts/ide/stores/actions_spec.js
spec/javascripts/ide/stores/actions_spec.js
+132
-101
No files found.
ee/app/assets/javascripts/ide/stores/actions.js
View file @
2a7fedaf
...
...
@@ -10,7 +10,7 @@ export const setInitialData = ({ commit }, data) =>
commit
(
types
.
SET_INITIAL_DATA
,
data
);
export
const
discardAllChanges
=
({
state
,
commit
,
dispatch
})
=>
{
state
.
changedFiles
.
forEach
(
(
file
)
=>
{
state
.
changedFiles
.
forEach
(
file
=>
{
commit
(
types
.
DISCARD_FILE_CHANGES
,
file
.
path
);
if
(
file
.
tempFile
)
{
...
...
@@ -22,7 +22,7 @@ export const discardAllChanges = ({ state, commit, dispatch }) => {
};
export
const
closeAllFiles
=
({
state
,
dispatch
})
=>
{
state
.
openFiles
.
forEach
(
file
=>
dispatch
(
'
closeFile
'
,
file
));
state
.
openFiles
.
forEach
(
file
=>
dispatch
(
'
closeFile
'
,
file
.
path
));
};
export
const
setPanelCollapsedStatus
=
({
commit
},
{
side
,
collapsed
})
=>
{
...
...
@@ -40,51 +40,62 @@ export const setResizingStatus = ({ commit }, resizing) => {
export
const
createTempEntry
=
(
{
state
,
commit
,
dispatch
},
{
branchId
,
name
,
type
,
content
=
''
,
base64
=
false
},
)
=>
new
Promise
((
resolve
)
=>
{
const
worker
=
new
FilesDecoratorWorker
();
const
fullName
=
name
.
slice
(
-
1
)
!==
'
/
'
&&
type
===
'
tree
'
?
`
${
name
}
/`
:
name
;
)
=>
new
Promise
(
resolve
=>
{
const
worker
=
new
FilesDecoratorWorker
();
const
fullName
=
name
.
slice
(
-
1
)
!==
'
/
'
&&
type
===
'
tree
'
?
`
${
name
}
/`
:
name
;
if
(
state
.
entries
[
name
])
{
flash
(
`The name "
${
name
.
split
(
'
/
'
)
.
pop
()}
" is already taken in this directory.`
,
'
alert
'
,
document
,
null
,
false
,
true
,
);
resolve
();
return
null
;
}
if
(
state
.
entries
[
name
])
{
flash
(
`The name "
${
name
.
split
(
'
/
'
).
pop
()}
" is already taken in this directory.`
,
'
alert
'
,
document
,
null
,
false
,
true
)
;
worker
.
addEventListener
(
'
message
'
,
({
data
})
=>
{
const
{
file
}
=
data
;
resolv
e
();
worker
.
terminat
e
();
return
null
;
}
commit
(
types
.
CREATE_TMP_ENTRY
,
{
data
,
projectId
:
state
.
currentProjectId
,
branchId
,
});
worker
.
addEventListener
(
'
message
'
,
({
data
})
=>
{
const
{
file
}
=
data
;
if
(
type
===
'
blob
'
)
{
commit
(
types
.
TOGGLE_FILE_OPEN
,
file
.
path
);
commit
(
types
.
ADD_FILE_TO_CHANGED
,
file
.
path
);
dispatch
(
'
setFileActive
'
,
file
.
path
);
}
worker
.
terminate
();
resolve
(
file
);
});
commit
(
types
.
CREATE_TMP_ENTRY
,
{
data
,
worker
.
postMessage
(
{
data
:
[
fullName
]
,
projectId
:
state
.
currentProjectId
,
branchId
,
type
,
tempFile
:
true
,
base64
,
content
,
});
if
(
type
===
'
blob
'
)
{
commit
(
types
.
TOGGLE_FILE_OPEN
,
file
.
path
);
commit
(
types
.
ADD_FILE_TO_CHANGED
,
file
.
path
);
dispatch
(
'
setFileActive
'
,
file
.
path
);
}
resolve
(
file
);
});
worker
.
postMessage
({
data
:
[
fullName
],
projectId
:
state
.
currentProjectId
,
branchId
,
type
,
tempFile
:
true
,
base64
,
content
,
return
null
;
});
return
null
;
});
export
const
scrollToTab
=
()
=>
{
Vue
.
nextTick
(()
=>
{
const
tabs
=
document
.
getElementById
(
'
tabs
'
);
...
...
spec/javascripts/ide/stores/actions_spec.js
View file @
2a7fedaf
This diff is collapsed.
Click to expand it.
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