[Fix] Fix part issue of round2

Signed-off-by: Yogi_Wang <yawang@vmware.com>
This commit is contained in:
Yogi_Wang 2020-04-09 13:08:39 +08:00
parent 5661ff937b
commit 3c771670ca
20 changed files with 67 additions and 46 deletions

View File

@ -135,16 +135,11 @@ export class CreateProjectComponent implements AfterViewInit, OnChanges, OnDest
Validators.pattern('(^-1$)|(^([1-9]+)([0-9]+)*$)'),
validateLimit(this.currentForm.form.controls['create_project_storage_limit_unit'])
]);
this.currentForm.form.controls['create_project_count_limit'].setValidators(
[
Validators.required,
Validators.pattern('(^-1$)|(^([1-9]+)([0-9]+)*$)')
]);
}
this.currentForm.form.valueChanges
.pipe(distinctUntilChanged((a, b) => JSON.stringify(a) === JSON.stringify(b)))
.subscribe((data) => {
['create_project_storage_limit', 'create_project_storage_limit_unit', 'create_project_count_limit'].forEach(fieldName => {
['create_project_storage_limit', 'create_project_storage_limit_unit'].forEach(fieldName => {
if (this.currentForm.form.get(fieldName) && this.currentForm.form.get(fieldName).value !== null) {
this.currentForm.form.get(fieldName).updateValueAndValidity();
}

View File

@ -182,7 +182,7 @@
</clr-dg-cell>
<clr-dg-cell *ngIf="depth">
<div class="cell">
{{artifact.extra_attrs?.os}}/{{artifact.extra_attrs?.architecture}}
{{artifact.platform?.os}}/{{artifact.platform?.architecture}}{{artifact.platform?.variant?'/'+artifact.platform?.variant: ''}}
</div>
</clr-dg-cell>
<clr-dg-cell class="w-rem-4">
@ -208,7 +208,7 @@
<tr>
<th class="left tag-header-color">
{{'REPOSITORY.TAGS' | translate | uppercase}}</th>
<th class="left tag-header-color">
<th *ngIf="withNotary" class="left tag-header-color">
{{'REPOSITORY.SIGNED' | translate | uppercase}}</th>
<th class="left tag-header-color">
{{'REPOSITORY.PULL_TIME' | translate | uppercase}}</th>
@ -219,7 +219,7 @@
<tbody class="tag-tbody">
<tr class="tag-tr" *ngFor="let tag of artifact.tags">
<td class="left tag-body-color">{{tag.name}}</td>
<td class="left tag-body-color" [ngSwitch]="tag.signed">
<td *ngIf="withNotary" class="left tag-body-color" [ngSwitch]="tag.signed">
<div class="cell">
<clr-icon shape="check-circle" *ngSwitchCase="true" size="20" class="color-green"></clr-icon>
<clr-icon shape="times-circle" *ngSwitchCase="false" size="16" class="color-red"></clr-icon>

View File

@ -58,6 +58,7 @@ import { ArtifactFront as Artifact, mutipleFilter } from "../../../artifact/arti
import { Project } from "../../../../project";
import { ArtifactService as NewArtifactService } from "../../../../../../../ng-swagger-gen/services/artifact.service";
import { ADDITIONS } from "../../../artifact/artifact-additions/models";
import { Platform } from "../../../../../../../ng-swagger-gen/models/platform";
export interface LabelState {
iconsShow: boolean;
label: Label;
@ -347,6 +348,7 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy {
this.newArtifactService.getArtifact(artifactParam).subscribe(
res => {
let observableLists: Observable<Artifact>[] = [];
let platFormAttr: { platform: Platform }[] = [];
this.totalCount = res.references.length;
res.references.forEach((child, index) => {
if (index >= (pageNumber - 1) * this.pageSize && index < pageNumber * this.pageSize) {
@ -360,6 +362,7 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy {
withSignature: true,
withTag: true
};
platFormAttr.push({platform: child.platform});
observableLists.push(this.newArtifactService.getArtifact(childParams));
}
});
@ -367,6 +370,9 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy {
this.loading = false;
})).subscribe(artifacts => {
this.artifactList = artifacts;
this.artifactList.forEach((artifact, index) => {
artifact.platform = clone(platFormAttr[index].platform);
});
this.getArtifactAnnotationsArray(this.artifactList);
}, error => {
this.errorHandlerService.error(error);
@ -681,12 +687,12 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy {
this.newArtifactService.CopyArtifact(params)
.pipe(finalize(() => {
this.imageNameInput.form.reset();
this.retagDialogOpened = false;
}))
.subscribe(response => {
this.translateService.get('RETAG.MSG_SUCCESS').subscribe((res: string) => {
this.errorHandlerService.info(res);
});
this.retagDialogOpened = false;
}, error => {
this.errorHandlerService.error(error);
});

View File

@ -41,7 +41,7 @@
</form>
</clr-dg-action-bar>
<clr-dg-column [clrDgField]="'name'">{{'TAG.NAME' | translate}}</clr-dg-column>
<clr-dg-column >{{'REPOSITORY.SIGNED' | translate}}</clr-dg-column>
<clr-dg-column *ngIf="withNotary">{{'REPOSITORY.SIGNED' | translate}}</clr-dg-column>
<clr-dg-column>{{'TAG.PULL_TIME' | translate}}</clr-dg-column>
<clr-dg-column>{{'TAG.PUSH_TIME' | translate}}</clr-dg-column>
@ -52,7 +52,7 @@
<span *ngIf="tag.immutable" class="label label-info ml-8">{{'REPOSITORY.IMMUTABLE' | translate}}</span>
</div>
</clr-dg-cell>
<clr-dg-cell [ngSwitch]="tag.signed">
<clr-dg-cell *ngIf="withNotary" [ngSwitch]="tag.signed">
<div class="cell">
<clr-icon shape="check-circle" *ngSwitchCase="true" size="20" class="color-green"></clr-icon>
<clr-icon shape="times-circle" *ngSwitchCase="false" size="16" class="color-red"></clr-icon>

View File

@ -12,7 +12,7 @@ import { OperationService } from "../../../../../lib/components/operation/operat
import { CURRENT_BASE_HREF } from "../../../../../lib/utils/utils";
import { USERSTATICPERMISSION, UserPermissionService, UserPermissionDefaultService } from '../../../../../lib/services';
import { delay } from 'rxjs/operators';
import { AppConfigService } from "../../../../services/app-config.service";
describe('ArtifactTagComponent', () => {
let component: ArtifactTagComponent;
@ -29,6 +29,18 @@ describe('ArtifactTagComponent', () => {
const config: IServiceConfig = {
repositoryBaseEndpoint: CURRENT_BASE_HREF + "/repositories/testing"
};
const mockAppConfigService = {
getConfig: () => {
return {
project_creation_restriction: "",
with_chartmuseum: "",
with_notary: "",
with_clair: "",
with_admiral: "",
registry_url: "",
};
}
};
let userPermissionService;
const permissions = [
{ resource: USERSTATICPERMISSION.REPOSITORY_TAG.KEY, action: USERSTATICPERMISSION.REPOSITORY_TAG.VALUE.DELETE },
@ -51,6 +63,7 @@ describe('ArtifactTagComponent', () => {
{ provide: SERVICE_CONFIG, useValue: config },
{ provide: mockErrorHandler, useValue: ErrorHandler },
{ provide: ArtifactService, useValue: mockArtifactService },
{ provide: AppConfigService, useValue: mockAppConfigService },
{ provide: UserPermissionService, useClass: UserPermissionDefaultService },
{ provide: OperationService },
]

View File

@ -22,6 +22,7 @@ import {
} from "../../../../../lib/services";
import { ClrDatagridStateInterface } from '@clr/angular';
import { DEFAULT_PAGE_SIZE, calculatePage, dbEncodeURIComponent } from '../../../../../lib/utils/utils';
import { AppConfigService } from "../../../../services/app-config.service";
class InitTag {
name = "";
@ -64,6 +65,7 @@ export class ArtifactTagComponent implements OnInit, OnDestroy {
private artifactService: ArtifactService,
private translateService: TranslateService,
private userPermissionService: UserPermissionService,
private appConfigService: AppConfigService,
private errorHandlerService: ErrorHandler
) { }
@ -156,7 +158,7 @@ export class ArtifactTagComponent implements OnInit, OnDestroy {
// const tag: NewTag = {name: this.newTagName};
const createTagParams: ArtifactService.CreateTagParams = {
projectName: this.projectName,
repositoryName: this.repositoryName,
repositoryName: dbEncodeURIComponent(this.repositoryName),
reference: this.artifactDetails.digest,
tag: this.newTagName
};
@ -249,7 +251,7 @@ export class ArtifactTagComponent implements OnInit, OnDestroy {
this.operationService.publishInfo(operMessage);
const deleteTagParams: ArtifactService.DeleteTagParams = {
projectName: this.projectName,
repositoryName: this.repositoryName,
repositoryName: dbEncodeURIComponent(this.repositoryName),
reference: this.artifactDetails.digest,
tagName: tag.name
};
@ -292,4 +294,7 @@ export class ArtifactTagComponent implements OnInit, OnDestroy {
ngOnDestroy(): void {
this.tagNameCheckSub.unsubscribe();
}
get withNotary(): boolean {
return this.appConfigService.getConfig().with_notary;
}
}

View File

@ -1,7 +1,9 @@
import { Artifact } from "../../../../../ng-swagger-gen/models/artifact";
import { Platform } from "../../../../../ng-swagger-gen/models/platform";
export interface ArtifactFront extends Artifact {
annotationsArray?: string[];
platform?: Platform;
showImage?: string;
}

View File

@ -187,6 +187,6 @@ export class ResultBarChartComponent implements OnInit, OnDestroy {
}
viewLog(): string {
return `${ CURRENT_BASE_HREF }/projects/${this.projectName
}/repositories/${this.repoName}/artifacts/${this.artifactDigest}/scan/${this.summary.report_id}/log`;
}/repositories/${dbEncodeURIComponent(this.repoName)}/artifacts/${this.artifactDigest}/scan/${this.summary.report_id}/log`;
}
}

View File

@ -23,8 +23,8 @@
<div class="black-point-container margin-left-10">
<div class="black-point "></div>
</div>
<span class="margin-left-10 font-weight-800 color-green font-size-12">{{fixableCount}}</span>
<span class="margin-left-5 color-green font-size-12">{{'SCANNER.FIXABLE' | translate}}</span>
<span class="margin-left-10 font-weight-800 font-size-12">{{fixableCount}}</span>
<span class="margin-left-5 font-size-12">{{'SCANNER.FIXABLE' | translate}}</span>
</div>
<div *ngIf="isNone" class="pl-1 margin-left-5 tip-wrapper bar-block-none shadow-none width-150">{{'VULNERABILITY.NO_VULNERABILITY' | translate }}</div>
</div>

View File

@ -82,7 +82,7 @@
</tr>
<tr>
<td class="left">
<span>{{'ROBOT_ACCOUNT.PERMISSIONS_IMAGE' | translate}}</span>
<span>{{'ROBOT_ACCOUNT.PERMISSIONS_ARTIFACT' | translate}}</span>
<clr-tooltip>
<clr-icon clrTooltipTrigger shape="info-circle" size="24"></clr-icon>
<clr-tooltip-content clrPosition="top-right" clrSize="lg" *clrIfOpen>

View File

@ -336,8 +336,8 @@
"ENABLE_ACCOUNT": "Enable Account",
"DELETE": "Delete",
"CREAT_ROBOT_ACCOUNT": "Create Robot Account",
"PERMISSIONS_IMAGE": "Image",
"PERMISSIONS_HELMCHART": "Helm Chart",
"PERMISSIONS_ARTIFACT": "Artifact",
"PERMISSIONS_HELMCHART": "Helm Chart (Chart Museum)",
"PUSH": "Push",
"PULL": "Pull",
"FILTER_PLACEHOLDER": "Filter Robot Accounts",
@ -642,7 +642,7 @@
"NAME": "Name",
"TAGS": "Tags",
"PLATFORM": "OS/ARCH",
"ARTIFACT_TOOTIP": "Click this icon to enter the Artifact list of refer",
"ARTIFACT_TOOTIP": "Click to view this OCI index's artifact list",
"ARTIFACTS_COUNT": "Artifacts",
"PULL_COUNT": "Pulls",
"PULL_COMMAND": "Pull Command",

View File

@ -337,8 +337,8 @@
"ENABLE_ACCOUNT": "Enable Account",
"DELETE": "Delete",
"CREAT_ROBOT_ACCOUNT": "Creat Robot Account",
"PERMISSIONS_IMAGE": "Image",
"PERMISSIONS_HELMCHART": "Helm Chart",
"PERMISSIONS_ARTIFACT": "Artifact",
"PERMISSIONS_HELMCHART": "Helm Chart (Chart Museum)",
"PUSH": "Push",
"PULL": "Pull",
"FILTER_PLACEHOLDER": "Filter Robot Accounts",
@ -643,7 +643,7 @@
"NAME": "Nombre",
"TAGS": "Etiquetas",
"PLATFORM": "OS/ARCH",
"ARTIFACT_TOOTIP": "Click this icon to enter the Artifact list of refer",
"ARTIFACT_TOOTIP": "Click to view this OCI index's artifact list",
"ARTIFACTS_COUNT": "Artifacts",
"PULL_COUNT": "Pulls",
"PULL_COMMAND": "Comando Pull",
@ -790,6 +790,7 @@
"SUB_TITLE_SUFIX": "logs"
},
"CONFIG": {
"HISTORY": "History",
"TITLE": "Configuración",
"AUTH": "Autentificación",
"REPLICATION": "Replicación",

View File

@ -328,8 +328,8 @@
"ENABLE_ACCOUNT": "permettre à compte ",
"DELETE": "Supprimer",
"CREAT_ROBOT_ACCOUNT": "créat robot compte ",
"PERMISSIONS_IMAGE": "Image",
"PERMISSIONS_HELMCHART": "Helm Chart",
"PERMISSIONS_ARTIFACT": "Artifact",
"PERMISSIONS_HELMCHART": "Helm Chart (Chart Museum)",
"PUSH": "Push",
"PULL": "Pull",
"FILTER_PLACEHOLDER": "Filter Robot Accounts",
@ -631,7 +631,7 @@
"NAME": "Nom",
"TAGS": "Tags",
"PLATFORM": "OS/ARCH",
"ARTIFACT_TOOTIP": "Click this icon to enter the Artifact list of refer",
"ARTIFACT_TOOTIP": "Click to view this OCI index's artifact list",
"ARTIFACTS_COUNT": "Artifacts",
"PULL_COUNT": "Pulls",
"PULL_COMMAND": "Commande de Pull",
@ -775,6 +775,7 @@
"SUB_TITLE_SUFIX": "logs"
},
"CONFIG": {
"HISTORY": "History",
"TITLE": "Configuration",
"AUTH": "Identification",
"REPLICATION": "Réplication",

View File

@ -334,8 +334,8 @@
"ENABLE_ACCOUNT": "Ativar conta",
"DELETE": "Remover",
"CREAT_ROBOT_ACCOUNT": "CRIA robô conta",
"PERMISSIONS_IMAGE": "Image",
"PERMISSIONS_HELMCHART": "Helm Chart",
"PERMISSIONS_ARTIFACT": "Artifact",
"PERMISSIONS_HELMCHART": "Helm Chart (Chart Museum)",
"PUSH": "Push",
"PULL": "Pull",
"FILTER_PLACEHOLDER": "Filtro robot accounts",
@ -642,7 +642,7 @@
"NAME": "Nome",
"TAGS": "Tags",
"PLATFORM": "OS/ARCH",
"ARTIFACT_TOOTIP": "Click this icon to enter the Artifact list of refer",
"ARTIFACT_TOOTIP": "Click to view this OCI index's artifact list",
"ARTIFACTS_COUNT": "Artifacts",
"PULL_COUNT": "Pulls",
"PULL_COMMAND": "Comando de Pull",
@ -786,6 +786,7 @@
"SUB_TITLE_SUFIX": "logs"
},
"CONFIG": {
"HISTORY": "History",
"TITLE": "Configuração",
"AUTH": "Autenticação",
"REPLICATION": "Replicação",

View File

@ -336,8 +336,8 @@
"ENABLE_ACCOUNT": "Hesabı Etkinleştir",
"DELETE": "Sil",
"CREAT_ROBOT_ACCOUNT": "Robot Hesabı Yarat",
"PERMISSIONS_IMAGE": "İmaj",
"PERMISSIONS_HELMCHART": "Helm Tablosu",
"PERMISSIONS_ARTIFACT": "Artifact",
"PERMISSIONS_HELMCHART": "Helm Tablosu (Chart Museum)",
"PUSH": "Yükle",
"PULL": "Çek",
"FILTER_PLACEHOLDER": "Robot Hesaplarını Filtrele",
@ -642,7 +642,7 @@
"NAME": "İsim",
"TAGS": "Etiketler",
"PLATFORM": "OS/ARCH",
"ARTIFACT_TOOTIP": "Click this icon to enter the Artifact list of refer",
"ARTIFACT_TOOTIP": "Click to view this OCI index's artifact list",
"ARTIFACTS_COUNT": "Artifacts",
"PULL_COUNT": "İndirmeler",
"PULL_COMMAND": "İndirme Komutu",

View File

@ -335,8 +335,8 @@
"ENABLE_ACCOUNT": "启用账户",
"DELETE": "删除",
"CREAT_ROBOT_ACCOUNT": "创建机器人账户",
"PERMISSIONS_IMAGE": "镜像",
"PERMISSIONS_HELMCHART": "Helm Chart",
"PERMISSIONS_ARTIFACT": "Artifact",
"PERMISSIONS_HELMCHART": "Helm Chart (Chart Museum)",
"PUSH": "推送",
"PULL": "拉取",
"FILTER_PLACEHOLDER": "过滤机器人账户",
@ -643,7 +643,7 @@
"NAME": "名称",
"TAGS": "Tags",
"PLATFORM": "OS/ARCH",
"ARTIFACT_TOOTIP": "Click this icon to enter the Artifact list of refer",
"ARTIFACT_TOOTIP": "点击查看此 OCI 索引的 Artifact 列表",
"ARTIFACTS_COUNT": "Artifacts",
"PULL_COUNT": "下载数",
"PULL_COMMAND": "Pull命令",
@ -790,6 +790,7 @@
"SUB_TITLE_SUFIX": "条日志"
},
"CONFIG": {
"HISTORY": "历史记录",
"TITLE": "配置",
"AUTH": "认证模式",
"REPLICATION": "复制",
@ -1153,6 +1154,7 @@
"UNKNOWN": "未知",
"STATUS": "状态",
"START_TIME": "创建时间",
"CREATION_TIME": "创建时间",
"UPDATE_TIME": "更新时间",
"LOGS": "日志",
"PENDING": "未开始",

View File

@ -83,7 +83,7 @@
<select class="clr-select width-100" formControlName="value" #selectedValue id="{{'select_'+ supportedFilters[i]?.type}}"
name="{{supportedFilters[i]?.type}}">
<option value="">{{'REPLICATION.ALL' | translate}}</option>
<option *ngFor="let value of supportedFilters[i]?.values;" value="{{value}}">{{value}}</option>
<option *ngFor="let value of supportedFilters[i]?.values;" value="{{value}}">{{value}}{{value==='chart'? ' (chartmuseum)': ''}}</option>
</select>
</div>
<div class="select resource-box" *ngIf="supportedFilters[i]?.type==='label'&& supportedFilters[i]?.style==='list'">
@ -93,7 +93,7 @@
<ng-template ngFor let-label [ngForOf]="filter.value.value" let-m="index">
<span class="label" *ngIf="m<1"> {{label}} </span>
</ng-template>
<span class="ellipsis" *ngIf="filter.value.value.length>1">···</span>
<span class="ellipsis color-white-dark" *ngIf="filter.value.value.length>1">···</span>
<div *ngFor="let label1 of filter.value.value;let k = index" hidden="true">
<input type="text" [formControlName]="k" #labelValue id="{{'label_'+ supportedFilters[i]?.type + '_' + label1}}" name="{{'label_'+ supportedFilters[i]?.type + '_' + label1}}"
placeholder="select labels">

View File

@ -448,7 +448,7 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
supportedFilter.values.forEach( value => {
this.supportedFilterLabels.push({
name: value,
color: '#fff',
color: '#FFFFFF',
select: false,
scope: 'g'
});
@ -468,7 +468,7 @@ export class CreateEditRuleComponent implements OnInit, OnDestroy {
this.supportedFilterLabels = [
{
name: labelValue,
color: '#fff',
color: '#FFFFFF',
select: true,
scope: 'g'
}, ...this.supportedFilterLabels];

View File

@ -8,7 +8,6 @@
id="project-name"
class="clr-input w-90"
(keyup)='validateProjectName()'
(blur)='blurProjectInput()'
formControlName="projectName" autocomplete="off" />
<clr-icon class="clr-validate-icon" shape="exclamation-circle"></clr-icon>
<div class="select-box" [style.display]="selectedProjectList.length ? 'block' : 'none'">

View File

@ -76,10 +76,6 @@ export class ImageNameInputComponent implements OnInit, OnDestroy {
}
}
blurProjectInput(): void {
this.validateProjectName();
}
get form(): AbstractControl {
return this.imageNameForm;
}