Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
凌波微步_大先生
dashboard
提交
86f26581
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,发现更多精彩内容 >>
提交
86f26581
编写于
5月 24, 2016
作者:
P
Piotr Bryk
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #759 from Draiken/deployment-detail-frontend
Deployment details frontend
上级
cf3ed3e6
c415bd3e
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
253 addition
and
5 deletion
+253
-5
src/app/externs/backendapi.js
src/app/externs/backendapi.js
+34
-0
src/app/frontend/deploymentdetail/deploymentdetail.html
src/app/frontend/deploymentdetail/deploymentdetail.html
+12
-0
src/app/frontend/deploymentdetail/deploymentdetail_controller.js
.../frontend/deploymentdetail/deploymentdetail_controller.js
+14
-0
src/app/frontend/deploymentdetail/deploymentdetail_module.js
src/app/frontend/deploymentdetail/deploymentdetail_module.js
+4
-2
src/app/frontend/deploymentdetail/deploymentdetail_state.js
src/app/frontend/deploymentdetail/deploymentdetail_state.js
+3
-0
src/app/frontend/deploymentdetail/deploymentdetail_stateconfig.js
...frontend/deploymentdetail/deploymentdetail_stateconfig.js
+44
-3
src/app/frontend/deploymentdetail/deploymentinfo.html
src/app/frontend/deploymentdetail/deploymentinfo.html
+52
-0
src/app/frontend/deploymentdetail/deploymentinfo_component.js
...app/frontend/deploymentdetail/deploymentinfo_component.js
+36
-0
src/test/frontend/deploymentdetail/deploymentdetail_controller_test.js
...tend/deploymentdetail/deploymentdetail_controller_test.js
+16
-0
src/test/frontend/deploymentdetail/deploymentinfo_component_test.js
...rontend/deploymentdetail/deploymentinfo_component_test.js
+38
-0
未找到文件。
src/app/externs/backendapi.js
浏览文件 @
86f26581
...
@@ -213,6 +213,40 @@ backendApi.Deployment;
...
@@ -213,6 +213,40 @@ backendApi.Deployment;
*/
*/
backendApi
.
DeploymentList
;
backendApi
.
DeploymentList
;
/**
* @typedef {{
* maxSurge: !number,
* maxUnavailabe: !number,
* }}
*/
backendApi
.
RollingUpdateStrategy
;
/**
* @typedef {{
* replicas: !number,
* updated: !number,
* available: !number,
* unavailable: !number,
* }}
*/
backendApi
.
DeploymentInfo
;
/**
* @typedef {{
* objectMeta: !backendApi.ObjectMeta,
* typeMeta: !backendApi.TypeMeta,
* selector: !Array<backendApi.Label>,
* status: !backendApi.DeploymentInfo,
* strategy: !string,
* minReadySeconds: !number,
* rollingUpdateStrategy: !backendApi.RollingUpdateStrategy,
* oldReplicaSetList: !backendApi.ReplicaSetList,
* newReplicaSet: !backendApi.ReplicaSet,
* events: !backendApi.EventList,
* }}
*/
backendApi
.
DeploymentDetail
;
/**
/**
* @typedef {{
* @typedef {{
* pods: !Array<!backendApi.Pod>
* pods: !Array<!backendApi.Pod>
...
...
src/app/frontend/deploymentdetail/deploymentdetail.html
0 → 100644
浏览文件 @
86f26581
<div
layout=
"column"
>
<md-content>
<md-tabs
md-border-bottom
md-dynamic-height
>
<md-tab
label=
"Overview"
>
<kd-deployment-info
deployment=
"::ctrl.deploymentDetail"
></kd-deployment-info>
</md-tab>
<md-tab
label=
"Events"
>
<kd-event-card-list
events=
"::ctrl.deploymentDetail.eventList.events"
></kd-event-card-list>
</md-tab>
</md-tabs>
</md-content>
</div>
src/app/frontend/deploymentdetail/deploymentdetail_controller.js
0 → 100644
浏览文件 @
86f26581
/**
* @final
*/
export
class
DeploymentDetailController
{
/**
* @param {!backendApi.DeploymentDetail} deploymentDetail
* @ngInject
*/
constructor
(
deploymentDetail
)
{
/** @export {!backendApi.DeploymentDetail} */
this
.
deploymentDetail
=
deploymentDetail
;
}
}
src/app/frontend/deploymentdetail/deploymentdetail_module.js
浏览文件 @
86f26581
...
@@ -12,9 +12,10 @@
...
@@ -12,9 +12,10 @@
// 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
'
./deploymentdetail_stateconfig
'
;
import
filtersModule
from
'
common/filters/filters_module
'
;
import
filtersModule
from
'
common/filters/filters_module
'
;
import
componentsModule
from
'
common/components/components_module
'
;
import
componentsModule
from
'
common/components/components_module
'
;
import
stateConfig
from
'
./deploymentdetail_stateconfig
'
;
import
{
deploymentInfoComponent
}
from
'
./deploymentinfo_component
'
;
/**
/**
* Angular module for the Deployment details view.
* Angular module for the Deployment details view.
...
@@ -31,4 +32,5 @@ export default angular
...
@@ -31,4 +32,5 @@ export default angular
componentsModule
.
name
,
componentsModule
.
name
,
filtersModule
.
name
,
filtersModule
.
name
,
])
])
.
config
(
stateConfig
);
.
config
(
stateConfig
)
.
component
(
'
kdDeploymentInfo
'
,
deploymentInfoComponent
);
src/app/frontend/deploymentdetail/deploymentdetail_state.js
浏览文件 @
86f26581
...
@@ -15,6 +15,9 @@
...
@@ -15,6 +15,9 @@
/** Name of the state. Can be used in, e.g., $state.go method. */
/** Name of the state. Can be used in, e.g., $state.go method. */
export
const
stateName
=
'
deploymentdetail
'
;
export
const
stateName
=
'
deploymentdetail
'
;
/** Absolute URL of the state. */
export
const
stateUrl
=
'
/deployment/:namespace/:deployment
'
;
/**
/**
* Parameters for this state.
* Parameters for this state.
*
*
...
...
src/app/frontend/deploymentdetail/deploymentdetail_stateconfig.js
浏览文件 @
86f26581
...
@@ -12,16 +12,57 @@
...
@@ -12,16 +12,57 @@
// 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
{
stateName
}
from
'
./deploymentdetail_state
'
;
import
{
actionbarViewName
}
from
'
chrome/chrome_state
'
;
import
{
breadcrumbsConfig
}
from
'
common/components/breadcrumbs/breadcrumbs_service
'
;
import
{
DeploymentDetailController
}
from
'
./deploymentdetail_controller
'
;
import
{
stateName
as
deploymentList
}
from
'
deploymentlist/deploymentlist_state
'
;
import
{
stateName
,
stateUrl
}
from
'
./deploymentdetail_state
'
;
/**
/**
* Configures states for the
replica set details
view.
* Configures states for the
deployment detail
view.
*
*
* @param {!ui.router.$stateProvider} $stateProvider
* @param {!ui.router.$stateProvider} $stateProvider
* @ngInject
* @ngInject
*/
*/
export
default
function
stateConfig
(
$stateProvider
)
{
export
default
function
stateConfig
(
$stateProvider
)
{
$stateProvider
.
state
(
stateName
,
{
$stateProvider
.
state
(
stateName
,
{
url
:
'
/deployment/:namespace/:deployment
'
,
url
:
stateUrl
,
resolve
:
{
'
deploymentDetailResource
'
:
getDeploymentDetailResource
,
'
deploymentDetail
'
:
getDeploymentDetail
,
},
data
:
{
[
breadcrumbsConfig
]:
{
'
label
'
:
'
{{$stateParams.deployment}}
'
,
'
parent
'
:
deploymentList
,
},
},
views
:
{
''
:
{
controller
:
DeploymentDetailController
,
controllerAs
:
'
ctrl
'
,
templateUrl
:
'
deploymentdetail/deploymentdetail.html
'
,
},
[
actionbarViewName
]:
{},
},
});
});
}
}
/**
* @param {!./deploymentdetail_state.StateParams} $stateParams
* @param {!angular.$resource} $resource
* @return {!angular.Resource<!backendApi.DeploymentDetail>}
* @ngInject
*/
export
function
getDeploymentDetailResource
(
$resource
,
$stateParams
)
{
return
$resource
(
`api/v1/deployment/
${
$stateParams
.
namespace
}
/
${
$stateParams
.
deployment
}
`
);
}
/**
* @param {!angular.Resource<!backendApi.DeploymentDetail>} deploymentDetailResource
* @return {!angular.$q.Promise}
* @ngInject
*/
export
function
getDeploymentDetail
(
deploymentDetailResource
)
{
return
deploymentDetailResource
.
get
().
$promise
;
}
src/app/frontend/deploymentdetail/deploymentinfo.html
0 → 100644
浏览文件 @
86f26581
<kd-info-card>
<kd-info-card-header>
Resource details
</kd-info-card-header>
<kd-info-card-section
name=
"Details"
>
<kd-info-card-entry
title=
"Name"
>
<kd-middle-ellipsis
display-string=
"{{::$ctrl.deployment.objectMeta.name}}"
>
</kd-middle-ellipsis>
</kd-info-card-entry>
<kd-info-card-entry
title=
"Namespace"
>
{{::$ctrl.deployment.objectMeta.namespace}}
</kd-info-card-entry>
<kd-info-card-entry
title=
"Labels"
>
<kd-labels
labels=
"::$ctrl.deployment.objectMeta.labels"
></kd-labels>
</kd-info-card-entry>
<kd-info-card-entry
title=
"Selector"
>
<kd-labels
labels=
"::$ctrl.deployment.selector"
></kd-labels>
</kd-info-card-entry>
<kd-info-card-entry
title=
"Strategy"
>
{{::$ctrl.deployment.strategy}}
</kd-info-card-entry>
<kd-info-card-entry
title=
"Min Ready Seconds"
>
{{::$ctrl.deployment.minReadySeconds}}
</kd-info-card-entry>
<kd-info-card-entry
title=
"Rolling Update Strategy"
ng-if=
"$ctrl.rollingUpdateStrategy()"
>
Max Surge: {{::$ctrl.deployment.rollingUpdateStrategy.maxSurge}}
Max Unavailable: {{::$ctrl.deployment.rollingUpdateStrategy.maxUnavailable}}
</kd-info-card-entry>
</kd-info-card-section>
<kd-info-card-section>
<kd-info-card-entry
title=
"Status"
>
{{::$ctrl.deployment.statusInfo.updated}} updated,
{{::$ctrl.deployment.statusInfo.replicas}} total,
{{::$ctrl.deployment.statusInfo.available}} available,
{{::$ctrl.deployment.statusInfo.unavailable}} unavailable
</kd-info-card-entry>
<kd-info-card-entry
title=
"New Replica Set"
>
<kd-middle-ellipsis
display-string=
"{{$ctrl.deployment.newReplicaSet.objectMeta.name}}"
>
</kd-middle-ellipsis>
</kd-info-card-entry>
<kd-info-card-entry
title=
"Old Replica Sets"
>
<div
ng-repeat=
"rs in $ctrl.deployment.oldReplicaSets.replicaSets"
>
{{rs.objectMeta.name}}
</div>
<div
ng-if=
"!$ctrl.deployment.oldReplicaSets.replicaSets.length"
>
None
</div>
</kd-info-card-entry>
</kd-info-card-section>
</kd-info-card>
src/app/frontend/deploymentdetail/deploymentinfo_component.js
0 → 100644
浏览文件 @
86f26581
/**
* @final
*/
export
default
class
DeploymentInfoController
{
/**
* Constructs replication controller info object.
*/
constructor
()
{
/**
* Deployment details. Initialized from the scope.
* @export {!backendApi.DeploymentDetail}
*/
this
.
deployment
;
}
/**
* Returns true if the deployment strategy is RollingUpdate
* @return {boolean}
* @export
*/
rollingUpdateStrategy
()
{
return
this
.
deployment
.
strategy
===
'
RollingUpdate
'
;
}
}
/**
* Definition object for the component that displays replica set info.
*
* @return {!angular.Directive}
*/
export
const
deploymentInfoComponent
=
{
controller
:
DeploymentInfoController
,
templateUrl
:
'
deploymentdetail/deploymentinfo.html
'
,
bindings
:
{
/** {!backendApi.DeploymentDetail} */
'
deployment
'
:
'
=
'
,
},
};
src/test/frontend/deploymentdetail/deploymentdetail_controller_test.js
0 → 100644
浏览文件 @
86f26581
import
{
DeploymentDetailController
}
from
'
deploymentdetail/deploymentdetail_controller
'
;
import
deploymentDetailModule
from
'
deploymentdetail/deploymentdetail_module
'
;
describe
(
'
Deployment Detail controller
'
,
()
=>
{
beforeEach
(()
=>
{
angular
.
mock
.
module
(
deploymentDetailModule
.
name
);
});
it
(
'
should initialize deployment detail
'
,
angular
.
mock
.
inject
((
$controller
)
=>
{
let
data
=
{};
/** @type {!DeploymentDetailController} */
let
ctrl
=
$controller
(
DeploymentDetailController
,
{
deploymentDetail
:
data
});
expect
(
ctrl
.
deploymentDetail
).
toBe
(
data
);
}));
});
src/test/frontend/deploymentdetail/deploymentinfo_component_test.js
0 → 100644
浏览文件 @
86f26581
import
deploymentDetailModule
from
'
deploymentdetail/deploymentdetail_module
'
;
describe
(
'
Deployment Info controller
'
,
()
=>
{
/**
* Deployment Info controller.
* @type {!DeploymentInfoController}
*/
let
ctrl
;
beforeEach
(()
=>
{
angular
.
mock
.
module
(
deploymentDetailModule
.
name
);
angular
.
mock
.
inject
(
(
$componentController
)
=>
{
ctrl
=
$componentController
(
'
kdDeploymentInfo
'
,
{});
});
});
describe
(
'
#rollingUpdateStrategy
'
,
()
=>
{
it
(
'
returns true when strategy is rolling update
'
,
()
=>
{
// given
ctrl
.
deployment
=
{
strategy
:
'
RollingUpdate
'
,
};
// then
expect
(
ctrl
.
rollingUpdateStrategy
()).
toBeTruthy
();
});
it
(
'
returns true when strategy is rolling update
'
,
()
=>
{
// given
ctrl
.
deployment
=
{
strategy
:
'
Recreate
'
,
};
// then
expect
(
ctrl
.
rollingUpdateStrategy
()).
toBeFalsy
();
});
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录