Merge pull request #7606 from jwangyangls/fix_delete_repository_and_oidc_add_tooltip

Add OIDC Redirect url and fix delete repository bug and fix operation refresh bug
This commit is contained in:
jwangyangls 2019-04-30 12:19:15 +08:00 committed by GitHub
commit 17b38e395a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 84 additions and 58 deletions

View File

@ -8,7 +8,7 @@ export class OperateInfo {
this.name = ''; this.name = '';
this.state = ''; this.state = '';
this.data = {id: -1, name: '', errorInf: ''}; this.data = {id: -1, name: '', errorInf: ''};
this.timeStamp = 0; this.timeStamp = new Date().getTime();
this.timeDiff = 'less 1 minute'; this.timeDiff = 'less 1 minute';
} }
} }

View File

@ -151,17 +151,23 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
} }
confirmDeletion(message: ConfirmationAcknowledgement) { confirmDeletion(message: ConfirmationAcknowledgement) {
let repArr: any[] = [];
message.data.forEach(repo => {
if (!this.signedCon[repo.name]) {
repArr.push(this.getTagInfo(repo.name));
}
});
this.loading = true;
forkJoin(...repArr).subscribe(() => {
if (message && if (message &&
message.source === ConfirmationTargets.REPOSITORY && message.source === ConfirmationTargets.REPOSITORY &&
message.state === ConfirmationState.CONFIRMED) { message.state === ConfirmationState.CONFIRMED) {
let repoLists = message.data; let repoLists = message.data;
if (repoLists && repoLists.length) { if (repoLists && repoLists.length) {
let observableLists: any[] = []; let observableLists: any[] = [];
repoLists.forEach(repo => { repoLists.forEach(repo => {
observableLists.push(this.delOperate(repo)); observableLists.push(this.delOperate(repo));
}); });
forkJoin(observableLists).subscribe((item) => { forkJoin(observableLists).subscribe((item) => {
this.selectedRow = []; this.selectedRow = [];
this.refresh(); this.refresh();
@ -171,9 +177,16 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
} else { } else {
this.clrLoad(st); this.clrLoad(st);
} }
}, error => {
this.errorHandler.error(error);
this.loading = false;
}); });
} }
} }
}, error => {
this.errorHandler.error(error);
this.loading = false;
});
} }
delOperate(repo: RepositoryItem): Observable<any> { delOperate(repo: RepositoryItem): Observable<any> {
@ -238,17 +251,9 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
deleteRepos(repoLists: RepositoryItem[]) { deleteRepos(repoLists: RepositoryItem[]) {
if (repoLists && repoLists.length) { if (repoLists && repoLists.length) {
let repoNames: string[] = []; let repoNames: string[] = [];
let repArr: any[] = [];
repoLists.forEach(repo => { repoLists.forEach(repo => {
repoNames.push(repo.name); repoNames.push(repo.name);
if (!this.signedCon[repo.name]) {
repArr.push(this.getTagInfo(repo.name));
}
}); });
forkJoin(...repArr).subscribe(() => {
this.confirmationDialogSet( this.confirmationDialogSet(
'REPOSITORY.DELETION_TITLE_REPO', 'REPOSITORY.DELETION_TITLE_REPO',
'', '',
@ -256,7 +261,6 @@ export class RepositoryGridviewComponent implements OnChanges, OnInit {
repoLists, repoLists,
'REPOSITORY.DELETION_SUMMARY_REPO', 'REPOSITORY.DELETION_SUMMARY_REPO',
ConfirmationButtons.DELETE_CANCEL); ConfirmationButtons.DELETE_CANCEL);
}, error => this.errorHandler.error(error));
} }
} }

View File

@ -257,6 +257,7 @@ export interface SystemInfo {
harbor_version?: string; harbor_version?: string;
clair_vulnerability_status?: ClairDBStatus; clair_vulnerability_status?: ClairDBStatus;
next_scan_all?: number; next_scan_all?: number;
external_url?: string;
} }
/** /**

View File

@ -322,6 +322,7 @@
</section> </section>
<section class="form-block" *ngIf="showOIDC"> <section class="form-block" *ngIf="showOIDC">
<div class="oidc-tip">{{ 'CONFIG.OIDC.OIDC_REDIREC_URL' | translate}} <span>{{redirectUrl}}/c/oidc/callback</span></div>
<div class="form-group"> <div class="form-group">
<label for="oidcName" class="required">{{'CONFIG.OIDC.OIDC_PROVIDER' | translate}}</label> <label for="oidcName" class="required">{{'CONFIG.OIDC.OIDC_PROVIDER' | translate}}</label>
<label for="oidcName" aria-haspopup="true" role="tooltip" <label for="oidcName" aria-haspopup="true" role="tooltip"

View File

@ -15,3 +15,8 @@ clr-tooltip {
.top-5 { .top-5 {
top: -5px; top: -5px;
} }
.oidc-tip {
position: absolute;
top: 170px;
color: rgb(210, 74, 112);
}

View File

@ -11,11 +11,11 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
import { Component, Input, ViewChild, SimpleChanges, OnChanges } from '@angular/core'; import { Component, Input, ViewChild, SimpleChanges, OnChanges, OnInit } from '@angular/core';
import { NgForm } from '@angular/forms'; import { NgForm } from '@angular/forms';
import { Subscription } from "rxjs"; import { Subscription } from "rxjs";
import { Configuration, clone, isEmpty, getChanges, StringValueItem, BoolValueItem } from '@harbor/ui'; import { Configuration, clone, isEmpty, getChanges, StringValueItem, BoolValueItem, SystemInfoService, ErrorHandler } from '@harbor/ui';
import { MessageHandlerService } from '../../shared/message-handler/message-handler.service'; import { MessageHandlerService } from '../../shared/message-handler/message-handler.service';
import { ConfirmMessageHandler } from '../config.msg.utils'; import { ConfirmMessageHandler } from '../config.msg.utils';
import { AppConfigService } from '../../app-config.service'; import { AppConfigService } from '../../app-config.service';
@ -28,10 +28,11 @@ const fakePass = 'aWpLOSYkIzJTTU4wMDkx';
templateUrl: 'config-auth.component.html', templateUrl: 'config-auth.component.html',
styleUrls: ['./config-auth.component.scss', '../config.component.scss'] styleUrls: ['./config-auth.component.scss', '../config.component.scss']
}) })
export class ConfigurationAuthComponent implements OnChanges { export class ConfigurationAuthComponent implements OnChanges, OnInit {
changeSub: Subscription; changeSub: Subscription;
testingLDAPOnGoing = false; testingLDAPOnGoing = false;
onGoing = false; onGoing = false;
redirectUrl: string;
// tslint:disable-next-line:no-input-rename // tslint:disable-next-line:no-input-rename
@Input('allConfig') currentConfig: Configuration = new Configuration(); @Input('allConfig') currentConfig: Configuration = new Configuration();
private originalConfig: Configuration; private originalConfig: Configuration;
@ -41,10 +42,19 @@ export class ConfigurationAuthComponent implements OnChanges {
private msgHandler: MessageHandlerService, private msgHandler: MessageHandlerService,
private configService: ConfigurationService, private configService: ConfigurationService,
private appConfigService: AppConfigService, private appConfigService: AppConfigService,
private confirmMessageHandler: ConfirmMessageHandler private confirmMessageHandler: ConfirmMessageHandler,
private systemInfo: SystemInfoService,
private errorHandler: ErrorHandler,
) { ) {
} }
ngOnInit() {
this.getSystemInfo();
}
getSystemInfo(): void {
this.systemInfo.getSystemInfo()
.subscribe(systemInfo => (this.redirectUrl = systemInfo.external_url)
, error => this.errorHandler.error(error));
}
get checkable() { get checkable() {
return this.currentConfig && return this.currentConfig &&
this.currentConfig.self_registration && this.currentConfig.self_registration &&

View File

@ -756,6 +756,7 @@
}, },
"OIDC": { "OIDC": {
"OIDC_PROVIDER": "OIDC Provider Name", "OIDC_PROVIDER": "OIDC Provider Name",
"OIDC_REDIREC_URL": "Please make sure the Redirect URI on the OIDC provider is set to",
"ENDPOINT": "OIDC Endpoint", "ENDPOINT": "OIDC Endpoint",
"CLIENT_ID": "OIDC Client ID", "CLIENT_ID": "OIDC Client ID",
"CLIENTSECRET": "OIDC Client Secret", "CLIENTSECRET": "OIDC Client Secret",

View File

@ -756,6 +756,7 @@
}, },
"OIDC": { "OIDC": {
"OIDC_PROVIDER": "OIDC Proveedor", "OIDC_PROVIDER": "OIDC Proveedor",
"OIDC_REDIREC_URL": "Please make sure the Redirect URI on the OIDC provider is set to",
"ENDPOINT": "OIDC Endpoint", "ENDPOINT": "OIDC Endpoint",
"CLIENT_ID": "ID de cliente OIDC", "CLIENT_ID": "ID de cliente OIDC",
"CLIENTSECRET": "OIDC Client Secret", "CLIENTSECRET": "OIDC Client Secret",

View File

@ -729,6 +729,7 @@
}, },
"OIDC": { "OIDC": {
"OIDC_PROVIDER": "OIDC Fournisseur", "OIDC_PROVIDER": "OIDC Fournisseur",
"OIDC_REDIREC_URL": "Please make sure the Redirect URI on the OIDC provider is set to",
"ENDPOINT": "OIDC Faramètre", "ENDPOINT": "OIDC Faramètre",
"CLIENT_ID": "no d'identification du client OIDC", "CLIENT_ID": "no d'identification du client OIDC",
"CLIENTSECRET": "OIDC Client Secret", "CLIENTSECRET": "OIDC Client Secret",

View File

@ -750,6 +750,7 @@
}, },
"OIDC": { "OIDC": {
"OIDC_PROVIDER": "OIDC Fornecedor", "OIDC_PROVIDER": "OIDC Fornecedor",
"OIDC_REDIREC_URL": "Please make sure the Redirect URI on the OIDC provider is set to",
"ENDPOINT": "OIDC Endpoint", "ENDPOINT": "OIDC Endpoint",
"CLIENT_ID": "ID de cliente OIDC", "CLIENT_ID": "ID de cliente OIDC",
"CLIENTSECRET": "OIDC Client Secret", "CLIENTSECRET": "OIDC Client Secret",

View File

@ -755,6 +755,7 @@
}, },
"OIDC": { "OIDC": {
"OIDC_PROVIDER": "OIDC 供应商", "OIDC_PROVIDER": "OIDC 供应商",
"OIDC_REDIREC_URL": "请确保将OIDC提供的重定向地址设置为",
"ENDPOINT": "OIDC Endpoint", "ENDPOINT": "OIDC Endpoint",
"CLIENT_ID": "OIDC 客户端标识", "CLIENT_ID": "OIDC 客户端标识",
"CLIENTSECRET": "OIDC 客户端密码", "CLIENTSECRET": "OIDC 客户端密码",