type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
---|---|---|---|---|
ArrowFunction |
(box) => (box.layout.top += shadow.height) | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
() => {
if (!assetGraphData) {
return {bundles: {}, bundleForAssetId: {}, boxes: [], edges: []};
}
const assetIds = Object.keys(assetGraphData.nodes);
const bundles = identifyBundles(assetIds);
const bundleForAssetId: {[assetId: string]: string} = {};
for (const [bundleId, childrenIds] of Object.entries(bundles)) {
childrenIds.forEach((c) => (bundleForAssetId[c] = bundleId));
}
const unbundledAssetIds = assetIds.filter((id) => !bundleForAssetId[id]);
if (unbundledAssetIds.length) {
bundles[NONE_BUNDLE] = unbundledAssetIds;
bundles[NONE_BUNDLE].forEach((id) => (bundleForAssetId[id] = NONE_BUNDLE));
}
const edges = flatMap(Object.entries(assetGraphData.downstream), ([from, downstreams]) =>
Object.keys(downstreams).map((to) => ({from, to})),
);
const {boxes} = runMinimalDagreLayout(
bundles,
uniqBy(
edges.map((e) => ({from: bundleForAssetId[e.from], to: bundleForAssetId[e.to]})),
JSON.stringify,
),
);
if (boxes.length > 10) {
flattenToGrid(boxes, viewportWidth);
} else {
alignToGrid(boxes, viewportWidth);
}
return {bundles, bundleForAssetId, boxes, edges};
} | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(c) => (bundleForAssetId[c] = bundleId) | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(id) => !bundleForAssetId[id] | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(id) => (bundleForAssetId[id] = NONE_BUNDLE) | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
([from, downstreams]) =>
Object.keys(downstreams).map((to) => ({from, to})) | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(to) => ({from, to}) | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(e) => ({from: bundleForAssetId[e.from], to: bundleForAssetId[e.to]}) | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
({assetGraphData}) => {
const [highlighted, setHighlighted] = React.useState<string | null>(null);
const [expanded, setExpanded] = React.useState<string | null>(null);
const {viewport, containerProps} = useViewport();
const layout = useAssetGridLayout(assetGraphData, viewport.width);
const {edges, bundleForAssetId} = layout;
const {boxes, shadows} = React.useMemo(() => expandBoxes(layout, expanded, viewport.width), [
layout,
expanded,
viewport.width,
]);
const expandedAssetKeys =
boxes.find((b) => b.id === expanded)?.contentIds.map((id) => ({path: JSON.parse(id)})) || [];
const {liveResult, liveDataByNode} = useLiveDataForAssetKeys(
null,
assetGraphData,
expandedAssetKeys,
);
useQueryRefreshAtInterval(liveResult, FIFTEEN_SECONDS);
if (!assetGraphData) {
return <LoadingSpinner purpose="page" />;
}
const renderedIds = keyBy(
boxes.filter((b) => expanded !== b.id),
(b) => b.id,
);
const renderedEdges = uniqBy(
edges.map((e) => ({
from: renderedIds[e.from] ? e.from : bundleForAssetId[e.from] || e.from,
to: renderedIds[e.to] ? e.to : bundleForAssetId[e.to] || e.to,
})),
JSON.stringify,
);
const bottom = Math.max(
...shadows.map((s) => s.top + s.height),
...boxes.map((b) => b.layout.top + b.layout.height),
);
return (
<div
{...containerProps}
style={{
overflowY: 'scroll',
position: 'relative',
width: '100%',
height: bottom,
}} | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
() => expandBoxes(layout, expanded, viewport.width) | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(id) => ({path: JSON.parse(id)}) | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(b) => expanded !== b.id | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(b) => b.id | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(e) => ({
from: renderedIds[e.from] ? e.from : bundleForAssetId[e.from] || e.from,
to: renderedIds[e.to] ? e.to : bundleForAssetId[e.to] || e.to,
}) | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(s) => s.top + s.height | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(shadow) => (
<div
key={shadow.top} | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(b) => !b.contentIds.length | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(box) => (
<div
key={box.id} | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(b) => b.contentIds.length | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(box) => (
<AssetGridItem
key={box.id} | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
({
boxes,
edges,
highlighted,
expanded,
}: {
boxes: Box[];
highlighted: string | null;
expanded: string | null;
edges: {from: string; to: string}[];
}) => {
const highlightedEdges =
highlighted && highlighted !== expanded
? edges.filter((e) => e.from === highlighted || e.to === highlighted)
: [];
const expandedChildren = boxes.find((b) => b.id === expanded)?.contentIds || [];
const expandedEdges = edges.filter(
(e) => expandedChildren.includes(e.from) || expandedChildren.includes(e.to),
);
const showBaseEdgeHintsAlways = expandedEdges.length === 0; // && boxes.length < 30
const showExpandedEdgeHintsAlways = expandedEdges.length > 0;
const width = Math.max(...boxes.map((b) => b.layout.width + b.layout.left));
const height = Math.max(...boxes.map((b) => b.layout.height + b.layout.top));
return (
<React.Fragment>
{showBaseEdgeHintsAlways && (
<StyledPathSet
key="base"
boxes={boxes}
edges={edges}
color="rgba(35, 31, 27, 0.06)"
zIndex={0}
width={width}
height={height}
/> | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(e) => e.from === highlighted || e.to === highlighted | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(e) => expandedChildren.includes(e.from) || expandedChildren.includes(e.to) | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(b) => b.layout.width + b.layout.left | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(b) => b.layout.height + b.layout.top | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(e) => e.to === highlighted | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(e) => e.from === highlighted | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
({boxes, edges, color, zIndex, width, height}) => {
const pointForAssetId = (bundleId: string) => {
const box = boxes.find((b) => b.id === bundleId);
if (!box) {
console.log(bundleId);
return {x: 0, y: 0};
}
const {width, height, left, top} = box.layout;
return {x: left + width / 2, y: top + height / 2};
};
const stackings = {left: 0, right: 0};
const dForEdge = (edge: {from: string; to: string}) => {
const source = pointForAssetId(edge.from);
source.x += boxes[0].layout.width / 2 - 24;
const target = pointForAssetId(edge.to);
target.x -= boxes[0].layout.width / 2 - 24;
if (source.y < target.y) {
target.y -= 30;
} else if (source.y > target.y) {
target.y += 30; //boxes[0].layout.height / 2 - stackings.bottom++ * 10;
} else {
if (source.x < target.x) {
target.x -= 30;
source.y += stackings.left;
target.y += stackings.left;
stackings.left += 7;
} else if (source.x > target.x) {
target.x += 30;
source.y += stackings.right;
target.y += stackings.right;
stackings.right += 7;
}
}
return buildSVGPath({source, target});
};
const markerId = React.useRef(`arrow${Math.random()}`);
return (
<svg style={{zIndex, width, height, position: 'absolute', pointerEvents: 'none'}} | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(bundleId: string) => {
const box = boxes.find((b) => b.id === bundleId);
if (!box) {
console.log(bundleId);
return {x: 0, y: 0};
}
const {width, height, left, top} = box.layout;
return {x: left + width / 2, y: top + height / 2};
} | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(b) => b.id === bundleId | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(edge: {from: string; to: string}) => {
const source = pointForAssetId(edge.from);
source.x += boxes[0].layout.width / 2 - 24;
const target = pointForAssetId(edge.to);
target.x -= boxes[0].layout.width / 2 - 24;
if (source.y < target.y) {
target.y -= 30;
} else if (source.y > target.y) {
target.y += 30; //boxes[0].layout.height / 2 - stackings.bottom++ * 10;
} else {
if (source.x < target.x) {
target.x -= 30;
source.y += stackings.left;
target.y += stackings.left;
stackings.left += 7;
} else if (source.x > target.x) {
target.x += 30;
source.y += stackings.right;
target.y += stackings.right;
stackings.right += 7;
}
}
return buildSVGPath({source, target});
} | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
(edge, idx) => (
<StyledPath
key={idx} | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
({
box,
expanded,
highlighted,
setHighlighted,
toggleExpanded,
}: {
box: Box;
highlighted: boolean;
setHighlighted: (s: string | null) => void;
expanded: boolean;
toggleExpanded: () => void;
}) => {
return (
<AssetNodeContainer
$selected={false}
$padded={false}
style={{
margin: 0,
position: 'absolute',
background: 'transparent',
outline: expanded ? `10px solid #FDF6EF` : 'none',
boxShadow: expanded ? `0px 15px 0 9px #FDF6EF` : 'none', | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
InterfaceDeclaration |
interface Box {
id: string;
contentIds: string[];
layout: {top: number; left: number; width: number; height: number};
} | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
TypeAliasDeclaration |
type Layout = ReturnType<typeof useAssetGridLayout>; | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
MethodDeclaration |
dForEdge(edge) | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
MethodDeclaration |
displayNameForAssetKey({path: JSON | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
MethodDeclaration |
instanceAssetsExplorerPathToURL({
opsQuery: `${tokenForAssetKey | unlearnai/dagster | js_modules/dagit/packages/core/src/assets/InstanceAssetGrid.tsx | TypeScript |
ArrowFunction |
props => {
const { size, withHoverEffect, color, margin, ...restProps } = props;
return (
<SvgIcon {...{ size, withHoverEffect, color, margin, ...restProps }}>
<SideEffect1546LineIconSvg {...restProps} width="1em" height="1em" />
</SvgIcon> | IshanKute/medly-components | packages/icons/src/icons/GSDD/SideEffect1546LineIcon.tsx | TypeScript |
ArrowFunction |
() => getFakeJobRole({ post }) | AnubhavUjjawal/test-project | src/migration/1632821322960-seed-jobs.ts | TypeScript |
ClassDeclaration |
export class seedJobs1632821322960 implements MigrationInterface {
name = 'seedJobs1632821322960'
public async up(queryRunner: QueryRunner): Promise<void> {
const connection = getConnection()
for (let index = 0; index < 3000000; index++) {
const HR = await connection.getRepository(Users)
.createQueryBuilder("users")
.where("role_id = 'HIRING_MANAGER'")
.andWhere("random() < 0.01")
.getOne()
const post = getFakeJobPost();
post.user_id = HR.user_id
const roles: JobRole[] = [...Array(Math.floor(Math.random() * 10 + 1))].map(() => getFakeJobRole({ post }))
// console.log(roles)
await connection.getRepository(JobRole).save(roles)
await connection.getRepository(JobPost).save(post)
console.log(`Inserted ${roles.length} jobRoles for ${index+1} jobPost`)
}
}
public async down(queryRunner: QueryRunner): Promise<void> {
}
} | AnubhavUjjawal/test-project | src/migration/1632821322960-seed-jobs.ts | TypeScript |
MethodDeclaration |
public async up(queryRunner: QueryRunner): Promise<void> {
const connection = getConnection()
for (let index = 0; index < 3000000; index++) {
const HR = await connection.getRepository(Users)
.createQueryBuilder("users")
.where("role_id = 'HIRING_MANAGER'")
.andWhere("random() < 0.01")
.getOne()
const post = getFakeJobPost();
post.user_id = HR.user_id
const roles: JobRole[] = [...Array(Math.floor(Math.random() * 10 + 1))].map(() => getFakeJobRole({ post }))
// console.log(roles)
await connection.getRepository(JobRole).save(roles)
await connection.getRepository(JobPost).save(post)
console.log(`Inserted ${roles.length} jobRoles for ${index+1} jobPost`)
}
} | AnubhavUjjawal/test-project | src/migration/1632821322960-seed-jobs.ts | TypeScript |
MethodDeclaration |
public async down(queryRunner: QueryRunner): Promise<void> {
} | AnubhavUjjawal/test-project | src/migration/1632821322960-seed-jobs.ts | TypeScript |
TypeAliasDeclaration |
export type FlatVariant = typeof FlatVariants[keyof typeof FlatVariants]; | pplanel/puzzli-monorepo | apps/frontend/web-components/src/global/types/ColorVariants.ts | TypeScript |
TypeAliasDeclaration |
export type OutlineVariant = typeof OutlineVariants[keyof typeof OutlineVariants]; | pplanel/puzzli-monorepo | apps/frontend/web-components/src/global/types/ColorVariants.ts | TypeScript |
TypeAliasDeclaration |
export type ColorVariant = FlatVariant | OutlineVariant; | pplanel/puzzli-monorepo | apps/frontend/web-components/src/global/types/ColorVariants.ts | TypeScript |
ArrowFunction |
(zadano: | FornaxA/dash | src/qt/locale/ion_hr.ts | TypeScript |
ArrowFunction |
() => {
const tree = TestRenderer.create(<Rival/>).toJSON()
expect(tree).toMatchSnapshot()
} | AlexanderLapygin/bp | components/application/taste-court/court/rival.snapshot.test.tsx | TypeScript |
InterfaceDeclaration |
export interface MutableDashboard {
title: string;
meta: DashboardMeta;
destroy: () => void;
} | Dizzudin2/grafana6 | public/app/types/dashboard.ts | TypeScript |
InterfaceDeclaration |
export interface DashboardDTO {
redirectUri?: string;
dashboard: DashboardDataDTO;
meta: DashboardMeta;
} | Dizzudin2/grafana6 | public/app/types/dashboard.ts | TypeScript |
InterfaceDeclaration |
export interface DashboardMeta {
canSave?: boolean;
canEdit?: boolean;
canDelete?: boolean;
canShare?: boolean;
canStar?: boolean;
canAdmin?: boolean;
url?: string;
folderId?: number;
fullscreen?: boolean;
fromExplore?: boolean;
isEditing?: boolean;
canMakeEditable?: boolean;
submenuEnabled?: boolean;
provisioned?: boolean;
provisionedExternalId?: string;
focusPanelId?: number;
isStarred?: boolean;
showSettings?: boolean;
expires?: string;
isSnapshot?: boolean;
folderTitle?: string;
folderUrl?: string;
created?: string;
isDynamicViewEnabled?: boolean;
} | Dizzudin2/grafana6 | public/app/types/dashboard.ts | TypeScript |
InterfaceDeclaration |
export interface DashboardDataDTO {
title: string;
} | Dizzudin2/grafana6 | public/app/types/dashboard.ts | TypeScript |
InterfaceDeclaration |
export interface DashboardInitError {
message: string;
error: any;
} | Dizzudin2/grafana6 | public/app/types/dashboard.ts | TypeScript |
InterfaceDeclaration |
export interface DashboardState {
model: MutableDashboard | null;
initPhase: DashboardInitPhase;
isInitSlow: boolean;
initError?: DashboardInitError;
permissions: DashboardAcl[] | null;
modifiedQueries?: {
panelId: number;
queries: DataQuery[];
};
} | Dizzudin2/grafana6 | public/app/types/dashboard.ts | TypeScript |
EnumDeclaration |
export enum DashboardRouteInfo {
Home = 'home-dashboard',
New = 'new-dashboard',
Normal = 'normal-dashboard',
Scripted = 'scripted-dashboard',
} | Dizzudin2/grafana6 | public/app/types/dashboard.ts | TypeScript |
EnumDeclaration |
export enum DashboardInitPhase {
NotStarted = 'Not started',
Fetching = 'Fetching',
Services = 'Services',
Failed = 'Failed',
Completed = 'Completed',
} | Dizzudin2/grafana6 | public/app/types/dashboard.ts | TypeScript |
TypeAliasDeclaration |
export type KioskUrlValue = 'tv' | '1' | true; | Dizzudin2/grafana6 | public/app/types/dashboard.ts | TypeScript |
FunctionDeclaration |
export function useDialog(): [(container: ReactNode, onExited?: VoidFunction) => void, VoidFunction] {
const [createDialog, closeDialog] = React.useContext(DialogContext);
let idDialog: number = -1;
const handleOpen = useCallback(
(container: ReactNode, onExited?: VoidFunction) => {
idDialog = ++idd as number;
createDialog({
children: container,
onExited,
idDialog,
});
},
[createDialog],
);
const handleClose = useCallback(() => {
closeDialog(idDialog);
}, [closeDialog, idDialog]);
return [handleOpen, handleClose];
} | BertSa/Schedulator3000 | frontend/schedulator3000/src/hooks/useDialog.tsx | TypeScript |
FunctionDeclaration |
function DialogContainer({ children, open, onClose, onEnded }: DialogContainerProps) {
return (
<Dialog open={open} onClose={onClose} onEnded={onEnded}>
{children}
</Dialog>
);
} | BertSa/Schedulator3000 | frontend/schedulator3000/src/hooks/useDialog.tsx | TypeScript |
FunctionDeclaration |
export default function DialogProvider({ children }: PropsWithChildren<{}>) {
const [dialogs, setDialogs] = React.useState<DialogParams[]>([]);
const [dialogsToRemove, setDialogsToRemove] = React.useState<number[]>([]);
useEffect(() => {
function removeDialog() {
if (dialogsToRemove.length > 0) {
setDialogs((dial) =>
dial.map((dialog) => {
if (dialog?.idDialog !== undefined && dialogsToRemove.indexOf(dialog.idDialog) !== -1) {
return { ...dialog, open: false };
}
return dialog;
}),
);
setDialogsToRemove([]);
}
}
removeDialog();
}, [dialogsToRemove]);
function createDialog(option: DialogParams): void {
return setDialogs((dial) => [...dial, { ...option, open: true }]);
}
function closeDialog(idDialog?: number): void {
setDialogsToRemove((dial) => {
if (idDialog === undefined) {
const id = dialogs[dialogs.length - 1]?.idDialog;
if (id === undefined) {
return dial;
}
return [...dial, id];
}
return [...dial, idDialog];
});
}
const contextValue = React.useRef([createDialog, closeDialog] as const);
return (
<DialogContext.Provider value={contextValue.current}>
{children}
{dialogs.map((dialog) => {
const { onClose, ...dialogParams } = dialog;
const handleOnEnded = () => {
if (dialog.onExited) {
dialog.onExited();
}
setDialogs((dial) => dial.slice(0, dial.length - 1));
};
return (
<DialogContainer key={dialog.idDialog} onClose={() => closeDialog()} onEnded={handleOnEnded} open={dialogParams.open ?? false}>
{dialogParams.children}
</DialogContainer>
);
})} | BertSa/Schedulator3000 | frontend/schedulator3000/src/hooks/useDialog.tsx | TypeScript |
FunctionDeclaration |
function removeDialog() {
if (dialogsToRemove.length > 0) {
setDialogs((dial) =>
dial.map((dialog) => {
if (dialog?.idDialog !== undefined && dialogsToRemove.indexOf(dialog.idDialog) !== -1) {
return { ...dialog, open: false };
}
return dialog;
}),
);
setDialogsToRemove([]);
}
} | BertSa/Schedulator3000 | frontend/schedulator3000/src/hooks/useDialog.tsx | TypeScript |
FunctionDeclaration |
function createDialog(option: DialogParams): void {
return setDialogs((dial) => [...dial, { ...option, open: true }]);
} | BertSa/Schedulator3000 | frontend/schedulator3000/src/hooks/useDialog.tsx | TypeScript |
FunctionDeclaration |
function closeDialog(idDialog?: number): void {
setDialogsToRemove((dial) => {
if (idDialog === undefined) {
const id = dialogs[dialogs.length - 1]?.idDialog;
if (id === undefined) {
return dial;
}
return [...dial, id];
}
return [...dial, idDialog];
});
} | BertSa/Schedulator3000 | frontend/schedulator3000/src/hooks/useDialog.tsx | TypeScript |
ArrowFunction |
(container: ReactNode, onExited?: VoidFunction) => {
idDialog = ++idd as number;
createDialog({
children: container,
onExited,
idDialog,
});
} | BertSa/Schedulator3000 | frontend/schedulator3000/src/hooks/useDialog.tsx | TypeScript |
ArrowFunction |
() => {
closeDialog(idDialog);
} | BertSa/Schedulator3000 | frontend/schedulator3000/src/hooks/useDialog.tsx | TypeScript |
ArrowFunction |
() => {
function removeDialog() {
if (dialogsToRemove.length > 0) {
setDialogs((dial) =>
dial.map((dialog) => {
if (dialog?.idDialog !== undefined && dialogsToRemove.indexOf(dialog.idDialog) !== -1) {
return { ...dialog, open: false };
}
return dialog;
}),
);
setDialogsToRemove([]);
}
}
removeDialog();
} | BertSa/Schedulator3000 | frontend/schedulator3000/src/hooks/useDialog.tsx | TypeScript |
ArrowFunction |
(dial) =>
dial.map((dialog) => {
if (dialog?.idDialog !== undefined && dialogsToRemove.indexOf(dialog.idDialog) !== -1) {
return { ...dialog, open: false };
}
return dialog;
}) | BertSa/Schedulator3000 | frontend/schedulator3000/src/hooks/useDialog.tsx | TypeScript |
ArrowFunction |
(dialog) => {
if (dialog?.idDialog !== undefined && dialogsToRemove.indexOf(dialog.idDialog) !== -1) {
return { ...dialog, open: false };
}
return dialog;
} | BertSa/Schedulator3000 | frontend/schedulator3000/src/hooks/useDialog.tsx | TypeScript |
ArrowFunction |
(dial) => [...dial, { ...option, open: true }] | BertSa/Schedulator3000 | frontend/schedulator3000/src/hooks/useDialog.tsx | TypeScript |
ArrowFunction |
(dial) => {
if (idDialog === undefined) {
const id = dialogs[dialogs.length - 1]?.idDialog;
if (id === undefined) {
return dial;
}
return [...dial, id];
}
return [...dial, idDialog];
} | BertSa/Schedulator3000 | frontend/schedulator3000/src/hooks/useDialog.tsx | TypeScript |
ArrowFunction |
(dialog) => {
const { onClose, ...dialogParams } = dialog;
const handleOnEnded = () => {
if (dialog.onExited) {
dialog.onExited();
}
setDialogs((dial) => dial.slice(0, dial.length - 1));
};
return (
<DialogContainer key={dialog.idDialog} onClose={() => closeDialog()} | BertSa/Schedulator3000 | frontend/schedulator3000/src/hooks/useDialog.tsx | TypeScript |
ArrowFunction |
() => {
if (dialog.onExited) {
dialog.onExited();
}
setDialogs((dial) => dial.slice(0, dial.length - 1));
} | BertSa/Schedulator3000 | frontend/schedulator3000/src/hooks/useDialog.tsx | TypeScript |
ArrowFunction |
(dial) => dial.slice(0, dial.length - 1) | BertSa/Schedulator3000 | frontend/schedulator3000/src/hooks/useDialog.tsx | TypeScript |
TypeAliasDeclaration |
type DialogParams = PropsWithChildren<{
idDialog?: number;
open?: boolean;
onClose?: VoidFunction;
onExited?: VoidFunction;
}>; | BertSa/Schedulator3000 | frontend/schedulator3000/src/hooks/useDialog.tsx | TypeScript |
TypeAliasDeclaration |
type ProviderContext = readonly [(option: DialogParams) => void, (id?: number) => void]; | BertSa/Schedulator3000 | frontend/schedulator3000/src/hooks/useDialog.tsx | TypeScript |
TypeAliasDeclaration |
type DialogContainerProps = PropsWithChildren<{
open: boolean;
onClose: VoidFunction;
onEnded: VoidFunction;
}>; | BertSa/Schedulator3000 | frontend/schedulator3000/src/hooks/useDialog.tsx | TypeScript |
InterfaceDeclaration |
export interface IMDIncGrp {
MDUpdateAction: string// 279
DeleteReason?: string// 285
MDSubBookType?: number// 1173
MarketDepth?: number// 264
MDEntryType?: string// 269
MDEntryID?: string// 278
MDEntryRefID?: string// 280
Instrument?: IInstrument
UndInstrmtGrp?: IUndInstrmtGrp
InstrmtLegGrp?: IInstrmtLegGrp
FinancialStatus?: string// 291
CorporateAction?: string// 292
MDEntryPx?: number// 270
PriceType?: number// 423
YieldData?: IYieldData
SpreadOrBenchmarkCurveData?: ISpreadOrBenchmarkCurveData
OrdType?: string// 40
Currency?: number// 15
MDEntrySize?: number// 271
SecSizesGrp?: ISecSizesGrp[]
LotType?: string// 1093
MDEntryDate?: Date// 272
MDEntryTime?: Date// 273
TickDirection?: string// 274
MDMkt?: string// 275
TradingSessionID?: string// 336
TradingSessionSubID?: string// 625
SecurityTradingStatus?: number// 326
HaltReason?: number// 327
QuoteCondition?: string// 276
TradeCondition?: string// 277
TrdType?: number// 828
MatchType?: string// 574
MDEntryOriginator?: string// 282
LocationID?: string// 283
DeskID?: string// 284
OpenCloseSettlFlag?: string// 286
TimeInForce?: string// 59
ExpireDate?: Date// 432
ExpireTime?: Date// 126
MinQty?: number// 110
ExecInst?: string// 18
SellerDays?: number// 287
OrderID?: string// 37
SecondaryOrderID?: string// 198
QuoteEntryID?: string// 299
TradeID?: string// 1003
MDEntryBuyer?: string// 288
MDEntrySeller?: string// 289
NumberOfOrders?: number// 346
MDEntryPositionNo?: number// 290
Scope?: string// 546
PriceDelta?: number// 811
NetChgPrevDay?: number// 451
Text?: string// 58
EncodedTextLen?: number// 354
EncodedText?: Buffer// 355
MDPriceLevel?: number// 1023
OrderCapacity?: string// 528
MDOriginType?: number// 1024
HighPx?: number// 332
LowPx?: number// 333
TradeVolume?: number// 1020
SettlType?: string// 63
SettlDate?: Date// 64
TransBkdTime?: Date// 483
TransactTime?: Date// 60
MDQuoteType?: number// 1070
RptSeq?: number// 83
DealingCapacity?: string// 1048
MDEntrySpotRate?: number// 1026
MDEntryForwardPoints?: number// 1027
StatsIndGrp?: IStatsIndGrp[]
Parties?: IParties[]
SettlCurrency?: number// 120
RateSource?: IRateSource[]
FirstPx?: number// 1025
LastPx?: number// 31
MDStreamID?: string// 1500
} | pvtienhoa/jspurefix | src/types/FIX.5.0SP2/repo/set/md_inc_grp.ts | TypeScript |
ArrowFunction |
() => import('@/uiservice/sys-role-permission/sys-role-permission-ui-service') | ibiz4j/ibizlab-runtime | ibzuaa/app_web/src/uiservice/ui-service-register.ts | TypeScript |
ArrowFunction |
() => import('@/uiservice/sys-user/sys-user-ui-service') | ibiz4j/ibizlab-runtime | ibzuaa/app_web/src/uiservice/ui-service-register.ts | TypeScript |
ArrowFunction |
() => import('@/uiservice/sys-auth-log/sys-auth-log-ui-service') | ibiz4j/ibizlab-runtime | ibzuaa/app_web/src/uiservice/ui-service-register.ts | TypeScript |
ArrowFunction |
() => import('@/uiservice/sys-user-auth/sys-user-auth-ui-service') | ibiz4j/ibizlab-runtime | ibzuaa/app_web/src/uiservice/ui-service-register.ts | TypeScript |
ArrowFunction |
() => import('@/uiservice/sys-open-access/sys-open-access-ui-service') | ibiz4j/ibizlab-runtime | ibzuaa/app_web/src/uiservice/ui-service-register.ts | TypeScript |
ArrowFunction |
() => import('@/uiservice/sys-user-role/sys-user-role-ui-service') | ibiz4j/ibizlab-runtime | ibzuaa/app_web/src/uiservice/ui-service-register.ts | TypeScript |
ArrowFunction |
() => import('@/uiservice/sys-role/sys-role-ui-service') | ibiz4j/ibizlab-runtime | ibzuaa/app_web/src/uiservice/ui-service-register.ts | TypeScript |
ArrowFunction |
() => import('@/uiservice/sys-permission/sys-permission-ui-service') | ibiz4j/ibizlab-runtime | ibzuaa/app_web/src/uiservice/ui-service-register.ts | TypeScript |
ArrowFunction |
() => import('@/uiservice/sys-app/sys-app-ui-service') | ibiz4j/ibizlab-runtime | ibzuaa/app_web/src/uiservice/ui-service-register.ts | TypeScript |
ClassDeclaration | /**
* UI服务注册中心
*
* @export
* @class UIServiceRegister
*/
export class UIServiceRegister {
/**
* 所有UI实体服务Map
*
* @protected
* @type {*}
* @memberof UIServiceRegister
*/
protected allUIService: Map<string, () => Promise<any>> = new Map();
/**
* 已加载UI实体服务Map缓存
*
* @protected
* @type {Map<string, any>}
* @memberof UIServiceRegister
*/
protected serviceCache: Map<string, any> = new Map();
/**
* Creates an instance of UIServiceRegister.
* @memberof UIServiceRegister
*/
constructor() {
this.init();
}
/**
* 初始化
*
* @protected
* @memberof UIServiceRegister
*/
protected init(): void {
this.allUIService.set('sysrolepermission', () => import('@/uiservice/sys-role-permission/sys-role-permission-ui-service'));
this.allUIService.set('sysuser', () => import('@/uiservice/sys-user/sys-user-ui-service'));
this.allUIService.set('sysauthlog', () => import('@/uiservice/sys-auth-log/sys-auth-log-ui-service'));
this.allUIService.set('sysuserauth', () => import('@/uiservice/sys-user-auth/sys-user-auth-ui-service'));
this.allUIService.set('sysopenaccess', () => import('@/uiservice/sys-open-access/sys-open-access-ui-service'));
this.allUIService.set('sysuserrole', () => import('@/uiservice/sys-user-role/sys-user-role-ui-service'));
this.allUIService.set('sysrole', () => import('@/uiservice/sys-role/sys-role-ui-service'));
this.allUIService.set('syspermission', () => import('@/uiservice/sys-permission/sys-permission-ui-service'));
this.allUIService.set('sysapp', () => import('@/uiservice/sys-app/sys-app-ui-service'));
}
/**
* 加载服务实体
*
* @protected
* @param {string} serviceName
* @returns {Promise<any>}
* @memberof UIServiceRegister
*/
protected async loadService(serviceName: string): Promise<any> {
const service = this.allUIService.get(serviceName);
if (service) {
return service();
}
}
/**
* 获取应用实体服务
*
* @param {string} name
* @returns {Promise<any>}
* @memberof UIServiceRegister
*/
public async getService(name: string): Promise<any> {
if (this.serviceCache.has(name)) {
return this.serviceCache.get(name);
}
const entityService: any = await this.loadService(name);
if (entityService && entityService.default) {
const instance: any = new entityService.default();
this.serviceCache.set(name, instance);
return instance;
}
}
} | ibiz4j/ibizlab-runtime | ibzuaa/app_web/src/uiservice/ui-service-register.ts | TypeScript |
MethodDeclaration | /**
* 初始化
*
* @protected
* @memberof UIServiceRegister
*/
protected init(): void {
this.allUIService.set('sysrolepermission', () => import('@/uiservice/sys-role-permission/sys-role-permission-ui-service'));
this.allUIService.set('sysuser', () => import('@/uiservice/sys-user/sys-user-ui-service'));
this.allUIService.set('sysauthlog', () => import('@/uiservice/sys-auth-log/sys-auth-log-ui-service'));
this.allUIService.set('sysuserauth', () => import('@/uiservice/sys-user-auth/sys-user-auth-ui-service'));
this.allUIService.set('sysopenaccess', () => import('@/uiservice/sys-open-access/sys-open-access-ui-service'));
this.allUIService.set('sysuserrole', () => import('@/uiservice/sys-user-role/sys-user-role-ui-service'));
this.allUIService.set('sysrole', () => import('@/uiservice/sys-role/sys-role-ui-service'));
this.allUIService.set('syspermission', () => import('@/uiservice/sys-permission/sys-permission-ui-service'));
this.allUIService.set('sysapp', () => import('@/uiservice/sys-app/sys-app-ui-service'));
} | ibiz4j/ibizlab-runtime | ibzuaa/app_web/src/uiservice/ui-service-register.ts | TypeScript |
MethodDeclaration | /**
* 加载服务实体
*
* @protected
* @param {string} serviceName
* @returns {Promise<any>}
* @memberof UIServiceRegister
*/
protected async loadService(serviceName: string): Promise<any> {
const service = this.allUIService.get(serviceName);
if (service) {
return service();
}
} | ibiz4j/ibizlab-runtime | ibzuaa/app_web/src/uiservice/ui-service-register.ts | TypeScript |
MethodDeclaration | /**
* 获取应用实体服务
*
* @param {string} name
* @returns {Promise<any>}
* @memberof UIServiceRegister
*/
public async getService(name: string): Promise<any> {
if (this.serviceCache.has(name)) {
return this.serviceCache.get(name);
}
const entityService: any = await this.loadService(name);
if (entityService && entityService.default) {
const instance: any = new entityService.default();
this.serviceCache.set(name, instance);
return instance;
}
} | ibiz4j/ibizlab-runtime | ibzuaa/app_web/src/uiservice/ui-service-register.ts | TypeScript |
ArrowFunction |
(resolve) => {
this.http.post(url, data, { headers: this.getHeader() }).subscribe(
(response) => {
resolve(<ICommunication<TModel>>{
success: true,
data: response
});
},
(error) => {
let resultError = <ICommunication<TModel>>{
success: false,
statusCode: error.status,
data: error.error
};
this.errorValidate(resultError);
resolve(resultError);
});
} | PauloHenriqueFernandesAraujo/AngularMaterializeStruct | src/app/generic/services/communication.service.ts | TypeScript |
ArrowFunction |
(response) => {
resolve(<ICommunication<TModel>>{
success: true,
data: response
});
} | PauloHenriqueFernandesAraujo/AngularMaterializeStruct | src/app/generic/services/communication.service.ts | TypeScript |
ArrowFunction |
(error) => {
let resultError = <ICommunication<TModel>>{
success: false,
statusCode: error.status,
data: error.error
};
this.errorValidate(resultError);
resolve(resultError);
} | PauloHenriqueFernandesAraujo/AngularMaterializeStruct | src/app/generic/services/communication.service.ts | TypeScript |
ArrowFunction |
(resolve) => {
this.http.get(url, { headers: this.getHeader() }).subscribe(
(response) => {
resolve(<ICommunication<TModel>>{
success: true,
data: response
});
},
(error) => {
let resultError = <ICommunication<TModel>>{
success: false,
statusCode: error.status,
data: error.error
};
this.errorValidate(resultError);
resolve(resultError);
});
} | PauloHenriqueFernandesAraujo/AngularMaterializeStruct | src/app/generic/services/communication.service.ts | TypeScript |
ArrowFunction |
(error) => {
let resultError = <ICommunication<TModel>>{
success: false,
statusCode: error.status,
data: error.error
};
this.errorValidate(resultError);
resolve(resultError);
} | PauloHenriqueFernandesAraujo/AngularMaterializeStruct | src/app/generic/services/communication.service.ts | TypeScript |
ClassDeclaration |
@Injectable()
export class CommunicationService {
constructor(public http: HttpClient, public router: Router) { }
public post<TModel>(url: string, data: any): Promise<ICommunication<TModel>> {
return new Promise((resolve) => {
this.http.post(url, data, { headers: this.getHeader() }).subscribe(
(response) => {
resolve(<ICommunication<TModel>>{
success: true,
data: response
});
},
(error) => {
let resultError = <ICommunication<TModel>>{
success: false,
statusCode: error.status,
data: error.error
};
this.errorValidate(resultError);
resolve(resultError);
});
});
}
public get<TModel>(url: string): Promise<ICommunication<TModel>> {
return new Promise((resolve) => {
this.http.get(url, { headers: this.getHeader() }).subscribe(
(response) => {
resolve(<ICommunication<TModel>>{
success: true,
data: response
});
},
(error) => {
let resultError = <ICommunication<TModel>>{
success: false,
statusCode: error.status,
data: error.error
};
this.errorValidate(resultError);
resolve(resultError);
});
});
}
getHeader(): HttpHeaders { return new HttpHeaders().set("Authorization", "Bearer " + this.getToken()).append('Content-Type', 'application/json'); }
public getToken() {
let info = this.getLocalStorageToken();
if (info) return info['access_token'];
}
public getUserInfo() {
let info = this.getLocalStorageToken();
if (info) { return { id: info["session_id"], username: info["username"], name: info["name"] }; }
}
private getLocalStorageToken() {
let local = localStorage.getItem(Constants.STORAGE_USER_SESSION);
if (isNullOrUndefined(local)) return null;
let obj = JSON.parse(local);
if (isNullOrUndefined(obj)) return null;
return obj;
}
private errorValidate(result: any) {
if (!result.success) {
if (!isNullOrUndefined(result.modelState)) {
if (result.modelState.message == "USR_LOGIN") { this.router.navigate(['/entrar']); }
//adicionar demais erros aqui
}
}
}
} | PauloHenriqueFernandesAraujo/AngularMaterializeStruct | src/app/generic/services/communication.service.ts | TypeScript |
MethodDeclaration |
public post<TModel>(url: string, data: any): Promise<ICommunication<TModel>> {
return new Promise((resolve) => {
this.http.post(url, data, { headers: this.getHeader() }).subscribe(
(response) => {
resolve(<ICommunication<TModel>>{
success: true,
data: response
});
},
(error) => {
let resultError = <ICommunication<TModel>>{
success: false,
statusCode: error.status,
data: error.error
};
this.errorValidate(resultError);
resolve(resultError);
});
});
} | PauloHenriqueFernandesAraujo/AngularMaterializeStruct | src/app/generic/services/communication.service.ts | TypeScript |
MethodDeclaration |
public get<TModel>(url: string): Promise<ICommunication<TModel>> {
return new Promise((resolve) => {
this.http.get(url, { headers: this.getHeader() }).subscribe(
(response) => {
resolve(<ICommunication<TModel>>{
success: true,
data: response
});
},
(error) => {
let resultError = <ICommunication<TModel>>{
success: false,
statusCode: error.status,
data: error.error
};
this.errorValidate(resultError);
resolve(resultError);
});
});
} | PauloHenriqueFernandesAraujo/AngularMaterializeStruct | src/app/generic/services/communication.service.ts | TypeScript |
MethodDeclaration |
getHeader(): HttpHeaders { return new HttpHeaders().set("Authorization", "Bearer " + this.getToken()).append('Content-Type', 'application/json'); } | PauloHenriqueFernandesAraujo/AngularMaterializeStruct | src/app/generic/services/communication.service.ts | TypeScript |
MethodDeclaration |
public getToken() {
let info = this.getLocalStorageToken();
if (info) return info['access_token'];
} | PauloHenriqueFernandesAraujo/AngularMaterializeStruct | src/app/generic/services/communication.service.ts | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.