Skip to content

Commit

Permalink
Merge 7b709d7 into ddba0df
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjadq committed Sep 8, 2018
2 parents ddba0df + 7b709d7 commit 8c2d559
Show file tree
Hide file tree
Showing 513 changed files with 7,456 additions and 11,951 deletions.
19 changes: 7 additions & 12 deletions .gitignore
Expand Up @@ -24,11 +24,11 @@ src/ui/static/styles.css
src/ui/static/i18n
src/ui/static/shapes

src/ui_ng/coverage/
src/ui_ng/dist/
src/ui_ng/html-report/
src/ui_ng/node_modules/
src/ui_ng/typings/
src/portal/coverage/
src/portal/dist/
src/portal/html-report/
src/portal/node_modules/
src/portal/typings/
**/*npm-debug.log.*
**/*yarn-error.log.*
.idea/
Expand All @@ -39,16 +39,11 @@ src/ui_ng/typings/
**/ssl/
**/proxy.config.json

src/ui_ng/src/**/*.js
src/ui_ng/src/**/*.js.map
src/ui_ng/src/**/*.json
src/portal/src/**/*.js
src/portal/src/**/*.js.map

**/npm*.log

src/ui_ng/aot/**/*.js
src/ui_ng/aot/**/*.js.map
src/ui_ng/aot/**/*.json

**/*ngsummary.json
**/*ngfactory.ts
**/aot
Expand Down
33 changes: 24 additions & 9 deletions .travis.yml
Expand Up @@ -28,14 +28,25 @@ env:
REG_VERSION: v2.6.2
UI_BUILDER_VERSION: 1.6.0

addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
- google-chrome-beta

before_install:
- sudo ./tests/hostcfg.sh
- sudo ./tests/generateCerts.sh
- sudo ./make/prepare
- sudo mkdir -p "/data/redis"
- sudo mkdir -p /etc/ui/ca/ && sudo mv ./tests/ca.crt /etc/ui/ca/
- sudo mkdir -p /harbor && sudo mv ./VERSION /harbor/UIVERSION
- sudo ./tests/testprepare.sh
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- sudo ./tests/hostcfg.sh
- sudo ./tests/generateCerts.sh
- sudo ./make/prepare
- sudo mkdir -p "/data/redis"
- sudo mkdir -p /etc/ui/ca/ && sudo mv ./tests/ca.crt /etc/ui/ca/
- sudo mkdir -p /harbor && sudo mv ./VERSION /harbor/UIVERSION
- sudo ./tests/testprepare.sh

install:
- sudo apt-get update && sudo apt-get install -y libldap2-dev
Expand All @@ -58,6 +69,11 @@ install:
- sudo service postgresql stop

before_script:
- cd src/portal
- npm install -g -q --no-progress angular-cli
- npm install -g -q --no-progress karma
- npm install -q --no-progress
- npm run build_lib && npm run link_lib && cd ../..
- export POSTGRESQL_HOST=$IP
- export REGISTRY_URL=$IP:5000
- echo $REGISTRY_URL
Expand All @@ -70,8 +86,7 @@ before_script:
- sudo mkdir -p ./make/common/config/registry/ && sudo mv ./tests/reg_config.yml ./make/common/config/registry/config.yml

script:
- sudo make run_clarity_ut CLARITYIMAGE=goharbor/harbor-clarity-ui-builder:${UI_BUILDER_VERSION}
- cat ./src/ui_ng/npm-ut-test-results
- cd src/portal && npm run lint && npm run lint:lib && npm run test && cd ../..
- sudo docker-compose -f ./make/docker-compose.test.yml up -d
- make go_check
- ./tests/pushimage.sh
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Expand Up @@ -93,9 +93,9 @@ The folder graph below shows the structure of the source code folder `harbor/src
│   ├── static
│   ├── utils
│   └── views
├── ui_ng # The code of harbor web UI
├── portal # The code of harbor web UI
│   ├── e2e
│   ├── lib # Source code of harbor-ui npm library which includes the main UI components of web UI
│   ├── lib # Source code of @harbor/ui npm library which includes the main UI components of web UI
│   └── src # General web page UI code of Harbor
└── vendor # Go code dependencies
├── github.com
Expand Down Expand Up @@ -134,11 +134,11 @@ Harbor web UI is built based on [Clarity](https://vmware.github.io/clarity/) and
**Npm Package Dependency:** Run the following commands to restore the package dependencies.
```
#For the web UI
cd $REPO_DIR/src/ui_ng
cd $REPO_DIR/src/portal
npm install
#For the UI library
cd $REPO_DIR/src/ui_ng/lib
cd $REPO_DIR/src/portal/lib
npm install
```

Expand Down Expand Up @@ -213,7 +213,7 @@ go test -v ./...

Run UI library test cases:
```
#cd #working_dir/src/ui_ng/lib
#cd #working_dir/src/portal/lib
npm run test
```

Expand Down
31 changes: 10 additions & 21 deletions Makefile
Expand Up @@ -68,7 +68,7 @@ MAKEDEVPATH=$(MAKEPATH)/dev
SRCPATH=./src
TOOLSPATH=$(BUILDPATH)/tools
UIPATH=$(BUILDPATH)/src/ui
UINGPATH=$(BUILDPATH)/src/ui_ng
UINGPATH=$(BUILDPATH)/src/portal
GOBASEPATH=/go/src/github.com/goharbor
CHECKENVCMD=checkenv.sh

Expand Down Expand Up @@ -104,15 +104,10 @@ CLAIRVERSION=v2.0.5
CLAIRDBVERSION=$(VERSIONTAG)
MIGRATORVERSION=$(VERSIONTAG)
REDISVERSION=$(VERSIONTAG)

# version of chartmuseum
CHARTMUSEUMVERSION=v0.7.1

#clarity parameters
CLARITYIMAGE=goharbor/harbor-clarity-ui-builder[:tag]
CLARITYSEEDPATH=/harbor_src
CLARITYUTPATH=${CLARITYSEEDPATH}/ui_ng/lib
CLARITYBUILDSCRIPT=/entrypoint.sh

# docker parameters
DOCKERCMD=$(shell which docker)
DOCKERBUILD=$(DOCKERCMD) build
Expand Down Expand Up @@ -183,6 +178,7 @@ DOCKERFILE_CLARITY=$(MAKEPATH)/dev/nodeclarity/Dockerfile

# docker image name
DOCKERIMAGENAME_ADMINSERVER=goharbor/harbor-adminserver
DOCKERIMAGENAME_PORTAL=goharbor/harbor-portal
DOCKERIMAGENAME_UI=goharbor/harbor-ui
DOCKERIMAGENAME_JOBSERVICE=goharbor/harbor-jobservice
DOCKERIMAGENAME_LOG=goharbor/harbor-log
Expand Down Expand Up @@ -218,6 +214,7 @@ REGISTRYPASSWORD=default

# cmds
DOCKERSAVE_PARA=$(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG) \
$(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG) \
$(DOCKERIMAGENAME_UI):$(VERSIONTAG) \
$(DOCKERIMAGENAME_LOG):$(VERSIONTAG) \
$(DOCKERIMAGENAME_DB):$(VERSIONTAG) \
Expand Down Expand Up @@ -271,15 +268,6 @@ version:
check_environment:
@$(MAKEPATH)/$(CHECKENVCMD)

compile_clarity:
@echo "compiling binary for clarity ui..."
@if [ "$(HTTPPROXY)" != "" ] ; then \
$(DOCKERCMD) run --rm -v $(BUILDPATH)/src:$(CLARITYSEEDPATH) $(CLARITYIMAGE) $(SHELL) $(CLARITYBUILDSCRIPT) -p $(HTTPPROXY); \
else \
$(DOCKERCMD) run --rm -v $(BUILDPATH)/src:$(CLARITYSEEDPATH) $(CLARITYIMAGE) $(SHELL) $(CLARITYBUILDSCRIPT); \
fi
@echo "Done."

compile_adminserver:
@echo "compiling binary for adminserver (golang image)..."
@echo $(GOBASEPATH)
Expand All @@ -304,7 +292,7 @@ compile_registryctl:
@$(DOCKERCMD) run --rm -v $(BUILDPATH):$(GOBUILDPATH) -w $(GOBUILDPATH_REGISTRYCTL) $(GOBUILDIMAGE) $(GOIMAGEBUILD) -o $(GOBUILDMAKEPATH_REGISTRYCTL)/$(REGISTRYCTLBINARYNAME)
@echo "Done."

compile:check_environment compile_clarity compile_adminserver compile_ui compile_jobservice compile_registryctl
compile:check_environment compile_adminserver compile_ui compile_jobservice compile_registryctl

prepare:
@echo "preparing..."
Expand Down Expand Up @@ -400,10 +388,6 @@ refresh_clarity_builder:
$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_ADMINSERVER):$(NEWCLARITYVERSION); \
fi

run_clarity_ut:
@echo "run clarity ut ..."
@$(DOCKERCMD) run --rm -v $(UINGPATH):$(CLARITYSEEDPATH) -v $(BUILDPATH)/tests:$(CLARITYSEEDPATH)/tests $(CLARITYIMAGE) $(SHELL) $(CLARITYSEEDPATH)/tests/run-clarity-ut.sh

gosec:
#go get github.com/securego/gosec/cmd/gosec
#go get github.com/dghubble/sling
Expand Down Expand Up @@ -444,6 +428,11 @@ pushimage:
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_ADMINSERVER):$(VERSIONTAG)

@$(DOCKERTAG) $(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG) $(REGISTRYSERVER)$(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG)
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG) \
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
@$(DOCKERRMIMAGE) $(REGISTRYSERVER)$(DOCKERIMAGENAME_PORTAL):$(VERSIONTAG)

@$(DOCKERTAG) $(DOCKERIMAGENAME_UI):$(VERSIONTAG) $(REGISTRYSERVER)$(DOCKERIMAGENAME_UI):$(VERSIONTAG)
@$(PUSHSCRIPTPATH)/$(PUSHSCRIPTNAME) $(REGISTRYSERVER)$(DOCKERIMAGENAME_UI):$(VERSIONTAG) \
$(REGISTRYUSER) $(REGISTRYPASSWORD) $(REGISTRYSERVER)
Expand Down
9 changes: 4 additions & 5 deletions docs/compile_guide.md
Expand Up @@ -50,19 +50,19 @@ You can compile the code by one of the three approaches:
* Build, install and bring up Harbor without Notary:

```sh
$ make install GOBUILDIMAGE=golang:1.9.2 COMPILETAG=compile_golangimage CLARITYIMAGE=goharbor/harbor-clarity-ui-builder:1.6.0
$ make install GOBUILDIMAGE=golang:1.9.2 COMPILETAG=compile_golangimage
```

* Build, install and bring up Harbor with Notary:

```sh
$ make install GOBUILDIMAGE=golang:1.9.2 COMPILETAG=compile_golangimage CLARITYIMAGE=goharbor/harbor-clarity-ui-builder:1.6.0 NOTARYFLAG=true
$ make install GOBUILDIMAGE=golang:1.9.2 COMPILETAG=compile_golangimage
```

* Build, install and bring up Harbor with Clair:

```sh
$ make install GOBUILDIMAGE=golang:1.9.2 COMPILETAG=compile_golangimage CLARITYIMAGE=goharbor/harbor-clarity-ui-builder:1.6.0 CLAIRFLAG=true
$ make install GOBUILDIMAGE=golang:1.9.2 COMPILETAG=compile_golangimage
```

#### II. Compile code with your own Golang environment, then build Harbor
Expand Down Expand Up @@ -108,7 +108,6 @@ The `Makefile` contains these configurable parameters:
Variable | Description
-------------------|-------------
BASEIMAGE | Container base image, default: photon
CLARITYIMAGE | Clarity UI builder image, default: harbor-clarity-ui-builder
DEVFLAG | Build model flag, default: dev
COMPILETAG | Compile model flag, default: compile_normal (local golang build)
NOTARYFLAG | Notary mode flag, default: false
Expand All @@ -128,9 +127,9 @@ Target | Description
all | prepare env, compile binaries, build images and install images
prepare | prepare env
compile | compile ui and jobservice code
compile_portal | compile portal code
compile_ui | compile ui binary
compile_jobservice | compile jobservice binary
compile_clarity | compile Clarity binary
build | build Harbor docker images (default: using build_photon)
build_photon | build Harbor docker images from Photon OS base image
install | compile binaries, build images, prepare specific version of compose file and startup Harbor instance
Expand Down
2 changes: 1 addition & 1 deletion docs/customize_look&feel_guide.md
@@ -1,6 +1,6 @@
# Customize the look & feel of Harbor

The primary look & feel of Harbor supports to be customized with several simple steps. All the relevant customization in configurations are saved in the `setting.json` file under `$HARBOR_DIR/src/ui_ng/src` folder with `json` format and will be loaded when Harbor is launched.
The primary look & feel of Harbor supports to be customized with several simple steps. All the relevant customization in configurations are saved in the `setting.json` file under `$HARBOR_DIR/src/portal/src` folder with `json` format and will be loaded when Harbor is launched.

## Configure
Open the `setting.json` file, you'll see the default content as shown below:
Expand Down
6 changes: 3 additions & 3 deletions docs/developer_guide_i18n.md
Expand Up @@ -4,7 +4,7 @@

### Steps to localize the UI in your language

1. In the folder `src/ui_ng/src/i18n/lang`, copy json file `en-us-lang.json` to a new file and rename it to `<language>-<locale>-lang.json` .
1. In the folder `src/portal/src/i18n/lang`, copy json file `en-us-lang.json` to a new file and rename it to `<language>-<locale>-lang.json` .

The file contains a JSON object including all the key-value pairs of UI strings:
```
Expand All @@ -21,7 +21,7 @@

2. After creating your language file, you should add it to the language supporting list.

Locate the file `src/ui_ng/src/app/shared/shared.const.ts`.
Locate the file `src/portal/src/app/shared/shared.const.ts`.
Append `<language>-<locale>` to the language supporting list:
```
export const supportedLangs = ['en-us', 'zh-cn', '<language>-<locale>'];
Expand All @@ -39,7 +39,7 @@

3. Enable the new language in the view.

Locate the file `src/ui_ng/src/app/base/navigator/navigator.component.html` and then find the following code piece:
Locate the file `src/portal/src/app/base/navigator/navigator.component.html` and then find the following code piece:
```
<div class="dropdown-menu">
<a href="javascript:void(0)" clrDropdownItem (click)='switchLanguage("en-us")' [class.lang-selected]='matchLang("en-us")'>English</a>
Expand Down
7 changes: 2 additions & 5 deletions docs/use_make.md
Expand Up @@ -5,11 +5,9 @@ BASEIMAGE | Container base image, default: photon
DEVFLAG | Build model flag, default: dev
COMPILETAG | Compile model flag, default: compile_normal (local golang build)
GOBUILDIMAGE | Golang image to compile harbor go source code.
CLARITYIMAGE | Clarity image that based on Node to compile UI.
NOTARYFLAG | Whether to enable notary in harbor, default:false
HTTPPROXY | Clarity proxy to build UI.


### Targets
Target | Description
--------------------|-------------
Expand All @@ -18,7 +16,6 @@ prepare | prepare env
compile | compile ui and jobservice code
compile_ui | compile ui binary
compile_jobservice | compile jobservice binary
compile_clarity | compile clarity ui binary
compile_adminserver | compile admin server binary
build | build Harbor docker images (default: using build_photon)
build_photon | build Harbor docker images from Photon OS base image
Expand All @@ -39,10 +36,10 @@ version | set harbor version
#### EXAMPLE:

#### Build and run harbor from source code.
make install GOBUILDIMAGE=golang:1.7.3 COMPILETAG=compile_golangimage CLARITYIMAGE=goharbor/harbor-clarity-ui-builder:1.6.0 NOTARYFLAG=true HTTPPROXY=
make install GOBUILDIMAGE=golang:1.7.3 COMPILETAG=compile_golangimage NOTARYFLAG=true

### Package offline installer
make package_offline GOBUILDIMAGE=golang:1.7.3 COMPILETAG=compile_golangimage CLARITYIMAGE=goharbor/harbor-clarity-ui-builder:1.6.0 NOTARYFLAG=true HTTPPROXY=
make package_offline GOBUILDIMAGE=golang:1.7.3 COMPILETAG=compile_golangimage NOTARYFLAG=true

### Start harbor with notary
make -e NOTARYFLAG=true start
Expand Down

0 comments on commit 8c2d559

Please sign in to comment.