BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
3a2f883f
Commit
3a2f883f
authored
Jul 17, 2017
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ide' of gitlab.com:gitlab-org/gitlab-ce into ide With conflicts
parents
0b500111
51a936fb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
310 additions
and
198 deletions
+310
-198
dispatcher.js
app/assets/javascripts/dispatcher.js
+5
-6
repo_binary_viewer.js
app/assets/javascripts/repo/repo_binary_viewer.js
+31
-12
repo_bundle.js
app/assets/javascripts/repo/repo_bundle.js
+11
-0
repo_editor.js
app/assets/javascripts/repo/repo_editor.js
+31
-17
repo_file.js
app/assets/javascripts/repo/repo_file.js
+4
-4
repo_file_buttons.js
app/assets/javascripts/repo/repo_file_buttons.js
+21
-5
repo_file_options.js
app/assets/javascripts/repo/repo_file_options.js
+5
-6
repo_helper.js
app/assets/javascripts/repo/repo_helper.js
+119
-83
repo_loading_file.js
app/assets/javascripts/repo/repo_loading_file.js
+6
-7
repo_mini_mixin.js
app/assets/javascripts/repo/repo_mini_mixin.js
+4
-5
repo_prev_directory.js
app/assets/javascripts/repo/repo_prev_directory.js
+5
-6
repo_service.js
app/assets/javascripts/repo/repo_service.js
+11
-12
repo_sidebar.js
app/assets/javascripts/repo/repo_sidebar.js
+22
-17
repo_store.js
app/assets/javascripts/repo/repo_store.js
+8
-5
repo_tab.js
app/assets/javascripts/repo/repo_tab.js
+5
-6
repo_tabs.js
app/assets/javascripts/repo/repo_tabs.js
+6
-7
repo_view_toggler.js
app/assets/javascripts/repo/repo_view_toggler.js
+16
-0
No files found.
app/assets/javascripts/dispatcher.js
View file @
3a2f883f
...
...
@@ -72,19 +72,18 @@ import RepoBundle from './repo/repo_bundle';
}
Dispatcher
.
prototype
.
initPageScripts
=
function
()
{
var
page
,
path
,
shortcut_handler
,
fileBlobPermalinkUrlElement
,
fileBlobPermalinkUrl
,
os
;
var
page
,
path
,
shortcut_handler
,
fileBlobPermalinkUrlElement
,
fileBlobPermalinkUrl
;
page
=
$
(
'body'
).
attr
(
'data-page'
);
if
(
!
page
)
{
return
false
;
}
function
getScrollBarWidth
()
{
var
$outer
=
$
(
'<div>'
).
css
({
visibility
:
'hidden'
,
width
:
100
,
overflow
:
'scroll'
}).
appendTo
(
'body'
),
widthWithScroll
=
$
(
'<div>'
).
css
({
width
:
'100%'
}).
appendTo
(
$outer
).
outerWidth
();
var
$outer
=
$
(
'<div>'
).
css
({
visibility
:
'hidden'
,
width
:
100
,
overflow
:
'scroll'
}).
appendTo
(
'body'
),
widthWithScroll
=
$
(
'<div>'
).
css
({
width
:
'100%'
}).
appendTo
(
$outer
).
outerWidth
();
$outer
.
remove
();
return
100
-
widthWithScroll
;
}
;
}
$
(
'body'
).
attr
(
'data-scroll-width'
,
getScrollBarWidth
());
...
...
@@ -353,7 +352,7 @@ import RepoBundle from './repo/repo_bundle';
shortcut_handler
=
true
;
break
;
case
'projects:blob:show'
:
new
RepoBundle
();
new
RepoBundle
();
break
;
case
'projects:blame:show'
:
initBlob
();
...
...
app/assets/javascripts/repo/repo_binary_viewer.js
View file @
3a2f883f
import
Vue
from
'vue'
import
Store
from
'./repo_store'
import
Vue
from
'vue'
;
import
Store
from
'./repo_store'
;
import
{
loadingError
}
from
'./repo_helper'
;
export
default
class
RepoBinaryViewer
{
constructor
(
url
)
{
constructor
()
{
this
.
initVue
();
}
...
...
@@ -15,32 +16,51 @@ export default class RepoBinaryViewer {
computed
:
{
pngBlobWithDataURI
()
{
return
`data:image/png;base64,
${
this
.
blobRaw
}
`
;
}
}
,
},
methods
:
{
<<<<<<<
HEAD
isMarkdown
()
{
return
this
.
activeFile
.
extension
===
'md'
;
=======
supportedNonBinaryFileType
()
{
switch
(
this
.
activeFile
.
extension
)
{
case
'md'
:
this
.
binaryTypes
.
markdown
=
true
;
return
true
;
default
:
return
false
;
}
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
},
},
watch
:
{
blobRaw
()
{
<<<<<<<
HEAD
if
(
this
.
isMarkdown
())
{
=======
const
supported
=
this
.
supportedNonBinaryFileType
();
if
(
supported
)
{
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
this
.
binaryTypes
.
markdown
=
true
;
this
.
activeFile
.
raw
=
false
;
// counts as binaryish so we use the binary viewer in this case.
this
.
binary
=
true
;
return
;
}
if
(
!
this
.
binary
)
return
;
switch
(
this
.
binaryMimeType
)
{
if
(
!
this
.
binary
)
return
;
switch
(
this
.
binaryMimeType
)
{
case
'image/png'
:
this
.
binaryTypes
.
png
=
true
;
break
;
}
}
}
break
;
default
:
loadingError
();
break
;
}
},
},
});
}
}
\ No newline at end of file
}
app/assets/javascripts/repo/repo_bundle.js
View file @
3a2f883f
<<<<<<<
HEAD
import
Tabs
from
'./repo_tabs'
import
Sidebar
from
'./repo_sidebar'
import
Editor
from
'./repo_editor'
...
...
@@ -8,6 +9,16 @@ import CommitSection from './repo_commit_section'
import
Service
from
'./repo_service'
import
Store
from
'./repo_store'
import
Helper
from
'./repo_helper'
=======
import
Tabs
from
'./repo_tabs'
;
import
Sidebar
from
'./repo_sidebar'
;
import
Editor
from
'./repo_editor'
;
import
FileButtons
from
'./repo_file_buttons'
;
import
BinaryViewer
from
'./repo_binary_viewer'
;
import
Service
from
'./repo_service'
;
import
Store
from
'./repo_store'
;
import
Helper
from
'./repo_helper'
;
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
export
default
class
RepoBundle
{
constructor
()
{
...
...
app/assets/javascripts/repo/repo_editor.js
View file @
3a2f883f
/* global monaco */
import
Vue
from
'vue'
;
import
Store
from
'./repo_store'
import
Helper
from
'./repo_helper'
import
Store
from
'./repo_store'
;
import
Helper
from
'./repo_helper'
;
export
default
class
RepoEditor
{
constructor
()
{
...
...
@@ -10,12 +10,19 @@ export default class RepoEditor {
}
addMonacoEvents
()
{
<<<<<<<
HEAD
this
.
monacoEditor
.
onMouseUp
(
this
.
onMonacoEditorMouseUp
.
bind
(
this
));
this
.
monacoEditor
.
onKeyUp
(
this
.
onMonacoEditorKeysPressed
.
bind
(
this
));
=======
this
.
vue
.
$watch
(
'activeFile.lineNumber'
,
()
=>
{
console
.
log
(
'cahnged'
);
});
this
.
monacoEditor
.
onMouseUp
(
RepoEditor
.
onMonacoEditorMouseUp
);
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
}
onMonacoEditorMouseUp
(
e
)
{
if
(
e
.
target
.
element
.
className
===
'line-numbers'
)
{
static
onMonacoEditorMouseUp
(
e
)
{
if
(
e
.
target
.
element
.
className
===
'line-numbers'
)
{
location
.
hash
=
`L
${
e
.
target
.
position
.
lineNumber
}
`
;
Store
.
activeLine
=
e
.
target
.
position
.
lineNumber
;
}
...
...
@@ -34,7 +41,7 @@ export default class RepoEditor {
model
:
null
,
readOnly
:
true
,
contextmenu
:
false
,
}
}
,
);
Helper
.
monacoInstance
=
monaco
;
...
...
@@ -49,33 +56,37 @@ export default class RepoEditor {
const
monacoEditor
=
this
.
monacoEditor
;
this
.
vue
=
new
Vue
({
data
:
()
=>
Store
,
created
()
{
created
()
{
this
.
showHide
();
if
(
this
.
blobRaw
!==
''
)
{
if
(
this
.
blobRaw
!==
''
)
{
monacoEditor
.
setModel
(
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
'plain'
)
'plain'
,
)
,
);
}
},
methods
:
{
showHide
()
{
<<<<<<<
HEAD
if
(
!
this
.
openedFiles
.
length
||
(
this
.
binary
&&
!
this
.
activeFile
.
raw
))
{
=======
if
((
!
this
.
openedFiles
.
length
)
||
this
.
binary
)
{
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
self
.
el
.
style
.
display
=
'none'
;
}
else
{
self
.
el
.
style
.
display
=
'inline-block'
;
}
}
}
,
},
watch
:
{
activeLine
()
{
self
.
monacoEditor
.
setPosition
({
lineNumber
:
this
.
activeLine
,
column
:
1
column
:
1
,
});
},
...
...
@@ -114,20 +125,24 @@ export default class RepoEditor {
blobRaw
()
{
this
.
showHide
();
<<<<<<<
HEAD
if
(
!
this
.
isTree
)
{
// kill the current model;
self
.
monacoEditor
.
setModel
(
null
);
// then create the new one
=======
if
(
!
this
.
isTree
)
{
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
self
.
monacoEditor
.
setModel
(
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
this
.
activeFile
.
mime_type
)
this
.
activeFile
.
mime_type
,
)
,
);
console
.
log
(
monaco
.
editor
.
getModels
());
}
}
}
}
,
}
,
});
}
}
\ No newline at end of file
}
app/assets/javascripts/repo/repo_file.js
View file @
3a2f883f
le
t
RepoFile
=
{
cons
t
RepoFile
=
{
template
:
`
<tr v-if='!loading.tree || hasFiles' :class='{"active": activeFile.url === file.url}'>
<td>
...
...
@@ -20,13 +20,13 @@ let RepoFile = {
isMini
:
Boolean
,
loading
:
Object
,
hasFiles
:
Boolean
,
activeFile
:
Object
activeFile
:
Object
,
},
methods
:
{
linkClicked
(
file
)
{
this
.
$emit
(
'linkclicked'
,
file
);
}
}
}
,
}
,
};
export
default
RepoFile
;
app/assets/javascripts/repo/repo_file_buttons.js
View file @
3a2f883f
<<<<<<<
HEAD
import
Vue
from
'vue'
import
Store
from
'./repo_store'
import
Helper
from
'./repo_helper'
import
RepoMiniMixin
from
'./repo_mini_mixin'
=======
import
Vue
from
'vue'
;
import
Store
from
'./repo_store'
;
import
Helper
from
'./repo_helper'
;
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
export
default
class
RepoSidebar
{
constructor
(
url
)
{
...
...
@@ -9,7 +15,7 @@ export default class RepoSidebar {
this
.
initVue
();
this
.
el
=
document
.
getElementById
(
'repo-file-buttons'
);
}
initVue
()
{
this
.
vue
=
new
Vue
({
el
:
'#repo-file-buttons'
,
...
...
@@ -31,16 +37,21 @@ export default class RepoSidebar {
</div>
`
,
computed
:
{
<<<<<<<
HEAD
editableBorder
()
{
return
this
.
editMode
?
'1px solid #1F78D1'
:
'1px solid #f0f0f0'
;
=======
previewLabel
()
{
return
this
.
activeFile
.
raw
?
'Preview'
:
'Raw'
;
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
},
canPreview
()
{
return
this
.
activeFile
.
extension
===
'md'
;
},
rawFileURL
()
{
rawFileURL
()
{
return
Helper
.
getRawURLFromBlobURL
(
this
.
activeFile
.
url
);
},
...
...
@@ -50,14 +61,20 @@ export default class RepoSidebar {
historyFileUrl
()
{
return
Helper
.
getHistoryURLFromBlobURL
(
this
.
activeFile
.
url
);
}
}
,
},
methods
:
{
<<<<<<<
HEAD
rawPreviewToggle
()
{
Helper
.
setCurrentFileRawOrPreview
();
}
=======
setRawPreviewMode
()
{
},
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
},
});
}
}
\ No newline at end of file
}
app/assets/javascripts/repo/repo_file_options.js
View file @
3a2f883f
le
t
RepoFileOptions
=
{
cons
t
RepoFileOptions
=
{
template
:
`
<tr v-if='isMini' class='repo-file-options'>
<td>
...
...
@@ -21,8 +21,8 @@ let RepoFileOptions = {
props
:
{
name
:
'repo-file-options'
,
isMini
:
Boolean
,
projectName
:
String
}
}
projectName
:
String
,
}
,
}
;
export
default
RepoFileOptions
;
\ No newline at end of file
export
default
RepoFileOptions
;
app/assets/javascripts/repo/repo_helper.js
View file @
3a2f883f
This diff is collapsed.
Click to expand it.
app/assets/javascripts/repo/repo_loading_file.js
View file @
3a2f883f
le
t
RepoLoadingFile
=
{
cons
t
RepoLoadingFile
=
{
template
:
`
<tr v-if='loading.tree && !hasFiles'>
<td>
...
...
@@ -18,17 +18,17 @@ let RepoLoadingFile = {
</td>
</tr>
`
,
methods
:
{
lineOfCode
(
n
)
{
return
`line-of-code-
${
n
}
`
;
}
}
,
},
props
:
{
loading
:
Object
,
hasFiles
:
Boolean
,
isMini
:
Boolean
}
isMini
:
Boolean
,
}
,
};
export
default
RepoLoadingFile
;
\ No newline at end of file
export
default
RepoLoadingFile
;
app/assets/javascripts/repo/repo_mini_mixin.js
View file @
3a2f883f
import
Store
from
'./repo_store'
import
Store
from
'./repo_store'
;
le
t
RepoMiniMixin
=
{
cons
t
RepoMiniMixin
=
{
computed
:
{
isMini
()
{
return
!!
Store
.
openedFiles
.
length
;
}
}
,
},
};
export
default
RepoMiniMixin
;
\ No newline at end of file
export
default
RepoMiniMixin
;
app/assets/javascripts/repo/repo_prev_directory.js
View file @
3a2f883f
le
t
RepoPreviousDirectory
=
{
cons
t
RepoPreviousDirectory
=
{
template
:
`
<tr>
<td colspan='3'>
...
...
@@ -8,13 +8,13 @@ let RepoPreviousDirectory = {
`
,
props
:
{
name
:
'repo-previous-directory'
,
prevUrl
:
String
prevUrl
:
String
,
},
methods
:
{
linkClicked
(
file
)
{
this
.
$emit
(
'linkclicked'
,
file
);
}
}
}
,
}
,
};
export
default
RepoPreviousDirectory
;
\ No newline at end of file
export
default
RepoPreviousDirectory
;
app/assets/javascripts/repo/repo_service.js
View file @
3a2f883f
import
axios
from
'axios'
;
le
t
RepoService
=
{
cons
t
RepoService
=
{
url
:
''
,
params
:
{
params
:
{
format
:
'json'
}
format
:
'json'
,
}
,
},
setUrl
(
url
)
{
...
...
@@ -14,16 +14,16 @@ let RepoService = {
paramsWithRich
(
url
)
{
// copy the obj so we don't modify perm.
le
t
params
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
params
));
if
(
url
.
substr
(
url
.
length
-
2
)
===
'md'
)
{
cons
t
params
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
params
));
if
(
url
.
substr
(
url
.
length
-
2
)
===
'md'
)
{
params
.
params
.
viewer
=
'rich'
;
}
return
params
;
},
getContent
(
url
)
{
if
(
url
)
{
return
axios
.
get
(
url
,
this
.
paramsWithRich
(
url
,
params
));
if
(
url
)
{
return
axios
.
get
(
url
,
this
.
paramsWithRich
(
url
,
this
.
params
));
}
return
axios
.
get
(
this
.
url
,
this
.
paramsWithRich
(
this
.
url
,
this
.
params
));
},
...
...
@@ -31,10 +31,10 @@ let RepoService = {
getBase64Content
(
url
)
{
return
axios
.
get
(
url
,
{
responseType
:
'arraybuffer'
responseType
:
'arraybuffer'
,
})
.
then
(
response
=>
new
Buffer
(
response
.
data
,
'binary'
).
toString
(
'base64'
))
}
.
then
(
response
=>
new
Buffer
(
response
.
data
,
'binary'
).
toString
(
'base64'
))
;
}
,
};
export
default
RepoService
;
\ No newline at end of file
export
default
RepoService
;
app/assets/javascripts/repo/repo_sidebar.js
View file @
3a2f883f
import
Service
from
'./repo_service'
import
Helper
from
'./repo_helper'
import
Vue
from
'vue'
import
Store
from
'./repo_store'
import
RepoPreviousDirectory
from
'./repo_prev_directory'
import
RepoFileOptions
from
'./repo_file_options'
import
RepoFile
from
'./repo_file'
import
RepoLoadingFile
from
'./repo_loading_file'
import
RepoMiniMixin
from
'./repo_mini_mixin'
import
Vue
from
'vue'
;
import
Service
from
'./repo_service'
;
import
Helper
from
'./repo_helper'
;
import
Store
from
'./repo_store'
;
import
RepoPreviousDirectory
from
'./repo_prev_directory'
;
import
RepoFileOptions
from
'./repo_file_options'
;
import
RepoFile
from
'./repo_file'
;
import
RepoLoadingFile
from
'./repo_loading_file'
;
import
RepoMiniMixin
from
'./repo_mini_mixin'
;
export
default
class
RepoSidebar
{
constructor
(
url
)
{
...
...
@@ -35,32 +35,38 @@ export default class RepoSidebar {
methods
:
{
addPopEventListener
()
{
window
.
addEventListener
(
'popstate'
,
()
=>
{
if
(
location
.
href
.
indexOf
(
'#'
)
>
-
1
)
return
;
if
(
location
.
href
.
indexOf
(
'#'
)
>
-
1
)
return
;
this
.
linkClicked
({
url
:
location
.
href
url
:
location
.
href
,
});
});
},
linkClicked
(
file
)
{
let
url
=
''
;
if
(
typeof
file
===
'object'
)
{
if
(
file
.
type
===
'tree'
&&
file
.
opened
)
{
if
(
typeof
file
===
'object'
)
{
if
(
file
.
type
===
'tree'
&&
file
.
opened
)
{
Helper
.
removeChildFilesOfTree
(
file
);
<<<<<<<
HEAD
return
;
}
else
{
url
=
file
.
url
;
Service
.
url
=
url
;
Helper
.
getContent
(
file
);
=======
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
}
}
else
if
(
typeof
file
===
'string'
)
{
url
=
file
.
url
;
Service
.
url
=
url
;
Helper
.
getContent
(
file
);
}
else
if
(
typeof
file
===
'string'
)
{
// go back
url
=
file
;
Service
.
url
=
url
;
Helper
.
getContent
();
}
}
}
,
},
});
}
}
\ No newline at end of file
}
app/assets/javascripts/repo/repo_store.js
View file @
3a2f883f
le
t
RepoStore
=
{
cons
t
RepoStore
=
{
service
:
''
,
editor
:
''
,
sidebar
:
''
,
...
...
@@ -22,9 +22,12 @@ let RepoStore = {
plain
:
''
,
size
:
0
,
url
:
''
,
<<<<<<<
HEAD
raw
:
false
,
newContent
:
''
,
changed
:
false
=======
>>>>>>>
51
a936fb3d2cdbd133a3b0eed463b47c1c92fe7d
},
activeFileIndex
:
0
,
activeLine
:
0
,
...
...
@@ -32,15 +35,15 @@ let RepoStore = {
files
:
[],
binary
:
false
,
binaryMimeType
:
''
,
//scroll bar space for windows
//
scroll bar space for windows
scrollWidth
:
0
,
binaryTypes
:
{
png
:
false
,
markdown
:
false
markdown
:
false
,
},
loading
:
{
tree
:
false
,
blob
:
false
}
blob
:
false
,
}
,
};
export
default
RepoStore
;
app/assets/javascripts/repo/repo_tab.js
View file @
3a2f883f
import
RepoHelper
from
'./repo_helper'
import
RepoHelper
from
'./repo_helper'
;
le
t
RepoTab
=
{
cons
t
RepoTab
=
{
template
:
`
<li>
<a href='#' @click.prevent='xClicked(tab)' v-if='!tab.loading'>
...
...
@@ -34,7 +34,7 @@ let RepoTab = {
xClicked
(
file
)
{
if
(
file
.
changed
)
return
;
RepoHelper
.
removeFromOpenedFiles
(
file
);
}
}
}
,
}
,
};
export
default
RepoTab
;
\ No newline at end of file
export
default
RepoTab
;
app/assets/javascripts/repo/repo_tabs.js
View file @
3a2f883f
import
Vue
from
'vue'
;
import
Store
from
'./repo_store'
import
RepoTab
from
'./repo_tab'
import
RepoMiniMixin
from
'./repo_mini_mixin'
import
Store
from
'./repo_store'
;
import
RepoTab
from
'./repo_tab'
;
import
RepoMiniMixin
from
'./repo_mini_mixin'
;
export
default
class
RepoTabs
{
constructor
()
{
thi
s
.
styleTabsForWindows
();
RepoTab
s
.
styleTabsForWindows
();
this
.
initVue
();
}
...
...
@@ -20,8 +20,8 @@ export default class RepoTabs {
});
}
styleTabsForWindows
()
{
st
atic
st
yleTabsForWindows
()
{
const
scrollWidth
=
Number
(
document
.
body
.
dataset
.
scrollWidth
);
Store
.
scrollWidth
=
scrollWidth
;
}
}
\ No newline at end of file
}
app/assets/javascripts/repo/repo_view_toggler.js
0 → 100644
View file @
3a2f883f
import
Vue
from
'vue'
;
import
Store
from
'./repo_store'
;
export
default
class
RepoViewToggler
{
constructor
()
{
this
.
initVue
();
}
initVue
()
{
this
.
vue
=
new
Vue
({
el
:
'#view-toggler'
,
data
:
()
=>
Store
,
});
}
}
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