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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
aeb4b750
Commit
aeb4b750
authored
May 04, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create constant for viewer type
i18n
parent
4d48658b
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
40 additions
and
18 deletions
+40
-18
app/assets/javascripts/ide/components/commit_sidebar/list_item.vue
...s/javascripts/ide/components/commit_sidebar/list_item.vue
+2
-1
app/assets/javascripts/ide/components/editor_mode_dropdown.vue
...ssets/javascripts/ide/components/editor_mode_dropdown.vue
+7
-5
app/assets/javascripts/ide/components/ide_review.vue
app/assets/javascripts/ide/components/ide_review.vue
+11
-4
app/assets/javascripts/ide/components/repo_editor.vue
app/assets/javascripts/ide/components/repo_editor.vue
+5
-4
app/assets/javascripts/ide/constants.js
app/assets/javascripts/ide/constants.js
+6
-0
app/assets/javascripts/ide/stores/actions/file.js
app/assets/javascripts/ide/stores/actions/file.js
+7
-2
app/assets/javascripts/ide/stores/state.js
app/assets/javascripts/ide/stores/state.js
+2
-2
No files found.
app/assets/javascripts/ide/components/commit_sidebar/list_item.vue
View file @
aeb4b750
...
@@ -3,6 +3,7 @@ import { mapActions } from 'vuex';
...
@@ -3,6 +3,7 @@ import { mapActions } from 'vuex';
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
StageButton
from
'
./stage_button.vue
'
;
import
StageButton
from
'
./stage_button.vue
'
;
import
UnstageButton
from
'
./unstage_button.vue
'
;
import
UnstageButton
from
'
./unstage_button.vue
'
;
import
{
viewerTypes
}
from
'
../../constants
'
;
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -53,7 +54,7 @@ export default {
...
@@ -53,7 +54,7 @@ export default {
keyPrefix
:
this
.
keyPrefix
.
toLowerCase
(),
keyPrefix
:
this
.
keyPrefix
.
toLowerCase
(),
}).
then
(
changeViewer
=>
{
}).
then
(
changeViewer
=>
{
if
(
changeViewer
)
{
if
(
changeViewer
)
{
this
.
updateViewer
(
'
diff
'
);
this
.
updateViewer
(
viewerTypes
.
diff
);
}
}
});
});
},
},
...
...
app/assets/javascripts/ide/components/editor_mode_dropdown.vue
View file @
aeb4b750
<
script
>
<
script
>
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
{
viewerTypes
}
from
'
../constants
'
;
export
default
{
export
default
{
props
:
{
props
:
{
...
@@ -24,6 +25,7 @@ export default {
...
@@ -24,6 +25,7 @@ export default {
this
.
$emit
(
'
click
'
,
mode
);
this
.
$emit
(
'
click
'
,
mode
);
},
},
},
},
viewerTypes
,
};
};
</
script
>
</
script
>
...
@@ -36,16 +38,16 @@ export default {
...
@@ -36,16 +38,16 @@ export default {
class=
"btn btn-link"
class=
"btn btn-link"
data-toggle=
"dropdown"
data-toggle=
"dropdown"
>
>
Edit
{{
__
(
'
Edit
'
)
}}
</button>
</button>
<div
class=
"dropdown-menu dropdown-menu-selectable dropdown-open-left"
>
<div
class=
"dropdown-menu dropdown-menu-selectable dropdown-open-left"
>
<ul>
<ul>
<li>
<li>
<a
<a
href=
"#"
href=
"#"
@
click.prevent=
"changeMode(
'mrdiff'
)"
@
click.prevent=
"changeMode(
$options.viewerTypes.mr
)"
:class=
"
{
:class=
"
{
'is-active': viewer ===
'mrdiff'
,
'is-active': viewer ===
$options.viewerTypes.mr
,
}"
}"
>
>
<strong
class=
"dropdown-menu-inner-title"
>
<strong
class=
"dropdown-menu-inner-title"
>
...
@@ -59,9 +61,9 @@ export default {
...
@@ -59,9 +61,9 @@ export default {
<li>
<li>
<a
<a
href=
"#"
href=
"#"
@
click.prevent=
"changeMode(
'diff'
)"
@
click.prevent=
"changeMode(
$options.viewerTypes.diff
)"
:class=
"
{
:class=
"
{
'is-active': viewer ===
'diff'
,
'is-active': viewer ===
$options.viewerTypes.diff
,
}"
}"
>
>
<strong
class=
"dropdown-menu-inner-title"
>
{{
__
(
'
Reviewing
'
)
}}
</strong>
<strong
class=
"dropdown-menu-inner-title"
>
{{
__
(
'
Reviewing
'
)
}}
</strong>
...
...
app/assets/javascripts/ide/components/ide_review.vue
View file @
aeb4b750
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
{
mapGetters
,
mapState
,
mapActions
}
from
'
vuex
'
;
import
{
mapGetters
,
mapState
,
mapActions
}
from
'
vuex
'
;
import
IdeTreeList
from
'
./ide_tree_list.vue
'
;
import
IdeTreeList
from
'
./ide_tree_list.vue
'
;
import
EditorModeDropdown
from
'
./editor_mode_dropdown.vue
'
;
import
EditorModeDropdown
from
'
./editor_mode_dropdown.vue
'
;
import
{
viewerTypes
}
from
'
../constants
'
;
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -11,10 +12,16 @@ export default {
...
@@ -11,10 +12,16 @@ export default {
computed
:
{
computed
:
{
...
mapGetters
([
'
currentMergeRequest
'
]),
...
mapGetters
([
'
currentMergeRequest
'
]),
...
mapState
([
'
viewer
'
]),
...
mapState
([
'
viewer
'
]),
showLatestChangesText
()
{
return
!
this
.
currentMergeRequest
||
this
.
viewer
===
viewerTypes
.
diff
;
},
showMergeRequestText
()
{
return
this
.
currentMergeRequest
&&
this
.
viewer
===
viewerTypes
.
mr
;
},
},
},
mounted
()
{
mounted
()
{
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
updateViewer
(
this
.
currentMergeRequest
?
'
mrdiff
'
:
'
diff
'
);
this
.
updateViewer
(
this
.
currentMergeRequest
?
viewerTypes
.
mr
:
viewerTypes
.
diff
);
});
});
},
},
methods
:
{
methods
:
{
...
@@ -42,11 +49,11 @@ export default {
...
@@ -42,11 +49,11 @@ export default {
/>
/>
</div>
</div>
<div
class=
"prepend-top-5 ide-review-sub-header"
>
<div
class=
"prepend-top-5 ide-review-sub-header"
>
<template
v-if=
"
!currentMergeRequest || viewer === 'diff'
"
>
<template
v-if=
"
showLatestChangesText
"
>
{{
__
(
'
Latest changes
'
)
}}
{{
__
(
'
Latest changes
'
)
}}
</
template
>
</
template
>
<
template
v-else-if=
"
currentMergeRequest && viewer === 'mrdiff'
"
>
<
template
v-else-if=
"
showMergeRequestText
"
>
Merge request
{{
__
(
'
Merge request
'
)
}}
(
<a
:href=
"currentMergeRequest.web_url"
>
!
{{
currentMergeRequest
.
iid
}}
</a>
)
(
<a
:href=
"currentMergeRequest.web_url"
>
!
{{
currentMergeRequest
.
iid
}}
</a>
)
</
template
>
</
template
>
</div>
</div>
...
...
app/assets/javascripts/ide/components/repo_editor.vue
View file @
aeb4b750
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
import
{
mapState
,
mapGetters
,
mapActions
}
from
'
vuex
'
;
import
{
mapState
,
mapGetters
,
mapActions
}
from
'
vuex
'
;
import
flash
from
'
~/flash
'
;
import
flash
from
'
~/flash
'
;
import
ContentViewer
from
'
~/vue_shared/components/content_viewer/content_viewer.vue
'
;
import
ContentViewer
from
'
~/vue_shared/components/content_viewer/content_viewer.vue
'
;
import
{
activityBarViews
}
from
'
../constants
'
;
import
{
activityBarViews
,
viewerTypes
}
from
'
../constants
'
;
import
monacoLoader
from
'
../monaco_loader
'
;
import
monacoLoader
from
'
../monaco_loader
'
;
import
Editor
from
'
../lib/editor
'
;
import
Editor
from
'
../lib/editor
'
;
import
IdeFileButtons
from
'
./ide_file_buttons.vue
'
;
import
IdeFileButtons
from
'
./ide_file_buttons.vue
'
;
...
@@ -121,7 +121,7 @@ export default {
...
@@ -121,7 +121,7 @@ export default {
this
.
editor
.
dispose
();
this
.
editor
.
dispose
();
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
if
(
this
.
viewer
===
'
editor
'
)
{
if
(
this
.
viewer
===
viewerTypes
.
edit
)
{
this
.
editor
.
createInstance
(
this
.
$refs
.
editor
);
this
.
editor
.
createInstance
(
this
.
$refs
.
editor
);
}
else
{
}
else
{
this
.
editor
.
createDiffInstance
(
this
.
$refs
.
editor
,
!
this
.
isReviewModeActive
);
this
.
editor
.
createDiffInstance
(
this
.
$refs
.
editor
,
!
this
.
isReviewModeActive
);
...
@@ -140,7 +140,7 @@ export default {
...
@@ -140,7 +140,7 @@ export default {
this
.
file
.
staged
&&
this
.
file
.
key
.
indexOf
(
'
unstaged-
'
)
===
0
?
head
:
null
,
this
.
file
.
staged
&&
this
.
file
.
key
.
indexOf
(
'
unstaged-
'
)
===
0
?
head
:
null
,
);
);
if
(
this
.
viewer
===
'
mrdiff
'
)
{
if
(
this
.
viewer
===
viewerTypes
.
mr
)
{
this
.
editor
.
attachMergeRequestModel
(
this
.
model
);
this
.
editor
.
attachMergeRequestModel
(
this
.
model
);
}
else
{
}
else
{
this
.
editor
.
attachModel
(
this
.
model
);
this
.
editor
.
attachModel
(
this
.
model
);
...
@@ -181,6 +181,7 @@ export default {
...
@@ -181,6 +181,7 @@ export default {
});
});
},
},
},
},
viewerTypes
,
};
};
</
script
>
</
script
>
...
@@ -199,7 +200,7 @@ export default {
...
@@ -199,7 +200,7 @@ export default {
href=
"javascript:void(0);"
href=
"javascript:void(0);"
role=
"button"
role=
"button"
@
click.prevent=
"setFileViewMode(
{ file, viewMode: 'edit' })">
@
click.prevent=
"setFileViewMode(
{ file, viewMode: 'edit' })">
<template
v-if=
"viewer ===
'editor'
"
>
<template
v-if=
"viewer ===
$options.viewerTypes.edit
"
>
{{
__
(
'
Edit
'
)
}}
{{
__
(
'
Edit
'
)
}}
</
template
>
</
template
>
<
template
v-else
>
<
template
v-else
>
...
...
app/assets/javascripts/ide/constants.js
View file @
aeb4b750
...
@@ -12,3 +12,9 @@ export const activityBarViews = {
...
@@ -12,3 +12,9 @@ export const activityBarViews = {
commit
:
'
commit-section
'
,
commit
:
'
commit-section
'
,
review
:
'
ide-review
'
,
review
:
'
ide-review
'
,
};
};
export
const
viewerTypes
=
{
mr
:
'
mrdiff
'
,
edit
:
'
editor
'
,
diff
:
'
diff
'
,
};
app/assets/javascripts/ide/stores/actions/file.js
View file @
aeb4b750
...
@@ -5,6 +5,7 @@ import service from '../../services';
...
@@ -5,6 +5,7 @@ import service from '../../services';
import
*
as
types
from
'
../mutation_types
'
;
import
*
as
types
from
'
../mutation_types
'
;
import
router
from
'
../../ide_router
'
;
import
router
from
'
../../ide_router
'
;
import
{
setPageTitle
}
from
'
../utils
'
;
import
{
setPageTitle
}
from
'
../utils
'
;
import
{
viewerTypes
}
from
'
../../constants
'
;
export
const
closeFile
=
({
commit
,
state
,
dispatch
},
file
)
=>
{
export
const
closeFile
=
({
commit
,
state
,
dispatch
},
file
)
=>
{
const
path
=
file
.
path
;
const
path
=
file
.
path
;
...
@@ -23,7 +24,7 @@ export const closeFile = ({ commit, state, dispatch }, file) => {
...
@@ -23,7 +24,7 @@ export const closeFile = ({ commit, state, dispatch }, file) => {
const
nextFileToOpen
=
state
.
openFiles
[
nextIndexToOpen
];
const
nextFileToOpen
=
state
.
openFiles
[
nextIndexToOpen
];
if
(
nextFileToOpen
.
pending
)
{
if
(
nextFileToOpen
.
pending
)
{
dispatch
(
'
updateViewer
'
,
'
diff
'
);
dispatch
(
'
updateViewer
'
,
viewerTypes
.
diff
);
dispatch
(
'
openPendingTab
'
,
{
dispatch
(
'
openPendingTab
'
,
{
file
:
nextFileToOpen
,
file
:
nextFileToOpen
,
keyPrefix
:
nextFileToOpen
.
staged
?
'
staged
'
:
'
unstaged
'
,
keyPrefix
:
nextFileToOpen
.
staged
?
'
staged
'
:
'
unstaged
'
,
...
@@ -194,7 +195,11 @@ export const unstageChange = ({ commit }, path) => {
...
@@ -194,7 +195,11 @@ export const unstageChange = ({ commit }, path) => {
};
};
export
const
openPendingTab
=
({
commit
,
getters
,
dispatch
,
state
},
{
file
,
keyPrefix
})
=>
{
export
const
openPendingTab
=
({
commit
,
getters
,
dispatch
,
state
},
{
file
,
keyPrefix
})
=>
{
if
(
getters
.
activeFile
&&
getters
.
activeFile
.
path
===
file
.
path
&&
state
.
viewer
===
'
diff
'
)
{
if
(
getters
.
activeFile
&&
getters
.
activeFile
.
path
===
file
.
path
&&
state
.
viewer
===
viewerTypes
.
diff
)
{
return
false
;
return
false
;
}
}
...
...
app/assets/javascripts/ide/stores/state.js
View file @
aeb4b750
import
{
activityBarViews
}
from
'
../constants
'
;
import
{
activityBarViews
,
viewerTypes
}
from
'
../constants
'
;
export
default
()
=>
({
export
default
()
=>
({
currentProjectId
:
''
,
currentProjectId
:
''
,
...
@@ -18,7 +18,7 @@ export default () => ({
...
@@ -18,7 +18,7 @@ export default () => ({
rightPanelCollapsed
:
false
,
rightPanelCollapsed
:
false
,
panelResizing
:
false
,
panelResizing
:
false
,
entries
:
{},
entries
:
{},
viewer
:
'
editor
'
,
viewer
:
viewerTypes
.
edit
,
delayViewerUpdated
:
false
,
delayViewerUpdated
:
false
,
currentActivityView
:
activityBarViews
.
edit
,
currentActivityView
:
activityBarViews
.
edit
,
unusedSeal
:
true
,
unusedSeal
:
true
,
...
...
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