Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
a82b7432
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
a82b7432
编写于
7月 26, 2017
作者:
L
Luke "Jared" Bennett
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix eslint offenses
上级
4ae39ceb
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
52 addition
and
60 deletion
+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
未找到文件。
app/assets/javascripts/api.js
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
a82b7432
<
script
>
import
Vue
from
'
vue
'
;
import
Store
from
'
./repo_store
'
;
import
RepoHelper
from
'
./repo_helper
'
;
...
...
app/assets/javascripts/repo/repo_commit_section.vue
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
'
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录