Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
e25a8e12
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,发现更多精彩内容 >>
提交
e25a8e12
编写于
11月 14, 2017
作者:
F
Filipa Lacerda
提交者:
Kamil Trzcinski
12月 03, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add clipboard button to readonly inputs
上级
a78c4b22
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
71 addition
and
8 deletion
+71
-8
app/assets/javascripts/clusters/clusters_bundle.js
app/assets/javascripts/clusters/clusters_bundle.js
+18
-2
app/views/projects/clusters/gcp/_show.html.haml
app/views/projects/clusters/gcp/_show.html.haml
+40
-0
app/views/projects/clusters/kubernetes/_form.html.haml
app/views/projects/clusters/kubernetes/_form.html.haml
+4
-0
app/views/projects/clusters/kubernetes/_show.html.haml
app/views/projects/clusters/kubernetes/_show.html.haml
+5
-5
app/views/projects/clusters/show.html.haml
app/views/projects/clusters/show.html.haml
+4
-1
未找到文件。
app/assets/javascripts/clusters/clusters_bundle.js
浏览文件 @
e25a8e12
...
...
@@ -60,6 +60,8 @@ export default class Clusters {
this
.
showTokenButton
=
document
.
querySelector
(
'
.js-show-cluster-token
'
);
this
.
tokenField
=
document
.
querySelector
(
'
.js-cluster-token
'
);
this
.
showTokenButtonHasEventListener
=
false
;
initSettingsPanels
();
this
.
initApplications
();
...
...
@@ -100,13 +102,26 @@ export default class Clusters {
addListeners
()
{
this
.
toggleButton
.
addEventListener
(
'
click
'
,
this
.
toggle
);
this
.
showTokenButton
.
addEventListener
(
'
click
'
,
this
.
showToken
);
this
.
addEventListenerToken
(
);
eventHub
.
$on
(
'
installApplication
'
,
this
.
installApplication
);
}
/**
* This button only exists when the cluster is 'created'.
* Because we are polling cluster status we need to make sure we only set one event listener
*/
addEventListenerToken
()
{
if
(
this
.
showTokenButton
&&
!
this
.
showTokenButtonHasEventListener
)
{
this
.
showTokenButtonHasEventListener
=
true
;
this
.
showTokenButton
.
addEventListener
(
'
click
'
,
this
.
showToken
);
}
}
removeListeners
()
{
this
.
toggleButton
.
removeEventListener
(
'
click
'
,
this
.
toggle
);
this
.
showTokenButton
.
removeEventListener
(
'
click
'
,
this
.
showToken
);
if
(
this
.
showTokenButton
)
{
this
.
showTokenButton
.
removeEventListener
(
'
click
'
,
this
.
showToken
);
this
.
showTokenButtonHasEventListener
=
false
;
}
eventHub
.
$off
(
'
installApplication
'
,
this
.
installApplication
);
}
...
...
@@ -193,6 +208,7 @@ export default class Clusters {
switch
(
status
)
{
case
'
created
'
:
this
.
successContainer
.
classList
.
remove
(
'
hidden
'
);
this
.
addEventListenerToken
();
break
;
case
'
errored
'
:
this
.
errorContainer
.
classList
.
remove
(
'
hidden
'
);
...
...
app/views/projects/clusters/gcp/_show.html.haml
0 → 100644
浏览文件 @
e25a8e12
.form-group
%label
.append-bottom-10
{
for:
'cluster-name'
}
=
s_
(
'ClusterIntegration|Cluster name'
)
.input-group
%input
.form-control.cluster-name
{
value:
@cluster
.
name
,
readonly:
true
}
%span
.input-group-btn
=
clipboard_button
(
text:
@cluster
.
name
,
title:
s_
(
'ClusterIntegration|Copy cluster name'
),
class:
'btn-default'
)
=
form_for
@cluster
,
url:
namespace_project_cluster_path
(
@project
.
namespace
,
@project
,
@cluster
),
as: :cluster
do
|
field
|
=
form_errors
(
@cluster
)
=
field
.
fields_for
:platform_kubernetes
,
@cluster
.
platform_kubernetes
do
|
platform_kubernetes_field
|
.form-group
=
platform_kubernetes_field
.
label
:api_url
,
s_
(
'ClusterIntegration|API URL'
)
.input-group
=
platform_kubernetes_field
.
text_field
:api_url
,
class:
'form-control'
,
placeholder:
s_
(
'ClusterIntegration|API URL'
),
readonly:
true
%span
.input-group-btn
=
clipboard_button
(
text:
@cluster
.
platform_kubernetes
.
api_url
,
title:
s_
(
'ClusterIntegration|Copy API URL'
),
class:
'btn-default'
)
.form-group
=
platform_kubernetes_field
.
label
:ca_cert
,
s_
(
'ClusterIntegration|CA Certificate'
)
.input-group
=
platform_kubernetes_field
.
text_area
:ca_cert
,
class:
'form-control'
,
placeholder:
s_
(
'ClusterIntegration|Certificate Authority bundle (PEM format)'
),
readonly:
true
%span
.input-group-addon.clipboard-addon
=
clipboard_button
(
text:
@cluster
.
platform_kubernetes
.
ca_cert
,
title:
s_
(
'ClusterIntegration|Copy CA Certificate'
),
class:
'btn-blank'
)
.form-group
=
platform_kubernetes_field
.
label
:token
,
s_
(
'ClusterIntegration|Token'
)
.input-group
=
platform_kubernetes_field
.
text_field
:token
,
class:
'form-control js-cluster-token'
,
type:
'password'
,
placeholder:
s_
(
'ClusterIntegration|Token'
),
readonly:
true
%span
.input-group-btn
%button
.btn.btn-default.js-show-cluster-token
{
type:
'button'
}
=
s_
(
'ClusterIntegration|Show'
)
=
clipboard_button
(
text:
@cluster
.
platform_kubernetes
.
token
,
title:
s_
(
'ClusterIntegration|Copy Token'
),
class:
'btn-default'
)
.form-group
=
platform_kubernetes_field
.
label
:namespace
,
s_
(
'ClusterIntegration|Project namespace (optional, unique)'
)
=
platform_kubernetes_field
.
text_field
:namespace
,
class:
'form-control'
,
placeholder:
s_
(
'ClusterIntegration|Project namespace'
),
readonly:
true
.form-group
=
field
.
submit
s_
(
'ClusterIntegration|Save changes'
),
class:
'btn btn-save'
app/views/projects/clusters/kubernetes/_form.html.haml
浏览文件 @
e25a8e12
=
form_for
@cluster
,
url:
platforms_kubernetes_namespace_project_clusters_path
(
@project
.
namespace
,
@project
),
as: :cluster
do
|
field
|
=
form_errors
(
@cluster
)
.form-group
=
field
.
label
:name
,
s_
(
'ClusterIntegration|Cluster name'
)
=
field
.
text_field
:name
,
class:
'form-control'
,
placeholder:
s_
(
'ClusterIntegration|Cluster name'
)
=
field
.
fields_for
:platform_kubernetes
,
@cluster
.
platform_kubernetes
do
|
platform_kubernetes_field
|
.form-group
=
platform_kubernetes_field
.
label
:api_url
,
s_
(
'ClusterIntegration|API URL'
)
...
...
app/views/projects/clusters/
_form
.html.haml
→
app/views/projects/clusters/
kubernetes/_show
.html.haml
浏览文件 @
e25a8e12
...
...
@@ -2,7 +2,7 @@
%label
.append-bottom-10
{
for:
'cluster-name'
}
=
s_
(
'ClusterIntegration|Cluster name'
)
.input-group
%input
.form-control.cluster-name
{
value:
@cluster
.
name
,
disabled
:
true
}
%input
.form-control.cluster-name
{
value:
@cluster
.
name
,
readonly
:
true
}
%span
.input-group-addon.clipboard-addon
=
clipboard_button
(
text:
@cluster
.
name
,
title:
s_
(
'ClusterIntegration|Copy cluster name'
))
...
...
@@ -11,23 +11,23 @@
=
field
.
fields_for
:platform_kubernetes
,
@cluster
.
platform_kubernetes
do
|
platform_kubernetes_field
|
.form-group
=
platform_kubernetes_field
.
label
:api_url
,
s_
(
'ClusterIntegration|API URL'
)
=
platform_kubernetes_field
.
text_field
:api_url
,
class:
'form-control'
,
placeholder:
s_
(
'ClusterIntegration|API URL'
)
,
disabled:
@cluster
.
managed?
=
platform_kubernetes_field
.
text_field
:api_url
,
class:
'form-control'
,
placeholder:
s_
(
'ClusterIntegration|API URL'
)
.form-group
=
platform_kubernetes_field
.
label
:ca_cert
,
s_
(
'ClusterIntegration|CA Certificate'
)
=
platform_kubernetes_field
.
text_area
:ca_cert
,
class:
'form-control'
,
placeholder:
s_
(
'ClusterIntegration|Certificate Authority bundle (PEM format)'
)
,
disabled:
@cluster
.
managed?
=
platform_kubernetes_field
.
text_area
:ca_cert
,
class:
'form-control'
,
placeholder:
s_
(
'ClusterIntegration|Certificate Authority bundle (PEM format)'
)
.form-group
=
platform_kubernetes_field
.
label
:token
,
s_
(
'ClusterIntegration|Token'
)
.input-group
=
platform_kubernetes_field
.
text_field
:token
,
class:
'form-control js-cluster-token'
,
type:
'password'
,
placeholder:
s_
(
'ClusterIntegration|Token'
)
,
disabled:
@cluster
.
managed?
=
platform_kubernetes_field
.
text_field
:token
,
class:
'form-control js-cluster-token'
,
type:
'password'
,
placeholder:
s_
(
'ClusterIntegration|Token'
)
%span
.input-group-addon.clipboard-addon
%button
.js-show-cluster-token.btn-blank
{
type:
'button'
}
=
s_
(
'ClusterIntegration|Show'
)
.form-group
=
platform_kubernetes_field
.
label
:namespace
,
s_
(
'ClusterIntegration|Project namespace (optional, unique)'
)
=
platform_kubernetes_field
.
text_field
:namespace
,
class:
'form-control'
,
placeholder:
s_
(
'ClusterIntegration|Project namespace'
)
,
disabled:
@cluster
.
managed?
=
platform_kubernetes_field
.
text_field
:namespace
,
class:
'form-control'
,
placeholder:
s_
(
'ClusterIntegration|Project namespace'
)
.form-group
=
field
.
submit
s_
(
'ClusterIntegration|Save changes'
),
class:
'btn btn-save'
app/views/projects/clusters/show.html.haml
浏览文件 @
e25a8e12
...
...
@@ -66,7 +66,10 @@
%p
=
s_
(
'ClusterIntegration|See and edit the details for your cluster'
)
.settings-content
=
render
'form'
-
if
@cluster
.
managed?
=
render
'projects/clusters/gcp/show'
-
else
=
render
'projects/clusters/kubernetes/show'
%section
.settings.no-animate
#js-cluster-advanced-settings
{
class:
(
'expanded'
if
expanded
)
}
.settings-header
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录