Example #1
0
 @observeEvent(EventConst.STORY_SELECTED)
 _onStorySelected(event) {
     this._selectedStory = event.story;
     this._allStories.forEach(story => {
         story.isSelected = story === event.story;
     });
 }
Example #2
0
 public getCustomerName(appStore:AppStore) {
     let name:string = '';
     var businessId = this.getKey('businessId');
     var businessUsers:List<BusinessUser> = appStore.getState().business.get('businessUsers');
     businessUsers.forEach((businessUser:BusinessUser)=> {
         if (businessUser.getBusinessId() == businessId)
             name = businessUser.getName();
     })
     return name;
 }
Example #3
0
 public getSource(appStore:AppStore) {
     let source:string = '';
     var businessId = this.getKey('businessId');
     var businesses:List<BusinessModel> = appStore.getState().business.get('businesses');
     businesses.forEach((business:BusinessModel)=> {
         if (business.getBusinessId() == businessId)
             source = business.getKey('source');
     })
     return source;
 }
Example #4
0
export function findVerticalCollisionsWithCursor(timelineDuration: number, stacks: List<List<Record<Annotation>>>, currentTime: number) {
  const res: {annotation: Record<Annotation>, annotationIndex: number, annotationStackIndex: number}[] = []
  stacks.forEach((stack, annotationStackIndex) => {
    stack.forEach((annotation, annotationIndex) => {
      if(recordHasCollisionWithCursor(timelineDuration, annotation, currentTime)) {
        res.push({annotation, annotationIndex, annotationStackIndex})
      }
    })
  })
  return res
}
Example #5
0
 @observeEvent(EventConst.EPIC_SELECTED)
 _onEpicSelected(event) {
     this._selectedEpic = event.epic;
     this._epics.forEach(epic => {
         epic.isSelected = epic === event.epic;
     });
     if (this._selectedStory && this._selectedStory.epic !== this._selectedEpic) {
         this._selectedStory.isSelected = false;
         this._selectedStory = null;
     }
 }
Example #6
0
export function moveInList<T>(list: List<T>, itemIndex: number, insertPoint: number): List<T> {
  var n = list.size;
  if (itemIndex < 0 || itemIndex >= n) throw new Error('itemIndex out of range');
  if (insertPoint < 0 || insertPoint > n) throw new Error('insertPoint out of range');
  var newArray: T[] = [];
  list.forEach((value, i) => {
    if (i === insertPoint) newArray.push(list.get(itemIndex));
    if (i !== itemIndex) newArray.push(value);
  });
  if (n === insertPoint) newArray.push(list.get(itemIndex));
  return List(newArray);
}
Example #7
0
    // Gets called by the router when an event for this model has been processed by observers,
    // great place for aggregate operations and/or validation.
    postProcess() {
        this._allStories = this._epics.flatMap(epic => epic.stories).toList();

        if (this._selectedEpic) {
            this._displayedStories = this._allStories
                .filter(story => story.epic === this.selectedEpic)
                .toList();
        } else {
            this._displayedStories = this.allStories;
        }
        this._showAllStoriesButton = this.selectedEpic && this.allStories.count() !== this.displayedStories.count();
        this._epics.forEach(epic => {
            epic.postProcess();
        });
    }
Example #8
0
function findHorizontalCollisions(timelineDuration: number, list: List<Record<Annotation>>, indices: List<number>, checkSelf: boolean=false) {
  const collisions: {annotation: Record<Annotation>, index: number}[] = []
  const isInIndices = (k: number) => {
    if(checkSelf) {
      return indices.find(i => i === k) !== undefined
    } else {
      return false
    }
  }
  let n = 1
  let nextIndex
  indices.forEach(i => {
    // Collision to right
    n = 1
    nextIndex = i+n
    while(nextIndex < list.size && !isInIndices(nextIndex) && recordHasCollision(list.get(i)!, list.get(nextIndex)!, timelineDuration)) {
      collisions.push({annotation: list.get(nextIndex)!, index: nextIndex})
      nextIndex = i+(++n)
    }
    // Collision to left
    n = 1
    nextIndex = i-n
    while(nextIndex >= 0 && !isInIndices(nextIndex) && recordHasCollision(list.get(i)!, list.get(nextIndex)!, timelineDuration)) {
      collisions.push({annotation: list.get(nextIndex)!, index: nextIndex})
      nextIndex = i-(++n)
    }
  })

  const uniqueMapIndexMap: {[key: number]: boolean} = {}
  return collisions.filter(({index}) => {
    if(uniqueMapIndexMap[index]) {
      return false
    } else {
      uniqueMapIndexMap[index] = true
      return true
    }
  })
}
Example #9
0
 return Map<string, number>().withMutations(mutable => {
   tasksForProject.forEach((task, index) => {
     mutable.set(task.display, index);
   });
 });