This repository has been archived by the owner on May 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(delete-work-item): add delete work item from list (#2797)
* feat(delete-work-item): add delete work item from query list, preview and detail page * feat(delete-work-item): add test for delete work item * feat(delete-work-item): add internal user level feature flag * fix(test): fix delete work item test
- Loading branch information
1 parent
e3271db
commit c45d8bc
Showing
24 changed files
with
267 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/app/components_ngrx/delete-work-item/delete-work-item.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<f8-feature-toggle featureName="Planner.deleteWorkItem" [userLevel]="internal"></f8-feature-toggle> | ||
<ng-template #internal> | ||
<span *ngIf="allowDelete | async" | ||
id="wi-delete-icon" | ||
class="pficon-delete delete-icon pointer" | ||
placement="right" | ||
tooltip="Delete work item" | ||
(click)="deleteWorkItem($event)"> | ||
</span> | ||
</ng-template> |
5 changes: 5 additions & 0 deletions
5
src/app/components_ngrx/delete-work-item/delete-work-item.component.less
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@import '../../../assets/stylesheets/shared/_variables.less'; | ||
|
||
.delete-icon { | ||
color: @color-pf-red-100; | ||
} |
55 changes: 55 additions & 0 deletions
55
src/app/components_ngrx/delete-work-item/delete-work-item.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; | ||
import { Store } from '@ngrx/store'; | ||
import { Observable } from 'rxjs'; | ||
import { first } from 'rxjs/operators'; | ||
import { Delete } from '../../actions/work-item.actions'; | ||
import { PermissionQuery } from '../../models/permission.model'; | ||
import { WorkItemUI } from '../../models/work-item'; | ||
import { ModalService } from '../../services/modal.service'; | ||
import { AppState } from '../../states/app.state'; | ||
|
||
@Component({ | ||
selector: 'f8-delete-workitem', | ||
templateUrl: './delete-work-item.component.html', | ||
styleUrls: ['./delete-work-item.component.less'] | ||
}) | ||
|
||
export class DeleteWorkItemComponent { | ||
|
||
@Input('workItem') set workItemInput(val: WorkItemUI) { | ||
if (val) { | ||
this.workItem = val; | ||
this.allowDelete = | ||
this.permissionQuery.isAllowedToDelete(val); | ||
} | ||
} | ||
@Input() detailContext: string = ''; | ||
|
||
@Output() readonly onDelete: EventEmitter<any> = new EventEmitter; | ||
|
||
allowDelete: Observable<boolean>; | ||
workItem: WorkItemUI; | ||
|
||
constructor( | ||
private modalService: ModalService, | ||
private store: Store<AppState>, | ||
private permissionQuery: PermissionQuery | ||
) {} | ||
|
||
deleteWorkItem(event: MouseEvent): void { | ||
let note = 'Are you sure you want to delete this work item?'; | ||
if (this.workItem.hasChildren) { | ||
note = 'This work item has children. ' + note; | ||
} | ||
this.modalService.openModal('Delete Work Item', note, 'Delete', 'deleteWorkItem') | ||
.pipe( | ||
first() | ||
).subscribe((actionKey: string) => { | ||
if (actionKey === 'deleteWorkItem') { | ||
this.onDelete.emit(); | ||
this.store.dispatch(new Delete(this.workItem)); | ||
} | ||
}); | ||
} | ||
} | ||
|
27 changes: 27 additions & 0 deletions
27
src/app/components_ngrx/delete-work-item/delete-work-item.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { TooltipConfig, TooltipModule } from 'ngx-bootstrap/tooltip'; | ||
import { FeatureFlagModule } from 'ngx-feature-flag'; | ||
import { ModalService } from '../../services/modal.service'; | ||
import { DeleteWorkItemComponent } from './delete-work-item.component'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
TooltipModule, | ||
FeatureFlagModule | ||
], | ||
declarations: [ | ||
DeleteWorkItemComponent | ||
], | ||
exports: [ | ||
DeleteWorkItemComponent | ||
], | ||
providers: [ | ||
ModalService, | ||
TooltipConfig | ||
] | ||
}) | ||
|
||
export class DeleteWorkItemModule {} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,5 +57,5 @@ | |
} | ||
|
||
work-item-cell { | ||
max-width: ~'calc(e("100% - 20px"))'; | ||
max-width: ~'calc(e("100% - 50px"))'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.