Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
凌波微步_大先生
dashboard
提交
65875b44
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 搜索 >>
提交
65875b44
编写于
6月 08, 2016
作者:
D
Denis Poisson
提交者:
Marcin Maciaszczyk
6月 08, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Status icons for Services visible on list and resources pages + no labels handled (#845)
上级
12511ace
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
133 addition
and
10 deletion
+133
-10
src/app/backend/resource/service/servicecommon.go
src/app/backend/resource/service/servicecommon.go
+1
-0
src/app/backend/resource/service/servicelist.go
src/app/backend/resource/service/servicelist.go
+4
-0
src/app/externs/backendapi.js
src/app/externs/backendapi.js
+1
-0
src/app/frontend/common/components/labels/labels.html
src/app/frontend/common/components/labels/labels.html
+11
-8
src/app/frontend/servicelist/servicecardlist.html
src/app/frontend/servicelist/servicecardlist.html
+12
-1
src/app/frontend/servicelist/servicecardlist_component.js
src/app/frontend/servicelist/servicecardlist_component.js
+33
-0
src/app/frontend/servicelist/servicelist.html
src/app/frontend/servicelist/servicelist.html
+1
-1
src/test/frontend/replicationcontrollerlist/replicationcontrollercard_component_test.js
...ontrollerlist/replicationcontrollercard_component_test.js
+1
-0
src/test/frontend/servicelist/servicecardlist_component_test.js
...st/frontend/servicelist/servicecardlist_component_test.js
+69
-0
未找到文件。
src/app/backend/resource/service/servicecommon.go
浏览文件 @
65875b44
...
...
@@ -29,6 +29,7 @@ func ToService(service *api.Service) Service {
// TODO(maciaszczykm): Fill ExternalEndpoints with data.
Selector
:
service
.
Spec
.
Selector
,
ClusterIP
:
service
.
Spec
.
ClusterIP
,
Type
:
service
.
Spec
.
Type
,
}
}
...
...
src/app/backend/resource/service/servicelist.go
浏览文件 @
65875b44
...
...
@@ -17,6 +17,7 @@ package service
import
(
"log"
"k8s.io/kubernetes/pkg/api"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"github.com/kubernetes/dashboard/resource/common"
...
...
@@ -38,6 +39,9 @@ type Service struct {
// Label selector of the service.
Selector
map
[
string
]
string
`json:"selector"`
// Type determines how the service will be exposed. Valid options: ClusterIP, NodePort, LoadBalancer
Type
api
.
ServiceType
`json:"type"`
// ClusterIP is usually assigned by the master. Valid values are None, empty string (""), or
// a valid IP address. None can be specified for headless services when proxying is not required
ClusterIP
string
`json:"clusterIP"`
...
...
src/app/externs/backendapi.js
浏览文件 @
65875b44
...
...
@@ -407,6 +407,7 @@ backendApi.ServiceDetail;
* internalEndpoint: !backendApi.Endpoint,
* externalEndpoints: !Array<!backendApi.Endpoint>,
* selector: !Object<string, string>,
* type: string,
* clusterIP: string
* }}
*/
...
...
src/app/frontend/common/components/labels/labels.html
浏览文件 @
65875b44
...
...
@@ -14,12 +14,15 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<kd-middle-ellipsis
display-string=
"{{::key}}: {{::value}}"
class=
"kd-labels"
ng-repeat=
"(key, value) in ::labelsCtrl.labels"
ng-if=
"labelsCtrl.isVisible($index)"
>
</kd-middle-ellipsis>
<div
class=
"kd-labels kd-labels-switch"
ng-show=
"labelsCtrl.isMoreAvailable()"
ng-click=
"labelsCtrl.switchLabelsView()"
>
{{labelsCtrl.isShowingAll() ?
labelsCtrl.i18n.MSG_LABELS_SHOW_LESS_TOOLTIP : labelsCtrl.i18n.MSG_LABELS_SHOW_ALL_TOOLTIP}}
<div
ng-if=
"::labelsCtrl.labels"
>
<kd-middle-ellipsis
display-string=
"{{::key}}: {{::value}}"
class=
"kd-labels"
ng-repeat=
"(key, value) in ::labelsCtrl.labels"
ng-if=
"labelsCtrl.isVisible($index)"
>
</kd-middle-ellipsis>
<div
class=
"kd-labels kd-labels-switch"
ng-show=
"labelsCtrl.isMoreAvailable()"
ng-click=
"labelsCtrl.switchLabelsView()"
>
{{labelsCtrl.isShowingAll() ?
labelsCtrl.i18n.MSG_LABELS_SHOW_LESS_TOOLTIP : labelsCtrl.i18n.MSG_LABELS_SHOW_ALL_TOOLTIP}}
</div>
</div>
<div
ng-hide=
"::labelsCtrl.labels"
>
-
</div>
src/app/frontend/servicelist/servicecardlist.html
浏览文件 @
65875b44
...
...
@@ -27,6 +27,15 @@ limitations under the License.
<kd-resource-card
ng-repeat=
"service in ::$ctrl.services"
object-meta=
"service.objectMeta"
type-meta=
"service.typeMeta"
>
<kd-resource-card-status
layout=
"row"
>
<md-icon
class=
"material-icons"
ng-if=
"::$ctrl.isPending(service)"
>
timelapse
<md-tooltip
md-direction=
"right"
>
{{::$ctrl.i18n.MSG_POD_IS_PENDING_TOOLTIP}}
</md-tooltip>
</md-icon>
<md-icon
class=
"material-icons kd-success"
ng-if=
"::$ctrl.isSuccess(service)"
>
check_circle
</md-icon>
</kd-resource-card-status>
<kd-resource-card-columns>
<kd-resource-card-column>
<a
ng-href=
"{{::$ctrl.getServiceDetailHref(service)}}"
>
...
...
@@ -36,7 +45,9 @@ limitations under the License.
<kd-resource-card-column>
<kd-labels
labels=
"::service.objectMeta.labels"
></kd-labels>
</kd-resource-card-column>
<kd-resource-card-column>
{{::service.clusterIP}}
</kd-resource-card-column>
<kd-resource-card-column>
<div>
{{::$ctrl.getServiceClusterIP(service)}}
</div>
</kd-resource-card-column>
<kd-resource-card-column>
<div
ng-if=
"::service.internalEndpoint"
>
<kd-internal-endpoint
endpoint=
"::service.internalEndpoint"
></kd-internal-endpoint>
...
...
src/app/frontend/servicelist/servicecardlist_component.js
浏览文件 @
65875b44
...
...
@@ -40,6 +40,37 @@ export class ServiceCardListController {
return
this
.
state_
.
href
(
stateName
,
new
StateParams
(
service
.
objectMeta
.
namespace
,
service
.
objectMeta
.
name
));
}
/**
* Returns true if Service has no assigned Cluster IP
* or if Service type is LoadBalancer or NodePort and doesn't have an external endpoint IP
* @param {!backendApi.Service} service
* @return {boolean}
* @export
*/
isPending
(
service
)
{
return
service
.
clusterIP
===
null
||
((
service
.
type
===
'
LoadBalancer
'
||
service
.
type
===
'
NodePort
'
)
&&
service
.
externalEndpoints
===
null
);
}
/**
* Returns true if Service has ClusterIP assigned and one of the following conditions is met:
* - Service type is LoadBalancer or NodePort and has an external endpoint IP
* - Service type is not LoadBalancer or NodePort
* @param {!backendApi.Service} service
* @return {boolean}
* @export
*/
isSuccess
(
service
)
{
return
!
this
.
isPending
(
service
);
}
/**
* Returns the service's clusterIP or a dash ('-') if it is not yet set
* @param {!backendApi.Service} service
* @return {string}
* @export
*/
getServiceClusterIP
(
service
)
{
return
service
.
clusterIP
?
service
.
clusterIP
:
'
-
'
;
}
}
/**
...
...
@@ -76,4 +107,6 @@ const i18n = {
/** @export {string} @desc Label 'External endpoints' which appears as a column label in the
table of services (service list view). */
MSG_SERVICE_LIST_EXTERNAL_ENDPOINTS_LABEL
:
goog
.
getMsg
(
'
External endpoints
'
),
/** @export {string} @desc tooltip for pending pod card icon */
MSG_SERVICE_IS_PENDING_TOOLTIP
:
goog
.
getMsg
(
'
This service is in a pending state.
'
),
};
src/app/frontend/servicelist/servicelist.html
浏览文件 @
65875b44
...
...
@@ -16,6 +16,6 @@ limitations under the License.
<kd-content-card>
<kd-content>
<kd-service-card-list
services=
"::ctrl.serviceList.services"
></kd-service-card-list>
<kd-service-card-list
services=
"::ctrl.serviceList.services"
with-statuses=
"true"
></kd-service-card-list>
</kd-content>
</kd-content-card>
src/test/frontend/replicationcontrollerlist/replicationcontrollercard_component_test.js
浏览文件 @
65875b44
...
...
@@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import
replicationControllerListModule
from
'
replicationcontrollerlist/replicationcontrollerlist_module
'
;
describe
(
'
Replication controller card
'
,
()
=>
{
...
...
src/test/frontend/servicelist/servicecardlist_component_test.js
浏览文件 @
65875b44
...
...
@@ -38,4 +38,73 @@ describe('Service list controller', () => {
},
})).
toBe
(
'
#/service/foo-namespace/foo-service
'
);
});
it
(
'
should return true when service.clusterIP is null
'
,
()
=>
{
expect
(
ctrl
.
isPending
({
clusterIP
:
null
,
})).
toBeTruthy
();
});
it
(
'
should return false when service.clusterIP is set
'
,
()
=>
{
expect
(
ctrl
.
isPending
({
clusterIP
:
'
10.67.252.103
'
,
})).
toBeFalsy
();
});
it
(
'
should return true when service.type is LoadBalancer AND service.externalEndpoints is null
'
,
()
=>
{
expect
(
ctrl
.
isPending
({
clusterIP
:
'
10.67.252.103
'
,
type
:
'
LoadBalancer
'
,
externalEndpoints
:
null
,
})).
toBeTruthy
();
});
it
(
'
should return true when service.type is NodePort AND service.externalEndpoints is null
'
,
()
=>
{
expect
(
ctrl
.
isPending
({
clusterIP
:
'
10.67.252.103
'
,
type
:
'
NodePort
'
,
externalEndpoints
:
null
,
})).
toBeTruthy
();
});
it
(
'
should return true when service.type is LoadBalancer AND service.externalEndpoints is set
'
,
()
=>
{
expect
(
ctrl
.
isSuccess
({
clusterIP
:
'
10.67.252.103
'
,
type
:
'
LoadBalancer
'
,
externalEndpoints
:
[
'
10.64.0.4:80
'
,
'
10.64.1.5:80
'
,
'
10.64.2.4:80
'
],
})).
toBeTruthy
();
});
it
(
'
should return true when service.type is NodePort AND service.externalEndpoints is set
'
,
()
=>
{
expect
(
ctrl
.
isSuccess
({
clusterIP
:
'
10.67.252.103
'
,
type
:
'
NodePort
'
,
externalEndpoints
:
[
'
10.64.0.4:80
'
,
'
10.64.1.5:80
'
,
'
10.64.2.4:80
'
],
})).
toBeTruthy
();
});
it
(
'
should return true when service.type is ClusterIP and service.externalEndpoints is null
'
,
()
=>
{
expect
(
ctrl
.
isSuccess
({
clusterIP
:
'
10.67.252.103
'
,
type
:
'
ClusterIP
'
,
externalEndpoints
:
null
,
})).
toBeTruthy
();
});
it
(
'
should return the service clusterIP when teh clusterIP is set
'
,
()
=>
{
expect
(
ctrl
.
getServiceClusterIP
({
clusterIP
:
'
10.67.252.103
'
,
})).
toBe
(
'
10.67.252.103
'
);
});
it
(
'
should return the service clusterIP when teh clusterIP is set
'
,
()
=>
{
expect
(
ctrl
.
getServiceClusterIP
({
clusterIP
:
null
,
})).
toBe
(
'
-
'
);
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录