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

init i18n support

parent 5cfdd0d1
......@@ -271,7 +271,7 @@ public class AuthConfiguration {
http.csrf().disable();
http.headers().frameOptions().sameOrigin();
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);
http.formLogin().loginPage("/signin").defaultSuccessUrl("/", true).permitAll().failureUrl("/signin?#/error").and()
.httpBasic();
......@@ -403,7 +403,7 @@ public class AuthConfiguration {
http.csrf().disable();
http.headers().frameOptions().sameOrigin();
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();
http.formLogin().loginPage("/signin").defaultSuccessUrl("/", true).permitAll().failureUrl("/signin?#/error").and()
.httpBasic();
......
......@@ -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" href="styles/common-style.css">
<title>新建项目</title>
<title>{{'App.CreateProject' | translate }}</title>
</head>
<body>
......@@ -22,7 +22,7 @@
<div class="col-md-8 col-md-offset-2">
<div class="panel">
<header class="panel-heading">
创建项目
{{'App.CreateProject' | translate }}
</header>
<form class="form-horizontal panel-body" name="appForm" ng-controller="CreateAppController"
......@@ -31,7 +31,7 @@
<div class="form-group">
<label class="col-sm-3 control-label">
<apollorequiredfield></apollorequiredfield>
部门</label>
{{'Common.Department' | translate }}</label>
<div class="col-sm-3">
<select id="organization">
<option></option>
......@@ -41,43 +41,44 @@
<div class="form-group" valdr-form-group>
<label class="col-sm-3 control-label">
<apollorequiredfield></apollorequiredfield>
应用Id</label>
{{'Common.AppId' | translate }}</label>
<div class="col-sm-3">
<input type="text" class="form-control" name="appId" ng-model="app.appId">
<small>(应用唯一标识)</small>
<small>{{'App.AppIdTips' | translate }}
</small>
</div>
</div>
<div class="form-group" valdr-form-group>
<label class="col-sm-3 control-label">
<apollorequiredfield></apollorequiredfield>
应用名称</label>
{{'Common.AppName' | translate }}</label>
<div class="col-sm-5">
<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 class="form-group">
<label class="col-sm-3 control-label">
<apollorequiredfield></apollorequiredfield>
应用负责人</label>
{{'Common.AppOwner' | translate }}</label>
<div class="col-sm-6 J_ownerSelectorPanel">
<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 class="form-group">
<label class="col-sm-3 control-label">项目管理员<br>
<label class="col-sm-3 control-label">{{'Common.AppAdmin' | translate }}<br>
</label>
<div class="col-sm-9 J_adminSelectorPanel">
<apollomultipleuserselector apollo-id="'adminSelector'" ng-disabled="isOpenManageAppMasterRoleLimit"></apollomultipleuserselector>
<br>
<small>(应用负责人默认具有项目管理员权限,</small>
<small>{{'App.AppAdminTips1' | translate }}</small>
<br>
<small>项目管理员可以创建Namespace和集群、分配用户权限)</small>
<small>{{'App.AppAdminTips2' | translate }}</small>
</div>
</div>
......@@ -86,7 +87,7 @@
<div class="col-sm-offset-3 col-sm-9">
<button type="submit" class="btn btn-primary"
ng-disabled="appForm.$invalid || submitBtnDisabled">提交
ng-disabled="appForm.$invalid || submitBtnDisabled">{{'Common.Submit' | translate }}
</button>
</div>
</div>
......@@ -104,6 +105,11 @@
<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>
<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 -->
<script src="vendor/jquery.min.js" type="text/javascript"></script>
......
......@@ -9,7 +9,7 @@
<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" href="styles/common-style.css">
<title>新建集群</title>
<title>{{'Cluster.CreateCluster' | translate }}</title>
</head>
<body>
......@@ -23,10 +23,10 @@
<header class="panel-heading">
<div class="row">
<div class="col-md-6">
<h4>创建集群</h4>
<h4>{{'Cluster.CreateCluster' | translate }}</h4>
</div>
<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>
</div>
</div>
......@@ -39,13 +39,10 @@
<div class="alert alert-info no-radius" role="alert">
<strong>Tips:</strong>
<ul>
<li>通过添加集群,可以使同一份程序在不同的集群(如不同的数据中心)使用不同的配置</li>
<li>如果不同集群使用一样的配置,则没有必要创建集群</li>
<li>
Apollo默认会读取机器上/opt/settings/server.properties(linux)或C:\opt\settings\server.properties(windows)文件中的idc属性作为集群名字,
如SHAJQ(金桥数据中心)、SHAOY(欧阳数据中心)
</li>
<li>在这里创建的集群名字需要和机器上server.properties中的idc属性一致</li>
<li>{{'Cluster.Tips.1' | translate }}</li>
<li>{{'Cluster.Tips.2' | translate }}</li>
<li>{{'Cluster.Tips.3' | translate }}</li>
<li>{{'Cluster.Tips.4' | translate }}</li>
</ul>
</div>
<form class="form-horizontal" name="clusterForm" valdr-type="Cluster" ng-show="step == 1"
......@@ -53,7 +50,7 @@
<div class="form-group">
<label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield>
应用AppId</label>
{{'Common.AppId' | translate }}</label>
<div class="col-sm-6">
<label class="form-control-static" ng-bind="appId"></label>
</div>
......@@ -61,16 +58,16 @@
<div class="form-group" valdr-form-group>
<label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield>
集群名称</label>
{{'Common.ClusterName' | translate }}</label>
<div class="col-sm-6">
<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 class="form-group">
<label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield>
选择环境</label>
{{'Cluster.ChooseEnvironment' | translate }}</label>
<div class="col-sm-5">
<table class="table table-hover" style="width: 100px">
<tbody>
......@@ -89,14 +86,14 @@
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary"
ng-disabled="clusterForm.$invalid || submitBtnDisabled">提交
ng-disabled="clusterForm.$invalid || submitBtnDisabled">{{'Common.Submit' | translate }}
</button>
</div>
</div>
</form>
<div class="row text-center" ng-show="step == 2">
<img src="img/sync-succ.png" style="height: 100px; width: 100px">
<h3>创建成功!</h3>
<h3>{{'Common.Created' | translate }}!</h3>
</div>
</div>
</div>
......@@ -111,6 +108,11 @@
<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>
<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 -->
<script src="vendor/jquery.min.js" type="text/javascript"></script>
......
This diff is collapsed.
This diff is collapsed.
......@@ -2,7 +2,7 @@
<html lang="en" ng-app="login">
<head>
<meta charset="UTF-8">
<title>Apollo配置中心</title>
<title>{{ 'Common.Title' | translate }}</title>
<link rel="icon" href="./img/config.png">
<link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="vendor/font-awesome.min.css">
......@@ -257,7 +257,7 @@
</div>
<div class="col-xs-12 form-group pull-right">
<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>
</form>
</div>
......@@ -277,6 +277,11 @@
<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>
<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/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) {
if (response.status == -1) {
return "您的登录信息已过期,请刷新页面后重试";
return $translate.instant('Common.LoginExprieTips');
}
var msg = "Code:" + response.status;
if (response.data.message != null) {
......@@ -13,7 +13,7 @@ appUtil.service('AppUtil', ['toastr', '$window', '$q', function (toastr, $window
function parsePureErrorMsg(response) {
if (response.status == -1) {
return "您的登录信息已过期,请刷新页面后重试";
return $translate.instant('Common.LoginExprieTips');
}
if (response.data.message != null) {
return response.data.message;
......@@ -25,23 +25,23 @@ appUtil.service('AppUtil', ['toastr', '$window', '$q', function (toastr, $window
var d = $q.defer();
if (requestBody) {
resource(requestParams, requestBody, function (result) {
d.resolve(result);
},
function (result) {
d.reject(result);
});
d.resolve(result);
},
function (result) {
d.reject(result);
});
} else {
resource(requestParams, function (result) {
d.resolve(result);
},
function (result) {
d.reject(result);
});
d.resolve(result);
},
function (result) {
d.reject(result);
});
}
return d.promise;
}
return {
errorMsg: parseErrorMsg,
pureErrorMsg: parsePureErrorMsg,
......@@ -92,7 +92,7 @@ appUtil.service('AppUtil', ['toastr', '$window', '$q', function (toastr, $window
hideModal: function (modal) {
$(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);
}
}
......
/**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 定义*/
var appService = angular.module('app.service', ['ngResource']);
var appService = angular.module('app.service', ['ngResource', 'app.util'])
/** 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 定义*/
// 首页
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']);
// 比较页面
......@@ -27,7 +39,7 @@ var setting_module = angular.module('setting', ['app.service', 'apollo.directive
//role
var role_module = angular.module('role', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar']);
//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
var release_history_module = angular.module('release_history', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar']);
//open manage
......@@ -35,7 +47,7 @@ var open_manage_module = angular.module('open_manage', ['app.service', 'apollo.d
//user
var user_module = angular.module('user', ['apollo.directive', 'toastr', 'app.service', 'app.util', 'angular-loading-bar', 'valdr']);
//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
var delete_app_cluster_namespace_module = angular.module('delete_app_cluster_namespace', ['app.service', 'apollo.directive', 'app.util', 'toastr', 'angular-loading-bar']);
//system info
......
app_module.controller('CreateAppController',
['$scope', '$window', 'toastr', 'AppService', 'AppUtil', 'OrganizationService','SystemRoleService','UserService',
createAppController]);
['$scope', '$window', '$translate', 'toastr', 'AppService', 'AppUtil', 'OrganizationService', 'SystemRoleService', 'UserService',
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.submitBtnDisabled = false;
......@@ -27,10 +27,10 @@ function createAppController($scope, $window, toastr, AppService, AppUtil, Organ
organizations.push(org);
});
$('#organization').select2({
placeholder: '请选择部门',
width: '100%',
data: organizations
});
placeholder: $translate.instant('Common.PelaseChooseDepartment'),
width: '100%',
data: organizations
});
}, function (result) {
toastr.error(AppUtil.errorMsg(result), "load organizations error");
});
......@@ -60,7 +60,7 @@ function createAppController($scope, $window, toastr, AppService, AppUtil, Organ
var selectedOrg = $('#organization').select2('data')[0];
if (!selectedOrg.id) {
toastr.warning("请选择部门");
toastr.warning($translate.instant('Common.PelaseChooseDepartment'));
$scope.submitBtnDisabled = false;
return;
}
......@@ -71,10 +71,10 @@ function createAppController($scope, $window, toastr, AppService, AppUtil, Organ
// owner
var owner = $('.ownerSelector').select2('data')[0];
if ($scope.isOpenManageAppMasterRoleLimit) {
owner = {id: $scope.currentUser.userId};
owner = { id: $scope.currentUser.userId };
}
if (!owner) {
toastr.warning("请选择应用负责人");
toastr.warning($translate.instant('Common.PelaseChooseOwner'));
$scope.submitBtnDisabled = false;
return;
}
......@@ -84,7 +84,7 @@ function createAppController($scope, $window, toastr, AppService, AppUtil, Organ
$scope.app.admins = [];
var admins = $(".adminSelector").select2('data');
if ($scope.isOpenManageAppMasterRoleLimit) {
admins = [{id: $scope.currentUser.userId}];
admins = [{ id: $scope.currentUser.userId }];
}
if (admins) {
admins.forEach(function (admin) {
......@@ -93,14 +93,14 @@ function createAppController($scope, $window, toastr, AppService, AppUtil, Organ
}
AppService.create($scope.app).then(function (result) {
toastr.success('创建成功!');
toastr.success($translate.instant('Common.Created'));
setInterval(function () {
$scope.submitBtnDisabled = false;
$window.location.href = '/config.html?#appid=' + result.appId;
}, 1000);
}, function (result) {
$scope.submitBtnDisabled = false;
toastr.error(AppUtil.errorMsg(result), '创建失败!');
toastr.error(AppUtil.errorMsg(result), $translate.instant('Common.CreateFailed'));
});
}
......
index_module.controller('IndexController', ['$scope', '$window', 'toastr', 'AppUtil', 'AppService',
'UserService', 'FavoriteService',
IndexController]);
index_module.controller('IndexController', ['$scope', '$window', '$translate', 'toastr', 'AppUtil', 'AppService',
'UserService', 'FavoriteService',
IndexController]);
function IndexController($scope, $window, toastr, AppUtil, AppService, UserService, FavoriteService) {
function IndexController($scope, $window, $translate, toastr, AppUtil, AppService, UserService, FavoriteService) {
$scope.userId = '';
......@@ -15,13 +15,13 @@ function IndexController($scope, $window, toastr, AppUtil, AppService, UserServi
$scope.toTop = toTop;
$scope.deleteFavorite = deleteFavorite;
function initCreateApplicationPermission() {
function initCreateApplicationPermission() {
AppService.has_create_application_role($scope.userId).then(
function (value) {
$scope.hasCreateApplicationPermission = value.hasCreateApplicationPermission;
},
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
$scope.favoritesPage += 1;
$scope.hasMoreFavorites = result.length == size;
if ($scope.favoritesPage == 1){
if ($scope.favoritesPage == 1) {
$("#app-list").removeClass("hidden");
}
......@@ -92,7 +92,7 @@ function IndexController($scope, $window, toastr, AppUtil, AppService, UserServi
});
result.forEach(function (favorite) {
var app = appIdMapApp[favorite.appId];
if (!app){
if (!app) {
return;
}
app.favoriteId = favorite.id;
......@@ -122,7 +122,7 @@ function IndexController($scope, $window, toastr, AppUtil, AppService, UserServi
userVisitedApps.forEach(function (appId) {
var app = appIdMapApp[appId];
if (app){
if (app) {
$scope.visitedApps.push(app);
}
});
......@@ -145,7 +145,7 @@ function IndexController($scope, $window, toastr, AppUtil, AppService, UserServi
function toTop(favoriteId) {
FavoriteService.toTop(favoriteId).then(function () {
toastr.success("置顶成功");
toastr.success($translate.instant('Index.Topped'));
refreshFavorites();
})
......@@ -153,7 +153,7 @@ function IndexController($scope, $window, toastr, AppUtil, AppService, UserServi
function deleteFavorite(favoriteId) {
FavoriteService.deleteFavorite(favoriteId).then(function () {
toastr.success("取消收藏成功");
toastr.success($translate.instant('Index.CancelledFavorite'));
refreshFavorites();
})
}
......
login_module.controller('LoginController',
['$scope', '$window', '$location', 'toastr', 'AppUtil',
LoginController]);
['$scope', '$window', '$location', '$translate', 'toastr', 'AppUtil',
LoginController]);
function LoginController($scope, $window, $location, toastr, AppUtil) {
function LoginController($scope, $window, $location, $translate, toastr, AppUtil) {
if ($location.$$url) {
var params = AppUtil.parseParams($location.$$url);
if (params.error) {
$scope.info = "用户名或密码错误";
$translate('Login.UserNameOrPasswordIncorrect').then(function(result) {
$scope.info = result;
})
}
if (params.logout) {
$scope.info = "登出成功";
$scope.info = $translate.instant('Login.LogoutSuccessfully');
}
}
......
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