Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
凌波微步_大先生
dashboard
提交
3fc3fcbc
D
dashboard
项目概览
凌波微步_大先生
/
dashboard
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dashboard
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
3fc3fcbc
编写于
2月 07, 2019
作者:
A
Ajat Prabha
提交者:
Kubernetes Prow Robot
2月 07, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
align actionbar actions with context actions (#3514)
上级
1f2007d1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
50 addition
and
1 deletion
+50
-1
src/app/frontend/common/components/actionbar/detailactions/component.ts
...nd/common/components/actionbar/detailactions/component.ts
+1
-0
src/app/frontend/common/components/list/column/menu/component.ts
.../frontend/common/components/list/column/menu/component.ts
+40
-1
src/app/frontend/common/components/list/column/menu/template.html
...frontend/common/components/list/column/menu/template.html
+9
-0
未找到文件。
src/app/frontend/common/components/actionbar/detailactions/component.ts
浏览文件 @
3fc3fcbc
...
...
@@ -14,6 +14,7 @@
import
{
Component
,
Input
}
from
'
@angular/core
'
;
import
{
ObjectMeta
,
TypeMeta
}
from
'
@api/backendapi
'
;
import
{
ResourceMeta
}
from
'
../../../services/global/actionbar
'
;
@
Component
({
selector
:
'
kd-actionbar-detail-actions
'
,
...
...
src/app/frontend/common/components/list/column/menu/component.ts
浏览文件 @
3fc3fcbc
...
...
@@ -17,7 +17,21 @@ import {ObjectMeta, TypeMeta} from '@api/backendapi';
import
{
ActionColumn
}
from
'
@api/frontendapi
'
;
import
{
StateService
}
from
'
@uirouter/core
'
;
import
{
Subscription
}
from
'
rxjs/Subscription
'
;
import
{
logsState
}
from
'
../../../../../logs/state
'
;
import
{
LogsStateParams
}
from
'
../../../../params/params
'
;
import
{
KdStateService
}
from
'
../../../../services/global/state
'
;
import
{
VerberService
}
from
'
../../../../services/global/verber
'
;
import
{
Resource
}
from
'
../../../../services/resource/endpoint
'
;
const
loggableResources
:
string
[]
=
[
Resource
.
daemonSet
,
Resource
.
job
,
Resource
.
pod
,
Resource
.
replicaSet
,
Resource
.
replicationController
,
Resource
.
statefulSet
];
const
scalableResources
:
string
[]
=
[
Resource
.
deployment
,
Resource
.
replicaSet
,
Resource
.
replicationController
,
Resource
.
statefulSet
];
@
Component
({
selector
:
'
kd-resource-context-menu
'
,
...
...
@@ -27,10 +41,13 @@ export class MenuComponent implements ActionColumn, OnDestroy {
@
Input
()
objectMeta
:
ObjectMeta
;
@
Input
()
typeMeta
:
TypeMeta
;
private
onScaleSubscription_
:
Subscription
;
private
onEditSubscription_
:
Subscription
;
private
onDeleteSubscription_
:
Subscription
;
constructor
(
private
readonly
verber_
:
VerberService
,
private
readonly
state_
:
StateService
)
{}
constructor
(
private
readonly
verber_
:
VerberService
,
private
readonly
state_
:
StateService
,
private
readonly
kdState_
:
KdStateService
)
{}
setObjectMeta
(
objectMeta
:
ObjectMeta
):
void
{
this
.
objectMeta
=
objectMeta
;
...
...
@@ -41,10 +58,32 @@ export class MenuComponent implements ActionColumn, OnDestroy {
}
ngOnDestroy
():
void
{
if
(
this
.
onScaleSubscription_
)
this
.
onScaleSubscription_
.
unsubscribe
();
if
(
this
.
onEditSubscription_
)
this
.
onEditSubscription_
.
unsubscribe
();
if
(
this
.
onDeleteSubscription_
)
this
.
onDeleteSubscription_
.
unsubscribe
();
}
showOption
(
optionName
:
string
):
boolean
{
return
(
optionName
===
'
logs
'
&&
loggableResources
.
includes
(
this
.
typeMeta
.
kind
))
||
(
optionName
===
'
scale
'
&&
scalableResources
.
includes
(
this
.
typeMeta
.
kind
))
||
(
optionName
===
'
exec
'
&&
this
.
typeMeta
.
kind
===
Resource
.
pod
);
}
getLogsHref
():
string
{
return
this
.
state_
.
href
(
logsState
.
name
,
new
LogsStateParams
(
this
.
objectMeta
.
namespace
,
this
.
objectMeta
.
name
,
this
.
typeMeta
.
kind
));
}
getExecHref
():
string
{
return
this
.
kdState_
.
href
(
'
shell
'
,
this
.
objectMeta
.
name
,
this
.
objectMeta
.
namespace
);
}
onScale
()
{
this
.
onScaleSubscription_
=
this
.
verber_
.
onScale
.
subscribe
(
this
.
onSuccess_
.
bind
(
this
));
this
.
verber_
.
showScaleDialog
(
this
.
typeMeta
.
kind
,
this
.
typeMeta
,
this
.
objectMeta
);
}
onEdit
():
void
{
this
.
onEditSubscription_
=
this
.
verber_
.
onEdit
.
subscribe
(
this
.
onSuccess_
.
bind
(
this
));
this
.
verber_
.
showEditDialog
(
this
.
typeMeta
.
kind
,
this
.
typeMeta
,
this
.
objectMeta
);
...
...
src/app/frontend/common/components/list/column/menu/template.html
浏览文件 @
3fc3fcbc
...
...
@@ -15,6 +15,15 @@ limitations under the License.
-->
<mat-menu
#actions
="
matMenu
"
>
<a
mat-menu-item
*ngIf=
"showOption('logs')"
[href]=
"getLogsHref()"
>
Logs
</a>
<a
mat-menu-item
*ngIf=
"showOption('exec')"
[href]=
"getExecHref()"
>
Exec
</a>
<button
mat-menu-item
*ngIf=
"showOption('scale')"
(click)=
"onScale()"
>
Scale
</button>
<button
mat-menu-item
(click)=
"onEdit()"
>
Edit
</button>
<button
mat-menu-item
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录