Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
6698804e
Commit
6698804e
authored
Apr 26, 2016
by
lepdou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add miss envs
parent
536eb044
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
173 additions
and
41 deletions
+173
-41
API.java
...portal/src/main/java/com/ctrip/apollo/portal/api/API.java
+0
-1
AppController.java
...ava/com/ctrip/apollo/portal/controller/AppController.java
+9
-4
AppInfoVO.java
...c/main/java/com/ctrip/apollo/portal/entity/AppInfoVO.java
+31
-0
AppService.java
...main/java/com/ctrip/apollo/portal/service/AppService.java
+23
-4
close.png
apollo-portal/src/main/resources/static/img/close.png
+0
-0
info.png
apollo-portal/src/main/resources/static/img/info.png
+0
-0
open.png
apollo-portal/src/main/resources/static/img/open.png
+0
-0
plus.png
apollo-portal/src/main/resources/static/img/plus.png
+0
-0
index.html
apollo-portal/src/main/resources/static/index.html
+1
-0
AppUtils.js
apollo-portal/src/main/resources/static/scripts/AppUtils.js
+12
-0
app.js
apollo-portal/src/main/resources/static/scripts/app.js
+6
-3
CreateAppController.js
...esources/static/scripts/controller/CreateAppController.js
+5
-5
IndexController.js
...in/resources/static/scripts/controller/IndexController.js
+4
-4
AppConfigController.js
...rces/static/scripts/controller/app/AppConfigController.js
+53
-14
AppService.js
.../src/main/resources/static/scripts/services/AppService.js
+5
-5
common-style.css
...-portal/src/main/resources/static/styles/common-style.css
+21
-0
app.html
apollo-portal/src/main/resources/static/views/app.html
+0
-0
create-app.html
...lo-portal/src/main/resources/static/views/create-app.html
+3
-1
No files found.
apollo-portal/src/main/java/com/ctrip/apollo/portal/api/API.java
View file @
6698804e
...
@@ -27,5 +27,4 @@ public class API {
...
@@ -27,5 +27,4 @@ public class API {
public
String
getAdminServiceHost
(
Env
env
)
{
public
String
getAdminServiceHost
(
Env
env
)
{
return
serviceLocator
.
getAdminService
(
env
).
getHomepageUrl
();
return
serviceLocator
.
getAdminService
(
env
).
getHomepageUrl
();
}
}
}
}
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/AppController.java
View file @
6698804e
...
@@ -12,6 +12,7 @@ import com.ctrip.apollo.core.dto.AppDTO;
...
@@ -12,6 +12,7 @@ import com.ctrip.apollo.core.dto.AppDTO;
import
com.ctrip.apollo.core.enums.Env
;
import
com.ctrip.apollo.core.enums.Env
;
import
com.ctrip.apollo.core.exception.BadRequestException
;
import
com.ctrip.apollo.core.exception.BadRequestException
;
import
com.ctrip.apollo.core.utils.StringUtils
;
import
com.ctrip.apollo.core.utils.StringUtils
;
import
com.ctrip.apollo.portal.entity.AppInfoVO
;
import
com.ctrip.apollo.portal.entity.ClusterNavTree
;
import
com.ctrip.apollo.portal.entity.ClusterNavTree
;
import
com.ctrip.apollo.portal.service.AppService
;
import
com.ctrip.apollo.portal.service.AppService
;
...
@@ -25,7 +26,7 @@ public class AppController {
...
@@ -25,7 +26,7 @@ public class AppController {
private
AppService
appService
;
private
AppService
appService
;
@RequestMapping
(
"/env/{env}"
)
@RequestMapping
(
"/env
s
/{env}"
)
public
List
<
AppDTO
>
findAllApp
(
@PathVariable
String
env
){
public
List
<
AppDTO
>
findAllApp
(
@PathVariable
String
env
){
if
(
StringUtils
.
isEmpty
(
env
)){
if
(
StringUtils
.
isEmpty
(
env
)){
throw
new
BadRequestException
(
"env can not be empty"
);
throw
new
BadRequestException
(
"env can not be empty"
);
...
@@ -42,17 +43,21 @@ public class AppController {
...
@@ -42,17 +43,21 @@ public class AppController {
return
appService
.
buildClusterNavTree
(
appId
);
return
appService
.
buildClusterNavTree
(
appId
);
}
}
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
POST
,
consumes
=
{
"application/json"
})
@RequestMapping
(
value
=
"
/envs/{env}
"
,
method
=
RequestMethod
.
POST
,
consumes
=
{
"application/json"
})
public
ResponseEntity
<
Void
>
create
(
@RequestBody
AppDTO
app
)
{
public
ResponseEntity
<
Void
>
create
(
@
PathVariable
String
env
,
@
RequestBody
AppDTO
app
)
{
if
(
isInvalidApp
(
app
)){
if
(
isInvalidApp
(
app
)){
throw
new
BadRequestException
(
"request payload contains empty"
);
throw
new
BadRequestException
(
"request payload contains empty"
);
}
}
if
(
"ALL"
.
equals
(
env
)){
appService
.
save
(
app
);
appService
.
save
(
app
);
}
else
{
appService
.
save
(
Env
.
valueOf
(
env
),
app
);
}
return
ResponseEntity
.
ok
().
build
();
return
ResponseEntity
.
ok
().
build
();
}
}
@RequestMapping
(
value
=
"/{appId}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/{appId}"
,
method
=
RequestMethod
.
GET
)
public
App
DT
O
load
(
@PathVariable
String
appId
){
public
App
InfoV
O
load
(
@PathVariable
String
appId
){
if
(
StringUtils
.
isEmpty
(
appId
)){
if
(
StringUtils
.
isEmpty
(
appId
)){
throw
new
BadRequestException
(
"app id can not be empty."
);
throw
new
BadRequestException
(
"app id can not be empty."
);
}
}
...
...
apollo-portal/src/main/java/com/ctrip/apollo/portal/entity/AppInfoVO.java
0 → 100644
View file @
6698804e
package
com
.
ctrip
.
apollo
.
portal
.
entity
;
import
com.ctrip.apollo.core.dto.AppDTO
;
import
com.ctrip.apollo.core.enums.Env
;
import
java.util.List
;
public
class
AppInfoVO
{
private
AppDTO
app
;
/**
* 在创建app的时候可能在某些环境下创建失败
*/
private
List
<
Env
>
missEnvs
;
public
AppDTO
getApp
()
{
return
app
;
}
public
void
setApp
(
AppDTO
app
)
{
this
.
app
=
app
;
}
public
List
<
Env
>
getMissEnvs
()
{
return
missEnvs
;
}
public
void
setMissEnvs
(
List
<
Env
>
missEnvs
)
{
this
.
missEnvs
=
missEnvs
;
}
}
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/AppService.java
View file @
6698804e
package
com
.
ctrip
.
apollo
.
portal
.
service
;
package
com
.
ctrip
.
apollo
.
portal
.
service
;
import
java.util.Arrays
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.List
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -17,6 +19,7 @@ import com.ctrip.apollo.core.exception.BadRequestException;
...
@@ -17,6 +19,7 @@ import com.ctrip.apollo.core.exception.BadRequestException;
import
com.ctrip.apollo.core.exception.ServiceException
;
import
com.ctrip.apollo.core.exception.ServiceException
;
import
com.ctrip.apollo.portal.PortalSettings
;
import
com.ctrip.apollo.portal.PortalSettings
;
import
com.ctrip.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.apollo.portal.entity.AppInfoVO
;
import
com.ctrip.apollo.portal.entity.ClusterNavTree
;
import
com.ctrip.apollo.portal.entity.ClusterNavTree
;
@Service
@Service
...
@@ -37,16 +40,19 @@ public class AppService {
...
@@ -37,16 +40,19 @@ public class AppService {
return
appAPI
.
findApps
(
env
);
return
appAPI
.
findApps
(
env
);
}
}
public
App
DT
O
load
(
String
appId
)
{
public
App
InfoV
O
load
(
String
appId
)
{
//轮询环境直到能找到此app的信息
//轮询环境直到能找到此app的信息
AppDTO
app
=
null
;
AppDTO
app
=
null
;
List
<
Env
>
missEnvs
=
new
LinkedList
<>();
for
(
Env
env
:
portalSettings
.
getEnvs
())
{
for
(
Env
env
:
portalSettings
.
getEnvs
())
{
try
{
try
{
app
=
appAPI
.
loadApp
(
env
,
appId
);
app
=
appAPI
.
loadApp
(
env
,
appId
);
break
;
}
catch
(
HttpClientErrorException
e
)
{
}
catch
(
HttpClientErrorException
e
)
{
//not exist maybe because create app fail.
//not exist maybe because create app fail.
if
(
e
.
getStatusCode
()
==
HttpStatus
.
NOT_FOUND
)
{
if
(
e
.
getStatusCode
()
==
HttpStatus
.
NOT_FOUND
)
{
missEnvs
.
add
(
env
);
logger
.
warn
(
"app:{} in {} not exist"
,
appId
,
env
);
logger
.
warn
(
"app:{} in {} not exist"
,
appId
,
env
);
}
else
{
}
else
{
logger
.
error
(
"load app info({}) from env:{} error."
,
appId
,
env
);
logger
.
error
(
"load app info({}) from env:{} error."
,
appId
,
env
);
...
@@ -54,11 +60,15 @@ public class AppService {
...
@@ -54,11 +60,15 @@ public class AppService {
}
}
}
}
}
}
if
(
app
==
null
){
if
(
app
==
null
)
{
throw
new
BadRequestException
(
String
.
format
(
"invalid app id %s"
,
appId
));
throw
new
BadRequestException
(
String
.
format
(
"invalid app id %s"
,
appId
));
}
}
return
app
;
AppInfoVO
appInfo
=
new
AppInfoVO
();
appInfo
.
setApp
(
app
);
appInfo
.
setMissEnvs
(
missEnvs
);
return
appInfo
;
}
}
...
@@ -86,4 +96,13 @@ public class AppService {
...
@@ -86,4 +96,13 @@ public class AppService {
}
}
}
}
public
void
save
(
Env
env
,
AppDTO
app
)
{
try
{
appAPI
.
save
(
env
,
app
);
}
catch
(
HttpStatusCodeException
e
)
{
logger
.
error
(
ExceptionUtils
.
toString
(
e
));
throw
e
;
}
}
}
}
apollo-portal/src/main/resources/static/img/close.png
0 → 100644
View file @
6698804e
2.87 KB
apollo-portal/src/main/resources/static/img/info.png
0 → 100644
View file @
6698804e
5.92 KB
apollo-portal/src/main/resources/static/img/open.png
0 → 100644
View file @
6698804e
2.17 KB
apollo-portal/src/main/resources/static/img/plus.png
0 → 100644
View file @
6698804e
2.46 KB
apollo-portal/src/main/resources/static/index.html
View file @
6698804e
...
@@ -79,6 +79,7 @@
...
@@ -79,6 +79,7 @@
<script
type=
"application/javascript"
src=
"scripts/app.js"
></script>
<script
type=
"application/javascript"
src=
"scripts/app.js"
></script>
<script
type=
"application/javascript"
src=
"scripts/services/AppService.js"
></script>
<script
type=
"application/javascript"
src=
"scripts/services/AppService.js"
></script>
<script
type=
"application/javascript"
src=
"scripts/services/EnvService.js"
></script>
<script
type=
"application/javascript"
src=
"scripts/services/EnvService.js"
></script>
<script
type=
"application/javascript"
src=
"scripts/AppUtils.js"
></script>
<script
type=
"application/javascript"
src=
"scripts/controller/IndexController.js"
></script>
<script
type=
"application/javascript"
src=
"scripts/controller/IndexController.js"
></script>
</body>
</body>
</html>
</html>
apollo-portal/src/main/resources/static/scripts/AppUtils.js
0 → 100644
View file @
6698804e
appUtil
.
service
(
'AppUtil'
,
[
function
()
{
return
{
errorMsg
:
function
(
response
)
{
var
msg
=
"Code:"
+
response
.
status
;
if
(
response
.
data
.
message
!=
null
){
msg
+=
" Msg:"
+
response
.
data
.
message
;
}
return
msg
;
}
}
}]);
apollo-portal/src/main/resources/static/scripts/app.js
View file @
6698804e
/**service module 定义*/
/**service module 定义*/
var
appService
=
angular
.
module
(
'app.service'
,
[
'ngResource'
]);
var
appService
=
angular
.
module
(
'app.service'
,
[
'ngResource'
]);
/**utils*/
var
appUtil
=
angular
.
module
(
'app.util'
,
[]);
/** page module 定义*/
/** page module 定义*/
// 首页
// 首页
var
index_module
=
angular
.
module
(
'index'
,
[
'toastr'
,
'app.service'
,
'angular-loading-bar'
]);
var
index_module
=
angular
.
module
(
'index'
,
[
'toastr'
,
'app.service'
,
'a
pp.util'
,
'a
ngular-loading-bar'
]);
//项目主页
//项目主页
var
application_module
=
angular
.
module
(
'application'
,
[
'app.service'
,
'toastr'
,
'angular-loading-bar'
]);
var
application_module
=
angular
.
module
(
'application'
,
[
'app.service'
,
'
app.util'
,
'
toastr'
,
'angular-loading-bar'
]);
//创建项目页面
//创建项目页面
var
create_app_module
=
angular
.
module
(
'create_app'
,
[
'ngResource'
,
'toastr'
,
'app.service'
,
'angular-loading-bar'
]);
var
create_app_module
=
angular
.
module
(
'create_app'
,
[
'ngResource'
,
'toastr'
,
'app.service'
,
'a
pp.util'
,
'a
ngular-loading-bar'
]);
...
...
apollo-portal/src/main/resources/static/scripts/controller/CreateAppController.js
View file @
6698804e
create_app_module
.
controller
(
'CreateAppController'
,
[
'$scope'
,
'$window'
,
'toastr'
,
'AppService'
,
create_app_module
.
controller
(
'CreateAppController'
,
[
'$scope'
,
'$window'
,
'toastr'
,
'AppService'
,
'AppUtil'
,
function
(
$scope
,
$window
,
toastr
,
AppService
)
{
function
(
$scope
,
$window
,
toastr
,
AppService
,
AppUtil
)
{
$scope
.
sav
e
=
function
()
{
$scope
.
creat
e
=
function
()
{
AppService
.
add
(
$scope
.
app
).
then
(
function
(
result
)
{
AppService
.
create
(
'ALL'
,
$scope
.
app
).
then
(
function
(
result
)
{
toastr
.
success
(
'添加成功!'
);
toastr
.
success
(
'添加成功!'
);
setInterval
(
function
()
{
setInterval
(
function
()
{
$window
.
location
.
href
=
'/views/app.html?#appid='
+
result
.
appId
;
$window
.
location
.
href
=
'/views/app.html?#appid='
+
result
.
appId
;
},
1000
);
},
1000
);
},
function
(
result
)
{
},
function
(
result
)
{
toastr
.
error
(
result
.
status
+
result
.
data
.
message
,
'添加失败!'
);
toastr
.
error
(
AppUtil
.
errorMsg
(
result
)
,
'添加失败!'
);
});
});
};
};
...
...
apollo-portal/src/main/resources/static/scripts/controller/IndexController.js
View file @
6698804e
index_module
.
controller
(
'IndexController'
,
[
'$scope'
,
'$window'
,
'toastr'
,
'AppService'
,
'EnvService'
,
index_module
.
controller
(
'IndexController'
,
[
'$scope'
,
'$window'
,
'toastr'
,
'AppService'
,
'
AppUtil'
,
'
EnvService'
,
function
(
$scope
,
$window
,
toastr
,
AppService
,
EnvService
)
{
function
(
$scope
,
$window
,
toastr
,
AppService
,
AppUtil
,
EnvService
)
{
$scope
.
envs
=
[];
$scope
.
envs
=
[];
$scope
.
selectedEnv
=
''
;
$scope
.
selectedEnv
=
''
;
...
@@ -8,7 +8,7 @@ index_module.controller('IndexController', ['$scope', '$window', 'toastr', 'AppS
...
@@ -8,7 +8,7 @@ index_module.controller('IndexController', ['$scope', '$window', 'toastr', 'AppS
//default select first env
//default select first env
$scope
.
switchEnv
(
$scope
.
envs
[
0
]);
$scope
.
switchEnv
(
$scope
.
envs
[
0
]);
},
function
(
result
)
{
},
function
(
result
)
{
toastr
.
error
(
result
.
status
+
result
.
data
.
message
,
"load env error"
);
toastr
.
error
(
AppUtil
.
errorMsg
(
result
)
,
"load env error"
);
});
});
var
apps
=
[];
var
apps
=
[];
...
@@ -25,7 +25,7 @@ index_module.controller('IndexController', ['$scope', '$window', 'toastr', 'AppS
...
@@ -25,7 +25,7 @@ index_module.controller('IndexController', ['$scope', '$window', 'toastr', 'AppS
$scope
.
appsCount
=
apps
.
length
;
$scope
.
appsCount
=
apps
.
length
;
$scope
.
selectedEnv
=
env
;
$scope
.
selectedEnv
=
env
;
},
function
(
result
)
{
},
function
(
result
)
{
toastr
.
error
(
result
.
status
+
result
.
data
.
message
,
"load apps error"
);
toastr
.
error
(
AppUtil
.
errorMsg
(
result
)
,
"load apps error"
);
});
});
};
};
...
...
apollo-portal/src/main/resources/static/scripts/controller/app/AppConfigController.js
View file @
6698804e
application_module
.
controller
(
"AppConfigController"
,
application_module
.
controller
(
"AppConfigController"
,
[
'$scope'
,
'$location'
,
'toastr'
,
'AppService'
,
'ConfigService'
,
[
'$scope'
,
'$location'
,
'toastr'
,
'AppService'
,
'
AppUtil'
,
'
ConfigService'
,
function
(
$scope
,
$location
,
toastr
,
AppService
,
ConfigService
)
{
function
(
$scope
,
$location
,
toastr
,
AppService
,
AppUtil
,
ConfigService
)
{
var
appId
=
$location
.
$$url
.
split
(
"="
)[
1
];
var
appId
=
$location
.
$$url
.
split
(
"="
)[
1
];
var
currentUser
=
'test_user'
;
var
currentUser
=
'test_user'
;
...
@@ -12,7 +12,7 @@ application_module.controller("AppConfigController",
...
@@ -12,7 +12,7 @@ application_module.controller("AppConfigController",
$scope
.
pageContext
=
pageContext
;
$scope
.
pageContext
=
pageContext
;
//////
/////// load cluster nav tree ///
//////
//////
load cluster nav tree
//////
AppService
.
load_nav_tree
(
$scope
.
pageContext
.
appId
).
then
(
function
(
result
)
{
AppService
.
load_nav_tree
(
$scope
.
pageContext
.
appId
).
then
(
function
(
result
)
{
var
navTree
=
[];
var
navTree
=
[];
...
@@ -58,18 +58,20 @@ application_module.controller("AppConfigController",
...
@@ -58,18 +58,20 @@ application_module.controller("AppConfigController",
}
}
});
});
},
function
(
result
)
{
},
function
(
result
)
{
toastr
.
error
(
result
.
status
+
result
.
data
.
message
,
"加载导航出错"
);
toastr
.
error
(
AppUtil
.
errorMsg
(
result
)
,
"加载导航出错"
);
});
});
//////
///// app info //////
//////
//////
app info
//////
AppService
.
load
(
$scope
.
pageContext
.
appId
).
then
(
function
(
result
)
{
AppService
.
load
(
$scope
.
pageContext
.
appId
).
then
(
function
(
result
)
{
$scope
.
appInfo
=
result
;
$scope
.
appBaseInfo
=
result
.
app
;
$scope
.
missEnvs
=
result
.
missEnvs
;
$scope
.
selectedEnvs
=
angular
.
copy
(
$scope
.
missEnvs
);
},
function
(
result
)
{
},
function
(
result
)
{
toastr
.
error
(
result
.
status
+
result
.
data
.
message
,
"加载App信息出错"
);
toastr
.
error
(
AppUtil
.
errorMsg
(
result
)
,
"加载App信息出错"
);
});
});
//////
///// namespace //////
//////
//////
namespace
//////
var
namespace_view_type
=
{
var
namespace_view_type
=
{
TEXT
:
'text'
,
TEXT
:
'text'
,
...
@@ -103,11 +105,11 @@ application_module.controller("AppConfigController",
...
@@ -103,11 +105,11 @@ application_module.controller("AppConfigController",
}
}
},
function
(
result
)
{
},
function
(
result
)
{
toastr
.
error
(
result
.
status
+
result
.
data
.
message
,
"加载配置信息出错"
);
toastr
.
error
(
AppUtil
.
errorMsg
(
result
)
,
"加载配置信息出错"
);
});
});
}
}
//////
//////global view oper ///////
//////
//////
global view oper
//////
$scope
.
switchView
=
function
(
namespace
,
viewType
)
{
$scope
.
switchView
=
function
(
namespace
,
viewType
)
{
...
@@ -138,7 +140,7 @@ application_module.controller("AppConfigController",
...
@@ -138,7 +140,7 @@ application_module.controller("AppConfigController",
return
result
;
return
result
;
}
}
//////
//// text view oper ///
//////
//////
text view oper
//////
$scope
.
draft
=
{};
$scope
.
draft
=
{};
//保存草稿
//保存草稿
...
@@ -161,7 +163,7 @@ application_module.controller("AppConfigController",
...
@@ -161,7 +163,7 @@ application_module.controller("AppConfigController",
$scope
.
toggleTextEditStatus
(
$scope
.
draft
);
$scope
.
toggleTextEditStatus
(
$scope
.
draft
);
},
function
(
result
)
{
},
function
(
result
)
{
toastr
.
error
(
result
.
status
+
result
.
data
.
message
,
"更新失败"
);
toastr
.
error
(
AppUtil
.
errorMsg
(
result
)
,
"更新失败"
);
}
}
);
);
...
@@ -169,6 +171,7 @@ application_module.controller("AppConfigController",
...
@@ -169,6 +171,7 @@ application_module.controller("AppConfigController",
$scope
.
isItemsViewOpened
=
true
;
$scope
.
isItemsViewOpened
=
true
;
$scope
.
toggleItemView
=
function
(
isOpened
)
{
$scope
.
toggleItemView
=
function
(
isOpened
)
{
$scope
.
isItemsViewOpened
=
isOpened
;
$scope
.
isItemsViewOpened
=
isOpened
;
};
};
...
@@ -185,7 +188,7 @@ application_module.controller("AppConfigController",
...
@@ -185,7 +188,7 @@ application_module.controller("AppConfigController",
}
}
};
};
//////
//// table view oper ///
//////
//////
table view oper
//////
//查看旧值
//查看旧值
$scope
.
queryOldValue
=
function
(
key
,
oldValue
)
{
$scope
.
queryOldValue
=
function
(
key
,
oldValue
)
{
...
@@ -215,11 +218,47 @@ application_module.controller("AppConfigController",
...
@@ -215,11 +218,47 @@ application_module.controller("AppConfigController",
refreshNamespaces
();
refreshNamespaces
();
},
function
(
result
)
{
},
function
(
result
)
{
toastr
.
error
(
result
.
status
+
result
.
data
.
message
,
"发布失败"
);
toastr
.
error
(
AppUtil
.
errorMsg
(
result
)
,
"发布失败"
);
}
}
);
);
}
}
////// create env //////
$scope
.
toggleSelection
=
function
toggleSelection
(
env
)
{
var
idx
=
$scope
.
selectedEnvs
.
indexOf
(
env
);
// is currently selected
if
(
idx
>
-
1
)
{
$scope
.
selectedEnvs
.
splice
(
idx
,
1
);
}
// is newly selected
else
{
$scope
.
selectedEnvs
.
push
(
env
);
}
};
$scope
.
createEnvs
=
function
()
{
var
count
=
0
;
$scope
.
selectedEnvs
.
forEach
(
function
(
env
)
{
AppService
.
create
(
env
,
$scope
.
appBaseInfo
).
then
(
function
(
result
)
{
toastr
.
success
(
env
,
'创建成功'
);
count
++
;
if
(
count
==
$scope
.
selectedEnvs
){
$route
.
reload
();
}
},
function
(
result
)
{
toastr
.
error
(
AppUtil
.
errorMsg
(
result
),
'创建失败:'
+
env
);
count
++
;
if
(
count
==
$scope
.
selectedEnvs
){
$route
.
reload
();
}
});
});
};
}]);
}]);
apollo-portal/src/main/resources/static/scripts/services/AppService.js
View file @
6698804e
...
@@ -3,7 +3,7 @@ appService.service('AppService', ['$resource', '$q', function ($resource, $q) {
...
@@ -3,7 +3,7 @@ appService.service('AppService', ['$resource', '$q', function ($resource, $q) {
find_all_app
:{
find_all_app
:{
method
:
'GET'
,
method
:
'GET'
,
isArray
:
true
,
isArray
:
true
,
url
:
'/apps/env/:env'
url
:
'/apps/env
s
/:env'
},
},
load_navtree
:{
load_navtree
:{
methode
:
'GET'
,
methode
:
'GET'
,
...
@@ -14,9 +14,9 @@ appService.service('AppService', ['$resource', '$q', function ($resource, $q) {
...
@@ -14,9 +14,9 @@ appService.service('AppService', ['$resource', '$q', function ($resource, $q) {
method
:
'GET'
,
method
:
'GET'
,
isArray
:
false
isArray
:
false
},
},
add
_app
:
{
create
_app
:
{
method
:
'POST'
,
method
:
'POST'
,
url
:
'/apps'
url
:
'/apps
/envs/:env
'
}
}
});
});
return
{
return
{
...
@@ -42,9 +42,9 @@ appService.service('AppService', ['$resource', '$q', function ($resource, $q) {
...
@@ -42,9 +42,9 @@ appService.service('AppService', ['$resource', '$q', function ($resource, $q) {
});
});
return
d
.
promise
;
return
d
.
promise
;
},
},
add
:
function
(
app
)
{
create
:
function
(
env
,
app
)
{
var
d
=
$q
.
defer
();
var
d
=
$q
.
defer
();
app_resource
.
add_app
({
},
app
,
function
(
result
)
{
app_resource
.
create_app
({
env
:
env
},
app
,
function
(
result
)
{
d
.
resolve
(
result
);
d
.
resolve
(
result
);
},
function
(
result
)
{
},
function
(
result
)
{
d
.
reject
(
result
);
d
.
reject
(
result
);
...
...
apollo-portal/src/main/resources/static/styles/common-style.css
View file @
6698804e
...
@@ -16,6 +16,21 @@ a {
...
@@ -16,6 +16,21 @@ a {
cursor
:
pointer
;
cursor
:
pointer
;
}
}
.i-20
{
height
:
20px
;
width
:
20px
;
}
.i-25-20
{
height
:
20px
;
width
:
25px
;
}
.i-15
{
height
:
15px
;
width
:
15px
;
}
.apollo-container
{
.apollo-container
{
min-height
:
90%
;
min-height
:
90%
;
}
}
...
@@ -122,6 +137,12 @@ table th {
...
@@ -122,6 +137,12 @@ table th {
font-weight
:
300
;
font-weight
:
300
;
}
}
.project-info
th
{
text-align
:
right
;
padding
:
4px
6px
;
white-space
:
nowrap
;
}
.project-info
td
{
.project-info
td
{
word-wrap
:
break-word
;
word-wrap
:
break-word
;
word-break
:
break-all
;
word-break
:
break-all
;
...
...
apollo-portal/src/main/resources/static/views/app.html
View file @
6698804e
This diff is collapsed.
Click to expand it.
apollo-portal/src/main/resources/static/views/create-app.html
View file @
6698804e
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
</header>
</header>
<div
class=
"panel-body"
>
<div
class=
"panel-body"
>
<form
class=
"form-horizontal"
ng-controller=
"CreateAppController"
ng-submit=
"
sav
e()"
>
<form
class=
"form-horizontal"
ng-controller=
"CreateAppController"
ng-submit=
"
creat
e()"
>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
><font
style=
"color: red"
>
*
</font>
应用ID
</label>
<label
class=
"col-sm-2 control-label"
><font
style=
"color: red"
>
*
</font>
应用ID
</label>
<div
class=
"col-sm-3"
>
<div
class=
"col-sm-3"
>
...
@@ -81,6 +81,8 @@
...
@@ -81,6 +81,8 @@
<script
type=
"application/javascript"
src=
"../scripts/app.js"
></script>
<script
type=
"application/javascript"
src=
"../scripts/app.js"
></script>
<script
type=
"application/javascript"
src=
"../scripts/services/AppService.js"
></script>
<script
type=
"application/javascript"
src=
"../scripts/services/AppService.js"
></script>
<script
type=
"application/javascript"
src=
"../scripts/AppUtils.js"
></script>
<script
type=
"application/javascript"
src=
"../scripts/controller/CreateAppController.js"
></script>
<script
type=
"application/javascript"
src=
"../scripts/controller/CreateAppController.js"
></script>
</body>
</body>
</html>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment