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
a82b7432
Commit
a82b7432
authored
Jul 26, 2017
by
Luke "Jared" Bennett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix eslint offenses
parent
4ae39ceb
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
52 additions
and
60 deletions
+52
-60
app/assets/javascripts/api.js
app/assets/javascripts/api.js
+2
-3
app/assets/javascripts/project.js
app/assets/javascripts/project.js
+1
-1
app/assets/javascripts/repo/index.js
app/assets/javascripts/repo/index.js
+3
-3
app/assets/javascripts/repo/repo_binary_viewer.vue
app/assets/javascripts/repo/repo_binary_viewer.vue
+0
-1
app/assets/javascripts/repo/repo_commit_section.vue
app/assets/javascripts/repo/repo_commit_section.vue
+15
-15
app/assets/javascripts/repo/repo_editor.vue
app/assets/javascripts/repo/repo_editor.vue
+2
-3
app/assets/javascripts/repo/repo_file_buttons.vue
app/assets/javascripts/repo/repo_file_buttons.vue
+0
-1
app/assets/javascripts/repo/repo_helper.js
app/assets/javascripts/repo/repo_helper.js
+9
-13
app/assets/javascripts/repo/repo_service.js
app/assets/javascripts/repo/repo_service.js
+5
-5
app/assets/javascripts/repo/repo_sidebar.vue
app/assets/javascripts/repo/repo_sidebar.vue
+0
-1
app/assets/javascripts/repo/repo_store.js
app/assets/javascripts/repo/repo_store.js
+10
-9
app/assets/javascripts/repo/repo_tabs.vue
app/assets/javascripts/repo/repo_tabs.vue
+4
-4
spec/javascripts/repo/repo_tab_spec.js
spec/javascripts/repo/repo_tab_spec.js
+1
-1
No files found.
app/assets/javascripts/api.js
View file @
a82b7432
...
@@ -103,16 +103,15 @@ const Api = {
...
@@ -103,16 +103,15 @@ const Api = {
return
$
.
ajax
({
return
$
.
ajax
({
url
,
url
,
headers
:
{
headers
:
{
'
PRIVATE_TOKEN
'
:
token
,
PRIVATE_TOKEN
:
token
,
},
},
type
:
'
POST
'
,
type
:
'
POST
'
,
contentType
:
"
application/json; charset=utf-8
"
,
contentType
:
'
application/json; charset=utf-8
'
,
data
:
JSON
.
stringify
(
data
),
data
:
JSON
.
stringify
(
data
),
dataType
:
'
json
'
,
dataType
:
'
json
'
,
})
})
.
done
(
commitData
=>
callback
(
commitData
))
.
done
(
commitData
=>
callback
(
commitData
))
.
fail
(
message
=>
callback
(
message
.
responseJSON
));
.
fail
(
message
=>
callback
(
message
.
responseJSON
));
},
},
// Return text for a specific license
// Return text for a specific license
...
...
app/assets/javascripts/project.js
View file @
a82b7432
...
@@ -77,7 +77,7 @@ import Cookies from 'js-cookie';
...
@@ -77,7 +77,7 @@ import Cookies from 'js-cookie';
},
},
dataType
:
"
json
"
dataType
:
"
json
"
}).
done
(
function
(
refs
)
{
}).
done
(
function
(
refs
)
{
console
.
log
(
refs
)
console
.
log
(
refs
)
;
return
callback
(
refs
);
return
callback
(
refs
);
});
});
},
},
...
...
app/assets/javascripts/repo/index.js
View file @
a82b7432
...
@@ -19,12 +19,12 @@ function initRepo() {
...
@@ -19,12 +19,12 @@ function initRepo() {
Store
.
service
.
url
=
repo
.
dataset
.
url
;
Store
.
service
.
url
=
repo
.
dataset
.
url
;
Store
.
projectName
=
repo
.
dataset
.
projectName
;
Store
.
projectName
=
repo
.
dataset
.
projectName
;
Store
.
service
.
refsUrl
=
repo
.
dataset
.
refsUrl
;
Store
.
service
.
refsUrl
=
repo
.
dataset
.
refsUrl
;
Store
.
currentBranch
=
$
(
"
button.dropdown-menu-toggle
"
).
attr
(
'
data-ref
'
);
Store
.
currentBranch
=
$
(
'
button.dropdown-menu-toggle
'
).
attr
(
'
data-ref
'
);
Store
.
checkIsCommitable
();
Store
.
checkIsCommitable
();
Store
.
projectId
=
repo
.
dataset
.
projectId
;
Store
.
projectId
=
repo
.
dataset
.
projectId
;
Store
.
tempPrivateToken
=
repo
.
dataset
.
tempToken
;
Store
.
tempPrivateToken
=
repo
.
dataset
.
tempToken
;
new
Vue
({
this
.
vm
=
new
Vue
({
el
:
repo
,
el
:
repo
,
data
:
()
=>
Store
,
data
:
()
=>
Store
,
template
:
`
template
:
`
...
@@ -45,7 +45,7 @@ function initRepo() {
...
@@ -45,7 +45,7 @@ function initRepo() {
'
repo-file-buttons
'
:
RepoFileButtons
,
'
repo-file-buttons
'
:
RepoFileButtons
,
'
repo-binary-viewer
'
:
RepoBinaryViewer
,
'
repo-binary-viewer
'
:
RepoBinaryViewer
,
'
repo-editor
'
:
RepoEditor
,
'
repo-editor
'
:
RepoEditor
,
'
repo-commit-section
'
:
RepoCommitSection
'
repo-commit-section
'
:
RepoCommitSection
,
},
},
});
});
...
...
app/assets/javascripts/repo/repo_binary_viewer.vue
View file @
a82b7432
<
script
>
<
script
>
import
Vue
from
'
vue
'
;
import
Store
from
'
./repo_store
'
;
import
Store
from
'
./repo_store
'
;
import
RepoHelper
from
'
./repo_helper
'
;
import
RepoHelper
from
'
./repo_helper
'
;
...
...
app/assets/javascripts/repo/repo_commit_section.vue
View file @
a82b7432
<
script
>
<
script
>
import
Vue
from
'
vue
'
;
/* global Flash */
import
Store
from
'
./repo_store
'
;
import
Store
from
'
./repo_store
'
;
import
Api
from
'
../api
'
import
Api
from
'
../api
'
;
const
RepoCommitSection
=
{
const
RepoCommitSection
=
{
data
:
()
=>
Store
,
data
:
()
=>
Store
,
...
@@ -9,21 +9,21 @@ const RepoCommitSection = {
...
@@ -9,21 +9,21 @@ const RepoCommitSection = {
methods
:
{
methods
:
{
makeCommit
()
{
makeCommit
()
{
// see https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
// see https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
const
branch
=
$
(
"
button.dropdown-menu-toggle
"
).
attr
(
'
data-ref
'
);
const
branch
=
$
(
'
button.dropdown-menu-toggle
'
).
attr
(
'
data-ref
'
);
const
commitMessage
=
this
.
commitMessage
;
const
commitMessage
=
this
.
commitMessage
;
const
actions
=
this
.
changedFiles
.
map
(
f
=>
{
const
actions
=
this
.
changedFiles
.
map
(
(
f
)
=>
{
const
filePath
=
f
.
url
.
split
(
branch
)[
1
];
const
filePath
=
f
.
url
.
split
(
branch
)[
1
];
return
{
return
{
action
:
'
update
'
,
action
:
'
update
'
,
file_path
:
filePath
,
file_path
:
filePath
,
content
:
f
.
newContent
,
content
:
f
.
newContent
,
};
};
});
});
const
payload
=
{
const
payload
=
{
branch
:
branch
,
branch
,
commit_message
:
commitMessage
,
commit_message
:
commitMessage
,
actions
:
actions
,
actions
,
}
}
;
Store
.
submitCommitsLoading
=
true
;
Store
.
submitCommitsLoading
=
true
;
Api
.
commitMultiple
(
Store
.
projectId
,
payload
,
(
data
)
=>
{
Api
.
commitMultiple
(
Store
.
projectId
,
payload
,
(
data
)
=>
{
Store
.
submitCommitsLoading
=
false
;
Store
.
submitCommitsLoading
=
false
;
...
@@ -36,7 +36,7 @@ const RepoCommitSection = {
...
@@ -36,7 +36,7 @@ const RepoCommitSection = {
this
.
editMode
=
false
;
this
.
editMode
=
false
;
$
(
'
html, body
'
).
animate
({
scrollTop
:
0
},
'
fast
'
);
$
(
'
html, body
'
).
animate
({
scrollTop
:
0
},
'
fast
'
);
},
Store
.
tempPrivateToken
);
},
Store
.
tempPrivateToken
);
}
}
,
},
},
computed
:
{
computed
:
{
...
@@ -46,7 +46,7 @@ const RepoCommitSection = {
...
@@ -46,7 +46,7 @@ const RepoCommitSection = {
return
changedFileList
;
return
changedFileList
;
},
},
},
},
}
}
;
export
default
RepoCommitSection
;
export
default
RepoCommitSection
;
</
script
>
</
script
>
...
...
app/assets/javascripts/repo/repo_editor.vue
View file @
a82b7432
<
script
>
<
script
>
/* global monaco */
/* global monaco */
import
Vue
from
'
vue
'
;
import
Store
from
'
./repo_store
'
;
import
Store
from
'
./repo_store
'
;
import
Helper
from
'
./repo_helper
'
;
import
Helper
from
'
./repo_helper
'
;
import
monacoLoader
from
'
./monaco_loader
'
;
import
monacoLoader
from
'
./monaco_loader
'
;
...
@@ -28,7 +27,7 @@ const RepoEditor = {
...
@@ -28,7 +27,7 @@ const RepoEditor = {
const
newModel
=
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
'
plaintext
'
);
const
newModel
=
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
'
plaintext
'
);
this
.
monacoInstance
.
setModel
(
newModel
);
this
.
monacoInstance
.
setModel
(
newModel
);
});
})
.
catch
(
Helper
.
loadingError
)
;
});
});
},
},
...
@@ -55,7 +54,7 @@ const RepoEditor = {
...
@@ -55,7 +54,7 @@ const RepoEditor = {
location
.
hash
=
`L
${
e
.
target
.
position
.
lineNumber
}
`
;
location
.
hash
=
`L
${
e
.
target
.
position
.
lineNumber
}
`
;
Store
.
activeLine
=
e
.
target
.
position
.
lineNumber
;
Store
.
activeLine
=
e
.
target
.
position
.
lineNumber
;
}
}
}
}
,
},
},
watch
:
{
watch
:
{
...
...
app/assets/javascripts/repo/repo_file_buttons.vue
View file @
a82b7432
<
script
>
<
script
>
import
Vue
from
'
vue
'
;
import
Store
from
'
./repo_store
'
;
import
Store
from
'
./repo_store
'
;
import
Helper
from
'
./repo_helper
'
;
import
Helper
from
'
./repo_helper
'
;
import
RepoMiniMixin
from
'
./repo_mini_mixin
'
;
import
RepoMiniMixin
from
'
./repo_mini_mixin
'
;
...
...
app/assets/javascripts/repo/repo_helper.js
View file @
a82b7432
...
@@ -27,8 +27,8 @@ const RepoHelper = {
...
@@ -27,8 +27,8 @@ const RepoHelper = {
},
},
setDirectoryOpen
(
tree
)
{
setDirectoryOpen
(
tree
)
{
le
t
file
=
tree
;
cons
t
file
=
tree
;
if
(
!
file
)
return
;
if
(
!
file
)
return
undefined
;
file
.
opened
=
true
;
file
.
opened
=
true
;
file
.
icon
=
'
fa-folder-open
'
;
file
.
icon
=
'
fa-folder-open
'
;
...
@@ -91,14 +91,12 @@ const RepoHelper = {
...
@@ -91,14 +91,12 @@ const RepoHelper = {
return
oldList
;
return
oldList
;
},
},
compareFilesCaseInsensitive
(
a
,
b
)
{
compareFilesCaseInsensitive
(
a
,
b
)
{
const
aName
=
a
.
name
.
toLowerCase
();
const
aName
=
a
.
name
.
toLowerCase
();
const
bName
=
b
.
name
.
toLowerCase
();
const
bName
=
b
.
name
.
toLowerCase
();
if
(
a
.
level
>
0
)
return
0
;
if
(
a
.
level
>
0
)
return
0
;
if
(
aName
<
bName
)
if
(
aName
<
bName
)
{
return
-
1
;
}
return
-
1
;
if
(
aName
>
bName
)
{
return
1
;
}
if
(
aName
>
bName
)
return
1
;
return
0
;
return
0
;
},
},
...
@@ -109,7 +107,7 @@ const RepoHelper = {
...
@@ -109,7 +107,7 @@ const RepoHelper = {
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
const
data
=
response
.
data
;
const
data
=
response
.
data
;
// RepoHelper.setLoading(false, loadingData);
// RepoHelper.setLoading(false, loadingData);
if
(
cb
)
cb
();
if
(
cb
)
cb
();
Store
.
isTree
=
RepoHelper
.
isTree
(
data
);
Store
.
isTree
=
RepoHelper
.
isTree
(
data
);
if
(
!
Store
.
isTree
)
{
if
(
!
Store
.
isTree
)
{
if
(
!
file
)
file
=
data
;
if
(
!
file
)
file
=
data
;
...
@@ -187,15 +185,13 @@ const RepoHelper = {
...
@@ -187,15 +185,13 @@ const RepoHelper = {
};
};
},
},
scrollTabsRight
()
{
scrollTabsRight
()
{
// wait for the transition. 0.1 seconds.
// wait for the transition. 0.1 seconds.
setTimeout
(()
=>
{
setTimeout
(()
=>
{
const
tabs
=
document
.
getElementById
(
'
tabs
'
);
const
tabs
=
document
.
getElementById
(
'
tabs
'
);
if
(
!
tabs
)
return
;
if
(
!
tabs
)
return
;
tabs
.
scrollLeft
=
12000
;
tabs
.
scrollLeft
=
12000
;
},
200
)
},
200
)
;
},
},
dataToListOfFiles
(
data
)
{
dataToListOfFiles
(
data
)
{
...
...
app/assets/javascripts/repo/repo_service.js
View file @
a82b7432
import
Store
from
'
./repo_store
'
;
import
axios
from
'
axios
'
;
import
axios
from
'
axios
'
;
import
Store
from
'
./repo_store
'
;
const
RepoService
=
{
const
RepoService
=
{
url
:
''
,
url
:
''
,
...
@@ -12,10 +12,10 @@ const RepoService = {
...
@@ -12,10 +12,10 @@ const RepoService = {
checkCurrentBranchIsCommitable
()
{
checkCurrentBranchIsCommitable
()
{
const
url
=
Store
.
service
.
refsUrl
;
const
url
=
Store
.
service
.
refsUrl
;
return
axios
.
get
(
url
,
{
params
:
{
return
axios
.
get
(
url
,
{
params
:
{
ref
:
Store
.
currentBranch
,
ref
:
Store
.
currentBranch
,
search
:
Store
.
currentBranch
search
:
Store
.
currentBranch
,
}
});
}
});
},
},
buildParams
(
url
=
this
.
url
)
{
buildParams
(
url
=
this
.
url
)
{
...
...
app/assets/javascripts/repo/repo_sidebar.vue
View file @
a82b7432
<
script
>
<
script
>
import
Vue
from
'
vue
'
;
import
Service
from
'
./repo_service
'
;
import
Service
from
'
./repo_service
'
;
import
Helper
from
'
./repo_helper
'
;
import
Helper
from
'
./repo_helper
'
;
import
Store
from
'
./repo_store
'
;
import
Store
from
'
./repo_store
'
;
...
...
app/assets/javascripts/repo/repo_store.js
View file @
a82b7432
/* global Flash */
import
RepoHelper
from
'
./repo_helper
'
;
import
RepoHelper
from
'
./repo_helper
'
;
const
RepoStore
=
{
const
RepoStore
=
{
...
@@ -37,7 +38,7 @@ const RepoStore = {
...
@@ -37,7 +38,7 @@ const RepoStore = {
raw
:
false
,
raw
:
false
,
newContent
:
''
,
newContent
:
''
,
changed
:
false
,
changed
:
false
,
loading
:
false
loading
:
false
,
},
},
activeFileIndex
:
0
,
activeFileIndex
:
0
,
activeLine
:
0
,
activeLine
:
0
,
...
@@ -64,12 +65,12 @@ const RepoStore = {
...
@@ -64,12 +65,12 @@ const RepoStore = {
checkIsCommitable
()
{
checkIsCommitable
()
{
RepoStore
.
service
.
checkCurrentBranchIsCommitable
()
RepoStore
.
service
.
checkCurrentBranchIsCommitable
()
.
then
((
data
)
=>
{
.
then
((
data
)
=>
{
// you shouldn't be able to make commits on commits or tags.
// you shouldn't be able to make commits on commits or tags.
let
{
Branches
,
Commits
,
Tags
}
=
data
.
data
;
const
{
Branches
,
Commits
,
Tags
}
=
data
.
data
;
if
(
Branches
&&
Branches
.
length
)
RepoStore
.
isCommitable
=
true
;
if
(
Branches
&&
Branches
.
length
)
RepoStore
.
isCommitable
=
true
;
if
(
Commits
&&
Commits
.
length
)
RepoStore
.
isCommitable
=
false
;
if
(
Commits
&&
Commits
.
length
)
RepoStore
.
isCommitable
=
false
;
if
(
Tags
&&
Tags
.
length
)
RepoStore
.
isCommitable
=
false
;
if
(
Tags
&&
Tags
.
length
)
RepoStore
.
isCommitable
=
false
;
});
})
.
catch
(()
=>
Flash
(
'
Failed to check if branch can be committed to.
'
))
;
},
},
addFilesToDirectory
(
inDirectory
,
currentList
,
newList
)
{
addFilesToDirectory
(
inDirectory
,
currentList
,
newList
)
{
...
@@ -126,11 +127,11 @@ const RepoStore = {
...
@@ -126,11 +127,11 @@ const RepoStore = {
RepoStore
.
files
=
RepoStore
.
files
.
filter
((
file
)
=>
{
RepoStore
.
files
=
RepoStore
.
files
.
filter
((
file
)
=>
{
const
isItTheTreeWeWant
=
file
.
url
===
treeToClose
.
url
;
const
isItTheTreeWeWant
=
file
.
url
===
treeToClose
.
url
;
// if it's the next tree
// if it's the next tree
if
(
foundTree
&&
file
.
type
===
'
tree
'
&&
!
isItTheTreeWeWant
&&
file
.
level
===
treeToClose
.
level
)
{
if
(
foundTree
&&
file
.
type
===
'
tree
'
&&
!
isItTheTreeWeWant
&&
file
.
level
===
treeToClose
.
level
)
{
wereDone
=
true
;
wereDone
=
true
;
return
true
;
return
true
;
}
}
if
(
wereDone
)
return
true
;
if
(
wereDone
)
return
true
;
if
(
isItTheTreeWeWant
)
foundTree
=
true
;
if
(
isItTheTreeWeWant
)
foundTree
=
true
;
...
...
app/assets/javascripts/repo/repo_tabs.vue
View file @
a82b7432
...
@@ -16,7 +16,7 @@ const RepoTabs = {
...
@@ -16,7 +16,7 @@ const RepoTabs = {
methods
:
{
methods
:
{
isOverflow
()
{
isOverflow
()
{
return
this
.
$el
.
scrollWidth
>
this
.
$el
.
offsetWidth
;
return
this
.
$el
.
scrollWidth
>
this
.
$el
.
offsetWidth
;
}
}
,
},
},
watch
:
{
watch
:
{
...
@@ -24,9 +24,9 @@ const RepoTabs = {
...
@@ -24,9 +24,9 @@ const RepoTabs = {
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
this
.
tabsOverflow
=
this
.
isOverflow
();
this
.
tabsOverflow
=
this
.
isOverflow
();
});
});
}
}
,
}
}
,
}
}
;
export
default
RepoTabs
;
export
default
RepoTabs
;
</
script
>
</
script
>
...
...
spec/javascripts/repo/repo_tab_spec.js
View file @
a82b7432
...
@@ -20,7 +20,7 @@ describe('RepoTab', () => {
...
@@ -20,7 +20,7 @@ describe('RepoTab', () => {
tab
,
tab
,
});
});
const
close
=
vm
.
$el
.
querySelector
(
'
.close
'
);
const
close
=
vm
.
$el
.
querySelector
(
'
.close
'
);
const
name
=
vm
.
$el
.
querySelector
(
`a[title="
${
tab
.
url
}
"]`
)
const
name
=
vm
.
$el
.
querySelector
(
`a[title="
${
tab
.
url
}
"]`
)
;
spyOn
(
vm
,
'
xClicked
'
);
spyOn
(
vm
,
'
xClicked
'
);
spyOn
(
vm
,
'
tabClicked
'
);
spyOn
(
vm
,
'
tabClicked
'
);
...
...
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