mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-26 20:26:13 +01:00
updates for dissmisable alerts and other refinements.
This commit is contained in:
parent
e2cf967195
commit
04f6157048
@ -110,20 +110,34 @@
|
||||
}
|
||||
|
||||
.popover-header {
|
||||
padding:8px 14px;
|
||||
background-color:#f7f7f7;
|
||||
border-bottom:1px solid #ebebeb;
|
||||
-webkit-border-radius:5px 5px 0 0;
|
||||
-moz-border-radius:5px 5px 0 0;
|
||||
border-radius:5px 5px 0 0;
|
||||
padding:8px 14px;
|
||||
background-color:#f7f7f7;
|
||||
border-bottom:1px solid #ebebeb;
|
||||
-webkit-border-radius:5px 5px 0 0;
|
||||
-moz-border-radius:5px 5px 0 0;
|
||||
border-radius:5px 5px 0 0;
|
||||
}
|
||||
|
||||
.popover-title {
|
||||
height: 2.5em;
|
||||
padding: 8px 14px;
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
background-color: #f7f7f7;
|
||||
border-bottom: 1px solid #ebebeb;
|
||||
border-radius: 5px 5px 0 0;
|
||||
height: 2.5em;
|
||||
padding: 8px 14px;
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
background-color: #f7f7f7;
|
||||
border-bottom: 1px solid #ebebeb;
|
||||
border-radius: 5px 5px 0 0;
|
||||
}
|
||||
|
||||
.alert-custom {
|
||||
position: fixed;
|
||||
bottom: 24px;
|
||||
z-index: 99;
|
||||
width: 1110px;
|
||||
padding: 10px;
|
||||
background-color: #f2dede;
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
.alert-custom .close {
|
||||
right: 0;
|
||||
}
|
@ -34,10 +34,6 @@
|
||||
vm.publicity = current ? true : false;
|
||||
vm.isPublic = vm.publicity ? 1 : 0;
|
||||
vm.projectType = (vm.isPublic === 1) ? 'public_projects' : 'my_projects';
|
||||
if(vm.publicity) {
|
||||
vm.isProjectMember = false;
|
||||
vm.target = 'repository';
|
||||
}
|
||||
vm.retrieve();
|
||||
});
|
||||
|
||||
|
@ -0,0 +1,4 @@
|
||||
<div ng-show="toggleAlert" class="alert alert-danger alert-dismissible alert-custom" role="alert">
|
||||
<button type="button" class="close" ng-click="close()"><span aria-hidden="true">×</span></button>
|
||||
<strong>// 'caution' | tr //</strong> //message//
|
||||
</div>
|
@ -0,0 +1,34 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular
|
||||
.module('harbor.dismissable.alerts')
|
||||
.directive('dismissableAlerts', dismissableAlerts);
|
||||
|
||||
function dismissableAlerts() {
|
||||
var directive = {
|
||||
'restrict': 'E',
|
||||
'templateUrl': '/static/resources/js/components/dismissable-alerts/dismissable-alerts.directive.html',
|
||||
'link': link
|
||||
};
|
||||
return directive;
|
||||
function link(scope, element, attrs, ctrl) {
|
||||
|
||||
scope.close = function() {
|
||||
scope.toggleAlert = false;
|
||||
}
|
||||
scope.$on('raiseAlert', function(e, val) {
|
||||
console.log('received raiseAlert:' + angular.toJson(val));
|
||||
if(val.show) {
|
||||
scope.message = val.message;
|
||||
scope.toggleAlert = true;
|
||||
}else{
|
||||
scope.message = ''
|
||||
scope.toggleAlert = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
@ -0,0 +1,7 @@
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
angular.module('harbor.dismissable.alerts', []);
|
||||
|
||||
})();
|
@ -37,6 +37,7 @@
|
||||
'projectId': vm.projectId,
|
||||
'username' : vm.username
|
||||
};
|
||||
|
||||
retrieve(vm.queryParams);
|
||||
|
||||
$scope.$on('$locationChangeSuccess', function() {
|
||||
|
@ -22,7 +22,7 @@
|
||||
vm.deleteProjectMember = deleteProjectMember;
|
||||
vm.retrieve = retrieve;
|
||||
vm.username = '';
|
||||
|
||||
|
||||
vm.projectId = getParameterByName('project_id', $location.absUrl());
|
||||
vm.retrieve();
|
||||
|
||||
@ -78,12 +78,7 @@
|
||||
function getProjectMemberFailed(response) {
|
||||
console.log('Failed to get project members:' + response);
|
||||
vm.projectMembers = [];
|
||||
vm.target = 'repositories';
|
||||
// $scope.$emit('modalTitle', $filter('tr')('error'));
|
||||
// $scope.$emit('modalMessage', $filter('tr')('failed_to_get_project_member'));
|
||||
// $scope.$emit('raiseError', true);
|
||||
|
||||
|
||||
vm.target = 'repositories';
|
||||
$location.url('repositories').search('project_id', vm.projectId);
|
||||
}
|
||||
|
||||
|
@ -171,6 +171,7 @@
|
||||
vm.policy = policy;
|
||||
if(vm.targetEditable) {
|
||||
vm.policy.targetId = vm1.selection.id;
|
||||
saveDestination();
|
||||
saveOrUpdatePolicy();
|
||||
}
|
||||
}
|
||||
@ -366,6 +367,8 @@
|
||||
ctrl.pingMessage = '';
|
||||
ctrl.pingAvailable = true;
|
||||
|
||||
ctrl.saveTIP = false;
|
||||
ctrl.pingTIP = false;
|
||||
ctrl.toggleErrorMessage = false;
|
||||
ctrl.errorMessages = [];
|
||||
|
||||
|
@ -41,8 +41,8 @@
|
||||
</td>
|
||||
<td width="15%">
|
||||
<div class="display-inline-block" ng-switch on="//r.enabled//">
|
||||
<a href="javascript:void(0);" ng-click="vm.togglePolicy(r.id, 0)" title="// 'disabled' | tr //"><span ng-switch-when="1" class="glyphicon glyphicon-stop color-danger"></span></a>
|
||||
<a href="javascript:void(0);" ng-click="vm.togglePolicy(r.id, 1)" title="// 'enabled' | tr //"><span ng-switch-when="0" class="glyphicon glyphicon-play color-success"></span></a>
|
||||
<a href="javascript:void(0);" ng-click="vm.togglePolicy(r.id, 0)" title="// 'disable' | tr //"><span ng-switch-when="1" class="glyphicon glyphicon-stop color-danger"></span></a>
|
||||
<a href="javascript:void(0);" ng-click="vm.togglePolicy(r.id, 1)" title="// 'enable' | tr //"><span ng-switch-when="0" class="glyphicon glyphicon-play color-success"></span></a>
|
||||
</div>
|
||||
|
||||
<a href="javascript:void(0);" data-toggle="modal" data-target="#createPolicyModal" ng-click="vm.editReplication(r.id)" title="// 'edit_policy' | tr //"><span class="glyphicon glyphicon-pencil"></span></a>
|
||||
|
@ -15,6 +15,7 @@
|
||||
{'key': 'pending', 'value': $filter('tr')('pending')},
|
||||
{'key': 'running', 'value': $filter('tr')('running')},
|
||||
{'key': 'error' , 'value': $filter('tr')('error')},
|
||||
{'key': 'retrying', 'value': $filter('tr')('retrying')},
|
||||
{'key': 'stopped', 'value': $filter('tr')('stopped')},
|
||||
{'key': 'finished', 'value':$filter('tr')('finished')},
|
||||
{'key': 'canceled', 'value': $filter('tr')('canceled')}
|
||||
@ -28,7 +29,7 @@
|
||||
var vm = this;
|
||||
|
||||
vm.sectionHeight = {'min-height': '1200px'};
|
||||
|
||||
|
||||
$scope.$on('$locationChangeSuccess', function() {
|
||||
vm.projectId = getParameterByName('project_id', $location.absUrl());
|
||||
vm.retrievePolicy();
|
||||
@ -59,7 +60,7 @@
|
||||
|
||||
vm.searchJobTIP = false;
|
||||
vm.refreshJobTIP = false;
|
||||
|
||||
|
||||
function searchReplicationPolicy() {
|
||||
vm.retrievePolicy();
|
||||
}
|
||||
@ -102,9 +103,17 @@
|
||||
|
||||
function listReplicationJobSuccess(data, status) {
|
||||
vm.replicationJobs = data || [];
|
||||
var alertInfo = {
|
||||
'show': false,
|
||||
'message': ''
|
||||
};
|
||||
angular.forEach(vm.replicationJobs, function(item) {
|
||||
for(var key in item) {
|
||||
var value = item[key]
|
||||
var value = item[key];
|
||||
if(key === 'status' && (value === 'error' || value === 'retrying')) {
|
||||
alertInfo.show = true;
|
||||
alertInfo.message = $filter('tr')('alert_job_contains_error');
|
||||
}
|
||||
switch(key) {
|
||||
case 'operation':
|
||||
case 'status':
|
||||
@ -114,6 +123,8 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$emit('raiseAlert', alertInfo);
|
||||
vm.searchJobTIP = false;
|
||||
vm.refreshJobTIP = false;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
vm.filterInput = '';
|
||||
vm.toggleInProgress = [];
|
||||
|
||||
|
||||
var hashValue = $location.hash();
|
||||
if(hashValue) {
|
||||
var slashIndex = hashValue.indexOf('/');
|
||||
|
@ -184,6 +184,7 @@
|
||||
ctrl.pingAvailable = true;
|
||||
ctrl.pingMessage = '';
|
||||
|
||||
ctrl.pingTIP = false;
|
||||
ctrl.toggleErrorMessage = false;
|
||||
ctrl.errorMessages = [];
|
||||
|
||||
|
@ -45,6 +45,7 @@
|
||||
'harbor.replication',
|
||||
'harbor.system.management',
|
||||
'harbor.loading.progress',
|
||||
'harbor.inline.help'
|
||||
'harbor.inline.help',
|
||||
'harbor.dismissable.alerts'
|
||||
]);
|
||||
})();
|
@ -15,7 +15,6 @@
|
||||
vm.isProjectMember = false;
|
||||
|
||||
vm.togglePublicity = togglePublicity;
|
||||
vm.target = 'repositories';
|
||||
|
||||
vm.sectionDefaultHeight = {'min-height': '579px'};
|
||||
|
||||
@ -55,7 +54,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
function togglePublicity(e) {
|
||||
function togglePublicity(e) {
|
||||
vm.publicity = e.publicity;
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +153,9 @@ var locale_messages = {
|
||||
'status': 'Status',
|
||||
'logs' : 'Logs',
|
||||
'enabled': 'Enabled',
|
||||
'enable': 'Enable',
|
||||
'disabled': 'Disabled',
|
||||
'disable': 'Disable',
|
||||
'no_replication_policies_add_new': 'No replication policies, add new replication policy.',
|
||||
'no_replication_policies': 'No replication policies.',
|
||||
'no_replication_jobs': 'No replication jobs.',
|
||||
@ -205,6 +207,7 @@ var locale_messages = {
|
||||
'finished': 'Finished',
|
||||
'canceled': 'Canceled',
|
||||
'stopped': 'Stopped',
|
||||
'retrying': 'Retrying',
|
||||
'error': 'Error',
|
||||
'failed_to_get_project_member': 'Failed to get current project member.',
|
||||
'failed_to_delete_repo': 'Failed to delete repository. ',
|
||||
@ -243,6 +246,7 @@ var locale_messages = {
|
||||
'<strong>Developer</strong>: Developer has read and write privileges for a project.<br/>' +
|
||||
'<strong>Guest</strong>: Guest has read-only privilege for a specified project.',
|
||||
'inline_help_publicity_title': '<strong>Publicity of Project</strong>',
|
||||
'inline_help_publicity': 'Setting the project as public.'
|
||||
|
||||
'inline_help_publicity': 'Setting the project as public.',
|
||||
'alert_job_contains_error': 'There contain errors in current replication jobs results, please look into it.',
|
||||
'caution': 'Caution'
|
||||
};
|
@ -150,8 +150,10 @@ var locale_messages = {
|
||||
'actions': '操作',
|
||||
'status': '状态',
|
||||
'logs': '日志',
|
||||
'enabled': '启用',
|
||||
'disabled': '停用',
|
||||
'enabled': '已启用',
|
||||
'enable': '启用',
|
||||
'disabled': '已停用',
|
||||
'disable': '停用',
|
||||
'no_replication_policies_add_new': '没有复制策略,请新增复制策略。',
|
||||
'no_replication_policies': '没有复制策略。',
|
||||
'no_replications': '没有复制策略。',
|
||||
@ -160,7 +162,6 @@ var locale_messages = {
|
||||
'name_is_required': '名称为必填项',
|
||||
'name_is_too_long': '名称长度超出限制。(最长为20个字符)',
|
||||
'description_is_too_long': '描述内容长度超出限制。(最长为20个字符)',
|
||||
'enable': '启用',
|
||||
'general_setting': '一般设置',
|
||||
'destination_setting': '目标设置',
|
||||
'endpoint': '终端URL',
|
||||
@ -199,12 +200,13 @@ var locale_messages = {
|
||||
'edit': '修改',
|
||||
'delete': '删除',
|
||||
'all': '全部',
|
||||
'transfer': '传输',
|
||||
'pending': '等待',
|
||||
'transfer': '复制',
|
||||
'pending': '等待中',
|
||||
'running': '进行中',
|
||||
'finished': '已完成',
|
||||
'canceled': '取消',
|
||||
'stopped': '停止',
|
||||
'canceled': '已取消',
|
||||
'stopped': '已终止',
|
||||
'retrying': '重试中',
|
||||
'error': '错误',
|
||||
'failed_to_get_project_member': '无法获取当前项目成员。',
|
||||
'failed_to_delete_repo': '无法删除镜像仓库。',
|
||||
@ -243,5 +245,7 @@ var locale_messages = {
|
||||
'<strong>开发人员</strong>: “开发人员” 拥有一个项目的读/写权限。<br/>' +
|
||||
'<strong>来宾用户</strong>: “来宾用户”拥有特定项目的只读权限。',
|
||||
'inline_help_publicity_title': '<strong>公开项目</strong>',
|
||||
'inline_help_publicity': '设置该项目为公开。'
|
||||
'inline_help_publicity': '设置该项目为公开。',
|
||||
'alert_job_contains_error': '当前复制任务中包含错误,请检查。',
|
||||
'caution': '注意'
|
||||
};
|
@ -2,7 +2,7 @@
|
||||
<modal-dialog action="vm.action()" content-type="//vm.contentType//" modal-title="//vm.modalTitle//" modal-message="//vm.modalMessage//" confirm-only="vm.confirmOnly"></modal-dialog>
|
||||
<div class="container container-custom">
|
||||
<div class="row extend-height">
|
||||
<div class="col-xs-12 col-md-12 extend-height">
|
||||
<div class="col-xs-12 col-md-12 extend-height">
|
||||
<div class="section" ng-style="vm.sectionHeight">
|
||||
<h4 class="page-header">
|
||||
<span ng-show="!vm.publicity">// 'my_projects' | tr //</span>
|
||||
@ -26,6 +26,7 @@
|
||||
<list-log ng-if="vm.target === 'logs'" section-height="vm.sectionHeight" target="vm.target" publicity="vm.publicity"></list-log>
|
||||
</div>
|
||||
</div>
|
||||
<dismissable-alerts></dismissable-alerts>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -240,4 +240,7 @@
|
||||
<script src="/static/resources/js/components/loading-progress/loading-progress.directive.js"></script>
|
||||
|
||||
<script src="/static/resources/js/components/inline-help/inline-help.module.js"></script>
|
||||
<script src="/static/resources/js/components/inline-help/inline-help.directive.js"></script>
|
||||
<script src="/static/resources/js/components/inline-help/inline-help.directive.js"></script>
|
||||
|
||||
<script src="/static/resources/js/components/dismissable-alerts/dismissable-alerts.module.js"></script>
|
||||
<script src="/static/resources/js/components/dismissable-alerts/dismissable-alerts.directive.js"></script>
|
Loading…
Reference in New Issue
Block a user