Remove notary UI (#18666)

1. Remove notary from the UI
2. Remove notary-related unit test cases

Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
Shijun Sun 2023-05-11 19:23:51 +08:00 committed by GitHub
parent 79d1aa05fd
commit f2fc0f6a99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 7 additions and 130 deletions

View File

@ -288,7 +288,7 @@
</div>
<div
class="clr-form-control margin-top-06"
*ngIf="withNotary() && enableContentTrust">
*ngIf="enableContentTrust">
<label class="clr-control-label width-6rem">
<span>{{
'P2P_PROVIDER.CRITERIA' | translate
@ -330,12 +330,10 @@
</div>
</div>
<div
class="clr-form-control margin-top-06"
*ngIf="preventVul"
[ngClass]="{ 'mt-1': !withNotary() }">
class="clr-form-control margin-top-06 mt-1"
*ngIf="preventVul">
<label for="repo" class="clr-control-label width-6rem">
<ng-container
*ngIf="!(withNotary() && enableContentTrust)">
<ng-container *ngIf="!enableContentTrust">
<span>{{
'P2P_PROVIDER.CRITERIA' | translate
}}</span>

View File

@ -173,7 +173,7 @@ export class AddP2pPolicyComponent implements OnInit, OnDestroy {
this.preventVul = project.metadata.prevent_vul === TRUE;
this.projectSeverity = project.metadata.severity;
this.enableContentTrust =
project.metadata.enable_content_trust === TRUE;
project.metadata.enable_content_trust_cosign === TRUE;
this.severity =
PROJECT_SEVERITY_LEVEL_MAP[this.projectSeverity];
}
@ -423,9 +423,6 @@ export class AddP2pPolicyComponent implements OnInit, OnDestroy {
}
return false;
}
withNotary(): boolean {
return this.appConfigService.getConfig().with_notary;
}
showExplainForEventBased(): boolean {
return this.triggerType === TRIGGER.EVENT_BASED;
}

View File

@ -32,18 +32,6 @@
'ACCESSORY.CO_SIGN' | translate
}}</label>
</clr-checkbox-wrapper>
<clr-checkbox-wrapper *ngIf="withNotary">
<input
id="content-trust"
type="checkbox"
clrCheckbox
[(ngModel)]="projectPolicy.ContentTrust"
name="content-trust"
[disabled]="!hasChangeConfigRole" />
<label for="content-trust">{{
'ACCESSORY.NOTARY' | translate
}}</label>
</clr-checkbox-wrapper>
<clr-control-helper class="config-subtext">
{{ 'PROJECT_CONFIG.CONTENT_TRUST_POLCIY' | translate }}
</clr-control-helper>

View File

@ -15,7 +15,6 @@ import { Component, ViewChild } from '@angular/core';
const mockSystemInfo: SystemInfo[] = [
{
with_trivy: true,
with_notary: true,
with_admiral: false,
admiral_endpoint: 'NA',
auth_mode: 'db_auth',
@ -27,7 +26,6 @@ const mockSystemInfo: SystemInfo[] = [
},
{
with_trivy: false,
with_notary: false,
with_admiral: false,
admiral_endpoint: 'NA',
auth_mode: 'db_auth',

View File

@ -44,7 +44,6 @@ export class ProjectPolicy {
initByProject(pro: Project) {
this.Public = pro.metadata.public === 'true';
this.ContentTrust = pro.metadata.enable_content_trust === 'true';
this.ContentTrustCosign =
pro.metadata.enable_content_trust_cosign === 'true';
this.PreventVulImg = pro.metadata.prevent_vul === 'true';
@ -168,9 +167,6 @@ export class ProjectPolicyConfigComponent implements OnInit {
});
}
public get withNotary(): boolean {
return this.systemInfo ? this.systemInfo.with_notary : false;
}
retrieve(state?: State): any {
this.projectService.getProject(this.projectId).subscribe(
response => {

View File

@ -14,7 +14,6 @@ export class Project {
role_name?: string;
metadata?: {
public: string | boolean;
enable_content_trust: string | boolean;
enable_content_trust_cosign?: string | boolean;
prevent_vul: string | boolean;
severity: string;
@ -24,7 +23,6 @@ export class Project {
cve_allowlist?: object;
constructor() {
this.metadata.public = false;
this.metadata.enable_content_trust = false;
this.metadata.enable_content_trust_cosign = false;
this.metadata.prevent_vul = false;
this.metadata.severity = 'low';

View File

@ -299,15 +299,6 @@
| uppercase
}}
</th>
<th
*ngIf="withNotary"
class="left tag-header-color">
{{
'ACCESSORY.NOTARY_SIGNED'
| translate
| uppercase
}}
</th>
<th class="left tag-header-color">
{{
'REPOSITORY.PULL_TIME'
@ -332,41 +323,6 @@
<td class="left tag-body-color">
{{ tag.name }}
</td>
<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>
<a
href="javascript:void(0)"
*ngSwitchDefault
role="tooltip"
aria-haspopup="true"
class="tooltip tooltip-top-right">
<clr-icon
shape="help"
class="color-gray"
size="16"></clr-icon>
<span
class="tooltip-content"
>{{
'REPOSITORY.NOTARY_IS_UNDETERMINED'
| translate
}}</span
>
</a>
</div>
</td>
<td class="left tag-body-color">
{{
tag.pull_time ===

View File

@ -281,9 +281,6 @@ export class ArtifactListTabComponent implements OnInit, OnDestroy {
this.hiddenArray
);
}
get withNotary(): boolean {
return this.appConfigService.getConfig()?.with_notary;
}
clrDgRefresh(state: ClrDatagridStateInterface) {
setTimeout(() => {

View File

@ -105,9 +105,6 @@
<clr-dg-column *ngIf="hasPullCommand()">{{
'REPOSITORY.PULL_COMMAND' | translate
}}</clr-dg-column>
<clr-dg-column *ngIf="withNotary">{{
'ACCESSORY.NOTARY_SIGNED' | translate
}}</clr-dg-column>
<clr-dg-column [clrDgSortBy]="'pull_time'">{{
'TAG.PULL_TIME' | translate
}}</clr-dg-column>
@ -138,34 +135,6 @@
[iconMode]="true"
[defaultValue]="getPullCommand(tag)"></hbr-copy-input>
</clr-dg-cell>
<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>
<a
href="javascript:void(0)"
*ngSwitchDefault
role="tooltip"
aria-haspopup="true"
class="tooltip tooltip-top-right">
<clr-icon
shape="help"
class="color-gray"
size="16"></clr-icon>
<span class="tooltip-content">{{
'REPOSITORY.NOTARY_IS_UNDETERMINED' | translate
}}</span>
</a>
</div>
</clr-dg-cell>
<clr-dg-cell>{{
tag.pull_time !== availableTime
? (tag.pull_time | harborDatetime : 'short')

View File

@ -12,7 +12,6 @@ import {
USERSTATICPERMISSION,
} from '../../../../../shared/services';
import { delay } from 'rxjs/operators';
import { AppConfigService } from '../../../../../services/app-config.service';
import { SharedTestingModule } from '../../../../../shared/shared.module';
describe('ArtifactTagComponent', () => {
@ -29,18 +28,7 @@ describe('ArtifactTagComponent', () => {
const mockSystemInfoService = {
getSystemInfo: () => of(false),
};
const mockAppConfigService = {
getConfig: () => {
return {
project_creation_restriction: '',
with_chartmuseum: '',
with_notary: '',
with_trivy: '',
with_admiral: '',
registry_url: '',
};
},
};
let userPermissionService;
const permissions = [
{
@ -61,7 +49,6 @@ describe('ArtifactTagComponent', () => {
providers: [
{ provide: ErrorHandler, useValue: mockErrorHandler },
{ provide: ArtifactService, useValue: mockArtifactService },
{ provide: AppConfigService, useValue: mockAppConfigService },
{ provide: SystemInfoService, useValue: mockSystemInfoService },
{
provide: UserPermissionService,

View File

@ -104,7 +104,6 @@ export class ArtifactTagComponent implements OnInit, OnDestroy {
private translateService: TranslateService,
private userPermissionService: UserPermissionService,
private systemInfoService: SystemInfoService,
private appConfigService: AppConfigService,
private errorHandlerService: ErrorHandler,
private activatedRoute: ActivatedRoute
) {
@ -434,9 +433,7 @@ export class ArtifactTagComponent implements OnInit, OnDestroy {
ngOnDestroy(): void {
this.tagNameCheckSub.unsubscribe();
}
get withNotary(): boolean {
return this.appConfigService.getConfig().with_notary;
}
public get registryUrl(): string {
if (this.systemInfo && this.systemInfo.registry_url) {
return this.systemInfo.registry_url;

View File

@ -20,7 +20,6 @@ describe('RepositoryComponentGridview (inline template)', () => {
let compRepo: RepositoryGridviewComponent;
let fixtureRepo: ComponentFixture<RepositoryGridviewComponent>;
let mockSystemInfo: SystemInfo = {
with_notary: true,
with_admiral: false,
admiral_endpoint: 'NA',
auth_mode: 'db_auth',

View File

@ -15,7 +15,6 @@
import { ClairDBStatus } from '../shared/services';
export class AppConfig {
with_notary: boolean;
with_trivy: boolean;
admiral_endpoint: string;
auth_mode: string;
@ -33,7 +32,6 @@ export class AppConfig {
constructor() {
// Set default value
this.with_notary = false;
this.with_trivy = false;
this.admiral_endpoint = '';
this.auth_mode = 'db_auth';

View File

@ -141,7 +141,6 @@ export interface AccessLogItem {
*/
export interface SystemInfo {
with_trivy?: boolean;
with_notary?: boolean;
with_admiral?: boolean;
with_chartmuseum?: boolean;
admiral_endpoint?: string;