type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
TypeAliasDeclaration
/** * The type of placement policy for a service fabric service. Following are the possible values. */ export type ServicePlacementPolicyType = (typeof ServicePlacementPolicyType)[keyof typeof ServicePlacementPolicyType];
polivbr/pulumi-azure-native
sdk/nodejs/types/enums/servicefabric/v20210101preview/index.ts
TypeScript
TypeAliasDeclaration
/** * Specifies the mechanism associated with this scaling policy. */ export type ServiceScalingMechanismKind = (typeof ServiceScalingMechanismKind)[keyof typeof ServiceScalingMechanismKind];
polivbr/pulumi-azure-native
sdk/nodejs/types/enums/servicefabric/v20210101preview/index.ts
TypeScript
TypeAliasDeclaration
/** * Specifies the trigger associated with this scaling policy. */ export type ServiceScalingTriggerKind = (typeof ServiceScalingTriggerKind)[keyof typeof ServiceScalingTriggerKind];
polivbr/pulumi-azure-native
sdk/nodejs/types/enums/servicefabric/v20210101preview/index.ts
TypeScript
FunctionDeclaration
export function durationStringToMs(s: string) { return Number(s.slice(0, -1)) * 1000 }
ferdaber/react-transient
src/lib/transition-utils.ts
TypeScript
FunctionDeclaration
export function totalTransitionDuration(durationString: string, delayString: string) { const durations = durationString.split(',') let delays = delayString.split(',') while (delays.length < durations.length) { delays = delays.concat(delays) } return Math.max(...durations.map((d, i) => durationStringToMs(d) + durationStringToMs(delays[i]))) }
ferdaber/react-transient
src/lib/transition-utils.ts
TypeScript
FunctionDeclaration
export function getSniffedCssInfo(type: 'animation' | 'transition', el: HTMLElement) { const { animationDuration, animationDelay, transitionDuration, transitionDelay } = getComputedStyle(el) const maxDurations = { animation: null as number, transition: null as number } maxDurations.animation = totalTransitionDuration(animationDuration, animationDelay) maxDurations.transition = totalTransitionDuration(transitionDuration, transitionDelay) const maxType = maxDurations.transition > maxDurations.animation ? 'transition' : 'animation' return type ? { type, duration: maxDurations[type], numDurations: type === 'transition' ? transitionDuration.split(',').length : animationDuration.split(',').length } : { type: maxType, duration: maxDurations[maxType], numDurations: maxType === 'transition' ? transitionDuration.split(',').length : animationDuration.split(',').length } }
ferdaber/react-transient
src/lib/transition-utils.ts
TypeScript
FunctionDeclaration
export function onAllTransitionsEnd(type: 'animation' | 'transition', el: HTMLElement, callback: Function) { // use explicitly provided type if available // sniff for CSS properties for transition or animation and get the maximum duration // set a timeout for the maximum duration, and also append transition/animation end handlers // call the callback when the timeout or the event handlers occur, whichever comes first const sniffedInfo = getSniffedCssInfo(type, el) const totalNumTransitionEnds = sniffedInfo.numDurations const eventType = `${sniffedInfo.type}end` let numTransitionEnds = 0 let timeout: number function doneCallback() { window.clearTimeout(timeout) el.removeEventListener(eventType, onAnimationEnd) callback() } function onAnimationEnd(event: AnimationEvent) { // the slowest animation is the last animation, so we are done when the number of animations ended // is equal to the total event.target === el && ++numTransitionEnds >= totalNumTransitionEnds && doneCallback() } timeout = window.setTimeout(doneCallback, sniffedInfo.duration) el.addEventListener(eventType, onAnimationEnd) return function clearTimeouts() { window.clearTimeout(timeout) el.removeEventListener(eventType, onAnimationEnd) } }
ferdaber/react-transient
src/lib/transition-utils.ts
TypeScript
FunctionDeclaration
function doneCallback() { window.clearTimeout(timeout) el.removeEventListener(eventType, onAnimationEnd) callback() }
ferdaber/react-transient
src/lib/transition-utils.ts
TypeScript
FunctionDeclaration
function onAnimationEnd(event: AnimationEvent) { // the slowest animation is the last animation, so we are done when the number of animations ended // is equal to the total event.target === el && ++numTransitionEnds >= totalNumTransitionEnds && doneCallback() }
ferdaber/react-transient
src/lib/transition-utils.ts
TypeScript
ArrowFunction
(d, i) => durationStringToMs(d) + durationStringToMs(delays[i])
ferdaber/react-transient
src/lib/transition-utils.ts
TypeScript
ArrowFunction
() => { // 重新初始化Console中渲染的TreeModel this.initTreeModel(this.manager.currentSession, true); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
() => { this.treeModel?.root.collapsedAll(); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
() => { let text = ''; if (!this.treeModel?.root || !this.treeModel.root.children) { return; } for (const child of this.treeModel.root.children) { text += this.getValidText(child as DebugConsoleNode) + '\n'; } this.clipboardService.writeText(text.slice(0, -'\n'.length)); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
(node: DebugConsoleNode) => { if (node) { this.clipboardService.writeText(this.getValidText(node)); } }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
(session: DebugSession) => { this.debugSessionModelMap.delete(session.id); if (this.debugSessionModelMap.size > 0) { this.initTreeModel(this.manager.currentSession); } }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
(state: DidChangeActiveDebugSession) => { if (state.current) { this.initTreeModel(state.current); } }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
(target) => { this.loadingDecoration.addTarget(target); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
(target) => { this.loadingDecoration.removeTarget(target); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
() => { // 更新树前更新下选中节点 if (this.selectedNodes.length !== 0) { // 仅处理一下单选情况 const node = this.treeModel?.root.getTreeNodeByPath(this.selectedNodes[0].path); this.selectedDecoration.addTarget(node as ExpressionNode); } }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
async () => { if (!treeModel) { return; } const branchSize = (treeModel.root as DebugConsoleRoot).branchSize; const children = debugConsoleSession.resolveChildren(); (treeModel.root as DebugConsoleRoot).updatePresetChildren(children); if (branchSize === children.length) { return; } else { this.refresh(); } if (treeModel.isScrollBottom) { await this.treeHandle.ensureVisible(children[children.length - 1]); } treeModel?.dispatchChange(); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
(target: AnsiConsoleNode | DebugConsoleNode, dispatchChange = true) => { if (this.contextMenuNode) { this.contextMenuDecoration.removeTarget(this.contextMenuNode); this._contextMenuNode = undefined; } if (target) { if (this.selectedNodes.length > 0) { // 因为选择装饰器可能通过其他方式添加而不能及时在selectedNodes上更新 // 故这里遍历所有选中装饰器的节点进行一次统一清理 for (const target of this.selectedDecoration.appliedTargets.keys()) { this.selectedDecoration.removeTarget(target); } } if (this.focusedNode) { } this.selectedDecoration.addTarget(target); this._focusedNode = target; this._selectedNodes = [target]; if (dispatchChange) { // 通知视图更新 this.treeModel?.dispatchChange(); } } }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
(target: AnsiConsoleNode | DebugConsoleNode) => { if (this.contextMenuNode) { this.contextMenuDecoration.removeTarget(this.contextMenuNode); } if (this.focusedNode) { this._focusedNode = undefined; } this.contextMenuDecoration.addTarget(target); this._contextMenuNode = target; this.treeModel?.dispatchChange(); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
() => { if (this.focusedNode) { this._focusedNode = undefined; } if (this.contextMenuNode) { this.contextMenuDecoration.removeTarget(this.contextMenuNode); } this.treeModel?.dispatchChange(); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
(ev: React.MouseEvent, expression?: AnsiConsoleNode | DebugConsoleNode) => { ev.stopPropagation(); ev.preventDefault(); const { x, y } = ev.nativeEvent; this.debugContextKey.contextInDebugConsole.set(true); if (expression) { this.activeNodeActivedDecoration(expression); } else { this.enactiveNodeDecoration(); } let node: AnsiConsoleNode | DebugConsoleNode; if (!expression) { // 空白区域右键菜单 node = this.treeModel?.root as DebugConsoleNode; } else { node = expression; } const menus = this.contextMenuService.createMenu({ id: MenuId.DebugConsoleContext, contextKeyService: this.debugContextKey.contextKeyScoped, }); const menuNodes = menus.getMergedMenuNodes(); menus.dispose(); this.ctxMenuRenderer.show({ anchor: { x, y }, menuNodes, args: [node], onHide: () => { window.requestAnimationFrame(() => { this.debugContextKey.contextInDebugConsole.set(false); }); }, }); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
() => { window.requestAnimationFrame(() => { this.debugContextKey.contextInDebugConsole.set(false); }); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
() => { this.debugContextKey.contextInDebugConsole.set(false); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
() => { // 清空焦点状态 this.enactiveNodeDecoration(); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
(item: AnsiConsoleNode | DebugConsoleNode) => { // 单选操作默认先更新选中状态 this.activeNodeDecoration(item); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
(item: AnsiConsoleNode | DebugConsoleNode, type: TreeNodeType) => { if (type === TreeNodeType.CompositeTreeNode) { if (DebugConsoleNode.is(item) && (item as DebugConsoleNode).available) { this.activeNodeDecoration(item, false); this.toggleDirectory(item as ExpressionContainer); return; } else { if ((item as ExpressionContainer).variablesReference) { this.activeNodeDecoration(item, false); this.toggleDirectory(item as ExpressionContainer); return; } } } this.activeNodeDecoration(item); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
async (item: ExpressionContainer) => { if (item.expanded) { this.treeHandle.collapseNode(item); } else { this.treeHandle.expandNode(item); } }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
() => { this.onDidRefreshedEmitter.fire(); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
async () => { await this.flushEventQueue()!; this.flushEventQueueDeferred?.resolve(); this.flushEventQueueDeferred = null; callback(); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
() => { let promise: Promise<any>; if (!this._changeEventDispatchQueue || this._changeEventDispatchQueue.length === 0) { return; } this._changeEventDispatchQueue.sort((pathA, pathB) => { const pathADepth = Path.pathDepth(pathA); const pathBDepth = Path.pathDepth(pathB); return pathADepth - pathBDepth; }); const roots = [this._changeEventDispatchQueue[0]]; for (const path of this._changeEventDispatchQueue) { if (roots.some((root) => path.indexOf(root) === 0)) { continue; } else { roots.push(path); } } promise = pSeries( roots.map((path) => async () => { const node = this.treeModel?.root?.getTreeNodeByPath(path); if (node && CompositeTreeNode.is(node)) { await (node as CompositeTreeNode).refresh(); } return null; }), ); // 重置更新队列 this._changeEventDispatchQueue = []; return promise; }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
(pathA, pathB) => { const pathADepth = Path.pathDepth(pathA); const pathBDepth = Path.pathDepth(pathB); return pathADepth - pathBDepth; }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
(root) => path.indexOf(root) === 0
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
(path) => async () => { const node = this.treeModel?.root?.getTreeNodeByPath(path); if (node && CompositeTreeNode.is(node)) { await (node as CompositeTreeNode).refresh(); } return null; }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
ArrowFunction
async () => { const node = this.treeModel?.root?.getTreeNodeByPath(path); if (node && CompositeTreeNode.is(node)) { await (node as CompositeTreeNode).refresh(); } return null; }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
InterfaceDeclaration
export interface IDebugConsoleHandle extends IRecycleTreeHandle { hasDirectFocus: () => boolean; }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
InterfaceDeclaration
export interface IDebugConsoleModel { treeModel: DebugConsoleTreeModel; debugConsoleSession: DebugConsoleSession; }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
MethodDeclaration
private getValidText(node: DebugConsoleNode) { return node.description; }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
MethodDeclaration
getConsoleModel(id: string): IDebugConsoleModel | undefined { return this.debugSessionModelMap.get(id); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
MethodDeclaration
dispose() { this.disposeTreeModel(); this.disposeDebugConsole(); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
MethodDeclaration
disposeTreeModel() { if (!this.treeModelDisposableCollection.disposed) { this.treeModelDisposableCollection.dispose(); } }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
MethodDeclaration
disposeDebugConsole() { if (!this.debugConsoleDisposableCollection.disposed) { this.debugConsoleDisposableCollection.dispose(); } }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
MethodDeclaration
async init() { this.debugConsoleDisposableCollection.push( this.manager.onDidDestroyDebugSession((session: DebugSession) => { this.debugSessionModelMap.delete(session.id); if (this.debugSessionModelMap.size > 0) { this.initTreeModel(this.manager.currentSession); } }), ); this.debugConsoleDisposableCollection.push( this.manager.onDidChangeActiveDebugSession((state: DidChangeActiveDebugSession) => { if (state.current) { this.initTreeModel(state.current); } }), ); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
MethodDeclaration
listenTreeViewChange() { this.disposeTreeModel(); this.treeModelDisposableCollection.push( this.treeModel?.root.watcher.on(TreeNodeEvent.WillResolveChildren, (target) => { this.loadingDecoration.addTarget(target); }), ); this.treeModelDisposableCollection.push( this.treeModel?.root.watcher.on(TreeNodeEvent.DidResolveChildren, (target) => { this.loadingDecoration.removeTarget(target); }), ); this.treeModelDisposableCollection.push( this.treeModel!.onWillUpdate(() => { // 更新树前更新下选中节点 if (this.selectedNodes.length !== 0) { // 仅处理一下单选情况 const node = this.treeModel?.root.getTreeNodeByPath(this.selectedNodes[0].path); this.selectedDecoration.addTarget(node as ExpressionNode); } }), ); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
MethodDeclaration
async initTreeModel(session?: DebugSession, force?: boolean) { if (!session) { this._activeDebugSessionModel = undefined; this.onDidUpdateTreeModelEmitter.fire(this._activeDebugSessionModel); return; } // 根据 IDebugSessionReplMode 判断子 session 是否要共享父 session 的 repl const sessionId = session.hasSeparateRepl() ? session.id : session.parentSession!.id; if (this.debugSessionModelMap.has(sessionId) && !force) { const model = this.debugSessionModelMap.get(sessionId); this._activeDebugSessionModel = model; } else { // 根据是否为多工作区创建不同根节点 const root = new DebugConsoleRoot({} as any); if (!root) { return; } const treeModel = this.injector.get<any>(DebugConsoleTreeModel, [root]); const debugConsoleSession = this.injector.get<any>(DebugConsoleSession, [ session, treeModel, ]) as DebugConsoleSession; this._activeDebugSessionModel = { treeModel, debugConsoleSession, }; debugConsoleSession.onDidChange(async () => { if (!treeModel) { return; } const branchSize = (treeModel.root as DebugConsoleRoot).branchSize; const children = debugConsoleSession.resolveChildren(); (treeModel.root as DebugConsoleRoot).updatePresetChildren(children); if (branchSize === children.length) { return; } else { this.refresh(); } if (treeModel.isScrollBottom) { await this.treeHandle.ensureVisible(children[children.length - 1]); } treeModel?.dispatchChange(); }); this.debugSessionModelMap.set(sessionId, this._activeDebugSessionModel); this.initDecorations(root); this.listenTreeViewChange(); } this.onDidUpdateTreeModelEmitter.fire(this._activeDebugSessionModel); return this._activeDebugSessionModel; }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
MethodDeclaration
initDecorations(root) { this._decorations = new DecorationsManager(root as any); this._decorations.addDecoration(this.selectedDecoration); this._decorations.addDecoration(this.contextMenuDecoration); this._decorations.addDecoration(this.loadingDecoration); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
MethodDeclaration
removeNodeDecoration() { if (!this.decorations) { return; } this.decorations.removeDecoration(this.selectedDecoration); this.decorations.removeDecoration(this.contextMenuDecoration); this.decorations.removeDecoration(this.loadingDecoration); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
MethodDeclaration
handleTreeHandler(handle: IDebugConsoleHandle) { this._debugWatchTreeHandle = handle; }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
MethodDeclaration
private dispatchWatchEvent(root: DebugConsoleRoot, path: string, event: IWatcherEvent) { const watcher = root.watchEvents.get(path); if (watcher && watcher.callback) { watcher.callback(event); } }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
MethodDeclaration
collapsedAll() { this.treeModel?.root.collapsedAll(); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
MethodDeclaration
/** * 刷新指定下的所有子节点 */ async refresh(node?: ExpressionContainer) { if (!node) { if (this.treeModel) { node = this.treeModel.root as ExpressionContainer; } else { return; } } if (!ExpressionContainer.is(node) && (node as ExpressionContainer).parent) { node = (node as ExpressionContainer).parent as ExpressionContainer; } // 这里也可以直接调用node.refresh,但由于文件树刷新事件可能会较多 // 队列化刷新动作减少更新成本 this.queueChangeEvent(node.path, () => { this.onDidRefreshedEmitter.fire(); }); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
MethodDeclaration
// 队列化Changed事件 private queueChangeEvent(path: string, callback: any) { if (!this.flushEventQueueDeferred) { this.flushEventQueueDeferred = new Deferred<void>(); clearTimeout(this._eventFlushTimeout); this._eventFlushTimeout = setTimeout(async () => { await this.flushEventQueue()!; this.flushEventQueueDeferred?.resolve(); this.flushEventQueueDeferred = null; callback(); }, DebugConsoleModelService.DEFAULT_REFRESH_DELAY) as any; } if (this._changeEventDispatchQueue.indexOf(path) === -1) { this._changeEventDispatchQueue.push(path); } }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
MethodDeclaration
async execute(value: string) { if (!this.treeModel) { return; } const parent: DebugConsoleRoot = this.treeModel.root as DebugConsoleRoot; const textNode = new AnsiConsoleNode(value, parent, this.linkDetector); this.dispatchWatchEvent(parent, parent.path, { type: WatchEvent.Added, node: textNode, id: parent.id }); const expressionNode = new DebugConsoleNode(this.manager.currentSession, value, parent as ExpressionContainer); await expressionNode.evaluate(); this.dispatchWatchEvent(parent, parent.path, { type: WatchEvent.Added, node: expressionNode, id: parent.id }); this.treeHandle.ensureVisible(expressionNode, 'end', true); }
careteenL/core
packages/debug/src/browser/view/console/debug-console-tree.model.service.ts
TypeScript
FunctionDeclaration
function MyApp({ Component, pageProps }: AppProps) { return <Component {...pageProps} /> }
open-sauced/swag
pages/_app.tsx
TypeScript
FunctionDeclaration
function dataDetails(entry: GedcomEntry) { const lines = []; if (entry.data) { lines.push(...getData(entry)); } entry.tree .filter((subentry) => subentry.tag === 'NOTE') .forEach((note) => getData(note).forEach((line) => lines.push(<i>{line}</i>)), ); if (!lines.length) { return null; } return ( <> <div className="ui sub header"> <TranslatedTag tag={entry.tag} /> </div> <span> <MultilineText lines={lines} /> </span> </> ); }
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
FunctionDeclaration
function noteDetails(entry: GedcomEntry) { return ( <MultilineText lines={getData(entry).map((line, index) => ( <i key={index}>{line}</i> ))} /> ); }
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
FunctionDeclaration
function nameDetails(entry: GedcomEntry) { return ( <h2 className="ui header"> {entry.data .split('/') .filter((name) => !!name) .map((name, index) => ( <div key={index}> {name} <br /> </div> ))} </h2> ); }
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
FunctionDeclaration
function getDetails( entries: GedcomEntry[], tags: string[], detailsFunction: (entry: GedcomEntry) => JSX.Element | null, ): JSX.Element[] { return flatMap(tags, (tag) => entries .filter((entry) => entry.tag === tag) .map((entry) => detailsFunction(entry)), ) .filter((element) => element !== null) .map((element, index) => ( <div className="ui segment" key={index}> {element} </div> )); }
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
FunctionDeclaration
/** * Returns true if there is displayable information in this entry. * Returns false if there is no data in this entry or this is only a reference * to another entry. */ function hasData(entry: GedcomEntry) { return entry.tree.length > 0 || (entry.data && !entry.data.startsWith('@')); }
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
FunctionDeclaration
function getOtherDetails(entries: GedcomEntry[]) { return entries .filter((entry) => !EXCLUDED_TAGS.includes(entry.tag)) .filter(hasData) .map((entry) => dataDetails(entry)) .filter((element) => element !== null) .map((element, index) => ( <div className="ui segment" key={index}> {element} </div> )); }
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
FunctionDeclaration
export function Details(props: Props) { const entries = props.gedcom.indis[props.indi].tree; const entriesWithData = entries .map((entry) => dereference(entry, props.gedcom, (gedcom) => gedcom.other)) .filter(hasData); return ( <div className="ui segments details"> {getDetails(entries, ['NAME'], nameDetails)} <Events gedcom={props.gedcom} entries={entries} indi={props.indi} /> {getOtherDetails(entriesWithData)} {getDetails(entriesWithData, ['NOTE'], noteDetails)} </div> ); }
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
ArrowFunction
(subentry) => subentry.tag === 'NOTE'
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
ArrowFunction
(note) => getData(note).forEach((line) => lines.push(<i>{line}</i>)), )
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
ArrowFunction
(line) => lines.push(<i>{line}</i>)), )
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
ArrowFunction
(line, index) => ( <i key={index}>{line}</i>
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
ArrowFunction
(name) => !!name
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
ArrowFunction
(name, index) => ( <div key={index}> {name} <br /> </div>
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
ArrowFunction
(tag) => entries .filter((entry) => entry.tag === tag) .map((entry) => detailsFunction(entry))
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
ArrowFunction
(entry) => entry.tag === tag
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
ArrowFunction
(entry) => detailsFunction(entry)
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
ArrowFunction
(element) => element !== null
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
ArrowFunction
(element, index) => ( <div className="ui segment"
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
ArrowFunction
(entry) => !EXCLUDED_TAGS.includes(entry.tag)
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
ArrowFunction
(entry) => dataDetails(entry)
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
ArrowFunction
(entry) => dereference(entry, props.gedcom, (gedcom) => gedcom.other)
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
ArrowFunction
(gedcom) => gedcom.other
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
InterfaceDeclaration
interface Props { gedcom: GedcomData; indi: string; }
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
MethodDeclaration
getData(entry)
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
MethodDeclaration
getDetails(entries, ['NAME'
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
MethodDeclaration
getOtherDetails(entriesWithData)
albertoriella/topola-viewer
src/details/details.tsx
TypeScript
InterfaceDeclaration
export interface Parameters { stage: string; }
bryanjswift/sqs_email_sender
infrastructure/cdk/lib/parameters.ts
TypeScript
FunctionDeclaration
function scenarioSaveDataCaptureRequests( scenario: IScenario<any>, recordingDir: string, interactions: ChartInteractions, ): void { const requestsFile = path.join(recordingDir, RecordingFiles.Execution.Requests); const { dataViewRequests } = interactions; const { customDataCapture } = scenario; let requests: DataViewRequests = { allData: false, windows: [], }; if (fs.existsSync(requestsFile)) { try { const existingRequests = readJsonSync(requestsFile); if (!isObject(existingRequests)) { // eslint-disable-next-line no-console console.warn( `The requests file ${requestsFile} seems invalid. It should contain object describing what data view requests should be captured for the recording.`, ); } else { requests = existingRequests as DataViewRequests; } } catch (err) { // eslint-disable-next-line no-console console.warn("Unable to read or parse exec requests file in ", requestsFile); } } if (dataViewRequests.allData || customDataCapture.allData) { requests.allData = true; } if (dataViewRequests.windows) { requests.windows = unionBy( dataViewRequests.windows, requests.windows, customDataCapture.windows, (val) => { return `${val.offset.join(",")}-${val.size.join(",")}`; }, ); } writeAsJsonSync(requestsFile, requests); }
fiedlr/gooddata-ui-sdk
libs/sdk-ui-tests/tests/smoke-and-capture/allScenarios.test.tsx
TypeScript
FunctionDeclaration
function scenarioSaveDefinition( scenario: IScenario<any>, dir: string, interactions: ChartInteractions, ): string { const { triggeredExecution } = interactions; const fp = defFingerprint(triggeredExecution!); const recordingDir = path.join(dir, fp); if (!fs.existsSync(recordingDir)) { fs.mkdirSync(recordingDir); } writeAsJsonSync(path.join(recordingDir, RecordingFiles.Execution.Definition), { ...triggeredExecution, buckets: [], }); scenarioSaveDataCaptureRequests(scenario, recordingDir, interactions); return recordingDir; }
fiedlr/gooddata-ui-sdk
libs/sdk-ui-tests/tests/smoke-and-capture/allScenarios.test.tsx
TypeScript
FunctionDeclaration
function scenarioSaveDescriptors( scenario: IScenario<any>, recordingDir: string, interactions: ChartInteractions, ) { const scenariosFile = path.join(recordingDir, RecordingFiles.Execution.Scenarios); let scenarioDescriptors: ScenarioDescriptor[] = []; if (fs.existsSync(scenariosFile)) { try { const existingScenarios = readJsonSync(scenariosFile); if (!isArray(existingScenarios)) { // eslint-disable-next-line no-console console.warn( `The scenarios file ${scenariosFile} seems invalid. It should contain array of scenario metadata.`, ); } else { scenarioDescriptors = existingScenarios; } } catch (err) { // eslint-disable-next-line no-console console.warn("Unable to read or parse exec definition scenario file in ", scenariosFile); } } const { vis, name: scenarioName } = scenario; if (scenarioDescriptors.find((s) => s.vis === vis && s.scenario === scenarioName)) { // scenario is already mentioned in the metadata; bail out there is nothing to do return; } const { normalizationState } = interactions; if (normalizationState) { /* * If execution normalization took place, the scenario definition must contain the original execution definition * and mapping between normalized localIds and original localIds. The normalized execution does not * have to be stored together with scenario: it's already stored as part of execution definition. * * This must be done so that directly accessing recordedDataView can perform denormalization as well. * * The recordedDataView() is an important piece of the test support and must work predictably and without * caveats. */ scenarioDescriptors.push({ vis, scenario: scenarioName, originalExecution: normalizationState.original, n2oMap: normalizationState.n2oMap, }); } else { const definition = interactions.triggeredExecution; scenarioDescriptors.push({ vis, scenario: scenarioName, buckets: definition!.buckets }); } writeAsJsonSync(scenariosFile, scenarioDescriptors); }
fiedlr/gooddata-ui-sdk
libs/sdk-ui-tests/tests/smoke-and-capture/allScenarios.test.tsx
TypeScript
FunctionDeclaration
/** * This will store execution definition for particular visualization scenario. The execution definition * will be stored in directory named after definition's fingerprint. The directory will contain 'definition.json' * file with the actual definition and 'scenarios.json' file that enumerates test scenarios where this definition * is used. * * @param scenario - detail about test scenario * @param interactions - chart interactions with the backend * @param plugVizInteractions - plug viz interactions with the backend */ function scenarioSave( scenario: IScenario<any>, interactions: ChartInteractions, plugVizInteractions?: ChartInteractions, ) { const storeDir = storeDirectoryFor(scenario, "executions"); if (!storeDir) { return; } const { triggeredExecution: componentExecution } = interactions; const { triggeredExecution: plugVizExecution } = plugVizInteractions ?? {}; const recordingDir = scenarioSaveDefinition(scenario, storeDir, interactions); if (plugVizExecution && defFingerprint(componentExecution!) !== defFingerprint(plugVizExecution!)) { /* * As-is, react components and plug viz for the same bucket MAY lead to different executions * due to plug viz auto-magically adding sorts (desired UX). different sorts in exec means different * execution. if that happens, make sure the exec definition for the plug viz variant of the * scenario is also stored. */ scenarioSaveDefinition(scenario, storeDir, plugVizInteractions!); } if (!scenario.tags.includes("mock-no-scenario-meta")) { scenarioSaveDescriptors(scenario, recordingDir, interactions); } }
fiedlr/gooddata-ui-sdk
libs/sdk-ui-tests/tests/smoke-and-capture/allScenarios.test.tsx
TypeScript
FunctionDeclaration
function scenarioStoreInsight(scenario: IScenario<any>, def: IInsightDefinition) { const storeDir = storeDirectoryFor(scenario, "insights"); if (!storeDir) { return; } const id = scenario.insightId; /* * Note: while the generated insight uses ref as uriRef, the recordedBackend allows to override this at * runtime so then tests can say if they want id or uri */ const persistentInsight: IInsight = scenario.insightConverter({ insight: { identifier: id, uri: id, ref: uriRef(id), ...def.insight }, }); const insightDir = path.join(storeDir, id); if (!fs.existsSync(insightDir)) { fs.mkdirSync(insightDir); } writeAsJsonSync(path.join(insightDir, RecordingFiles.Insights.Object), persistentInsight); const insightIndexFile = path.join(storeDir, RecordingFiles.Insights.Index); const insightIndex = fs.existsSync(insightIndexFile) ? readJsonSync(insightIndexFile) : {}; /* * Inclusion of scenario information in the insight recording definition makes the mock-handling tool * to include the insight in Insight index - meaning the insight can be accessed programatically such * as 'Insight.BarChart.TwoMeasures' etc. */ const shouldIncludeScenario = !scenario.tags.includes("mock-no-scenario-meta"); const scenarioInfo = shouldIncludeScenario ? { visName: scenario.vis, scenarioName: scenario.name } : {}; insightIndex[id] = { ...scenarioInfo, comment: `Auto-generated insight for test scenario ${insightTitle(def)}.`, }; writeAsJsonSync(insightIndexFile, insightIndex); return; }
fiedlr/gooddata-ui-sdk
libs/sdk-ui-tests/tests/smoke-and-capture/allScenarios.test.tsx
TypeScript
ArrowFunction
(val) => { return `${val.offset.join(",")}-${val.size.join(",")}`; }
fiedlr/gooddata-ui-sdk
libs/sdk-ui-tests/tests/smoke-and-capture/allScenarios.test.tsx
TypeScript
ArrowFunction
(s) => s.vis === vis && s.scenario === scenarioName
fiedlr/gooddata-ui-sdk
libs/sdk-ui-tests/tests/smoke-and-capture/allScenarios.test.tsx
TypeScript
ArrowFunction
() => { const Scenarios: AllScenariosType[] = flatMap(allScenarios, (s): AllScenariosType[] => { const testInputs: Array<IScenario<any>> = s.asScenarioList(); return testInputs.map((t) => { return [t.fullyQualifiedName, t]; }); }); it.each(Scenarios)("%s should lead to execution", async (_scenarioFqn, scenario) => { const interactions = await mountChartAndCaptureNormalized(scenario); expect(interactions.triggeredExecution).toBeDefined(); expect(interactions.normalizationState).toBeDefined(); if ( interactions.dataViewRequests.windows === undefined && interactions.dataViewRequests.allData === undefined ) { fail( `Mounting ${scenario.vis} for scenario ${scenario.name} did not lead to request of data from server. The smoke-and-capture suite now does not know what to store in the recording definition as it is unclear if the scenario needs all data or some particular window of data.`, ); return; } if (scenario.tags.includes("mock-no-insight") || PlugVisUnsupported.indexOf(scenario.vis) >= 0) { /* * Some visualizations may not support plug vis yet. For those, just store scenario * definition and halt. */ scenarioSave(scenario, interactions); } else { /* * For others, create insight object, try to mount pluggable visualization for * the respective visualization, capture execution definition and store everything. */ const insight = createInsightDefinitionForChart(scenario.vis, scenario.name, interactions); /* * note: to allow PV executions and react component executions to hit the same fingerprints, this function * must also use the normalizing backend. */ const plugVizInteractions = await mountInsight(scenario, insight, true); scenarioSave(scenario, interactions, plugVizInteractions); scenarioStoreInsight(scenario, insight); } }); }
fiedlr/gooddata-ui-sdk
libs/sdk-ui-tests/tests/smoke-and-capture/allScenarios.test.tsx
TypeScript
ArrowFunction
(s): AllScenariosType[] => { const testInputs: Array<IScenario<any>> = s.asScenarioList(); return testInputs.map((t) => { return [t.fullyQualifiedName, t]; }); }
fiedlr/gooddata-ui-sdk
libs/sdk-ui-tests/tests/smoke-and-capture/allScenarios.test.tsx
TypeScript
ArrowFunction
(t) => { return [t.fullyQualifiedName, t]; }
fiedlr/gooddata-ui-sdk
libs/sdk-ui-tests/tests/smoke-and-capture/allScenarios.test.tsx
TypeScript
ArrowFunction
async (_scenarioFqn, scenario) => { const interactions = await mountChartAndCaptureNormalized(scenario); expect(interactions.triggeredExecution).toBeDefined(); expect(interactions.normalizationState).toBeDefined(); if ( interactions.dataViewRequests.windows === undefined && interactions.dataViewRequests.allData === undefined ) { fail( `Mounting ${scenario.vis} for scenario ${scenario.name} did not lead to request of data from server. The smoke-and-capture suite now does not know what to store in the recording definition as it is unclear if the scenario needs all data or some particular window of data.`, ); return; } if (scenario.tags.includes("mock-no-insight") || PlugVisUnsupported.indexOf(scenario.vis) >= 0) { /* * Some visualizations may not support plug vis yet. For those, just store scenario * definition and halt. */ scenarioSave(scenario, interactions); } else { /* * For others, create insight object, try to mount pluggable visualization for * the respective visualization, capture execution definition and store everything. */ const insight = createInsightDefinitionForChart(scenario.vis, scenario.name, interactions); /* * note: to allow PV executions and react component executions to hit the same fingerprints, this function * must also use the normalizing backend. */ const plugVizInteractions = await mountInsight(scenario, insight, true); scenarioSave(scenario, interactions, plugVizInteractions); scenarioStoreInsight(scenario, insight); } }
fiedlr/gooddata-ui-sdk
libs/sdk-ui-tests/tests/smoke-and-capture/allScenarios.test.tsx
TypeScript
TypeAliasDeclaration
type AllScenariosType = [string, IScenario<any>];
fiedlr/gooddata-ui-sdk
libs/sdk-ui-tests/tests/smoke-and-capture/allScenarios.test.tsx
TypeScript
ClassDeclaration
export class Load implements Action { readonly type = LOAD; constructor(public payload: { item: ExportToS3Item }) {} }
broadinstitute/firecloud-explorer
src/app/file-manager/actions/export-to-s3-item.actions.ts
TypeScript
ClassDeclaration
export class Filter implements Action { readonly type = FILTER; constructor(public payload: { item: ExportToS3Item }) {} }
broadinstitute/firecloud-explorer
src/app/file-manager/actions/export-to-s3-item.actions.ts
TypeScript
ClassDeclaration
export class Reset implements Action { readonly type = RESET; constructor() {} }
broadinstitute/firecloud-explorer
src/app/file-manager/actions/export-to-s3-item.actions.ts
TypeScript
ClassDeclaration
export class SelectAll implements Action { readonly type = SELECT_ALL; }
broadinstitute/firecloud-explorer
src/app/file-manager/actions/export-to-s3-item.actions.ts
TypeScript
ClassDeclaration
export class UnselectAll implements Action { readonly type = UNSELECT_ALL; constructor(public payload: { item: ExportToS3Item }) {} }
broadinstitute/firecloud-explorer
src/app/file-manager/actions/export-to-s3-item.actions.ts
TypeScript