mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-04 08:03:37 +01:00
Merge pull request #11648 from jwangyangls/add-sign-pop-when-delete
[feat] Add pop up command when delete signed tag
This commit is contained in:
commit
981cae9f11
@ -10,7 +10,7 @@ import { ErrorHandler } from "../../../../../lib/utils/error-handler";
|
|||||||
import { ArtifactService } from '../../../../../../ng-swagger-gen/services/artifact.service';
|
import { ArtifactService } from '../../../../../../ng-swagger-gen/services/artifact.service';
|
||||||
import { OperationService } from "../../../../../lib/components/operation/operation.service";
|
import { OperationService } from "../../../../../lib/components/operation/operation.service";
|
||||||
import { CURRENT_BASE_HREF } from "../../../../../lib/utils/utils";
|
import { CURRENT_BASE_HREF } from "../../../../../lib/utils/utils";
|
||||||
import { USERSTATICPERMISSION, UserPermissionService, UserPermissionDefaultService } from '../../../../../lib/services';
|
import { USERSTATICPERMISSION, UserPermissionService, UserPermissionDefaultService, SystemInfoService } from '../../../../../lib/services';
|
||||||
import { delay } from 'rxjs/operators';
|
import { delay } from 'rxjs/operators';
|
||||||
import { AppConfigService } from "../../../../services/app-config.service";
|
import { AppConfigService } from "../../../../services/app-config.service";
|
||||||
|
|
||||||
@ -29,6 +29,9 @@ describe('ArtifactTagComponent', () => {
|
|||||||
const config: IServiceConfig = {
|
const config: IServiceConfig = {
|
||||||
repositoryBaseEndpoint: CURRENT_BASE_HREF + "/repositories/testing"
|
repositoryBaseEndpoint: CURRENT_BASE_HREF + "/repositories/testing"
|
||||||
};
|
};
|
||||||
|
const mockSystemInfoService = {
|
||||||
|
getSystemInfo: () => of( false )
|
||||||
|
};
|
||||||
const mockAppConfigService = {
|
const mockAppConfigService = {
|
||||||
getConfig: () => {
|
getConfig: () => {
|
||||||
return {
|
return {
|
||||||
@ -64,6 +67,7 @@ describe('ArtifactTagComponent', () => {
|
|||||||
{ provide: mockErrorHandler, useValue: ErrorHandler },
|
{ provide: mockErrorHandler, useValue: ErrorHandler },
|
||||||
{ provide: ArtifactService, useValue: mockArtifactService },
|
{ provide: ArtifactService, useValue: mockArtifactService },
|
||||||
{ provide: AppConfigService, useValue: mockAppConfigService },
|
{ provide: AppConfigService, useValue: mockAppConfigService },
|
||||||
|
{ provide: SystemInfoService, useValue: mockSystemInfoService },
|
||||||
{ provide: UserPermissionService, useClass: UserPermissionDefaultService },
|
{ provide: UserPermissionService, useClass: UserPermissionDefaultService },
|
||||||
{ provide: OperationService },
|
{ provide: OperationService },
|
||||||
]
|
]
|
||||||
|
@ -18,7 +18,7 @@ import { ArtifactFront as Artifact } from "../artifact";
|
|||||||
import { ArtifactService } from '../../../../../../ng-swagger-gen/services/artifact.service';
|
import { ArtifactService } from '../../../../../../ng-swagger-gen/services/artifact.service';
|
||||||
import { Tag } from '../../../../../../ng-swagger-gen/models/tag';
|
import { Tag } from '../../../../../../ng-swagger-gen/models/tag';
|
||||||
import {
|
import {
|
||||||
UserPermissionService, USERSTATICPERMISSION
|
UserPermissionService, USERSTATICPERMISSION, SystemInfoService, SystemInfo
|
||||||
} from "../../../../../lib/services";
|
} from "../../../../../lib/services";
|
||||||
import { ClrDatagridStateInterface } from '@clr/angular';
|
import { ClrDatagridStateInterface } from '@clr/angular';
|
||||||
import {
|
import {
|
||||||
@ -33,12 +33,13 @@ import { AppConfigService } from "../../../../services/app-config.service";
|
|||||||
class InitTag {
|
class InitTag {
|
||||||
name = "";
|
name = "";
|
||||||
}
|
}
|
||||||
|
const DeleteTagWithNotoryCommand1 = 'notary -s https://';
|
||||||
|
const DeleteTagWithNotoryCommand2 = ':4443 -d ~/.docker/trust remove -p ';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'artifact-tag',
|
selector: 'artifact-tag',
|
||||||
templateUrl: './artifact-tag.component.html',
|
templateUrl: './artifact-tag.component.html',
|
||||||
styleUrls: ['./artifact-tag.component.scss']
|
styleUrls: ['./artifact-tag.component.scss']
|
||||||
})
|
})
|
||||||
|
|
||||||
export class ArtifactTagComponent implements OnInit, OnDestroy {
|
export class ArtifactTagComponent implements OnInit, OnDestroy {
|
||||||
@Input() artifactDetails: Artifact;
|
@Input() artifactDetails: Artifact;
|
||||||
@Input() projectName: string;
|
@Input() projectName: string;
|
||||||
@ -66,11 +67,13 @@ export class ArtifactTagComponent implements OnInit, OnDestroy {
|
|||||||
tagNameChecker: Subject<string> = new Subject<string>();
|
tagNameChecker: Subject<string> = new Subject<string>();
|
||||||
tagNameCheckSub: Subscription;
|
tagNameCheckSub: Subscription;
|
||||||
tagNameCheckOnGoing = false;
|
tagNameCheckOnGoing = false;
|
||||||
|
systemInfo: SystemInfo;
|
||||||
constructor(
|
constructor(
|
||||||
private operationService: OperationService,
|
private operationService: OperationService,
|
||||||
private artifactService: ArtifactService,
|
private artifactService: ArtifactService,
|
||||||
private translateService: TranslateService,
|
private translateService: TranslateService,
|
||||||
private userPermissionService: UserPermissionService,
|
private userPermissionService: UserPermissionService,
|
||||||
|
private systemInfoService: SystemInfoService,
|
||||||
private appConfigService: AppConfigService,
|
private appConfigService: AppConfigService,
|
||||||
private errorHandlerService: ErrorHandler
|
private errorHandlerService: ErrorHandler
|
||||||
|
|
||||||
@ -78,6 +81,8 @@ export class ArtifactTagComponent implements OnInit, OnDestroy {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.getImagePermissionRule(this.projectId);
|
this.getImagePermissionRule(this.projectId);
|
||||||
this.invalidCreateTag();
|
this.invalidCreateTag();
|
||||||
|
this.systemInfoService.getSystemInfo()
|
||||||
|
.subscribe(systemInfo => this.systemInfo = systemInfo, error => this.errorHandlerService.error(error));
|
||||||
}
|
}
|
||||||
checkTagName(name) {
|
checkTagName(name) {
|
||||||
let listArtifactParams: ArtifactService.ListArtifactsParams = {
|
let listArtifactParams: ArtifactService.ListArtifactsParams = {
|
||||||
@ -258,6 +263,18 @@ export class ArtifactTagComponent implements OnInit, OnDestroy {
|
|||||||
operMessage.state = OperationState.progressing;
|
operMessage.state = OperationState.progressing;
|
||||||
operMessage.data.name = tag.name;
|
operMessage.data.name = tag.name;
|
||||||
this.operationService.publishInfo(operMessage);
|
this.operationService.publishInfo(operMessage);
|
||||||
|
|
||||||
|
if (tag.signature) {
|
||||||
|
forkJoin(this.translateService.get("BATCH.DELETED_FAILURE"),
|
||||||
|
this.translateService.get("REPOSITORY.DELETION_SUMMARY_TAG_DENIED")).subscribe(res => {
|
||||||
|
let wrongInfo: string = res[1] + DeleteTagWithNotoryCommand1 + this.registryUrl +
|
||||||
|
DeleteTagWithNotoryCommand2 +
|
||||||
|
this.registryUrl + "/" + this.repositoryName +
|
||||||
|
" " + name;
|
||||||
|
operateChanges(operMessage, OperationState.failure, wrongInfo);
|
||||||
|
});
|
||||||
|
return of(null);
|
||||||
|
} else {
|
||||||
const deleteTagParams: ArtifactService.DeleteTagParams = {
|
const deleteTagParams: ArtifactService.DeleteTagParams = {
|
||||||
projectName: this.projectName,
|
projectName: this.projectName,
|
||||||
repositoryName: dbEncodeURIComponent(this.repositoryName),
|
repositoryName: dbEncodeURIComponent(this.repositoryName),
|
||||||
@ -278,6 +295,7 @@ export class ArtifactTagComponent implements OnInit, OnDestroy {
|
|||||||
);
|
);
|
||||||
return of(error);
|
return of(error);
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
existValid(name) {
|
existValid(name) {
|
||||||
@ -306,4 +324,7 @@ export class ArtifactTagComponent implements OnInit, OnDestroy {
|
|||||||
get withNotary(): boolean {
|
get withNotary(): boolean {
|
||||||
return this.appConfigService.getConfig().with_notary;
|
return this.appConfigService.getConfig().with_notary;
|
||||||
}
|
}
|
||||||
|
public get registryUrl(): string {
|
||||||
|
return this.systemInfo ? this.systemInfo.registry_url : '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user