Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
凌波微步_大先生
dashboard
提交
65326716
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,发现更多精彩内容 >>
提交
65326716
编写于
12月 29, 2015
作者:
P
Piotr Bryk
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #206 from bryk/deploy-active
Handle name and container image validation in deploy form
上级
7409de52
4f6ad581
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
30 addition
and
19 deletion
+30
-19
src/app/frontend/deploy/deploy.html
src/app/frontend/deploy/deploy.html
+7
-3
src/app/frontend/deploy/deploy_controller.js
src/app/frontend/deploy/deploy_controller.js
+5
-5
src/app/frontend/deploy/deployfromsettings.html
src/app/frontend/deploy/deployfromsettings.html
+4
-1
src/app/frontend/deploy/deployfromsettings_controller.js
src/app/frontend/deploy/deployfromsettings_controller.js
+6
-0
src/app/frontend/deploy/deployfromsettings_directive.js
src/app/frontend/deploy/deployfromsettings_directive.js
+1
-0
src/test/frontend/deploy/deploy_controller_test.js
src/test/frontend/deploy/deploy_controller_test.js
+7
-10
未找到文件。
src/app/frontend/deploy/deploy.html
浏览文件 @
65326716
...
...
@@ -17,12 +17,15 @@ limitations under the License.
<div
layout=
"column"
layout-padding
layout-align=
"center center"
>
<md-whiteframe
class=
"kd-deploy-whiteframe md-whiteframe-5dp"
flex
flex-gt-md
>
<h3
class=
"md-headline"
>
Deploy a Containerized App
</h3>
<form
name=
"ctrl.deployForm"
ng-submit=
"ctrl.deployBySelection()"
>
<form
name=
"ctrl.deployForm"
ng-submit=
"ctrl.deployBySelection()"
novalidate
>
<kd-help-section>
<md-input-container
class=
"md-block"
ng-model-options=
"{ updateOn: 'blur' }"
>
<label>
App name
</label>
<input
ng-model=
"ctrl.name"
required
>
<input
ng-model=
"ctrl.name"
required
name=
"name"
>
<ng-messages
for=
"ctrl.deployForm.name.$error"
role=
"alert"
multiple
>
<ng-message
when=
"required"
>
Application name is required.
</ng-message>
</ng-messages>
</md-input-container>
<kd-user-help>
An 'app' label with this value will be added to the Replica Set and Service that get deployed.
...
...
@@ -41,7 +44,8 @@ limitations under the License.
</kd-help-section>
<div
ng-switch=
"ctrl.selection"
>
<deploy-from-settings
ng-switch-when=
"Settings"
name=
"ctrl.name"
namespaces=
"ctrl.namespaces"
detail=
"ctrl.detail"
>
<deploy-from-settings
ng-switch-when=
"Settings"
name=
"ctrl.name"
namespaces=
"ctrl.namespaces"
detail=
"ctrl.detail"
form=
"ctrl.deployForm"
>
</deploy-from-settings>
<deploy-from-file
ng-switch-when=
"File"
name=
"ctrl.name"
detail=
"ctrl.detail"
>
</deploy-from-file>
...
...
src/app/frontend/deploy/deploy_controller.js
浏览文件 @
65326716
...
...
@@ -75,8 +75,10 @@ export default class DeployController {
* @export
*/
deployBySelection
()
{
this
.
isDeployInProgress_
=
true
;
this
.
detail
.
deploy
().
finally
(()
=>
{
this
.
isDeployInProgress_
=
false
;
});
if
(
this
.
deployForm
.
$valid
)
{
this
.
isDeployInProgress_
=
true
;
this
.
detail
.
deploy
().
finally
(()
=>
{
this
.
isDeployInProgress_
=
false
;
});
}
}
/**
...
...
@@ -84,9 +86,7 @@ export default class DeployController {
* @return {boolean}
* @export
*/
isDeployDisabled
()
{
return
this
.
isDeployInProgress_
||
this
.
deployForm
.
$invalid
||
!
this
.
detail
;
}
isDeployDisabled
()
{
return
this
.
isDeployInProgress_
||
!
this
.
detail
;
}
/**
* Cancels the deployment form.
...
...
src/app/frontend/deploy/deployfromsettings.html
浏览文件 @
65326716
...
...
@@ -17,7 +17,10 @@ limitations under the License.
<kd-help-section>
<md-input-container
class=
"md-block"
>
<label>
Container image
</label>
<input
ng-model=
"ctrl.containerImage"
required
>
<input
ng-model=
"ctrl.containerImage"
name=
"containerImage"
required
>
<ng-messages
for=
"ctrl.form.containerImage.$error"
role=
"alert"
multiple
>
<ng-message
when=
"required"
>
Container image is required.
</ng-message>
</ng-messages>
</md-input-container>
<kd-user-help>
Enter the URL of a public image on any registry, or a private image hosted on Docker Hub or Google Container Registry.
...
...
src/app/frontend/deploy/deployfromsettings_controller.js
浏览文件 @
65326716
...
...
@@ -42,6 +42,12 @@ export default class DeployFromSettingsController {
*/
this
.
detail
=
this
;
/**
* Initialized from the scope.
* @export {!angular.FormController}
*/
this
.
form
;
/** @private {boolean} */
this
.
showMoreOptions_
=
false
;
...
...
src/app/frontend/deploy/deployfromsettings_directive.js
浏览文件 @
65326716
...
...
@@ -25,6 +25,7 @@ export default function deployFromSettingsDirective() {
'
name
'
:
'
=
'
,
'
namespaces
'
:
'
=
'
,
'
detail
'
:
'
=
'
,
'
form
'
:
'
=
'
,
},
controller
:
DeployFromSettingsController
,
controllerAs
:
'
ctrl
'
,
...
...
src/test/frontend/deploy/deploy_controller_test.js
浏览文件 @
65326716
...
...
@@ -28,16 +28,13 @@ describe('Deploy controller', () => {
beforeEach
(()
=>
{
angular
.
mock
.
module
(
deployModule
.
name
);
angular
.
mock
.
inject
((
$controller
,
$state
)
=>
{
angular
.
mock
.
inject
((
$controller
,
$state
,
$q
)
=>
{
state
=
$state
;
ctrl
=
$controller
(
DeployController
,
{
namespaces
:
[]});
settingsCtrl
=
$controller
(
DeployFromSettingController
,
{},
{
namespaces
:
[]});
settingsCtrl
=
$controller
(
DeployFromSettingController
,
{},
{
namespaces
:
[],
deploy
:
()
=>
$q
.
defer
().
promise
});
ctrl
=
$controller
(
DeployController
,
{
namespaces
:
[]},
{
detail
:
settingsCtrl
,
deployForm
:
{
$valid
:
true
}});
});
// prepare and mock
ctrl
.
detail
=
settingsCtrl
;
ctrl
.
deployForm
=
{
$invalid
:
false
};
settingsCtrl
.
deploy
=
()
=>
{
return
settingsCtrl
.
q_
.
defer
().
promise
;
};
});
it
(
'
should return true when deploy in progress
'
,
()
=>
{
...
...
@@ -46,7 +43,7 @@ describe('Deploy controller', () => {
let
result
=
ctrl
.
isDeployDisabled
();
// then
expect
(
result
).
toBe
Truthy
(
);
expect
(
result
).
toBe
(
true
);
});
it
(
'
should return false when deploy not in progress
'
,
()
=>
{
...
...
@@ -54,7 +51,7 @@ describe('Deploy controller', () => {
let
result
=
ctrl
.
isDeployDisabled
();
// then
expect
(
result
).
toBe
Falsy
(
);
expect
(
result
).
toBe
(
false
);
});
it
(
'
should change state to replica set list view on cancel
'
,
()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录