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 {
...
@@ -37,14 +37,14 @@ func CreateHttpApiHandler(client *client.Client) http.Handler {
Writes
(
AppDeployment
{}))
Writes
(
AppDeployment
{}))
wsContainer
.
Add
(
deployWs
)
wsContainer
.
Add
(
deployWs
)
microservice
ListWs
:=
new
(
restful
.
WebService
)
replicaSet
ListWs
:=
new
(
restful
.
WebService
)
microserviceListWs
.
Path
(
"/api/microservice
"
)
.
replicaSetListWs
.
Path
(
"/api/replicaset
"
)
.
Produces
(
restful
.
MIME_JSON
)
Produces
(
restful
.
MIME_JSON
)
microservice
ListWs
.
Route
(
replicaSet
ListWs
.
Route
(
microservice
ListWs
.
GET
(
""
)
.
replicaSet
ListWs
.
GET
(
""
)
.
To
(
apiHandler
.
handleGet
Microservice
List
)
.
To
(
apiHandler
.
handleGet
ReplicaSet
List
)
.
Writes
(
Microservice
List
{}))
Writes
(
ReplicaSet
List
{}))
wsContainer
.
Add
(
microservice
ListWs
)
wsContainer
.
Add
(
replicaSet
ListWs
)
return
wsContainer
return
wsContainer
}
}
...
@@ -68,11 +68,11 @@ func (apiHandler *ApiHandler) handleDeploy(request *restful.Request, response *r
...
@@ -68,11 +68,11 @@ func (apiHandler *ApiHandler) handleDeploy(request *restful.Request, response *r
response
.
WriteHeaderAndEntity
(
http
.
StatusCreated
,
cfg
)
response
.
WriteHeaderAndEntity
(
http
.
StatusCreated
,
cfg
)
}
}
// Handles get
microservice
list API call.
// Handles get
Replica Set
list API call.
func
(
apiHandler
*
ApiHandler
)
handleGet
Microservice
List
(
func
(
apiHandler
*
ApiHandler
)
handleGet
ReplicaSet
List
(
request
*
restful
.
Request
,
response
*
restful
.
Response
)
{
request
*
restful
.
Request
,
response
*
restful
.
Response
)
{
result
,
err
:=
Get
Microservice
List
(
apiHandler
.
client
)
result
,
err
:=
Get
ReplicaSet
List
(
apiHandler
.
client
)
if
err
!=
nil
{
if
err
!=
nil
{
handleInternalError
(
response
,
err
)
handleInternalError
(
response
,
err
)
return
return
...
...
src/app/backend/
microservice
list.go
→
src/app/backend/
replicaset
list.go
浏览文件 @
80d8c4f8
...
@@ -21,25 +21,18 @@ import (
...
@@ -21,25 +21,18 @@ import (
"k8s.io/kubernetes/pkg/labels"
"k8s.io/kubernetes/pkg/labels"
)
)
// List of
microservice
s in the cluster.
// List of
Replica Set
s in the cluster.
type
Microservice
List
struct
{
type
ReplicaSet
List
struct
{
// Unordered list of
microservice
s.
// Unordered list of
Replica Set
s.
Microservices
[]
Microservice
`json:"microservice
s"`
ReplicaSets
[]
ReplicaSet
`json:"replicaSet
s"`
}
}
// Microservice is a Kubernetes replica set plus zero or more Kubernetes services.
// Kubernetes Replica Set (aka. Replication Controller) plus zero or more Kubernetes services that
type
Microservice
struct
{
// target the Replica Set.
// Name of the microservice, derived from the replica set.
type
ReplicaSet
struct
{
// Name of the Replica Set.
Name
string
`json:"name"`
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.
// Number of pods that are currently running.
PodsRunning
int
`json:"podsRunning"`
PodsRunning
int
`json:"podsRunning"`
...
@@ -48,10 +41,12 @@ type ReplicaSet struct {
...
@@ -48,10 +41,12 @@ type ReplicaSet struct {
// Container images of the replica set.
// Container images of the replica set.
ContainerImages
[]
string
`json:"containerImages"`
ContainerImages
[]
string
`json:"containerImages"`
// TODO(bryk): Add service information here.
}
}
// Returns a list of all
microservice
s in the cluster.
// Returns a list of all
Replica Set
s in the cluster.
func
Get
MicroserviceList
(
client
*
client
.
Client
)
(
*
Microservice
List
,
error
)
{
func
Get
ReplicaSetList
(
client
*
client
.
Client
)
(
*
ReplicaSet
List
,
error
)
{
list
,
err
:=
client
.
ReplicationControllers
(
api
.
NamespaceAll
)
.
list
,
err
:=
client
.
ReplicationControllers
(
api
.
NamespaceAll
)
.
List
(
labels
.
Everything
(),
fields
.
Everything
())
List
(
labels
.
Everything
(),
fields
.
Everything
())
...
@@ -59,24 +54,22 @@ func GetMicroserviceList(client *client.Client) (*MicroserviceList, error) {
...
@@ -59,24 +54,22 @@ func GetMicroserviceList(client *client.Client) (*MicroserviceList, error) {
return
nil
,
err
return
nil
,
err
}
}
microserviceList
:=
&
Microservice
List
{}
replicaSetList
:=
&
ReplicaSet
List
{}
for
_
,
elemen
t
:=
range
list
.
Items
{
for
_
,
replicaSe
t
:=
range
list
.
Items
{
var
containerImages
[]
string
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
)
containerImages
=
append
(
containerImages
,
container
.
Image
)
}
}
microserviceList
.
Microservices
=
append
(
microserviceList
.
Microservices
,
Microservice
{
replicaSetList
.
ReplicaSets
=
append
(
replicaSetList
.
ReplicaSets
,
ReplicaSet
{
Name
:
element
.
ObjectMeta
.
Name
,
Name
:
replicaSet
.
ObjectMeta
.
Name
,
ReplicaSet
:
ReplicaSet
{
ContainerImages
:
containerImages
,
ContainerImages
:
containerImages
,
PodsRunning
:
replicaSet
.
Status
.
Replicas
,
PodsRunning
:
element
.
Status
.
Replicas
,
PodsDesired
:
replicaSet
.
Spec
.
Replicas
,
PodsDesired
:
element
.
Spec
.
Replicas
,
},
})
})
}
}
return
microservice
List
,
nil
return
replicaSet
List
,
nil
}
}
src/app/externs/backendapi.js
浏览文件 @
80d8c4f8
...
@@ -50,20 +50,18 @@ backendApi.AppDeployment;
...
@@ -50,20 +50,18 @@ backendApi.AppDeployment;
/**
/**
* @typedef {{
* @typedef {{
*
microservices: !Array<!backendApi.Microservice
>
*
replicaSets: !Array<!backendApi.ReplicaSet
>
* }}
* }}
*/
*/
backendApi
.
Microservice
List
;
backendApi
.
ReplicaSet
List
;
/**
/**
* @typedef {{
* @typedef {{
* name: string,
* name: string,
* replicaSet: {
* podsRunning: number,
* podsRunning: number,
* podsDesired: number,
* podsDesired: number,
* containerImages: !Array<string>
* containerImages: !Array<string>
* }
* }}
* }}
*/
*/
backendApi
.
Microservice
;
backendApi
.
ReplicaSet
;
src/app/frontend/index.module.js
浏览文件 @
80d8c4f8
...
@@ -19,8 +19,8 @@
...
@@ -19,8 +19,8 @@
import
chromeModule
from
'
./chrome/chrome.module
'
;
import
chromeModule
from
'
./chrome/chrome.module
'
;
import
deployModule
from
'
./deploy/deploy.module
'
;
import
deployModule
from
'
./deploy/deploy.module
'
;
import
indexConfig
from
'
./index.config
'
;
import
indexConfig
from
'
./index.config
'
;
import
replicaSetListModule
from
'
./replicasetlist/replicasetlist.module
'
;
import
routeConfig
from
'
./index.route
'
;
import
routeConfig
from
'
./index.route
'
;
import
microserviceListModule
from
'
./microservicelist/microservicelist.module
'
;
import
zerostateModule
from
'
./zerostate/zerostate.module
'
;
import
zerostateModule
from
'
./zerostate/zerostate.module
'
;
...
@@ -36,7 +36,7 @@ export default angular.module(
...
@@ -36,7 +36,7 @@ export default angular.module(
'
ui.router
'
,
'
ui.router
'
,
chromeModule
.
name
,
chromeModule
.
name
,
deployModule
.
name
,
deployModule
.
name
,
microservice
ListModule
.
name
,
replicaSet
ListModule
.
name
,
zerostateModule
.
name
,
zerostateModule
.
name
,
])
])
.
config
(
indexConfig
)
.
config
(
indexConfig
)
...
...
src/app/frontend/
microservicelist/microservice
list.controller.js
→
src/app/frontend/
replicasetlist/replicaset
list.controller.js
浏览文件 @
80d8c4f8
...
@@ -14,19 +14,19 @@
...
@@ -14,19 +14,19 @@
/**
/**
* Controller for the
service
list view.
* Controller for the
replica set
list view.
*
*
* @final
* @final
*/
*/
export
default
class
Microservice
ListController
{
export
default
class
ReplicaSet
ListController
{
/**
/**
* @param {!angular.$log} $log
* @param {!angular.$log} $log
* @param {!angular.$resource} $resource
* @param {!angular.$resource} $resource
* @ngInject
* @ngInject
*/
*/
constructor
(
$log
,
$resource
)
{
constructor
(
$log
,
$resource
)
{
/** @export {!Array<backendApi.
Microservice
>} */
/** @export {!Array<backendApi.
ReplicaSet
>} */
this
.
microservice
s
=
[];
this
.
replicaSet
s
=
[];
this
.
initialize_
(
$log
,
$resource
);
this
.
initialize_
(
$log
,
$resource
);
}
}
...
@@ -37,14 +37,14 @@ export default class MicroserviceListController {
...
@@ -37,14 +37,14 @@ export default class MicroserviceListController {
* @private
* @private
*/
*/
initialize_
(
$log
,
$resource
)
{
initialize_
(
$log
,
$resource
)
{
/** @type {!angular.Resource<!backendApi.
Microservice
List>} */
/** @type {!angular.Resource<!backendApi.
ReplicaSet
List>} */
let
resource
=
$resource
(
'
/api/
microservice
'
);
let
resource
=
$resource
(
'
/api/
replicaset
'
);
resource
.
get
((
microservice
List
)
=>
{
resource
.
get
((
replicaSet
List
)
=>
{
$log
.
info
(
'
Successfully fetched
microservice list:
'
,
microservice
List
);
$log
.
info
(
'
Successfully fetched
Replica Set list:
'
,
replicaSet
List
);
this
.
microservices
=
microserviceList
.
microservice
s
;
this
.
replicaSets
=
replicaSetList
.
replicaSet
s
;
},
(
err
)
=>
{
},
(
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.
...
@@ -15,16 +15,16 @@ limitations under the License.
-->
-->
<div
layout=
"row"
layout-wrap
layout-margin
layout-align=
"center center"
>
<div
layout=
"row"
layout-wrap
layout-margin
layout-align=
"center center"
>
<md-card
ng-repeat=
"
microservice in ctrl.microservice
s"
>
<md-card
ng-repeat=
"
replicaSet in ctrl.replicaSet
s"
>
<md-card-content
class=
"kd-
microservice
-card"
>
<md-card-content
class=
"kd-
replicaset
-card"
>
<div
layout=
"row"
layout-align=
"space-between center"
>
<div
layout=
"row"
layout-align=
"space-between center"
>
<span
flex
>
{{
microservice
.name}}
</span>
<span
flex
>
{{
replicaSet
.name}}
</span>
<md-button
flex
class=
"md-icon-button kd-
microservice
-card-menu"
>
<md-button
flex
class=
"md-icon-button kd-
replicaset
-card-menu"
>
<md-icon
md-font-library=
"material-icons"
>
more_vert
</md-icon>
<md-icon
md-font-library=
"material-icons"
>
more_vert
</md-icon>
</md-button>
</md-button>
</div>
</div>
<div
class=
"md-caption"
>
<div
class=
"md-caption"
>
<span>
{{
microservice.
replicaSet.podsRunning}} pods running
</span>
<span>
{{replicaSet.podsRunning}} pods running
</span>
</div>
</div>
</md-card-content>
</md-card-content>
</md-card
>
</md-card
>
...
...
src/app/frontend/
microservicelist/microservice
list.module.js
→
src/app/frontend/
replicasetlist/replicaset
list.module.js
浏览文件 @
80d8c4f8
...
@@ -12,16 +12,16 @@
...
@@ -12,16 +12,16 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// 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
(
export
default
angular
.
module
(
'
kubernetesDashboard.
microservice
List
'
,
'
kubernetesDashboard.
replicaSet
List
'
,
[
[
'
ngMaterial
'
,
'
ngMaterial
'
,
'
ui.router
'
,
'
ui.router
'
,
...
...
src/app/frontend/
microservicelist/microservice
list.scss
→
src/app/frontend/
replicasetlist/replicaset
list.scss
浏览文件 @
80d8c4f8
// Copyright 2015 Google Inc. All Rights Reserved.
// Copyright 2015 Google Inc. All Rights Reserved.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// limitations under the License.
.kd-microservice-card
{
.kd-replicaset-card
{
padding-top
:
0
;
padding-top
:
0
;
width
:
400px
;
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 @@
...
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// See the License for the specific language governing permissions and
// limitations under the License.
// 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';
...
@@ -22,10 +22,10 @@ import MicroserviceListController from './microservicelist.controller';
* @ngInject
* @ngInject
*/
*/
export
default
function
stateConfig
(
$stateProvider
)
{
export
default
function
stateConfig
(
$stateProvider
)
{
$stateProvider
.
state
(
'
microservice
list
'
,
{
$stateProvider
.
state
(
'
replicaset
list
'
,
{
controller
:
Microservice
ListController
,
controller
:
ReplicaSet
ListController
,
controllerAs
:
'
ctrl
'
,
controllerAs
:
'
ctrl
'
,
url
:
'
/
microservice
list
'
,
url
:
'
/
replicaset
list
'
,
templateUrl
:
'
microservicelist/microservice
list.html
'
,
templateUrl
:
'
replicasetlist/replicaset
list.html
'
,
});
});
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录