Commit aee511ba authored by czd890's avatar czd890 Committed by Jason Song

init i18n support

parent 5cfdd0d1
...@@ -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/**").permitAll() .antMatchers("/prometheus/**","/metrics/**","/openapi/**", "/vendor/**", "/styles/**", "/scripts/**", "/views/**", "/img/**", "/i18n/**").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/**").permitAll() .antMatchers("/prometheus/**","/metrics/**","/openapi/**", "/vendor/**", "/styles/**", "/scripts/**", "/views/**", "/img/**", "/i18n/**").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();
......
...@@ -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>新建项目</title> <title>{{'App.CreateProject' | translate }}</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>
部门</label> {{'Common.Department' | translate }}</label>
<div class="col-sm-3"> <div class="col-sm-3">
<select id="organization"> <select id="organization">
<option></option> <option></option>
...@@ -41,43 +41,44 @@ ...@@ -41,43 +41,44 @@
<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>
应用Id</label> {{'Common.AppId' | translate }}</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>(应用唯一标识)</small> <small>{{'App.AppIdTips' | translate }}
</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>
应用名称</label> {{'Common.AppName' | translate }}</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>(建议格式 xx-yy-zz 例:apollo-server)</small> <small>{{'App.AppNameTips' | translate }}</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>
应用负责人</label> {{'Common.AppOwner' | translate }}</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">(开启项目管理员分配权限控制后,应用负责人和项目管理员默认为本账号,不可选择)</small> <small style="color: maroon" ng-if="isOpenManageAppMasterRoleLimit">{{'App.AppOwnerTips' | translate }}</small>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-3 control-label">项目管理员<br> <label class="col-sm-3 control-label">{{'Common.AppAdmin' | translate }}<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>(应用负责人默认具有项目管理员权限,</small> <small>{{'App.AppAdminTips1' | translate }}</small>
<br> <br>
<small>项目管理员可以创建Namespace和集群、分配用户权限)</small> <small>{{'App.AppAdminTips2' | translate }}</small>
</div> </div>
</div> </div>
...@@ -86,7 +87,7 @@ ...@@ -86,7 +87,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">提交 ng-disabled="appForm.$invalid || submitBtnDisabled">{{'Common.Submit' | translate }}
</button> </button>
</div> </div>
</div> </div>
...@@ -104,6 +105,11 @@ ...@@ -104,6 +105,11 @@
<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>新建集群</title> <title>{{'Cluster.CreateCluster' | translate }}</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>创建集群</h4> <h4>{{'Cluster.CreateCluster' | translate }}</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}}">返回到项目首页 <a type="button" class="btn btn-info" href="/config.html?#/appid={{appId}}">{{'Common.ReturnToIndex' | translate }}
</a> </a>
</div> </div>
</div> </div>
...@@ -39,13 +39,10 @@ ...@@ -39,13 +39,10 @@
<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>通过添加集群,可以使同一份程序在不同的集群(如不同的数据中心)使用不同的配置</li> <li>{{'Cluster.Tips.1' | translate }}</li>
<li>如果不同集群使用一样的配置,则没有必要创建集群</li> <li>{{'Cluster.Tips.2' | translate }}</li>
<li> <li>{{'Cluster.Tips.3' | translate }}</li>
Apollo默认会读取机器上/opt/settings/server.properties(linux)或C:\opt\settings\server.properties(windows)文件中的idc属性作为集群名字, <li>{{'Cluster.Tips.4' | translate }}</li>
如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"
...@@ -53,7 +50,7 @@ ...@@ -53,7 +50,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>
应用AppId</label> {{'Common.AppId' | translate }}</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>
...@@ -61,16 +58,16 @@ ...@@ -61,16 +58,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>
集群名称</label> {{'Common.ClusterName' | translate }}</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>(部署集群如:SHAJQ,SHAOY 或自定义集群如:SHAJQ-xx,SHAJQ-yy)</small> <small>{{'Cluster.CreaterNameTips' | translate }}</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>
选择环境</label> {{'Cluster.ChooseEnvironment' | translate }}</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>
...@@ -89,14 +86,14 @@ ...@@ -89,14 +86,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">提交 ng-disabled="clusterForm.$invalid || submitBtnDisabled">{{'Common.Submit' | translate }}
</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>创建成功!</h3> <h3>{{'Common.Created' | translate }}!</h3>
</div> </div>
</div> </div>
</div> </div>
...@@ -111,6 +108,11 @@ ...@@ -111,6 +108,11 @@
<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.
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">
...@@ -11,24 +12,25 @@ ...@@ -11,24 +12,25 @@
<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>Apollo配置中心</title> <title>{{'Common.Title' | translate }}</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>我的项目</h5> <h5>{{'Index.MyProject' | translate }}</h5>
</aside> </aside>
<aside class="media-body"> <aside class="media-body">
<div class="app-panel col-md-2 text-center" ng-click="goToCreateAppPage()" ng-if="hasCreateApplicationPermission"> <div class="app-panel col-md-2 text-center" ng-click="goToCreateAppPage()"
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>创建项目</h5> <h5>{{'Index.CreateProject' | translate }}</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"
...@@ -41,8 +43,8 @@ ...@@ -41,8 +43,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>加载更多</h5> <h5>{{'Index.LoadingMore' | translate }}</h5>
</div> </div>
</div> </div>
</aside> </aside>
...@@ -50,39 +52,36 @@ ...@@ -50,39 +52,36 @@
<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>收藏的项目</h5> <h5>{{'Index.FavoriteItems' | translate }}</h5>
</aside> </aside>
<aside class="media-body"> <aside class="media-body">
<div class="app-panel col-md-2 text-center" <div class="app-panel col-md-2 text-center" ng-repeat="app in favorites"
ng-repeat="app in favorites" ng-click="goToAppHomePage(app.appId)" ng-mouseover="toggleOperationBtn(app)"
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="置顶" <button class="btn btn-default btn-xs" title="{{'Index.Topping' | translate }}"
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="取消收藏" <button class="btn btn-default btn-xs" title="{{'Index.FavoriteCancel' | translate }}"
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" <div class="col-md-2 text-center" ng-show="hasMoreFavorites" ng-click="getUserFavorites()">
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>加载更多</h5> <h5>{{'Index.LoadingMore' | translate }}</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>您还没有收藏过任何项目,在项目主页可以收藏项目哟~</h4> <h4>{{'Index.FavoriteTip' | translate }}</h4>
</div> </div>
</aside> </aside>
...@@ -90,11 +89,10 @@ ...@@ -90,11 +89,10 @@
<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>最近浏览的项目</h5> <h5>{{'Index.RecentyViewedItems' | translate }}</h5>
</aside> </aside>
<aside class="media-body"> <aside class="media-body">
<div class="app-panel col-md-2 text-center" <div class="app-panel col-md-2 text-center" ng-repeat="app in visitedApps"
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>
...@@ -103,35 +101,45 @@ ...@@ -103,35 +101,45 @@
</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-->
<script src="vendor/angular/angular.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/loading-bar.min.js"></script>
<script src="vendor/angular/angular-cookies.min.js"></script>
<!--angular--> <script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script>
<script src="vendor/angular/angular.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-resource.min.js"></script> <script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.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>
<!-- jquery.js --> <!--<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-translate/2.18.1/angular-translate.min.js"></script>-->
<script src="vendor/jquery.min.js" type="text/javascript"></script> <!--<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-translate/2.18.1/angular-translate-storage-cookie/angular-translate-storage-cookie.min.js"></script>-->
<script src="vendor/select2/select2.min.js" type="text/javascript"></script> <!--<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-translate/2.18.1/angular-translate-loader-static-files/angular-translate-loader-static-files.min.js"></script>-->
<!-- bootstrap.js --> <!-- jquery.js -->
<script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script> <script src="vendor/jquery.min.js" type="text/javascript"></script>
<script src="vendor/select2/select2.min.js" type="text/javascript"></script>
<script type="application/javascript" src="scripts/app.js"></script> <!-- bootstrap.js -->
<script type="application/javascript" src="scripts/services/AppService.js"></script> <script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></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> <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/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>
\ No newline at end of file
...@@ -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>Apollo配置中心</title> <title>{{ 'Common.Title' | translate }}</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="登录"> class="form-control btn btn-login" value="{{'Login.Login' | translate }}">
</div> </div>
</form> </form>
</div> </div>
...@@ -277,6 +277,11 @@ ...@@ -277,6 +277,11 @@
<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', function (toastr, $window, $q) { appUtil.service('AppUtil', ['toastr', '$window', '$q', '$translate', function (toastr, $window, $q, $translate) {
function parseErrorMsg(response) { function parseErrorMsg(response) {
if (response.status == -1) { if (response.status == -1) {
return "您的登录信息已过期,请刷新页面后重试"; return $translate.instant('Common.LoginExprieTips');
} }
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', function (toastr, $window ...@@ -13,7 +13,7 @@ appUtil.service('AppUtil', ['toastr', '$window', '$q', function (toastr, $window
function parsePureErrorMsg(response) { function parsePureErrorMsg(response) {
if (response.status == -1) { if (response.status == -1) {
return "您的登录信息已过期,请刷新页面后重试"; return $translate.instant('Common.LoginExprieTips');
} }
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', function (toastr, $window ...@@ -92,7 +92,7 @@ appUtil.service('AppUtil', ['toastr', '$window', '$q', function (toastr, $window
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']); var appUtil = angular.module('app.util', ['toastr', 'ngCookies', 'pascalprecht.translate'])
.config(['$translateProvider', function ($translateProvider) {
// $translateProvider.useMissingTranslationHandlerLog();
$translateProvider.useCookieStorage();
$translateProvider.useStaticFilesLoader({
prefix: '/i18n/',
suffix: '.json'
});
$translateProvider.preferredLanguage('en');
$translateProvider.fallbackLanguage('zh-cn');
}]);
/**service module 定义*/ /**service module 定义*/
var appService = angular.module('app.service', ['ngResource']); var appService = angular.module('app.service', ['ngResource', 'app.util'])
/** directive */ /** directive */
var directive_module = angular.module('apollo.directive', ['app.service', 'app.util', 'toastr']); var directive_module = angular.module('apollo.directive', ['app.service', 'app.util', 'toastr', 'pascalprecht.translate']);
/** page module 定义*/ /** page module 定义*/
// 首页 // 首页
var index_module = angular.module('index', ['toastr', 'app.service', 'apollo.directive', 'app.util', 'angular-loading-bar']); var index_module = angular.module('index', ['toastr', 'app.service', 'apollo.directive', 'app.util', 'angular-loading-bar', 'pascalprecht.translate']);
//项目主页 //项目主页
var application_module = angular.module('application', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar', 'valdr', 'ui.ace']); var application_module = angular.module('application', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar', 'valdr', 'ui.ace', 'ngSanitize']);
//创建项目页面 //创建项目页面
var app_module = angular.module('create_app', ['apollo.directive', 'toastr', 'app.service', 'app.util', 'angular-loading-bar', 'valdr']); var app_module = angular.module('create_app', ['apollo.directive', 'toastr', 'app.service', 'app.util', 'angular-loading-bar', 'valdr','pascalprecht.translate']);
//配置同步页面 //配置同步页面
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']);
// 比较页面 // 比较页面
...@@ -27,7 +39,7 @@ var setting_module = angular.module('setting', ['app.service', 'apollo.directive ...@@ -27,7 +39,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
...@@ -35,7 +47,7 @@ var open_manage_module = angular.module('open_manage', ['app.service', 'apollo.d ...@@ -35,7 +47,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', ['toastr', 'app.util']); var login_module = angular.module('login', ['app.service', 'toastr', 'app.util', 'pascalprecht.translate']);
//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', 'toastr', 'AppService', 'AppUtil', 'OrganizationService','SystemRoleService','UserService', ['$scope', '$window', '$translate', 'toastr', 'AppService', 'AppUtil', 'OrganizationService', 'SystemRoleService', 'UserService',
createAppController]); createAppController]);
function createAppController($scope, $window, toastr, AppService, AppUtil, OrganizationService, SystemRoleService, UserService) { function createAppController($scope, $window, $translate, toastr, AppService, AppUtil, OrganizationService, SystemRoleService, UserService) {
$scope.app = {}; $scope.app = {};
$scope.submitBtnDisabled = false; $scope.submitBtnDisabled = false;
...@@ -27,7 +27,7 @@ function createAppController($scope, $window, toastr, AppService, AppUtil, Organ ...@@ -27,7 +27,7 @@ function createAppController($scope, $window, toastr, AppService, AppUtil, Organ
organizations.push(org); organizations.push(org);
}); });
$('#organization').select2({ $('#organization').select2({
placeholder: '请选择部门', placeholder: $translate.instant('Common.PelaseChooseDepartment'),
width: '100%', width: '100%',
data: organizations data: organizations
}); });
...@@ -60,7 +60,7 @@ function createAppController($scope, $window, toastr, AppService, AppUtil, Organ ...@@ -60,7 +60,7 @@ function createAppController($scope, $window, toastr, AppService, AppUtil, Organ
var selectedOrg = $('#organization').select2('data')[0]; var selectedOrg = $('#organization').select2('data')[0];
if (!selectedOrg.id) { if (!selectedOrg.id) {
toastr.warning("请选择部门"); toastr.warning($translate.instant('Common.PelaseChooseDepartment'));
$scope.submitBtnDisabled = false; $scope.submitBtnDisabled = false;
return; return;
} }
...@@ -71,10 +71,10 @@ function createAppController($scope, $window, toastr, AppService, AppUtil, Organ ...@@ -71,10 +71,10 @@ function createAppController($scope, $window, toastr, AppService, AppUtil, Organ
// 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("请选择应用负责人"); toastr.warning($translate.instant('Common.PelaseChooseOwner'));
$scope.submitBtnDisabled = false; $scope.submitBtnDisabled = false;
return; return;
} }
...@@ -84,7 +84,7 @@ function createAppController($scope, $window, toastr, AppService, AppUtil, Organ ...@@ -84,7 +84,7 @@ function createAppController($scope, $window, toastr, AppService, AppUtil, Organ
$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, toastr, AppService, AppUtil, Organ ...@@ -93,14 +93,14 @@ function createAppController($scope, $window, toastr, AppService, AppUtil, Organ
} }
AppService.create($scope.app).then(function (result) { AppService.create($scope.app).then(function (result) {
toastr.success('创建成功!'); toastr.success($translate.instant('Common.Created'));
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), '创建失败!'); toastr.error(AppUtil.errorMsg(result), $translate.instant('Common.CreateFailed'));
}); });
} }
......
cluster_module.controller('ClusterController', cluster_module.controller('ClusterController',
['$scope', '$location', '$window', 'toastr', 'AppService', 'EnvService', 'ClusterService', ['$scope', '$location', '$window', '$translate', 'toastr', 'AppService', 'EnvService', 'ClusterService',
'AppUtil', 'AppUtil',
function ($scope, $location, $window, toastr, AppService, EnvService, ClusterService, function ($scope, $location, $window, $translate, 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), "加载环境信息出错"); toastr.error(AppUtil.errorMsg(result), $translate.instant('Cluster.LoadingEnvironmentError'));
}); });
$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, "集群创建成功"); toastr.success(env.name, $translate.instant('Cluster.ClusterCreated'));
$scope.step = 2; $scope.step = 2;
$scope.submitBtnDisabled = false; $scope.submitBtnDisabled = false;
}, function (result) { }, function (result) {
toastr.error(AppUtil.errorMsg(result), "集群创建失败"); toastr.error(AppUtil.errorMsg(result), $translate.instant('Cluster.ClusterCreateFailed'));
$scope.submitBtnDisabled = false; $scope.submitBtnDisabled = false;
}) })
} }
}); });
if (noEnvChecked){ if (noEnvChecked) {
toastr.warning("请选择环境"); toastr.warning($translate.instant('Cluster.PleaseChooseEnvironment'));
} }
}; };
......
delete_app_cluster_namespace_module.controller('DeleteAppClusterNamespaceController', delete_app_cluster_namespace_module.controller('DeleteAppClusterNamespaceController',
['$scope', 'toastr', 'AppUtil', 'AppService', 'ClusterService', 'NamespaceService', 'PermissionService', ['$scope', '$translate', 'toastr', 'AppUtil', 'AppService', 'ClusterService', 'NamespaceService', 'PermissionService',
DeleteAppClusterNamespaceController]); DeleteAppClusterNamespaceController]);
function DeleteAppClusterNamespaceController($scope, toastr, AppUtil, AppService, ClusterService, NamespaceService, PermissionService) { function DeleteAppClusterNamespaceController($scope, $translate, toastr, AppUtil, AppService, ClusterService, NamespaceService, PermissionService) {
$scope.app = {}; $scope.app = {};
$scope.deleteAppBtnDisabled = true; $scope.deleteAppBtnDisabled = true;
...@@ -30,7 +30,7 @@ function DeleteAppClusterNamespaceController($scope, toastr, AppUtil, AppService ...@@ -30,7 +30,7 @@ function DeleteAppClusterNamespaceController($scope, toastr, AppUtil, AppService
function getAppInfo() { function getAppInfo() {
if (!$scope.app.appId) { if (!$scope.app.appId) {
toastr.warning("请输入appId"); toastr.warning($translate.instant('Delete.PleaseEnterAppId'));
return; return;
} }
...@@ -38,12 +38,18 @@ function DeleteAppClusterNamespaceController($scope, toastr, AppUtil, AppService ...@@ -38,12 +38,18 @@ function DeleteAppClusterNamespaceController($scope, toastr, AppUtil, AppService
AppService.load($scope.app.appId).then(function (result) { AppService.load($scope.app.appId).then(function (result) {
if (!result.appId) { if (!result.appId) {
toastr.warning("AppId: " + $scope.app.appId + " 不存在!"); toastr.warning($translate.instant('Delete.AppIdNotFound', { appId: $scope.app.appId }));
$scope.deleteAppBtnDisabled = true; $scope.deleteAppBtnDisabled = true;
return; return;
} }
$scope.app.info = "应用名:" + result.name + " 部门:" + result.orgName + '(' + result.orgId + ')' + " 负责人:" + result.ownerName; $scope.app.info = $translate.instant('Delete.AppInfoContent', {
appName: result.name,
departmentName: result.orgName,
departmentId: result.orgId,
ownerName: result.ownerName
});
$scope.deleteAppBtnDisabled = false; $scope.deleteAppBtnDisabled = false;
}, function (result) { }, function (result) {
...@@ -53,12 +59,12 @@ function DeleteAppClusterNamespaceController($scope, toastr, AppUtil, AppService ...@@ -53,12 +59,12 @@ function DeleteAppClusterNamespaceController($scope, toastr, AppUtil, AppService
function deleteApp() { function deleteApp() {
if (!$scope.app.appId) { if (!$scope.app.appId) {
toastr.warning("请输入appId"); toastr.warning($translate.instant('Delete.PleaseEnterAppId'));
return; return;
} }
if (confirm("确认删除AppId: " + $scope.app.appId + "")) { if (confirm($translate.instant('Delete.PleaseEnterAppId', { appId: $scope.app.appId }))) {
AppService.delete_app($scope.app.appId).then(function (result) { AppService.delete_app($scope.app.appId).then(function (result) {
toastr.success("删除成功"); toastr.success($translate.instant('Delete.Deleted'));
$scope.deleteAppBtnDisabled = true; $scope.deleteAppBtnDisabled = true;
}, function (result) { }, function (result) {
AppUtil.showErrorMsg(result); AppUtil.showErrorMsg(result);
...@@ -68,14 +74,18 @@ function DeleteAppClusterNamespaceController($scope, toastr, AppUtil, AppService ...@@ -68,14 +74,18 @@ function DeleteAppClusterNamespaceController($scope, toastr, AppUtil, AppService
function getClusterInfo() { function getClusterInfo() {
if (!$scope.cluster.appId || !$scope.cluster.env || !$scope.cluster.name) { if (!$scope.cluster.appId || !$scope.cluster.env || !$scope.cluster.name) {
toastr.warning("请输入appId、环境和集群名称"); toastr.warning($translate.instant('Delete.PleaseEnterAppIdAndEnvAndCluster'));
return; return;
} }
$scope.cluster.info = ""; $scope.cluster.info = "";
ClusterService.load_cluster($scope.cluster.appId, $scope.cluster.env, $scope.cluster.name).then(function (result) { ClusterService.load_cluster($scope.cluster.appId, $scope.cluster.env, $scope.cluster.name).then(function (result) {
$scope.cluster.info = "AppId:" + result.appId+ " 环境:" + $scope.cluster.env + " 集群名称:" + result.name; $scope.cluster.info = $translate.instant('Delete.ClusterInfoContent', {
appId: result.appId,
env: $scope.cluster.env,
clusterName: result.name
});
$scope.deleteClusterBtnDisabled = false; $scope.deleteClusterBtnDisabled = false;
}, function (result) { }, function (result) {
...@@ -85,12 +95,18 @@ function DeleteAppClusterNamespaceController($scope, toastr, AppUtil, AppService ...@@ -85,12 +95,18 @@ function DeleteAppClusterNamespaceController($scope, toastr, AppUtil, AppService
function deleteCluster() { function deleteCluster() {
if (!$scope.cluster.appId || !$scope.cluster.env || !$scope.cluster.name) { if (!$scope.cluster.appId || !$scope.cluster.env || !$scope.cluster.name) {
toastr.warning("请输入appId、环境和集群名称"); toastr.warning($translate.instant('Delete.PleaseEnterAppIdAndEnvAndCluster'));
return; return;
} }
if (confirm("确认删除集群?appId: " + $scope.cluster.appId + " 环境:" + $scope.cluster.env + " 集群名称:" + $scope.cluster.name)) { var confirmTip = $translate.instant('Delete.ConfirmDeleteCluster', {
appId: result.appId,
env: $scope.cluster.env,
clusterName: result.name
});
if (confirm(confirmTip)) {
ClusterService.delete_cluster($scope.cluster.appId, $scope.cluster.env, $scope.cluster.name).then(function (result) { ClusterService.delete_cluster($scope.cluster.appId, $scope.cluster.env, $scope.cluster.name).then(function (result) {
toastr.success("删除成功"); toastr.success($translate.instant('Delete.Deleted'));
$scope.deleteClusterBtnDisabled = true; $scope.deleteClusterBtnDisabled = true;
}, function (result) { }, function (result) {
AppUtil.showErrorMsg(result); AppUtil.showErrorMsg(result);
...@@ -100,14 +116,18 @@ function DeleteAppClusterNamespaceController($scope, toastr, AppUtil, AppService ...@@ -100,14 +116,18 @@ function DeleteAppClusterNamespaceController($scope, toastr, AppUtil, AppService
function getAppNamespaceInfo() { function getAppNamespaceInfo() {
if (!$scope.appNamespace.appId || !$scope.appNamespace.name) { if (!$scope.appNamespace.appId || !$scope.appNamespace.name) {
toastr.warning("请输入appId和AppNamespace名称"); toastr.warning($translate.instant('Delete.PleaseEnterAppIdAndNamespace'));
return; return;
} }
$scope.appNamespace.info = ""; $scope.appNamespace.info = "";
NamespaceService.loadAppNamespace($scope.appNamespace.appId, $scope.appNamespace.name).then(function (result) { NamespaceService.loadAppNamespace($scope.appNamespace.appId, $scope.appNamespace.name).then(function (result) {
$scope.appNamespace.info = "AppId:" + result.appId+ " AppNamespace名称:" + result.name + " isPublic:" + result.isPublic; $scope.appNamespace.info = $translate.instant('Delete.AppNamespaceInfoContent', {
appId: result.appId,
namespace: result.name,
isPublic: result.isPublic
});
$scope.deleteAppNamespaceBtnDisabled = false; $scope.deleteAppNamespaceBtnDisabled = false;
}, function (result) { }, function (result) {
...@@ -117,12 +137,16 @@ function DeleteAppClusterNamespaceController($scope, toastr, AppUtil, AppService ...@@ -117,12 +137,16 @@ function DeleteAppClusterNamespaceController($scope, toastr, AppUtil, AppService
function deleteAppNamespace() { function deleteAppNamespace() {
if (!$scope.appNamespace.appId || !$scope.appNamespace.name) { if (!$scope.appNamespace.appId || !$scope.appNamespace.name) {
toastr.warning("请输入appId和AppNamespace名称"); toastr.warning($translate.instant('Delete.PleaseEnterAppIdAndNamespace'));
return; return;
} }
if (confirm("确认删除所有环境的AppNamespace和Namespace?appId: " + $scope.appNamespace.appId + " 环境:所有环境" + " AppNamespace名称:" + $scope.appNamespace.name)) { var confirmTip = $translate.instant('Delete.ConfirmDeleteNamespace', {
appId: $scope.appNamespace.appId,
namespace: $scope.appNamespace.name
});
if (confirm(confirmTip)) {
NamespaceService.deleteAppNamespace($scope.appNamespace.appId, $scope.appNamespace.name).then(function (result) { NamespaceService.deleteAppNamespace($scope.appNamespace.appId, $scope.appNamespace.name).then(function (result) {
toastr.success("删除成功"); toastr.success($translate.instant('Delete.Deleted'));
$scope.deleteAppNamespaceBtnDisabled = true; $scope.deleteAppNamespaceBtnDisabled = true;
}, function (result) { }, function (result) {
AppUtil.showErrorMsg(result); AppUtil.showErrorMsg(result);
......
index_module.controller('IndexController', ['$scope', '$window', 'toastr', 'AppUtil', 'AppService', index_module.controller('IndexController', ['$scope', '$window', '$translate', 'toastr', 'AppUtil', 'AppService',
'UserService', 'FavoriteService', 'UserService', 'FavoriteService',
IndexController]); IndexController]);
function IndexController($scope, $window, toastr, AppUtil, AppService, UserService, FavoriteService) { function IndexController($scope, $window, $translate, toastr, AppUtil, AppService, UserService, FavoriteService) {
$scope.userId = ''; $scope.userId = '';
...@@ -21,7 +21,7 @@ function IndexController($scope, $window, toastr, AppUtil, AppService, UserServi ...@@ -21,7 +21,7 @@ function IndexController($scope, $window, toastr, AppUtil, AppService, UserServi
$scope.hasCreateApplicationPermission = value.hasCreateApplicationPermission; $scope.hasCreateApplicationPermission = value.hasCreateApplicationPermission;
}, },
function (reason) { function (reason) {
toastr.warning(AppUtil.errorMsg(reason), "获取创建应用权限信息失败"); toastr.warning(AppUtil.errorMsg(reason), $translate.instant('Index.GetCreateAppRoleFailed'));
} }
) )
} }
...@@ -70,7 +70,7 @@ function IndexController($scope, $window, toastr, AppUtil, AppService, UserServi ...@@ -70,7 +70,7 @@ function IndexController($scope, $window, toastr, AppUtil, AppService, UserServi
$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, toastr, AppUtil, AppService, UserServi ...@@ -92,7 +92,7 @@ function IndexController($scope, $window, toastr, AppUtil, AppService, UserServi
}); });
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, toastr, AppUtil, AppService, UserServi ...@@ -122,7 +122,7 @@ function IndexController($scope, $window, toastr, AppUtil, AppService, UserServi
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, toastr, AppUtil, AppService, UserServi ...@@ -145,7 +145,7 @@ function IndexController($scope, $window, toastr, AppUtil, AppService, UserServi
function toTop(favoriteId) { function toTop(favoriteId) {
FavoriteService.toTop(favoriteId).then(function () { FavoriteService.toTop(favoriteId).then(function () {
toastr.success("置顶成功"); toastr.success($translate.instant('Index.Topped'));
refreshFavorites(); refreshFavorites();
}) })
...@@ -153,7 +153,7 @@ function IndexController($scope, $window, toastr, AppUtil, AppService, UserServi ...@@ -153,7 +153,7 @@ function IndexController($scope, $window, toastr, AppUtil, AppService, UserServi
function deleteFavorite(favoriteId) { function deleteFavorite(favoriteId) {
FavoriteService.deleteFavorite(favoriteId).then(function () { FavoriteService.deleteFavorite(favoriteId).then(function () {
toastr.success("取消收藏成功"); toastr.success($translate.instant('Index.CancelledFavorite'));
refreshFavorites(); refreshFavorites();
}) })
} }
......
login_module.controller('LoginController', login_module.controller('LoginController',
['$scope', '$window', '$location', 'toastr', 'AppUtil', ['$scope', '$window', '$location', '$translate', 'toastr', 'AppUtil',
LoginController]); LoginController]);
function LoginController($scope, $window, $location, toastr, AppUtil) { function LoginController($scope, $window, $location, $translate, 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) {
$scope.info = "用户名或密码错误"; $translate('Login.UserNameOrPasswordIncorrect').then(function(result) {
$scope.info = result;
})
} }
if (params.logout) { if (params.logout) {
$scope.info = "登出成功"; $scope.info = $translate.instant('Login.LogoutSuccessfully');
} }
} }
......
user_module.controller('UserController', user_module.controller('UserController',
['$scope', '$window', 'toastr', 'AppUtil', 'UserService', ['$scope', '$window', '$translate', 'toastr', 'AppUtil', 'UserService',
UserController]); UserController]);
function UserController($scope, $window, toastr, AppUtil, UserService) { function UserController($scope, $window, $translate, 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("创建用户成功"); toastr.success($translate.instant('UserMange.Created'));
}, function (result) { }, function (result) {
AppUtil.showErrorMsg(result, "创建用户失败"); AppUtil.showErrorMsg(result, $translate.instant('UserMange.CreateFailed'));
}) })
} }
......
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