my-test123
Version:
A planner front-end for Fabric8.
295 lines (294 loc) • 10.7 kB
TypeScript
import 'rxjs/add/operator/toPromise';
import 'rxjs/operators/map';
import 'rxjs/add/operator/catch';
import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject';
import { Broadcaster, Logger } from 'ngx-base';
import { AuthenticationService, User, UserService } from 'ngx-login-client';
import { Spaces } from 'ngx-fabric8-wit';
import { Notifications } from 'ngx-base';
import { Comment } from '../models/comment';
import { AreaModel } from '../models/area.model';
import { AreaService } from './area.service';
import { IterationModel } from '../models/iteration.model';
import { IterationService } from './iteration.service';
import { Link } from '../models/link';
import { WorkItem, WorkItemService as WIService } from '../models/work-item';
import { WorkItemType } from '../models/work-item-type';
import { HttpService } from './http-service';
export declare class WorkItemService {
private http;
private broadcaster;
private logger;
private areaService;
private auth;
private iterationService;
private userService;
private notifications;
private spaces;
private baseApiUrl;
private workItemUrl;
private workItemTypeUrl;
private linkTypesUrl;
private linksUrl;
private reorderUrl;
private baseSearchUrl;
private renderUrl;
private headers;
private availableStates;
workItemTypes: WorkItemType[];
private nextLink;
private initialWorkItemFetchDone;
private userIdMap;
private workItemIdIndexMap;
private prevFilters;
private iterations;
_currentSpace: any;
private selfId;
addWIObservable: Subject<any>;
addWIChildObservable: Subject<any>;
editWIObservable: Subject<WorkItem>;
selectedWIObservable: Subject<WorkItem>;
showTree: Subject<boolean>;
constructor(http: HttpService, broadcaster: Broadcaster, logger: Logger, areaService: AreaService, auth: AuthenticationService, iterationService: IterationService, userService: UserService, notifications: Notifications, spaces: Spaces, baseApiUrl: string);
notifyError(message: string, httpError: any): void;
createId(): string;
getChildren(parent: WorkItem): Observable<WorkItem[]>;
getChildren2(url: string): Observable<WIService[]>;
getWorkItems(pageSize?: number, filters?: any[]): Observable<{
workItems: WorkItem[];
nextLink: string;
totalCount?: number | null;
included?: WorkItem[] | null;
ancestorIDs?: Array<string>;
}>;
getWorkItems2(pageSize: number, filters: object): Observable<{
workItems: WorkItem[];
nextLink: string;
totalCount?: number | null;
included?: WorkItem[] | null;
ancestorIDs?: Array<string>;
}>;
/**
* This function is called from next page onwards in the scroll
* It does pretty much same as the getWorkItems function
*/
getMoreWorkItems(url: any): Observable<{
workItems: WorkItem[];
nextLink: string | null;
included?: WorkItem[] | null;
ancestorIDs?: Array<string>;
}>;
resolveWorkItems(workItems: any, iterations: any, users: any, wiTypes: any, labels: any, included?: WorkItem[]): WorkItem[];
getNextLink(): string;
setNextLink(link: string): void;
/**
* Usage: This method gives a single work item by display number.
*
* @param id : string - number
* @param owner : string
* @param space : string
*/
getWorkItemByNumber(id: string | number, owner?: string, space?: string): Observable<WorkItem>;
/**
* Usage: To resolve the users in eact WorkItem
* For now it resolves assignne and creator
*/
resolveUsersForWorkItem(workItem: WorkItem): void;
/**
* Usage: Resolve the list of assignees for a WorkItem
*/
resolveAssignee(workItem: WorkItem): void;
resolveAssignees(assignees: any): Observable<User[]>;
getUsersByURLs(userURLs: string[]): Observable<User[]>;
resolveCreator2(creator: any): Observable<User>;
resolveCommentCreator(creator: any): Observable<User>;
/**
* Usage: Resolve the creator for a WorkItem
*/
resolveCreator(workItem: WorkItem): void;
/**
* Usage: Resolve the wi type for a WorkItem
*/
resolveType(workItem: WorkItem): void;
/**
* Usage: To resolve the users in eact WorkItem
* For now it resolves assignne and creator
*/
resolveIterationForWorkItem(workItem: WorkItem): void;
/**
* Usage: To resolve the areas in eact WorkItem
* For now it resolves assignne and creator
*/
resolveAreaForWorkItem(workItem: WorkItem): void;
/**
* Usage: Build a ID-User map to dynamically access list of users
* This method takes the locally saved list of users from User Service
* Before coming to this method we fetch the list of users using router resolver
* in detail and list component.
*/
buildUserIdMap(): void;
/**
* Usage: Fetch an use by it's ID from the User-ID map
*/
getUserById(userId: string): User;
/**
* Usage: Fetch an area by it's ID from the areas list
*/
getAreaById(areaId: string): Observable<AreaModel>;
/**
* Usage: Fetch an iteration by it's ID from the iterations list
*/
getIterationById(iterationId: string): Observable<IterationModel>;
/**
* Usage: This method is to resolve the comments for a work item
* This method is only called when a single item is fetched for the
* details page.
*
* @param: WorkItem - wItem
*/
resolveComments(url: string): Observable<any>;
/**
* Usage: This method is to resolve the linked items for a work item
* This method is only called when a single item is fetched for the
* details page.
*
* @param: WorkItem - wItem
*/
resolveLinks(url: string): Observable<any>;
/**
* Usage: This method is to fetch the work item types
* This method will be deprecated and types will come from
* router resolver
* ToDo: Use router resolver to fetch types here
*/
getWorkItemTypes(): Observable<any[]>;
getWorkItemTypes2(workItemTypeUrl: any): Observable<any[]>;
/**
* Usage: This method is to fetch the work item types by ID
*/
getWorkItemTypesById(id: string): Observable<WorkItemType>;
/**
* Usage: This method is to fetch the work item states
* This method will be deprecated and states will come from
* router resolver
* ToDo: Use router resolver to fetch states here
*/
getStatusOptions(): Observable<any[]>;
/**
* Usage: This method deletes an item
* removes the delted item from the big list
* re build the ID-Index map
*
* @param: WorkItem - workItem (Item to be delted)
*/
delete(workItem: WorkItem): Observable<void>;
/**
* Usage: This method create a new item
* adds the new item to the big list
* resolve the users for the item
* re build the ID-Index map
*
* @param: WorkItem - workItem (Item to be created)
*/
create(workItem: WorkItem): Observable<WorkItem>;
/**
* Usage: This method emit a new work item created event
* The list view and board view listens to this event
* and updates the view based on applied filters.
*/
emitAddWI(workitemDetail: any): void;
emitAddWIChild(workitemDetail: any): void;
/**
* Usage: This method emit a new work item created event
* The list view and board view listens to this event
* and updates the view based on applied filters.
*/
emitEditWI(workItem: WorkItem): void;
/**
* Usage: This method emit a event when WI get seleceted.
*/
emitSelectedWI(workItem: WorkItem): void;
/**
* Usage: this method emit a event when showTree is toggled
*/
emitShowTree(showTree: boolean): void;
/**
* Usage: This method update an existing item
* updates the item in the big list
* resolve the users for the item
*
* @param: WorkItem - workItem (Item to be created)
*/
update(workItem: WorkItem): Observable<WorkItem>;
/**
* Usage: This method create a comment for a workItem
*
* @param: string - id (Work Item ID)
* @param: Comment
*/
createComment(url: string, comment: Comment): Observable<Comment>;
updateComment(comment: Comment): Observable<Comment>;
deleteComment(comment: Comment): Observable<any>;
/**
* Usage: This function fetches all the work item link types
* Store it in an instance variable
*
* @return Promise of LinkType[]
*/
getAllLinkTypes(workItem: WorkItem): Observable<any>;
/**
* Usage: This function fetches all the work item link types
* Store it in an instance variable
*
* @return Promise of LinkType[]
*/
getLinkTypes(workItem: WorkItem): Observable<Object>;
formatLinkTypes(linkTypes: any): any;
/**
* Usage: This function adds a link to a work item
* Stroes the resolved link in relationalData
* Updates the reference of workItem so doesn't return anything
*
* @param link: Link
* @param includes: any - Data relavent to the link
* @param wItem: WorkItem
*/
addLinkToWorkItem(link: Link, includes: any, wItem: WorkItem): void;
/**
* Usage: This function removes a link from a work item
* Removes the link from relationalData
* Updates the reference of workItem so doesn't return anything
*
* @param link: Link
* @param wItem: WorkItem
*/
removeLinkFromWorkItem(deletedLink: Link, wItem: WorkItem): void;
/**
* Usage: Makes an API call to create a link
* Recieves the new link response
* Resolves and add the new link to the workItem
*
* @param link: Link - The new link object for request params
* @returns Promise<Link>
*/
createLink(link: Object): Observable<any>;
/**
* Usage: Makes an API call to delete a link
* Removes the new link to the workItem
*
* @param link: Link
* @param currentWiId: string - The work item ID where the link is created
* @returns Promise<void>
*/
deleteLink(link: any, currentWiId: string): Observable<void>;
searchLinkWorkItem(term: string): Observable<WorkItem[]>;
/**
* Usage: Make a API call to save
* the order of work item.
*
* @param workItemId: string
*/
reOrderWorkItem(workItem: WorkItem, prevWiId: string | null, direction: string): Observable<any>;
renderMarkDown(markDownText: string): Observable<any>;
}