type
stringclasses 7
values | content
stringlengths 4
9.55k
| repo
stringlengths 7
96
| path
stringlengths 4
178
| language
stringclasses 1
value |
---|---|---|---|---|
MethodDeclaration |
findByStatus(status: string) {
return this.emailList.filter((email) => email.status == status);
} | tharkana/node-email-api | src/model/emailModel.ts | TypeScript |
MethodDeclaration |
update(data: Email) {
if (data && data.uid) {
const email = this.findOne(data.uid);
if (email) {
const index = this.emailList.indexOf(email);
this.emailList[index].body = data.body || email.body;
this.emailList[index].to = data.to || email.to;
this.emailList[index].subject = data.subject || email.subject;
this.emailList[index].status = data.status || email.status;
this.emailList[index].modifiedDate = moment.now()
return this.emailList[index];
} else {
throw new Error("record not found");
}
} else {
throw new Error('Should Provide uid in Email object');
}
} | tharkana/node-email-api | src/model/emailModel.ts | TypeScript |
MethodDeclaration |
delete(id: string) {
const email = this.findOne(id);
if (email) {
const index = this.emailList.indexOf(email);
this.emailList.splice(index, 1);
return email;
} else {
return undefined;
}
} | tharkana/node-email-api | src/model/emailModel.ts | TypeScript |
ArrowFunction |
() => {
const form = attach(createForm())
const field = attach(
form.createVoidField({
name: 'void',
})
)
field.destroy()
} | 10088/formily | packages/core/src/__tests__/void.spec.ts | TypeScript |
ArrowFunction |
() => {
const form = attach(createForm())
const field1 = attach(
form.createVoidField({
name: 'field1',
title: 'Field 1',
description: 'This is Field 1',
})
)
expect(field1.title).toEqual('Field 1')
expect(field1.description).toEqual('This is Field 1')
const field2 = attach(
form.createVoidField({
name: 'field2',
disabled: true,
hidden: true,
})
)
expect(field2.pattern).toEqual('disabled')
expect(field2.disabled).toBeTruthy()
expect(field2.display).toEqual('hidden')
expect(field2.hidden).toBeTruthy()
const field3 = attach(
form.createVoidField({
name: 'field3',
readOnly: true,
visible: false,
})
)
expect(field3.pattern).toEqual('readOnly')
expect(field3.readOnly).toBeTruthy()
expect(field3.display).toEqual('none')
expect(field3.visible).toBeFalsy()
} | 10088/formily | packages/core/src/__tests__/void.spec.ts | TypeScript |
ArrowFunction |
() => {
const form = attach(createForm())
const field = attach(
form.createVoidField({
name: 'aa',
})
)
const component = () => null
field.setComponent(component, { props: 123 })
expect(field.component[0]).toEqual(component)
expect(field.component[1]).toEqual({ props: 123 })
field.setComponentProps({
hello: 'world',
})
expect(field.component[1]).toEqual({ props: 123, hello: 'world' })
} | 10088/formily | packages/core/src/__tests__/void.spec.ts | TypeScript |
ArrowFunction |
() => {
const form = attach(createForm())
const aa = attach(
form.createVoidField({
name: 'aa',
})
)
aa.setTitle('AAA')
aa.setDescription('This is AAA')
expect(aa.title).toEqual('AAA')
expect(aa.description).toEqual('This is AAA')
} | 10088/formily | packages/core/src/__tests__/void.spec.ts | TypeScript |
ArrowFunction |
() => {
const component = () => null
const form = attach(createForm())
const field = attach(
form.createVoidField({
name: 'aa',
})
)
field.setComponent(undefined, { props: 123 })
field.setComponent(component)
expect(field.component[0]).toEqual(component)
expect(field.component[1]).toEqual({ props: 123 })
field.setComponentProps({
hello: 'world',
})
expect(field.component[1]).toEqual({ props: 123, hello: 'world' })
} | 10088/formily | packages/core/src/__tests__/void.spec.ts | TypeScript |
ArrowFunction |
() => {
const component = () => null
const form = attach(createForm())
const field = attach(
form.createVoidField({
name: 'aa',
})
)
field.setDecorator(undefined, { props: 123 })
field.setDecorator(component)
expect(field.decorator[0]).toEqual(component)
expect(field.decorator[1]).toEqual({ props: 123 })
field.setDecoratorProps({
hello: 'world',
})
expect(field.decorator[1]).toEqual({ props: 123, hello: 'world' })
} | 10088/formily | packages/core/src/__tests__/void.spec.ts | TypeScript |
ArrowFunction |
() => {
const form = attach(createForm())
const aa = attach(
form.createVoidField({
name: 'aa',
})
)
const state = aa.getState()
aa.setState((state) => {
state.title = 'AAA'
})
expect(aa.title).toEqual('AAA')
aa.setState(state)
expect(aa.title).toBeUndefined()
aa.setState((state) => {
state.hidden = false
})
expect(aa.display).toEqual('visible')
aa.setState((state) => {
state.visible = true
})
expect(aa.display).toEqual('visible')
aa.setState((state) => {
state.readOnly = false
})
expect(aa.pattern).toEqual('editable')
aa.setState((state) => {
state.disabled = false
})
expect(aa.pattern).toEqual('editable')
aa.setState((state) => {
state.editable = true
})
expect(aa.pattern).toEqual('editable')
aa.setState((state) => {
state.editable = false
})
expect(aa.pattern).toEqual('readPretty')
aa.setState((state) => {
state.readPretty = true
})
expect(aa.pattern).toEqual('readPretty')
aa.setState((state) => {
state.readPretty = false
})
expect(aa.pattern).toEqual('editable')
expect(aa.parent).toBeUndefined()
} | 10088/formily | packages/core/src/__tests__/void.spec.ts | TypeScript |
ArrowFunction |
(state) => {
state.title = 'AAA'
} | 10088/formily | packages/core/src/__tests__/void.spec.ts | TypeScript |
ArrowFunction |
(state) => {
state.hidden = false
} | 10088/formily | packages/core/src/__tests__/void.spec.ts | TypeScript |
ArrowFunction |
(state) => {
state.visible = true
} | 10088/formily | packages/core/src/__tests__/void.spec.ts | TypeScript |
ArrowFunction |
(state) => {
state.readOnly = false
} | 10088/formily | packages/core/src/__tests__/void.spec.ts | TypeScript |
ArrowFunction |
(state) => {
state.disabled = false
} | 10088/formily | packages/core/src/__tests__/void.spec.ts | TypeScript |
ArrowFunction |
(state) => {
state.editable = true
} | 10088/formily | packages/core/src/__tests__/void.spec.ts | TypeScript |
ArrowFunction |
(state) => {
state.editable = false
} | 10088/formily | packages/core/src/__tests__/void.spec.ts | TypeScript |
ArrowFunction |
(state) => {
state.readPretty = true
} | 10088/formily | packages/core/src/__tests__/void.spec.ts | TypeScript |
ArrowFunction |
(state) => {
state.readPretty = false
} | 10088/formily | packages/core/src/__tests__/void.spec.ts | TypeScript |
ArrowFunction |
() => {
const form = attach(createForm())
attach(
form.createObjectField({
name: 'object',
})
)
const void_ = attach(
form.createVoidField({
name: 'void',
basePath: 'object',
})
)
const void2_ = attach(
form.createVoidField({
name: 'void',
basePath: 'object.void.0',
})
)
const aaa = attach(
form.createField({
name: 'aaa',
basePath: 'object.void',
})
)
const bbb = attach(
form.createField({
name: 'bbb',
basePath: 'object.void',
})
)
void_.setPattern('readPretty')
expect(void_.pattern).toEqual('readPretty')
expect(aaa.pattern).toEqual('readPretty')
expect(bbb.pattern).toEqual('readPretty')
void_.setPattern('readOnly')
expect(void_.pattern).toEqual('readOnly')
expect(aaa.pattern).toEqual('readOnly')
expect(bbb.pattern).toEqual('readOnly')
void_.setPattern('disabled')
expect(void_.pattern).toEqual('disabled')
expect(aaa.pattern).toEqual('disabled')
expect(bbb.pattern).toEqual('disabled')
void_.setPattern()
expect(void_.pattern).toEqual('editable')
expect(aaa.pattern).toEqual('editable')
expect(bbb.pattern).toEqual('editable')
void_.setDisplay('hidden')
expect(void_.display).toEqual('hidden')
expect(aaa.display).toEqual('hidden')
expect(bbb.display).toEqual('hidden')
void_.setDisplay('none')
expect(void_.display).toEqual('none')
expect(aaa.display).toEqual('none')
expect(bbb.display).toEqual('none')
void_.setDisplay()
expect(void_.display).toEqual('visible')
expect(aaa.display).toEqual('visible')
expect(bbb.display).toEqual('visible')
void_.onUnmount()
expect(void2_.parent === void_).toBeTruthy()
} | 10088/formily | packages/core/src/__tests__/void.spec.ts | TypeScript |
ArrowFunction |
async () => {
const form = attach(createForm())
const aa = attach(
form.createField({
name: 'aa',
})
)
const bb = attach(
form.createVoidField({
name: 'bb',
reactions: [
(field) => {
const aa = field.query('aa')
if (aa.get('value') === '123') {
field.visible = false
} else {
field.visible = true
}
if (aa.get('inputValue') === '333') {
field.editable = false
} else if (aa.get('inputValue') === '444') {
field.editable = true
}
if (aa.get('initialValue') === '555') {
field.readOnly = true
} else if (aa.get('initialValue') === '666') {
field.readOnly = false
}
},
null,
],
})
)
expect(bb.visible).toBeTruthy()
aa.setValue('123')
expect(bb.visible).toBeFalsy()
await aa.onInput('333')
expect(bb.editable).toBeFalsy()
await aa.onInput('444')
expect(bb.editable).toBeTruthy()
aa.setInitialValue('555')
expect(bb.readOnly).toBeTruthy()
aa.setInitialValue('666')
expect(bb.readOnly).toBeFalsy()
form.onUnmount()
} | 10088/formily | packages/core/src/__tests__/void.spec.ts | TypeScript |
ArrowFunction |
(field) => {
const aa = field.query('aa')
if (aa.get('value') === '123') {
field.visible = false
} else {
field.visible = true
}
if (aa.get('inputValue') === '333') {
field.editable = false
} else if (aa.get('inputValue') === '444') {
field.editable = true
}
if (aa.get('initialValue') === '555') {
field.readOnly = true
} else if (aa.get('initialValue') === '666') {
field.readOnly = false
}
} | 10088/formily | packages/core/src/__tests__/void.spec.ts | TypeScript |
ArrowFunction |
() => {
const form = attach(createForm())
form.setDisplay(null)
form.setPattern(null)
const field = attach(
form.createVoidField({
name: 'xxx',
})
)
expect(field.display).toEqual('visible')
expect(field.pattern).toEqual('editable')
} | 10088/formily | packages/core/src/__tests__/void.spec.ts | TypeScript |
ArrowFunction |
(button) => {
button.setButtonText("Add Command")
.onClick(() => {
new CommandSuggester(this.plugin, this).open();
});
} | claremacrae/obsidian-customizable-menu | src/ui/settingsTab.ts | TypeScript |
ArrowFunction |
() => {
new CommandSuggester(this.plugin, this).open();
} | claremacrae/obsidian-customizable-menu | src/ui/settingsTab.ts | TypeScript |
ArrowFunction |
command => {
const iconDiv = createDiv({ cls: "custom-menu-settings-icon" });
setIcon(iconDiv, command.icon, 20);
const setting = new Setting(containerEl)
.setName(command.name)
.addExtraButton(button => {
button.setIcon("trash")
.setTooltip("Remove command")
.onClick(async () => {
this.plugin.settings.menuCommands.remove(command);
await this.plugin.saveSettings();
this.display();
new Notice("You will need to restart Obsidian for the command to disappear.")
})
})
.addExtraButton(button => {
button.setIcon("gear")
.setTooltip("Edit icon")
.onClick(() => {
new IconPicker(new CommandSuggester(this.plugin, this), command, true).open(); //rewrite icon picker so it isn't taking a command suggester
})
});
setting.nameEl.prepend(iconDiv);
setting.nameEl.addClass("custom-menu-flex");
} | claremacrae/obsidian-customizable-menu | src/ui/settingsTab.ts | TypeScript |
ArrowFunction |
button => {
button.setIcon("trash")
.setTooltip("Remove command")
.onClick(async () => {
this.plugin.settings.menuCommands.remove(command);
await this.plugin.saveSettings();
this.display();
new Notice("You will need to restart Obsidian for the command to disappear.")
})
} | claremacrae/obsidian-customizable-menu | src/ui/settingsTab.ts | TypeScript |
ArrowFunction |
async () => {
this.plugin.settings.menuCommands.remove(command);
await this.plugin.saveSettings();
this.display();
new Notice("You will need to restart Obsidian for the command to disappear.")
} | claremacrae/obsidian-customizable-menu | src/ui/settingsTab.ts | TypeScript |
ArrowFunction |
button => {
button.setIcon("gear")
.setTooltip("Edit icon")
.onClick(() => {
new IconPicker(new CommandSuggester(this.plugin, this), command, true).open(); //rewrite icon picker so it isn't taking a command suggester
})
} | claremacrae/obsidian-customizable-menu | src/ui/settingsTab.ts | TypeScript |
ArrowFunction |
() => {
new IconPicker(new CommandSuggester(this.plugin, this), command, true).open(); //rewrite icon picker so it isn't taking a command suggester
} | claremacrae/obsidian-customizable-menu | src/ui/settingsTab.ts | TypeScript |
ClassDeclaration |
export default class CustomMenuSettingsTab extends PluginSettingTab {
plugin: CustomMenuPlugin;
constructor(app: App, plugin: CustomMenuPlugin) {
super(app, plugin);
this.plugin = plugin;
}
display(): void {
let { containerEl } = this;
containerEl.empty();
containerEl.createEl('h2', { text: 'Customizable Menu Settings' });
new Setting(containerEl)
.setName("Add Command to Menu")
.setDesc("Add a new command to the right-click menu")
.addButton((button) => {
button.setButtonText("Add Command")
.onClick(() => {
new CommandSuggester(this.plugin, this).open();
});
});
this.plugin.settings.menuCommands.forEach(command => {
const iconDiv = createDiv({ cls: "custom-menu-settings-icon" });
setIcon(iconDiv, command.icon, 20);
const setting = new Setting(containerEl)
.setName(command.name)
.addExtraButton(button => {
button.setIcon("trash")
.setTooltip("Remove command")
.onClick(async () => {
this.plugin.settings.menuCommands.remove(command);
await this.plugin.saveSettings();
this.display();
new Notice("You will need to restart Obsidian for the command to disappear.")
})
})
.addExtraButton(button => {
button.setIcon("gear")
.setTooltip("Edit icon")
.onClick(() => {
new IconPicker(new CommandSuggester(this.plugin, this), command, true).open(); //rewrite icon picker so it isn't taking a command suggester
})
});
setting.nameEl.prepend(iconDiv);
setting.nameEl.addClass("custom-menu-flex");
});
}
} | claremacrae/obsidian-customizable-menu | src/ui/settingsTab.ts | TypeScript |
InterfaceDeclaration |
export interface CustomMenuSettings {
menuCommands: Command[];
} | claremacrae/obsidian-customizable-menu | src/ui/settingsTab.ts | TypeScript |
MethodDeclaration |
display(): void {
let { containerEl } = this;
containerEl.empty();
containerEl.createEl('h2', { text: 'Customizable Menu Settings' });
new Setting(containerEl)
.setName("Add Command to Menu")
.setDesc("Add a new command to the right-click menu")
.addButton((button) => {
button.setButtonText("Add Command")
.onClick(() => {
new CommandSuggester(this.plugin, this).open();
});
});
this.plugin.settings.menuCommands.forEach(command => {
const iconDiv = createDiv({ cls: "custom-menu-settings-icon" });
setIcon(iconDiv, command.icon, 20);
const setting = new Setting(containerEl)
.setName(command.name)
.addExtraButton(button => {
button.setIcon("trash")
.setTooltip("Remove command")
.onClick(async () => {
this.plugin.settings.menuCommands.remove(command);
await this.plugin.saveSettings();
this.display();
new Notice("You will need to restart Obsidian for the command to disappear.")
})
})
.addExtraButton(button => {
button.setIcon("gear")
.setTooltip("Edit icon")
.onClick(() => {
new IconPicker(new CommandSuggester(this.plugin, this), command, true).open(); //rewrite icon picker so it isn't taking a command suggester
})
});
setting.nameEl.prepend(iconDiv);
setting.nameEl.addClass("custom-menu-flex");
});
} | claremacrae/obsidian-customizable-menu | src/ui/settingsTab.ts | TypeScript |
ArrowFunction |
(type: string, graph: Graph): Layout | undefined => {
return type === COLA_LAYOUT ? new TopologyColaLayout(graph, { layoutOnDrag: false }) : undefined;
} | Lucifergene/console | frontend/packages/topology/src/components/graph-view/layouts/layoutFactory.ts | TypeScript |
ArrowFunction |
()=>MouseCoordintatePlugin.changeMouseCoordinates | iofirag/stenciljs-gis-example | .history/src/components/gis-viewer/classes/features/ToolbarComp/ToolbarComp_20171226103859.ts | TypeScript |
ArrowFunction |
(dataLayer: ShapeLayerContainer) => {
// const isLayerVisible: boolean = map.hasLayer(dataLayer.leafletHeatLayer);
if (dataLayer.isDisplay) {
if (this.context.mapSettings.mode==='heat') {
this.toggleBetweenHeatCluster(dataLayer, SELECT_LAYER, UNSELECT_LAYER);
} else if (this.context.mapSettings.mode==='cluster') {
this.toggleBetweenHeatCluster(dataLayer, UNSELECT_LAYER, SELECT_LAYER);
}
}
} | iofirag/stenciljs-gis-example | .history/src/components/gis-viewer/classes/features/ToolbarComp/ToolbarComp_20171226103859.ts | TypeScript |
ArrowFunction |
(fileType: string) => {
this.context.mapState.importedLayers[fileType.toLowerCase()].forEach((dataLayer: ShapeLayerContainer) => {
if (dataLayer.isDisplay) {
if (this.context.mapSettings.mode === 'heat') {
this.toggleBetweenHeatCluster(dataLayer, SELECT_LAYER, UNSELECT_LAYER);
} else if (this.context.mapSettings.mode === 'cluster') {
this.toggleBetweenHeatCluster(dataLayer, UNSELECT_LAYER, SELECT_LAYER);
}
}
});
} | iofirag/stenciljs-gis-example | .history/src/components/gis-viewer/classes/features/ToolbarComp/ToolbarComp_20171226103859.ts | TypeScript |
ArrowFunction |
(dataLayer: ShapeLayerContainer) => {
if (dataLayer.isDisplay) {
if (this.context.mapSettings.mode === 'heat') {
this.toggleBetweenHeatCluster(dataLayer, SELECT_LAYER, UNSELECT_LAYER);
} else if (this.context.mapSettings.mode === 'cluster') {
this.toggleBetweenHeatCluster(dataLayer, UNSELECT_LAYER, SELECT_LAYER);
}
}
} | iofirag/stenciljs-gis-example | .history/src/components/gis-viewer/classes/features/ToolbarComp/ToolbarComp_20171226103859.ts | TypeScript |
MethodDeclaration |
init() {
const context = this.context;
if (!context) { return;}
this.features = {};
context.onAddControlToFeatures = this.addFeatureToToolbarHandler;
const { selectedLeafletObjects, mapState, map, props } = this.context;
const exportDropDownData: any[] = [{
label: 'Export KML',
onClick: Utils.exportBlobFactory.bind(this, FILE_TYPES.kml, selectedLeafletObjects, mapState, map, props.onSaveKmlBlob),
className: 'icon-kml'
}, {
label: 'Export CSV',
onClick: Utils.exportBlobFactory.bind(this, FILE_TYPES.csv, selectedLeafletObjects, mapState, map, props.onSaveCsvBlob),
className: 'icon-csv'
},
{
label: 'Export SHP',
onClick: Utils.exportBlobFactory.bind(this, FILE_TYPES.zip, selectedLeafletObjects, mapState, map, props.onSaveShpBlob),
className: 'icon-shp'
}
];
const coordinateSystemToolbarData = _.get(context, 'props.mouseCoordinate.enable')
? {
title: 'Coordinate system',
itemList: [
{
label: CoordinateType.MGRS,
iconClassName: 'icon-pin',
onClick: ()=>MouseCoordintatePlugin.changeMouseCoordinates,
name: 'coordinates',
type: DropDownItemType.RADIO_BUTTON,
isSelected: !!_.get(context, 'props.mouseCoordinate.utmref'),
}, {
label: CoordinateType.UTM,
iconClassName: 'icon-pin',
onClick: MouseCoordintatePlugin.changeMouseCoordinates,
name: 'coordinates',
type: DropDownItemType.RADIO_BUTTON,
isSelected: !!_.get(context, 'props.mouseCoordinate.utm'),
}, {
label: CoordinateType.DECIMAL,
iconClassName: 'icon-pin',
onClick: MouseCoordintatePlugin.changeMouseCoordinates,
name: 'coordinates',
type: DropDownItemType.RADIO_BUTTON,
isSelected: !!_.get(context, 'props.mouseCoordinate.gps'),
}
],
}
: null;
const toolbarLayerSettingsConfig = _.get(context, 'props.layersController.enable')
? {
title: 'Layers',
itemList: [
{
label: LayersTypeLabel.HEAT,
iconClassName: 'icon-heatmap',
onClick: this.onChangeMapMode,
name: 'layers',
type: DropDownItemType.RADIO_BUTTON,
isSelected: this.context.mapSettings.mode === 'heat',
}, {
label: LayersTypeLabel.CLUSTER,
iconClassName: 'icon-cluster',
onClick: this.onChangeMapMode,
name: 'layers',
type: DropDownItemType.RADIO_BUTTON,
isSelected: this.context.mapSettings.mode === 'cluster',
},],
}
: null;
// const dropDownData = [coordinateSystemToolbarData, toolbarLayerSettingsConfig];
// const toolbarSettingsDropDownData = _.filter(dropDownData, (item) => item !== null);
// const { isImportExport, isToolbarSettings } = context.props;
// const mouseCoordinateGps = {
// enable: true,
// gps: true,
// gpsLong: false,
// utm: false,
// utmref: false,
// };
// const mouseCoordinateUtm = {
// enable: true,
// gps: false,
// gpsLong: false,
// utm: true,
// utmref: false,
// };
// const mouseCoordinateUtmref = {
// enable: true,
// gps: false,
// gpsLong: false,
// utm: false,
// utmref: true,
// };
// // Create all plugins
// new LayersControllerComp(context); // Create first
// new DrawBarComp(context); // Draw-Bar
// new PolylineMeasureComp(context); // Polyline-Measure
// new SearchBoxComp(context); // Search-Box
// new ZoomToExtendComp(context);
// new MouseCoordintatePlugin(context, mouseCoordinateGps); // Mouse-position
// new MouseCoordintatePlugin(context, mouseCoordinateUtm); // Mouse-position
// new MouseCoordintatePlugin(context, mouseCoordinateUtmref); // Mouse-position
// new ScaleControlComp(context); // Add layers-control button to map
// new MiniMapComp(context); // MiniMap
// new CustomControlComp(context, this.unitsChangeClickHandler, CustomControlName.UNIT_CHANGER);
// new DropDownComp(context, exportDropDownData, isImportExport, 'Export Map');
// new CustomDropDownComp(context, toolbarSettingsDropDownData, CustomControlName.SETTINGS, isToolbarSettings, 'Settings');
// this.createElement();
// this.createOutsidePlugins();
} | iofirag/stenciljs-gis-example | .history/src/components/gis-viewer/classes/features/ToolbarComp/ToolbarComp_20171226103859.ts | TypeScript |
MethodDeclaration |
public onChangeMapMode(mode: ClusterHeat) {
// const previewsMode: string = this.context.mapSettings.mode;
this.context.mapSettings.mode = mode;
// Initial layers
this.context.mapState.initialLayers.forEach((dataLayer: ShapeLayerContainer) => {
// const isLayerVisible: boolean = map.hasLayer(dataLayer.leafletHeatLayer);
if (dataLayer.isDisplay) {
if (this.context.mapSettings.mode==='heat') {
this.toggleBetweenHeatCluster(dataLayer, SELECT_LAYER, UNSELECT_LAYER);
} else if (this.context.mapSettings.mode==='cluster') {
this.toggleBetweenHeatCluster(dataLayer, UNSELECT_LAYER, SELECT_LAYER);
}
}
});
// Imported layers
if (this.context.mapState.importedLayers) {
FILE_TYPES_ARRAY.forEach((fileType: string) => {
this.context.mapState.importedLayers[fileType.toLowerCase()].forEach((dataLayer: ShapeLayerContainer) => {
if (dataLayer.isDisplay) {
if (this.context.mapSettings.mode === 'heat') {
this.toggleBetweenHeatCluster(dataLayer, SELECT_LAYER, UNSELECT_LAYER);
} else if (this.context.mapSettings.mode === 'cluster') {
this.toggleBetweenHeatCluster(dataLayer, UNSELECT_LAYER, SELECT_LAYER);
}
}
});
});
}
Utils.updateLayerControllerLayersClass(this.context.mapSettings.mode);
} | iofirag/stenciljs-gis-example | .history/src/components/gis-viewer/classes/features/ToolbarComp/ToolbarComp_20171226103859.ts | TypeScript |
MethodDeclaration | // public getZoomToExtends(): ZoomToExtendComp {
// return this.features[FeaturesNames.ZOOM_TO_EXTEND_COMP];
// }
// public getDrawBar(): DrawBarComp {
// return this.features[FeaturesNames.DRAWBAR_COMP];
// }
// public getDrawLayer(): L.FeatureGroup {
// return this.getDrawBar().getDrawLayer();
// }
private toggleBetweenHeatCluster(dataLayer: ShapeLayerContainer, HeatSelectionMode: SelectionMode, clusterSelectionMode: SelectionMode) {
if (dataLayer.leafletHeatLayer) {
this.context.layersController.element[HeatSelectionMode](dataLayer.leafletHeatLayer);
}
if (dataLayer.leafletClusterLayer) {
this.context.layersController.element[clusterSelectionMode](dataLayer.leafletClusterLayer);
}
} | iofirag/stenciljs-gis-example | .history/src/components/gis-viewer/classes/features/ToolbarComp/ToolbarComp_20171226103859.ts | TypeScript |
MethodDeclaration | // private unitsChangeClickHandler() {
// const toggleableList = [
// FeaturesNames.MEASURE_COMP,
// FeaturesNames.SCALE_CONTROL_COMP,
// FeaturesNames.DRAWBAR_COMP
// ];
// try {
// toggleableList.forEach(key => {
// if (this.features[key]) {
// this.features[key].toggleUnits();
// }
// });
// } catch(e) {
// console.error('Error in change units in one of the plugins', e);
// }
// }
private addFeatureToToolbarHandler(key: string, control: any) {
this.features[key] = control;
if (ToolbarPlugins[key]) {
this.toolbarEnabledPlugins.push(key);
} else if (MapPlugins[key]) {
this.mapEnabledPlugins.add(key);
}
} | iofirag/stenciljs-gis-example | .history/src/components/gis-viewer/classes/features/ToolbarComp/ToolbarComp_20171226103859.ts | TypeScript |
ClassDeclaration |
@Module({})
export class CommonModule {} | dawiddominiak/reminders | src/common/common.module.ts | TypeScript |
FunctionDeclaration |
function waitForSpyCall(spy: jasmine.Spy, checkInterval: number = 40, timeout: number = 1000): Promise<any> {
const initialCallsCount = spy.calls.count();
return new Promise<void>((resolve, reject) => {
let intervalId;
const timeoutId = setTimeout(() => {
clearInterval(intervalId);
reject();
}, timeout);
intervalId = setInterval(() => {
if (spy.calls.count() > initialCallsCount) {
clearTimeout(timeoutId);
clearInterval(intervalId);
resolve();
}
}, checkInterval);
});
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
(resolve, reject) => {
let intervalId;
const timeoutId = setTimeout(() => {
clearInterval(intervalId);
reject();
}, timeout);
intervalId = setInterval(() => {
if (spy.calls.count() > initialCallsCount) {
clearTimeout(timeoutId);
clearInterval(intervalId);
resolve();
}
}, checkInterval);
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
() => {
clearInterval(intervalId);
reject();
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
() => {
if (spy.calls.count() > initialCallsCount) {
clearTimeout(timeoutId);
clearInterval(intervalId);
resolve();
}
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
() => {
let initialTimeoutInterval;
beforeAll(() => {
initialTimeoutInterval = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;
});
afterAll(() => (jasmine.DEFAULT_TIMEOUT_INTERVAL = initialTimeoutInterval));
beforeEach(() => {
fixture = TestBed.configureTestingModule({
imports: [NbListModule],
declarations: [PagerTestComponent],
providers: [{ provide: ComponentFixtureAutoDetect, useValue: true }],
}).createComponent(PagerTestComponent);
testComponent = fixture.componentInstance;
fixture.detectChanges();
pageChangedSpy = spyOn(testComponent, 'pageChanged');
});
afterEach(fakeAsync(() => {
fixture.destroy();
tick();
fixture.nativeElement.remove();
}));
describe('initial page', () => {
it('should emit initial page change when list was prefilled', async () => {
try {
await waitForSpyCall(pageChangedSpy);
} catch {
fail('Page change should be emmited');
}
expect(pageChangedSpy).toHaveBeenCalledTimes(1);
expect(pageChangedSpy).toHaveBeenCalledWith(1);
});
describe('empty list', () => {
let initialItemsCountBefore;
beforeAll(() => {
initialItemsCountBefore = initialItemsCount;
initialItemsCount = 0;
});
afterAll(() => (initialItemsCount = initialItemsCountBefore));
it('should not emit initial page change when list is empty', async () => {
try {
await waitForSpyCall(pageChangedSpy);
fail('Page change should not be emmited');
} catch {}
expect(pageChangedSpy).not.toHaveBeenCalled();
});
it(`should emit initial page change when items added to empty list`, async () => {
testComponent.items = new Array(initialItemsCountBefore);
fixture.detectChanges();
try {
await waitForSpyCall(pageChangedSpy);
} catch {
fail('Page change should be emmited');
}
expect(pageChangedSpy).toHaveBeenCalledTimes(1);
expect(pageChangedSpy).toHaveBeenCalledWith(1);
});
});
});
describe('start page', () => {
let initialItemsCountBefore;
beforeAll(() => {
initialItemsCountBefore = initialItemsCount;
initialItemsCount = 0;
});
afterAll(() => (initialItemsCount = initialItemsCountBefore));
it('should take into account start page when calculating current page', async () => {
const startPage = 5;
const { listElement } = testComponent;
testComponent.items = new Array(initialItemsCountBefore);
testComponent.startPage = startPage;
fixture.detectChanges();
try {
await waitForSpyCall(pageChangedSpy);
} catch {
fail('pageChanged should be called after adding new items to empty list');
}
expect(pageChangedSpy).toHaveBeenCalledTimes(1);
expect(pageChangedSpy).toHaveBeenCalledWith(startPage);
const numberOfPagesToScroll = [1, 5];
let timesPageShouldBeChanged = 1;
for (const nPagesToScroll of numberOfPagesToScroll) {
listElement.scrollTop = PAGE_HEIGHT * nPagesToScroll;
try {
await waitForSpyCall(pageChangedSpy);
timesPageShouldBeChanged++;
} catch {
fail(`pageChanged should be called after scrolling ${startPage + nPagesToScroll} pages down`);
}
expect(pageChangedSpy).toHaveBeenCalledTimes(timesPageShouldBeChanged);
expect(pageChangedSpy).toHaveBeenCalledWith(startPage + nPagesToScroll);
}
});
});
describe(`page change`, () => {
beforeEach(async () => {
try {
await waitForSpyCall(pageChangedSpy);
} catch {
throw new Error('No initial page call');
}
// 'pageChanged' will be called once after list initialization, since list has items.
// Reset to start counting from zero calls.
pageChangedSpy.calls.reset();
});
it('should not emit page change when scrolling within current page', async () => {
const { listElement } = testComponent;
const positionBeforePageTwo = PAGE_HEIGHT - LIST_HEIGHT;
listElement.scrollTop = positionBeforePageTwo;
try {
await waitForSpyCall(pageChangedSpy);
} catch {
/* Expecting to throw because 'pageChanged' shouldn't be called since page wasn't changed. */
}
expect(pageChangedSpy).not.toHaveBeenCalled();
});
it('should emit page change when scrolling to another pages', async () => {
const { listElement } = testComponent;
const startPage = 1;
let timesPageShouldBeChanged = 0;
const lastPage = initialItemsCount / ITEMS_PER_PAGE - 1;
const numbersOfPagesToScroll = [1, 2, lastPage, 0];
for (const pagesToScroll of numbersOfPagesToScroll) {
listElement.scrollTop = PAGE_HEIGHT * pagesToScroll;
try {
await waitForSpyCall(pageChangedSpy);
timesPageShouldBeChanged++;
} catch {
fail(`pageChanged should be called after scrolling to ${startPage + pagesToScroll} page`);
}
expect(pageChangedSpy).toHaveBeenCalledTimes(timesPageShouldBeChanged);
expect(pageChangedSpy).toHaveBeenCalledWith(startPage + pagesToScroll);
}
});
});
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
() => {
initialTimeoutInterval = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 5000;
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
() => (jasmine.DEFAULT_TIMEOUT_INTERVAL = initialTimeoutInterval) | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
() => {
fixture = TestBed.configureTestingModule({
imports: [NbListModule],
declarations: [PagerTestComponent],
providers: [{ provide: ComponentFixtureAutoDetect, useValue: true }],
}).createComponent(PagerTestComponent);
testComponent = fixture.componentInstance;
fixture.detectChanges();
pageChangedSpy = spyOn(testComponent, 'pageChanged');
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
() => {
fixture.destroy();
tick();
fixture.nativeElement.remove();
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
() => {
it('should emit initial page change when list was prefilled', async () => {
try {
await waitForSpyCall(pageChangedSpy);
} catch {
fail('Page change should be emmited');
}
expect(pageChangedSpy).toHaveBeenCalledTimes(1);
expect(pageChangedSpy).toHaveBeenCalledWith(1);
});
describe('empty list', () => {
let initialItemsCountBefore;
beforeAll(() => {
initialItemsCountBefore = initialItemsCount;
initialItemsCount = 0;
});
afterAll(() => (initialItemsCount = initialItemsCountBefore));
it('should not emit initial page change when list is empty', async () => {
try {
await waitForSpyCall(pageChangedSpy);
fail('Page change should not be emmited');
} catch {}
expect(pageChangedSpy).not.toHaveBeenCalled();
});
it(`should emit initial page change when items added to empty list`, async () => {
testComponent.items = new Array(initialItemsCountBefore);
fixture.detectChanges();
try {
await waitForSpyCall(pageChangedSpy);
} catch {
fail('Page change should be emmited');
}
expect(pageChangedSpy).toHaveBeenCalledTimes(1);
expect(pageChangedSpy).toHaveBeenCalledWith(1);
});
});
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
async () => {
try {
await waitForSpyCall(pageChangedSpy);
} catch {
fail('Page change should be emmited');
}
expect(pageChangedSpy).toHaveBeenCalledTimes(1);
expect(pageChangedSpy).toHaveBeenCalledWith(1);
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
() => {
let initialItemsCountBefore;
beforeAll(() => {
initialItemsCountBefore = initialItemsCount;
initialItemsCount = 0;
});
afterAll(() => (initialItemsCount = initialItemsCountBefore));
it('should not emit initial page change when list is empty', async () => {
try {
await waitForSpyCall(pageChangedSpy);
fail('Page change should not be emmited');
} catch {}
expect(pageChangedSpy).not.toHaveBeenCalled();
});
it(`should emit initial page change when items added to empty list`, async () => {
testComponent.items = new Array(initialItemsCountBefore);
fixture.detectChanges();
try {
await waitForSpyCall(pageChangedSpy);
} catch {
fail('Page change should be emmited');
}
expect(pageChangedSpy).toHaveBeenCalledTimes(1);
expect(pageChangedSpy).toHaveBeenCalledWith(1);
});
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
() => {
initialItemsCountBefore = initialItemsCount;
initialItemsCount = 0;
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
() => (initialItemsCount = initialItemsCountBefore) | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
async () => {
try {
await waitForSpyCall(pageChangedSpy);
fail('Page change should not be emmited');
} catch {}
expect(pageChangedSpy).not.toHaveBeenCalled();
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
async () => {
testComponent.items = new Array(initialItemsCountBefore);
fixture.detectChanges();
try {
await waitForSpyCall(pageChangedSpy);
} catch {
fail('Page change should be emmited');
}
expect(pageChangedSpy).toHaveBeenCalledTimes(1);
expect(pageChangedSpy).toHaveBeenCalledWith(1);
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
() => {
let initialItemsCountBefore;
beforeAll(() => {
initialItemsCountBefore = initialItemsCount;
initialItemsCount = 0;
});
afterAll(() => (initialItemsCount = initialItemsCountBefore));
it('should take into account start page when calculating current page', async () => {
const startPage = 5;
const { listElement } = testComponent;
testComponent.items = new Array(initialItemsCountBefore);
testComponent.startPage = startPage;
fixture.detectChanges();
try {
await waitForSpyCall(pageChangedSpy);
} catch {
fail('pageChanged should be called after adding new items to empty list');
}
expect(pageChangedSpy).toHaveBeenCalledTimes(1);
expect(pageChangedSpy).toHaveBeenCalledWith(startPage);
const numberOfPagesToScroll = [1, 5];
let timesPageShouldBeChanged = 1;
for (const nPagesToScroll of numberOfPagesToScroll) {
listElement.scrollTop = PAGE_HEIGHT * nPagesToScroll;
try {
await waitForSpyCall(pageChangedSpy);
timesPageShouldBeChanged++;
} catch {
fail(`pageChanged should be called after scrolling ${startPage + nPagesToScroll} pages down`);
}
expect(pageChangedSpy).toHaveBeenCalledTimes(timesPageShouldBeChanged);
expect(pageChangedSpy).toHaveBeenCalledWith(startPage + nPagesToScroll);
}
});
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
() => {
initialItemsCountBefore = initialItemsCount;
initialItemsCount = 0;
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
async () => {
const startPage = 5;
const { listElement } = testComponent;
testComponent.items = new Array(initialItemsCountBefore);
testComponent.startPage = startPage;
fixture.detectChanges();
try {
await waitForSpyCall(pageChangedSpy);
} catch {
fail('pageChanged should be called after adding new items to empty list');
}
expect(pageChangedSpy).toHaveBeenCalledTimes(1);
expect(pageChangedSpy).toHaveBeenCalledWith(startPage);
const numberOfPagesToScroll = [1, 5];
let timesPageShouldBeChanged = 1;
for (const nPagesToScroll of numberOfPagesToScroll) {
listElement.scrollTop = PAGE_HEIGHT * nPagesToScroll;
try {
await waitForSpyCall(pageChangedSpy);
timesPageShouldBeChanged++;
} catch {
fail(`pageChanged should be called after scrolling ${startPage + nPagesToScroll} pages down`);
}
expect(pageChangedSpy).toHaveBeenCalledTimes(timesPageShouldBeChanged);
expect(pageChangedSpy).toHaveBeenCalledWith(startPage + nPagesToScroll);
}
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
() => {
beforeEach(async () => {
try {
await waitForSpyCall(pageChangedSpy);
} catch {
throw new Error('No initial page call');
}
// 'pageChanged' will be called once after list initialization, since list has items.
// Reset to start counting from zero calls.
pageChangedSpy.calls.reset();
});
it('should not emit page change when scrolling within current page', async () => {
const { listElement } = testComponent;
const positionBeforePageTwo = PAGE_HEIGHT - LIST_HEIGHT;
listElement.scrollTop = positionBeforePageTwo;
try {
await waitForSpyCall(pageChangedSpy);
} catch {
/* Expecting to throw because 'pageChanged' shouldn't be called since page wasn't changed. */
}
expect(pageChangedSpy).not.toHaveBeenCalled();
});
it('should emit page change when scrolling to another pages', async () => {
const { listElement } = testComponent;
const startPage = 1;
let timesPageShouldBeChanged = 0;
const lastPage = initialItemsCount / ITEMS_PER_PAGE - 1;
const numbersOfPagesToScroll = [1, 2, lastPage, 0];
for (const pagesToScroll of numbersOfPagesToScroll) {
listElement.scrollTop = PAGE_HEIGHT * pagesToScroll;
try {
await waitForSpyCall(pageChangedSpy);
timesPageShouldBeChanged++;
} catch {
fail(`pageChanged should be called after scrolling to ${startPage + pagesToScroll} page`);
}
expect(pageChangedSpy).toHaveBeenCalledTimes(timesPageShouldBeChanged);
expect(pageChangedSpy).toHaveBeenCalledWith(startPage + pagesToScroll);
}
});
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
async () => {
try {
await waitForSpyCall(pageChangedSpy);
} catch {
throw new Error('No initial page call');
}
// 'pageChanged' will be called once after list initialization, since list has items.
// Reset to start counting from zero calls.
pageChangedSpy.calls.reset();
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
async () => {
const { listElement } = testComponent;
const positionBeforePageTwo = PAGE_HEIGHT - LIST_HEIGHT;
listElement.scrollTop = positionBeforePageTwo;
try {
await waitForSpyCall(pageChangedSpy);
} catch {
/* Expecting to throw because 'pageChanged' shouldn't be called since page wasn't changed. */
}
expect(pageChangedSpy).not.toHaveBeenCalled();
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
async () => {
const { listElement } = testComponent;
const startPage = 1;
let timesPageShouldBeChanged = 0;
const lastPage = initialItemsCount / ITEMS_PER_PAGE - 1;
const numbersOfPagesToScroll = [1, 2, lastPage, 0];
for (const pagesToScroll of numbersOfPagesToScroll) {
listElement.scrollTop = PAGE_HEIGHT * pagesToScroll;
try {
await waitForSpyCall(pageChangedSpy);
timesPageShouldBeChanged++;
} catch {
fail(`pageChanged should be called after scrolling to ${startPage + pagesToScroll} page`);
}
expect(pageChangedSpy).toHaveBeenCalledTimes(timesPageShouldBeChanged);
expect(pageChangedSpy).toHaveBeenCalledWith(startPage + pagesToScroll);
}
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ClassDeclaration |
@Component({
template: `
<nb-list
nbListPageTracker
[pageSize]="pageSize"
[startPage]="startPage"
(pageChange)="pageChanged($event)"
class="list"
>
<nb-list-item *ngFor="let _ of items" class="list-item"></nb-list-item>
</nb-list>
`,
styles: [
`
.list {
background: lightslategray;
height: ${LIST_HEIGHT}px;
padding: 0 5px;
overflow: auto;
}
.list-item {
background: lightblue;
border: ${ITEM_HEIGHT * 0.01}px solid black;
height: ${ITEM_HEIGHT * 0.98}px;
}
`,
],
})
class PagerTestComponent {
@ViewChild(NbListComponent, { read: ElementRef }) listElementRef: ElementRef;
get listElement(): Element {
return this.listElementRef.nativeElement;
}
items = new Array(initialItemsCount);
pageSize = ITEMS_PER_PAGE;
startPage = 1;
pageChanged() {}
} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
MethodDeclaration |
pageChanged() {} | dadosfera/beast | src/framework/theme/components/list/list-pager.directive.spec.ts | TypeScript |
ArrowFunction |
(paramMap: ParamMap) => {
if (paramMap.has('reminder')) {
const reminderId = paramMap.get('reminder');
const dialogRef = this.dialog.open(ReminderDialogComponent, {
width: '100%',
data: {
reminderId
}
});
dialogRef.afterClosed().subscribe((reminder: Reminder) => {
this.router.navigate([
reminder && reminder.archived ? '/archive' : '/inbox'
]);
this.listReminders();
});
}
} | andryfailli/remindme-frontend | src/app/reminders/reminders-list/reminders-list.component.ts | TypeScript |
ArrowFunction |
(reminder: Reminder) => {
this.router.navigate([
reminder && reminder.archived ? '/archive' : '/inbox'
]);
this.listReminders();
} | andryfailli/remindme-frontend | src/app/reminders/reminders-list/reminders-list.component.ts | TypeScript |
ArrowFunction |
(reminders: Reminder[]) =>
reminders.filter((reminder: Reminder) => reminder.isPast() === false) | andryfailli/remindme-frontend | src/app/reminders/reminders-list/reminders-list.component.ts | TypeScript |
ArrowFunction |
(reminder: Reminder) => reminder.isPast() === false | andryfailli/remindme-frontend | src/app/reminders/reminders-list/reminders-list.component.ts | TypeScript |
ArrowFunction |
(reminders: Reminder[]) =>
reminders.filter((reminder: Reminder) => reminder.isPast() === true) | andryfailli/remindme-frontend | src/app/reminders/reminders-list/reminders-list.component.ts | TypeScript |
ArrowFunction |
(reminder: Reminder) => reminder.isPast() === true | andryfailli/remindme-frontend | src/app/reminders/reminders-list/reminders-list.component.ts | TypeScript |
ArrowFunction |
() => {
this.matSnackBar.open('Reminder moved to the archive.', null, {
duration: 2000
});
this.listReminders();
} | andryfailli/remindme-frontend | src/app/reminders/reminders-list/reminders-list.component.ts | TypeScript |
ArrowFunction |
() => {
this.matSnackBar.open('Reminder moved to inbox.', null, {
duration: 2000
});
this.listReminders();
} | andryfailli/remindme-frontend | src/app/reminders/reminders-list/reminders-list.component.ts | TypeScript |
ArrowFunction |
() => {
this.matSnackBar.open('Reminder deleted.', null, { duration: 2000 });
this.listReminders();
} | andryfailli/remindme-frontend | src/app/reminders/reminders-list/reminders-list.component.ts | TypeScript |
ClassDeclaration |
@Component({
selector: 'app-reminders-list',
templateUrl: './reminders-list.component.html',
styleUrls: ['./reminders-list.component.css']
})
export class RemindersListComponent implements OnInit {
reminders$: Observable<Reminder[]>;
remindersUpcoming$: Observable<Reminder[]>;
remindersPast$: Observable<Reminder[]>;
constructor(
private remindersService: RemindersService,
private dialog: MatDialog,
private route: ActivatedRoute,
private router: Router,
private matSnackBar: MatSnackBar
) {}
ngOnInit() {
this.listReminders();
this.route.paramMap.subscribe((paramMap: ParamMap) => {
if (paramMap.has('reminder')) {
const reminderId = paramMap.get('reminder');
const dialogRef = this.dialog.open(ReminderDialogComponent, {
width: '100%',
data: {
reminderId
}
});
dialogRef.afterClosed().subscribe((reminder: Reminder) => {
this.router.navigate([
reminder && reminder.archived ? '/archive' : '/inbox'
]);
this.listReminders();
});
}
});
}
listReminders() {
this.reminders$ = this.remindersService
.list(this.router.url.startsWith('/inbox') ? false : true)
.share();
this.remindersUpcoming$ = this.reminders$.map((reminders: Reminder[]) =>
reminders.filter((reminder: Reminder) => reminder.isPast() === false)
);
this.remindersPast$ = this.reminders$.map((reminders: Reminder[]) =>
reminders.filter((reminder: Reminder) => reminder.isPast() === true)
);
}
archiveReminder(reminder: Reminder): Observable<Reminder> {
const reminder$: Observable<Reminder> = this.remindersService.archive(
reminder
);
reminder$.subscribe(() => {
this.matSnackBar.open('Reminder moved to the archive.', null, {
duration: 2000
});
this.listReminders();
});
return reminder$;
}
unarchiveReminder(reminder: Reminder): Observable<Reminder> {
const reminder$: Observable<Reminder> = this.remindersService.unarchive(
reminder
);
reminder$.subscribe(() => {
this.matSnackBar.open('Reminder moved to inbox.', null, {
duration: 2000
});
this.listReminders();
});
return reminder$;
}
deleteReminder(reminder: Reminder): Observable<void> {
const reminder$: Observable<void> = this.remindersService.delete(reminder);
reminder$.subscribe(() => {
this.matSnackBar.open('Reminder deleted.', null, { duration: 2000 });
this.listReminders();
});
return reminder$;
}
} | andryfailli/remindme-frontend | src/app/reminders/reminders-list/reminders-list.component.ts | TypeScript |
MethodDeclaration |
ngOnInit() {
this.listReminders();
this.route.paramMap.subscribe((paramMap: ParamMap) => {
if (paramMap.has('reminder')) {
const reminderId = paramMap.get('reminder');
const dialogRef = this.dialog.open(ReminderDialogComponent, {
width: '100%',
data: {
reminderId
}
});
dialogRef.afterClosed().subscribe((reminder: Reminder) => {
this.router.navigate([
reminder && reminder.archived ? '/archive' : '/inbox'
]);
this.listReminders();
});
}
});
} | andryfailli/remindme-frontend | src/app/reminders/reminders-list/reminders-list.component.ts | TypeScript |
MethodDeclaration |
listReminders() {
this.reminders$ = this.remindersService
.list(this.router.url.startsWith('/inbox') ? false : true)
.share();
this.remindersUpcoming$ = this.reminders$.map((reminders: Reminder[]) =>
reminders.filter((reminder: Reminder) => reminder.isPast() === false)
);
this.remindersPast$ = this.reminders$.map((reminders: Reminder[]) =>
reminders.filter((reminder: Reminder) => reminder.isPast() === true)
);
} | andryfailli/remindme-frontend | src/app/reminders/reminders-list/reminders-list.component.ts | TypeScript |
MethodDeclaration |
archiveReminder(reminder: Reminder): Observable<Reminder> {
const reminder$: Observable<Reminder> = this.remindersService.archive(
reminder
);
reminder$.subscribe(() => {
this.matSnackBar.open('Reminder moved to the archive.', null, {
duration: 2000
});
this.listReminders();
});
return reminder$;
} | andryfailli/remindme-frontend | src/app/reminders/reminders-list/reminders-list.component.ts | TypeScript |
MethodDeclaration |
unarchiveReminder(reminder: Reminder): Observable<Reminder> {
const reminder$: Observable<Reminder> = this.remindersService.unarchive(
reminder
);
reminder$.subscribe(() => {
this.matSnackBar.open('Reminder moved to inbox.', null, {
duration: 2000
});
this.listReminders();
});
return reminder$;
} | andryfailli/remindme-frontend | src/app/reminders/reminders-list/reminders-list.component.ts | TypeScript |
MethodDeclaration |
deleteReminder(reminder: Reminder): Observable<void> {
const reminder$: Observable<void> = this.remindersService.delete(reminder);
reminder$.subscribe(() => {
this.matSnackBar.open('Reminder deleted.', null, { duration: 2000 });
this.listReminders();
});
return reminder$;
} | andryfailli/remindme-frontend | src/app/reminders/reminders-list/reminders-list.component.ts | TypeScript |
ClassDeclaration |
export class PaginationQueryDto {
@ApiProperty()
@IsString()
@IsOptional()
@IsPositive()
limit: string;
@ApiProperty()
@IsString()
@IsOptional()
@IsPositive()
offset: string;
} | abebelagua/testproyect-api | src/dto/pagination.dto.ts | TypeScript |
FunctionDeclaration |
function mapStateToProps(state: CombinedState): StateToProps {
const {
auth: {
user,
fetching: logoutFetching,
fetching: changePasswordFetching,
showChangePasswordDialog: changePasswordDialogShown,
allowChangePassword: renderChangePasswordItem,
},
plugins: { list },
about: { server, packageVersion },
shortcuts: { normalizedKeyMap },
settings: { showDialog: settingsDialogShown },
} = state;
return {
user,
tool: {
name: server.name as string,
description: server.description as string,
server: {
host: core.config.backendAPI.slice(0, -7),
version: server.version as string,
},
canvas: {
version: packageVersion.canvas,
},
core: {
version: packageVersion.core,
},
ui: {
version: packageVersion.ui,
},
},
switchSettingsShortcut: normalizedKeyMap.SWITCH_SETTINGS,
settingsDialogShown,
changePasswordDialogShown,
changePasswordFetching,
logoutFetching,
renderChangePasswordItem,
isAnalyticsPluginActive: list.ANALYTICS,
isModelsPluginActive: list.MODELS,
isGitPluginActive: list.GIT_INTEGRATION,
};
} | Intelligent-Systems-Laboratory/cvat | cvat-ui/src/components/header/header.tsx | TypeScript |
FunctionDeclaration |
function mapDispatchToProps(dispatch: any): DispatchToProps {
return {
onLogout: (): void => dispatch(logoutAsync()),
switchSettingsDialog: (show: boolean): void => dispatch(switchSettingsDialogAction(show)),
switchChangePasswordDialog: (show: boolean): void => dispatch(authActions.switchChangePasswordDialog(show)),
};
} | Intelligent-Systems-Laboratory/cvat | cvat-ui/src/components/header/header.tsx | TypeScript |
FunctionDeclaration |
function HeaderContainer(props: Props): JSX.Element {
const {
user,
tool,
logoutFetching,
changePasswordFetching,
settingsDialogShown,
switchSettingsShortcut,
onLogout,
switchSettingsDialog,
switchChangePasswordDialog,
renderChangePasswordItem,
isAnalyticsPluginActive,
isModelsPluginActive,
} = props;
const { CHANGELOG_URL, LICENSE_URL, GITTER_URL, FORUM_URL, GITHUB_URL } = consts;
const history = useHistory();
function showAboutModal(): void {
Modal.info({
title: `${tool.name}`,
content: (
<div>
<p>{`${tool.description}`}</p>
<p>
<Text strong>Server version:</Text>
<Text type='secondary'>{` ${tool.server.version}`}</Text>
</p>
<p>
<Text strong>Core version:</Text>
<Text type='secondary'>{` ${tool.core.version}`} | Intelligent-Systems-Laboratory/cvat | cvat-ui/src/components/header/header.tsx | TypeScript |
FunctionDeclaration |
function showAboutModal(): void {
Modal.info({
title: `${tool.name}`,
content: (
<div>
<p>{`${tool.description}`}</p>
<p>
<Text strong>Server version:</Text>
<Text type='secondary'>{` ${tool.server.version}`} | Intelligent-Systems-Laboratory/cvat | cvat-ui/src/components/header/header.tsx | TypeScript |
FunctionDeclaration |
function propsAreTheSame(prevProps: Props, nextProps: Props): boolean {
let equal = true;
for (const prop in nextProps) {
if (prop in prevProps && (prevProps as any)[prop] !== (nextProps as any)[prop]) {
if (prop !== 'tool') {
equal = false;
}
}
}
return equal;
} | Intelligent-Systems-Laboratory/cvat | cvat-ui/src/components/header/header.tsx | TypeScript |
ArrowFunction |
(): void => dispatch(logoutAsync()) | Intelligent-Systems-Laboratory/cvat | cvat-ui/src/components/header/header.tsx | TypeScript |
ArrowFunction |
(show: boolean): void => dispatch(switchSettingsDialogAction(show)) | Intelligent-Systems-Laboratory/cvat | cvat-ui/src/components/header/header.tsx | TypeScript |
ArrowFunction |
(show: boolean): void => dispatch(authActions.switchChangePasswordDialog(show)) | Intelligent-Systems-Laboratory/cvat | cvat-ui/src/components/header/header.tsx | TypeScript |
ArrowFunction |
(): void => switchChangePasswordDialog(true) | Intelligent-Systems-Laboratory/cvat | cvat-ui/src/components/header/header.tsx | TypeScript |
ArrowFunction |
() => switchChangePasswordDialog(false) | Intelligent-Systems-Laboratory/cvat | cvat-ui/src/components/header/header.tsx | TypeScript |
InterfaceDeclaration |
interface Tool {
name: string;
description: string;
server: {
host: string;
version: string;
};
core: {
version: string;
};
canvas: {
version: string;
};
ui: {
version: string;
};
} | Intelligent-Systems-Laboratory/cvat | cvat-ui/src/components/header/header.tsx | TypeScript |
InterfaceDeclaration |
interface StateToProps {
user: any;
tool: Tool;
switchSettingsShortcut: string;
settingsDialogShown: boolean;
changePasswordDialogShown: boolean;
changePasswordFetching: boolean;
logoutFetching: boolean;
renderChangePasswordItem: boolean;
isAnalyticsPluginActive: boolean;
isModelsPluginActive: boolean;
isGitPluginActive: boolean;
} | Intelligent-Systems-Laboratory/cvat | cvat-ui/src/components/header/header.tsx | TypeScript |
InterfaceDeclaration |
interface DispatchToProps {
onLogout: () => void;
switchSettingsDialog: (show: boolean) => void;
switchChangePasswordDialog: (show: boolean) => void;
} | Intelligent-Systems-Laboratory/cvat | cvat-ui/src/components/header/header.tsx | TypeScript |
TypeAliasDeclaration |
type Props = StateToProps & DispatchToProps; | Intelligent-Systems-Laboratory/cvat | cvat-ui/src/components/header/header.tsx | TypeScript |
MethodDeclaration |
functions< | Intelligent-Systems-Laboratory/cvat | cvat-ui/src/components/header/header.tsx | TypeScript |
MethodDeclaration |
changePasswordFetching ? <Icon type='loading' | Intelligent-Systems-Laboratory/cvat | cvat-ui/src/components/header/header.tsx | TypeScript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.