How to use the @harbor/ui.OperationState.progressing function in @harbor/ui

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 / 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-group / add-group.component.ts View on Github external
let GroupAdders$ = this.selectedGroups.map(group => {
      let operMessage = new OperateInfo();
      operMessage.name = 'OPERATION.ADD_GROUP';
      operMessage.data.id = group.id;
      operMessage.state = OperationState.progressing;
      operMessage.data.name = group.group_name;
      this.operationService.publishInfo(operMessage);
      return this.memberService
        .addGroupMember(this.projectId, group, this.selectedRole).pipe(
        mergeMap(response => {
           return this.translateService.get("BATCH.DELETED_SUCCESS").pipe(
           mergeMap(res => {
            operateChanges(operMessage, OperationState.success);
            return observableOf(res);
           })); }),
            catchError(
              error => {
                  const message = errorHandFn(error);
                  this.translateService.get(message).subscribe(res =>
                    operateChanges(operMessage, OperationState.failure, res)
                  );
github goharbor / harbor / src / portal / src / app / group / group.component.ts View on Github external
let obs = this.selectedGroups.map(group => {
      let operMessage = new OperateInfo();
      operMessage.name = 'OPERATION.DELETE_GROUP';
      operMessage.data.id = group.id;
      operMessage.state = OperationState.progressing;
      operMessage.data.name = group.group_name;

      this.operationService.publishInfo(operMessage);
      return this.groupService
        .deleteGroup(group.id)
        .pipe(flatMap(response => {
          return this.translate.get("BATCH.DELETED_SUCCESS").pipe(flatMap(res => {
            operateChanges(operMessage, OperationState.success);
            return of(res);
          }));
        }))
        .pipe(catchError(error => {
          const message = errorHandFn(error);
          this.translateService.get(message).subscribe(res =>
            operateChanges(operMessage, OperationState.failure, res)
          );
github goharbor / harbor / src / portal / src / app / project / member / member.component.ts View on Github external
let deleteMember = (projectId: number, member: Member) => {
      let operMessage = new OperateInfo();
      operMessage.name = 'OPERATION.DELETE_MEMBER';
      operMessage.data.id = member.id;
      operMessage.state = OperationState.progressing;
      operMessage.data.name = member.entity_name;

      this.operationService.publishInfo(operMessage);
      if (member.entity_type === 'u' && member.entity_id === this.currentUser.user_id) {
        this.translate.get("BATCH.DELETED_FAILURE").subscribe(res => {
          operateChanges(operMessage, OperationState.failure, res);
        });
        return null;
      }

      return this.memberService
        .deleteMember(projectId, member.id)
        .pipe(map(response => {
          this.translate.get("BATCH.DELETED_SUCCESS").subscribe(res => {
            operateChanges(operMessage, OperationState.success);
          });
github goharbor / harbor / src / portal / src / app / project / helm-chart / list-charts-detail / helm-chart.component.ts View on Github external
deleteChart(chartName: string): Observable {
    let operateMsg = new OperateInfo();
    operateMsg.name = "OPERATION.DELETE_CHART";
    operateMsg.data.id = chartName;
    operateMsg.state = OperationState.progressing;
    operateMsg.data.name = chartName;
    this.operationService.publishInfo(operateMsg);

    return this.helmChartService.deleteHelmChart(this.projectName, chartName)
      .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);
        }
      )));
  }