type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
|---|---|---|---|---|
ArrowFunction
|
(res) => {
const body = res.body;
assert.deepStrictEqual(body, {
error: 'Only individual PATCH requests are supported',
});
return request(testServer)
.patch(url + '/' + projectId)
.send([{ }])
.expect('Content-Type', /json/)
.expect(httpstatus.BAD_REQUEST);
}
|
OwenG88/taxinomitis
|
src/tests/restapi/projects.ts
|
TypeScript
|
ArrowFunction
|
(res) => {
const body = res.body;
assert.deepStrictEqual(body, {
error: 'Only modifications to project labels are supported',
});
return request(testServer)
.patch(url + '/' + projectId)
.send([{ path : '/labels' }])
.expect('Content-Type', /json/)
.expect(httpstatus.BAD_REQUEST);
}
|
OwenG88/taxinomitis
|
src/tests/restapi/projects.ts
|
TypeScript
|
ArrowFunction
|
(res) => {
const body = res.body;
assert.deepStrictEqual(body, {
error: 'PATCH requests must include an op',
});
return request(testServer)
.patch(url + '/' + projectId)
.send([{ path : '/labels', op : 'INVALID', value : [ 'BAD' ] }])
.expect('Content-Type', /json/)
.expect(httpstatus.BAD_REQUEST);
}
|
OwenG88/taxinomitis
|
src/tests/restapi/projects.ts
|
TypeScript
|
ArrowFunction
|
(res) => {
const body = res.body;
assert.deepStrictEqual(body, {
error: 'Invalid PATCH op',
});
return request(testServer)
.patch(url + '/' + projectId)
.send([{ path : '/labels', op : 'add' }])
.expect('Content-Type', /json/)
.expect(httpstatus.BAD_REQUEST);
}
|
OwenG88/taxinomitis
|
src/tests/restapi/projects.ts
|
TypeScript
|
ArrowFunction
|
(res) => {
const body = res.body;
assert.deepStrictEqual(body, {
error: 'PATCH requests must include a value',
});
return request(testServer)
.patch(url + '/' + projectId)
.send([{ path : '/labels', op : 'add', value : [ 'BAD' ] }])
.expect('Content-Type', /json/)
.expect(httpstatus.BAD_REQUEST);
}
|
OwenG88/taxinomitis
|
src/tests/restapi/projects.ts
|
TypeScript
|
ArrowFunction
|
(res) => {
const body = res.body;
assert.deepStrictEqual(body, {
error: 'PATCH requests to add or remove a label should specify a string',
});
return request(testServer)
.patch(url + '/' + projectId)
.send([{ path : '/labels', op : 'add', value : ' ' }])
.expect('Content-Type', /json/)
.expect(httpstatus.BAD_REQUEST);
}
|
OwenG88/taxinomitis
|
src/tests/restapi/projects.ts
|
TypeScript
|
ArrowFunction
|
(res) => {
const body = res.body;
assert.deepStrictEqual(body, {
error: 'Cannot add an empty label',
});
return request(testServer)
.patch(url + '/' + projectId)
.send([{
path : '/labels', op : 'add',
value : randomstring.generate({ length : 100 }),
}])
.expect('Content-Type', /json/)
.expect(httpstatus.BAD_REQUEST);
}
|
OwenG88/taxinomitis
|
src/tests/restapi/projects.ts
|
TypeScript
|
ArrowFunction
|
(res) => {
const body = res.body;
assert.deepStrictEqual(body, {
error: 'Label exceeds max length',
});
return request(testServer)
.patch(url + '/' + projectId)
.send([{
path : '/labels', op : 'replace',
value : 'should be an array',
}])
.expect('Content-Type', /json/)
.expect(httpstatus.BAD_REQUEST);
}
|
OwenG88/taxinomitis
|
src/tests/restapi/projects.ts
|
TypeScript
|
ArrowFunction
|
(res) => {
const body = res.body;
assert.deepStrictEqual(body, {
error: 'PATCH requests to replace labels should specify an array',
});
return request(testServer)
.patch(url + '/' + projectId)
.send([{
path : '/labels', op : 'replace',
value : [ 'test', randomstring.generate({ length : 100 }) ],
}])
.expect('Content-Type', /json/)
.expect(httpstatus.BAD_REQUEST);
}
|
OwenG88/taxinomitis
|
src/tests/restapi/projects.ts
|
TypeScript
|
ArrowFunction
|
(res) => {
const body = res.body;
assert.deepStrictEqual(body, {
error: 'Label exceeds max length',
});
return request(testServer)
.patch('/api/classes/' + TESTCLASS + '/students/' + 'different' + '/projects' + '/' + projectId)
.send([{
path : '/labels', op : 'add',
value : 'newlabel',
}])
.expect('Content-Type', /json/)
.expect(httpstatus.FORBIDDEN);
}
|
OwenG88/taxinomitis
|
src/tests/restapi/projects.ts
|
TypeScript
|
ArrowFunction
|
(_tab, index) => index > this.maxNumberOfTabs - 2
|
JoseCamilo/po-angular
|
projects/ui/src/lib/components/po-tabs/po-tabs.component.ts
|
TypeScript
|
ArrowFunction
|
tab => !tab.hide
|
JoseCamilo/po-angular
|
projects/ui/src/lib/components/po-tabs/po-tabs.component.ts
|
TypeScript
|
ArrowFunction
|
visibleTab => visibleTab.id === tab.id
|
JoseCamilo/po-angular
|
projects/ui/src/lib/components/po-tabs/po-tabs.component.ts
|
TypeScript
|
ArrowFunction
|
tabChild => tabChild.active && tabChild.id !== tab.id
|
JoseCamilo/po-angular
|
projects/ui/src/lib/components/po-tabs/po-tabs.component.ts
|
TypeScript
|
ArrowFunction
|
tabChild => {
if (!tabChild.disabled && !tabChild.hide) {
tabChild.active = true;
return true;
}
}
|
JoseCamilo/po-angular
|
projects/ui/src/lib/components/po-tabs/po-tabs.component.ts
|
TypeScript
|
ClassDeclaration
|
/**
* @docsExtends PoTabsBaseComponent
*
* @example
*
* <example name="po-tabs-basic" title="PO Tabs Basic">
* <file name="sample-po-tabs-basic/sample-po-tabs-basic.component.html"> </file>
* <file name="sample-po-tabs-basic/sample-po-tabs-basic.component.ts"> </file>
* </example>
*
* <example name="po-tabs-labs" title="PO Tabs Labs">
* <file name="sample-po-tabs-labs/sample-po-tabs-labs.component.html"> </file>
* <file name="sample-po-tabs-labs/sample-po-tabs-labs.component.ts"> </file>
* </example>
*
* <example name="po-tabs-travel" title="PO Tabs - Travel">
* <file name="sample-po-tabs-travel/sample-po-tabs-travel.component.html"> </file>
* <file name="sample-po-tabs-travel/sample-po-tabs-travel.component.ts"> </file>
* </example>
*
* <example name="po-tabs-business-conf" title="PO Tabs - Business Conference">
* <file name="sample-po-tabs-business-conf/sample-po-tabs-business-conf.component.html"> </file>
* <file name="sample-po-tabs-business-conf/sample-po-tabs-business-conf.component.ts"> </file>
* </example>
*/
@Component({
selector: 'po-tabs',
templateUrl: './po-tabs.component.html'
})
export class PoTabsComponent extends PoTabsBaseComponent {
maxNumberOfTabs = poTabsMaxNumberOfTabs;
private previousActiveTab: PoTabComponent;
// Tabs utilizados no ng-content
@ContentChildren(PoTabComponent) tabs: QueryList<PoTabComponent>;
@ViewChild('tabDropdown', { static: true }) tabDropdown: PoTabDropdownComponent;
constructor(private changeDetector: ChangeDetectorRef) {
super();
}
get isMobileDevice() {
return isMobile();
}
get isShowTabDropdown() {
return !this.isMobileDevice && this.visibleTabs.length > this.maxNumberOfTabs;
}
// tabs que serão apresentadas na aba "Mais"
get overflowedTabs() {
return this.visibleTabs.filter((_tab, index) => index > this.maxNumberOfTabs - 2);
}
get visibleTabs() {
return this.tabs.filter(tab => !tab.hide);
}
closePopover(): void {
const containsPopoverVisible = this.tabDropdown && this.tabDropdown.popover && !this.tabDropdown.popover.isHidden;
if (containsPopoverVisible) {
this.tabDropdown.popover.close();
}
}
isVisibleTab(tab) {
if (this.isMobileDevice) {
return true;
}
const visibleTabIndex = this.visibleTabs.findIndex(visibleTab => visibleTab.id === tab.id);
return this.visibleTabs.length <= this.maxNumberOfTabs || visibleTabIndex < this.maxNumberOfTabs - 1;
}
// Função disparada quando alguma tab ficar ativa
onTabActive(tab) {
this.previousActiveTab = this.tabs.find(tabChild => tabChild.active && tabChild.id !== tab.id);
this.deactivateTab();
}
// funcao será disparada quando mudar o estado do poTab para desabilitado ou escondido.
onTabChangeState(tab: PoTabComponent) {
if (tab.active) {
tab.active = false;
this.activeDistinctTab();
this.changeDetector.detectChanges();
}
}
// selectiona a aba informada por parametro, caso houver click faz a emição do evento.
selectedTab(tab: PoTabComponent) {
tab.active = true;
if (tab.click) {
tab.click.emit(tab);
}
this.changeDetector.detectChanges();
}
trackByFn(_i, tab: PoTabComponent) {
return tab.id;
}
// ativa a previousActiveTab ou primeira tab encontrada.
private activeDistinctTab() {
if (this.previousActiveTab) {
this.previousActiveTab.active = true;
} else {
this.activeFirstTab();
}
}
// Ativa a primeira Tab que não estiver desabilitada ou escondida.
private activeFirstTab() {
this.tabs.some(tabChild => {
if (!tabChild.disabled && !tabChild.hide) {
tabChild.active = true;
return true;
}
});
}
// desativa previousActiveTab e dispara a detecção de mudança.
private deactivateTab() {
if (this.previousActiveTab) {
this.previousActiveTab.active = false;
this.changeDetector.detectChanges();
}
}
}
|
JoseCamilo/po-angular
|
projects/ui/src/lib/components/po-tabs/po-tabs.component.ts
|
TypeScript
|
MethodDeclaration
|
closePopover(): void {
const containsPopoverVisible = this.tabDropdown && this.tabDropdown.popover && !this.tabDropdown.popover.isHidden;
if (containsPopoverVisible) {
this.tabDropdown.popover.close();
}
}
|
JoseCamilo/po-angular
|
projects/ui/src/lib/components/po-tabs/po-tabs.component.ts
|
TypeScript
|
MethodDeclaration
|
isVisibleTab(tab) {
if (this.isMobileDevice) {
return true;
}
const visibleTabIndex = this.visibleTabs.findIndex(visibleTab => visibleTab.id === tab.id);
return this.visibleTabs.length <= this.maxNumberOfTabs || visibleTabIndex < this.maxNumberOfTabs - 1;
}
|
JoseCamilo/po-angular
|
projects/ui/src/lib/components/po-tabs/po-tabs.component.ts
|
TypeScript
|
MethodDeclaration
|
// Função disparada quando alguma tab ficar ativa
onTabActive(tab) {
this.previousActiveTab = this.tabs.find(tabChild => tabChild.active && tabChild.id !== tab.id);
this.deactivateTab();
}
|
JoseCamilo/po-angular
|
projects/ui/src/lib/components/po-tabs/po-tabs.component.ts
|
TypeScript
|
MethodDeclaration
|
// funcao será disparada quando mudar o estado do poTab para desabilitado ou escondido.
onTabChangeState(tab: PoTabComponent) {
if (tab.active) {
tab.active = false;
this.activeDistinctTab();
this.changeDetector.detectChanges();
}
}
|
JoseCamilo/po-angular
|
projects/ui/src/lib/components/po-tabs/po-tabs.component.ts
|
TypeScript
|
MethodDeclaration
|
// selectiona a aba informada por parametro, caso houver click faz a emição do evento.
selectedTab(tab: PoTabComponent) {
tab.active = true;
if (tab.click) {
tab.click.emit(tab);
}
this.changeDetector.detectChanges();
}
|
JoseCamilo/po-angular
|
projects/ui/src/lib/components/po-tabs/po-tabs.component.ts
|
TypeScript
|
MethodDeclaration
|
trackByFn(_i, tab: PoTabComponent) {
return tab.id;
}
|
JoseCamilo/po-angular
|
projects/ui/src/lib/components/po-tabs/po-tabs.component.ts
|
TypeScript
|
MethodDeclaration
|
// ativa a previousActiveTab ou primeira tab encontrada.
private activeDistinctTab() {
if (this.previousActiveTab) {
this.previousActiveTab.active = true;
} else {
this.activeFirstTab();
}
}
|
JoseCamilo/po-angular
|
projects/ui/src/lib/components/po-tabs/po-tabs.component.ts
|
TypeScript
|
MethodDeclaration
|
// Ativa a primeira Tab que não estiver desabilitada ou escondida.
private activeFirstTab() {
this.tabs.some(tabChild => {
if (!tabChild.disabled && !tabChild.hide) {
tabChild.active = true;
return true;
}
});
}
|
JoseCamilo/po-angular
|
projects/ui/src/lib/components/po-tabs/po-tabs.component.ts
|
TypeScript
|
MethodDeclaration
|
// desativa previousActiveTab e dispara a detecção de mudança.
private deactivateTab() {
if (this.previousActiveTab) {
this.previousActiveTab.active = false;
this.changeDetector.detectChanges();
}
}
|
JoseCamilo/po-angular
|
projects/ui/src/lib/components/po-tabs/po-tabs.component.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface UserDocument extends Document {
_id: string;
badges: DevBadge[];
banned: boolean;
lastVotedAt: Date;
premium: boolean;
role: UserRole;
}
|
DaKing01/staff-signin
|
data/models/user.ts
|
TypeScript
|
EnumDeclaration
|
export enum DevBadge {
BetaTester = 'BETA_TESTER',
OG = 'OG',
Viewer = 'VIEWER'
}
|
DaKing01/staff-signin
|
data/models/user.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type UserRole = '' | 'reviewer' | 'admin';
|
DaKing01/staff-signin
|
data/models/user.ts
|
TypeScript
|
FunctionDeclaration
|
// Get or create chat
export function findOrCreateChat(id: number) {
return ChatModel.findOneAndUpdate(
{ id },
{},
{
upsert: true,
new: true,
}
)
}
|
Moldoteck/ToxModNew
|
src/models/Chat.ts
|
TypeScript
|
FunctionDeclaration
|
export async function findOnlyChat(id: number) {
return await ChatModel.findOne({ id })
}
|
Moldoteck/ToxModNew
|
src/models/Chat.ts
|
TypeScript
|
FunctionDeclaration
|
export async function findAllChats() {
return await ChatModel.find({})
}
|
Moldoteck/ToxModNew
|
src/models/Chat.ts
|
TypeScript
|
FunctionDeclaration
|
export async function countChats() {
return await ChatModel.countDocuments({})
}
|
Moldoteck/ToxModNew
|
src/models/Chat.ts
|
TypeScript
|
ClassDeclaration
|
@modelOptions({ schemaOptions: { timestamps: true } })
export class Chat {
@prop({ required: true, index: true, unique: true })
id!: number
@prop({ required: true, default: 'en' })
language!: string
@prop({ required: true, default: 0.65 })
toxic_thresh!: number
@prop({ required: true, default: 0.7 })
profan_thresh!: number
@prop({ required: true, default: 0.7 })
identity_thresh!: number
@prop({ required: true, default: 0.6 })
insult_thresh!: number
@prop({ required: false, default: [] })
moderators!: Array<number>
@prop({ required: true, default: true })
interactive!: boolean
@prop({ required: true, default: {} })
triggers!: { [key: string]: number }
@prop({ required: true, default: {} })
ignored_triggers!: { [key: string]: number }
}
|
Moldoteck/ToxModNew
|
src/models/Chat.ts
|
TypeScript
|
ArrowFunction
|
() => {
return {
...extra,
error: 'PermissionsError',
message,
type: permissionErrorType
}
}
|
ConsueloHerrera/orionjs
|
packages/helpers/src/Errors/PermissionsError.ts
|
TypeScript
|
ClassDeclaration
|
export default class PermissionsError extends OrionError {
constructor(permissionErrorType, extra: any = {}) {
// Calling parent constructor of base Error class.
const message =
extra.message || `Client is not allowed to perform this action [${permissionErrorType}]`
super(message)
Error.captureStackTrace(this, this.constructor)
this.isOrionError = true
this.isPermissionsError = true
this.code = 'PermissionsError'
this.extra = extra
this.getInfo = () => {
return {
...extra,
error: 'PermissionsError',
message,
type: permissionErrorType
}
}
}
}
|
ConsueloHerrera/orionjs
|
packages/helpers/src/Errors/PermissionsError.ts
|
TypeScript
|
ArrowFunction
|
(props)=> {
const {result, bemBlocks} = props
return (
<div className={bemBlocks.item().mix(bemBlocks.container("item"))}>
{result._source.name}
</div>
|
gustavoquinalha/searchkit
|
test/e2e/server/apps/taxonomy-app/index.tsx
|
TypeScript
|
ClassDeclaration
|
export class App extends React.Component<any, any> {
searchkit:SearchkitManager
constructor() {
super()
const host = "http://demo.searchkit.co/api/taxonomy"
this.searchkit = new SearchkitManager(host)
}
render(){ return (
<div>
<SearchkitProvider searchkit={this.searchkit}>
<div className="sk-layout">
<div className="sk-layout__top-bar sk-top-bar">
<div className="sk-top-bar__content">
<div className="my-logo">Searchkit Acme co</div>
<SearchBox
translations={{"searchbox.placeholder":"search regions"}}
queryOptions={
|
gustavoquinalha/searchkit
|
test/e2e/server/apps/taxonomy-app/index.tsx
|
TypeScript
|
MethodDeclaration
|
render(){ return (
<div>
<SearchkitProvider searchkit={this.searchkit}>
<div className="sk-layout">
<div className="sk-layout__top-bar sk-top-bar">
<div className="sk-top-bar__content">
<div className="my-logo">Searchkit Acme co</div>
<SearchBox
translations={{"searchbox.placeholder":"search regions"}}
|
gustavoquinalha/searchkit
|
test/e2e/server/apps/taxonomy-app/index.tsx
|
TypeScript
|
FunctionDeclaration
|
export function scrollStrategyFactory(
overlay: Overlay
): RepositionScrollStrategy {
return overlay.scrollStrategies.reposition();
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
ArrowFunction
|
() => {
this.onViewExtentReset.emit();
this.state = InteractionState.NONE;
this.changeDetector.markForCheck();
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
ArrowFunction
|
(event) => {
const newState = this.shouldPan(event);
if (newState !== this.specialKeyPressed) {
this.specialKeyPressed = newState;
this.changeDetector.markForCheck();
}
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
ArrowFunction
|
(event) => {
const prevState = this.state;
const nextState = this.shouldPan(event)
? InteractionState.PANNING
: InteractionState.DRAG_ZOOMING;
// Override the dragStartCoord and zoomBox only when started to zoom.
// For instance, if you press left button then right, drag zoom should start at
// the left button down so the second mousedown is ignored.
if (
prevState === InteractionState.NONE &&
nextState === InteractionState.DRAG_ZOOMING
) {
this.dragStartCoord = {x: event.offsetX, y: event.offsetY};
this.zoomBoxInUiCoordinate = {
x: event.offsetX,
width: 0,
y: event.offsetY,
height: 0,
};
}
if (prevState !== nextState) {
this.state = nextState;
this.changeDetector.markForCheck();
}
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
ArrowFunction
|
(event) => {
const leftClicked =
(event.buttons & MouseEventButtons.LEFT) === MouseEventButtons.LEFT;
this.dragStartCoord = null;
const zoomBox = this.zoomBoxInUiCoordinate;
if (
!leftClicked &&
this.state === InteractionState.DRAG_ZOOMING &&
zoomBox.width > 0 &&
zoomBox.height > 0
) {
const xMin = this.getDataX(zoomBox.x);
const xMax = this.getDataX(zoomBox.x + zoomBox.width);
const yMin = this.getDataY(zoomBox.y + zoomBox.height);
const yMax = this.getDataY(zoomBox.y);
this.onViewExtentChange.emit({
dataExtent: {
x: [xMin, xMax],
y: [yMin, yMax],
},
});
}
if (this.state !== InteractionState.NONE) {
this.state = InteractionState.NONE;
this.changeDetector.markForCheck();
}
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
ArrowFunction
|
(event) => {
this.isCursorInside = true;
this.updateTooltip(event);
this.changeDetector.markForCheck();
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
ArrowFunction
|
(event) => {
this.dragStartCoord = null;
this.isCursorInside = false;
this.updateTooltip(event);
this.state = InteractionState.NONE;
this.changeDetector.markForCheck();
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
ArrowFunction
|
(event) => {
switch (this.state) {
case InteractionState.SCROLL_ZOOMING: {
this.state = InteractionState.NONE;
this.updateTooltip(event);
this.changeDetector.markForCheck();
break;
}
case InteractionState.NONE:
this.updateTooltip(event);
this.changeDetector.markForCheck();
break;
case InteractionState.PANNING: {
const deltaX = -event.movementX;
const deltaY = -event.movementY;
const {width: domWidth, height: domHeight} = this.domDim;
const xMin = this.getDataX(deltaX);
const xMax = this.getDataX(domWidth + deltaX);
const yMin = this.getDataY(domHeight + deltaY);
const yMax = this.getDataY(deltaY);
this.onViewExtentChange.emit({
dataExtent: {
x: [xMin, xMax],
y: [yMin, yMax],
},
});
break;
}
case InteractionState.DRAG_ZOOMING:
{
if (!this.dragStartCoord) {
break;
}
const xs = [this.dragStartCoord.x, event.offsetX];
const ys = [this.dragStartCoord.y, event.offsetY];
this.zoomBoxInUiCoordinate = {
x: Math.min(...xs),
width: Math.max(...xs) - Math.min(...xs),
y: Math.min(...ys),
height: Math.max(...ys) - Math.min(...ys),
};
}
this.changeDetector.markForCheck();
break;
}
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
ArrowFunction
|
(event: WheelEvent) => {
const shouldZoom = !event.ctrlKey && !event.shiftKey && event.altKey;
this.showZoomInstruction = !shouldZoom;
this.changeDetector.markForCheck();
if (shouldZoom) {
event.preventDefault();
return of(event);
}
return timer(3000).pipe(
tap(() => {
this.showZoomInstruction = false;
this.changeDetector.markForCheck();
}),
map(() => null)
);
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
ArrowFunction
|
() => {
this.showZoomInstruction = false;
this.changeDetector.markForCheck();
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
ArrowFunction
|
(eventOrNull) => Boolean(eventOrNull)
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
ArrowFunction
|
(eventOrNull) => {
const event = eventOrNull!;
this.onViewExtentChange.emit({
dataExtent: getProposedViewExtentOnZoom(
event,
this.viewExtent,
this.domDim,
SCROLL_ZOOM_SPEED_FACTOR,
this.xScale,
this.yScale
),
});
if (this.state !== InteractionState.SCROLL_ZOOMING) {
this.state = InteractionState.SCROLL_ZOOMING;
this.changeDetector.markForCheck();
}
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
ArrowFunction
|
(seriesDatum) => {
return {
seriesDatum: seriesDatum,
metadata: this.seriesMetadataMap[seriesDatum.id],
};
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
ArrowFunction
|
({metadata}) => {
return metadata && metadata.visible && !Boolean(metadata.aux);
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
ArrowFunction
|
({seriesDatum, metadata}) => {
const index = findClosestIndex(seriesDatum.points, cursorLoc.x);
return {
id: seriesDatum.id,
closestPointIndex: index,
point: seriesDatum.points[index],
metadata,
};
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
ArrowFunction
|
(tooltipDatumOrNull) => tooltipDatumOrNull
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface TooltipDatum<
Metadata extends DataSeriesMetadata = DataSeriesMetadata,
PointDatum extends Point = Point
> {
id: string;
metadata: Metadata;
closestPointIndex: number;
point: PointDatum;
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
InterfaceDeclaration
|
export interface TooltipTemplateContext {
cursorLocationInDataCoord: {x: number; y: number};
data: TooltipDatum[];
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
EnumDeclaration
|
enum InteractionState {
NONE,
DRAG_ZOOMING,
SCROLL_ZOOMING,
PANNING,
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type TooltipTemplate = TemplateRef<TooltipTemplateContext>;
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
MethodDeclaration
|
ngOnChanges() {
this.updateCursoredDataAndTooltipVisibility();
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
MethodDeclaration
|
ngOnDestroy() {
this.ngUnsubscribe.next();
this.ngUnsubscribe.complete();
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
MethodDeclaration
|
private shouldPan(event: MouseEvent | KeyboardEvent): boolean {
const specialKeyEngaged = event.shiftKey || event.altKey;
if (event instanceof KeyboardEvent) {
return specialKeyEngaged;
}
const leftClicked =
(event.buttons & MouseEventButtons.LEFT) === MouseEventButtons.LEFT;
const middleClicked =
(event.buttons & MouseEventButtons.MIDDLE) === MouseEventButtons.MIDDLE;
// Ignore right/forward/back clicks.
if (!leftClicked && !middleClicked) return false;
// At this point, either left or middle is clicked, but if both are clicked, left
// takes precedence.
return (middleClicked && !leftClicked) || specialKeyEngaged;
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
MethodDeclaration
|
trackBySeriesName(index: number, datum: TooltipDatum) {
return datum.id;
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
MethodDeclaration
|
getDomX(uiCoord: number): number {
return this.xScale.forward(
this.viewExtent.x,
getScaleRangeFromDomDim(this.domDim, 'x'),
uiCoord
);
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
MethodDeclaration
|
private getDataX(uiCoord: number): number {
return this.xScale.reverse(
this.viewExtent.x,
getScaleRangeFromDomDim(this.domDim, 'x'),
uiCoord
);
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
MethodDeclaration
|
getDomY(uiCoord: number): number {
return this.yScale.forward(
this.viewExtent.y,
getScaleRangeFromDomDim(this.domDim, 'y'),
uiCoord
);
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
MethodDeclaration
|
private getDataY(uiCoord: number): number {
return this.yScale.reverse(
this.viewExtent.y,
getScaleRangeFromDomDim(this.domDim, 'y'),
uiCoord
);
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
MethodDeclaration
|
shouldRenderTooltipPoint(point: Point | null): boolean {
return point !== null && !isNaN(point.x) && !isNaN(point.y);
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
MethodDeclaration
|
private updateTooltip(event: MouseEvent) {
this.cursorLocationInDataCoord = {
x: this.getDataX(event.offsetX),
y: this.getDataY(event.offsetY),
};
this.updateCursoredDataAndTooltipVisibility();
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
MethodDeclaration
|
onTooltipDisplayDetached() {
this.tooltipDisplayAttached = false;
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
MethodDeclaration
|
private updateCursoredDataAndTooltipVisibility() {
const cursorLoc = this.cursorLocationInDataCoord;
if (cursorLoc === null) {
this.cursoredData = [];
this.tooltipDisplayAttached = false;
return;
}
this.cursoredData = this.isCursorInside
? (this.seriesData
.map((seriesDatum) => {
return {
seriesDatum: seriesDatum,
metadata: this.seriesMetadataMap[seriesDatum.id],
};
})
.filter(({metadata}) => {
return metadata && metadata.visible && !Boolean(metadata.aux);
})
.map(({seriesDatum, metadata}) => {
const index = findClosestIndex(seriesDatum.points, cursorLoc.x);
return {
id: seriesDatum.id,
closestPointIndex: index,
point: seriesDatum.points[index],
metadata,
};
})
.filter((tooltipDatumOrNull) => tooltipDatumOrNull) as TooltipDatum[])
: [];
this.tooltipDisplayAttached = Boolean(this.cursoredData.length);
}
|
GeorgePearse/tensorboard
|
tensorboard/webapp/widgets/line_chart_v2/sub_view/line_chart_interactive_view.ts
|
TypeScript
|
ArrowFunction
|
(acc, [stateStr, priority]) => {
const state = Number(stateStr) as TestRunState;
acc[state] = { statusNode: true, state, priority };
return acc;
}
|
alexlarbi/vscode
|
src/vs/workbench/contrib/testing/browser/testExplorerTree.ts
|
TypeScript
|
ArrowFunction
|
(a: TestRunState, b: TestRunState) => statePriority[b] - statePriority[a]
|
alexlarbi/vscode
|
src/vs/workbench/contrib/testing/browser/testExplorerTree.ts
|
TypeScript
|
ArrowFunction
|
(a: TestRunState, b: TestRunState) => statePriority[a] > statePriority[b] ? a : b
|
alexlarbi/vscode
|
src/vs/workbench/contrib/testing/browser/testExplorerTree.ts
|
TypeScript
|
ArrowFunction
|
s => Number(s) as TestRunState
|
alexlarbi/vscode
|
src/vs/workbench/contrib/testing/browser/testExplorerTree.ts
|
TypeScript
|
TypeAliasDeclaration
|
export type TreeStateNode = { statusNode: true; state: TestRunState; priority: number };
|
alexlarbi/vscode
|
src/vs/workbench/contrib/testing/browser/testExplorerTree.ts
|
TypeScript
|
FunctionDeclaration
|
function renderViewTree(container: HTMLElement): HTMLElement {
const treeContainer = document.createElement('div');
dom.addClass(treeContainer, 'debug-view-content');
container.appendChild(treeContainer);
return treeContainer;
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
(ariaLabel: string) => {
return <tree.ITreeOptions> {
indentPixels: 8,
twistiePixels: 20,
ariaLabel
};
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
() => this.onFocusedStackFrameUpdated()
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
() => {
collapseAction.enabled = this.debugService.getState() === debug.State.Running || this.debugService.getState() === debug.State.Stopped;
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
() => {
const stackFrame = this.debugService.getViewModel().getFocusedStackFrame();
if (stackFrame) {
return stackFrame.getScopes(this.debugService).then(scopes => {
if (scopes.length > 0) {
return this.tree.expand(scopes[0]);
}
});
}
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
scopes => {
if (scopes.length > 0) {
return this.tree.expand(scopes[0]);
}
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
(we) => {
// only expand when a new watch expression is added.
if (we instanceof model.Expression) {
this.expand();
}
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
(we: model.Expression) => this.onWatchExpressionsUpdated(we)
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
(expression: debug.IExpression) => {
if (!expression || !(expression instanceof model.Expression)) {
return;
}
this.tree.refresh(expression, false).then(() => {
this.tree.setHighlight(expression);
const unbind = this.tree.addListener(events.EventType.HIGHLIGHT, (e: tree.IHighlightEvent) => {
if (!e.highlight) {
this.debugService.getViewModel().setSelectedExpression(null);
this.tree.refresh(expression).done(null, errors.onUnexpectedError);
unbind();
}
});
}).done(null, errors.onUnexpectedError);
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
() => {
this.tree.setHighlight(expression);
const unbind = this.tree.addListener(events.EventType.HIGHLIGHT, (e: tree.IHighlightEvent) => {
if (!e.highlight) {
this.debugService.getViewModel().setSelectedExpression(null);
this.tree.refresh(expression).done(null, errors.onUnexpectedError);
unbind();
}
});
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
(e: tree.IHighlightEvent) => {
if (!e.highlight) {
this.debugService.getViewModel().setSelectedExpression(null);
this.tree.refresh(expression).done(null, errors.onUnexpectedError);
unbind();
}
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
() => {
return we instanceof model.Expression ? this.tree.reveal(we): TPromise.as(true);
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
(e: tree.ISelectionEvent) => {
if (!e.selection.length) {
return;
}
const element = e.selection[0];
if (!(element instanceof model.StackFrame)) {
return;
}
const stackFrame = <debug.IStackFrame> element;
this.debugService.setFocusedStackFrameAndEvaluate(stackFrame);
const isMouse = (e.payload.origin === 'mouse');
let preserveFocus = isMouse;
const originalEvent:KeyboardEvent|MouseEvent = e && e.payload && e.payload.originalEvent;
if (originalEvent && isMouse && originalEvent.detail === 2) {
preserveFocus = false;
originalEvent.preventDefault(); // focus moves to editor, we need to prevent default
}
const sideBySide = (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey));
this.debugService.openOrRevealEditor(stackFrame.source, stackFrame.lineNumber, preserveFocus, sideBySide).done(null, errors.onUnexpectedError);
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
() => {
this.tree.refresh().done(null, errors.onUnexpectedError);
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
() => {
const focussedThread = this.debugService.getModel().getThreads()[this.debugService.getViewModel().getFocusedThreadId()];
const previouslyHidden = this.messageBox.hidden;
if (focussedThread && focussedThread.stoppedReason && focussedThread.stoppedReason !== 'step') {
this.messageBox.textContent = nls.localize('debugStopped', "Paused on {0}.", focussedThread.stoppedReason);
focussedThread.stoppedReason === 'exception' ? this.messageBox.classList.add('exception') : this.messageBox.classList.remove('exception');
this.messageBox.hidden = false;
} else {
this.messageBox.hidden = true;
}
if (previouslyHidden !== this.messageBox.hidden) {
this.layoutBody(this.fullSize);
}
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
() => {
const focused = this.debugService.getViewModel().getFocusedStackFrame();
if (focused) {
const threads = this.debugService.getModel().getThreads();
for (let ref in threads) {
if (threads[ref].callStack.some(sf => sf === focused)) {
this.tree.expand(threads[ref]);
}
}
this.tree.setFocus(focused);
}
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
sf => sf === focused
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
() => this.onBreakpointsChange()
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
(e: tree.ISelectionEvent) => {
if (!e.selection.length) {
return;
}
const element = e.selection[0];
if (!(element instanceof model.Breakpoint)) {
return;
}
const breakpoint = <debug.IBreakpoint> element;
if (!breakpoint.source.inMemory) {
const isMouse = (e.payload.origin === 'mouse');
let preserveFocus = isMouse;
const originalEvent:KeyboardEvent|MouseEvent = e && e.payload && e.payload.originalEvent;
if (originalEvent && isMouse && originalEvent.detail === 2) {
preserveFocus = false;
originalEvent.preventDefault(); // focus moves to editor, we need to prevent default
}
const sideBySide = (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey));
this.debugService.openOrRevealEditor(breakpoint.source, breakpoint.lineNumber, preserveFocus, sideBySide).done(null, errors.onUnexpectedError);
}
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
() => {
this.onDebugServiceStateChange();
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
v => this.splitView.addView(<any> v)
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
() => {
return Promise.join(this.views.map((view) => view.setVisible(visible)));
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
(view) => view.setVisible(visible)
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
a => {
this.toDispose.push(a);
}
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
ArrowFunction
|
v => v.shutdown()
|
07026657836/vscode
|
src/vs/workbench/parts/debug/browser/debugViewlet.ts
|
TypeScript
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.