type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
|---|---|---|---|---|
ArrowFunction
|
f =>
new CodeFragmentTreeItem(
f.label,
f.id,
vscode.TreeItemCollapsibleState.None,
{
arguments: [f.id],
command: 'codeFragments.insertCodeFragment',
title: 'Insert Code Fragment',
tooltip: 'Insert Code Fragment'
})
|
markvincze/vscode-codeFragments
|
src/codeFragmentsTreeItem.ts
|
TypeScript
|
ClassDeclaration
|
export class CodeFragmentTreeItem extends vscode.TreeItem {
constructor(
public readonly label: string,
public readonly id: string,
public readonly collapsibleState: vscode.TreeItemCollapsibleState,
public readonly command: vscode.Command,
) {
super(label, collapsibleState);
}
}
|
markvincze/vscode-codeFragments
|
src/codeFragmentsTreeItem.ts
|
TypeScript
|
ClassDeclaration
|
export class CodeFragmentProvider implements vscode.TreeDataProvider<CodeFragmentTreeItem> {
private onDidChangeTreeDataEmitter: vscode.EventEmitter<CodeFragmentTreeItem | undefined> =
new vscode.EventEmitter<CodeFragmentTreeItem | undefined>();
public readonly onDidChangeTreeData: vscode.Event<CodeFragmentTreeItem | undefined> = this.onDidChangeTreeDataEmitter.event;
constructor(
private readonly fragmentManager: IFragmentManager
) {
fragmentManager.onFragmentsChanged(() => this.onDidChangeTreeDataEmitter.fire());
}
public getTreeItem(element: CodeFragmentTreeItem): vscode.TreeItem {
return element;
}
public getChildren(element?: CodeFragmentTreeItem): Thenable<CodeFragmentTreeItem[]> {
return new Promise(resolve => {
resolve(
this.fragmentManager.getAll().map(f =>
new CodeFragmentTreeItem(
f.label,
f.id,
vscode.TreeItemCollapsibleState.None,
{
arguments: [f.id],
command: 'codeFragments.insertCodeFragment',
title: 'Insert Code Fragment',
tooltip: 'Insert Code Fragment'
}),
)
);
});
}
}
|
markvincze/vscode-codeFragments
|
src/codeFragmentsTreeItem.ts
|
TypeScript
|
MethodDeclaration
|
public getTreeItem(element: CodeFragmentTreeItem): vscode.TreeItem {
return element;
}
|
markvincze/vscode-codeFragments
|
src/codeFragmentsTreeItem.ts
|
TypeScript
|
MethodDeclaration
|
public getChildren(element?: CodeFragmentTreeItem): Thenable<CodeFragmentTreeItem[]> {
return new Promise(resolve => {
resolve(
this.fragmentManager.getAll().map(f =>
new CodeFragmentTreeItem(
f.label,
f.id,
vscode.TreeItemCollapsibleState.None,
{
arguments: [f.id],
command: 'codeFragments.insertCodeFragment',
title: 'Insert Code Fragment',
tooltip: 'Insert Code Fragment'
}),
)
);
});
}
|
markvincze/vscode-codeFragments
|
src/codeFragmentsTreeItem.ts
|
TypeScript
|
InterfaceDeclaration
|
interface Meta {
ref?: ComposedRef;
source?: string;
sourceType?: 'local' | 'external';
sourceLocation?: string;
refId?: string;
v?: number;
type: string;
}
|
Catherinesjkim/React-Storybook-V6
|
node_modules/@storybook/api/ts3.5/dist/lib/events.d.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface IBulkImportData {
files: IFileEntity[];
authorizedFiles: IFileEntity[];
}
|
include-dcc/include-portal-ui
|
src/store/fenceCavatica/types.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface ICavaticaTreeNode {
href: string;
name: string;
id: string;
pId: any;
value: string;
title: string;
type: string;
project?: string;
isLeaf?: boolean;
}
|
include-dcc/include-portal-ui
|
src/store/fenceCavatica/types.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type initialState = {
isAnalyseModalOpen: boolean;
isCreateProjectModalOpen: boolean;
isCreatingProject: boolean;
isFetchingBillingGroup: boolean;
isInitializingAnalyse: boolean;
isBulkImportLoading: boolean;
isLoading: boolean;
beginAnalyseAfterConnection: boolean;
bulkImportData: IBulkImportData;
projects: TCavaticaProjectWithMembers[];
projectsTree: ICavaticaTreeNode[];
billingGroups: ICavaticaBillingGroup[];
error?: any;
newlyCreatedProject?: ICavaticaTreeNode;
};
|
include-dcc/include-portal-ui
|
src/store/fenceCavatica/types.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type TCavaticaProjectWithMembers = ICavaticaProject & {
memberCount: number;
};
|
include-dcc/include-portal-ui
|
src/store/fenceCavatica/types.ts
|
TypeScript
|
ClassDeclaration
|
export class TNSWebViewAdvanced extends Common {
}
|
NathanWalker/nativescript-webview-advanced
|
webview-advanced.ios.ts
|
TypeScript
|
ArrowFunction
|
(isCollapsed) => {
this.isMenuCollapsed = isCollapsed;
}
|
supun19/directPayfrontend
|
src/app/theme/components/baSidebar/baSidebar.component.ts
|
TypeScript
|
ArrowFunction
|
() => this.updateSidebarHeight()
|
supun19/directPayfrontend
|
src/app/theme/components/baSidebar/baSidebar.component.ts
|
TypeScript
|
ClassDeclaration
|
@Component({
selector: 'ba-sidebar',
templateUrl: './baSidebar.html',
styleUrls: ['./baSidebar.scss']
})
export class BaSidebar {
public menuHeight:number;
public isMenuCollapsed:boolean = false;
public isMenuShouldCollapsed:boolean = false;
constructor(private _elementRef:ElementRef, private _state:GlobalState) {
this._state.subscribe('menu.isCollapsed', (isCollapsed) => {
this.isMenuCollapsed = isCollapsed;
});
}
public ngOnInit():void {
if (this._shouldMenuCollapse()) {
this.menuCollapse();
}
}
public ngAfterViewInit():void {
setTimeout(() => this.updateSidebarHeight());
}
@HostListener('window:resize')
public onWindowResize():void {
var isMenuShouldCollapsed = this._shouldMenuCollapse();
if (this.isMenuShouldCollapsed !== isMenuShouldCollapsed) {
this.menuCollapseStateChange(isMenuShouldCollapsed);
}
this.isMenuShouldCollapsed = isMenuShouldCollapsed;
this.updateSidebarHeight();
}
public menuExpand():void {
this.menuCollapseStateChange(false);
}
public menuCollapse():void {
this.menuCollapseStateChange(true);
}
public menuCollapseStateChange(isCollapsed:boolean):void {
this.isMenuCollapsed = isCollapsed;
this._state.notifyDataChanged('menu.isCollapsed', this.isMenuCollapsed);
}
public updateSidebarHeight():void {
// TODO: get rid of magic 84 constant
this.menuHeight = this._elementRef.nativeElement.childNodes[0].clientHeight - 84;
}
private _shouldMenuCollapse():boolean {
return window.innerWidth <= layoutSizes.resWidthCollapseSidebar;
}
}
|
supun19/directPayfrontend
|
src/app/theme/components/baSidebar/baSidebar.component.ts
|
TypeScript
|
MethodDeclaration
|
public ngOnInit():void {
if (this._shouldMenuCollapse()) {
this.menuCollapse();
}
}
|
supun19/directPayfrontend
|
src/app/theme/components/baSidebar/baSidebar.component.ts
|
TypeScript
|
MethodDeclaration
|
public ngAfterViewInit():void {
setTimeout(() => this.updateSidebarHeight());
}
|
supun19/directPayfrontend
|
src/app/theme/components/baSidebar/baSidebar.component.ts
|
TypeScript
|
MethodDeclaration
|
@HostListener('window:resize')
public onWindowResize():void {
var isMenuShouldCollapsed = this._shouldMenuCollapse();
if (this.isMenuShouldCollapsed !== isMenuShouldCollapsed) {
this.menuCollapseStateChange(isMenuShouldCollapsed);
}
this.isMenuShouldCollapsed = isMenuShouldCollapsed;
this.updateSidebarHeight();
}
|
supun19/directPayfrontend
|
src/app/theme/components/baSidebar/baSidebar.component.ts
|
TypeScript
|
MethodDeclaration
|
public menuExpand():void {
this.menuCollapseStateChange(false);
}
|
supun19/directPayfrontend
|
src/app/theme/components/baSidebar/baSidebar.component.ts
|
TypeScript
|
MethodDeclaration
|
public menuCollapse():void {
this.menuCollapseStateChange(true);
}
|
supun19/directPayfrontend
|
src/app/theme/components/baSidebar/baSidebar.component.ts
|
TypeScript
|
MethodDeclaration
|
public menuCollapseStateChange(isCollapsed:boolean):void {
this.isMenuCollapsed = isCollapsed;
this._state.notifyDataChanged('menu.isCollapsed', this.isMenuCollapsed);
}
|
supun19/directPayfrontend
|
src/app/theme/components/baSidebar/baSidebar.component.ts
|
TypeScript
|
MethodDeclaration
|
public updateSidebarHeight():void {
// TODO: get rid of magic 84 constant
this.menuHeight = this._elementRef.nativeElement.childNodes[0].clientHeight - 84;
}
|
supun19/directPayfrontend
|
src/app/theme/components/baSidebar/baSidebar.component.ts
|
TypeScript
|
MethodDeclaration
|
private _shouldMenuCollapse():boolean {
return window.innerWidth <= layoutSizes.resWidthCollapseSidebar;
}
|
supun19/directPayfrontend
|
src/app/theme/components/baSidebar/baSidebar.component.ts
|
TypeScript
|
ArrowFunction
|
({schedule, repoAddress, onHighlightRunIds}) => {
const scheduleSelector = {
...repoAddressToSelector(repoAddress),
scheduleName: schedule.name,
};
const {data} = useQuery<ScheduleTickHistoryQuery>(SCHEDULE_TICK_HISTORY_QUERY, {
variables: {
scheduleSelector,
},
fetchPolicy: 'cache-and-network',
pollInterval: 15 * 1000,
partialRefetch: true,
});
if (!data || data?.scheduleOrError.__typename !== 'Schedule') {
return <Spinner />;
}
return (
<Box margin={{vertical: 20}}
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
ArrowFunction
|
({sensor, repoAddress, onHighlightRunIds}) => {
const sensorSelector = {
...repoAddressToSelector(repoAddress),
sensorName: sensor.name,
};
const {data} = useQuery<SensorTickHistoryQuery>(SENSOR_TICK_HISTORY_QUERY, {
variables: {
sensorSelector,
},
fetchPolicy: 'cache-and-network',
pollInterval: 15 * 1000,
partialRefetch: true,
});
if (!data || data?.sensorOrError.__typename !== 'Sensor') {
return <Spinner />;
}
return (
<Box margin={{vertical: 20}}
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
ArrowFunction
|
({
jobName,
jobState,
repoAddress,
onHighlightRunIds,
}: {
jobName: string;
jobState: JobHistoryFragment;
repoAddress: RepoAddress;
onHighlightRunIds: (runIds: string[]) => void;
}) => {
const [shownStates, setShownStates] = React.useState<ShownStatusState>(
DEFAULT_SHOWN_STATUS_STATE,
);
const [selectedTab, setSelectedTab] = React.useState<string>('recent');
const [selectedTick, setSelectedTick] = React.useState<JobHistoryFragment_ticks | undefined>();
const {ticks} = jobState;
const displayedTicks = ticks.filter((tick) =>
tick.status === JobTickStatus.SKIPPED
? jobState.jobType === JobType.SCHEDULE && shownStates[tick.status]
: shownStates[tick.status],
);
const StatusFilter = ({status}: {status: JobTickStatus}) => (
<Checkbox
label={STATUS_TEXT_MAP[status]}
checked={shownStates[status]}
disabled={!ticks.filter((tick) => tick.status === status).length}
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
ArrowFunction
|
(tick) =>
tick.status === JobTickStatus.SKIPPED
? jobState.jobType === JobType.SCHEDULE && shownStates[tick.status]
: shownStates[tick.status]
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
ArrowFunction
|
({status}: {status: JobTickStatus}) => (
<Checkbox
label={STATUS_TEXT_MAP[status]}
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
ArrowFunction
|
(tick) => tick.status === status
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
ArrowFunction
|
(tick?: JobHistoryFragment_ticks) => {
setSelectedTick(tick);
if (!tick) {
return;
}
if (tick.error && tick.status === JobTickStatus.FAILURE) {
showCustomAlert({
title: 'Python Error',
body: <PythonErrorInfo error={tick.error} />,
});
}
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
ArrowFunction
|
({ticks, selectedTick, onSelectTick, onHighlightRunIds}) => {
const [bounds, setBounds] = React.useState<Bounds | null>(null);
const tickData = ticks.map((tick) => ({x: 1000 * tick.timestamp, y: 0}));
const graphData: ChartComponentProps['data'] = {
labels: ['ticks'],
datasets: [
{
label: 'ticks',
data: tickData,
borderColor: Colors.LIGHT_GRAY4,
borderWidth: 0,
backgroundColor: 'rgba(0,0,0,0)',
pointBackgroundColor: ticks.map((tick) => COLOR_MAP[tick.status]),
pointBorderWidth: 1,
pointBorderColor: ticks.map((tick) =>
selectedTick && selectedTick.id === tick.id ? Colors.DARK_GRAY5 : COLOR_MAP[tick.status],
),
pointRadius: ticks.map((tick) => (selectedTick && selectedTick.id === tick.id ? 5 : 3)),
pointHoverBorderWidth: 1,
pointHoverRadius: 5,
showLine: true,
},
],
};
const dataMin = Math.min(...tickData.map((_) => _.x));
const dataMax = Math.max(...tickData.map((_) => _.x));
const buffer = (dataMax - dataMin) / 25;
const dataBounds = {min: dataMin - buffer, max: dataMax + buffer};
const calculateBounds = () => {
if (bounds) {
return bounds;
}
return dataBounds;
};
const calculateUnit: () => TimeUnit = () => {
const {min, max} = calculateBounds();
const range = max - min;
const factor = 2;
const hour = 3600000;
const day = 24 * hour;
const month = 30 * day;
const year = 365 * day;
if (range < factor * hour) {
return 'minute';
}
if (range < factor * day) {
return 'hour';
}
if (range < factor * month) {
return 'day';
}
if (range < factor * year) {
return 'month';
}
return 'year';
};
const dateFormat = (x: number) => moment(x).format('MMM D');
const snippet = (x: string, length = 100, buffer = 20) => {
const snipped = x.slice(0, length);
return snipped.length < x.length - buffer ? `${snipped}...` : x;
};
const title = bounds
? dateFormat(bounds.min) === dateFormat(bounds.max)
? dateFormat(bounds.min)
: `${dateFormat(bounds.min)} - ${dateFormat(bounds.max)}`
: undefined;
const options: ChartComponentProps['options'] = {
title: {
display: !!title,
text: title,
},
scales: {
yAxes: [{scaleLabel: {display: false}, ticks: {display: false}, gridLines: {display: false}}],
xAxes: [
{
type: 'time',
scaleLabel: {
display: false,
},
bounds: 'ticks',
gridLines: {display: true, drawBorder: true},
ticks: {
source: 'auto',
...calculateBounds(),
},
time: {
minUnit: calculateUnit(),
},
},
],
},
legend: {
display: false,
},
tooltips: {
displayColors: false,
callbacks: {
label: function (tooltipItem, _data) {
if (tooltipItem.index === undefined || tooltipItem.index === ticks.length) {
return '';
}
const tick = ticks[tooltipItem.index];
if (tick.status === JobTickStatus.SKIPPED && tick.skipReason) {
return snippet(tick.skipReason);
}
if (tick.status === JobTickStatus.SUCCESS && tick.runIds.length) {
return tick.runIds;
}
if (tick.status == JobTickStatus.FAILURE && tick.error?.message) {
return snippet(tick.error.message);
}
return '';
},
},
},
onHover: (event: MouseEvent, activeElements: any[]) => {
if (event?.target instanceof HTMLElement) {
event.target.style.cursor = activeElements.length ? 'pointer' : 'default';
}
if (activeElements.length && activeElements[0] && activeElements[0]._index < ticks.length) {
const tick = ticks[activeElements[0]._index];
onHighlightRunIds(tick.runIds || []);
} else {
onHighlightRunIds([]);
}
},
onClick: (_event: MouseEvent, activeElements: any[]) => {
if (!activeElements.length) {
return;
}
const [item] = activeElements;
if (item._datasetIndex === undefined || item._index === undefined) {
return;
}
const tick = ticks[item._index];
onSelectTick(tick);
},
plugins: {
zoom: {
zoom: {
enabled: true,
mode: 'x',
rangeMin: {
x: dataBounds.min,
},
rangeMax: {
x: dataBounds.max,
},
onZoom: ({chart}: {chart: Chart}) => {
const {min, max} = chart.options.scales?.xAxes?.[0].ticks || {};
if (min && max) {
setBounds({min, max});
}
},
},
pan: {
rangeMin: {
x: dataBounds.min,
},
rangeMax: {
x: dataBounds.max,
},
enabled: true,
mode: 'x',
onPan: ({chart}: {chart: Chart}) => {
const {min, max} = chart.options.scales?.xAxes?.[0].ticks || {};
if (min && max) {
setBounds({min, max});
}
},
},
},
},
};
return (
<div>
<Line data={graphData} height={30} options={options} key="100%" />
<div style={{fontSize: 13, opacity: 0.5}}>
<Box flex={{justifyContent: 'center'}} margin={{top: 8}}
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
ArrowFunction
|
(tick) => ({x: 1000 * tick.timestamp, y: 0})
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
ArrowFunction
|
(tick) => COLOR_MAP[tick.status]
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
ArrowFunction
|
(tick) =>
selectedTick && selectedTick.id === tick.id ? Colors.DARK_GRAY5 : COLOR_MAP[tick.status]
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
ArrowFunction
|
(tick) => (selectedTick && selectedTick.id === tick.id ? 5 : 3)
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
ArrowFunction
|
(_) => _.x
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
ArrowFunction
|
() => {
if (bounds) {
return bounds;
}
return dataBounds;
}
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
ArrowFunction
|
() => {
const {min, max} = calculateBounds();
const range = max - min;
const factor = 2;
const hour = 3600000;
const day = 24 * hour;
const month = 30 * day;
const year = 365 * day;
if (range < factor * hour) {
return 'minute';
}
if (range < factor * day) {
return 'hour';
}
if (range < factor * month) {
return 'day';
}
if (range < factor * year) {
return 'month';
}
return 'year';
}
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
ArrowFunction
|
(x: number) => moment(x).format('MMM D')
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
ArrowFunction
|
(x: string, length = 100, buffer = 20) => {
const snipped = x.slice(0, length);
return snipped.length < x.length - buffer ? `${snipped}...` : x;
}
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
ArrowFunction
|
(event: MouseEvent, activeElements: any[]) => {
if (event?.target instanceof HTMLElement) {
event.target.style.cursor = activeElements.length ? 'pointer' : 'default';
}
if (activeElements.length && activeElements[0] && activeElements[0]._index < ticks.length) {
const tick = ticks[activeElements[0]._index];
onHighlightRunIds(tick.runIds || []);
} else {
onHighlightRunIds([]);
}
}
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
ArrowFunction
|
(_event: MouseEvent, activeElements: any[]) => {
if (!activeElements.length) {
return;
}
const [item] = activeElements;
if (item._datasetIndex === undefined || item._index === undefined) {
return;
}
const tick = ticks[item._index];
onSelectTick(tick);
}
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
ArrowFunction
|
({chart}: {chart: Chart}) => {
const {min, max} = chart.options.scales?.xAxes?.[0].ticks || {};
if (min && max) {
setBounds({min, max});
}
}
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
ArrowFunction
|
() => setBounds(null)
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
InterfaceDeclaration
|
interface ShownStatusState {
[JobTickStatus.SUCCESS]: boolean;
[JobTickStatus.FAILURE]: boolean;
[JobTickStatus.STARTED]: boolean;
[JobTickStatus.SKIPPED]: boolean;
}
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
InterfaceDeclaration
|
interface Bounds {
min: number;
max: number;
}
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
MethodDeclaration
|
selectedTick ? <TimestampDisplay timestamp={selectedTick
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
MethodDeclaration
|
selectedTick ? (
<Box background={Colors.WHITE} padding={16} margin={{bottom: 16}
|
alex-treebeard/dagster
|
js_modules/dagit/src/jobs/TickHistory.tsx
|
TypeScript
|
FunctionDeclaration
|
function toAudienceScheme(value: string): AudienceScheme | undefined {
return Object.values(AudienceScheme).find(v => v === value)
}
|
DANS-KNAW/easy-deposit-ui
|
src/main/typescript/lib/metadata/Audience.ts
|
TypeScript
|
ArrowFunction
|
v => v === value
|
DANS-KNAW/easy-deposit-ui
|
src/main/typescript/lib/metadata/Audience.ts
|
TypeScript
|
ArrowFunction
|
audiences => a => {
const scheme = toAudienceScheme(a.scheme)
if (scheme && scheme === AudienceScheme.narcisDisciplineTypes)
if (audiences.find(({ key }) => key === a.key))
return a.key
else
throw `Error in metadata: no such audience found: '${a.key}'`
else
throw `Error in metadata: no such audience scheme: '${a.scheme}'`
}
|
DANS-KNAW/easy-deposit-ui
|
src/main/typescript/lib/metadata/Audience.ts
|
TypeScript
|
ArrowFunction
|
a => {
const scheme = toAudienceScheme(a.scheme)
if (scheme && scheme === AudienceScheme.narcisDisciplineTypes)
if (audiences.find(({ key }) => key === a.key))
return a.key
else
throw `Error in metadata: no such audience found: '${a.key}'`
else
throw `Error in metadata: no such audience scheme: '${a.scheme}'`
}
|
DANS-KNAW/easy-deposit-ui
|
src/main/typescript/lib/metadata/Audience.ts
|
TypeScript
|
ArrowFunction
|
({ key }) => key === a.key
|
DANS-KNAW/easy-deposit-ui
|
src/main/typescript/lib/metadata/Audience.ts
|
TypeScript
|
ArrowFunction
|
audiences => a => {
const entry: DropdownListEntry | undefined = audiences.find(({ key }) => key === a)
if (entry)
return {
scheme: AudienceScheme.narcisDisciplineTypes,
key: a,
value: entry.value,
}
else
throw `Error in metadata: no valid audience found for key '${a}'`
}
|
DANS-KNAW/easy-deposit-ui
|
src/main/typescript/lib/metadata/Audience.ts
|
TypeScript
|
ArrowFunction
|
a => {
const entry: DropdownListEntry | undefined = audiences.find(({ key }) => key === a)
if (entry)
return {
scheme: AudienceScheme.narcisDisciplineTypes,
key: a,
value: entry.value,
}
else
throw `Error in metadata: no valid audience found for key '${a}'`
}
|
DANS-KNAW/easy-deposit-ui
|
src/main/typescript/lib/metadata/Audience.ts
|
TypeScript
|
ArrowFunction
|
({ key }) => key === a
|
DANS-KNAW/easy-deposit-ui
|
src/main/typescript/lib/metadata/Audience.ts
|
TypeScript
|
EnumDeclaration
|
enum AudienceScheme {
narcisDisciplineTypes = "narcis:DisciplineType",
}
|
DANS-KNAW/easy-deposit-ui
|
src/main/typescript/lib/metadata/Audience.ts
|
TypeScript
|
ClassDeclaration
|
@Component({
selector: 'app-password-creation',
templateUrl: './password.component.html',
styleUrls: ['./password.component.css']
})
export class PasswordComponent {
constructor(private regSvc: RegistrationService,
private authService: AuthService,
private router: Router,
private alert: AlertsService) {
}
onKeydown(event) {
if (event.key === "Enter") {
this.next();
}
}
next() {
const password = (document.getElementById('password') as HTMLInputElement).value;
if (!password) {
this.alert.showError('Password must be more than 0 letters', 'Error');
return;
}
this.regSvc.password = password;
this.router.navigate(['/registration/repeat']);
return;
}
}
|
Masha1996/BrowserBNB
|
app/view/src/app/components/registration/password/password.component.ts
|
TypeScript
|
MethodDeclaration
|
onKeydown(event) {
if (event.key === "Enter") {
this.next();
}
}
|
Masha1996/BrowserBNB
|
app/view/src/app/components/registration/password/password.component.ts
|
TypeScript
|
MethodDeclaration
|
next() {
const password = (document.getElementById('password') as HTMLInputElement).value;
if (!password) {
this.alert.showError('Password must be more than 0 letters', 'Error');
return;
}
this.regSvc.password = password;
this.router.navigate(['/registration/repeat']);
return;
}
|
Masha1996/BrowserBNB
|
app/view/src/app/components/registration/password/password.component.ts
|
TypeScript
|
ClassDeclaration
|
/**
* Action for saving a file to the user's machine.
*/
export class SaveFileAction implements Action {
args: SaveFileArgs;
el: HTMLAnchorElement;
constructor(args: SaveFileArgs) {
this.args = args;
this.el = this.args.el ?? elDownloadLink;
}
/**
* This creates a "file" by converting it into a blob string and setting it on an
* <a> element in the document. It then clicks the link, which brings up a save dialog
* to the user with the blob string as the contents.
*
* NOTE: In order for this to work correctly, this should be handled in an input event
* handler. For example, a "click" event from a button calls this action.
*
* If this isn't called from a "reactive context" (i.e. an event handler) Firefox will
* block the .click() call.
*/
run(): void {
const data = encodeURI(this.args.data);
const mimeType = this.args.mimeType ?? "text/plain";
this.el.href = `data:${mimeType};charset=utf-8,${data}`;
this.el.download = this.args.fileName;
this.el.click();
}
}
|
OpenChartProject/OpenChart-web
|
client/src/actions/ui/saveFile.ts
|
TypeScript
|
InterfaceDeclaration
|
/**
* Arguments for the SaveFileAction.
*/
export interface SaveFileArgs {
data: string;
fileName: string;
el?: HTMLAnchorElement;
mimeType?: string;
}
|
OpenChartProject/OpenChart-web
|
client/src/actions/ui/saveFile.ts
|
TypeScript
|
MethodDeclaration
|
/**
* This creates a "file" by converting it into a blob string and setting it on an
* <a> element in the document. It then clicks the link, which brings up a save dialog
* to the user with the blob string as the contents.
*
* NOTE: In order for this to work correctly, this should be handled in an input event
* handler. For example, a "click" event from a button calls this action.
*
* If this isn't called from a "reactive context" (i.e. an event handler) Firefox will
* block the .click() call.
*/
run(): void {
const data = encodeURI(this.args.data);
const mimeType = this.args.mimeType ?? "text/plain";
this.el.href = `data:${mimeType};charset=utf-8,${data}`;
this.el.download = this.args.fileName;
this.el.click();
}
|
OpenChartProject/OpenChart-web
|
client/src/actions/ui/saveFile.ts
|
TypeScript
|
FunctionDeclaration
|
export declare function updateAndFetchZeroOrOneByCk<TableT extends ITable, DelegateT extends SingleTableSetDelegateFromTable<TableT>>(connection: IConnection, table: TableT & TableUtil.AssertHasCandidateKey<TableT>, ck: CandidateKey<TableT>, delegate: DelegateT): (AssertValidSingleTableSetDelegateFromTable_Hack<TableT, DelegateT, Promise<UpdateAndFetchZeroOrOneResult<TableT, DelegateT>>>);
|
AnyhowStep/typed-orm
|
dist/src/main/v3/update/util/execution/convenience/update-and-fetch-zero-or-one-by-ck.d.ts
|
TypeScript
|
ArrowFunction
|
() => {
const name = getProfileByKey('name');
const email = getProfileByKey('email');
const [currentUser, setCurrentUser] = useState<User>();
const {
register,
handleSubmit,
errors,
formState: { isValid }
} = useForm<User>({
mode: 'onChange'
});
const { findByEmail, user } = useUser();
const { updateNameById, user: userUpdated, status } = useUpdateName();
const [toggleModal, setToggleModal] = useState(false);
useEffect(() => {
if (user) {
setCurrentUser(user);
} else if (email) {
findByEmail(email);
}
}, [user, email, findByEmail]);
useEffect(() => {
if (userUpdated) {
setCurrentUser(userUpdated);
} else if (status === 'rejected') {
findByEmail(email);
}
}, [userUpdated, status, email, findByEmail]);
const onSubmit = (profile: User) => {
setCurrentUser(null);
updateNameById(currentUser.id, profile.name);
};
const renderModal = () =>
toggleModal && (
<Modal.Default onClose={() => setToggleModal(false)}
|
lucassaleszup/charlescd
|
ui/src/modules/Account/index.tsx
|
TypeScript
|
ArrowFunction
|
() => {
if (user) {
setCurrentUser(user);
} else if (email) {
findByEmail(email);
}
}
|
lucassaleszup/charlescd
|
ui/src/modules/Account/index.tsx
|
TypeScript
|
ArrowFunction
|
() => {
if (userUpdated) {
setCurrentUser(userUpdated);
} else if (status === 'rejected') {
findByEmail(email);
}
}
|
lucassaleszup/charlescd
|
ui/src/modules/Account/index.tsx
|
TypeScript
|
ArrowFunction
|
(profile: User) => {
setCurrentUser(null);
updateNameById(currentUser.id, profile.name);
}
|
lucassaleszup/charlescd
|
ui/src/modules/Account/index.tsx
|
TypeScript
|
ArrowFunction
|
() =>
toggleModal && (
<Modal.Default onClose
|
lucassaleszup/charlescd
|
ui/src/modules/Account/index.tsx
|
TypeScript
|
ArrowFunction
|
() => setToggleModal(false)
|
lucassaleszup/charlescd
|
ui/src/modules/Account/index.tsx
|
TypeScript
|
ArrowFunction
|
() => (
<>
{renderModal()}
<Styled.Layer>
<Styled.ContentIcon icon="picture">
<Avatar key
|
lucassaleszup/charlescd
|
ui/src/modules/Account/index.tsx
|
TypeScript
|
ArrowFunction
|
() => (
<Styled.Actions>
<LabeledIcon
icon="account"
|
lucassaleszup/charlescd
|
ui/src/modules/Account/index.tsx
|
TypeScript
|
ArrowFunction
|
() => (
<TabPanel
title="Account"
|
lucassaleszup/charlescd
|
ui/src/modules/Account/index.tsx
|
TypeScript
|
MethodDeclaration
|
renderModal()
|
lucassaleszup/charlescd
|
ui/src/modules/Account/index.tsx
|
TypeScript
|
MethodDeclaration
|
isRoot()
|
lucassaleszup/charlescd
|
ui/src/modules/Account/index.tsx
|
TypeScript
|
MethodDeclaration
|
register({
required: isRequired
|
lucassaleszup/charlescd
|
ui/src/modules/Account/index.tsx
|
TypeScript
|
MethodDeclaration
|
renderTabActions()
|
lucassaleszup/charlescd
|
ui/src/modules/Account/index.tsx
|
TypeScript
|
MethodDeclaration
|
renderContent()
|
lucassaleszup/charlescd
|
ui/src/modules/Account/index.tsx
|
TypeScript
|
MethodDeclaration
|
isEmpty(currentUser)
|
lucassaleszup/charlescd
|
ui/src/modules/Account/index.tsx
|
TypeScript
|
ArrowFunction
|
(text = '') => console.log(`${chalk.bgBlue('[INFO]')} ${chalk.blue(text)}`)
|
mr-kings/tinyimg-scripts
|
src/lib/utils/logger.ts
|
TypeScript
|
ArrowFunction
|
(text = '') => console.log(`${chalk.bgGreen('[SUCCESS]')} ${chalk.green(text)}`)
|
mr-kings/tinyimg-scripts
|
src/lib/utils/logger.ts
|
TypeScript
|
ArrowFunction
|
(text = '') => console.log(`${chalk.bgYellow('[WARN]')} ${chalk.yellow(text)}`)
|
mr-kings/tinyimg-scripts
|
src/lib/utils/logger.ts
|
TypeScript
|
ArrowFunction
|
(text = '') => console.log(`${chalk.bgRed('[ERROR]')} ${chalk.red(text)}`)
|
mr-kings/tinyimg-scripts
|
src/lib/utils/logger.ts
|
TypeScript
|
ArrowFunction
|
(predeterminado:
|
cassio123456/bitcoinevelin
|
src/qt/locale/bitcoin_es.ts
|
TypeScript
|
TypeAliasDeclaration
|
type commands here
|
cassio123456/bitcoinevelin
|
src/qt/locale/bitcoin_es.ts
|
TypeScript
|
ArrowFunction
|
err => {
this.logger.error(err.message);
}
|
GemunIon/nestjs-sqs
|
src/sqs.client.ts
|
TypeScript
|
ArrowFunction
|
() => {
this.routingMap.set(packet.id, callback);
}
|
GemunIon/nestjs-sqs
|
src/sqs.client.ts
|
TypeScript
|
ArrowFunction
|
() => this.routingMap.delete(packet.id)
|
GemunIon/nestjs-sqs
|
src/sqs.client.ts
|
TypeScript
|
ClassDeclaration
|
export class SqsClient extends ClientProxy {
private producer: Producer;
private consumer: Consumer;
private readonly logger = new Logger("SqsService");
constructor(protected readonly options: ISqsClientOptions["options"]) {
super();
this.initializeSerializer(options);
this.initializeDeserializer(options);
}
public createClient(): void {
const { producerUrl, consumerUrl, ...options } = this.options;
this.consumer = Consumer.create({
...options,
queueUrl: consumerUrl,
handleMessage: this.handleMessage.bind(this),
});
this.consumer.on("error", err => {
this.logger.error(err.message);
});
this.consumer.on("processing_error", err => {
this.logger.error(err.message);
});
this.consumer.on("timeout_error", err => {
this.logger.error(err.message);
});
this.consumer.start();
this.producer = Producer.create({
...options,
queueUrl: producerUrl,
});
}
protected publish(partialPacket: ReadPacket, callback: (packet: WritePacket) => any): () => void {
const packet = this.assignPacketId(partialPacket);
const serializedPacket = this.serializer.serialize(packet);
void this.producer.send(serializedPacket).then(() => {
this.routingMap.set(packet.id, callback);
});
return () => this.routingMap.delete(packet.id);
}
protected dispatchEvent(packet: ReadPacket): Promise<any> {
const serializedPacket = this.serializer.serialize(packet);
return this.producer.send(serializedPacket);
}
public connect(): Promise<any> {
this.createClient();
return Promise.resolve();
}
public async handleMessage(message: SQSMessage): Promise<void> {
const { id, response, err, status, isDisposed } = await this.deserializer.deserialize(message);
const callback = this.routingMap.get(id);
if (!callback) {
return undefined;
}
// eslint-disable-next-line node/no-callback-literal
callback({
response,
err,
status,
isDisposed,
});
}
public close(): void {
if (this.consumer) {
this.consumer.stop();
}
}
protected assignPacketId(packet: ReadPacket): ReadPacket & PacketId {
const id = randomStringGenerator();
return Object.assign(packet, { id });
}
protected initializeSerializer(options: ISqsClientOptions["options"]): void {
this.serializer = options?.serializer ?? new SqsSerializer();
}
protected initializeDeserializer(options: ISqsClientOptions["options"]): void {
this.deserializer = options?.deserializer ?? new SqsDeserializer();
}
}
|
GemunIon/nestjs-sqs
|
src/sqs.client.ts
|
TypeScript
|
MethodDeclaration
|
public createClient(): void {
const { producerUrl, consumerUrl, ...options } = this.options;
this.consumer = Consumer.create({
...options,
queueUrl: consumerUrl,
handleMessage: this.handleMessage.bind(this),
});
this.consumer.on("error", err => {
this.logger.error(err.message);
});
this.consumer.on("processing_error", err => {
this.logger.error(err.message);
});
this.consumer.on("timeout_error", err => {
this.logger.error(err.message);
});
this.consumer.start();
this.producer = Producer.create({
...options,
queueUrl: producerUrl,
});
}
|
GemunIon/nestjs-sqs
|
src/sqs.client.ts
|
TypeScript
|
MethodDeclaration
|
protected publish(partialPacket: ReadPacket, callback: (packet: WritePacket) => any): () => void {
const packet = this.assignPacketId(partialPacket);
const serializedPacket = this.serializer.serialize(packet);
void this.producer.send(serializedPacket).then(() => {
this.routingMap.set(packet.id, callback);
});
return () => this.routingMap.delete(packet.id);
}
|
GemunIon/nestjs-sqs
|
src/sqs.client.ts
|
TypeScript
|
MethodDeclaration
|
protected dispatchEvent(packet: ReadPacket): Promise<any> {
const serializedPacket = this.serializer.serialize(packet);
return this.producer.send(serializedPacket);
}
|
GemunIon/nestjs-sqs
|
src/sqs.client.ts
|
TypeScript
|
MethodDeclaration
|
public connect(): Promise<any> {
this.createClient();
return Promise.resolve();
}
|
GemunIon/nestjs-sqs
|
src/sqs.client.ts
|
TypeScript
|
MethodDeclaration
|
public async handleMessage(message: SQSMessage): Promise<void> {
const { id, response, err, status, isDisposed } = await this.deserializer.deserialize(message);
const callback = this.routingMap.get(id);
if (!callback) {
return undefined;
}
// eslint-disable-next-line node/no-callback-literal
callback({
response,
err,
status,
isDisposed,
});
}
|
GemunIon/nestjs-sqs
|
src/sqs.client.ts
|
TypeScript
|
MethodDeclaration
|
public close(): void {
if (this.consumer) {
this.consumer.stop();
}
}
|
GemunIon/nestjs-sqs
|
src/sqs.client.ts
|
TypeScript
|
MethodDeclaration
|
protected assignPacketId(packet: ReadPacket): ReadPacket & PacketId {
const id = randomStringGenerator();
return Object.assign(packet, { id });
}
|
GemunIon/nestjs-sqs
|
src/sqs.client.ts
|
TypeScript
|
MethodDeclaration
|
protected initializeSerializer(options: ISqsClientOptions["options"]): void {
this.serializer = options?.serializer ?? new SqsSerializer();
}
|
GemunIon/nestjs-sqs
|
src/sqs.client.ts
|
TypeScript
|
MethodDeclaration
|
protected initializeDeserializer(options: ISqsClientOptions["options"]): void {
this.deserializer = options?.deserializer ?? new SqsDeserializer();
}
|
GemunIon/nestjs-sqs
|
src/sqs.client.ts
|
TypeScript
|
ClassDeclaration
|
@Component({
selector: 'diagram-exclusive-gateway',
templateUrl: './diagram-exclusive-gateway.component.html'
})
export class DiagramExclusiveGatewayComponent implements OnInit {
@Input()
data: any;
@Output()
error = new EventEmitter();
center: any = {};
width: any;
height: any;
options: any = {stroke: '', fillColors: '', fillOpacity: '', strokeWidth: 3};
constructor(public elementRef: ElementRef,
private diagramColorService: DiagramColorService) {}
ngOnInit() {
this.center.x = this.data.x;
this.center.y = this.data.y;
this.width = this.data.width;
this.height = this.data.height;
this.options.stroke = this.diagramColorService.getBpmnColor(this.data, MAIN_STROKE_COLOR);
this.options.fillColors = this.diagramColorService.getFillColour(this.data.id);
this.options.fillOpacity = this.diagramColorService.getFillOpacity();
}
}
|
silverskyvicto/alfresco-ng2-components
|
lib/insights/src/lib/diagram/components/gateways/diagram-exclusive-gateway.component.ts
|
TypeScript
|
MethodDeclaration
|
ngOnInit() {
this.center.x = this.data.x;
this.center.y = this.data.y;
this.width = this.data.width;
this.height = this.data.height;
this.options.stroke = this.diagramColorService.getBpmnColor(this.data, MAIN_STROKE_COLOR);
this.options.fillColors = this.diagramColorService.getFillColour(this.data.id);
this.options.fillOpacity = this.diagramColorService.getFillOpacity();
}
|
silverskyvicto/alfresco-ng2-components
|
lib/insights/src/lib/diagram/components/gateways/diagram-exclusive-gateway.component.ts
|
TypeScript
|
ArrowFunction
|
() => {
morfeo.setCurrentTheme('default');
}
|
LucaCorcella/morfeo
|
packages/react/tests/useClassName.test.tsx
|
TypeScript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.