[OCI] changes some show words

1. search result show artifact count
2. replication shows changes both to all
3. fix delete bug when delete some artifact
Signed-off-by: Yogi_Wang <yawang@vmware.com>
This commit is contained in:
Yogi_Wang 2020-03-16 18:59:21 +08:00
parent fbb3226e85
commit 891ef80e46
7 changed files with 42 additions and 16 deletions

View File

@ -685,7 +685,7 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy {
} }
retag() { retag() {
if (this.selectedRow && this.selectedRow.length) { if (this.selectedRow && this.selectedRow.length && !this.depth) {
this.retagDialogOpened = true; this.retagDialogOpened = true;
this.retagSrcImage = this.repoName + ":" + this.selectedRow[0].digest; this.retagSrcImage = this.repoName + ":" + this.selectedRow[0].digest;
} }
@ -712,7 +712,7 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy {
} }
deleteArtifact() { deleteArtifact() {
if (this.selectedRow && this.selectedRow.length) { if (this.selectedRow && this.selectedRow.length && !this.depth) {
let artifactNames: string[] = []; let artifactNames: string[] = [];
this.selectedRow.forEach(artifact => { this.selectedRow.forEach(artifact => {
artifactNames.push(artifact.digest.slice(0, 15)); artifactNames.push(artifact.digest.slice(0, 15));
@ -744,9 +744,30 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy {
this.deleteArtifactobservableLists.push(this.delOperate(artifact)); this.deleteArtifactobservableLists.push(this.delOperate(artifact));
}); });
this.loading = true; this.loading = true;
forkJoin(...this.deleteArtifactobservableLists).subscribe((items) => { forkJoin(...this.deleteArtifactobservableLists).subscribe((deleteResult) => {
// if delete one success refresh list let deleteSuccessList = [];
if (items.some(item => !item)) { let deleteErrorList = [];
deleteResult.forEach(result => {
if (!result) {
// delete success
deleteSuccessList.push(result);
} else {
deleteErrorList.push(result);
}
});
if (deleteSuccessList.length === deleteResult.length) {
// all is success
this.selectedRow = [];
let st: ClrDatagridStateInterface = { page: {from: 0, to: this.pageSize - 1, size: this.pageSize} };
this.clrLoad(st);
} else if (deleteErrorList.length === deleteResult.length) {
// all is error
this.loading = false;
this.errorHandlerService.error(deleteResult[deleteResult.length - 1].error);
} else {
// some artifact delete success but it has error delete things
this.errorHandlerService.error(deleteErrorList[deleteErrorList.length - 1].error);
// if delete one success refresh list
this.selectedRow = []; this.selectedRow = [];
let st: ClrDatagridStateInterface = { page: {from: 0, to: this.pageSize - 1, size: this.pageSize} }; let st: ClrDatagridStateInterface = { page: {from: 0, to: this.pageSize - 1, size: this.pageSize} };
this.clrLoad(st); this.clrLoad(st);
@ -799,7 +820,7 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy {
} }
showDigestId() { showDigestId() {
if (this.selectedRow && (this.selectedRow.length === 1)) { if (this.selectedRow && (this.selectedRow.length === 1) && !this.depth) {
this.manifestInfoTitle = "REPOSITORY.COPY_DIGEST_ID"; this.manifestInfoTitle = "REPOSITORY.COPY_DIGEST_ID";
this.digestId = this.selectedRow[0].digest; this.digestId = this.selectedRow[0].digest;
this.showTagManifestOpened = true; this.showTagManifestOpened = true;

View File

@ -69,7 +69,7 @@
<clr-dg-footer> <clr-dg-footer>
<span *ngIf="pagination.totalItems">{{pagination.firstItem + 1}} - {{pagination.lastItem + 1}} {{'VULNERABILITY.GRID.FOOT_OF' | translate}}</span> {{pagination.totalItems}} {{'VULNERABILITY.GRID.FOOT_ITEMS' | translate}} <span *ngIf="pagination.totalItems">{{pagination.firstItem + 1}} - {{pagination.lastItem + 1}} {{'VULNERABILITY.GRID.FOOT_OF' | translate}}</span> {{pagination.totalItems}} {{'VULNERABILITY.GRID.FOOT_ITEMS' | translate}}
<clr-dg-pagination #pagination [clrDgPageSize]="25" [clrDgTotalItems]="scanningResults.length"></clr-dg-pagination> <clr-dg-pagination #pagination [clrDgPageSize]="25" [clrDgTotalItems]="scanningResults?.length"></clr-dg-pagination>
</clr-dg-footer> </clr-dg-footer>
</clr-datagrid> </clr-datagrid>
</div> </div>

View File

@ -90,7 +90,7 @@ describe('RepositoryComponentGridview (inline template)', () => {
}; };
const fakedRepositoryService = { const fakedRepositoryService = {
listRepositoriesResponse(params: NewRepositoryService.ListRepositoriesParams) { listRepositoriesResponse(params: NewRepositoryService.ListRepositoriesParams) {
if (params.name === 'nginx') { if (params.q === encodeURIComponent(`name=~nginx`)) {
return of({headers: new Map(), body: mockNginxRepo}); return of({headers: new Map(), body: mockNginxRepo});
} }
return of({headers: new Map(), body: mockRepo}).pipe(delay(0)); return of({headers: new Map(), body: mockRepo}).pipe(delay(0));

View File

@ -75,7 +75,8 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit, OnDestroy
cardHover = false; cardHover = false;
listHover = false; listHover = false;
pageSize: number = DEFAULT_PAGE_SIZE; // pageSize: number = DEFAULT_PAGE_SIZE;
pageSize: number = 3;
currentPage = 1; currentPage = 1;
totalCount = 0; totalCount = 0;
currentState: ClrDatagridStateInterface; currentState: ClrDatagridStateInterface;
@ -315,9 +316,11 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit, OnDestroy
let params: NewRepositoryService.ListRepositoriesParams = { let params: NewRepositoryService.ListRepositoriesParams = {
projectName: this.projectName, projectName: this.projectName,
page: this.currentPage, page: this.currentPage,
pageSize: this.pageSize, pageSize: this.pageSize
name: this.lastFilteredRepoName
}; };
if (this.lastFilteredRepoName) {
params.q = encodeURIComponent(`name=~${this.lastFilteredRepoName}`);
}
this.loading = true; this.loading = true;
this.newRepoService.listRepositoriesResponse( this.newRepoService.listRepositoriesResponse(
@ -351,9 +354,11 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit, OnDestroy
let params: NewRepositoryService.ListRepositoriesParams = { let params: NewRepositoryService.ListRepositoriesParams = {
projectName: this.projectName, projectName: this.projectName,
page: pageNumber, page: pageNumber,
pageSize: this.pageSize, pageSize: this.pageSize
name: this.lastFilteredRepoName
}; };
if (this.lastFilteredRepoName) {
params.q = encodeURIComponent(`name=~${this.lastFilteredRepoName}`);
}
if (state.filters && state.filters.length) { if (state.filters && state.filters.length) {
state.filters.forEach(item => { state.filters.forEach(item => {
params[item.property] = item.value; params[item.property] = item.value;

View File

@ -75,7 +75,7 @@
<input id="tags" required [(ngModel)]="tagsInput" class="clr-input w-100"> <input id="tags" required [(ngModel)]="tagsInput" class="clr-input w-100">
</div> </div>
</div> </div>
<div class="clr-col-3 p-0 font-size-13"> <div class="clr-col-3 p-0">
<div class="w-100 untagged"> <div class="w-100 untagged">
<label for="untagged">{{'TAG_RETENTION.INCLUDE_UNTAGGED' | translate}}</label> <label for="untagged">{{'TAG_RETENTION.INCLUDE_UNTAGGED' | translate}}</label>
<input type="checkbox" [(ngModel)]="untagged" name="untagged" id="untagged" class="clr-input w-100" clrCheckbox /> <input type="checkbox" [(ngModel)]="untagged" name="untagged" id="untagged" class="clr-input w-100" clrCheckbox />

View File

@ -4,7 +4,7 @@
<clr-dg-column>{{'REPOSITORY.PULL_COUNT' | translate}}</clr-dg-column> <clr-dg-column>{{'REPOSITORY.PULL_COUNT' | translate}}</clr-dg-column>
<clr-dg-row *clrDgItems="let r of repositories" [clrDgItem]='r'> <clr-dg-row *clrDgItems="let r of repositories" [clrDgItem]='r'>
<clr-dg-cell><a href="javascript:void(0)" (click)="gotoLink(projectId || r.project_id, r.name || r.repository_name)">{{r.name || r.repository_name}}</a></clr-dg-cell> <clr-dg-cell><a href="javascript:void(0)" (click)="gotoLink(projectId || r.project_id, r.name || r.repository_name)">{{r.name || r.repository_name}}</a></clr-dg-cell>
<clr-dg-cell>{{r.tags_count}}</clr-dg-cell> <clr-dg-cell>{{r.artifact_count}}</clr-dg-cell>
<clr-dg-cell>{{r.pull_count}}</clr-dg-cell> <clr-dg-cell>{{r.pull_count}}</clr-dg-cell>
</clr-dg-row> </clr-dg-row>
<clr-dg-footer> <clr-dg-footer>

View File

@ -82,7 +82,7 @@
<div class="select resource-box clr-select-wrapper" *ngIf="supportedFilters[i]?.style==='radio' && supportedFilters[i]?.values.length > 1"> <div class="select resource-box clr-select-wrapper" *ngIf="supportedFilters[i]?.style==='radio' && supportedFilters[i]?.values.length > 1">
<select class="clr-select width-100" formControlName="value" #selectedValue id="{{'select_'+ supportedFilters[i]?.type}}" <select class="clr-select width-100" formControlName="value" #selectedValue id="{{'select_'+ supportedFilters[i]?.type}}"
name="{{supportedFilters[i]?.type}}"> name="{{supportedFilters[i]?.type}}">
<option value="">{{'REPLICATION.BOTH' | translate}}</option> <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}}</option>
</select> </select>
</div> </div>