Commit 5cfdd0d1 authored by nobodyiam's avatar nobodyiam Committed by Jason Song

Revert "add i18n support and English translations (#2641)"

This reverts commit 437026f3.
parent 95aaa41d
...@@ -45,7 +45,6 @@ public class WebMvcConfig implements WebMvcConfigurer, WebServerFactoryCustomize ...@@ -45,7 +45,6 @@ public class WebMvcConfig implements WebMvcConfigurer, WebServerFactoryCustomize
addCacheControl(registry, "scripts", 86400); addCacheControl(registry, "scripts", 86400);
addCacheControl(registry, "styles", 86400); addCacheControl(registry, "styles", 86400);
addCacheControl(registry, "views", 86400); addCacheControl(registry, "views", 86400);
addCacheControl(registry, "i18n", 86400);
} }
private void addCacheControl(ResourceHandlerRegistry registry, String folder, int cachePeriod) { private void addCacheControl(ResourceHandlerRegistry registry, String folder, int cachePeriod) {
......
...@@ -11,7 +11,7 @@ public class AppDTO extends BaseDTO{ ...@@ -11,7 +11,7 @@ public class AppDTO extends BaseDTO{
@Pattern( @Pattern(
regexp = InputValidator.CLUSTER_NAMESPACE_VALIDATOR, regexp = InputValidator.CLUSTER_NAMESPACE_VALIDATOR,
message = "Invalid AppId format: " + InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE message = "AppId格式错误: " + InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE
) )
private String appId; private String appId;
......
...@@ -11,7 +11,7 @@ public class ClusterDTO extends BaseDTO{ ...@@ -11,7 +11,7 @@ public class ClusterDTO extends BaseDTO{
@NotBlank(message = "cluster name cannot be blank") @NotBlank(message = "cluster name cannot be blank")
@Pattern( @Pattern(
regexp = InputValidator.CLUSTER_NAMESPACE_VALIDATOR, regexp = InputValidator.CLUSTER_NAMESPACE_VALIDATOR,
message = "Invalid Cluster format: " + InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE message = "Cluster格式错误: " + InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE
) )
private String name; private String name;
......
...@@ -12,7 +12,7 @@ public class NamespaceDTO extends BaseDTO{ ...@@ -12,7 +12,7 @@ public class NamespaceDTO extends BaseDTO{
@Pattern( @Pattern(
regexp = InputValidator.CLUSTER_NAMESPACE_VALIDATOR, regexp = InputValidator.CLUSTER_NAMESPACE_VALIDATOR,
message = "Invalid Namespace format: " + InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE message = "Namespace格式错误: " + InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE
) )
private String namespaceName; private String namespaceName;
......
...@@ -22,7 +22,7 @@ public class AppNamespace extends BaseEntity { ...@@ -22,7 +22,7 @@ public class AppNamespace extends BaseEntity {
@NotBlank(message = "AppNamespace Name cannot be blank") @NotBlank(message = "AppNamespace Name cannot be blank")
@Pattern( @Pattern(
regexp = InputValidator.CLUSTER_NAMESPACE_VALIDATOR, regexp = InputValidator.CLUSTER_NAMESPACE_VALIDATOR,
message = "Invalid Namespace format: " + InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE + " & " + InputValidator.INVALID_NAMESPACE_NAMESPACE_MESSAGE message = "Namespace格式错误: " + InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE + " & " + InputValidator.INVALID_NAMESPACE_NAMESPACE_MESSAGE
) )
@Column(name = "Name", nullable = false) @Column(name = "Name", nullable = false)
private String name; private String name;
......
...@@ -8,8 +8,8 @@ import java.util.regex.Pattern; ...@@ -8,8 +8,8 @@ import java.util.regex.Pattern;
* @author Jason Song(song_s@ctrip.com) * @author Jason Song(song_s@ctrip.com)
*/ */
public class InputValidator { public class InputValidator {
public static final String INVALID_CLUSTER_NAMESPACE_MESSAGE = "Only digits, alphabets and symbol - _ . are allowed"; public static final String INVALID_CLUSTER_NAMESPACE_MESSAGE = "只允许输入数字,字母和符号 - _ .";
public static final String INVALID_NAMESPACE_NAMESPACE_MESSAGE = "not allowed to end with .json, .yml, .yaml, .xml, .properties"; public static final String INVALID_NAMESPACE_NAMESPACE_MESSAGE = "不允许以.json, .yml, .yaml, .xml, .properties结尾";
public static final String CLUSTER_NAMESPACE_VALIDATOR = "[0-9a-zA-Z_.-]+"; public static final String CLUSTER_NAMESPACE_VALIDATOR = "[0-9a-zA-Z_.-]+";
private static final String APP_NAMESPACE_VALIDATOR = "[a-zA-Z0-9._-]+(?<!\\.(json|yml|yaml|xml|properties))$"; private static final String APP_NAMESPACE_VALIDATOR = "[a-zA-Z0-9._-]+(?<!\\.(json|yml|yaml|xml|properties))$";
private static final Pattern CLUSTER_NAMESPACE_PATTERN = Pattern.compile(CLUSTER_NAMESPACE_VALIDATOR); private static final Pattern CLUSTER_NAMESPACE_PATTERN = Pattern.compile(CLUSTER_NAMESPACE_VALIDATOR);
......
...@@ -59,7 +59,7 @@ public class ClusterController { ...@@ -59,7 +59,7 @@ public class ClusterController {
if (!InputValidator.isValidClusterNamespace(clusterName)) { if (!InputValidator.isValidClusterNamespace(clusterName)) {
throw new BadRequestException( throw new BadRequestException(
String.format("Invalid ClusterName format: %s", InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE)); String.format("Cluster Name 格式错误: %s", InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE));
} }
if (userService.findByUserId(operator) == null) { if (userService.findByUserId(operator) == null) {
......
...@@ -68,7 +68,7 @@ public class NamespaceController { ...@@ -68,7 +68,7 @@ public class NamespaceController {
appNamespaceDTO.getFormat(), appNamespaceDTO.getDataChangeCreatedBy()); appNamespaceDTO.getFormat(), appNamespaceDTO.getDataChangeCreatedBy());
if (!InputValidator.isValidAppNamespace(appNamespaceDTO.getName())) { if (!InputValidator.isValidAppNamespace(appNamespaceDTO.getName())) {
throw new BadRequestException(String.format("Invalid Namespace format: %s", throw new BadRequestException(String.format("Namespace格式错误: %s",
InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE + " & " InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE + " & "
+ InputValidator.INVALID_NAMESPACE_NAMESPACE_MESSAGE)); + InputValidator.INVALID_NAMESPACE_NAMESPACE_MESSAGE));
} }
......
...@@ -193,7 +193,7 @@ public class NamespaceController { ...@@ -193,7 +193,7 @@ public class NamespaceController {
@RequestParam(defaultValue = "true") boolean appendNamespacePrefix, @RequestParam(defaultValue = "true") boolean appendNamespacePrefix,
@Valid @RequestBody AppNamespace appNamespace) { @Valid @RequestBody AppNamespace appNamespace) {
if (!InputValidator.isValidAppNamespace(appNamespace.getName())) { if (!InputValidator.isValidAppNamespace(appNamespace.getName())) {
throw new BadRequestException(String.format("Invalid Namespace format: %s", throw new BadRequestException(String.format("Namespace格式错误: %s",
InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE + " & " + InputValidator.INVALID_NAMESPACE_NAMESPACE_MESSAGE)); InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE + " & " + InputValidator.INVALID_NAMESPACE_NAMESPACE_MESSAGE));
} }
......
...@@ -154,7 +154,7 @@ public class PermissionController { ...@@ -154,7 +154,7 @@ public class PermissionController {
Set<String> assignedUser = rolePermissionService.assignRoleToUsers(RoleUtils.buildNamespaceRoleName(appId, namespaceName, roleType, env), Set<String> assignedUser = rolePermissionService.assignRoleToUsers(RoleUtils.buildNamespaceRoleName(appId, namespaceName, roleType, env),
Sets.newHashSet(user), userInfoHolder.getUser().getUserId()); Sets.newHashSet(user), userInfoHolder.getUser().getUserId());
if (CollectionUtils.isEmpty(assignedUser)) { if (CollectionUtils.isEmpty(assignedUser)) {
throw new BadRequestException(user + " already authorized"); throw new BadRequestException(user + "已授权");
} }
return ResponseEntity.ok().build(); return ResponseEntity.ok().build();
...@@ -209,7 +209,7 @@ public class PermissionController { ...@@ -209,7 +209,7 @@ public class PermissionController {
Set<String> assignedUser = rolePermissionService.assignRoleToUsers(RoleUtils.buildNamespaceRoleName(appId, namespaceName, roleType), Set<String> assignedUser = rolePermissionService.assignRoleToUsers(RoleUtils.buildNamespaceRoleName(appId, namespaceName, roleType),
Sets.newHashSet(user), userInfoHolder.getUser().getUserId()); Sets.newHashSet(user), userInfoHolder.getUser().getUserId());
if (CollectionUtils.isEmpty(assignedUser)) { if (CollectionUtils.isEmpty(assignedUser)) {
throw new BadRequestException(user + " already authorized"); throw new BadRequestException(user + "已授权");
} }
return ResponseEntity.ok().build(); return ResponseEntity.ok().build();
...@@ -253,7 +253,7 @@ public class PermissionController { ...@@ -253,7 +253,7 @@ public class PermissionController {
Set<String> assignedUsers = rolePermissionService.assignRoleToUsers(RoleUtils.buildAppRoleName(appId, roleType), Set<String> assignedUsers = rolePermissionService.assignRoleToUsers(RoleUtils.buildAppRoleName(appId, roleType),
Sets.newHashSet(user), userInfoHolder.getUser().getUserId()); Sets.newHashSet(user), userInfoHolder.getUser().getUserId());
if (CollectionUtils.isEmpty(assignedUsers)) { if (CollectionUtils.isEmpty(assignedUsers)) {
throw new BadRequestException(user + " already authorized"); throw new BadRequestException(user + "已授权");
} }
return ResponseEntity.ok().build(); return ResponseEntity.ok().build();
......
...@@ -14,7 +14,7 @@ public class AppModel { ...@@ -14,7 +14,7 @@ public class AppModel {
@NotBlank(message = "appId cannot be blank") @NotBlank(message = "appId cannot be blank")
@Pattern( @Pattern(
regexp = InputValidator.CLUSTER_NAMESPACE_VALIDATOR, regexp = InputValidator.CLUSTER_NAMESPACE_VALIDATOR,
message = "Invalid AppId format: " + InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE message = "AppId格式错误: " + InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE
) )
private String appId; private String appId;
......
...@@ -271,7 +271,7 @@ public class AuthConfiguration { ...@@ -271,7 +271,7 @@ public class AuthConfiguration {
http.csrf().disable(); http.csrf().disable();
http.headers().frameOptions().sameOrigin(); http.headers().frameOptions().sameOrigin();
http.authorizeRequests() http.authorizeRequests()
.antMatchers("/prometheus/**","/metrics/**","/openapi/**", "/vendor/**", "/styles/**", "/scripts/**", "/views/**", "/img/**", "/i18n/**").permitAll() .antMatchers("/prometheus/**","/metrics/**","/openapi/**", "/vendor/**", "/styles/**", "/scripts/**", "/views/**", "/img/**").permitAll()
.antMatchers("/**").hasAnyRole(USER_ROLE); .antMatchers("/**").hasAnyRole(USER_ROLE);
http.formLogin().loginPage("/signin").defaultSuccessUrl("/", true).permitAll().failureUrl("/signin?#/error").and() http.formLogin().loginPage("/signin").defaultSuccessUrl("/", true).permitAll().failureUrl("/signin?#/error").and()
.httpBasic(); .httpBasic();
...@@ -403,7 +403,7 @@ public class AuthConfiguration { ...@@ -403,7 +403,7 @@ public class AuthConfiguration {
http.csrf().disable(); http.csrf().disable();
http.headers().frameOptions().sameOrigin(); http.headers().frameOptions().sameOrigin();
http.authorizeRequests() http.authorizeRequests()
.antMatchers("/prometheus/**","/metrics/**","/openapi/**", "/vendor/**", "/styles/**", "/scripts/**", "/views/**", "/img/**", "/i18n/**").permitAll() .antMatchers("/prometheus/**","/metrics/**","/openapi/**", "/vendor/**", "/styles/**", "/scripts/**", "/views/**", "/img/**").permitAll()
.antMatchers("/**").authenticated(); .antMatchers("/**").authenticated();
http.formLogin().loginPage("/signin").defaultSuccessUrl("/", true).permitAll().failureUrl("/signin?#/error").and() http.formLogin().loginPage("/signin").defaultSuccessUrl("/", true).permitAll().failureUrl("/signin?#/error").and()
.httpBasic(); .httpBasic();
......
...@@ -12,11 +12,11 @@ public class RelativeDateFormat { ...@@ -12,11 +12,11 @@ public class RelativeDateFormat {
private static final long ONE_HOUR = 3600000L; private static final long ONE_HOUR = 3600000L;
private static final long ONE_DAY = 86400000L; private static final long ONE_DAY = 86400000L;
private static final String ONE_SECOND_AGO = " seconds ago"; private static final String ONE_SECOND_AGO = "秒前";
private static final String ONE_MINUTE_AGO = " minutes ago"; private static final String ONE_MINUTE_AGO = "分钟前";
private static final String ONE_HOUR_AGO = " hours ago"; private static final String ONE_HOUR_AGO = "小时前";
private static final String ONE_DAY_AGO = " days ago"; private static final String ONE_DAY_AGO = "天前";
private static final String ONE_MONTH_AGO = " months ago"; private static final String ONE_MONTH_AGO = "月前";
public static String format(Date date) { public static String format(Date date) {
if (date.after(new Date())) { if (date.after(new Date())) {
...@@ -39,11 +39,11 @@ public class RelativeDateFormat { ...@@ -39,11 +39,11 @@ public class RelativeDateFormat {
Date lastDayBeginTime = getDateOffset(-1); Date lastDayBeginTime = getDateOffset(-1);
if (date.after(lastDayBeginTime)) { if (date.after(lastDayBeginTime)) {
return "yesterday"; return "昨天";
} }
Date lastTwoDaysBeginTime = getDateOffset(-2); Date lastTwoDaysBeginTime = getDateOffset(-2);
if (date.after(lastTwoDaysBeginTime)) { if (date.after(lastTwoDaysBeginTime)) {
return "the day before yesterday"; return "前天";
} }
if (delta < 30L * ONE_DAY) { if (delta < 30L * ONE_DAY) {
long days = toDays(delta); long days = toDays(delta);
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css"> <link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css">
<link rel="stylesheet" type="text/css" href="styles/common-style.css"> <link rel="stylesheet" type="text/css" href="styles/common-style.css">
<title>{{'App.CreateProject' | translate }}</title> <title>新建项目</title>
</head> </head>
<body> <body>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<div class="col-md-8 col-md-offset-2"> <div class="col-md-8 col-md-offset-2">
<div class="panel"> <div class="panel">
<header class="panel-heading"> <header class="panel-heading">
{{'App.CreateProject' | translate }} 创建项目
</header> </header>
<form class="form-horizontal panel-body" name="appForm" ng-controller="CreateAppController" <form class="form-horizontal panel-body" name="appForm" ng-controller="CreateAppController"
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"> <label class="col-sm-3 control-label">
<apollorequiredfield></apollorequiredfield> <apollorequiredfield></apollorequiredfield>
{{'Common.Department' | translate }}</label> 部门</label>
<div class="col-sm-3"> <div class="col-sm-3">
<select id="organization"> <select id="organization">
<option></option> <option></option>
...@@ -41,44 +41,43 @@ ...@@ -41,44 +41,43 @@
<div class="form-group" valdr-form-group> <div class="form-group" valdr-form-group>
<label class="col-sm-3 control-label"> <label class="col-sm-3 control-label">
<apollorequiredfield></apollorequiredfield> <apollorequiredfield></apollorequiredfield>
{{'Common.AppId' | translate }}</label> 应用Id</label>
<div class="col-sm-3"> <div class="col-sm-3">
<input type="text" class="form-control" name="appId" ng-model="app.appId"> <input type="text" class="form-control" name="appId" ng-model="app.appId">
<small>{{'App.AppIdTips' | translate }} <small>(应用唯一标识)</small>
</small>
</div> </div>
</div> </div>
<div class="form-group" valdr-form-group> <div class="form-group" valdr-form-group>
<label class="col-sm-3 control-label"> <label class="col-sm-3 control-label">
<apollorequiredfield></apollorequiredfield> <apollorequiredfield></apollorequiredfield>
{{'Common.AppName' | translate }}</label> 应用名称</label>
<div class="col-sm-5"> <div class="col-sm-5">
<input type="text" class="form-control" name="appName" ng-model="app.name"> <input type="text" class="form-control" name="appName" ng-model="app.name">
<small>{{'App.AppNameTips' | translate }}</small> <small>(建议格式 xx-yy-zz 例:apollo-server)</small>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label"> <label class="col-sm-3 control-label">
<apollorequiredfield></apollorequiredfield> <apollorequiredfield></apollorequiredfield>
{{'Common.AppOwnerLong' | translate }}</label> 应用负责人</label>
<div class="col-sm-6 J_ownerSelectorPanel"> <div class="col-sm-6 J_ownerSelectorPanel">
<apollouserselector apollo-id="'ownerSelector'" disabled="isOpenManageAppMasterRoleLimit"></apollouserselector> <apollouserselector apollo-id="'ownerSelector'" disabled="isOpenManageAppMasterRoleLimit"></apollouserselector>
<small style="color: maroon" ng-if="isOpenManageAppMasterRoleLimit">{{'App.AppOwnerTips' | translate }}</small> <small style="color: maroon" ng-if="isOpenManageAppMasterRoleLimit">(开启项目管理员分配权限控制后,应用负责人和项目管理员默认为本账号,不可选择)</small>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">{{'Common.AppAdmin' | translate }}<br> <label class="col-sm-3 control-label">项目管理员<br>
</label> </label>
<div class="col-sm-9 J_adminSelectorPanel"> <div class="col-sm-9 J_adminSelectorPanel">
<apollomultipleuserselector apollo-id="'adminSelector'" ng-disabled="isOpenManageAppMasterRoleLimit"></apollomultipleuserselector> <apollomultipleuserselector apollo-id="'adminSelector'" ng-disabled="isOpenManageAppMasterRoleLimit"></apollomultipleuserselector>
<br> <br>
<small>{{'App.AppAdminTips1' | translate }}</small> <small>(应用负责人默认具有项目管理员权限,</small>
<br> <br>
<small>{{'App.AppAdminTips2' | translate }}</small> <small>项目管理员可以创建Namespace和集群、分配用户权限)</small>
</div> </div>
</div> </div>
...@@ -87,7 +86,7 @@ ...@@ -87,7 +86,7 @@
<div class="col-sm-offset-3 col-sm-9"> <div class="col-sm-offset-3 col-sm-9">
<button type="submit" class="btn btn-primary" <button type="submit" class="btn btn-primary"
ng-disabled="appForm.$invalid || submitBtnDisabled">{{'Common.Submit' | translate }} ng-disabled="appForm.$invalid || submitBtnDisabled">提交
</button> </button>
</div> </div>
</div> </div>
...@@ -105,11 +104,6 @@ ...@@ -105,11 +104,6 @@
<script src="vendor/angular/angular-resource.min.js"></script> <script src="vendor/angular/angular-resource.min.js"></script>
<script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script>
<script src="vendor/angular/loading-bar.min.js"></script> <script src="vendor/angular/loading-bar.min.js"></script>
<script src="vendor/angular/angular-cookies.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script>
<!-- jquery.js --> <!-- jquery.js -->
<script src="vendor/jquery.min.js" type="text/javascript"></script> <script src="vendor/jquery.min.js" type="text/javascript"></script>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css"> <link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css">
<link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css"> <link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css">
<link rel="stylesheet" type="text/css" href="styles/common-style.css"> <link rel="stylesheet" type="text/css" href="styles/common-style.css">
<title>{{'Cluster.CreateCluster' | translate }}</title> <title>新建集群</title>
</head> </head>
<body> <body>
...@@ -23,10 +23,10 @@ ...@@ -23,10 +23,10 @@
<header class="panel-heading"> <header class="panel-heading">
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-6">
<h4>{{'Cluster.CreateCluster' | translate }}</h4> <h4>创建集群</h4>
</div> </div>
<div class="col-md-6 text-right"> <div class="col-md-6 text-right">
<a type="button" class="btn btn-info" href="/config.html?#/appid={{appId}}">{{'Common.ReturnToIndex' | translate }} <a type="button" class="btn btn-info" href="/config.html?#/appid={{appId}}">返回到项目首页
</a> </a>
</div> </div>
</div> </div>
...@@ -39,10 +39,13 @@ ...@@ -39,10 +39,13 @@
<div class="alert alert-info no-radius" role="alert"> <div class="alert alert-info no-radius" role="alert">
<strong>Tips:</strong> <strong>Tips:</strong>
<ul> <ul>
<li>{{'Cluster.Tips.1' | translate }}</li> <li>通过添加集群,可以使同一份程序在不同的集群(如不同的数据中心)使用不同的配置</li>
<li>{{'Cluster.Tips.2' | translate }}</li> <li>如果不同集群使用一样的配置,则没有必要创建集群</li>
<li>{{'Cluster.Tips.3' | translate }}</li> <li>
<li>{{'Cluster.Tips.4' | translate }}</li> Apollo默认会读取机器上/opt/settings/server.properties(linux)或C:\opt\settings\server.properties(windows)文件中的idc属性作为集群名字,
如SHAJQ(金桥数据中心)、SHAOY(欧阳数据中心)
</li>
<li>在这里创建的集群名字需要和机器上server.properties中的idc属性一致</li>
</ul> </ul>
</div> </div>
<form class="form-horizontal" name="clusterForm" valdr-type="Cluster" ng-show="step == 1" <form class="form-horizontal" name="clusterForm" valdr-type="Cluster" ng-show="step == 1"
...@@ -50,7 +53,7 @@ ...@@ -50,7 +53,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label"> <label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield> <apollorequiredfield></apollorequiredfield>
{{'Common.AppId' | translate }}</label> 应用AppId</label>
<div class="col-sm-6"> <div class="col-sm-6">
<label class="form-control-static" ng-bind="appId"></label> <label class="form-control-static" ng-bind="appId"></label>
</div> </div>
...@@ -58,16 +61,16 @@ ...@@ -58,16 +61,16 @@
<div class="form-group" valdr-form-group> <div class="form-group" valdr-form-group>
<label class="col-sm-2 control-label"> <label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield> <apollorequiredfield></apollorequiredfield>
{{'Common.ClusterName' | translate }}</label> 集群名称</label>
<div class="col-sm-6"> <div class="col-sm-6">
<input type="text" class="form-control" name="clusterName" ng-model="clusterName"> <input type="text" class="form-control" name="clusterName" ng-model="clusterName">
<small>{{'Cluster.CreateNameTips' | translate }}</small> <small>(部署集群如:SHAJQ,SHAOY 或自定义集群如:SHAJQ-xx,SHAJQ-yy)</small>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label"> <label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield> <apollorequiredfield></apollorequiredfield>
{{'Cluster.ChooseEnvironment' | translate }}</label> 选择环境</label>
<div class="col-sm-5"> <div class="col-sm-5">
<table class="table table-hover" style="width: 100px"> <table class="table table-hover" style="width: 100px">
<tbody> <tbody>
...@@ -86,14 +89,14 @@ ...@@ -86,14 +89,14 @@
<div class="col-sm-offset-2 col-sm-10"> <div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary" <button type="submit" class="btn btn-primary"
ng-disabled="clusterForm.$invalid || submitBtnDisabled">{{'Common.Submit' | translate }} ng-disabled="clusterForm.$invalid || submitBtnDisabled">提交
</button> </button>
</div> </div>
</div> </div>
</form> </form>
<div class="row text-center" ng-show="step == 2"> <div class="row text-center" ng-show="step == 2">
<img src="img/sync-succ.png" style="height: 100px; width: 100px"> <img src="img/sync-succ.png" style="height: 100px; width: 100px">
<h3>{{'Common.Created' | translate }}!</h3> <h3>创建成功!</h3>
</div> </div>
</div> </div>
</div> </div>
...@@ -108,11 +111,6 @@ ...@@ -108,11 +111,6 @@
<script src="vendor/angular/angular-resource.min.js"></script> <script src="vendor/angular/angular-resource.min.js"></script>
<script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script>
<script src="vendor/angular/loading-bar.min.js"></script> <script src="vendor/angular/loading-bar.min.js"></script>
<script src="vendor/angular/angular-cookies.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script>
<!-- jquery.js --> <!-- jquery.js -->
<script src="vendor/jquery.min.js" type="text/javascript"></script> <script src="vendor/jquery.min.js" type="text/javascript"></script>
......
This diff is collapsed.
<!doctype html> <!doctype html>
<html ng-app="index"> <html ng-app="index">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="icon" href="./img/config.png"> <link rel="icon" href="./img/config.png">
...@@ -12,25 +11,24 @@ ...@@ -12,25 +11,24 @@
<link rel="stylesheet" type="text/css" media='all' href="vendor/font-awesome.min.css"> <link rel="stylesheet" type="text/css" media='all' href="vendor/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="styles/common-style.css"> <link rel="stylesheet" type="text/css" href="styles/common-style.css">
<title>{{'Common.Title' | translate }}</title> <title>Apollo配置中心</title>
</head> </head>
<body> <body>
<apollonav></apollonav> <apollonav></apollonav>
<div id="app-list" class="hidden" ng-controller="IndexController"> <div id="app-list" class="hidden" ng-controller="IndexController">
<section class="media create-app-list"> <section class="media create-app-list">
<aside class="media-left text-center"> <aside class="media-left text-center">
<h5>{{'Index.MyProject' | translate }}</h5> <h5>我的项目</h5>
</aside> </aside>
<aside class="media-body"> <aside class="media-body">
<div class="app-panel col-md-2 text-center" ng-click="goToCreateAppPage()" <div class="app-panel col-md-2 text-center" ng-click="goToCreateAppPage()" ng-if="hasCreateApplicationPermission">
ng-if="hasCreateApplicationPermission">
<div href="#" class="thumbnail create-btn hover cursor-pointer"> <div href="#" class="thumbnail create-btn hover cursor-pointer">
<img src="img/plus-white.png" /> <img src="img/plus-white.png"/>
<h5>{{'Index.CreateProject' | translate }}</h5> <h5>创建项目</h5>
</div> </div>
</div> </div>
<div class="app-panel col-md-2 text-center" ng-repeat="app in createdApps" <div class="app-panel col-md-2 text-center" ng-repeat="app in createdApps"
...@@ -43,8 +41,8 @@ ...@@ -43,8 +41,8 @@
<div class="app-panel col-md-2 text-center" ng-show="hasMoreCreatedApps" <div class="app-panel col-md-2 text-center" ng-show="hasMoreCreatedApps"
ng-click="getUserCreatedApps()"> ng-click="getUserCreatedApps()">
<div href="#" class="thumbnail hover cursor-pointer"> <div href="#" class="thumbnail hover cursor-pointer">
<img class="more-img" src="img/more.png" /> <img class="more-img" src="img/more.png"/>
<h5>{{'Index.LoadMore' | translate }}</h5> <h5>加载更多</h5>
</div> </div>
</div> </div>
</aside> </aside>
...@@ -52,36 +50,39 @@ ...@@ -52,36 +50,39 @@
<section class="media favorites-app-list"> <section class="media favorites-app-list">
<aside class="media-left text-center"> <aside class="media-left text-center">
<h5>{{'Index.FavoriteItems' | translate }}</h5> <h5>收藏的项目</h5>
</aside> </aside>
<aside class="media-body"> <aside class="media-body">
<div class="app-panel col-md-2 text-center" ng-repeat="app in favorites" <div class="app-panel col-md-2 text-center"
ng-click="goToAppHomePage(app.appId)" ng-mouseover="toggleOperationBtn(app)" ng-repeat="app in favorites"
ng-click="goToAppHomePage(app.appId)"
ng-mouseover="toggleOperationBtn(app)"
ng-mouseout="toggleOperationBtn(app)"> ng-mouseout="toggleOperationBtn(app)">
<div class="thumbnail hover"> <div class="thumbnail hover">
<h4 ng-bind="app.appId"></h4> <h4 ng-bind="app.appId"></h4>
<h5 ng-bind="app.name"></h5> <h5 ng-bind="app.name"></h5>
<p class="operate-panel" ng-show="app.showOperationBtn"> <p class="operate-panel" ng-show="app.showOperationBtn">
<button class="btn btn-default btn-xs" title="{{'Index.Topping' | translate }}" <button class="btn btn-default btn-xs" title="置顶"
ng-click="toTop(app.favoriteId);$event.stopPropagation();"> ng-click="toTop(app.favoriteId);$event.stopPropagation();">
<img src="img/top.png" class="i-15"> <img src="img/top.png" class="i-15">
</button> </button>
<button class="btn btn-default btn-xs" title="{{'Index.FavoriteCancel' | translate }}" <button class="btn btn-default btn-xs" title="取消收藏"
ng-click="deleteFavorite(app.favoriteId);$event.stopPropagation();"> ng-click="deleteFavorite(app.favoriteId);$event.stopPropagation();">
<img src="img/like.png" class="i-15"> <img src="img/like.png" class="i-15">
</button> </button>
</p> </p>
</div> </div>
</div> </div>
<div class="col-md-2 text-center" ng-show="hasMoreFavorites" ng-click="getUserFavorites()"> <div class="col-md-2 text-center" ng-show="hasMoreFavorites"
ng-click="getUserFavorites()">
<div href="#" class="thumbnail hover cursor-pointer"> <div href="#" class="thumbnail hover cursor-pointer">
<img class="more-img" src="img/more.png" /> <img class="more-img" src="img/more.png"/>
<h5>{{'Index.LoadMore' | translate }}</h5> <h5>加载更多</h5>
</div> </div>
</div> </div>
<div class="no-favorites text-center" ng-show="!favorites || favorites.length == 0"> <div class="no-favorites text-center" ng-show="!favorites || favorites.length == 0">
<h4>{{'Index.FavoriteTip' | translate }}</h4> <h4>您还没有收藏过任何项目,在项目主页可以收藏项目哟~</h4>
</div> </div>
</aside> </aside>
...@@ -89,10 +90,11 @@ ...@@ -89,10 +90,11 @@
<section class="media visit-app-list" ng-show="visitedApps && visitedApps.length"> <section class="media visit-app-list" ng-show="visitedApps && visitedApps.length">
<aside class="media-left text-center"> <aside class="media-left text-center">
<h5>{{'Index.RecentlyViewedItems' | translate }}</h5> <h5>最近浏览的项目</h5>
</aside> </aside>
<aside class="media-body"> <aside class="media-body">
<div class="app-panel col-md-2 text-center" ng-repeat="app in visitedApps" <div class="app-panel col-md-2 text-center"
ng-repeat="app in visitedApps"
ng-click="goToAppHomePage(app.appId)"> ng-click="goToAppHomePage(app.appId)">
<div class="thumbnail hover"> <div class="thumbnail hover">
<h4 ng-bind="app.appId"></h4> <h4 ng-bind="app.appId"></h4>
...@@ -101,41 +103,35 @@ ...@@ -101,41 +103,35 @@
</div> </div>
</aside> </aside>
</section> </section>
</div> </div>
<div ng-include="'views/common/footer.html'"></div> <div ng-include="'views/common/footer.html'"></div>
<!--angular--> <!--angular-->
<script src="vendor/angular/angular.min.js"></script> <script src="vendor/angular/angular.min.js"></script>
<script src="vendor/angular/angular-resource.min.js"></script> <script src="vendor/angular/angular-resource.min.js"></script>
<script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script>
<script src="vendor/angular/loading-bar.min.js"></script> <script src="vendor/angular/loading-bar.min.js"></script>
<script src="vendor/angular/angular-cookies.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script> <!-- jquery.js -->
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script> <script src="vendor/jquery.min.js" type="text/javascript"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script> <script src="vendor/select2/select2.min.js" type="text/javascript"></script>
<!-- jquery.js --> <!-- bootstrap.js -->
<script src="vendor/jquery.min.js" type="text/javascript"></script> <script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="vendor/select2/select2.min.js" type="text/javascript"></script>
<!-- bootstrap.js --> <script type="application/javascript" src="scripts/app.js"></script>
<script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></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/UserService.js"></script>
<script type="application/javascript" src="scripts/services/CommonService.js"></script>
<script type="application/javascript" src="scripts/services/FavoriteService.js"></script>
<script type="application/javascript" src="scripts/services/PermissionService.js"></script>
<script type="application/javascript" src="scripts/AppUtils.js"></script>
<script type="application/javascript" src="scripts/directive/directive.js"></script>
<script type="application/javascript" src="scripts/app.js"></script> <script type="application/javascript" src="scripts/controller/IndexController.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/UserService.js"></script>
<script type="application/javascript" src="scripts/services/CommonService.js"></script>
<script type="application/javascript" src="scripts/services/FavoriteService.js"></script>
<script type="application/javascript" src="scripts/services/PermissionService.js"></script>
<script type="application/javascript" src="scripts/AppUtils.js"></script>
<script type="application/javascript" src="scripts/directive/directive.js"></script>
<script type="application/javascript" src="scripts/controller/IndexController.js"></script>
</body> </body>
</html> </html>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<html lang="en" ng-app="login"> <html lang="en" ng-app="login">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>{{ 'Common.Title' | translate }}</title> <title>Apollo配置中心</title>
<link rel="icon" href="./img/config.png"> <link rel="icon" href="./img/config.png">
<link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="vendor/font-awesome.min.css"> <link rel="stylesheet" href="vendor/font-awesome.min.css">
...@@ -257,7 +257,7 @@ ...@@ -257,7 +257,7 @@
</div> </div>
<div class="col-xs-12 form-group pull-right"> <div class="col-xs-12 form-group pull-right">
<input type="submit" name="login-submit" id="login-submit" tabindex="4" <input type="submit" name="login-submit" id="login-submit" tabindex="4"
class="form-control btn btn-login" value="{{'Login.Login' | translate }}"> class="form-control btn btn-login" value="登录">
</div> </div>
</form> </form>
</div> </div>
...@@ -277,11 +277,6 @@ ...@@ -277,11 +277,6 @@
<script src="vendor/angular/angular-resource.min.js"></script> <script src="vendor/angular/angular-resource.min.js"></script>
<script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script> <script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script>
<script src="vendor/angular/loading-bar.min.js"></script> <script src="vendor/angular/loading-bar.min.js"></script>
<script src="vendor/angular/angular-cookies.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script>
<script type="application/javascript" src="scripts/app.js"></script> <script type="application/javascript" src="scripts/app.js"></script>
<script type="application/javascript" src="scripts/AppUtils.js"></script> <script type="application/javascript" src="scripts/AppUtils.js"></script>
......
appUtil.service('AppUtil', ['toastr', '$window', '$q', '$translate', function (toastr, $window, $q, $translate) { appUtil.service('AppUtil', ['toastr', '$window', '$q', function (toastr, $window, $q) {
function parseErrorMsg(response) { function parseErrorMsg(response) {
if (response.status == -1) { if (response.status == -1) {
return $translate.instant('Common.LoginExpiredTips'); return "您的登录信息已过期,请刷新页面后重试";
} }
var msg = "Code:" + response.status; var msg = "Code:" + response.status;
if (response.data.message != null) { if (response.data.message != null) {
...@@ -13,7 +13,7 @@ appUtil.service('AppUtil', ['toastr', '$window', '$q', '$translate', function (t ...@@ -13,7 +13,7 @@ appUtil.service('AppUtil', ['toastr', '$window', '$q', '$translate', function (t
function parsePureErrorMsg(response) { function parsePureErrorMsg(response) {
if (response.status == -1) { if (response.status == -1) {
return $translate.instant('Common.LoginExpiredTips'); return "您的登录信息已过期,请刷新页面后重试";
} }
if (response.data.message != null) { if (response.data.message != null) {
return response.data.message; return response.data.message;
...@@ -92,7 +92,7 @@ appUtil.service('AppUtil', ['toastr', '$window', '$q', '$translate', function (t ...@@ -92,7 +92,7 @@ appUtil.service('AppUtil', ['toastr', '$window', '$q', '$translate', function (t
hideModal: function (modal) { hideModal: function (modal) {
$(modal).modal("hide"); $(modal).modal("hide");
}, },
checkIPV4: function (ip) { checkIPV4:function (ip) {
return /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$|^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/.test(ip); return /^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^(([a-zA-Z]|[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z]|[A-Za-z][A-Za-z0-9\-]*[A-Za-z0-9])$|^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/.test(ip);
} }
} }
......
/**utils*/ /**utils*/
var appUtil = angular.module('app.util', ['toastr', 'ngCookies', 'pascalprecht.translate']) var appUtil = angular.module('app.util', ['toastr']);
.config(['$translateProvider', function ($translateProvider) {
$translateProvider.useSanitizeValueStrategy(null); // disable sanitization by default
$translateProvider.useCookieStorage();
$translateProvider.useStaticFilesLoader({
prefix: '/i18n/',
suffix: '.json'
});
$translateProvider.registerAvailableLanguageKeys(['en', 'zh-CN'], {
'zh-*': 'zh-CN',
'zh': 'zh-CN',
'en-*': 'en',
"*": "en"
})
$translateProvider.uniformLanguageTag('bcp47').determinePreferredLanguage();
}]);
/**service module 定义*/ /**service module 定义*/
var appService = angular.module('app.service', ['ngResource', 'app.util']) var appService = angular.module('app.service', ['ngResource']);
/** directive */ /** directive */
var directive_module = angular.module('apollo.directive', ['app.service', 'app.util', 'toastr', 'pascalprecht.translate']); var directive_module = angular.module('apollo.directive', ['app.service', 'app.util', 'toastr']);
/** page module 定义*/ /** page module 定义*/
// 首页 // 首页
var index_module = angular.module('index', ['toastr', 'app.service', 'apollo.directive', 'app.util', 'angular-loading-bar', 'pascalprecht.translate']); var index_module = angular.module('index', ['toastr', 'app.service', 'apollo.directive', 'app.util', 'angular-loading-bar']);
//项目主页 //项目主页
var application_module = angular.module('application', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar', 'valdr', 'ui.ace', 'ngSanitize']); var application_module = angular.module('application', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar', 'valdr', 'ui.ace']);
//创建项目页面 //创建项目页面
var app_module = angular.module('create_app', ['apollo.directive', 'toastr', 'app.service', 'app.util', 'angular-loading-bar', 'valdr','pascalprecht.translate']); var app_module = angular.module('create_app', ['apollo.directive', 'toastr', 'app.service', 'app.util', 'angular-loading-bar', 'valdr']);
//配置同步页面 //配置同步页面
var sync_item_module = angular.module('sync_item', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar']); var sync_item_module = angular.module('sync_item', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar']);
// 比较页面 // 比较页面
...@@ -43,7 +27,7 @@ var setting_module = angular.module('setting', ['app.service', 'apollo.directive ...@@ -43,7 +27,7 @@ var setting_module = angular.module('setting', ['app.service', 'apollo.directive
//role //role
var role_module = angular.module('role', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar']); var role_module = angular.module('role', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar']);
//cluster //cluster
var cluster_module = angular.module('cluster', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar', 'valdr']); var cluster_module = angular.module('cluster', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar' , 'valdr']);
//release history //release history
var release_history_module = angular.module('release_history', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar']); var release_history_module = angular.module('release_history', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar']);
//open manage //open manage
...@@ -51,7 +35,7 @@ var open_manage_module = angular.module('open_manage', ['app.service', 'apollo.d ...@@ -51,7 +35,7 @@ var open_manage_module = angular.module('open_manage', ['app.service', 'apollo.d
//user //user
var user_module = angular.module('user', ['apollo.directive', 'toastr', 'app.service', 'app.util', 'angular-loading-bar', 'valdr']); var user_module = angular.module('user', ['apollo.directive', 'toastr', 'app.service', 'app.util', 'angular-loading-bar', 'valdr']);
//login //login
var login_module = angular.module('login', ['app.service', 'toastr', 'app.util', 'pascalprecht.translate']); var login_module = angular.module('login', ['toastr', 'app.util']);
//delete app cluster namespace //delete app cluster namespace
var delete_app_cluster_namespace_module = angular.module('delete_app_cluster_namespace', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar']); var delete_app_cluster_namespace_module = angular.module('delete_app_cluster_namespace', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar']);
//system info //system info
......
app_module.controller('CreateAppController', app_module.controller('CreateAppController',
['$scope', '$window', '$translate', 'toastr', 'AppService', 'AppUtil', 'OrganizationService', 'SystemRoleService', 'UserService', ['$scope', '$window', 'toastr', 'AppService', 'AppUtil', 'OrganizationService','SystemRoleService','UserService',
createAppController]); createAppController]);
function createAppController($scope, $window, $translate, toastr, AppService, AppUtil, OrganizationService, SystemRoleService, UserService) { function createAppController($scope, $window, toastr, AppService, AppUtil, OrganizationService, SystemRoleService, UserService) {
$scope.app = {}; $scope.app = {};
$scope.submitBtnDisabled = false; $scope.submitBtnDisabled = false;
...@@ -27,7 +27,7 @@ function createAppController($scope, $window, $translate, toastr, AppService, Ap ...@@ -27,7 +27,7 @@ function createAppController($scope, $window, $translate, toastr, AppService, Ap
organizations.push(org); organizations.push(org);
}); });
$('#organization').select2({ $('#organization').select2({
placeholder: $translate.instant('Common.PleaseChooseDepartment'), placeholder: '请选择部门',
width: '100%', width: '100%',
data: organizations data: organizations
}); });
...@@ -60,7 +60,7 @@ function createAppController($scope, $window, $translate, toastr, AppService, Ap ...@@ -60,7 +60,7 @@ function createAppController($scope, $window, $translate, toastr, AppService, Ap
var selectedOrg = $('#organization').select2('data')[0]; var selectedOrg = $('#organization').select2('data')[0];
if (!selectedOrg.id) { if (!selectedOrg.id) {
toastr.warning($translate.instant('Common.PleaseChooseDepartment')); toastr.warning("请选择部门");
$scope.submitBtnDisabled = false; $scope.submitBtnDisabled = false;
return; return;
} }
...@@ -71,10 +71,10 @@ function createAppController($scope, $window, $translate, toastr, AppService, Ap ...@@ -71,10 +71,10 @@ function createAppController($scope, $window, $translate, toastr, AppService, Ap
// owner // owner
var owner = $('.ownerSelector').select2('data')[0]; var owner = $('.ownerSelector').select2('data')[0];
if ($scope.isOpenManageAppMasterRoleLimit) { if ($scope.isOpenManageAppMasterRoleLimit) {
owner = { id: $scope.currentUser.userId }; owner = {id: $scope.currentUser.userId};
} }
if (!owner) { if (!owner) {
toastr.warning($translate.instant('Common.PleaseChooseOwner')); toastr.warning("请选择应用负责人");
$scope.submitBtnDisabled = false; $scope.submitBtnDisabled = false;
return; return;
} }
...@@ -84,7 +84,7 @@ function createAppController($scope, $window, $translate, toastr, AppService, Ap ...@@ -84,7 +84,7 @@ function createAppController($scope, $window, $translate, toastr, AppService, Ap
$scope.app.admins = []; $scope.app.admins = [];
var admins = $(".adminSelector").select2('data'); var admins = $(".adminSelector").select2('data');
if ($scope.isOpenManageAppMasterRoleLimit) { if ($scope.isOpenManageAppMasterRoleLimit) {
admins = [{ id: $scope.currentUser.userId }]; admins = [{id: $scope.currentUser.userId}];
} }
if (admins) { if (admins) {
admins.forEach(function (admin) { admins.forEach(function (admin) {
...@@ -93,14 +93,14 @@ function createAppController($scope, $window, $translate, toastr, AppService, Ap ...@@ -93,14 +93,14 @@ function createAppController($scope, $window, $translate, toastr, AppService, Ap
} }
AppService.create($scope.app).then(function (result) { AppService.create($scope.app).then(function (result) {
toastr.success($translate.instant('Common.Created')); toastr.success('创建成功!');
setInterval(function () { setInterval(function () {
$scope.submitBtnDisabled = false; $scope.submitBtnDisabled = false;
$window.location.href = '/config.html?#appid=' + result.appId; $window.location.href = '/config.html?#appid=' + result.appId;
}, 1000); }, 1000);
}, function (result) { }, function (result) {
$scope.submitBtnDisabled = false; $scope.submitBtnDisabled = false;
toastr.error(AppUtil.errorMsg(result), $translate.instant('Common.CreateFailed')); toastr.error(AppUtil.errorMsg(result), '创建失败!');
}); });
} }
......
cluster_module.controller('ClusterController', cluster_module.controller('ClusterController',
['$scope', '$location', '$window', '$translate', 'toastr', 'AppService', 'EnvService', 'ClusterService', ['$scope', '$location', '$window', 'toastr', 'AppService', 'EnvService', 'ClusterService',
'AppUtil', 'AppUtil',
function ($scope, $location, $window, $translate, toastr, AppService, EnvService, ClusterService, function ($scope, $location, $window, toastr, AppService, EnvService, ClusterService,
AppUtil) { AppUtil) {
var params = AppUtil.parseParams($location.$$url); var params = AppUtil.parseParams($location.$$url);
...@@ -14,12 +14,12 @@ cluster_module.controller('ClusterController', ...@@ -14,12 +14,12 @@ cluster_module.controller('ClusterController',
EnvService.find_all_envs().then(function (result) { EnvService.find_all_envs().then(function (result) {
$scope.envs = []; $scope.envs = [];
result.forEach(function (env) { result.forEach(function (env) {
$scope.envs.push({ name: env, checked: false }); $scope.envs.push({name: env, checked: false});
}); });
$(".apollo-container").removeClass("hidden"); $(".apollo-container").removeClass("hidden");
}, function (result) { }, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Cluster.LoadingEnvironmentError')); toastr.error(AppUtil.errorMsg(result), "加载环境信息出错");
}); });
$scope.clusterName = ''; $scope.clusterName = '';
...@@ -45,18 +45,18 @@ cluster_module.controller('ClusterController', ...@@ -45,18 +45,18 @@ cluster_module.controller('ClusterController',
name: $scope.clusterName, name: $scope.clusterName,
appId: $scope.appId appId: $scope.appId
}).then(function (result) { }).then(function (result) {
toastr.success(env.name, $translate.instant('Cluster.ClusterCreated')); toastr.success(env.name, "集群创建成功");
$scope.step = 2; $scope.step = 2;
$scope.submitBtnDisabled = false; $scope.submitBtnDisabled = false;
}, function (result) { }, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('Cluster.ClusterCreateFailed')); toastr.error(AppUtil.errorMsg(result), "集群创建失败");
$scope.submitBtnDisabled = false; $scope.submitBtnDisabled = false;
}) })
} }
}); });
if (noEnvChecked) { if (noEnvChecked){
toastr.warning($translate.instant('Cluster.PleaseChooseEnvironment')); toastr.warning("请选择环境");
} }
}; };
......
index_module.controller('IndexController', ['$scope', '$window', '$translate', 'toastr', 'AppUtil', 'AppService', index_module.controller('IndexController', ['$scope', '$window', 'toastr', 'AppUtil', 'AppService',
'UserService', 'FavoriteService', 'UserService', 'FavoriteService',
IndexController]); IndexController]);
function IndexController($scope, $window, $translate, toastr, AppUtil, AppService, UserService, FavoriteService) { function IndexController($scope, $window, toastr, AppUtil, AppService, UserService, FavoriteService) {
$scope.userId = ''; $scope.userId = '';
...@@ -21,7 +21,7 @@ function IndexController($scope, $window, $translate, toastr, AppUtil, AppServic ...@@ -21,7 +21,7 @@ function IndexController($scope, $window, $translate, toastr, AppUtil, AppServic
$scope.hasCreateApplicationPermission = value.hasCreateApplicationPermission; $scope.hasCreateApplicationPermission = value.hasCreateApplicationPermission;
}, },
function (reason) { function (reason) {
toastr.warning(AppUtil.errorMsg(reason), $translate.instant('Index.GetCreateAppRoleFailed')); toastr.warning(AppUtil.errorMsg(reason), "获取创建应用权限信息失败");
} }
) )
} }
...@@ -70,7 +70,7 @@ function IndexController($scope, $window, $translate, toastr, AppUtil, AppServic ...@@ -70,7 +70,7 @@ function IndexController($scope, $window, $translate, toastr, AppUtil, AppServic
$scope.favoritesPage += 1; $scope.favoritesPage += 1;
$scope.hasMoreFavorites = result.length == size; $scope.hasMoreFavorites = result.length == size;
if ($scope.favoritesPage == 1) { if ($scope.favoritesPage == 1){
$("#app-list").removeClass("hidden"); $("#app-list").removeClass("hidden");
} }
...@@ -92,7 +92,7 @@ function IndexController($scope, $window, $translate, toastr, AppUtil, AppServic ...@@ -92,7 +92,7 @@ function IndexController($scope, $window, $translate, toastr, AppUtil, AppServic
}); });
result.forEach(function (favorite) { result.forEach(function (favorite) {
var app = appIdMapApp[favorite.appId]; var app = appIdMapApp[favorite.appId];
if (!app) { if (!app){
return; return;
} }
app.favoriteId = favorite.id; app.favoriteId = favorite.id;
...@@ -122,7 +122,7 @@ function IndexController($scope, $window, $translate, toastr, AppUtil, AppServic ...@@ -122,7 +122,7 @@ function IndexController($scope, $window, $translate, toastr, AppUtil, AppServic
userVisitedApps.forEach(function (appId) { userVisitedApps.forEach(function (appId) {
var app = appIdMapApp[appId]; var app = appIdMapApp[appId];
if (app) { if (app){
$scope.visitedApps.push(app); $scope.visitedApps.push(app);
} }
}); });
...@@ -145,7 +145,7 @@ function IndexController($scope, $window, $translate, toastr, AppUtil, AppServic ...@@ -145,7 +145,7 @@ function IndexController($scope, $window, $translate, toastr, AppUtil, AppServic
function toTop(favoriteId) { function toTop(favoriteId) {
FavoriteService.toTop(favoriteId).then(function () { FavoriteService.toTop(favoriteId).then(function () {
toastr.success($translate.instant('Index.Topped')); toastr.success("置顶成功");
refreshFavorites(); refreshFavorites();
}) })
...@@ -153,7 +153,7 @@ function IndexController($scope, $window, $translate, toastr, AppUtil, AppServic ...@@ -153,7 +153,7 @@ function IndexController($scope, $window, $translate, toastr, AppUtil, AppServic
function deleteFavorite(favoriteId) { function deleteFavorite(favoriteId) {
FavoriteService.deleteFavorite(favoriteId).then(function () { FavoriteService.deleteFavorite(favoriteId).then(function () {
toastr.success($translate.instant('Index.CancelledFavorite')); toastr.success("取消收藏成功");
refreshFavorites(); refreshFavorites();
}) })
} }
......
login_module.controller('LoginController', login_module.controller('LoginController',
['$scope', '$window', '$location', '$translate', 'toastr', 'AppUtil', ['$scope', '$window', '$location', 'toastr', 'AppUtil',
LoginController]); LoginController]);
function LoginController($scope, $window, $location, $translate, toastr, AppUtil) { function LoginController($scope, $window, $location, toastr, AppUtil) {
if ($location.$$url) { if ($location.$$url) {
var params = AppUtil.parseParams($location.$$url); var params = AppUtil.parseParams($location.$$url);
if (params.error) { if (params.error) {
$translate('Login.UserNameOrPasswordIncorrect').then(function(result) { $scope.info = "用户名或密码错误";
$scope.info = result;
});
} }
if (params.logout) { if (params.logout) {
$translate('Login.LogoutSuccessfully').then(function(result) { $scope.info = "登出成功";
$scope.info = result;
});
} }
} }
......
user_module.controller('UserController', user_module.controller('UserController',
['$scope', '$window', '$translate', 'toastr', 'AppUtil', 'UserService', ['$scope', '$window', 'toastr', 'AppUtil', 'UserService',
UserController]); UserController]);
function UserController($scope, $window, $translate, toastr, AppUtil, UserService) { function UserController($scope, $window, toastr, AppUtil, UserService) {
$scope.user = {}; $scope.user = {};
$scope.createOrUpdateUser = function () { $scope.createOrUpdateUser = function () {
UserService.createOrUpdateUser($scope.user).then(function (result) { UserService.createOrUpdateUser($scope.user).then(function (result) {
toastr.success($translate.instant('UserMange.Created')); toastr.success("创建用户成功");
}, function (result) { }, function (result) {
AppUtil.showErrorMsg(result, $translate.instant('UserMange.CreateFailed')); AppUtil.showErrorMsg(result, "创建用户失败");
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment