Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Commit

Permalink
fix(quickAdd): dont dispatch AddSuccess action on workitem creation
Browse files Browse the repository at this point in the history
  • Loading branch information
sahil143 committed Oct 23, 2018
1 parent 18eb3bf commit b2c271f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
type="text"
placeholder=" Type your title...."
#quickAddTitle
[formControl]="workItemTitle"
[disabled]="blockAdd"
[(ngModel)]="workItem.attributes['system.title']"
(keyup.enter)="save($event)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { PermissionQuery } from './../../models/permission.model';
import { WorkItemQuery } from './../../models/work-item';

// ngrx stuff
import { FormControl } from '@angular/forms';
import { select, Store } from '@ngrx/store';
import { Observable } from 'rxjs';
import * as WorkItemActions from './../../actions/work-item.actions';
Expand Down Expand Up @@ -55,6 +56,7 @@ export class WorkItemQuickAddComponent implements OnInit, OnDestroy, AfterViewIn
linkObject: object;
addDisabled: Observable<boolean> =
this.permissionQuery.isAllowedToAdd();
workItemTitle= new FormControl('');

// Board view specific
initialDescHeight: number = 0;
Expand Down Expand Up @@ -197,6 +199,7 @@ export class WorkItemQuickAddComponent implements OnInit, OnDestroy, AfterViewIn
parentId: this.parentWorkItemId,
openDetailPage: openStatus
}));
this.workItemTitle.setValue('');
} else {
this.blockAdd = false;
this.error = 'Title can not be empty.';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';

import { BsDropdownConfig, BsDropdownModule } from 'ngx-bootstrap/dropdown';
import { PermissionQuery } from '../../models/permission.model';
Expand All @@ -14,7 +14,8 @@ import { WorkItemQuickAddComponent } from './work-item-quick-add.component';
CommonModule,
CommonSelectorModule,
FormsModule,
InfotipModule
InfotipModule,
ReactiveFormsModule
],
declarations: [WorkItemQuickAddComponent],
exports: [WorkItemQuickAddComponent],
Expand Down
3 changes: 2 additions & 1 deletion src/app/effects/work-item.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { Actions, Effect } from '@ngrx/effects';
import { select, Store } from '@ngrx/store';
import { Notification, Notifications, NotificationType } from 'ngx-base';
import { Observable, of } from 'rxjs';
import { empty, Observable, of } from 'rxjs';
import { catchError, map, mergeMap, switchMap } from 'rxjs/operators';
import { cleanObject } from '../models/common.model';
import { FilterService } from '../services/filter.service';
Expand Down Expand Up @@ -133,6 +133,7 @@ export class WorkItemEffects {
} catch (e) {
console.log('Work item is added.');
}
return empty();
}
return of(new WorkItemActions.AddSuccess(wItem));
}
Expand Down

0 comments on commit b2c271f

Please sign in to comment.