Deploy button send event based on latest tag

If latest tag exist sent provision event. Otherwise send Add additional info event.
This commit is contained in:
Deng, Qian 2018-05-16 11:20:50 +08:00
parent d3930ae17c
commit b3749bd4a4
4 changed files with 26 additions and 3 deletions

2
.gitignore vendored
View File

@ -52,3 +52,5 @@ src/ui_ng/aot/**/*.json
**/aot
**/dist
**/.bin
package-lock.json
src/ui_ng/package-lock.json

View File

@ -1,6 +1,6 @@
{
"name": "harbor-ui",
"version": "0.7.19-dev.3",
"version": "0.7.19-dev.8",
"description": "Harbor shared UI components based on Clarity and Angular4",
"author": "VMware",
"module": "index.js",

View File

@ -346,11 +346,32 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
});
}
containsLatestTag(repo: RepositoryItem): Promise<boolean> {
return toPromise<Tag[]>(this.tagService.getTags(repo.name))
.then(items => {
if (items.some((t: Tag) => { return t.name === 'latest'; })) {
return true;
} else {
return false;
};
})
.catch(error => Promise.reject(false));
}
provisionItemEvent(evt: any, repo: RepositoryItem): void {
evt.stopPropagation();
let repoCopy = clone(repo);
repoCopy.name = this.registryUrl + ":443/" + repoCopy.name;
this.repoProvisionEvent.emit(repoCopy);
this.containsLatestTag(repo)
.then(containsLatest => {
if (containsLatest) {
this.repoProvisionEvent.emit(repoCopy);
} else {
this.addInfoEvent.emit(repoCopy);
}
})
.catch( error => this.errorHandler.error(error));
}
itemAddInfoEvent(evt: any, repo: RepositoryItem): void {

View File

@ -32,7 +32,7 @@
"clarity-icons": "^0.10.27",
"clarity-ui": "^0.10.27",
"core-js": "^2.4.1",
"harbor-ui": "0.7.19-dev.3",
"harbor-ui": "0.7.19-dev.8",
"intl": "^1.2.5",
"mutationobserver-shim": "^0.3.2",
"ngx-cookie": "^1.0.0",