mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-23 09:08:26 +01:00
Merge pull request #4810 from ninjadq/cherry_pick_hardcode_url_and_bug_fix
Cherry pick hardcode url and bug fix
This commit is contained in:
commit
b292c8b05a
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "harbor-ui",
|
||||
"version": "0.7.5",
|
||||
"version": "0.7.10",
|
||||
"description": "Harbor shared UI components based on Clarity and Angular4",
|
||||
"scripts": {
|
||||
"start": "ng serve --host 0.0.0.0 --port 4500 --proxy-config proxy.config.json",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "harbor-ui",
|
||||
"version": "0.7.5",
|
||||
"version": "0.7.10",
|
||||
"description": "Harbor shared UI components based on Clarity and Angular4",
|
||||
"author": "VMware",
|
||||
"module": "index.js",
|
||||
|
@ -69,7 +69,7 @@ export const CREATE_EDIT_RULE_TEMPLATE: string = `
|
||||
</div>
|
||||
</div>
|
||||
<label *ngIf="noEndpointInfo.length != 0" class="colorRed alertLabel">{{noEndpointInfo | translate}}</label>
|
||||
<span class="alertLabel goLink" *ngIf="noEndpointInfo.length != 0" (click)="goRegistry()">{{'SIDE_NAV.SYSTEM_MGMT.REGISTRY' | translate}}</span>
|
||||
<span class="alertLabel goLink" *ngIf="noEndpointInfo.length != 0" (click)="goRegistry()">{{'REPLICATION.ENDPOINTS' | translate}}</span>
|
||||
</div>
|
||||
|
||||
<!--Trigger-->
|
||||
|
@ -140,8 +140,6 @@ export interface HarborModuleConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @export
|
||||
* @param {AppConfigService} configService
|
||||
* @returns
|
||||
|
@ -73,16 +73,16 @@ export const REPOSITORY_GRIDVIEW_TEMPLATE = `
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<clr-dropdown [clrCloseMenuOnItemClick]="false">
|
||||
<button *ngIf="withAdmiral" type="button" class="btn btn-link" (click)="provisionItemEvent($event, item)">{{'REPOSITORY.DEPLOY' | translate}}</button>
|
||||
<button type="button" class="btn btn-link" (click)="$event.stopPropagation()" clrDropdownTrigger>
|
||||
<button *ngIf="withAdmiral" type="button" class="btn btn-link" (click)="provisionItemEvent($event, item)" [disabled]="!hasProjectAdminRole">{{'REPOSITORY.DEPLOY' | translate}}</button>
|
||||
<button type="button" class="btn btn-link" (click)="$event.stopPropagation()" [disabled]="!hasProjectAdminRole" clrDropdownTrigger>
|
||||
{{'REPOSITORY.ACTION' | translate}}
|
||||
<clr-icon shape="caret down"></clr-icon>
|
||||
</button>
|
||||
<clr-dropdown-menu clrPosition="top-left" *clrIfOpen>
|
||||
<button *ngIf="withAdmiral" type="button" class="btn btn-link" clrDropdownItem (click)="itemAddInfoEvent($event, item)">
|
||||
<button *ngIf="withAdmiral" type="button" class="btn btn-link" clrDropdownItem (click)="itemAddInfoEvent($event, item)" [disabled]="!hasProjectAdminRole">
|
||||
{{'REPOSITORY.ADDITIONAL_INFO' | translate}}
|
||||
</button>
|
||||
<button type="button" class="btn btn-link" clrDropdownItem (click)="deleteItemEvent($event, item)">
|
||||
<button type="button" class="btn btn-link" clrDropdownItem (click)="deleteItemEvent($event, item)" [disabled]="!hasProjectAdminRole">
|
||||
{{'REPOSITORY.DELETE' | translate}}
|
||||
</button>
|
||||
</clr-dropdown-menu>
|
||||
|
@ -9,7 +9,7 @@ import { REPOSITORY_GRIDVIEW_TEMPLATE } from './repository-gridview.component.ht
|
||||
import { REPOSITORY_GRIDVIEW_STYLE } from './repository-gridview.component.css';
|
||||
import { Repository, SystemInfo, SystemInfoService, RepositoryService, RequestQueryParams, RepositoryItem, TagService } from '../service/index';
|
||||
import { ErrorHandler } from '../error-handler/error-handler';
|
||||
import { toPromise, CustomComparator , DEFAULT_PAGE_SIZE, calculatePage, doFiltering, doSorting} from '../utils';
|
||||
import { toPromise, CustomComparator , DEFAULT_PAGE_SIZE, calculatePage, doFiltering, doSorting, clone} from '../utils';
|
||||
import { ConfirmationState, ConfirmationTargets, ConfirmationButtons } from '../shared/shared.const';
|
||||
import { ConfirmationDialogComponent } from '../confirmation-dialog/confirmation-dialog.component';
|
||||
import { ConfirmationMessage } from '../confirmation-dialog/confirmation-message';
|
||||
@ -266,12 +266,16 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
|
||||
|
||||
provisionItemEvent(evt: any, repo: RepositoryItem): void {
|
||||
evt.stopPropagation();
|
||||
this.repoProvisionEvent.emit(repo);
|
||||
let repoCopy = clone(repo)
|
||||
repoCopy.name = this.registryUrl + ':443/' + repoCopy.name;
|
||||
this.repoProvisionEvent.emit(repoCopy);
|
||||
}
|
||||
|
||||
itemAddInfoEvent(evt: any, repo: RepositoryItem): void {
|
||||
evt.stopPropagation();
|
||||
this.addInfoEvent.emit(repo);
|
||||
let repoCopy = clone(repo)
|
||||
repoCopy.name = this.registryUrl + ':443/' + repoCopy.name;
|
||||
this.addInfoEvent.emit(repoCopy);
|
||||
}
|
||||
|
||||
deleteItemEvent(evt: any, item: RepositoryItem): void {
|
||||
|
@ -88,6 +88,13 @@ export interface IServiceConfig {
|
||||
*/
|
||||
projectPolicyEndpoint?: string;
|
||||
|
||||
/**
|
||||
* The base endpoint of service used to handle projects
|
||||
* @type {string}
|
||||
* @memberOf IServiceConfig
|
||||
*/
|
||||
projectBaseEndpoint?: string;
|
||||
|
||||
/**
|
||||
* To determine whether or not to enable the i18 multiple languages supporting.
|
||||
*
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Injectable, Inject } from '@angular/core';
|
||||
import 'rxjs/add/observable/of';
|
||||
import { Http, Headers, RequestOptions } from '@angular/http';
|
||||
import { SERVICE_CONFIG, IServiceConfig } from '../service.config';
|
||||
import 'rxjs/add/observable/of';
|
||||
|
||||
import { SERVICE_CONFIG, IServiceConfig } from '../service.config';
|
||||
import { Project } from '../project-policy-config/project';
|
||||
import { ProjectPolicy } from '../project-policy-config/project-policy-config.component';
|
||||
import {HTTP_JSON_OPTIONS, HTTP_GET_OPTIONS, buildHttpRequestOptions} from "../utils";
|
||||
@ -40,6 +40,18 @@ export abstract class ProjectService {
|
||||
*/
|
||||
abstract updateProjectPolicy(projectId: number | string, projectPolicy: ProjectPolicy): Observable<any> | Promise<any> | any;
|
||||
|
||||
/**
|
||||
* Get all projects
|
||||
*
|
||||
* @abstract
|
||||
* @param {string} name
|
||||
* @param {number} isPublic
|
||||
* @param {number} page
|
||||
* @param {number} pageSize
|
||||
* @returns {(Observable<any> | Promise<any> | any)}
|
||||
*
|
||||
* @memberOf EndpointService
|
||||
*/
|
||||
abstract listProjects(name: string, isPublic: number, page?: number, pageSize?: number): Observable<Project[]> | Promise<Project[]> | Project[];
|
||||
}
|
||||
|
||||
@ -64,14 +76,15 @@ export class ProjectDefaultService extends ProjectService {
|
||||
if (!projectId) {
|
||||
return Promise.reject('Bad argument');
|
||||
}
|
||||
|
||||
let baseUrl: string = this.config.projectBaseEndpoint ? this.config.projectBaseEndpoint : '/api/projects';
|
||||
return this.http
|
||||
.get(`/api/projects/${projectId}`, HTTP_GET_OPTIONS)
|
||||
.get(`${baseUrl}/${projectId}`, HTTP_GET_OPTIONS)
|
||||
.map(response => response.json())
|
||||
.catch(error => Observable.throw(error));
|
||||
}
|
||||
|
||||
listProjects(name: string, isPublic: number, page?: number, pageSize?: number): Observable<Project[]> | Promise<Project[]> | Project[] {
|
||||
public listProjects(name: string, isPublic: number, page?: number, pageSize?: number): Observable<Project[]> | Promise<Project[]> | Project[] {
|
||||
let baseUrl: string = this.config.projectBaseEndpoint ? this.config.projectBaseEndpoint : '/api/projects';
|
||||
let params = new RequestQueryParams();
|
||||
if (page && pageSize) {
|
||||
params.set('page', page + '');
|
||||
@ -87,20 +100,24 @@ export class ProjectDefaultService extends ProjectService {
|
||||
|
||||
// let options = new RequestOptions({ headers: this.getHeaders, search: params });
|
||||
return this.http
|
||||
.get(`/api/projects`, buildHttpRequestOptions(params))
|
||||
.get(baseUrl, buildHttpRequestOptions(params))
|
||||
.map(response => response.json())
|
||||
.catch(error => Observable.throw(error));
|
||||
}
|
||||
|
||||
public updateProjectPolicy(projectId: number | string, projectPolicy: ProjectPolicy): any {
|
||||
let baseUrl: string = this.config.projectBaseEndpoint ? this.config.projectBaseEndpoint : '/api/projects';
|
||||
return this.http
|
||||
.put(`/api/projects/${projectId}`, { 'metadata': {
|
||||
'public': projectPolicy.Public ? 'true' : 'false',
|
||||
'enable_content_trust': projectPolicy.ContentTrust ? 'true' : 'false',
|
||||
'prevent_vul': projectPolicy.PreventVulImg ? 'true' : 'false',
|
||||
'severity': projectPolicy.PreventVulImgSeverity,
|
||||
'auto_scan': projectPolicy.ScanImgOnPush ? 'true' : 'false'
|
||||
} }, HTTP_JSON_OPTIONS)
|
||||
.put(`${baseUrl}/${projectId}`, {
|
||||
'metadata': {
|
||||
'public': projectPolicy.Public ? 'true' : 'false',
|
||||
'enable_content_trust': projectPolicy.ContentTrust ? 'true' : 'false',
|
||||
'prevent_vul': projectPolicy.PreventVulImg ? 'true' : 'false',
|
||||
'severity': projectPolicy.PreventVulImgSeverity,
|
||||
'auto_scan': projectPolicy.ScanImgOnPush ? 'true' : 'false'
|
||||
}
|
||||
},
|
||||
HTTP_JSON_OPTIONS)
|
||||
.map(response => response.status)
|
||||
.catch(error => Observable.throw(error));
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ export class TagDefaultService extends TagService {
|
||||
return Promise.reject('Invalid parameters.');
|
||||
}
|
||||
|
||||
let _addLabelToImageUrl = `/api/repositories/${repoName}/tags/${tagName}/labels`;
|
||||
let _addLabelToImageUrl = `${this._baseUrl}/${repoName}/tags/${tagName}/labels`;
|
||||
return this.http.post(_addLabelToImageUrl, {id: labelId}, HTTP_JSON_OPTIONS).toPromise()
|
||||
.then(response => response.status)
|
||||
.catch(error => Promise.reject(error));
|
||||
@ -159,7 +159,7 @@ export class TagDefaultService extends TagService {
|
||||
return Promise.reject('Invalid parameters.');
|
||||
}
|
||||
|
||||
let _addLabelToImageUrl = `/api/repositories/${repoName}/tags/${tagName}/labels/${labelId}`;
|
||||
let _addLabelToImageUrl = `${this._baseUrl}/${repoName}/tags/${tagName}/labels/${labelId}`;
|
||||
return this.http.delete(_addLabelToImageUrl).toPromise()
|
||||
.then(response => response.status)
|
||||
.catch(error => Promise.reject(error));
|
||||
|
@ -285,6 +285,6 @@ export function isEmptyObject(obj: any): boolean {
|
||||
* @returns {*}
|
||||
*/
|
||||
export function clone(srcObj: any): any {
|
||||
if (!srcObj) return null;
|
||||
if (!srcObj) { return null };
|
||||
return JSON.parse(JSON.stringify(srcObj));
|
||||
}
|
@ -30,7 +30,7 @@
|
||||
"clarity-icons": "^0.10.27",
|
||||
"clarity-ui": "^0.10.27",
|
||||
"core-js": "^2.4.1",
|
||||
"harbor-ui": "0.7.7",
|
||||
"harbor-ui": "0.7.10",
|
||||
"intl": "^1.2.5",
|
||||
"mutationobserver-shim": "^0.3.2",
|
||||
"ngx-cookie": "^1.0.0",
|
||||
|
Loading…
Reference in New Issue
Block a user