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
8a9375e9
Commit
8a9375e9
authored
Jul 21, 2017
by
Jacob Schatz
Browse files
Options
Browse Files
Download
Plain Diff
Merge 'ide' gitlab-ce into ide and fixes conflicts.
parents
54fa71d2
31480210
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
68 additions
and
58 deletions
+68
-58
repo_file_buttons.js
app/assets/javascripts/repo/repo_file_buttons.js
+5
-0
repo_helper.js
app/assets/javascripts/repo/repo_helper.js
+28
-27
repo_sidebar.js
app/assets/javascripts/repo/repo_sidebar.js
+4
-2
repo_store.js
app/assets/javascripts/repo/repo_store.js
+28
-27
repo_tab.vue
app/assets/javascripts/repo/repo_tab.vue
+1
-1
webpack.config.js
config/webpack.config.js
+2
-1
No files found.
app/assets/javascripts/repo/repo_file_buttons.js
View file @
8a9375e9
...
...
@@ -16,15 +16,20 @@ export default class RepoFileButtons {
template
:
`
<div id='repo-file-buttons' v-if='isMini' :style='{"border-bottom": editableBorder}'>
<a :href='rawFileURL' target='_blank' class='btn btn-default'>Raw</a>
<div class="btn-group" role="group" aria-label="File actions">
<a :href='blameFileUrl' class='btn btn-default'>Blame</a>
<a :href='historyFileUrl' class='btn btn-default'>History</a>
<a href='#' class='btn btn-default'>Permalink</a>
<a href='#' class='btn btn-default'>Lock</a>
</div>
<a href='#' v-if='canPreview' @click.prevent='rawPreviewToggle' class='btn btn-default'>
{{activeFileLabel}}
</a>
<button type="button" class="btn btn-default" data-target="#modal-upload-blob" data-toggle="modal">Replace</button>
<a href='#' class='btn btn-danger'>Delete</a>
</div>
`
,
...
...
app/assets/javascripts/repo/repo_helper.js
View file @
8a9375e9
...
...
@@ -17,7 +17,7 @@ const RepoHelper = {
getLanguageIDForFile
(
file
,
langs
)
{
const
ext
=
file
.
name
.
split
(
'.'
).
pop
();
const
foundLang
=
this
.
findLanguage
(
ext
,
langs
);
const
foundLang
=
RepoHelper
.
findLanguage
(
ext
,
langs
);
return
foundLang
?
foundLang
.
id
:
'plaintext'
;
},
...
...
@@ -53,7 +53,7 @@ const RepoHelper = {
Store
.
blobRaw
=
response
;
file
.
base64
=
response
;
// eslint-disable-line no-param-reassign
})
.
catch
(
this
.
loadingError
);
.
catch
(
RepoHelper
.
loadingError
);
},
toggleFakeTab
(
loading
,
file
)
{
...
...
@@ -64,7 +64,7 @@ const RepoHelper = {
setLoading
(
loading
,
file
)
{
if
(
Service
.
url
.
indexOf
(
'blob'
)
>
-
1
)
{
Store
.
loading
.
blob
=
loading
;
return
this
.
toggleFakeTab
(
loading
,
file
);
return
RepoHelper
.
toggleFakeTab
(
loading
,
file
);
}
if
(
Service
.
url
.
indexOf
(
'tree'
)
>
-
1
)
Store
.
loading
.
tree
=
loading
;
...
...
@@ -79,15 +79,16 @@ const RepoHelper = {
if
(
!
indexOfFile
)
return
newList
;
return
this
.
mergeNewListToOldList
(
newList
,
currentList
,
inDirectory
,
indexOfFile
);
return
RepoHelper
.
mergeNewListToOldList
(
newList
,
currentList
,
inDirectory
,
indexOfFile
);
},
mergeNewListToOldList
(
newList
,
oldList
,
inDirectory
,
indexOfFile
)
{
newList
.
forEach
((
newFile
)
=>
{
const
fileIndex
=
indexOfFile
+
1
;
const
file
=
newFile
;
file
.
level
=
inDirectory
.
level
+
1
;
oldList
.
splice
(
indexOfFile
,
0
,
file
);
oldList
.
splice
(
fileIndex
,
0
,
file
);
});
return
oldList
;
...
...
@@ -95,21 +96,21 @@ const RepoHelper = {
getContent
(
treeOrFile
)
{
let
file
=
treeOrFile
;
const
loadingData
=
this
.
setLoading
(
true
);
const
loadingData
=
RepoHelper
.
setLoading
(
true
);
Service
.
getContent
()
.
then
((
response
)
=>
{
const
data
=
response
.
data
;
this
.
setLoading
(
false
,
loadingData
);
Store
.
isTree
=
this
.
isTree
(
data
);
RepoHelper
.
setLoading
(
false
,
loadingData
);
Store
.
isTree
=
RepoHelper
.
isTree
(
data
);
if
(
!
Store
.
isTree
)
{
if
(
!
file
)
file
=
data
;
Store
.
binary
=
data
.
binary
;
if
(
data
.
binary
)
{
Store
.
binaryMimeType
=
data
.
mime_type
;
const
rawUrl
=
this
.
getRawURLFromBlobURL
(
file
.
url
);
this
.
setBinaryDataAsBase64
(
rawUrl
,
data
);
const
rawUrl
=
RepoHelper
.
getRawURLFromBlobURL
(
file
.
url
);
RepoHelper
.
setBinaryDataAsBase64
(
rawUrl
,
data
);
data
.
binary
=
true
;
}
else
{
Store
.
blobRaw
=
data
.
plain
;
...
...
@@ -128,19 +129,19 @@ const RepoHelper = {
if
(
Store
.
files
.
length
===
0
)
{
const
parentURL
=
Service
.
blobURLtoParentTree
(
Service
.
url
);
Service
.
url
=
parentURL
;
this
.
getContent
();
RepoHelper
.
getContent
();
}
}
else
{
// it's a tree
file
=
this
.
setDirectoryOpen
(
file
);
const
newDirectory
=
this
.
dataToListOfFiles
(
data
);
file
=
RepoHelper
.
setDirectoryOpen
(
file
);
const
newDirectory
=
RepoHelper
.
dataToListOfFiles
(
data
);
Store
.
addFilesToDirectory
(
file
,
Store
.
files
,
newDirectory
);
Store
.
prevURL
=
Service
.
blobURLtoParentTree
(
Service
.
url
);
}
})
.
catch
(()
=>
{
this
.
setLoading
(
false
,
loadingData
);
this
.
loadingError
();
RepoHelper
.
setLoading
(
false
,
loadingData
);
RepoHelper
.
loadingError
();
});
},
...
...
@@ -149,7 +150,7 @@ const RepoHelper = {
},
serializeBlob
(
blob
)
{
const
simpleBlob
=
this
.
serializeRepoEntity
(
'blob'
,
blob
);
const
simpleBlob
=
RepoHelper
.
serializeRepoEntity
(
'blob'
,
blob
);
simpleBlob
.
lastCommitMessage
=
blob
.
last_commit
.
message
;
simpleBlob
.
lastCommitUpdate
=
blob
.
last_commit
.
committed_date
;
...
...
@@ -157,11 +158,11 @@ const RepoHelper = {
},
serializeTree
(
tree
)
{
return
this
.
serializeRepoEntity
(
'tree'
,
tree
);
return
RepoHelper
.
serializeRepoEntity
(
'tree'
,
tree
);
},
serializeSubmodule
(
submodule
)
{
return
this
.
serializeRepoEntity
(
'submodule'
,
submodule
);
return
RepoHelper
.
serializeRepoEntity
(
'submodule'
,
submodule
);
},
serializeRepoEntity
(
type
,
entity
)
{
...
...
@@ -171,7 +172,7 @@ const RepoHelper = {
type
,
name
,
url
,
icon
:
this
.
toFA
(
icon
),
icon
:
RepoHelper
.
toFA
(
icon
),
level
:
0
,
};
},
...
...
@@ -181,38 +182,38 @@ const RepoHelper = {
// push in blobs
data
.
blobs
.
forEach
((
blob
)
=>
{
a
.
push
(
this
.
serializeBlob
(
blob
));
a
.
push
(
RepoHelper
.
serializeBlob
(
blob
));
});
data
.
trees
.
forEach
((
tree
)
=>
{
a
.
push
(
this
.
serializeTree
(
tree
));
a
.
push
(
RepoHelper
.
serializeTree
(
tree
));
});
data
.
submodules
.
forEach
((
submodule
)
=>
{
a
.
push
(
this
.
serializeSubmodule
(
submodule
));
a
.
push
(
RepoHelper
.
serializeSubmodule
(
submodule
));
});
return
a
;
},
genKey
()
{
return
this
.
Time
.
now
().
toFixed
(
3
);
return
RepoHelper
.
Time
.
now
().
toFixed
(
3
);
},
getStateKey
()
{
return
this
.
key
;
return
RepoHelper
.
key
;
},
setStateKey
(
key
)
{
this
.
key
=
key
;
RepoHelper
.
key
=
key
;
},
toURL
(
url
)
{
const
history
=
window
.
history
;
this
.
key
=
this
.
genKey
();
RepoHelper
.
key
=
RepoHelper
.
genKey
();
history
.
pushState
({
key
:
this
.
key
},
''
,
url
);
history
.
pushState
({
key
:
RepoHelper
.
key
},
''
,
url
);
},
loadingError
()
{
...
...
app/assets/javascripts/repo/repo_sidebar.js
View file @
8a9375e9
...
...
@@ -40,15 +40,17 @@ export default class RepoSidebar {
});
},
linkClicked
(
f
ile
)
{
linkClicked
(
clickedF
ile
)
{
let
url
=
''
;
let
file
=
clickedFile
;
if
(
typeof
file
===
'object'
)
{
if
(
file
.
type
===
'tree'
&&
file
.
opened
)
{
file
=
Store
.
removeChildFilesOfTree
(
file
);
}
}
else
{
url
=
file
.
url
;
Service
.
url
=
url
;
Helper
.
getContent
(
file
);
}
}
else
if
(
typeof
file
===
'string'
)
{
// go back
url
=
file
;
...
...
app/assets/javascripts/repo/repo_store.js
View file @
8a9375e9
...
...
@@ -50,55 +50,56 @@ const RepoStore = {
// mutations
addFilesToDirectory
(
inDirectory
,
currentList
,
newList
)
{
this
.
files
=
RepoHelper
.
getNewMergedList
(
inDirectory
,
currentList
,
newList
);
RepoStore
.
files
=
RepoHelper
.
getNewMergedList
(
inDirectory
,
currentList
,
newList
);
},
toggleRawPreview
()
{
this
.
activeFile
.
raw
=
!
this
.
activeFile
.
raw
;
this
.
activeFileLabel
=
this
.
activeFile
.
raw
?
'Display rendered file'
:
'Display source'
;
RepoStore
.
activeFile
.
raw
=
!
RepoStore
.
activeFile
.
raw
;
RepoStore
.
activeFileLabel
=
RepoStore
.
activeFile
.
raw
?
'Display rendered file'
:
'Display source'
;
},
setActiveFiles
(
file
)
{
if
(
this
.
isActiveFile
(
file
))
return
;
if
(
RepoStore
.
isActiveFile
(
file
))
return
;
this
.
openedFiles
=
this
.
openedFiles
.
map
((
openedFile
,
i
)
=>
this
.
setFileToActive
(
openedFile
,
i
));
RepoStore
.
openedFiles
=
RepoStore
.
openedFiles
.
map
((
openedFile
,
i
)
=>
RepoStore
.
w
(
openedFile
,
i
));
this
.
setActiveToRaw
();
RepoStore
.
setActiveToRaw
();
if
(
file
.
binary
)
{
this
.
blobRaw
=
file
.
base64
;
RepoStore
.
blobRaw
=
file
.
base64
;
}
else
{
this
.
blobRaw
=
file
.
plain
;
RepoStore
.
blobRaw
=
file
.
plain
;
}
if
(
!
file
.
loading
)
RepoHelper
.
toURL
(
file
.
url
);
this
.
binary
=
file
.
binary
;
RepoStore
.
binary
=
file
.
binary
;
},
setFileToActive
(
file
,
i
)
{
w
(
file
,
i
)
{
const
activeFile
=
file
;
activeFile
.
active
=
activeFile
.
url
===
activeFile
.
url
;
if
(
activeFile
.
active
)
this
.
setActiveFile
(
activeFile
,
i
);
if
(
activeFile
.
active
)
RepoStore
.
setActiveFile
(
activeFile
,
i
);
return
activeFile
;
},
setActiveFile
(
activeFile
,
i
)
{
this
.
activeFile
=
activeFile
;
this
.
activeFileIndex
=
i
;
RepoStore
.
activeFile
=
activeFile
;
RepoStore
.
activeFileIndex
=
i
;
},
setActiveToRaw
()
{
this
.
activeFile
.
raw
=
false
;
// can't get vue to listen to raw for some reason so
this
for now.
this
.
activeFileLabel
=
'Display source'
;
RepoStore
.
activeFile
.
raw
=
false
;
// can't get vue to listen to raw for some reason so
RepoStore
for now.
RepoStore
.
activeFileLabel
=
'Display source'
;
},
removeChildFilesOfTree
(
tree
)
{
let
foundTree
=
false
;
le
t
treetoClose
=
tree
;
this
.
files
=
this
.
files
.
filter
((
file
)
=>
{
cons
t
treetoClose
=
tree
;
RepoStore
.
files
=
RepoStore
.
files
.
filter
((
file
)
=>
{
if
(
file
.
url
===
treetoClose
.
url
)
foundTree
=
true
;
if
(
foundTree
)
return
file
.
level
<=
treetoClose
.
level
;
...
...
@@ -113,7 +114,7 @@ const RepoStore = {
removeFromOpenedFiles
(
file
)
{
if
(
file
.
type
===
'tree'
)
return
;
this
.
openedFiles
=
this
.
openedFiles
.
filter
(
openedFile
=>
openedFile
.
url
!==
file
.
url
);
RepoStore
.
openedFiles
=
RepoStore
.
openedFiles
.
filter
(
openedFile
=>
openedFile
.
url
!==
file
.
url
);
},
addPlaceholderFile
()
{
...
...
@@ -128,7 +129,7 @@ const RepoStore = {
url
:
randomURL
,
};
this
.
openedFiles
.
push
(
newFakeFile
);
RepoStore
.
openedFiles
.
push
(
newFakeFile
);
return
newFakeFile
;
},
...
...
@@ -136,27 +137,27 @@ const RepoStore = {
addToOpenedFiles
(
file
)
{
const
openFile
=
file
;
const
openedFilesAlreadyExists
=
this
.
openedFiles
const
openedFilesAlreadyExists
=
RepoStore
.
openedFiles
.
some
(
openedFile
=>
openedFile
.
url
===
openFile
.
url
);
if
(
openedFilesAlreadyExists
)
return
;
openFile
.
changed
=
false
;
this
.
openedFiles
.
push
(
openFile
);
RepoStore
.
openedFiles
.
push
(
openFile
);
},
setActiveFileContents
(
contents
)
{
if
(
!
this
.
editMode
)
return
;
if
(
!
RepoStore
.
editMode
)
return
;
this
.
activeFile
.
newContent
=
contents
;
this
.
activeFile
.
changed
=
this
.
activeFile
.
plain
!==
this
.
activeFile
.
newContent
;
this
.
openedFiles
[
this
.
activeFileIndex
].
changed
=
this
.
activeFile
.
changed
;
RepoStore
.
activeFile
.
newContent
=
contents
;
RepoStore
.
activeFile
.
changed
=
RepoStore
.
activeFile
.
plain
!==
RepoStore
.
activeFile
.
newContent
;
RepoStore
.
openedFiles
[
RepoStore
.
activeFileIndex
].
changed
=
RepoStore
.
activeFile
.
changed
;
},
// getters
isActiveFile
(
file
)
{
return
file
&&
file
.
url
===
this
.
activeFile
.
url
;
return
file
&&
file
.
url
===
RepoStore
.
activeFile
.
url
;
},
};
export
default
RepoStore
;
app/assets/javascripts/repo/repo_tab.vue
View file @
8a9375e9
...
...
@@ -20,7 +20,7 @@ const RepoTab = {
},
methods
:
{
tabClicked
:
RepoStore
.
setActiveFiles
.
bind
(
RepoStore
)
,
tabClicked
:
RepoStore
.
setActiveFiles
,
xClicked
(
file
)
{
if
(
file
.
changed
)
return
;
...
...
config/webpack.config.js
View file @
8a9375e9
...
...
@@ -212,10 +212,11 @@ var config = {
from
:
path
.
join
(
ROOT_PATH
,
`node_modules/monaco-editor/
${
IS_PRODUCTION
?
'min'
:
'dev'
}
/vs`
),
to
:
'monaco-editor/vs'
,
transform
:
function
(
content
,
path
)
{
if
(
/
\.
js$/
.
test
(
path
)
&&
!
/worker
Main/
.
test
(
path
))
{
if
(
/
\.
js$/
.
test
(
path
)
&&
!
/worker
/i
.
test
(
path
))
{
return
(
'(function(){
\
n'
+
'var define = this.define, require = this.require;
\
n'
+
'window.define = define; window.require = require;
\
n'
+
content
+
'
\
n}.call(window.__monaco_context__ || (window.__monaco_context__ = {})));'
);
...
...
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