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
5dbb7a25
Commit
5dbb7a25
authored
Mar 23, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed opening next tab being a pending tab
clears any active files when opening pending tab
parent
c4395488
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
12 deletions
+33
-12
app/assets/javascripts/ide/stores/actions/file.js
app/assets/javascripts/ide/stores/actions/file.js
+10
-4
app/assets/javascripts/ide/stores/mutations/file.js
app/assets/javascripts/ide/stores/mutations/file.js
+23
-8
No files found.
app/assets/javascripts/ide/stores/actions/file.js
View file @
5dbb7a25
...
@@ -12,7 +12,7 @@ export const closeFile = ({ commit, state, getters, dispatch }, file) => {
...
@@ -12,7 +12,7 @@ export const closeFile = ({ commit, state, getters, dispatch }, file) => {
if
(
file
.
pending
)
{
if
(
file
.
pending
)
{
commit
(
types
.
REMOVE_PENDING_TAB
,
file
);
commit
(
types
.
REMOVE_PENDING_TAB
,
file
);
}
else
{
}
else
{
const
indexOfClosedFile
=
state
.
openFile
s
.
findIndex
(
f
=>
f
.
path
===
path
);
const
indexOfClosedFile
=
getters
.
tab
s
.
findIndex
(
f
=>
f
.
path
===
path
);
const
fileWasActive
=
file
.
active
;
const
fileWasActive
=
file
.
active
;
commit
(
types
.
TOGGLE_FILE_OPEN
,
path
);
commit
(
types
.
TOGGLE_FILE_OPEN
,
path
);
...
@@ -21,9 +21,13 @@ export const closeFile = ({ commit, state, getters, dispatch }, file) => {
...
@@ -21,9 +21,13 @@ export const closeFile = ({ commit, state, getters, dispatch }, file) => {
if
(
getters
.
tabs
.
length
>
0
&&
fileWasActive
)
{
if
(
getters
.
tabs
.
length
>
0
&&
fileWasActive
)
{
const
nextIndexToOpen
=
const
nextIndexToOpen
=
indexOfClosedFile
===
0
?
0
:
indexOfClosedFile
-
1
;
indexOfClosedFile
===
0
?
0
:
indexOfClosedFile
-
1
;
const
nextFileToOpen
=
state
.
openFile
s
[
nextIndexToOpen
];
const
nextFileToOpen
=
getters
.
tab
s
[
nextIndexToOpen
];
router
.
push
(
`/project
${
nextFileToOpen
.
url
}
`
);
if
(
nextFileToOpen
.
pending
)
{
dispatch
(
'
openPendingTab
'
,
nextFileToOpen
);
}
else
{
router
.
push
(
`/project
${
nextFileToOpen
.
url
}
`
);
}
}
else
if
(
!
state
.
openFiles
.
length
)
{
}
else
if
(
!
state
.
openFiles
.
length
)
{
router
.
push
(
`/project/
${
file
.
projectId
}
/tree/
${
file
.
branchId
}
/`
);
router
.
push
(
`/project/
${
file
.
projectId
}
/tree/
${
file
.
branchId
}
/`
);
}
}
...
@@ -151,9 +155,11 @@ export const discardFileChanges = ({ state, commit }, path) => {
...
@@ -151,9 +155,11 @@ export const discardFileChanges = ({ state, commit }, path) => {
eventHub
.
$emit
(
`editor.update.model.content.
${
file
.
path
}
`
,
file
.
raw
);
eventHub
.
$emit
(
`editor.update.model.content.
${
file
.
path
}
`
,
file
.
raw
);
};
};
export
const
openPendingTab
=
({
commit
,
state
},
file
)
=>
{
export
const
openPendingTab
=
({
commit
,
dispatch
,
state
},
file
)
=>
{
commit
(
types
.
ADD_PENDING_TAB
,
file
);
commit
(
types
.
ADD_PENDING_TAB
,
file
);
dispatch
(
'
scrollToTab
'
);
router
.
push
(
`/project/
${
file
.
projectId
}
/tree/
${
state
.
currentBranchId
}
/`
);
router
.
push
(
`/project/
${
file
.
projectId
}
/tree/
${
state
.
currentBranchId
}
/`
);
};
};
...
...
app/assets/javascripts/ide/stores/mutations/file.js
View file @
5dbb7a25
...
@@ -88,14 +88,29 @@ export default {
...
@@ -88,14 +88,29 @@ export default {
});
});
},
},
[
types
.
ADD_PENDING_TAB
](
state
,
file
)
{
[
types
.
ADD_PENDING_TAB
](
state
,
file
)
{
Object
.
assign
(
state
,
{
const
pendingTab
=
state
.
pendingTabs
.
find
(
f
=>
f
.
path
===
file
.
path
);
pendingTabs
:
state
.
pendingTabs
.
concat
({
...
file
,
if
(
pendingTab
)
{
active
:
true
,
Object
.
assign
(
state
,
{
pending
:
true
,
pendingTabs
:
state
.
pendingTabs
.
map
(
tab
=>
({
key
:
`pending-
${
file
.
key
}
`
,
...
tab
,
}),
active
:
!!
pendingTab
,
});
})),
});
}
else
{
Object
.
assign
(
state
,
{
pendingTabs
:
state
.
pendingTabs
.
concat
({
...
file
,
active
:
true
,
pending
:
true
,
key
:
`pending-
${
file
.
key
}
`
,
}),
openFiles
:
state
.
openFiles
.
map
(
f
=>
({
...
f
,
active
:
false
,
})),
});
}
},
},
[
types
.
REMOVE_PENDING_TAB
](
state
,
file
)
{
[
types
.
REMOVE_PENDING_TAB
](
state
,
file
)
{
Object
.
assign
(
state
,
{
Object
.
assign
(
state
,
{
...
...
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