type stringclasses 7
values | content stringlengths 4 9.55k | repo stringlengths 7 96 | path stringlengths 4 178 | language stringclasses 1
value |
|---|---|---|---|---|
MethodDeclaration |
disposeTemplate(templateData: ITrustedUriPathColumnTemplateData): void {
templateData.disposables.dispose();
templateData.renderDisposables.dispose();
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
renderTemplate(container: HTMLElement): ITrustedUriHostColumnTemplateData {
const disposables = new DisposableStore();
const renderDisposables = disposables.add(new DisposableStore());
const element = container.appendChild($('.host'));
const hostContainer = element.appendChild($('div.host-label'));
const bu... | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
renderElement(item: ITrustedUriItem, index: number, templateData: ITrustedUriHostColumnTemplateData, height: number | undefined): void {
templateData.renderDisposables.clear();
templateData.renderDisposables.add({ dispose: () => { clearNode(templateData.buttonBarContainer); } });
templateData.hostContainer.inne... | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
disposeTemplate(templateData: ITrustedUriHostColumnTemplateData): void {
templateData.disposables.dispose();
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
protected createEditor(parent: HTMLElement): void {
this.rootElement = append(parent, $('.workspace-trust-editor', { tabindex: '0' }));
this.rootElement.style.visibility = 'hidden';
this.createHeaderElement(this.rootElement);
const scrollableContent = $('.workspace-trust-editor-body');
this.bodyScrollBar =... | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
override focus() {
this.rootElement.focus();
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
override async setInput(input: WorkspaceTrustEditorInput, options: IEditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
await super.setInput(input, options, context, token);
if (token.isCancellationRequested) { return; }
await this.workspaceTrustManagementService.... | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private registerListeners(): void {
this._register(this.extensionWorkbenchService.onChange(() => this.render()));
this._register(this.configurationService.onDidChangeRestrictedSettings(() => this.render()));
this._register(this.workspaceTrustManagementService.onDidChangeTrust(() => this.render()));
this._regis... | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private getHeaderContainerClass(trusted: boolean): string {
if (trusted) {
return 'workspace-trust-header workspace-trust-trusted';
}
return 'workspace-trust-header workspace-trust-untrusted';
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private getHeaderTitleText(trusted: boolean): string {
if (trusted) {
if (this.workspaceTrustManagementService.isWorkspaceTrustForced()) {
return localize('trustedUnsettableWindow', "This window is trusted");
}
switch (this.workspaceService.getWorkbenchState()) {
case WorkbenchState.EMPTY:
ret... | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private getHeaderTitleIconClassNames(trusted: boolean): string[] {
return shieldIcon.classNamesArray;
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private getFeaturesHeaderText(trusted: boolean): [string, string] {
let title: string = '';
let subTitle: string = '';
switch (this.workspaceService.getWorkbenchState()) {
case WorkbenchState.EMPTY: {
title = trusted ? localize('trustedWindow', "In a Trusted Window") : localize('untrustedWorkspace', "In ... | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
@debounce(100)
private async render() {
if (this.rendering) {
return;
}
this.rendering = true;
this.rerenderDisposables.clear();
const isWorkspaceTrusted = this.workspaceTrustManagementService.isWorkspaceTrusted();
this.rootElement.classList.toggle('trusted', isWorkspaceTrusted);
this.rootElement.c... | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private getExtensionCount(): number {
const set = new Set<string>();
const inVirtualWorkspace = isVirtualWorkspace(this.workspaceService.getWorkspace());
const localExtensions = this.extensionWorkbenchService.local.filter(ext => ext.local).map(ext => ext.local!);
for (const extension of localExtensions) {
... | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private createHeaderElement(parent: HTMLElement): void {
this.headerContainer = append(parent, $('.workspace-trust-header', { tabIndex: '0' }));
this.headerTitleContainer = append(this.headerContainer, $('.workspace-trust-title'));
this.headerTitleIcon = append(this.headerTitleContainer, $('.workspace-trust-titl... | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private createConfigurationElement(parent: HTMLElement): void {
this.configurationContainer = append(parent, $('.workspace-trust-settings', { tabIndex: '0' }));
const configurationTitle = append(this.configurationContainer, $('.workspace-trusted-folders-title'));
configurationTitle.innerText = localize('trustedF... | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private createAffectedFeaturesElement(parent: HTMLElement): void {
this.affectedFeaturesContainer = append(parent, $('.workspace-trust-features'));
this.trustedContainer = append(this.affectedFeaturesContainer, $('.workspace-trust-limitations.trusted', { tabIndex: '0' }));
this.untrustedContainer = append(this.a... | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private async renderAffectedFeatures(numSettings: number, numExtensions: number): Promise<void> {
clearNode(this.trustedContainer);
clearNode(this.untrustedContainer);
// Trusted features
const [trustedTitle, trustedSubTitle] = this.getFeaturesHeaderText(true);
this.renderLimitationsHeaderElement(this.trus... | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private createButtonRow(parent: HTMLElement, actions: Action | Action[], enabled?: boolean): void {
const buttonRow = append(parent, $('.workspace-trust-buttons-row'));
const buttonContainer = append(buttonRow, $('.workspace-trust-buttons'));
const buttonBar = this.rerenderDisposables.add(new ButtonBar(buttonCon... | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private addTrustButtonToElement(parent: HTMLElement): void {
const trustActions = [
new Action('workspace.trust.button.action.grant', localize('trustButton', "Trust"), undefined, true, async () => {
await this.workspaceTrustManagementService.setWorkspaceTrust(true);
})
];
if (this.workspaceTrustManage... | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private addDontTrustButtonToElement(parent: HTMLElement): void {
this.createButtonRow(parent, new Action('workspace.trust.button.action.deny', localize('dontTrustButton', "Don't Trust"), undefined, true, async () => {
await this.workspaceTrustManagementService.setWorkspaceTrust(false);
}));
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private addTrustedTextToElement(parent: HTMLElement): void {
if (this.workspaceService.getWorkbenchState() === WorkbenchState.EMPTY) {
return;
}
const textElement = append(parent, $('.workspace-trust-untrusted-description'));
if (!this.workspaceTrustManagementService.isWorkspaceTrustForced()) {
textElem... | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private renderLimitationsHeaderElement(parent: HTMLElement, headerText: string, subtitleText: string): void {
const limitationsHeaderContainer = append(parent, $('.workspace-trust-limitations-header'));
const titleElement = append(limitationsHeaderContainer, $('.workspace-trust-limitations-title'));
const textEl... | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
private renderLimitationsListElement(parent: HTMLElement, limitations: string[], iconClassNames: string[]): void {
const listContainer = append(parent, $('.workspace-trust-limitations-list-container'));
const limitationsList = append(listContainer, $('ul'));
for (const limitation of limitations) {
const limit... | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
MethodDeclaration |
layout(dimension: Dimension): void {
if (!this.isVisible()) {
return;
}
this.workspaceTrustedUrisTable.layout();
this.layoutParticipants.forEach(participant => {
participant.layout();
});
this.bodyScrollBar.scanDomNode();
} | AE1020/vscode | src/vs/workbench/contrib/workspace/browser/workspaceTrustEditor.ts | TypeScript |
FunctionDeclaration |
export function Root() {
const store = createStore(reducers);
return (
<BrowserRouter>
<Provider store={store}>
<Application />
</Provider>
</BrowserRouter>
);
} | LuisSaybe/seoullatte | web/js/page/root/index.tsx | TypeScript |
ArrowFunction |
async (req: Request, res: Response) => {
const { user, error, errorCode } = await UserServiceInstance.findById(
req.userId
);
if (error && errorCode) return res.status(errorCode).json({ error });
return res.status(200).json(user);
} | vipulchodankar/express-typescript-mongodb-boilerplate | src/controllers/user.ts | TypeScript |
ArrowFunction |
async (req: Request, res: Response) => {
const data: Partial<IUser> = req.body;
// Don't allow updating other fields
const allowedData = userSchema.update.noUnknown().cast(data);
const { user, error, errorCode } = await UserServiceInstance.update(
req.userId,
allowedData
);
if (error && errorCod... | vipulchodankar/express-typescript-mongodb-boilerplate | src/controllers/user.ts | TypeScript |
ArrowFunction |
async (req: Request, res: Response) => {
const { error, errorCode } = await UserServiceInstance.delete(req.userId);
if (error && errorCode) return res.status(errorCode).json({ error });
return res.status(200).json({ message: "Successfully deleted user" });
} | vipulchodankar/express-typescript-mongodb-boilerplate | src/controllers/user.ts | TypeScript |
ArrowFunction |
() => {
test.each([null, 'string', {}])(
'Throws when middleware is not an array (%j)',
(value) => {
// Act
const act = () => new HttpClient(value as [HippityMiddleware])
// Assert
expect(act).toThrow(new TypeError('Middleware stack must be an array'))
}
)
} | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
(value) => {
// Act
const act = () => new HttpClient(value as [HippityMiddleware])
// Assert
expect(act).toThrow(new TypeError('Middleware stack must be an array'))
} | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
() => new HttpClient(value as [HippityMiddleware]) | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
() => {
it('Throws exception when send is called with no middleware registered', async () => {
// Arrange
const sut = new HttpClient()
// Act
const act = sut.send({})
// Assert
await expect(act).rejects.toThrow(
new Error(
'Reached end of pipeline. Use a middleware which termi... | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
async () => {
// Arrange
const sut = new HttpClient()
// Act
const act = sut.send({})
// Assert
await expect(act).rejects.toThrow(
new Error(
'Reached end of pipeline. Use a middleware which terminates the pipeline.'
)
)
} | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
async () => {
// Arrange
const sut = new HttpClient().use((r, n) => n(r))
// Act
const act = sut.send({})
// Assert
await expect(act).rejects.toThrow(
new Error(
'Reached end of pipeline. Use a middleware which terminates the pipeline.'
)
)
} | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
(r, n) => n(r) | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
async () => {
// Arrange
let order = ''
const sut = new HttpClient()
.use(() => {
order += '1'
return Promise.resolve({ status: 200, success: true })
})
.use((r, n) => {
order += '2'
return n(r)
})
.use((r, n) => {
order += '3'
r... | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
() => {
order += '1'
return Promise.resolve({ status: 200, success: true })
} | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
(r, n) => {
order += '2'
return n(r)
} | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
(r, n) => {
order += '3'
return n(r)
} | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
async () => {
// Arrange
let order = ''
const sut = new HttpClient()
.use(() => {
order += '0'
return Promise.resolve({ status: 200, success: true })
})
.use((r, n) => {
order += '1'
return n(r)
})
// Act
await sut.send({})
// Assert
... | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
() => {
order += '0'
return Promise.resolve({ status: 200, success: true })
} | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
(r, n) => {
order += '1'
return n(r)
} | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
async () => {
// Arrange
const middleware = jest.fn(() =>
Promise.resolve({ status: 200, success: true })
)
const sut = new HttpClient()
.use(middleware)
.use((_, n) => n({ changed: true }))
// Act
await sut.send({})
// Assert
expect(middleware).toHaveBeenCalledWith(... | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
() =>
Promise.resolve({ status: 200, success: true }) | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
(_, n) => n({ changed: true }) | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
async () => {
// Arrange
const middleware = jest.fn()
const sut = new HttpClient()
.use(middleware)
.use(() => Promise.resolve({ status: 200, success: true }))
// Act
await sut.send({})
// Assert
expect(middleware).not.toHaveBeenCalled()
} | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
() => Promise.resolve({ status: 200, success: true }) | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
async () => {
// Arrange
const middleware = jest.fn(() =>
Promise.resolve({ status: 200, success: true })
)
const sut = new HttpClient().use((_, n) => n()).use(middleware)
// Act
await sut.send({ changed: false })
// Assert
expect(middleware).toHaveBeenCalledWith(
{ chang... | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
(_, n) => n() | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
() => {
it('Returns body of result', async () => {
// Arrange
const sut = new HttpClient().use(() => {
return Promise.resolve({ status: 200, success: true, body: 'body' })
})
// Act
const response = await sut.$send({ GET: 'foo' })
// Assert
expect(response).toBe('body')
})
te... | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
async () => {
// Arrange
const sut = new HttpClient().use(() => {
return Promise.resolve({ status: 200, success: true, body: 'body' })
})
// Act
const response = await sut.$send({ GET: 'foo' })
// Assert
expect(response).toBe('body')
} | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
() => {
return Promise.resolve({ status: 200, success: true, body: 'body' })
} | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
async () => {
// Arrange
const sut = new HttpClient().use(() =>
Promise.resolve({
success: false,
status: 200,
message: 'OK',
body: true,
})
)
// Act
const act = sut.$send({ method: 'DELETE' })
// Assert
await expect(act).rejects.toThrow(
... | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
() =>
Promise.resolve({
success: false,
status: 200,
message: 'OK',
body: true,
}) | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
() => {
it('Adds middleware to be called in reverse order', async () => {
// Arrange
let order = ''
const sut = new HttpClient()
.use(function a() {
order += '1'
return Promise.resolve({ status: 200, success: true })
})
.use(function b(r, n) {
order += '2'
... | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
async () => {
// Arrange
let order = ''
const sut = new HttpClient()
.use(function a() {
order += '1'
return Promise.resolve({ status: 200, success: true })
})
.use(function b(r, n) {
order += '2'
return n(r)
})
.use(function c(r, n) {
o... | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
() => {
it('Adds middleware to run before all others', async () => {
// Arrange
let order = ''
const sut = new HttpClient()
.use(() => {
order += '1'
return Promise.resolve({ status: 200, success: true })
})
.use((r, n) => {
order += '2'
return n(r)
... | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
async () => {
// Arrange
let order = ''
const sut = new HttpClient()
.use(() => {
order += '1'
return Promise.resolve({ status: 200, success: true })
})
.use((r, n) => {
order += '2'
return n(r)
})
.useAt(-1, (r, n) => {
order += '3'
... | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
async () => {
// Arrange
let order = ''
const sut = new HttpClient().useAt(-1, () => {
order += '1'
return Promise.resolve({ status: 200, success: true })
})
// Act
await sut.send({})
// Assert
expect(order).toEqual('1')
} | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
() => {
order += '1'
return Promise.resolve({ status: 200, success: true })
} | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
() => {
it('Registers middleware when true', async () => {
// Arrange
let order = ''
const sut = new HttpClient()
.use(() => {
order += '1'
return Promise.resolve({ status: 200, success: true })
})
.if(true, (c) =>
c.use((r, n) => {
order += '2'
... | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
async () => {
// Arrange
let order = ''
const sut = new HttpClient()
.use(() => {
order += '1'
return Promise.resolve({ status: 200, success: true })
})
.if(true, (c) =>
c.use((r, n) => {
order += '2'
return n(r)
})
)
// Act
... | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
(c) =>
c.use((r, n) => {
order += '2'
return n(r)
}) | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
(r, n) => {
order += '2'
return n(r)
} | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
async () => {
// Arrange
let order = ''
const sut = new HttpClient()
.use(() => {
order += '1'
return Promise.resolve({ status: 200, success: true })
})
.if(false, (c) =>
c.use((r, n) => {
order += '2'
return n(r)
})
)
// Act
... | berkeleybross/hippity | src/client/http-client.test.ts | TypeScript |
ArrowFunction |
({ className }) => (
<main className={className}>
<h1>About</h1>
<AboutMDX />
</main> | aa-0921/gatsby-portfolio-first | src/pages/about.tsx | TypeScript |
ArrowFunction |
({ path }: { path: string }): JSX.Element => (
<>
<SEO title='about' | aa-0921/gatsby-portfolio-first | src/pages/about.tsx | TypeScript |
ArrowFunction |
(data: CharacterStore[]) => {
return data.map((data) => {
const character = new CharacterStore();
for (const key of Object.keys(data)) {
// @ts-ignore
character[key] = data[key];
}
const inventory = new InventoryStore(character, {
unit: data.invento... | ph1p/rp-character-manager | src/store/root.ts | TypeScript |
ArrowFunction |
(data) => {
const character = new CharacterStore();
for (const key of Object.keys(data)) {
// @ts-ignore
character[key] = data[key];
}
const inventory = new InventoryStore(character, {
unit: data.inventory.unit,
coins: data.inventory.coins,
... | ph1p/rp-character-manager | src/store/root.ts | TypeScript |
ArrowFunction |
(attribute) => new CharacterAttribute(attribute, character) | ph1p/rp-character-manager | src/store/root.ts | TypeScript |
ArrowFunction |
(skill) => new CharacterSkill(skill, character) | ph1p/rp-character-manager | src/store/root.ts | TypeScript |
ArrowFunction |
(item) => new InventoryItem(item) | ph1p/rp-character-manager | src/store/root.ts | TypeScript |
ArrowFunction |
(note) => new CharacterNote(note.text, note.date, note.id) | ph1p/rp-character-manager | src/store/root.ts | TypeScript |
ArrowFunction |
(characters: CharacterStore[]) => {
return characters;
} | ph1p/rp-character-manager | src/store/root.ts | TypeScript |
ArrowFunction |
(c) => c.id !== id | ph1p/rp-character-manager | src/store/root.ts | TypeScript |
ArrowFunction |
(c) => c.id === id | ph1p/rp-character-manager | src/store/root.ts | TypeScript |
ClassDeclaration |
export class RootStore {
@format<any, any>(
(data: CharacterStore[]) => {
return data.map((data) => {
const character = new CharacterStore();
for (const key of Object.keys(data)) {
// @ts-ignore
character[key] = data[key];
}
const inventory = new Invent... | ph1p/rp-character-manager | src/store/root.ts | TypeScript |
MethodDeclaration |
selectCharacter(id: string) {
if (this.characterById(id)) {
this.selectedCharacterId = id;
}
} | ph1p/rp-character-manager | src/store/root.ts | TypeScript |
MethodDeclaration |
createCharacter(name: string) {
const character = new CharacterStore(name);
this.characters.push(character);
return character;
} | ph1p/rp-character-manager | src/store/root.ts | TypeScript |
MethodDeclaration |
removeCharacter(id: string) {
this.characters = this.characters.filter((c) => c.id !== id);
} | ph1p/rp-character-manager | src/store/root.ts | TypeScript |
MethodDeclaration |
characterById(id: string) {
return this.characters.find((c) => c.id === id);
} | ph1p/rp-character-manager | src/store/root.ts | TypeScript |
MethodDeclaration |
setLanguage(lang: string) {
this.language = lang;
i18n.changeLanguage(lang);
} | ph1p/rp-character-manager | src/store/root.ts | TypeScript |
FunctionDeclaration |
function alignToGrid(boxes: Box[], viewportWidth: number) {
if (viewportWidth === 0) {
return;
}
// Make Dagre's layout more "grid compatible" by centering each row and
// wrapping rows so they don't scroll offscreen
const splitWidth = viewportWidth - 40;
const itemsPerRow = Math.round(splitWidth / 280... | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
FunctionDeclaration |
function flattenToGrid(boxes: Box[], viewportWidth: number) {
if (viewportWidth === 0) {
return;
}
// Try to arrange the bundles so the downstream ones are generally lower in the grid.
// Algorithm: Iterate through the folders and insert each into the result set such that
// it is before things that depe... | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
FunctionDeclaration |
function expandBoxes(layout: Layout, expanded: string | null, viewportWidth: number) {
// Find the box we want to expand
const boxIdx = layout.boxes.findIndex((b) => b.id === expanded);
if (boxIdx === -1) {
return {boxes: layout.boxes, shadows: []};
}
const boxes: Box[] = JSON.parse(JSON.stringify(layou... | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
FunctionDeclaration |
function useAssetGridLayout(assetGraphData: GraphData | null, viewportWidth: number) {
return React.useMemo(() => {
if (!assetGraphData) {
return {bundles: {}, bundleForAssetId: {}, boxes: [], edges: []};
}
const assetIds = Object.keys(assetGraphData.nodes);
const bundles = identifyBundles(ass... | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
() => {
const params = useParams();
const explorerPath = instanceAssetsExplorerPathFromString(params[0]);
const {assetGraphData} = useAssetGraphData(null, explorerPath.opsQuery || '*');
return (
<Box
flex={{direction: 'column', justifyContent: 'stretch'}} | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(
bundles: {[prefixId: string]: string[]},
edges: {from: string; to: string}[],
) => {
const g = new dagre.graphlib.Graph({compound: true});
g.setGraph({
rankdir: 'TB',
marginx: 0,
marginy: 0,
nodesep: 20,
edgesep: 10,
ranksep: 20,
});
g.setDefaultEdgeLabel(() => ({}));
for (cons... | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
() => ({}) | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
([bundleId, contentIds]) => {
const {x, y, width, height} = g.node(bundleId);
return {id: bundleId, contentIds, layout: {top: y, left: x, width, height}};
} | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(a, b) => a.id.localeCompare(b.id) | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(box) => {
x++;
if (x >= itemsPerRow) {
x = 0;
y += box.layout.height + PADDING;
}
box.layout.top = y;
box.layout.left = INSET + centeringOffset + x * (itemWidth + PADDING);
box.layout.width = itemWidth;
} | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(b) => b.id === expanded | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(b) => b.layout.top >= shadow.top | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(c) => (contentsWithChildren[c] = []) | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(e) => contentsWithChildren[e.from] && contentsWithChildren[e.to] | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(e) => ({
from: contentsWithChildren[e.from] ? e.from : layout.bundleForAssetId[e.from],
to: contentsWithChildren[e.to] ? e.to : layout.bundleForAssetId[e.to],
}) | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
([bundleId, contentIds]) => ({
id: bundleId,
contentIds,
layout: {top: 0, left: 0, width: 250, height: 108},
}) | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(b) => b.layout.top + b.layout.height | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.