Merge pull request #7417 from pureshine/replication-case

Reload the task list when the task status is pending and scheduled
This commit is contained in:
Wenkai Yin 2019-04-17 20:03:36 +08:00 committed by GitHub
commit 7196abc77b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 45 deletions

View File

@ -8,7 +8,8 @@
</clr-dg-action-bar>
<clr-dg-column>{{'REPLICATION.NAME' | translate}}</clr-dg-column>
<clr-dg-column [clrDgField]="'status'" class="status-width">{{'REPLICATION.STATUS' | translate}}</clr-dg-column>
<clr-dg-column class="min-width">{{'REPLICATION.SRC_REGISTRY' | translate}}</clr-dg-column>
<clr-dg-column class="col-width">{{'REPLICATION.SRC_REGISTRY' | translate}}</clr-dg-column>
<clr-dg-column class="col-width">{{'REPLICATION.REPLICATION_MODE' | translate}}</clr-dg-column>
<clr-dg-column class="min-width">{{'REPLICATION.DESTINATION_NAMESPACE' | translate}}</clr-dg-column>
<clr-dg-column [clrDgField]="'trigger'">{{'REPLICATION.REPLICATION_TRIGGER' | translate}}</clr-dg-column>
<clr-dg-column [clrDgField]="'override'" class="status-width">{{'REPLICATION.OVERRIDE' | translate}}</clr-dg-column>
@ -27,14 +28,11 @@
<div *ngSwitchCase="true" ><clr-icon shape="success-standard" class="is-success text-alignment" size="18"></clr-icon> Enabled</div>
</div>
</clr-dg-cell>
<clr-dg-cell class="min-width">
<clr-dg-cell class="col-width">
{{p.src_registry ? p.src_registry.name : ''}}
<clr-tooltip>
<clr-icon *ngIf="p.src_namespaces && p.src_namespaces.length > 1" clrTooltipTrigger shape="ellipsis-horizontal" size="18"></clr-icon>
<clr-tooltip-content clrPosition="top-right" clrSize="md" *clrIfOpen>
<span>{{p.src_namespaces}}</span>
</clr-tooltip-content>
</clr-tooltip>
</clr-dg-cell>
<clr-dg-cell class="col-width">
{{p.src_registry && p.src_registry.id > 0 ? 'pull-based' : 'push-based'}}
</clr-dg-cell>
<clr-dg-cell class="min-width">
{{p.dest_registry ? p.dest_registry.name : ''}} : {{p.dest_namespace? p.dest_namespace: '-'}}

View File

@ -8,6 +8,9 @@
.min-width {
width: 224px;
}
.col-width {
width: 140px;
}
.status-width {
width: 105px;
}

View File

@ -8,7 +8,11 @@ import { ErrorHandler } from "../../error-handler/error-handler";
import { ReplicationJob, ReplicationTasks, Comparator, ReplicationJobItem, State } from "../../service/interface";
import { CustomComparator, DEFAULT_PAGE_SIZE, calculatePage, doFiltering, doSorting } from "../../utils";
import { RequestQueryParams } from "../../service/RequestQueryParams";
const taskStatus = 'InProgress';
const taskStatus: any = {
PENDING: "pending",
RUNNING: "running",
SCHEDULED: "scheduled"
};
@Component({
selector: 'replication-tasks',
templateUrl: './replication-tasks.component.html',
@ -145,7 +149,9 @@ export class ReplicationTasksComponent implements OnInit, OnDestroy {
let count: number = 0;
this.tasks.forEach(tasks => {
if (
tasks.status === taskStatus
tasks.status.toLowerCase() === taskStatus.PENDING ||
tasks.status.toLowerCase() === taskStatus.RUNNING ||
tasks.status.toLowerCase() === taskStatus.SCHEDULED
) {
count++;
}

View File

@ -82,7 +82,7 @@ export class ProjectDetailComponent implements OnInit {
permissionsList.push(this.userPermissionService.getPermission(projectId,
USERSTATICPERMISSION.LABEL.KEY, USERSTATICPERMISSION.LABEL.VALUE.CREATE));
forkJoin(...permissionsList).subscribe(Rules => {
[this.hasLogListPermission, this.hasConfigurationListPermission, this.hasMemberListPermission,
[this.hasLogListPermission, this.hasConfigurationListPermission, this.hasMemberListPermission
, this.hasLabelListPermission, this.hasRepositoryListPermission, this.hasHelmChartsListPermission, this.hasRobotListPermission
, this.hasLabelCreatePermission] = Rules;

View File

@ -38,7 +38,7 @@
"COPY": "拷贝",
"EDIT": "编辑",
"SWITCH": "切换",
"REPLICATE": "复制",
"REPLICATE": "同步",
"ACTIONS": "操作",
"BROWSE": "选择文件",
"UPLOAD": "上传",
@ -133,7 +133,7 @@
"USER": "用户管理",
"GROUP": "组管理",
"REGISTRY": "仓库管理",
"REPLICATION": "复制管理",
"REPLICATION": "同步管理",
"CONFIG": "配置管理",
"VULNERABILITY": "漏洞",
"GARBAGE_COLLECTION": "垃圾清理"
@ -194,16 +194,16 @@
"DELETION_TITLE": "移除项目成员确认",
"DELETION_SUMMARY": "你确认删除项目 {{param}}",
"FILTER_PLACEHOLDER": "过滤项目",
"REPLICATION_RULE": "复制规则",
"REPLICATION_RULE": "同步规则",
"CREATED_SUCCESS": "成功创建项目。",
"DELETED_SUCCESS": "成功删除项目。",
"TOGGLED_SUCCESS": "切换状态成功。",
"FAILED_TO_DELETE_PROJECT": "项目包含镜像仓库或复制规则或Helm Charts无法删除。",
"FAILED_TO_DELETE_PROJECT": "项目包含镜像仓库或同步规则或Helm Charts无法删除。",
"INLINE_HELP_PUBLIC": "当项目设为公开后任何人都有此项目下镜像的读权限。命令行用户不需要“docker login”就可以拉取此项目下的镜像。"
},
"PROJECT_DETAIL": {
"REPOSITORIES": "镜像仓库",
"REPLICATION": "复制",
"REPLICATION": "同步",
"USERS": "成员",
"LOGS": "日志",
"LABELS": "标签",
@ -362,7 +362,7 @@
"IN_PROGRESS": "进行中",
"STOP_EXECUTIONS": "停止任务",
"ID":"ID",
"REPLICATION_RULE": "复制规则",
"REPLICATION_RULE": "同步规则",
"NEW_REPLICATION_RULE": "新建规则",
"ENDPOINTS": "目标",
"FILTER_POLICIES_PLACEHOLDER": "过滤规则",
@ -370,8 +370,8 @@
"DELETION_TITLE": "删除规则确认",
"DELETION_SUMMARY": "确认删除规则 {{param}}?",
"DELETION_TITLE_FAILURE": "规则确认删除失败",
"REPLICATION_TITLE": "复制规则确认",
"REPLICATION_SUMMARY": "确认复制规则 {{param}}?",
"REPLICATION_TITLE": "同步规则确认",
"REPLICATION_SUMMARY": "确认同步规则 {{param}}?",
"DELETION_SUMMARY_FAILURE": "有 pending/running/retrying 状态,不能删除",
"REPLICATE_SUMMARY_FAILURE": "有 pending/running 状态,不能删除",
"FILTER_TARGETS_PLACEHOLDER": "过滤目标",
@ -391,10 +391,10 @@
"DESCRIPTION": "描述",
"ENABLE": "启用",
"DISABLE": "停用",
"REPLICATION_MODE": "复制模式",
"REPLICATION_MODE": "同步模式",
"SRC_REGISTRY": "源仓库",
"DESTINATION_NAMESPACE": "目标仓库:命名空间",
"LAST_REPLICATION":"最后一次复制",
"LAST_REPLICATION":"最后一次同步",
"DESTINATION_NAME_IS_REQUIRED": "目标名称为必填项。",
"NEW_DESTINATION": "创建目标",
"DESTINATION_URL": "目标URL",
@ -406,8 +406,8 @@
"DISABLED": "停用",
"LAST_START_TIME": "上次起始时间",
"ACTIVATION": "活动状态",
"REPLICATION_EXECUTION": "复制任务",
"REPLICATION_EXECUTIONS": "复制任务",
"REPLICATION_EXECUTION": "同步任务",
"REPLICATION_EXECUTIONS": "同步任务",
"STOPJOB": "停止任务",
"ALL": "全部",
"PENDING": "挂起",
@ -429,22 +429,22 @@
"ITEMS": "条记录",
"NO_LOGS": "无日志",
"TOGGLE_ENABLE_TITLE": "启用规则",
"CONFIRM_TOGGLE_ENABLE_POLICY": "启用规则后,该项目下的所有镜像仓库将复制到目标实例。\n请确认继续。",
"CONFIRM_TOGGLE_ENABLE_POLICY": "启用规则后,该项目下的所有镜像仓库将同步到目标实例。\n请确认继续。",
"TOGGLE_DISABLE_TITLE": "停用规则",
"CONFIRM_TOGGLE_DISABLE_POLICY": "停用规则后,所有未完成的复制任务将被终止和取消。\n请确认继续。",
"CREATED_SUCCESS": "创建复制规则成功。",
"UPDATED_SUCCESS": "更新复制规则成功。",
"DELETED_SUCCESS": "删除复制规则成功。",
"DELETED_FAILED": "删除复制规则失败。",
"TOGGLED_SUCCESS": "切换复制规则状态成功。",
"CANNOT_EDIT": "当复制规则启用时无法修改。",
"CONFIRM_TOGGLE_DISABLE_POLICY": "停用规则后,所有未完成的同步任务将被终止和取消。\n请确认继续。",
"CREATED_SUCCESS": "创建同步规则成功。",
"UPDATED_SUCCESS": "更新同步规则成功。",
"DELETED_SUCCESS": "删除同步规则成功。",
"DELETED_FAILED": "删除同步规则失败。",
"TOGGLED_SUCCESS": "切换同步规则状态成功。",
"CANNOT_EDIT": "当同步规则启用时无法修改。",
"POLICY_ALREADY_EXISTS": "规则已存在。",
"FAILED_TO_DELETE_POLICY_ENABLED": "删除复制规则失败: 仍有未完成的任务。",
"FOUND_ERROR_IN_JOBS": "复制任务中包含错误,请检查。",
"FAILED_TO_DELETE_POLICY_ENABLED": "删除同步规则失败: 仍有未完成的任务。",
"FOUND_ERROR_IN_JOBS": "同步任务中包含错误,请检查。",
"INVALID_DATE": "无效日期。",
"PLACEHOLDER": "未发现任何复制规则!",
"JOB_PLACEHOLDER": "未发现任何复制任务!",
"JOB_LOG_VIEWER": "查看复制任务日志",
"PLACEHOLDER": "未发现任何同步规则!",
"JOB_PLACEHOLDER": "未发现任何同步任务!",
"JOB_LOG_VIEWER": "查看同步任务日志",
"NO_ENDPOINT_INFO": "请先添加一个目标",
"NO_PROJECT_INFO": "此项目不存在",
"SOURCE_RESOURCE_FILTER": "源资源过滤器",
@ -459,15 +459,15 @@
"MODE": "模式",
"TRIGGER_MODE": "触发模式",
"SOURCE_PROJECT": "源项目",
"REPLICATE": "复制",
"REPLICATE": "同步",
"DELETE_REMOTE_IMAGES": "删除本地镜像时同时也删除远程的镜像。",
"DELETE_ENABLED": "默认启用该规则",
"REPLICATE_IMMEDIATE": "立即复制现有的镜像。",
"REPLICATE_IMMEDIATE": "立即同步现有的镜像。",
"NEW": "新增",
"NAME_TOOLTIP": "项目名称由小写字符、数字和._-组成且至少2个字符并以字符或者数字开头。",
"ACKNOWLEDGE": "确认",
"RULE_DISABLED": "这个规则因为过滤选项中的标签被删除已经不能用了,更新过滤项以便重新启用规则。",
"REPLI_MODE": "复制模式",
"REPLI_MODE": "同步模式",
"SOURCE_REGISTRY":"源Registry",
"SOURCE_NAMESPACES":"源Namespace",
"DEST_REGISTRY":"目的Registry",
@ -507,9 +507,9 @@
"UPDATED_SUCCESS": "成功更新目标。",
"DELETED_SUCCESS": "成功删除目标。",
"DELETED_FAILED": "删除目标失败。",
"CANNOT_EDIT": "当复制规则启用时目标无法修改。",
"CANNOT_EDIT": "当同步规则启用时目标无法修改。",
"FAILED_TO_DELETE_TARGET_IN_USED": "无法删除正在使用的目标。",
"PLACEHOLDER": "未发现任何复制目标!"
"PLACEHOLDER": "未发现任何同步目标!"
},
"REPOSITORY": {
"COPY_DIGEST_ID": "复制摘要",
@ -641,7 +641,7 @@
"CONFIG": {
"TITLE": "配置",
"AUTH": "认证模式",
"REPLICATION": "复制",
"REPLICATION": "同步",
"EMAIL": "邮箱",
"LABEL": "标签",
"REPOSITORY": "仓库",
@ -909,14 +909,14 @@
"DELETE_USER": "删除用户",
"DELETE_ROBOT": "删除账户",
"DELETE_REGISTRY": "删除Registry",
"DELETE_REPLICATION": "删除复制",
"DELETE_REPLICATION": "删除同步",
"DELETE_MEMBER": "删除用户成员",
"DELETE_GROUP": "删除组成员",
"SWITCH_ROLE": "切换角色",
"ADD_GROUP": "添加组成员",
"ADD_USER": "添加用户成员",
"DELETE_LABEL": "删除标签",
"REPLICATION": "复制",
"REPLICATION": "同步",
"DAY_AGO": "天前",
"HOUR_AGO": "小时前",
"MINUTE_AGO": "分钟前",
@ -967,7 +967,7 @@
"MSG_SCHEDULE_RESET": "垃圾回收定时任务已被重置"
},
"RETAG": {
"MSG_SUCCESS": "复制成功",
"MSG_SUCCESS": "同步成功",
"TIP_REPO": "镜像仓库名被分解为路径组件。仓库名必须至少有一个小写字母、字母数字字符,可选句点、破折号或下划线分隔。严格意义上说,它必须匹配正则表达式[a-z0-9]+(?[.-][a-z0-9]+)*.如果仓库名有两个或多个路径组件,则它们必须用正斜杠('/')分隔。包括斜杠在内的仓库名的总长度必须小于256个字符。",
"TIP_TAG": "标签是应用于存储库中的Docker映像的一种标签它用于区分多种镜像。它需要匹配Regex([\\w][\\w.-]{0,127})"
}