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
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 = {
return
$
.
ajax
({
url
,
headers
:
{
'
PRIVATE_TOKEN
'
:
token
,
PRIVATE_TOKEN
:
token
,
},
type
:
'
POST
'
,
contentType
:
"
application/json; charset=utf-8
"
,
contentType
:
'
application/json; charset=utf-8
'
,
data
:
JSON
.
stringify
(
data
),
dataType
:
'
json
'
,
})
.
done
(
commitData
=>
callback
(
commitData
))
.
fail
(
message
=>
callback
(
message
.
responseJSON
));
},
// Return text for a specific license
...
...
app/assets/javascripts/project.js
View file @
a82b7432
...
...
@@ -77,7 +77,7 @@ import Cookies from 'js-cookie';
},
dataType
:
"
json
"
}).
done
(
function
(
refs
)
{
console
.
log
(
refs
)
console
.
log
(
refs
)
;
return
callback
(
refs
);
});
},
...
...
app/assets/javascripts/repo/index.js
View file @
a82b7432
...
...
@@ -19,12 +19,12 @@ function initRepo() {
Store
.
service
.
url
=
repo
.
dataset
.
url
;
Store
.
projectName
=
repo
.
dataset
.
projectName
;
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
.
projectId
=
repo
.
dataset
.
projectId
;
Store
.
tempPrivateToken
=
repo
.
dataset
.
tempToken
;
new
Vue
({
this
.
vm
=
new
Vue
({
el
:
repo
,
data
:
()
=>
Store
,
template
:
`
...
...
@@ -45,7 +45,7 @@ function initRepo() {
'
repo-file-buttons
'
:
RepoFileButtons
,
'
repo-binary-viewer
'
:
RepoBinaryViewer
,
'
repo-editor
'
:
RepoEditor
,
'
repo-commit-section
'
:
RepoCommitSection
'
repo-commit-section
'
:
RepoCommitSection
,
},
});
...
...
app/assets/javascripts/repo/repo_binary_viewer.vue
View file @
a82b7432
<
script
>
import
Vue
from
'
vue
'
;
import
Store
from
'
./repo_store
'
;
import
RepoHelper
from
'
./repo_helper
'
;
...
...
app/assets/javascripts/repo/repo_commit_section.vue
View file @
a82b7432
<
script
>
import
Vue
from
'
vue
'
;
/* global Flash */
import
Store
from
'
./repo_store
'
;
import
Api
from
'
../api
'
import
Api
from
'
../api
'
;
const
RepoCommitSection
=
{
data
:
()
=>
Store
,
...
...
@@ -9,21 +9,21 @@ const RepoCommitSection = {
methods
:
{
makeCommit
()
{
// 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
actions
=
this
.
changedFiles
.
map
(
f
=>
{
const
filePath
=
f
.
url
.
split
(
branch
)[
1
];
return
{
action
:
'
update
'
,
file_path
:
filePath
,
content
:
f
.
newContent
,
};
const
actions
=
this
.
changedFiles
.
map
(
(
f
)
=>
{
const
filePath
=
f
.
url
.
split
(
branch
)[
1
];
return
{
action
:
'
update
'
,
file_path
:
filePath
,
content
:
f
.
newContent
,
};
});
const
payload
=
{
branch
:
branch
,
branch
,
commit_message
:
commitMessage
,
actions
:
actions
,
}
actions
,
}
;
Store
.
submitCommitsLoading
=
true
;
Api
.
commitMultiple
(
Store
.
projectId
,
payload
,
(
data
)
=>
{
Store
.
submitCommitsLoading
=
false
;
...
...
@@ -36,7 +36,7 @@ const RepoCommitSection = {
this
.
editMode
=
false
;
$
(
'
html, body
'
).
animate
({
scrollTop
:
0
},
'
fast
'
);
},
Store
.
tempPrivateToken
);
}
}
,
},
computed
:
{
...
...
@@ -46,7 +46,7 @@ const RepoCommitSection = {
return
changedFileList
;
},
},
}
}
;
export
default
RepoCommitSection
;
</
script
>
...
...
app/assets/javascripts/repo/repo_editor.vue
View file @
a82b7432
<
script
>
/* global monaco */
import
Vue
from
'
vue
'
;
import
Store
from
'
./repo_store
'
;
import
Helper
from
'
./repo_helper
'
;
import
monacoLoader
from
'
./monaco_loader
'
;
...
...
@@ -28,7 +27,7 @@ const RepoEditor = {
const
newModel
=
monaco
.
editor
.
createModel
(
this
.
blobRaw
,
'
plaintext
'
);
this
.
monacoInstance
.
setModel
(
newModel
);
});
})
.
catch
(
Helper
.
loadingError
)
;
});
},
...
...
@@ -55,7 +54,7 @@ const RepoEditor = {
location
.
hash
=
`L
${
e
.
target
.
position
.
lineNumber
}
`
;
Store
.
activeLine
=
e
.
target
.
position
.
lineNumber
;
}
}
}
,
},
watch
:
{
...
...
app/assets/javascripts/repo/repo_file_buttons.vue
View file @
a82b7432
<
script
>
import
Vue
from
'
vue
'
;
import
Store
from
'
./repo_store
'
;
import
Helper
from
'
./repo_helper
'
;
import
RepoMiniMixin
from
'
./repo_mini_mixin
'
;
...
...
app/assets/javascripts/repo/repo_helper.js
View file @
a82b7432
...
...
@@ -27,8 +27,8 @@ const RepoHelper = {
},
setDirectoryOpen
(
tree
)
{
le
t
file
=
tree
;
if
(
!
file
)
return
;
cons
t
file
=
tree
;
if
(
!
file
)
return
undefined
;
file
.
opened
=
true
;
file
.
icon
=
'
fa-folder-open
'
;
...
...
@@ -91,14 +91,12 @@ const RepoHelper = {
return
oldList
;
},
compareFilesCaseInsensitive
(
a
,
b
)
{
compareFilesCaseInsensitive
(
a
,
b
)
{
const
aName
=
a
.
name
.
toLowerCase
();
const
bName
=
b
.
name
.
toLowerCase
();
if
(
a
.
level
>
0
)
return
0
;
if
(
aName
<
bName
)
return
-
1
;
if
(
aName
>
bName
)
return
1
;
if
(
a
.
level
>
0
)
return
0
;
if
(
aName
<
bName
)
{
return
-
1
;
}
if
(
aName
>
bName
)
{
return
1
;
}
return
0
;
},
...
...
@@ -109,7 +107,7 @@ const RepoHelper = {
.
then
((
response
)
=>
{
const
data
=
response
.
data
;
// RepoHelper.setLoading(false, loadingData);
if
(
cb
)
cb
();
if
(
cb
)
cb
();
Store
.
isTree
=
RepoHelper
.
isTree
(
data
);
if
(
!
Store
.
isTree
)
{
if
(
!
file
)
file
=
data
;
...
...
@@ -187,15 +185,13 @@ const RepoHelper = {
};
},
scrollTabsRight
()
{
// wait for the transition. 0.1 seconds.
setTimeout
(()
=>
{
const
tabs
=
document
.
getElementById
(
'
tabs
'
);
if
(
!
tabs
)
return
;
if
(
!
tabs
)
return
;
tabs
.
scrollLeft
=
12000
;
},
200
)
},
200
)
;
},
dataToListOfFiles
(
data
)
{
...
...
app/assets/javascripts/repo/repo_service.js
View file @
a82b7432
import
Store
from
'
./repo_store
'
;
import
axios
from
'
axios
'
;
import
Store
from
'
./repo_store
'
;
const
RepoService
=
{
url
:
''
,
...
...
@@ -12,10 +12,10 @@ const RepoService = {
checkCurrentBranchIsCommitable
()
{
const
url
=
Store
.
service
.
refsUrl
;
return
axios
.
get
(
url
,
{
params
:
{
ref
:
Store
.
currentBranch
,
search
:
Store
.
currentBranch
}
});
return
axios
.
get
(
url
,
{
params
:
{
ref
:
Store
.
currentBranch
,
search
:
Store
.
currentBranch
,
}
});
},
buildParams
(
url
=
this
.
url
)
{
...
...
app/assets/javascripts/repo/repo_sidebar.vue
View file @
a82b7432
<
script
>
import
Vue
from
'
vue
'
;
import
Service
from
'
./repo_service
'
;
import
Helper
from
'
./repo_helper
'
;
import
Store
from
'
./repo_store
'
;
...
...
app/assets/javascripts/repo/repo_store.js
View file @
a82b7432
/* global Flash */
import
RepoHelper
from
'
./repo_helper
'
;
const
RepoStore
=
{
...
...
@@ -37,7 +38,7 @@ const RepoStore = {
raw
:
false
,
newContent
:
''
,
changed
:
false
,
loading
:
false
loading
:
false
,
},
activeFileIndex
:
0
,
activeLine
:
0
,
...
...
@@ -64,12 +65,12 @@ const RepoStore = {
checkIsCommitable
()
{
RepoStore
.
service
.
checkCurrentBranchIsCommitable
()
.
then
((
data
)
=>
{
// you shouldn't be able to make commits on commits or tags.
let
{
Branches
,
Commits
,
Tags
}
=
data
.
data
;
if
(
Branches
&&
Branches
.
length
)
RepoStore
.
isCommitable
=
true
;
if
(
Commits
&&
Commits
.
length
)
RepoStore
.
isCommitable
=
false
;
if
(
Tags
&&
Tags
.
length
)
RepoStore
.
isCommitable
=
false
;
});
// you shouldn't be able to make commits on commits or tags.
const
{
Branches
,
Commits
,
Tags
}
=
data
.
data
;
if
(
Branches
&&
Branches
.
length
)
RepoStore
.
isCommitable
=
true
;
if
(
Commits
&&
Commits
.
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
)
{
...
...
@@ -126,11 +127,11 @@ const RepoStore = {
RepoStore
.
files
=
RepoStore
.
files
.
filter
((
file
)
=>
{
const
isItTheTreeWeWant
=
file
.
url
===
treeToClose
.
url
;
// 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
;
return
true
;
}
if
(
wereDone
)
return
true
;
if
(
wereDone
)
return
true
;
if
(
isItTheTreeWeWant
)
foundTree
=
true
;
...
...
app/assets/javascripts/repo/repo_tabs.vue
View file @
a82b7432
...
...
@@ -16,7 +16,7 @@ const RepoTabs = {
methods
:
{
isOverflow
()
{
return
this
.
$el
.
scrollWidth
>
this
.
$el
.
offsetWidth
;
}
}
,
},
watch
:
{
...
...
@@ -24,9 +24,9 @@ const RepoTabs = {
Vue
.
nextTick
(()
=>
{
this
.
tabsOverflow
=
this
.
isOverflow
();
});
}
}
}
}
,
}
,
}
;
export
default
RepoTabs
;
</
script
>
...
...
spec/javascripts/repo/repo_tab_spec.js
View file @
a82b7432
...
...
@@ -20,7 +20,7 @@ describe('RepoTab', () => {
tab
,
});
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
,
'
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