Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ngAfterViewInit() {
if (this.actionSource === ActionSource.Animated) {
// Animated canvas specific setup.
this.registerSubscription(
combineLatest(
// TODO: don't think this is necessary anymore? only need to query playback service now?
merge(
this.playbackService.asObservable().pipe(map(event => event.vl)),
this.store.select(getVectorLayer),
),
this.store.select(getCanvasOverlayState),
).subscribe(
([
vectorLayer,
{ hiddenLayerIds, selectedLayerIds, isActionMode, selectedBlockLayerIds },
]) => {
this.vectorLayer = vectorLayer;
this.hiddenLayerIds = hiddenLayerIds;
this.selectedLayerIds = selectedLayerIds;
this.isActionMode = isActionMode;
this.selectedBlockLayerIds = selectedBlockLayerIds;
this.draw();
},
),
public getCurrentUserId(): Observable {
return this.getCurrentUserObject().pipe(
map(str => {
// Userstring Layout is "Domain\\user"
// This returns just the "user"
return str.user.toLowerCase().split('\\')[1];
})
);
}
constructor(store: Store) {
const recentEntities$ = store.select(recentlyVisitedSelector);
this.hasHits$ = recentEntities$.pipe(
map(recentEntities => recentEntities && !!recentEntities.hits && recentEntities.hits.length > 0)
);
const entitiesManager$ = recentEntities$.pipe(
filter(recentEntities => recentEntities && !!recentEntities.hits && recentEntities.hits.length > 0),
map(recentEntities => new CountedRecentEntitiesManager(recentEntities, store)),
);
this.frecentEntities$ = entitiesManager$.pipe(
map(manager => manager.getFrecentEntities()),
);
this.recentEntities$ = entitiesManager$.pipe(
map(manager => manager.getRecentEntities())
);
}
}
switchMap(({ doi }) =>
this.publishedDataApi.register(encodeURIComponent(doi)).pipe(
map(publishedData =>
fromActions.registerPublishedDataCompleteAction({ publishedData })
),
catchError(() => of(fromActions.registerPublishedDataFailedAction()))
)
)
export function docChanges(query: Query): Observable[]> {
return fromCollectionRef(query)
.pipe(
map(action =>
action.payload.docChanges()
.map(change => ({ type: change.type, payload: change } as DocumentChangeAction))));
}
const deleteLabel = (args: GQL.IDeleteLabelOnMutationArguments): Promise =>
mutateGraphQL(
gql`
mutation DeleteLabel($label: ID!) {
deleteLabel(label: $label) {
alwaysNil
}
}
`,
args
)
.pipe(
map(dataOrThrowErrors),
mapTo(void 0)
)
.toPromise()
mergeMap(req => of(req).pipe(
map(req => req.params.id),
switchMap(Dao.getUserById),
map(user => ({ body: user })),
catchError(() => throwError(
new HttpError('User does not exist', HttpStatus.NOT_FOUND)
))
)),
)));
export function createUser(username: string, email: string | undefined): Observable {
return mutateGraphQL(
gql`
mutation CreateUser($username: String!, $email: String) {
createUser(username: $username, email: $email) {
resetPasswordURL
}
}
`,
{ username, email }
).pipe(
map(dataOrThrowErrors),
map(data => data.createUser)
)
}
...DiffStatFields
}
}
}
}
}
}
${gitRevisionRangeFieldsFragment}
${fileDiffFieldsFragment}
${fileDiffHunkRangeFieldsFragment}
${diffStatFieldsFragment}
`,
{ changeset: changeset.id }
).pipe(
map(dataOrThrowErrors),
map(data => {
if (!data || !data.node || data.node.__typename !== 'Changeset') {
throw new Error('changeset not found')
}
return data.node.repositoryComparison
})
)
}
getResources(resourceName: string): Observable {
const $data = this.http
.get(this.resourcesUrl(resourceName))
.pipe(
map((resp: any) => resp.data),
share()
);
return $data.pipe(
catchError(this.handleError)
);
}