Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
凌波微步_大先生
dashboard
提交
80d8c4f8
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,发现更多精彩内容 >>
提交
80d8c4f8
编写于
11月 18, 2015
作者:
P
Piotr Bryk
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #78 from bryk/replica-set-list
Rename microservice list view to replica set view
上级
4e2c80a2
9dc24566
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
86 addition
and
72 deletion
+86
-72
src/app/backend/apihandler.go
src/app/backend/apihandler.go
+10
-10
src/app/backend/replicasetlist.go
src/app/backend/replicasetlist.go
+21
-28
src/app/externs/backendapi.js
src/app/externs/backendapi.js
+6
-8
src/app/frontend/index.module.js
src/app/frontend/index.module.js
+2
-2
src/app/frontend/replicasetlist/replicasetlist.controller.js
src/app/frontend/replicasetlist/replicasetlist.controller.js
+10
-10
src/app/frontend/replicasetlist/replicasetlist.html
src/app/frontend/replicasetlist/replicasetlist.html
+5
-5
src/app/frontend/replicasetlist/replicasetlist.module.js
src/app/frontend/replicasetlist/replicasetlist.module.js
+4
-4
src/app/frontend/replicasetlist/replicasetlist.scss
src/app/frontend/replicasetlist/replicasetlist.scss
+23
-0
src/app/frontend/replicasetlist/replicasetlist.state.js
src/app/frontend/replicasetlist/replicasetlist.state.js
+5
-5
未找到文件。
src/app/backend/apihandler.go
浏览文件 @
80d8c4f8
...
...
@@ -37,14 +37,14 @@ func CreateHttpApiHandler(client *client.Client) http.Handler {
Writes
(
AppDeployment
{}))
wsContainer
.
Add
(
deployWs
)
microservice
ListWs
:=
new
(
restful
.
WebService
)
microserviceListWs
.
Path
(
"/api/microservice
"
)
.
replicaSet
ListWs
:=
new
(
restful
.
WebService
)
replicaSetListWs
.
Path
(
"/api/replicaset
"
)
.
Produces
(
restful
.
MIME_JSON
)
microservice
ListWs
.
Route
(
microservice
ListWs
.
GET
(
""
)
.
To
(
apiHandler
.
handleGet
Microservice
List
)
.
Writes
(
Microservice
List
{}))
wsContainer
.
Add
(
microservice
ListWs
)
replicaSet
ListWs
.
Route
(
replicaSet
ListWs
.
GET
(
""
)
.
To
(
apiHandler
.
handleGet
ReplicaSet
List
)
.
Writes
(
ReplicaSet
List
{}))
wsContainer
.
Add
(
replicaSet
ListWs
)
return
wsContainer
}
...
...
@@ -68,11 +68,11 @@ func (apiHandler *ApiHandler) handleDeploy(request *restful.Request, response *r
response
.
WriteHeaderAndEntity
(
http
.
StatusCreated
,
cfg
)
}
// Handles get
microservice
list API call.
func
(
apiHandler
*
ApiHandler
)
handleGet
Microservice
List
(
// Handles get
Replica Set
list API call.
func
(
apiHandler
*
ApiHandler
)
handleGet
ReplicaSet
List
(
request
*
restful
.
Request
,
response
*
restful
.
Response
)
{
result
,
err
:=
Get
Microservice
List
(
apiHandler
.
client
)
result
,
err
:=
Get
ReplicaSet
List
(
apiHandler
.
client
)
if
err
!=
nil
{
handleInternalError
(
response
,
err
)
return
...
...
src/app/backend/
microservice
list.go
→
src/app/backend/
replicaset
list.go
浏览文件 @
80d8c4f8
...
...
@@ -21,25 +21,18 @@ import (
"k8s.io/kubernetes/pkg/labels"
)
// List of
microservice
s in the cluster.
type
Microservice
List
struct
{
// Unordered list of
microservice
s.
Microservices
[]
Microservice
`json:"microservice
s"`
// List of
Replica Set
s in the cluster.
type
ReplicaSet
List
struct
{
// Unordered list of
Replica Set
s.
ReplicaSets
[]
ReplicaSet
`json:"replicaSet
s"`
}
// Microservice is a Kubernetes replica set plus zero or more Kubernetes services.
type
Microservice
struct
{
// Name of the microservice, derived from the replica set.
// Kubernetes Replica Set (aka. Replication Controller) plus zero or more Kubernetes services that
// target the Replica Set.
type
ReplicaSet
struct
{
// Name of the Replica Set.
Name
string
`json:"name"`
// Replica set that represents the microservice.
ReplicaSet
ReplicaSet
`json:"replicaSet"`
// TODO(bryk): Add service field here.
}
// Replica set model to represent in the user interface.
type
ReplicaSet
struct
{
// Number of pods that are currently running.
PodsRunning
int
`json:"podsRunning"`
...
...
@@ -48,10 +41,12 @@ type ReplicaSet struct {
// Container images of the replica set.
ContainerImages
[]
string
`json:"containerImages"`
// TODO(bryk): Add service information here.
}
// Returns a list of all
microservice
s in the cluster.
func
Get
MicroserviceList
(
client
*
client
.
Client
)
(
*
Microservice
List
,
error
)
{
// Returns a list of all
Replica Set
s in the cluster.
func
Get
ReplicaSetList
(
client
*
client
.
Client
)
(
*
ReplicaSet
List
,
error
)
{
list
,
err
:=
client
.
ReplicationControllers
(
api
.
NamespaceAll
)
.
List
(
labels
.
Everything
(),
fields
.
Everything
())
...
...
@@ -59,24 +54,22 @@ func GetMicroserviceList(client *client.Client) (*MicroserviceList, error) {
return
nil
,
err
}
microserviceList
:=
&
Microservice
List
{}
replicaSetList
:=
&
ReplicaSet
List
{}
for
_
,
elemen
t
:=
range
list
.
Items
{
for
_
,
replicaSe
t
:=
range
list
.
Items
{
var
containerImages
[]
string
for
_
,
container
:=
range
elemen
t
.
Spec
.
Template
.
Spec
.
Containers
{
for
_
,
container
:=
range
replicaSe
t
.
Spec
.
Template
.
Spec
.
Containers
{
containerImages
=
append
(
containerImages
,
container
.
Image
)
}
microserviceList
.
Microservices
=
append
(
microserviceList
.
Microservices
,
Microservice
{
Name
:
element
.
ObjectMeta
.
Name
,
ReplicaSet
:
ReplicaSet
{
ContainerImages
:
containerImages
,
PodsRunning
:
element
.
Status
.
Replicas
,
PodsDesired
:
element
.
Spec
.
Replicas
,
},
replicaSetList
.
ReplicaSets
=
append
(
replicaSetList
.
ReplicaSets
,
ReplicaSet
{
Name
:
replicaSet
.
ObjectMeta
.
Name
,
ContainerImages
:
containerImages
,
PodsRunning
:
replicaSet
.
Status
.
Replicas
,
PodsDesired
:
replicaSet
.
Spec
.
Replicas
,
})
}
return
microservice
List
,
nil
return
replicaSet
List
,
nil
}
src/app/externs/backendapi.js
浏览文件 @
80d8c4f8
...
...
@@ -50,20 +50,18 @@ backendApi.AppDeployment;
/**
* @typedef {{
*
microservices: !Array<!backendApi.Microservice
>
*
replicaSets: !Array<!backendApi.ReplicaSet
>
* }}
*/
backendApi
.
Microservice
List
;
backendApi
.
ReplicaSet
List
;
/**
* @typedef {{
* name: string,
* replicaSet: {
* podsRunning: number,
* podsDesired: number,
* containerImages: !Array<string>
* }
* podsRunning: number,
* podsDesired: number,
* containerImages: !Array<string>
* }}
*/
backendApi
.
Microservice
;
backendApi
.
ReplicaSet
;
src/app/frontend/index.module.js
浏览文件 @
80d8c4f8
...
...
@@ -19,8 +19,8 @@
import
chromeModule
from
'
./chrome/chrome.module
'
;
import
deployModule
from
'
./deploy/deploy.module
'
;
import
indexConfig
from
'
./index.config
'
;
import
replicaSetListModule
from
'
./replicasetlist/replicasetlist.module
'
;
import
routeConfig
from
'
./index.route
'
;
import
microserviceListModule
from
'
./microservicelist/microservicelist.module
'
;
import
zerostateModule
from
'
./zerostate/zerostate.module
'
;
...
...
@@ -36,7 +36,7 @@ export default angular.module(
'
ui.router
'
,
chromeModule
.
name
,
deployModule
.
name
,
microservice
ListModule
.
name
,
replicaSet
ListModule
.
name
,
zerostateModule
.
name
,
])
.
config
(
indexConfig
)
...
...
src/app/frontend/
microservicelist/microservice
list.controller.js
→
src/app/frontend/
replicasetlist/replicaset
list.controller.js
浏览文件 @
80d8c4f8
...
...
@@ -14,19 +14,19 @@
/**
* Controller for the
service
list view.
* Controller for the
replica set
list view.
*
* @final
*/
export
default
class
Microservice
ListController
{
export
default
class
ReplicaSet
ListController
{
/**
* @param {!angular.$log} $log
* @param {!angular.$resource} $resource
* @ngInject
*/
constructor
(
$log
,
$resource
)
{
/** @export {!Array<backendApi.
Microservice
>} */
this
.
microservice
s
=
[];
/** @export {!Array<backendApi.
ReplicaSet
>} */
this
.
replicaSet
s
=
[];
this
.
initialize_
(
$log
,
$resource
);
}
...
...
@@ -37,14 +37,14 @@ export default class MicroserviceListController {
* @private
*/
initialize_
(
$log
,
$resource
)
{
/** @type {!angular.Resource<!backendApi.
Microservice
List>} */
let
resource
=
$resource
(
'
/api/
microservice
'
);
/** @type {!angular.Resource<!backendApi.
ReplicaSet
List>} */
let
resource
=
$resource
(
'
/api/
replicaset
'
);
resource
.
get
((
microservice
List
)
=>
{
$log
.
info
(
'
Successfully fetched
microservice list:
'
,
microservice
List
);
this
.
microservices
=
microserviceList
.
microservice
s
;
resource
.
get
((
replicaSet
List
)
=>
{
$log
.
info
(
'
Successfully fetched
Replica Set list:
'
,
replicaSet
List
);
this
.
replicaSets
=
replicaSetList
.
replicaSet
s
;
},
(
err
)
=>
{
$log
.
error
(
'
Error fetching
microservice
list:
'
,
err
);
$log
.
error
(
'
Error fetching
Replica Set
list:
'
,
err
);
});
}
}
src/app/frontend/
microservicelist/microservice
list.html
→
src/app/frontend/
replicasetlist/replicaset
list.html
浏览文件 @
80d8c4f8
...
...
@@ -15,16 +15,16 @@ limitations under the License.
-->
<div
layout=
"row"
layout-wrap
layout-margin
layout-align=
"center center"
>
<md-card
ng-repeat=
"
microservice in ctrl.microservice
s"
>
<md-card-content
class=
"kd-
microservice
-card"
>
<md-card
ng-repeat=
"
replicaSet in ctrl.replicaSet
s"
>
<md-card-content
class=
"kd-
replicaset
-card"
>
<div
layout=
"row"
layout-align=
"space-between center"
>
<span
flex
>
{{
microservice
.name}}
</span>
<md-button
flex
class=
"md-icon-button kd-
microservice
-card-menu"
>
<span
flex
>
{{
replicaSet
.name}}
</span>
<md-button
flex
class=
"md-icon-button kd-
replicaset
-card-menu"
>
<md-icon
md-font-library=
"material-icons"
>
more_vert
</md-icon>
</md-button>
</div>
<div
class=
"md-caption"
>
<span>
{{
microservice.
replicaSet.podsRunning}} pods running
</span>
<span>
{{replicaSet.podsRunning}} pods running
</span>
</div>
</md-card-content>
</md-card
>
...
...
src/app/frontend/
microservicelist/microservice
list.module.js
→
src/app/frontend/
replicasetlist/replicaset
list.module.js
浏览文件 @
80d8c4f8
...
...
@@ -12,16 +12,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import
stateConfig
from
'
./
microservice
list.state
'
;
import
stateConfig
from
'
./
replicaset
list.state
'
;
/**
* Angular module for the
microservice
list view.
* Angular module for the
Replica Set
list view.
*
* The view shows
microservice
s running in the cluster and allows to manage them.
* The view shows
Replica Set
s running in the cluster and allows to manage them.
*/
export
default
angular
.
module
(
'
kubernetesDashboard.
microservice
List
'
,
'
kubernetesDashboard.
replicaSet
List
'
,
[
'
ngMaterial
'
,
'
ui.router
'
,
...
...
src/app/frontend/
microservicelist/microservice
list.scss
→
src/app/frontend/
replicasetlist/replicaset
list.scss
浏览文件 @
80d8c4f8
// Copyright 2015 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// 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.
.kd-microservice-card
{
padding-top
:
0
;
width
:
400px
;
// Copyright 2015 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// 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.
.kd-replicaset-card
{
padding-top
:
0
;
width
:
400px
;
}
.kd-replicaset-card-menu
{
max-width
:
48px
;
}
.kd-microservice-card-menu
{
max-width
:
48px
;
}
src/app/frontend/
microservicelist/microservice
list.state.js
→
src/app/frontend/
replicasetlist/replicaset
list.state.js
浏览文件 @
80d8c4f8
...
...
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
import
MicroserviceListController
from
'
./microservice
list.controller
'
;
import
ReplicaSetListController
from
'
./replicaset
list.controller
'
;
/**
...
...
@@ -22,10 +22,10 @@ import MicroserviceListController from './microservicelist.controller';
* @ngInject
*/
export
default
function
stateConfig
(
$stateProvider
)
{
$stateProvider
.
state
(
'
microservice
list
'
,
{
controller
:
Microservice
ListController
,
$stateProvider
.
state
(
'
replicaset
list
'
,
{
controller
:
ReplicaSet
ListController
,
controllerAs
:
'
ctrl
'
,
url
:
'
/
microservice
list
'
,
templateUrl
:
'
microservicelist/microservice
list.html
'
,
url
:
'
/
replicaset
list
'
,
templateUrl
:
'
replicasetlist/replicaset
list.html
'
,
});
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录