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
e2f27393
Commit
e2f27393
authored
Mar 22, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
toggling viewer mode closes the pending tab
then opens the file in edit mode
parent
002cc923
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
7 deletions
+33
-7
app/assets/javascripts/ide/components/commit_sidebar/list_item.vue
...s/javascripts/ide/components/commit_sidebar/list_item.vue
+0
-2
app/assets/javascripts/ide/components/ide.vue
app/assets/javascripts/ide/components/ide.vue
+1
-0
app/assets/javascripts/ide/components/repo_tabs.vue
app/assets/javascripts/ide/components/repo_tabs.vue
+16
-2
app/assets/javascripts/ide/stores/actions/file.js
app/assets/javascripts/ide/stores/actions/file.js
+9
-3
app/assets/javascripts/ide/stores/mutations/file.js
app/assets/javascripts/ide/stores/mutations/file.js
+7
-0
No files found.
app/assets/javascripts/ide/components/commit_sidebar/list_item.vue
View file @
e2f27393
<
script
>
<
script
>
import
{
mapActions
}
from
'
vuex
'
;
import
{
mapActions
}
from
'
vuex
'
;
import
icon
from
'
~/vue_shared/components/icon.vue
'
;
import
icon
from
'
~/vue_shared/components/icon.vue
'
;
import
router
from
'
../../ide_router
'
;
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -26,7 +25,6 @@ export default {
...
@@ -26,7 +25,6 @@ export default {
openFileInEditor
(
file
)
{
openFileInEditor
(
file
)
{
return
this
.
updateViewer
(
'
diff
'
).
then
(()
=>
{
return
this
.
updateViewer
(
'
diff
'
).
then
(()
=>
{
this
.
openPendingTab
(
file
);
this
.
openPendingTab
(
file
);
router
.
push
(
`/project/
${
file
.
projectId
}
/tree/master/`
);
});
});
},
},
},
},
...
...
app/assets/javascripts/ide/components/ide.vue
View file @
e2f27393
...
@@ -60,6 +60,7 @@ export default {
...
@@ -60,6 +60,7 @@ export default {
v-if=
"activeFile"
v-if=
"activeFile"
>
>
<repo-tabs
<repo-tabs
:active-file=
"activeFile"
:files=
"tabs"
:files=
"tabs"
:viewer=
"viewer"
:viewer=
"viewer"
:has-changes=
"hasChanges"
:has-changes=
"hasChanges"
...
...
app/assets/javascripts/ide/components/repo_tabs.vue
View file @
e2f27393
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
{
mapActions
}
from
'
vuex
'
;
import
{
mapActions
}
from
'
vuex
'
;
import
RepoTab
from
'
./repo_tab.vue
'
;
import
RepoTab
from
'
./repo_tab.vue
'
;
import
EditorMode
from
'
./editor_mode_dropdown.vue
'
;
import
EditorMode
from
'
./editor_mode_dropdown.vue
'
;
import
router
from
'
../ide_router
'
;
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -9,6 +10,10 @@ export default {
...
@@ -9,6 +10,10 @@ export default {
EditorMode
,
EditorMode
,
},
},
props
:
{
props
:
{
activeFile
:
{
type
:
Object
,
required
:
true
,
},
files
:
{
files
:
{
type
:
Array
,
type
:
Array
,
required
:
true
,
required
:
true
,
...
@@ -33,7 +38,16 @@ export default {
...
@@ -33,7 +38,16 @@ export default {
this
.
showShadow
=
this
.
$refs
.
tabsScroller
.
scrollWidth
>
this
.
$refs
.
tabsScroller
.
offsetWidth
;
this
.
showShadow
=
this
.
$refs
.
tabsScroller
.
scrollWidth
>
this
.
$refs
.
tabsScroller
.
offsetWidth
;
},
},
methods
:
{
methods
:
{
...
mapActions
([
'
updateViewer
'
]),
...
mapActions
([
'
updateViewer
'
,
'
removePendingTab
'
]),
openFileViewer
(
viewer
)
{
this
.
updateViewer
(
viewer
);
if
(
this
.
activeFile
.
pending
)
{
this
.
removePendingTab
(
this
.
activeFile
).
then
(()
=>
{
router
.
push
(
`/project
${
this
.
activeFile
.
url
}
`
);
});
}
},
},
},
};
};
</
script
>
</
script
>
...
@@ -54,7 +68,7 @@ export default {
...
@@ -54,7 +68,7 @@ export default {
:viewer=
"viewer"
:viewer=
"viewer"
:show-shadow=
"showShadow"
:show-shadow=
"showShadow"
:has-changes=
"hasChanges"
:has-changes=
"hasChanges"
@
click=
"
updat
eViewer"
@
click=
"
openFil
eViewer"
/>
/>
</div>
</div>
</
template
>
</
template
>
app/assets/javascripts/ide/stores/actions/file.js
View file @
e2f27393
...
@@ -18,9 +18,9 @@ export const closeFile = ({ commit, state, getters, dispatch }, file) => {
...
@@ -18,9 +18,9 @@ export const closeFile = ({ commit, state, getters, dispatch }, file) => {
commit
(
types
.
TOGGLE_FILE_OPEN
,
path
);
commit
(
types
.
TOGGLE_FILE_OPEN
,
path
);
commit
(
types
.
SET_FILE_ACTIVE
,
{
path
,
active
:
false
});
commit
(
types
.
SET_FILE_ACTIVE
,
{
path
,
active
:
false
});
if
(
state
.
openFile
s
.
length
>
0
&&
fileWasActive
)
{
if
(
getters
.
tab
s
.
length
>
0
&&
fileWasActive
)
{
const
nextIndexToOpen
=
indexOfClosedFile
===
0
?
0
:
indexOfClosedFile
-
1
;
const
nextIndexToOpen
=
indexOfClosedFile
===
0
?
0
:
indexOfClosedFile
-
1
;
const
nextFileToOpen
=
state
.
entries
[
state
.
openFiles
[
nextIndexToOpen
].
path
];
const
nextFileToOpen
=
state
.
openFiles
[
nextIndexToOpen
];
router
.
push
(
`/project
${
nextFileToOpen
.
url
}
`
);
router
.
push
(
`/project
${
nextFileToOpen
.
url
}
`
);
}
else
if
(
!
state
.
openFiles
.
length
)
{
}
else
if
(
!
state
.
openFiles
.
length
)
{
...
@@ -133,6 +133,12 @@ export const discardFileChanges = ({ state, commit }, path) => {
...
@@ -133,6 +133,12 @@ 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
},
file
)
=>
{
export
const
openPendingTab
=
({
commit
,
state
},
file
)
=>
{
commit
(
types
.
ADD_PENDING_TAB
,
file
);
commit
(
types
.
ADD_PENDING_TAB
,
file
);
router
.
push
(
`/project/
${
file
.
projectId
}
/tree/
${
state
.
currentBranchId
}
/`
);
};
export
const
removePendingTab
=
({
commit
},
file
)
=>
{
commit
(
types
.
REMOVE_PENDING_TAB
,
file
);
};
};
app/assets/javascripts/ide/stores/mutations/file.js
View file @
e2f27393
...
@@ -5,6 +5,13 @@ export default {
...
@@ -5,6 +5,13 @@ export default {
Object
.
assign
(
state
.
entries
[
path
],
{
Object
.
assign
(
state
.
entries
[
path
],
{
active
,
active
,
});
});
Object
.
assign
(
state
,
{
pendingTabs
:
state
.
pendingTabs
.
map
(
f
=>
({
...
f
,
active
:
false
,
})),
});
},
},
[
types
.
TOGGLE_FILE_OPEN
](
state
,
path
)
{
[
types
.
TOGGLE_FILE_OPEN
](
state
,
path
)
{
Object
.
assign
(
state
.
entries
[
path
],
{
Object
.
assign
(
state
.
entries
[
path
],
{
...
...
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