update for applying i18n to sync image of UI.

This commit is contained in:
kunw 2016-06-20 19:15:45 +08:00
parent 96a9106beb
commit 4131a6c702
12 changed files with 123 additions and 71 deletions

View File

@ -9,74 +9,75 @@
<div class="modal-body">
<div class="create-policy">
<div class="col-md-12">
<h4>General</h4>
<h4>// 'general_setting' | tr //</h4>
<hr class="hr-line"/>
</div>
<div class="form-group col-md-12 form-group-custom">
<label for="name" class="col-md-3 control-label">Name:</label>
<label for="name" class="col-md-3 control-label">// 'name' | tr //:</label>
<div class="col-md-9">
<input type="text" class="form-control form-control-custom" id="name" ng-model="replication.policy.name" name="uName" required>
<input type="text" class="form-control form-control-custom" id="name" ng-model="replication.policy.name" name="uName" required maxlength="20">
<div ng-messages="form.$submitted && form.uName.$error">
<span ng-message="required">Name is required.</span>
<span ng-message="required">// 'name_is_required' | tr //</span>
<span ng-message="maxlength">// 'name_is_too_long' | tr //</span>
</div>
</div>
</div>
<div class="form-group col-md-12 form-group-custom">
<label for="description" class="col-md-3 control-label">Description:</label>
<label for="description" class="col-md-3 control-label">// 'description' | tr //:</label>
<div class="col-md-9">
<textarea class="form-control form-control-custom" id="description" ng-model="replication.policy.description" name="uDescription" required></textarea>
<textarea class="form-control form-control-custom" id="description" ng-model="replication.policy.description" name="uDescription" maxlength="20"></textarea>
<div ng-messages="form.$submitted && form.uDescription.$error">
<span ng-message="required">Description is required.</span>
<span ng-message="maxlength">// 'description_is_too_long' | tr //</span>
</div>
</div>
</div>
<div class="form-group col-md-12 form-group-custom">
<label for="enable" class="col-md-3 control-label">Enable:</label>
<label for="enable" class="col-md-3 control-label">// 'enable' | tr //:</label>
<div class="col-md-9">
<input type="checkbox" class="form-control" style="margin-top: 10px; height: auto;" ng-model="replication.policy.enabled">
</div>
</div>
<div class="col-md-12">
<h4 class="h4-custom">Destination Setting</h4>
<h4 class="h4-custom">// 'destination_setting' | tr //</h4>
<hr class="hr-line"/>
</div>
<div class="form-group col-md-12 form-group-custom">
<label for="destinationName" class="col-md-3 control-label">Name:</label>
<label for="destinationName" class="col-md-3 control-label">// 'name' | tr //:</label>
<div class="col-md-7">
<select class="form-control form-control-custom" id="destinationName" ng-model="replication.destination.selection" ng-options="d as d.name for d in vm.destinations track by d.id" ng-click="vm.selectDestination(replication.destination.selection)"></select>
</div>
</div>
<div class="form-group col-md-12 form-group-custom">
<label for="endpoint" class="col-md-3 control-label">Endpoint:</label>
<label for="endpoint" class="col-md-3 control-label">// 'endpoint' | tr //:</label>
<div class="col-md-9">
<input type="text" class="form-control form-control-custom" id="endpoint" ng-model="replication.destination.endpoint" name="uEndpoint" ng-value="vm.endpoint" required>
<div ng-messages="form.$submitted && form.uEndpoint.$error">
<span ng-message="required">Endpoint is required.</span>
<span ng-message="required">// 'endpoint_is_required' | tr //</span>
</div>
</div>
</div>
<div class="form-group col-md-12 form-group-custom">
<label for="username" class="col-md-3 control-label">Username:</label>
<label for="username" class="col-md-3 control-label">// 'username' | tr //:</label>
<div class="col-md-9">
<input type="text" class="form-control" id="username" ng-model="replication.destination.username" name="uUsername" ng-value="vm.username" required>
<div ng-messages="form.$submitted && form.uUsername.$error">
<span ng-message="required">Username is required.</span>
<span ng-message="required">// 'username_is_required' | tr //</span>
</div>
</div>
</div>
<div class="form-group col-md-12 form-group-custom">
<label for="password" class="col-md-3 control-label">Password:</label>
<label for="password" class="col-md-3 control-label">// 'password' | tr //:</label>
<div class="col-md-9">
<input type="password" class="form-control" id="password" ng-model="replication.destination.password" name="uPassword" ng-value="vm.password" required>
<div ng-messages="form.$submitted && form.uPassword.$error">
<span ng-message="required">Password is required.</span>
<span ng-message="required">// 'password_is_required' | tr //</span>
</div>
</div>
</div>
<div class="form-group col-md-12 form-group-custom">
<div class="col-md-3"></div>
<div class="col-md-9">
<button type="button" class="btn btn-default" ng-click="vm.pingDestination()">Test Connection</button>
<button type="button" class="btn btn-default" ng-click="vm.pingDestination()">// 'test_connection' | tr //</button>
</div>
</div>
</div>

View File

@ -7,23 +7,23 @@
<button class="btn btn-primary" type="button" ng-click="vm.searchReplicationPolicy()"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div>
<button ng-if="!vm.isOpen" class="btn btn-success" type="button" ng-click="vm.addReplication()" data-toggle="modal" data-target="#createPolicyModal"><span class="glyphicon glyphicon-plus"></span>New Replication</button>
<button ng-if="!vm.isOpen" class="btn btn-success" type="button" ng-click="vm.addReplication()" data-toggle="modal" data-target="#createPolicyModal"><span class="glyphicon glyphicon-plus"></span>// 'add_new_replication' | tr //</button>
<create-policy reload="vm.retrievePolicy()" action="vm.action" modal-title="//vm.modalTitle//" policy-id="//vm.policyId//"></create-policy>
</div>
<div class="pane-split" id="upon-pane">
<div class="sub-pane-split">
<table class="table table-pane">
<thead>
<th width="10%">Name</th>
<th width="18%">Description</th>
<th width="18%">Destination</th>
<th width="18%">Start Time</th>
<th width="14%">Activation</th>
<th width="15%">Actions</th>
<th width="10%">// 'name' | tr //</th>
<th width="18%">// 'description' | tr //</th>
<th width="18%">// 'destination' | tr //</th>
<th width="18%">// 'start_time' | tr //</th>
<th width="14%">// 'activation' | tr// </th>
<th width="15%">// 'actions' | tr //</th>
</thead>
<tbody>
<tr ng-if="vm.replicationPolicies.length == 0">
<td colspan="7" height="100%" class="empty-hint" ><h3 class="text-muted">No replication policies, add new replication policy.</h3></td>
<td colspan="7" height="100%" class="empty-hint" ><h3 class="text-muted">// 'no_replication_policies' | tr //</h3></td>
</tr>
<tr policy_id="//r.id//" ng-if="vm.replicationPolicies.length > 0" ng-repeat="r in vm.replicationPolicies" value="//vm.last = $last//">
<td>//r.name//</td>
@ -31,8 +31,8 @@
<td>//r.target_name//</td>
<td>//r.start_time | dateL : 'YYYY-MM-DD HH:mm:ss'//</td>
<td ng-switch on="//r.enabled//">
<span ng-switch-when="1">Enabled</span>
<span ng-switch-when="0">Disabled</span>
<span ng-switch-when="1">// 'enabled' | tr //</span>
<span ng-switch-when="0">// 'disabled' | tr //</span>
</td>
<td>
<div class="display-inline-block" ng-switch on="//r.enabled//">
@ -51,7 +51,7 @@
</div>
<div class="col-xs-4 col-md-12 well well-sm well-custom well-split"><div class="col-md-offset-10">//vm.replicationPolicies ? vm.replicationPolicies.length : 0// // 'items' | tr //</div></div>
<p class="split-handle"><span class="glyphicon glyphicon-align-justify"></span></p>
<h4 class="h4-custom-down">Replication Jobs</h4>
<h4 class="h4-custom-down">// 'replication_jobs' | tr //</h4>
<hr class="hr-line"/>
<div class="form-inline">
<div class="input-group">
@ -65,15 +65,15 @@
<div class="sub-pane-split">
<table class="table table-pane" width="98%">
<thead>
<th width="20%">Name</th>
<th width="25%">Operation</th>
<th width="25%">Start Time</th>
<th width="15%">Status</th>
<th width="15%">Logs</th>
<th width="20%">// 'name' | tr //</th>
<th width="25%">// 'operation' | tr //</th>
<th width="25%">// 'start_time' | tr //</th>
<th width="15%">// 'status' | tr //</th>
<th width="15%">// 'logs' | tr //</th>
</thead>
<tbody>
<tr ng-if="vm.replicationJobs.length == 0">
<td colspan="4" height="100%" class="empty-hint" ><h3 class="text-muted">No replication jobs.</h3></td>
<td colspan="4" height="100%" class="empty-hint" ><h3 class="text-muted">// 'no_replication_jobs' | tr //</h3></td>
</tr>
<tr ng-if="vm.replicationJobs.length > 0" ng-repeat="r in vm.replicationJobs">
<td>//r.repository//</td>

View File

@ -9,48 +9,47 @@
<div class="modal-body">
<div class="create-destination">
<div class="form-group col-md-12 form-group-custom">
<label for="name" class="col-md-3 control-label">Name:</label>
<label for="name" class="col-md-3 control-label">// 'name' | tr //:</label>
<div class="col-md-9">
<input type="text" class="form-control form-control-custom" id="name" ng-model="destination.name" name="uName" required>
<div ng-messages="form.$submitted && form.uName.$error">
<span ng-message="required">Name is required.</span>
<span ng-message="required">// 'name_is_required' | tr //</span>
</div>
</div>
</div>
<div class="form-group col-md-12 form-group-custom">
<label for="description" class="col-md-3 control-label">Endpoint:</label>
<label for="description" class="col-md-3 control-label">// 'endpoint' | tr //:</label>
<div class="col-md-9">
<input type="text" class="form-control form-control-custom" id="endpoint" ng-model="destination.endpoint" name="uEndpoint" required >
<div ng-messages="form.$submitted && form.uEndpoint.$error">
<span ng-message="required">Endpoint is required.</span>
<span ng-message="required">// 'endpoint_is_required' | tr //</span>
</div>
</div>
</div>
<div class="form-group col-md-12 form-group-custom">
<label for="username" class="col-md-3 control-label">Username:</label>
<label for="username" class="col-md-3 control-label">// 'username' | tr //:</label>
<div class="col-md-9">
<input type="text" class="form-control" id="username" ng-model="destination.username" name="uUsername" required>
<div ng-messages="form.$submitted && form.uUsername.$error">
<span ng-message="required">Username is required.</span>
<span ng-message="required">// 'username_is_required' | tr //</span>
</div>
</div>
</div>
<div class="form-group col-md-12 form-group-custom">
<label for="password" class="col-md-3 control-label">Password:</label>
<label for="password" class="col-md-3 control-label">// 'password' | tr //:</label>
<div class="col-md-9">
<input type="password" class="form-control" id="password" ng-model="destination.password" name="uPassword" required>
<div ng-messages="form.$submitted && form.uPassword.$error">
<span ng-message="required">Password is required.</span>
<span ng-message="required">// 'password_is_required' | tr //</span>
</div>
</div>
</div>
<div class="form-group col-md-12 form-group-custom">
<div class="col-md-3"></div>
<div class="col-md-9">
<button type="submit" class="btn btn-default" ng-click="form.$valid && vm.pingDestination()">Test Connection</button>
<button type="submit" class="btn btn-default" ng-click="form.$valid && vm.pingDestination()">// 'test_connection' | tr //</button>
</div>
</div>
</div>
</div>
<div class="modal-footer">

View File

@ -7,7 +7,7 @@
<button class="btn btn-primary" type="button" ng-click="vm.search()"><span class="glyphicon glyphicon-search"></span></button>
</span>
</div>
<button ng-if="!vm.isOpen" class="btn btn-success" type="button" ng-click="vm.addDestination()" data-toggle="modal" data-target="#createDestinationModal"><span class="glyphicon glyphicon-plus"></span>New Destination</button>
<button ng-if="!vm.isOpen" class="btn btn-success" type="button" ng-click="vm.addDestination()" data-toggle="modal" data-target="#createDestinationModal"><span class="glyphicon glyphicon-plus"></span>// 'add_new_destination' | tr //</button>
<create-destination action="//vm.action//" target-id="//vm.targetId//" reload="vm.retrieve()"></create-destination>
</div>
<div class="pane">
@ -15,14 +15,14 @@
<div class="sub-pane">
<table class="table table-pane">
<thead>
<th width="20%">Name</th>
<th width="40%">Endpoint</th>
<th width="20%">Creation Time</th>
<th width="20%">Action</th>
<th width="20%">// 'name' | tr //</th>
<th width="40%">// 'endpoint' | tr //</th>
<th width="20%">// 'creation_time' | tr //</th>
<th width="20%">// 'actions' | tr //</th>
</thead>
<tbody>
<tr ng-if="vm.destinations.length == 0">
<td colspan="7" height="100%" class="empty-hint" ><h3 class="text-muted">No destinations, add new destination.</h3></td>
<td colspan="7" height="100%" class="empty-hint" ><h3 class="text-muted">// 'no_destinations' | tr //</h3></td>
</tr>
<tr ng-if="vm.destinations.length > 0" ng-repeat="r in vm.destinations">
<td>//r.name//</td>

View File

@ -52,7 +52,7 @@
}
function listDestinationSuccess(data, status) {
vm.destinations = data;
vm.destinations = data || [];
}
function listDestinationFailed(data, status) {

View File

@ -13,17 +13,17 @@
<div class="sub-pane">
<table class="table table-pane">
<thead>
<th width="14%">Name</th>
<th width="18%">Description</th>
<th width="14%">Project</th>
<th width="12%">Destination</th>
<th width="18%">Start Time</th>
<th width="12%">Activation</th>
<th width="12%">Actions</th>
<th width="14%">// 'name' | tr //</th>
<th width="18%">// 'description' | tr //</th>
<th width="14%">// 'projects' | tr //</th>
<th width="12%">// 'destination' | tr //</th>
<th width="18%">// 'start_time' | tr //</th>
<th width="12%">// 'activation' | tr //</th>
<th width="12%">// 'actions' | tr //</th>
</thead>
<tbody>
<tr ng-if="vm.replications.length == 0">
<td colspan="7" height="100%" class="empty-hint" ><h3 class="text-muted">No replications.</h3></td>
<td colspan="7" height="100%" class="empty-hint" ><h3 class="text-muted">// 'no_replications' | tr //</h3></td>
</tr>
<tr ng-if="vm.replications.length > 0" ng-repeat="r in vm.replications">
<td>//r.name//</td>
@ -31,7 +31,10 @@
<td>//r.project_name//</td>
<td>//r.target_name//</td>
<td>//r.start_time | dateL : 'YYYY-MM-DD HH:mm:ss'//</td>
<td>//r.enabled == 1 ? 'Enabled' : 'Disabled'//</td>
<td ng-switch on="//r.enabled//">
<span ng-switch-when="1">// 'enabled' | tr //</span>
<span ng-switch-when="0">// 'disabled' | tr //</span>
</td>
<td>
<div class="display-inline-block" ng-switch on="//r.enabled//">
<a href="javascript:void(0);" ng-click="vm.togglePolicy(r.id, 0)"><span ng-switch-when="1" class="glyphicon glyphicon-play color-success"></span></a>

View File

@ -1,6 +1,6 @@
<ul class="switch-pane-admin-options" role="tablist">
<li><a tag="destinations" href="#/destinations">Destinations</a><span class="gutter">|</span></li>
<li><a tag="replication" href="#/replication">Replication</a><span class="gutter">
<li><a tag="destinations" href="#/destinations">// 'destination' | tr //</a><span class="gutter">|</span></li>
<li><a tag="replication" href="#/replication">// 'replication' | tr //</a><span class="gutter">
<!--
<li><a tag="configuration" href="#/configuration">Configuration</a></li>
-->

View File

@ -1,5 +0,0 @@
<ul class="switch-pane-tabs" role="tablist">
<li><a tag="repositories" href="#/repositories?project_id=//vm.projectId//">// 'repositories' | tr //</a><span class="gutter">|</span></li>
<li><a tag="users" href="#/users?project_id=//vm.projectId//">// 'users' | tr //</a><span class="gutter">|</span></li>
<li><a tag="logs" href="#/logs?project_id=//vm.projectId//">// 'logs' | tr //</a></li>
</ul>

View File

@ -28,7 +28,8 @@
function link(scope, element, attrs, ctrl) {
var visited = ctrl.url;
if (visited !== "") {
console.log('visited:' + visited);
if (visited !== '' && visited !== '/') {
element.find('a[href*="' + visited + '"]').addClass('active');
}
element.find('a').on('click', click);

View File

@ -134,5 +134,31 @@ var locale_messages = {
'confirm_to_delete_user_title': 'Delete user',
'confirm_to_delete_user': 'Are you sure to delete the current user?',
'confirm_to_delete_destination_title': 'Delete destination',
'confirm_to_delete_destination': 'Are you sure to delete the current destination?'
'confirm_to_delete_destination': 'Are you sure to delete the current destination?',
'replication': 'Replication',
'add_new_replication': 'New Replication',
'name': 'Name',
'description': 'Description',
'destination': 'Destination',
'start_time': 'Start Time',
'activation': 'Activation',
'replication_jobs': 'Replication Jobs',
'actions': 'Actions',
'status': 'Status',
'logs' : 'Logs',
'enabled': 'Enabled',
'disabled': 'Disabled',
'no_replication_policies': 'No replication policies, add new replication policy.',
'no_replications': 'No replications.',
'no_replication_jobs': 'No replication jobs.',
'no_destinations': 'No destinations, add new destination.',
'name_is_required': 'Name is required.',
'name_is_too_long': 'Name is too long. (maximum 20 characters)',
'description_is_too_long': 'Description is too long. (maximum 20 characters)',
'enable': 'Enable',
'general_setting': 'General',
'destination_setting': 'Destination Setting',
'endpoint': 'Endpoint',
'test_connection': 'Test connection',
'add_new_destination': 'New Destination'
};

View File

@ -132,5 +132,32 @@ var locale_messages = {
'confirm_to_delete_user_title': '删除用户',
'confirm_to_delete_user': '确认删除当前用户吗?',
'confirm_to_delete_destination_title': '删除目标',
'confirm_to_delete_destination': '确认删除当前目标吗?'
'confirm_to_delete_destination': '确认删除当前目标吗?',
'replication': '复制',
'add_new_replication': '新增复制',
'name': '名称',
'description': '描述',
'destination': '目标',
'start_time': '起始时间',
'activation': '活动状态',
'replication_jobs': '复制任务',
'actions': '操作',
'status': '状态',
'logs': '日志',
'enabled': '启用',
'disabled': '停用',
'no_replication_policies': '没有复制策略,请新增复制策略。',
'no_replications': '没有复制策略。',
'no_replication_jobs': '没有复制任务。',
'no_destinations': '没有目标设置,请新增目标。',
'name_is_required': '名称为必填项',
'name_is_too_long': '名称长度超出限制。最长为20个字符',
'description_is_too_long': '描述内容长度超出限制。最长为20个字符',
'enable': '启用',
'general_setting': '一般设置',
'destination_setting': '目标设置',
'endpoint': '终端URL',
'endpoint_is_required': '终端URL为必填项。',
'test_connection': '测试连接',
'add_new_destination': '新建目标'
};

View File

@ -1,7 +1,7 @@
<ul class="switch-pane-tabs pull-right" {{ if eq .IsAdmin 1 }} style="width: 365px" {{ end }} role="tablist">
<li><a tag="repositories" href="#/repositories?project_id=//vm.projectId//">// 'repositories' | tr //</a><span class="gutter">|</span></li>
{{ if eq .IsAdmin 1 }}
<li><a tag="replication" href="#/replication?project_id=//vm.projectId//">Replication</a><span class="gutter">|</span></li>
<li><a tag="replication" href="#/replication?project_id=//vm.projectId//">// 'replication' | tr //</a><span class="gutter">|</span></li>
{{ end }}
<li><a tag="users" href="#/users?project_id=//vm.projectId//">// 'users' | tr //</a><span class="gutter">|</span></li>
<li><a tag="logs" href="#/logs?project_id=//vm.projectId//">// 'logs' | tr //</a></li>