How to use @harbor/ui - 10 common examples

To help you get started, we’ve selected a few @harbor/ui examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github goharbor / harbor / src / portal / src / app / config / email / config-email.component.ts View on Github external
public save(): void {
        let changes = this.getChanges();
        if (!isEmpty(changes)) {
            this.onGoing = true;
            this.configService.saveConfiguration(changes)
                .subscribe(response => {
                    this.onGoing = false;
                    // refresh allConfig
                    this.refreshAllconfig.emit();
                    this.msgHandler.showSuccess('CONFIG.SAVE_SUCCESS');
                }, error => {
                    this.onGoing = false;
                    this.msgHandler.handleError(error);
                });
        } else {
            // Inprop situation, should not come here
            console.error('Save abort because nothing changed');
        }
    }
github goharbor / harbor / src / portal / src / app / config / auth / config-auth.component.ts View on Github external
public save(): void {
        let changes = this.getChanges();
        if (!isEmpty(changes)) {
            this.onGoing = true;
            this.configService.saveConfiguration(changes)
                .subscribe(response => {
                    this.onGoing = false;
                    this.refreshAllconfig.emit();
                    // Reload bootstrap option
                    this.appConfigService.load().subscribe(() => { }
                        , error => console.error('Failed to reload bootstrap option with error: ', error));
                    this.msgHandler.showSuccess('CONFIG.SAVE_SUCCESS');
                }, error => {
                    this.onGoing = false;
                    this.msgHandler.handleError(error);
                });
        } else {
            // Inprop situation, should not come here
            console.error('Save abort because nothing changed');
github goharbor / harbor / src / portal / src / app / config / auth / config-auth.component.ts View on Github external
public cancel(): void {
        let changes = this.getChanges();
        if (!isEmpty(changes)) {
            this.confirmMessageHandler.confirmUnsavedChanges(changes);
        } else {
            // Invalid situation, should not come here
            console.error('Nothing changed');
        }
    }
github goharbor / harbor / src / portal / src / app / config / email / config-email.component.ts View on Github external
public cancel(): void {
        let changes = this.getChanges();
        if (!isEmpty(changes)) {
            this.confirmMessageHandler.confirmUnsavedChanges(changes);
        } else {
            // Invalid situation, should not come here
            console.error('Nothing changed');
        }
    }
}
github goharbor / harbor / src / ui_ng / src / app / user / user.component.ts View on Github external
delOperate(user: User) {
    // init operation info
    let operMessage = new OperateInfo();
    operMessage.name = 'OPERATION.DELETE_USER';
    operMessage.data.id = user.user_id;
    operMessage.state = OperationState.progressing;
    operMessage.data.name = user.username;
    this.operationService.publishInfo(operMessage);

    if (this.isMySelf(user.user_id)) {
      this.translate.get('BATCH.DELETED_FAILURE').subscribe(res => {
        operateChanges(operMessage, OperationState.failure, res);
      });
      return null;
    }


    return this.userService.deleteUser(user.user_id).then(() => {
      this.translate.get('BATCH.DELETED_SUCCESS').subscribe(res => {
github goharbor / harbor / src / portal / src / app / project / helm-chart / list-chart-versions / helm-chart-versions-detail / helm-chart-version.component.ts View on Github external
deleteVersion(version: HelmChartVersion): Observable {
    // init operation info
    let operateMsg = new OperateInfo();
    operateMsg.name = "OPERATION.DELETE_CHART_VERSION";
    operateMsg.data.id = version.digest;
    operateMsg.state = OperationState.progressing;
    operateMsg.data.name = `${version.name}:${version.version}`;
    this.operationService.publishInfo(operateMsg);

    return this.helmChartService
      .deleteChartVersion(this.projectName, this.chartName, version.version)
      .pipe(map(
        () => operateChanges(operateMsg, OperationState.success),
        catchError( error => {
          const message = errorHandFn(error);
          this.translateService.get(message).subscribe(res =>
            operateChanges(operateMsg, OperationState.failure, res)
          );
          return observableThrowError(message);
github goharbor / harbor / src / portal / src / app / shared / message-handler / message-handler.service.ts View on Github external
public handleError(error: any | string): void {
        if (!error) {
            return;
        }
        let msg = errorHandler(error);

        if (!(error.statusCode || error.status)) {
            this.msgService.announceMessage(500, msg, AlertType.DANGER);
        } else {
            let code = error.statusCode || error.status;
            if (code === httpStatusCode.Unauthorized) {
                this.msgService.announceAppLevelMessage(code, msg, AlertType.DANGER);
                // Session is invalid now, clare session cache
                this.session.clear();
            } else {
                this.msgService.announceMessage(code, msg, AlertType.DANGER);
            }
        }
    }
github goharbor / harbor / src / ui_ng / src / app / user / user.component.ts View on Github external
delOperate(user: User) {
    // init operation info
    let operMessage = new OperateInfo();
    operMessage.name = 'OPERATION.DELETE_USER';
    operMessage.data.id = user.user_id;
    operMessage.state = OperationState.progressing;
    operMessage.data.name = user.username;
    this.operationService.publishInfo(operMessage);

    if (this.isMySelf(user.user_id)) {
      this.translate.get('BATCH.DELETED_FAILURE').subscribe(res => {
        operateChanges(operMessage, OperationState.failure, res);
      });
      return null;
    }


    return this.userService.deleteUser(user.user_id).then(() => {
      this.translate.get('BATCH.DELETED_SUCCESS').subscribe(res => {
        operateChanges(operMessage, OperationState.success);
      });
    }).catch(error => {
github goharbor / harbor / src / portal / src / app / project / helm-chart / list-chart-versions / helm-chart-versions-detail / helm-chart-version.component.ts View on Github external
deleteVersion(version: HelmChartVersion): Observable {
    // init operation info
    let operateMsg = new OperateInfo();
    operateMsg.name = "OPERATION.DELETE_CHART_VERSION";
    operateMsg.data.id = version.digest;
    operateMsg.state = OperationState.progressing;
    operateMsg.data.name = `${version.name}:${version.version}`;
    this.operationService.publishInfo(operateMsg);

    return this.helmChartService
      .deleteChartVersion(this.projectName, this.chartName, version.version)
      .pipe(map(
        () => operateChanges(operateMsg, OperationState.success),
        catchError( error => {
          const message = errorHandFn(error);
          this.translateService.get(message).subscribe(res =>
            operateChanges(operateMsg, OperationState.failure, res)
          );
          return observableThrowError(message);
        }
      )));
  }
github goharbor / harbor / src / portal / src / app / project / member / add-http-auth-group / add-http-auth-group.component.ts View on Github external
err => {
          let errorMessageKey: string = errorHandFn(err);
          this.translateService
            .get(errorMessageKey)
            .subscribe(errorMessage => this.inlineAlert.showInlineError(errorMessage));
          this.added.emit(false);
        }
      );