Skip to content

Commit

Permalink
Modify ui Ut and modify name of artifact mode file
Browse files Browse the repository at this point in the history
Signed-off-by: Yogi_Wang <yawang@vmware.com>
  • Loading branch information
Yogi_Wang committed Feb 12, 2020
1 parent 5e29f83 commit 4fb19d7
Show file tree
Hide file tree
Showing 33 changed files with 165 additions and 512 deletions.
14 changes: 7 additions & 7 deletions src/portal/src/app/harbor-routing.module.ts
Expand Up @@ -42,8 +42,8 @@ import { AuditLogComponent } from './log/audit-log.component';
import { LogPageComponent } from './log/log-page.component';

import { RepositoryPageComponent } from './repository/repository-page.component';
import { TagRepositoryComponent } from './repository/tag-repository/tag-repository.component';
import { TagDetailPageComponent } from './repository/tag-detail/tag-detail-page.component';
import { ArtifactListPageComponent } from './repository/artifact-list-page/artifact-list-page.component';
import { ArtifactSummaryPageComponent } from './repository/artifact-summary-page/artifact-summary-page.component';
import { LeavingRepositoryRouteDeactivate } from './shared/route/leaving-repository-deactivate.service';

import { ProjectComponent } from './project/project.component';
Expand Down Expand Up @@ -169,15 +169,15 @@ const harborRoutes: Routes = [
},
{
path: 'tags/:id/:repo',
component: TagRepositoryComponent,
component: ArtifactListPageComponent,
canActivate: [MemberGuard],
resolve: {
projectResolver: ProjectRoutingResolver
}
},
{
path: 'projects/:id/repositories/:repo',
component: TagRepositoryComponent,
component: ArtifactListPageComponent,
canActivate: [MemberGuard],
canDeactivate: [LeavingRepositoryRouteDeactivate],
resolve: {
Expand All @@ -186,7 +186,7 @@ const harborRoutes: Routes = [
},
{
path: 'projects/:id/repositories/:repo/depth/:depth',
component: TagRepositoryComponent,
component: ArtifactListPageComponent,
canActivate: [MemberGuard],
canDeactivate: [LeavingRepositoryRouteDeactivate],
resolve: {
Expand All @@ -195,7 +195,7 @@ const harborRoutes: Routes = [
},
{
path: 'projects/:id/repositories/:repo/artifacts/:digest',
component: TagDetailPageComponent,
component: ArtifactSummaryPageComponent,
canActivate: [MemberGuard],
resolve: {
projectResolver: ProjectRoutingResolver
Expand Down Expand Up @@ -267,7 +267,7 @@ const harborRoutes: Routes = [
action: USERSTATICPERMISSION.REPOSITORY.VALUE.LIST
}
},
component: TagRepositoryComponent
component: ArtifactListPageComponent
},
{
path: 'members',
Expand Down
Expand Up @@ -9,7 +9,7 @@
&lt;<a (click)="jumpDigest(referArtifactNameArray,i)" >{{digest | slice:0:15}}</a></span>
</span>
</div>
<hbr-repository [repoName]="repoName" [hasSignedIn]="hasSignedIn" [hasProjectAdminRole]="hasProjectAdminRole"
<artifact-list [repoName]="repoName" [hasSignedIn]="hasSignedIn" [hasProjectAdminRole]="hasProjectAdminRole"
[projectId]="projectId" [memberRoleID]="projectMemberRoleId" [isGuest]="isGuest"
(tagClickEvent)="watchTagClickEvt($event)" (backEvt)="watchGoBackEvt($event)" (putArtifactReferenceArr)="putArtifactReferenceArr($event)"></hbr-repository>
(tagClickEvent)="watchTagClickEvt($event)" (backEvt)="watchGoBackEvt($event)" (putArtifactReferenceArr)="putArtifactReferenceArr($event)"></artifact-list>
</div>
@@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { TagRepositoryComponent } from './tag-repository.component';
import { ArtifactListPageComponent } from './artifact-list-page.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { BrowserAnimationsModule, NoopAnimationsModule } from '@angular/platform-browser/animations';
import { ClarityModule } from '@clr/angular';
Expand All @@ -12,9 +12,10 @@ import { ActivatedRoute, Router } from '@angular/router';

import { AppConfigService } from '../../app-config.service';
import { SessionService } from '../../shared/session.service';
describe('TagRepositoryComponent', () => {
let component: TagRepositoryComponent;
let fixture: ComponentFixture<TagRepositoryComponent>;
import { ArtifactService } from '../../../lib/services';
describe('ArtifactListPageComponent', () => {
let component: ArtifactListPageComponent;
let fixture: ComponentFixture<ArtifactListPageComponent>;
const mockSessionService = {
getCurrentUser: () => { }
};
Expand All @@ -33,6 +34,11 @@ describe('TagRepositoryComponent', () => {
const mockRouter = {
navigate: () => { }
};
const mockArtifactService = {
triggerUploadArtifact: {
next: () => {}
}
};
const mockActivatedRoute = {
RouterparamMap: of({ get: (key) => 'value' }),
snapshot: {
Expand Down Expand Up @@ -69,20 +75,21 @@ describe('TagRepositoryComponent', () => {
NoopAnimationsModule,
HttpClientTestingModule
],
declarations: [TagRepositoryComponent],
declarations: [ArtifactListPageComponent],
providers: [
TranslateService,
{ provide: SessionService, useValue: mockSessionService },
{ provide: AppConfigService, useValue: mockAppConfigService },
{ provide: Router, useValue: mockRouter },
{ provide: ActivatedRoute, useValue: mockActivatedRoute },
{ provide: ArtifactService, useValue: mockArtifactService },
]
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(TagRepositoryComponent);
fixture = TestBed.createComponent(ArtifactListPageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
Expand Down
Expand Up @@ -16,16 +16,16 @@ import { ActivatedRoute, Router } from '@angular/router';
import { AppConfigService } from '../../app-config.service';
import { SessionService } from '../../shared/session.service';
import { Project } from '../../project/project';
import { RepositoryComponent } from "../../../lib/components/repository/repository.component";
import { ArtifactListComponent } from "../../../lib/components/artifact-list/artifact-list.component";
import { ArtifactClickEvent, ArtifactService } from "../../../lib/services";
import { clone } from '../../../lib/utils/utils';

@Component({
selector: 'tag-repository',
templateUrl: 'tag-repository.component.html',
styleUrls: ['./tag-repository.component.scss']
selector: 'artifact-list-page',
templateUrl: 'artifact-list-page.component.html',
styleUrls: ['./artifact-list-page.component.scss']
})
export class TagRepositoryComponent implements OnInit {
export class ArtifactListPageComponent implements OnInit {

projectId: number;
projectMemberRoleId: number;
Expand All @@ -35,8 +35,8 @@ export class TagRepositoryComponent implements OnInit {
isGuest: boolean;
registryUrl: string;

@ViewChild(RepositoryComponent, {static: false})
repositoryComponent: RepositoryComponent;
@ViewChild(ArtifactListComponent, {static: false})
repositoryComponent: ArtifactListComponent;

constructor(
private route: ActivatedRoute,
Expand Down
Expand Up @@ -5,11 +5,9 @@
<a (click)="goBackRep()">{{'REPOSITORY.REPOSITORIES'| translate}}</a>
<span class="back-icon"><</span>
<a (click)="goBack(repositoryName)">{{'REPOSITORY.ARTIFACTS'| translate}}</a>
<!-- <a (click)="goBack(repositoryName)">{{repositoryName}}</a> -->
<!-- <span *ngIf="referArtifactNameArray.length>=2" > -->

<span *ngFor="let digest of referArtifactNameArray;let i = index">
&lt;<a (click)="jumpDigest(referArtifactNameArray,i)" >{{digest | slice:0:15}}</a></span>
<!-- </span> -->
</div>
<artifact-summary (backEvt)="goBack($event)"
[artifactDigest]="artifactDigest"
Expand Down
@@ -1,6 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { TagDetailPageComponent } from './tag-detail-page.component';
import { ArtifactSummaryPageComponent } from './artifact-summary-page.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { BrowserAnimationsModule, NoopAnimationsModule } from '@angular/platform-browser/animations';
import { ClarityModule } from '@clr/angular';
Expand All @@ -12,9 +12,9 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ActivatedRoute, Router } from '@angular/router';
import {AppConfigService} from "../../app-config.service";
import { SessionService } from '../../shared/session.service';
describe('TagDetailPageComponent', () => {
let component: TagDetailPageComponent;
let fixture: ComponentFixture<TagDetailPageComponent>;
describe('ArtifactSummaryPageComponent', () => {
let component: ArtifactSummaryPageComponent;
let fixture: ComponentFixture<ArtifactSummaryPageComponent>;
const mockSessionService = {
getCurrentUser: () => { }
};
Expand Down Expand Up @@ -68,7 +68,7 @@ describe('TagDetailPageComponent', () => {
NoopAnimationsModule,
HttpClientTestingModule
],
declarations: [TagDetailPageComponent],
declarations: [ArtifactSummaryPageComponent],
providers: [
TranslateService,
{ provide: SessionService, useValue: mockSessionService },
Expand All @@ -81,7 +81,7 @@ describe('TagDetailPageComponent', () => {
}));

beforeEach(() => {
fixture = TestBed.createComponent(TagDetailPageComponent);
fixture = TestBed.createComponent(ArtifactSummaryPageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
Expand Down
Expand Up @@ -14,15 +14,13 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import {AppConfigService} from "../../app-config.service";
import { SessionService } from '../../shared/session.service';
import { ArtifactService } from '../../../lib/services';

@Component({
selector: 'repository',
templateUrl: 'tag-detail-page.component.html',
styleUrls: ["tag-detail-page.component.scss"]
selector: 'artifact-summary-page',
templateUrl: 'artifact-summary-page.component.html',
styleUrls: ["artifact-summary-page.component.scss"]
})
export class TagDetailPageComponent implements OnInit, OnDestroy {
export class ArtifactSummaryPageComponent implements OnInit, OnDestroy {
tagId: string;
artifactDigest: string;
repositoryName: string;
Expand All @@ -31,9 +29,7 @@ export class TagDetailPageComponent implements OnInit, OnDestroy {
constructor(
private route: ActivatedRoute,
private appConfigService: AppConfigService,
private router: Router,
private artifactService: ArtifactService,
private session: SessionService
private router: Router
) {
}

Expand Down
10 changes: 5 additions & 5 deletions src/portal/src/app/repository/repository.module.ts
Expand Up @@ -17,9 +17,9 @@ import { RouterModule } from '@angular/router';
import { SharedModule } from '../shared/shared.module';

import { RepositoryPageComponent } from './repository-page.component';
import { TagRepositoryComponent } from './tag-repository/tag-repository.component';
import { ArtifactListPageComponent } from './artifact-list-page/artifact-list-page.component';
import { TopRepoComponent } from './top-repo/top-repo.component';
import { TagDetailPageComponent } from './tag-detail/tag-detail-page.component';
import { ArtifactSummaryPageComponent } from './artifact-summary-page/artifact-summary-page.component';

@NgModule({
imports: [
Expand All @@ -28,14 +28,14 @@ import { TagDetailPageComponent } from './tag-detail/tag-detail-page.component';
],
declarations: [
RepositoryPageComponent,
TagRepositoryComponent,
ArtifactListPageComponent,
TopRepoComponent,
TagDetailPageComponent
ArtifactSummaryPageComponent
],
exports: [
RepositoryPageComponent,
TopRepoComponent,
TagDetailPageComponent
ArtifactSummaryPageComponent
],
providers: []
})
Expand Down
Expand Up @@ -22,17 +22,17 @@ import { ConfirmationDialogService } from '../confirmation-dialog/confirmation-d

import { ConfirmationMessage } from '../confirmation-dialog/confirmation-message';
import { ConfirmationState, ConfirmationTargets } from '../shared.const';
import { TagRepositoryComponent } from '../../repository/tag-repository/tag-repository.component';
import { ArtifactListPageComponent } from '../../repository/artifact-list-page/artifact-list-page.component';
import { Observable } from 'rxjs';

@Injectable()
export class LeavingRepositoryRouteDeactivate implements CanDeactivate<TagRepositoryComponent> {
export class LeavingRepositoryRouteDeactivate implements CanDeactivate<ArtifactListPageComponent> {
constructor(
private router: Router,
private confirmation: ConfirmationDialogService) { }

canDeactivate(
tagRepo: TagRepositoryComponent,
tagRepo: ArtifactListPageComponent,
route: ActivatedRouteSnapshot,
state: RouterStateSnapshot): Observable<boolean> | boolean {
// Confirmation before leaving config route
Expand Down
Expand Up @@ -53,7 +53,7 @@ <h2 sub-header-title class="custom-h2">{{showCurrentTitle | slice:0:15}}</h2>
</form>
</section>
<section id="image" role="tabpanel" aria-labelledby="repo-image" [hidden]='!isCurrentTabContent("image")'>
<div id=images-container>
<div id="images-container">
<artifact-list-tab ngProjectAs="clr-dg-row-detail" (tagClickEvent)="watchTagClickEvt($event)" (signatureOutput)="saveSignatures($event)"
class="sub-grid-custom" [repoName]="repoName" artifact [registryUrl]="registryUrl" [withNotary]="withNotary" [withAdmiral]="withAdmiral" [hasSignedIn]="hasSignedIn"
[isGuest]="isGuest" [projectId]="projectId" [memberRoleID]="memberRoleID" (putReferArtifactArray)="putReferArtifactArray($event)"></artifact-list-tab>
Expand Down

0 comments on commit 4fb19d7

Please sign in to comment.