commit
stringlengths
40
40
old_file
stringlengths
4
150
new_file
stringlengths
4
150
old_contents
stringlengths
0
3.26k
new_contents
stringlengths
1
4.43k
subject
stringlengths
15
501
message
stringlengths
15
4.06k
lang
stringclasses
4 values
license
stringclasses
13 values
repos
stringlengths
5
91.5k
diff
stringlengths
0
4.35k
9041c559ba0244efde0b8829963b9723130740e6
src/parser/hunter/survival/modules/resources/SurvivalFocusUsage.tsx
src/parser/hunter/survival/modules/resources/SurvivalFocusUsage.tsx
import SharedHunterFocusUsage from 'parser/hunter/shared/modules/resources/FocusUsage'; import { LIST_OF_FOCUS_SPENDERS_SV } from 'parser/hunter/survival/constants'; import SPELLS from 'common/SPELLS'; import Spell from 'common/SPELLS/Spell'; import { Ability } from 'parser/core/Events'; class SurvivalFocusUsage extends SharedHunterFocusUsage { static listOfResourceSpenders: Spell[] = [ ...LIST_OF_FOCUS_SPENDERS_SV, ]; static spellsThatShouldShowAsOtherSpells: { [key: number]: Ability } = { [SPELLS.MONGOOSE_BITE_TALENT_AOTE.id]: SPELLS.MONGOOSE_BITE_TALENT, [SPELLS.RAPTOR_STRIKE_AOTE.id]: SPELLS.RAPTOR_STRIKE, }; } export default SurvivalFocusUsage;
import SharedHunterFocusUsage from 'parser/hunter/shared/modules/resources/FocusUsage'; import { LIST_OF_FOCUS_SPENDERS_SV } from 'parser/hunter/survival/constants'; import SPELLS from 'common/SPELLS'; import Spell from 'common/SPELLS/Spell'; class SurvivalFocusUsage extends SharedHunterFocusUsage { static listOfResourceSpenders: Spell[] = [ ...LIST_OF_FOCUS_SPENDERS_SV, ]; static spellsThatShouldShowAsOtherSpells: { [key: number]: { id: number, name: string, abilityIcon: string, type: number } } = { [SPELLS.MONGOOSE_BITE_TALENT_AOTE.id]: SPELLS.MONGOOSE_BITE_TALENT, [SPELLS.RAPTOR_STRIKE_AOTE.id]: SPELLS.RAPTOR_STRIKE, }; } export default SurvivalFocusUsage;
Fix a crash in Survival when viewing the timeline
[Hunter] Fix a crash in Survival when viewing the timeline
TypeScript
agpl-3.0
anom0ly/WoWAnalyzer,Juko8/WoWAnalyzer,anom0ly/WoWAnalyzer,sMteX/WoWAnalyzer,anom0ly/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,yajinni/WoWAnalyzer,Juko8/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,yajinni/WoWAnalyzer,yajinni/WoWAnalyzer,sMteX/WoWAnalyzer,sMteX/WoWAnalyzer,yajinni/WoWAnalyzer,Juko8/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,anom0ly/WoWAnalyzer
--- +++ @@ -2,7 +2,6 @@ import { LIST_OF_FOCUS_SPENDERS_SV } from 'parser/hunter/survival/constants'; import SPELLS from 'common/SPELLS'; import Spell from 'common/SPELLS/Spell'; -import { Ability } from 'parser/core/Events'; class SurvivalFocusUsage extends SharedHunterFocusUsage { @@ -10,7 +9,7 @@ ...LIST_OF_FOCUS_SPENDERS_SV, ]; - static spellsThatShouldShowAsOtherSpells: { [key: number]: Ability } = { + static spellsThatShouldShowAsOtherSpells: { [key: number]: { id: number, name: string, abilityIcon: string, type: number } } = { [SPELLS.MONGOOSE_BITE_TALENT_AOTE.id]: SPELLS.MONGOOSE_BITE_TALENT, [SPELLS.RAPTOR_STRIKE_AOTE.id]: SPELLS.RAPTOR_STRIKE, };
3b5c81d82ff6835a5a4d5d98a4c382ccb5898607
src/lib/entry/TestFixture.tsx
src/lib/entry/TestFixture.tsx
import * as React from 'react' import { filter } from 'lodash' import { mount, ReactWrapper } from 'enzyme' import { PluginConstructor, PluginConfig } from '../core/PluginConfig' import { ApplicationContext } from '../core/ApplicationContext' import { ContextProvider } from '../core/ContextProvider' export interface TestFixtureProps { plugins?: PluginConstructor[] markup: React.ReactElement<{}> } export class TestFixture { private reactWrapper: ReactWrapper private markup: React.ReactElement<{}> private appContext: ApplicationContext constructor({ plugins, markup }: TestFixtureProps) { this.appContext = new ApplicationContext(plugins) this.markup = markup } render() { if (!this.reactWrapper) { this.reactWrapper = mount( <ContextProvider appContext={this.appContext}> {this.markup} </ContextProvider> ) } return this.reactWrapper.update() } stub<T extends PluginConfig>(ctor: PluginConstructor<T>, stubFn: (fn: T) => void) { const matches = filter(this.appContext.plugins, (x) => x instanceof ctor) matches.forEach(stubFn) return this } }
import * as React from 'react' import { filter } from 'lodash' import { mount, ReactWrapper } from 'enzyme' import { PluginConstructor, PluginConfig } from '../core/PluginConfig' import { ApplicationContext } from '../core/ApplicationContext' import { ContextProvider } from '../core/ContextProvider' export interface TestFixtureProps { plugins?: PluginConstructor[] markup: React.ReactElement<{}> } export class TestFixture { private reactWrapper: ReactWrapper private markup: React.ReactElement<{}> private appContext: ApplicationContext constructor({ plugins, markup }: TestFixtureProps) { this.appContext = new ApplicationContext(plugins) this.markup = markup } render() { if (!this.reactWrapper) { this.reactWrapper = mount( <ContextProvider appContext={this.appContext}> {this.markup} </ContextProvider> ) } return this.reactWrapper.update() } stub<T extends PluginConfig>(ctor: PluginConstructor<T>, stubFn: (fn: T) => void) { const matches = filter(this.appContext.plugins, (x) => x instanceof ctor) matches.forEach(stubFn) return this } getInstance<T>() { return this.render().childAt(0).instance() as any as T } }
Add helper for getting component instance to TestFIxture
Add helper for getting component instance to TestFIxture
TypeScript
mit
brightinteractive/bright-js-framework,brightinteractive/bright-js-framework,brightinteractive/bright-js-framework
--- +++ @@ -38,4 +38,8 @@ return this } + + getInstance<T>() { + return this.render().childAt(0).instance() as any as T + } }
cd87279f44661cb390bb68b7e989667606b5e728
web-ng/src/test.ts
web-ng/src/test.ts
/** * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the 'License'); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an 'AS IS' BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // This file is required by karma.conf.js and loads recursively all the .spec and framework files import 'zone.js/dist/zone-testing'; import { getTestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, platformBrowserDynamicTesting, } from '@angular/platform-browser-dynamic/testing'; declare const require: NodeRequire; // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( BrowserDynamicTestingModule, platformBrowserDynamicTesting() ); // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); // And load the modules. context.keys().map(context);
/** * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the 'License'); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an 'AS IS' BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // This file is required by karma.conf.js and loads recursively all the .spec and framework files import 'zone.js/dist/zone-testing'; import { getTestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, platformBrowserDynamicTesting, } from '@angular/platform-browser-dynamic/testing'; declare const require: any; // First, initialize the Angular testing environment. getTestBed().initTestEnvironment( BrowserDynamicTestingModule, platformBrowserDynamicTesting() ); // Then we find all the tests. const context = require.context('./', true, /\.spec\.ts$/); // And load the modules. context.keys().map(context);
Switch back to any type for require as it has no typing
Switch back to any type for require as it has no typing
TypeScript
apache-2.0
google/ground-platform,google/ground-platform,google/ground-platform,google/ground-platform
--- +++ @@ -23,7 +23,7 @@ platformBrowserDynamicTesting, } from '@angular/platform-browser-dynamic/testing'; -declare const require: NodeRequire; +declare const require: any; // First, initialize the Angular testing environment. getTestBed().initTestEnvironment(
d5829b679759e429605217387fb8bc0feca0fecf
controllers/user.controller.ts
controllers/user.controller.ts
import { Request, Response } from "express" import { IUser } from "../models/user.model" import { notFound } from "Boom" import { userModel } from "../models/user.model" class UserController { public infoUser(req: Request, res: Response) { const id = req.body.id userModel.findById(id) .then((user: IUser) => { res.json(user) }) .catch((error) => { res.json(notFound(error)) }) } } export const userController = new UserController()
import { Request, Response } from "express" import { IUser } from "../models/user.model" import { notFound } from "Boom" import { userModel } from "../models/user.model" class UserController { public async infoUser(req: Request, res: Response) { const id = req.body.id const user = await userModel.findById(id) user ? res.json(user) : res.json(notFound()) } } export const userController = new UserController()
Switch from Promises to Async Await
Switch from Promises to Async Await
TypeScript
mit
xeoneux/TypeMonPress
--- +++ @@ -6,16 +6,11 @@ class UserController { - public infoUser(req: Request, res: Response) { + public async infoUser(req: Request, res: Response) { const id = req.body.id - userModel.findById(id) - .then((user: IUser) => { - res.json(user) - }) - .catch((error) => { - res.json(notFound(error)) - }) + const user = await userModel.findById(id) + user ? res.json(user) : res.json(notFound()) } }
32d4f0e1245fa44728623dc6a04e05d3144dad63
src/utils/handleResponse.ts
src/utils/handleResponse.ts
export async function handleResponse(res : Response) : Promise<any> { const data = await res.json(); if (res.status < 300) { return data; } if (data.error) { throw new Error(data.error); } throw new Error(res.status.toString()); }
export function handleResponse(res : Response) : Promise<any> { return res.json().then(data => { if (res.status < 300) { return data; } if (data.error) { throw new Error(data.error); } throw new Error(res.status.toString()); }); }
Replace async function with Promise
Replace async function with Promise
TypeScript
mit
woubuc/node-updown,woubuc/node-updown
--- +++ @@ -1,13 +1,13 @@ -export async function handleResponse(res : Response) : Promise<any> { - const data = await res.json(); - - if (res.status < 300) { - return data; - } - - if (data.error) { - throw new Error(data.error); - } - - throw new Error(res.status.toString()); +export function handleResponse(res : Response) : Promise<any> { + return res.json().then(data => { + if (res.status < 300) { + return data; + } + + if (data.error) { + throw new Error(data.error); + } + + throw new Error(res.status.toString()); + }); }
e2099c0a3a8cbb568797066a7374fffcdd3412ed
ui/src/Navbar.tsx
ui/src/Navbar.tsx
import React, { CSSProperties, useContext } from 'react'; import { Navbar, Nav } from 'react-bootstrap'; import { useLocation, Link } from 'react-router-dom'; import { JwtContext } from './App'; export default () => { const location = useLocation(); const jwtContext = useContext(JwtContext); return ( <Navbar variant="dark" style={ navbarStyle }> <Navbar.Brand href="/">iDAI.<strong>field</strong></Navbar.Brand> <Nav activeKey={ location.pathname }> <Nav.Link as="span"> <Link to="/">Projekte</Link> </Nav.Link> <Nav.Link as="span"> <Link to="/download">Download</Link> </Nav.Link> <Nav.Link as="span"> <Link to="/manual">Handbuch</Link> </Nav.Link> </Nav> <Navbar.Text>{ jwtContext.user }</Navbar.Text> </Navbar> ); }; const navbarStyle: CSSProperties = { backgroundImage: 'linear-gradient(to right, rgba(106,164,184,0.95) 0%, #557ebb 100%)' };
import React, { CSSProperties, useContext } from 'react'; import { Navbar, Nav } from 'react-bootstrap'; import { useLocation, Link } from 'react-router-dom'; import { JwtContext } from './App'; export default () => { const location = useLocation(); const jwtContext = useContext(JwtContext); return ( <Navbar variant="dark" style={ navbarStyle }> <Navbar.Brand href="/">iDAI.<strong>field</strong></Navbar.Brand> <Nav activeKey={ location.pathname } className="mr-auto"> <Nav.Link as="span"> <Link to="/">Projekte</Link> </Nav.Link> <Nav.Link as="span"> <Link to="/download">Download</Link> </Nav.Link> <Nav.Link as="span"> <Link to="/manual">Handbuch</Link> </Nav.Link> </Nav> <Navbar.Text className="mr-sm-2">{ renderLogin(jwtContext) }</Navbar.Text> </Navbar> ); }; const renderLogin = (jwtContext: any) => jwtContext.user === 'anonymous' ? <Link to="/login">Login</Link> : <span>Eingeloggt als: { jwtContext.user }</span>; const navbarStyle: CSSProperties = { backgroundImage: 'linear-gradient(to right, rgba(106,164,184,0.95) 0%, #557ebb 100%)' };
Add Login button to navbar
Add Login button to navbar
TypeScript
apache-2.0
dainst/idai-field-web,dainst/idai-field-web,dainst/idai-field-web
--- +++ @@ -11,7 +11,7 @@ return ( <Navbar variant="dark" style={ navbarStyle }> <Navbar.Brand href="/">iDAI.<strong>field</strong></Navbar.Brand> - <Nav activeKey={ location.pathname }> + <Nav activeKey={ location.pathname } className="mr-auto"> <Nav.Link as="span"> <Link to="/">Projekte</Link> </Nav.Link> @@ -22,11 +22,18 @@ <Link to="/manual">Handbuch</Link> </Nav.Link> </Nav> - <Navbar.Text>{ jwtContext.user }</Navbar.Text> + <Navbar.Text className="mr-sm-2">{ renderLogin(jwtContext) }</Navbar.Text> </Navbar> ); }; + +const renderLogin = (jwtContext: any) => + jwtContext.user === 'anonymous' + ? <Link to="/login">Login</Link> + : <span>Eingeloggt als: { jwtContext.user }</span>; + + const navbarStyle: CSSProperties = { backgroundImage: 'linear-gradient(to right, rgba(106,164,184,0.95) 0%, #557ebb 100%)' };
772c35fcee84d3b95fcd7dc800003ad95a0419a0
src/SyntaxNodes/OrderedListNode.ts
src/SyntaxNodes/OrderedListNode.ts
import { SyntaxNode } from '../SyntaxNodes/SyntaxNode' import { RichSyntaxNode } from '../SyntaxNodes/RichSyntaxNode' export enum ListOrder { Ascending, Descrending } export class OrderedListNode extends RichSyntaxNode { constructor( parentOrChildren?: RichSyntaxNode | SyntaxNode[], public order = ListOrder.Ascending, public start = 1 ) { super(parentOrChildren) } private NUMBERED_LIST: any = null }
import { SyntaxNode } from '../SyntaxNodes/SyntaxNode' import { RichSyntaxNode } from '../SyntaxNodes/RichSyntaxNode' import { OrderedListItemNode } from '../SyntaxNodes/OrderedListItemNode' export enum ListOrder { Ascending, Descrending } export class OrderedListNode extends RichSyntaxNode { constructor(parentOrChildren?: RichSyntaxNode | SyntaxNode[], public order = ListOrder.Ascending) { super(parentOrChildren) } start(): number { return (<OrderedListItemNode>this.children[0]).ordinal } private NUMBERED_LIST: any = null }
Change ordered list node's start field to a method
Change ordered list node's start field to a method
TypeScript
mit
start/up,start/up
--- +++ @@ -1,5 +1,6 @@ import { SyntaxNode } from '../SyntaxNodes/SyntaxNode' import { RichSyntaxNode } from '../SyntaxNodes/RichSyntaxNode' +import { OrderedListItemNode } from '../SyntaxNodes/OrderedListItemNode' export enum ListOrder { Ascending, @@ -7,12 +8,12 @@ } export class OrderedListNode extends RichSyntaxNode { - constructor( - parentOrChildren?: RichSyntaxNode | SyntaxNode[], - public order = ListOrder.Ascending, - public start = 1 - ) { + constructor(parentOrChildren?: RichSyntaxNode | SyntaxNode[], public order = ListOrder.Ascending) { super(parentOrChildren) + } + + start(): number { + return (<OrderedListItemNode>this.children[0]).ordinal } private NUMBERED_LIST: any = null
842ec912ac6ea531009dfa97db1025f76ae8e23a
src/app/browse/browse.component.ts
src/app/browse/browse.component.ts
import {Component, OnInit} from '@angular/core'; import {NavigationService} from "../navigation.service"; import {ActivatedRoute} from "@angular/router"; @Component({ selector: 'app-results', templateUrl: './browse.component.html', styleUrls: ['./browse.component.scss'] }) export class BrowseComponent implements OnInit { categories = []; constructor(private navigation: NavigationService, private route: ActivatedRoute) { } ngOnInit() { this.route.params.subscribe(params => { const categoryId = NavigationService.getCategoryId([params['categoryId'], params['subcategoryId']]); const category = this.navigation.getCategory(categoryId); if (!category.isLeaf()) { this.categories = category.categories; } else { this.categories = []; } }); } }
import {Component, OnInit} from '@angular/core'; import {NavigationService} from "../navigation.service"; import {ActivatedRoute} from "@angular/router"; @Component({ selector: 'app-results', templateUrl: './browse.component.html', styleUrls: ['./browse.component.scss'] }) export class BrowseComponent implements OnInit { categories = []; constructor(private navigation: NavigationService, private route: ActivatedRoute) { } ngOnInit() { this.route.params.subscribe(params => { const categoryId = NavigationService.getCategoryId([params['categoryId'], params['subcategoryId']]); const category = this.navigation.getCategory(categoryId); if (!category.isLeaf()) { // Remove 'all' category when root category is requested let start = 0; if (categoryId === '/') { start = 1; } this.categories = category.categories.slice(start); } else { this.categories = []; } }); } }
Remove 'all' category when root category is requested
Remove 'all' category when root category is requested
TypeScript
bsd-3-clause
UoA-eResearch/research-hub,UoA-eResearch/research-hub,UoA-eResearch/research-hub
--- +++ @@ -21,7 +21,13 @@ const category = this.navigation.getCategory(categoryId); if (!category.isLeaf()) { - this.categories = category.categories; + // Remove 'all' category when root category is requested + let start = 0; + if (categoryId === '/') { + start = 1; + } + + this.categories = category.categories.slice(start); } else { this.categories = []; }
c98176a2120adc18bdf1020864da1323e1ea9d00
src/app/header/header.component.ts
src/app/header/header.component.ts
import { Component, OnInit, Output, EventEmitter } from '@angular/core'; import { Router, NavigationStart } from '@angular/router'; @Component({ selector: 'app-header', templateUrl: './header.component.html', styleUrls: ['./header.component.scss'] }) export class HeaderComponent implements OnInit { @Output() navToggled = new EventEmitter(); navOpen: boolean = false; constructor(private router: Router) { } ngOnInit() { this.router.events.subscribe(event => { if (event instanceof NavigationStart && this.navOpen) { this.toggleNav(); } }); } toggleNav() { this.navOpen = !this.navOpen; this.navToggled.emit(this.navOpen); } }
import { Component, OnInit, Output, EventEmitter } from '@angular/core'; import { Router, NavigationStart } from '@angular/router'; @Component({ selector: 'app-header', templateUrl: './header.component.html', styleUrls: ['./header.component.scss'] }) export class HeaderComponent implements OnInit { @Output() navToggled = new EventEmitter(); navOpen: boolean = false; constructor(private router: Router) { } ngOnInit() { this.router.events .filter(event => event instanceof NavigationStart && this.navOpen) .subscribe(event => this.toggleNav()); } toggleNav() { this.navOpen = !this.navOpen; this.navToggled.emit(this.navOpen); } }
Improve router events subscription in header.
Improve router events subscription in header.
TypeScript
mit
kmaida/ng2-dinos,kmaida/ng2-dinos,auth0-blog/ng2-dinos,auth0-blog/ng2-dinos,kmaida/ng2-dinos,auth0-blog/ng2-dinos
--- +++ @@ -13,11 +13,9 @@ constructor(private router: Router) { } ngOnInit() { - this.router.events.subscribe(event => { - if (event instanceof NavigationStart && this.navOpen) { - this.toggleNav(); - } - }); + this.router.events + .filter(event => event instanceof NavigationStart && this.navOpen) + .subscribe(event => this.toggleNav()); } toggleNav() {
0dafcfd44bce0edd261d3dfa1428cfef61587492
pages/posts/index.tsx
pages/posts/index.tsx
import { NextPage } from "next" import Page from "../../layouts/main" import postsLoader from "../../data/loaders/PostsLoader" import BlogPost from "../../models/BlogPost" import BlogPostPreview from "../../components/BlogPostPreview" interface Props { posts: BlogPost[] } const PostPage: NextPage<Props> = props => { const { posts } = props return ( <Page> {posts.map(post => { return <BlogPostPreview post={post} key={post.slug} /> })} </Page> ) } interface StaticProps { props: Props } export async function unstable_getStaticProps(): Promise<StaticProps> { const posts = await postsLoader.getPosts() return { props: { posts, }, } } export default PostPage
import { NextPage } from "next" import Page from "../../layouts/main" import postsLoader from "../../data/loaders/PostsLoader" import BlogPost from "../../models/BlogPost" import EntryPreviews from "../../components/EntryPreviews" interface Props { posts: BlogPost[] } const PostPage: NextPage<Props> = props => { const { posts } = props return ( <Page> <EntryPreviews entries={posts} /> </Page> ) } interface StaticProps { props: Props } export async function unstable_getStaticProps(): Promise<StaticProps> { const posts = await postsLoader.getPosts() return { props: { posts, }, } } export default PostPage
Update /posts to use `EntryPreviews`
Update /posts to use `EntryPreviews`
TypeScript
mit
JosephDuffy/josephduffy.co.uk,JosephDuffy/josephduffy.co.uk,JosephDuffy/josephduffy.co.uk
--- +++ @@ -2,7 +2,7 @@ import Page from "../../layouts/main" import postsLoader from "../../data/loaders/PostsLoader" import BlogPost from "../../models/BlogPost" -import BlogPostPreview from "../../components/BlogPostPreview" +import EntryPreviews from "../../components/EntryPreviews" interface Props { posts: BlogPost[] @@ -12,9 +12,7 @@ const { posts } = props return ( <Page> - {posts.map(post => { - return <BlogPostPreview post={post} key={post.slug} /> - })} + <EntryPreviews entries={posts} /> </Page> ) }
207a54238614da20e2deb570b4fa3b7f3b5834b2
resources/app/dashboard/components/parking/receipt/receipt.component.ts
resources/app/dashboard/components/parking/receipt/receipt.component.ts
import { Transition, StateService } from "@uirouter/angularjs"; import { ParkingService } from './../parking.service'; import './receipt.component.scss'; export class ParkingReceiptComponent implements ng.IComponentOptions { static NAME = 'parkingReceiptComponent'; public bindings; public controller; public template; constructor() { this.bindings = { $transition$: '<' }; this.controller = ParkingReceiptController; this.template = require('./receipt.component.html'); } } export class ParkingReceiptController implements ng.IComponentController { private receipt; constructor( private ParkingService, private $state: StateService, private $transition$: Transition, private $window: ng.IWindowService ) { 'ngInject' } $onInit() { if (!this.getReceipt()) { this.$state.go('app.dashboard.student'); } this.receipt = this.getReceipt(); this.saveReceiptToStorage(); } $onDestroy() { this.$window.localStorage.removeItem('receipt') } saveReceiptToStorage() { return this.$window.localStorage.setItem('receipt', this.receipt); } getReceipt() { return this.getReceiptFromStorage() || this.getReceiptFromParams(); } getReceiptFromStorage() { return this.$window.localStorage.getItem('receipt'); } getReceiptFromParams() { return this.$transition$.params('to').receipt; } }
import { Transition, StateService } from "@uirouter/angularjs"; import { ParkingService } from './../parking.service'; import './receipt.component.scss'; export class ParkingReceiptComponent implements ng.IComponentOptions { static NAME = 'parkingReceiptComponent'; public bindings; public controller; public template; constructor() { this.bindings = { $transition$: '<' }; this.controller = ParkingReceiptController; this.template = require('./receipt.component.html'); } } export class ParkingReceiptController implements ng.IComponentController { private receipt; private $transition$: Transition; constructor( private ParkingService, private $state: StateService, private $window: ng.IWindowService ) { 'ngInject' } $onInit() { if (!this.getReceipt()) { this.$state.go('app.dashboard.student'); } this.receipt = this.getReceipt(); this.saveReceiptToStorage(); } $onDestroy() { this.$window.localStorage.removeItem('receipt') } saveReceiptToStorage() { return this.$window.localStorage.setItem('receipt', this.receipt); } getReceipt() { return this.getReceiptFromStorage() || this.getReceiptFromParams(); } getReceiptFromStorage() { return this.$window.localStorage.getItem('receipt'); } getReceiptFromParams() { return this.$transition$.params('to').receipt; } }
Fix $transition$ error placed in controller param
Fix $transition$ error placed in controller param $transition$ is not a dependency injection, thus it will spit out an error. But it is passed as binding.
TypeScript
mit
ibnumalik/ibnumalik.github.io,ibnumalik/ibnumalik.github.io,ibnumalik/ibnumalik.github.io
--- +++ @@ -19,11 +19,11 @@ export class ParkingReceiptController implements ng.IComponentController { private receipt; + private $transition$: Transition; constructor( private ParkingService, private $state: StateService, - private $transition$: Transition, private $window: ng.IWindowService ) { 'ngInject' }
3b3050e11da73aed4b2d393141e2568fa133b740
app/hero.service.ts
app/hero.service.ts
import { Injectable } from '@angular/core'; @Injectable() export class HeroService { }
import { Injectable } from '@angular/core'; @Injectable() export class HeroService { getHeroes(): void {} // stub }
Add a getHeroes method stub.
Add a getHeroes method stub.
TypeScript
mit
amalshehu/angular-tour-of-heroes,amalshehu/angular-tour-of-heroes,amalshehu/angular-tour-of-heroes
--- +++ @@ -2,4 +2,5 @@ @Injectable() export class HeroService { + getHeroes(): void {} // stub }
b64567d738db70b5663330d2a407c228224ca057
src/main.ts
src/main.ts
import * as DomUtils from './utils/dom' import * as PathUtils from './utils/path' import {dispatch} from './dispatch' import {log} from './utils/log' import {DictionaryService} from './utils/dict' import {Sidebar} from './dom/sidebar' import {ControlPanel} from './dom/controlPanel' import {MiniTranslationModal} from './dom/miniTranslationModal' DomUtils.initialize(); let page = dispatch(unsafeWindow.location.href, $); let controlPanel = new ControlPanel({ userDictionary: DictionaryService.userDictionary, rootDictionary: DictionaryService.baseDictionary, page: page }); let translationModal = new MiniTranslationModal(DictionaryService.userDictionary); translationModal.listen(MiniTranslationModal.events.addedTranslation, () => { page.translateTagsOnPage(); }); let togglePanel = { id: 'pa_toggle_control_panel', label: 'Control Panel', color: 'green', icon: 'equalizer', execute: () => controlPanel.toggleVisibility() }; let toggleTranslationModal = { id: 'pa_toggle_translation_modal', label: 'Add Translation', color: 'green', icon: 'plus', execute: () => translationModal.toggleVisibility() }; let sidebar = new Sidebar(page.actionCache.concat([toggleTranslationModal, togglePanel])); DomUtils.render([sidebar, controlPanel, translationModal]);
import * as DomUtils from './utils/dom' import * as PathUtils from './utils/path' import {dispatch} from './dispatch' import {log} from './utils/log' import {DictionaryService} from './utils/dict' import {Sidebar} from './dom/sidebar' import {ControlPanel} from './dom/controlPanel' import {MiniTranslationModal} from './dom/miniTranslationModal' DomUtils.initialize(); let page = dispatch(unsafeWindow.location.href, $); let controlPanel = new ControlPanel({ userDictionary: DictionaryService.userDictionary, rootDictionary: DictionaryService.baseDictionary, page: page }); let translationModal = new MiniTranslationModal(DictionaryService.userDictionary); translationModal.listen(MiniTranslationModal.events.addedTranslation, () => { page.translateTagsOnPage(); translationModal.toggleVisibility(); }); let togglePanel = { id: 'pa_toggle_control_panel', label: 'Control Panel', color: 'green', icon: 'equalizer', execute: () => controlPanel.toggleVisibility() }; let toggleTranslationModal = { id: 'pa_toggle_translation_modal', label: 'Add Translation', color: 'green', icon: 'plus', execute: () => translationModal.toggleVisibility() }; let sidebar = new Sidebar(page.actionCache.concat([toggleTranslationModal, togglePanel])); DomUtils.render([sidebar, controlPanel, translationModal]);
Add translation mini modal now closes after item is added
Add translation mini modal now closes after item is added
TypeScript
mit
paarthenon/pixiv-assistant,paarthenon/pixiv-assistant,paarthk/pixiv-assistant,paarthk/pixiv-assistant
--- +++ @@ -23,6 +23,7 @@ let translationModal = new MiniTranslationModal(DictionaryService.userDictionary); translationModal.listen(MiniTranslationModal.events.addedTranslation, () => { page.translateTagsOnPage(); + translationModal.toggleVisibility(); }); let togglePanel = {
f65036ffcd8e26581cf3585d20f647633c97d572
polygerrit-ui/app/elements/gr-app-init.ts
polygerrit-ui/app/elements/gr-app-init.ts
/** * @license * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import {initAppContext} from '../services/app-context-init'; import { initVisibilityReporter, initPerformanceReporter, initErrorReporter, } from '../services/gr-reporting/gr-reporting_impl'; import {appContext} from '../services/app-context'; interface UninitializedPolymer { lazyRegister: boolean; } if (!window.Polymer) { // Without as... it violates internal google rules. ((window.Polymer as unknown) as UninitializedPolymer) = { lazyRegister: true, }; } initAppContext(); initVisibilityReporter(appContext); initPerformanceReporter(appContext); initErrorReporter(appContext);
/** * @license * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import {initAppContext} from '../services/app-context-init'; import { initVisibilityReporter, initPerformanceReporter, initErrorReporter, } from '../services/gr-reporting/gr-reporting_impl'; import {appContext} from '../services/app-context'; initAppContext(); initVisibilityReporter(appContext); initPerformanceReporter(appContext); initErrorReporter(appContext);
Remove obsolete setting of lazyRegister
Remove obsolete setting of lazyRegister This is always true anyway since Polymer 2. Change-Id: I5948a888a366b6efad5426b66f12d89ede11df04
TypeScript
apache-2.0
GerritCodeReview/gerrit,GerritCodeReview/gerrit,GerritCodeReview/gerrit,GerritCodeReview/gerrit,GerritCodeReview/gerrit,GerritCodeReview/gerrit,GerritCodeReview/gerrit,GerritCodeReview/gerrit
--- +++ @@ -22,17 +22,6 @@ } from '../services/gr-reporting/gr-reporting_impl'; import {appContext} from '../services/app-context'; -interface UninitializedPolymer { - lazyRegister: boolean; -} - -if (!window.Polymer) { - // Without as... it violates internal google rules. - ((window.Polymer as unknown) as UninitializedPolymer) = { - lazyRegister: true, - }; -} - initAppContext(); initVisibilityReporter(appContext); initPerformanceReporter(appContext);
e808ef5f244b210077601165b05775c83b9c62d9
packages/selenium-ide/src/main/session/controllers/Menu/menus/application.ts
packages/selenium-ide/src/main/session/controllers/Menu/menus/application.ts
import { Menu } from 'electron' import { Session } from 'main/types' import { editBasicsCommands } from './editBasics' import { projectEditorCommands } from './projectEditor' import { testEditorCommands } from './testEditor' import { projectViewCommands } from './projectView' const applicationMenu = (session: Session) => async () => Menu.buildFromTemplate([ { label: 'Selenium IDE', submenu: [ { role: 'about' }, { type: 'separator' }, { role: 'services' }, { type: 'separator' }, { role: 'hide' }, { role: 'hideOthers' }, { role: 'unhide' }, { type: 'separator' }, { accelerator: 'CommandOrControl+Q', label: 'Quit', click: async () => { await session.system.quit() }, }, ], }, { label: '&File', submenu: await projectEditorCommands(session)(), }, { label: '&Edit', submenu: [ ...(await editBasicsCommands(session)()), ...(await testEditorCommands(session)()), ], }, { label: '&View', submenu: await projectViewCommands(session)(), }, ]) export default applicationMenu
import { Menu } from 'electron' import { Session } from 'main/types' import { editBasicsCommands } from './editBasics' import { projectEditorCommands } from './projectEditor' import { testEditorCommands } from './testEditor' import { projectViewCommands } from './projectView' import { platform } from 'os' const applicationMenu = (session: Session) => async () => Menu.buildFromTemplate([ { label: 'Selenium IDE', submenu: [ { role: 'about' }, { type: 'separator' }, { role: 'services' }, { type: 'separator' }, { role: 'hide' }, { role: 'hideOthers' }, { role: 'unhide' }, { type: 'separator' }, { accelerator: platform() === 'win32' ? 'Alt+F4' : 'CommandOrControl+Q', label: 'Quit', click: async () => { await session.system.quit() }, }, ], }, { label: '&File', submenu: await projectEditorCommands(session)(), }, { label: '&Edit', submenu: [ ...(await editBasicsCommands(session)()), ...(await testEditorCommands(session)()), ], }, { label: '&View', submenu: await projectViewCommands(session)(), }, ]) export default applicationMenu
Make quit control feel better on Windows
Make quit control feel better on Windows
TypeScript
apache-2.0
SeleniumHQ/selenium-ide,SeleniumHQ/selenium-ide,SeleniumHQ/selenium-ide
--- +++ @@ -4,6 +4,7 @@ import { projectEditorCommands } from './projectEditor' import { testEditorCommands } from './testEditor' import { projectViewCommands } from './projectView' +import { platform } from 'os' const applicationMenu = (session: Session) => async () => Menu.buildFromTemplate([ @@ -19,7 +20,7 @@ { role: 'unhide' }, { type: 'separator' }, { - accelerator: 'CommandOrControl+Q', + accelerator: platform() === 'win32' ? 'Alt+F4' : 'CommandOrControl+Q', label: 'Quit', click: async () => { await session.system.quit()
d9e6d03e769ee7013bee70e4f73c8e59d932d91d
globalize/globalize-0.1.3.d.ts
globalize/globalize-0.1.3.d.ts
// Type definitions for Globalize v?.? NuGet package v0.1.3 // Project: https://github.com/jquery/globalize // Definitions by: Aram Taieb <https://github.com/afromogli/> // Definitions: https://github.com/afromogli/DefinitelyTyped interface GlobalizeStatic { addCultureInfo(cultureName: string, baseCultureName: string, info: any): void; findClosestCulture(name: string): any; format(value: any, format: string): string; format(value: any, format: string, cultureSelector: string): string; localize(key: string): string; localize(key: string, cultureSelector: string): string; parseDate(value: any): Date; parseDate(value: any, formats: any): Date; parseDate(value: any, formats: any, culture: string): Date; parseInt(value: any): number; parseInt(value: any, radix: number): number; parseInt(value: any, radix: number, cultureSelector: string): number; parseFloat(value: any): number; parseFloat(value: any, radix: number): number; parseFloat(value: any, radix: number, cultureSelector: string): number; culture(cultureSelector: string): any; } declare var Globalize: GlobalizeStatic;
// Type definitions for Globalize v0.1.3 (NuGet package version) // Project: https://github.com/jquery/globalize // Definitions by: Aram Taieb <https://github.com/afromogli/> // Definitions: https://github.com/afromogli/DefinitelyTyped interface GlobalizeStatic { addCultureInfo(cultureName: string, baseCultureName: string, info: any): void; findClosestCulture(name: string): any; format(value: any, format: string): string; format(value: any, format: string, cultureSelector: string): string; localize(key: string): string; localize(key: string, cultureSelector: string): string; parseDate(value: any): Date; parseDate(value: any, formats: any): Date; parseDate(value: any, formats: any, culture: string): Date; parseInt(value: any): number; parseInt(value: any, radix: number): number; parseInt(value: any, radix: number, cultureSelector: string): number; parseFloat(value: any): number; parseFloat(value: any, radix: number): number; parseFloat(value: any, radix: number, cultureSelector: string): number; culture(cultureSelector: string): any; } declare var Globalize: GlobalizeStatic;
Set NuGet version 0.1.3 as Globalize version.
Set NuGet version 0.1.3 as Globalize version.
TypeScript
mit
chrootsu/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,alexdresko/DefinitelyTyped,psnider/DefinitelyTyped,arma-gast/DefinitelyTyped,mattblang/DefinitelyTyped,Penryn/DefinitelyTyped,martinduparc/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,gcastre/DefinitelyTyped,AgentME/DefinitelyTyped,paulmorphy/DefinitelyTyped,EnableSoftware/DefinitelyTyped,musicist288/DefinitelyTyped,Litee/DefinitelyTyped,hellopao/DefinitelyTyped,martinduparc/DefinitelyTyped,alexdresko/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,alvarorahul/DefinitelyTyped,benishouga/DefinitelyTyped,frogcjn/DefinitelyTyped,rcchen/DefinitelyTyped,rolandzwaga/DefinitelyTyped,isman-usoh/DefinitelyTyped,chrootsu/DefinitelyTyped,arusakov/DefinitelyTyped,Ptival/DefinitelyTyped,axelcostaspena/DefinitelyTyped,yuit/DefinitelyTyped,mhegazy/DefinitelyTyped,daptiv/DefinitelyTyped,minodisk/DefinitelyTyped,schmuli/DefinitelyTyped,Litee/DefinitelyTyped,Ptival/DefinitelyTyped,arusakov/DefinitelyTyped,damianog/DefinitelyTyped,HPFOD/DefinitelyTyped,georgemarshall/DefinitelyTyped,rcchen/DefinitelyTyped,jimthedev/DefinitelyTyped,borisyankov/DefinitelyTyped,johan-gorter/DefinitelyTyped,YousefED/DefinitelyTyped,chrismbarr/DefinitelyTyped,ashwinr/DefinitelyTyped,scriby/DefinitelyTyped,progre/DefinitelyTyped,syuilo/DefinitelyTyped,ashwinr/DefinitelyTyped,jraymakers/DefinitelyTyped,yuit/DefinitelyTyped,shlomiassaf/DefinitelyTyped,tan9/DefinitelyTyped,paulmorphy/DefinitelyTyped,nainslie/DefinitelyTyped,sledorze/DefinitelyTyped,nycdotnet/DefinitelyTyped,stephenjelfs/DefinitelyTyped,aciccarello/DefinitelyTyped,tan9/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,gcastre/DefinitelyTyped,raijinsetsu/DefinitelyTyped,abbasmhd/DefinitelyTyped,florentpoujol/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,subash-a/DefinitelyTyped,hellopao/DefinitelyTyped,AgentME/DefinitelyTyped,mareek/DefinitelyTyped,abbasmhd/DefinitelyTyped,isman-usoh/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,arma-gast/DefinitelyTyped,syuilo/DefinitelyTyped,johan-gorter/DefinitelyTyped,nycdotnet/DefinitelyTyped,Zzzen/DefinitelyTyped,gandjustas/DefinitelyTyped,psnider/DefinitelyTyped,shlomiassaf/DefinitelyTyped,xStrom/DefinitelyTyped,amanmahajan7/DefinitelyTyped,QuatroCode/DefinitelyTyped,psnider/DefinitelyTyped,raijinsetsu/DefinitelyTyped,abner/DefinitelyTyped,newclear/DefinitelyTyped,stephenjelfs/DefinitelyTyped,scriby/DefinitelyTyped,pocesar/DefinitelyTyped,xStrom/DefinitelyTyped,mhegazy/DefinitelyTyped,pocesar/DefinitelyTyped,rolandzwaga/DefinitelyTyped,dsebastien/DefinitelyTyped,abner/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,use-strict/DefinitelyTyped,amanmahajan7/DefinitelyTyped,gandjustas/DefinitelyTyped,jimthedev/DefinitelyTyped,amir-arad/DefinitelyTyped,magny/DefinitelyTyped,frogcjn/DefinitelyTyped,mattblang/DefinitelyTyped,georgemarshall/DefinitelyTyped,mareek/DefinitelyTyped,danfma/DefinitelyTyped,Penryn/DefinitelyTyped,AgentME/DefinitelyTyped,aciccarello/DefinitelyTyped,benishouga/DefinitelyTyped,jimthedev/DefinitelyTyped,use-strict/DefinitelyTyped,HPFOD/DefinitelyTyped,georgemarshall/DefinitelyTyped,zuzusik/DefinitelyTyped,Zzzen/DefinitelyTyped,emanuelhp/DefinitelyTyped,ryan-codingintrigue/DefinitelyTyped,mcliment/DefinitelyTyped,nainslie/DefinitelyTyped,YousefED/DefinitelyTyped,benliddicott/DefinitelyTyped,martinduparc/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,mcrawshaw/DefinitelyTyped,newclear/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,mcrawshaw/DefinitelyTyped,dsebastien/DefinitelyTyped,donnut/DefinitelyTyped,subash-a/DefinitelyTyped,schmuli/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,smrq/DefinitelyTyped,hellopao/DefinitelyTyped,schmuli/DefinitelyTyped,florentpoujol/DefinitelyTyped,borisyankov/DefinitelyTyped,zuzusik/DefinitelyTyped,EnableSoftware/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,chrismbarr/DefinitelyTyped,donnut/DefinitelyTyped,markogresak/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,magny/DefinitelyTyped,minodisk/DefinitelyTyped,AgentME/DefinitelyTyped,danfma/DefinitelyTyped,zuzusik/DefinitelyTyped,smrq/DefinitelyTyped,georgemarshall/DefinitelyTyped,benishouga/DefinitelyTyped,sledorze/DefinitelyTyped,aciccarello/DefinitelyTyped,arusakov/DefinitelyTyped,pocesar/DefinitelyTyped,damianog/DefinitelyTyped,micurs/DefinitelyTyped,alvarorahul/DefinitelyTyped,jraymakers/DefinitelyTyped,emanuelhp/DefinitelyTyped,chbrown/DefinitelyTyped,progre/DefinitelyTyped,one-pieces/DefinitelyTyped,QuatroCode/DefinitelyTyped
--- +++ @@ -1,4 +1,4 @@ -// Type definitions for Globalize v?.? NuGet package v0.1.3 +// Type definitions for Globalize v0.1.3 (NuGet package version) // Project: https://github.com/jquery/globalize // Definitions by: Aram Taieb <https://github.com/afromogli/> // Definitions: https://github.com/afromogli/DefinitelyTyped
83a4dd26be88eaa3733d1a1f128f11c31a968cf5
packages/vanilla/example/index.ts
packages/vanilla/example/index.ts
/* The MIT License Copyright (c) 2017-2019 EclipseSource Munich https://github.com/eclipsesource/jsonforms Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ import { createThemeSelection } from './theme.switcher'; import { stylingReducer, vanillaCells, vanillaRenderers, vanillaStyles } from '../src'; import { renderExample } from '../../example/src/index'; renderExample(vanillaRenderers, vanillaCells, { name: 'styles', reducer: stylingReducer, state: vanillaStyles }); createThemeSelection();
/* The MIT License Copyright (c) 2017-2019 EclipseSource Munich https://github.com/eclipsesource/jsonforms Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ import { createThemeSelection } from './theme.switcher'; import { stylingReducer, vanillaCells, vanillaRenderers, vanillaStyles } from '../src'; import { renderExample } from '../../example/src/index'; renderExample(vanillaRenderers, vanillaCells, undefined, { name: 'styles', reducer: stylingReducer, state: vanillaStyles }); createThemeSelection();
Fix Vanilla example app crash
Fix Vanilla example app crash The Vanilla example app wasn't adapted when the 'renderExample' API was extended. This lead to a crash on app startup. This is now fixed.
TypeScript
mit
qb-project/jsonforms,qb-project/jsonforms,qb-project/jsonforms
--- +++ @@ -31,7 +31,7 @@ } from '../src'; import { renderExample } from '../../example/src/index'; -renderExample(vanillaRenderers, vanillaCells, { +renderExample(vanillaRenderers, vanillaCells, undefined, { name: 'styles', reducer: stylingReducer, state: vanillaStyles
6c434c9c63934e2c5944e7361d8be3348cb3907e
coffee-chats/src/main/webapp/src/components/ListItemLink.tsx
coffee-chats/src/main/webapp/src/components/ListItemLink.tsx
import React from "react"; import {Link, useRouteMatch} from "react-router-dom"; import {ListItem, ListItemText} from "@material-ui/core"; export function ListItemLink(props: {to: string, primary: string}) { const {to, primary} = props; const match = useRouteMatch(to)?.isExact; const renderLink = React.useMemo( () => React.forwardRef(itemProps => <Link to={to} {...itemProps} />), [to], ); return ( <ListItem button component={renderLink} selected={match}> <ListItemText primary={primary} /> </ListItem> ); }
import React from "react"; import {Link, useRouteMatch} from "react-router-dom"; import {ListItem, ListItemText} from "@material-ui/core"; interface ListItemLinkProps { to: string primary: string } export function ListItemLink({to, primary}: ListItemLinkProps) { const match = useRouteMatch(to)?.isExact; const renderLink = React.useMemo( () => React.forwardRef(itemProps => <Link to={to} {...itemProps} />), [to], ); return ( <ListItem button component={renderLink} selected={match}> <ListItemText primary={primary} /> </ListItem> ); }
Use destructuring function parameters for props
Use destructuring function parameters for props
TypeScript
apache-2.0
googleinterns/step250-2020,googleinterns/step250-2020,googleinterns/step250-2020,googleinterns/step250-2020
--- +++ @@ -2,9 +2,12 @@ import {Link, useRouteMatch} from "react-router-dom"; import {ListItem, ListItemText} from "@material-ui/core"; -export function ListItemLink(props: {to: string, primary: string}) { - const {to, primary} = props; +interface ListItemLinkProps { + to: string + primary: string +} +export function ListItemLink({to, primary}: ListItemLinkProps) { const match = useRouteMatch(to)?.isExact; const renderLink = React.useMemo(
65faaa35fc42a1c00bd5ef7e7ba1d5676727a45d
src/app/shared/models/index.ts
src/app/shared/models/index.ts
export * from './question.model'; export * from './question.model'; export * from './class.model'; export * from './student.model';
export * from './question.model'; export * from './assignment.model'; export * from './class.model'; export * from './student.model';
Fix models barrel for Assignment
Fix models barrel for Assignment
TypeScript
mit
bryant-pham/brograder,bryant-pham/brograder,bryant-pham/brograder,bryant-pham/brograder
--- +++ @@ -1,4 +1,4 @@ export * from './question.model'; -export * from './question.model'; +export * from './assignment.model'; export * from './class.model'; export * from './student.model';
d7e2b2094f7bfd31be72f8e20a2c106aae246576
source/features/set-default-repositories-type-to-sources.tsx
source/features/set-default-repositories-type-to-sources.tsx
import select from 'select-dom'; import features from '../libs/features'; function init() { // Get repositories link from user profile navigation const link = select<HTMLAnchorElement>('.user-profile-nav a[href*="tab=repositories"]'); if (!link) { return false; } link.search += '&type=source'; } features.add({ id: 'set-default-repositories-type-to-sources', include: [ features.isUserProfile ], load: features.onAjaxedPages, init });
import select from 'select-dom'; import features from '../libs/features'; function init() { const links = select.all<HTMLAnchorElement>([ '.user-profile-nav [href$="tab=repositories"]', // "Your repositories" in header dropdown '#user-links [href$="tab=repositories"]' // "Repositories" tab on profile ].join()); for (const link of links) { link.search += '&type=source'; } } features.add({ id: 'set-default-repositories-type-to-sources', load: features.onAjaxedPages, init });
Include "Your repositories" link in `...repositories...-to-sources`
Include "Your repositories" link in `...repositories...-to-sources`
TypeScript
mit
sindresorhus/refined-github,busches/refined-github,busches/refined-github,sindresorhus/refined-github
--- +++ @@ -2,21 +2,18 @@ import features from '../libs/features'; function init() { - // Get repositories link from user profile navigation - const link = select<HTMLAnchorElement>('.user-profile-nav a[href*="tab=repositories"]'); + const links = select.all<HTMLAnchorElement>([ + '.user-profile-nav [href$="tab=repositories"]', // "Your repositories" in header dropdown + '#user-links [href$="tab=repositories"]' // "Repositories" tab on profile + ].join()); - if (!link) { - return false; + for (const link of links) { + link.search += '&type=source'; } - - link.search += '&type=source'; } features.add({ id: 'set-default-repositories-type-to-sources', - include: [ - features.isUserProfile - ], load: features.onAjaxedPages, init });
984fd64c95789b2826ca2adeee0830b131eb2755
public/app/models/game.ts
public/app/models/game.ts
export class Game { _id: string; pgn: string; analysis: { moves: [ { bestMove: string, score: string } ], status: string, progress: number }; white: string; black: string; whiteElo: string; blackElo: string; round: string; result: string; event: string; site: string; datePlayed: string; dateUploaded: Date; uploadedByUserId: string; }
export class Game { _id: string; pgn: string; analysis: { moves: [ { bestMove: string, score: { cp: string, mate: string } } ], status: string, progress: number }; white: string; black: string; whiteElo: string; blackElo: string; round: string; result: string; event: string; site: string; datePlayed: string; dateUploaded: Date; uploadedByUserId: string; }
Update the front end model with new score model
Update the front end model with new score model
TypeScript
mit
revov/uci-gui,revov/uci-gui
--- +++ @@ -5,7 +5,10 @@ moves: [ { bestMove: string, - score: string + score: { + cp: string, + mate: string + } } ], status: string,
acbcca11021f1c79254ff8744b36206830efacc9
public/app/types/store.ts
public/app/types/store.ts
import { NavIndex } from './navModel'; import { LocationState } from './location'; import { AlertRulesState } from './alerting'; import { TeamsState, TeamState } from './teams'; import { FolderState } from './folders'; import { DashboardState } from './dashboard'; import { DataSourcesState } from './datasources'; import { ExploreState } from './explore'; import { UsersState, UserState } from './user'; import { OrganizationState } from './organization'; import { AppNotificationsState } from './appNotifications'; export interface StoreState { navIndex: NavIndex; location: LocationState; alertRules: AlertRulesState; teams: TeamsState; team: TeamState; folder: FolderState; dashboard: DashboardState; dataSources: DataSourcesState; explore: ExploreState; users: UsersState; organization: OrganizationState; appNotifications: AppNotificationsState; user: UserState; }
import { NavIndex } from './navModel'; import { LocationState } from './location'; import { AlertRulesState } from './alerting'; import { TeamsState, TeamState } from './teams'; import { FolderState } from './folders'; import { DashboardState } from './dashboard'; import { DataSourcesState } from './datasources'; import { ExploreState } from './explore'; import { UsersState, UserState } from './user'; import { OrganizationState } from './organization'; import { AppNotificationsState } from './appNotifications'; import { PluginsState } from './plugins'; export interface StoreState { navIndex: NavIndex; location: LocationState; alertRules: AlertRulesState; teams: TeamsState; team: TeamState; folder: FolderState; dashboard: DashboardState; dataSources: DataSourcesState; explore: ExploreState; users: UsersState; organization: OrganizationState; appNotifications: AppNotificationsState; user: UserState; plugins: PluginsState; }
Add plugins to StoreState interface
fix: Add plugins to StoreState interface
TypeScript
agpl-3.0
grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana
--- +++ @@ -9,6 +9,7 @@ import { UsersState, UserState } from './user'; import { OrganizationState } from './organization'; import { AppNotificationsState } from './appNotifications'; +import { PluginsState } from './plugins'; export interface StoreState { navIndex: NavIndex; @@ -24,4 +25,5 @@ organization: OrganizationState; appNotifications: AppNotificationsState; user: UserState; + plugins: PluginsState; }
7cafb66e02390fb55b1201414b99e0324322a71a
source/game/objects/gameFeatureObject.ts
source/game/objects/gameFeatureObject.ts
/** Copyright (C) 2013 by Justin DuJardin Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /// <reference path="../../tile/tileObject.ts" /> /// <reference path="../gameTileMap.ts" /> module pow2 { export class GameFeatureObject extends pow2.TileObject { tileMap:GameTileMap; feature:any; // TODO: Feature Interface type: string; // TODO: enum? passable:boolean; groups:any; constructor(options:any) { super(_.omit(options || {},["x","y","type"])); this.feature = options; this.point.x = options.x; this.point.y = options.y; this.type = options.type; this.groups = typeof options.groups === 'string' ? JSON.parse(options.groups) : options.groups; } } }
/** Copyright (C) 2013 by Justin DuJardin Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /// <reference path="../../tile/tileObject.ts" /> /// <reference path="../gameTileMap.ts" /> module pow2 { export class GameFeatureObject extends pow2.TileObject { tileMap:GameTileMap; feature:any; // TODO: Feature Interface type: string; // TODO: enum? passable:boolean; groups:any; frame:number; constructor(options:any) { super(_.omit(options || {},["x","y","type"])); this.feature = options; this.point.x = options.x; this.point.y = options.y; this.type = options.type; this.frame = typeof options.frame !== 'undefined' ? options.frame : 0; this.groups = typeof options.groups === 'string' ? JSON.parse(options.groups) : options.groups; } } }
Fix issue where Ship didn't render in map because GameFeatureObject.frame was undefined.
Fix issue where Ship didn't render in map because GameFeatureObject.frame was undefined.
TypeScript
apache-2.0
justindujardin/pow2,justindujardin/pow2,justindujardin/pow2
--- +++ @@ -24,12 +24,14 @@ type: string; // TODO: enum? passable:boolean; groups:any; + frame:number; constructor(options:any) { super(_.omit(options || {},["x","y","type"])); this.feature = options; this.point.x = options.x; this.point.y = options.y; this.type = options.type; + this.frame = typeof options.frame !== 'undefined' ? options.frame : 0; this.groups = typeof options.groups === 'string' ? JSON.parse(options.groups) : options.groups; } }
321d8a012539dadc4169dd6305aeafdaa66b5424
src/schema/MemberRef.ts
src/schema/MemberRef.ts
// This file is part of cxsd, copyright (c) 2016 BusFaster Ltd. // Released under the MIT license, see LICENSE. import {Namespace} from './Namespace'; import {Member} from './Member'; import {Type} from './Type'; export class MemberRef { constructor(member: Member, min: number, max: number) { this.member = member; this.min = min; this.max = max; } member: Member; min: number; max: number; safeName: string; prefix: string; static optionalFlag = 1; static arrayFlag = 2; }
// This file is part of cxsd, copyright (c) 2016 BusFaster Ltd. // Released under the MIT license, see LICENSE. import * as cxml from 'cxml'; import {Member} from './Member'; export class MemberRef extends cxml.MemberRefBase<Member> { prefix: string; }
Use member reference base class from cxml.
Use member reference base class from cxml.
TypeScript
mit
charto/cxsd,charto/fast-xml,charto/fast-xml,charto/cxsd
--- +++ @@ -1,24 +1,10 @@ // This file is part of cxsd, copyright (c) 2016 BusFaster Ltd. // Released under the MIT license, see LICENSE. -import {Namespace} from './Namespace'; +import * as cxml from 'cxml'; + import {Member} from './Member'; -import {Type} from './Type'; -export class MemberRef { - constructor(member: Member, min: number, max: number) { - this.member = member; - this.min = min; - this.max = max; - } - - member: Member; - min: number; - max: number; - - safeName: string; +export class MemberRef extends cxml.MemberRefBase<Member> { prefix: string; - - static optionalFlag = 1; - static arrayFlag = 2; }
e66f6a0409b511851e6051d6defb9b1349f9d90c
front-end/src/app/common/constants/constants.ts
front-end/src/app/common/constants/constants.ts
const NAVBAR = [ { title : 'Про нас', state : 'about' }, { title : 'Головна', state : 'home' }, { title : 'Судді', state : 'list' } ]; const SOURCE = '/source'; const URLS = { listUrl : `${SOURCE}/judges.json`, dictionaryUrl : `${SOURCE}/dictionary.json`, dictionaryTimeStamp : `${SOURCE}/dictionary.json.timestamp`, textUrl : `${SOURCE}/texts.json`, textTimeStamp : `${SOURCE}/dictionary.json.timestamp`, details : `/declarations/:key.json` }; export { URLS, NAVBAR };
const NAVBAR = [ { title : 'Про нас', state : 'about' }, { title : 'Головна', state : 'home' }, { title : 'Судді', state : 'list' } ]; const SOURCE = '/source'; const URLS = { listUrl : `${SOURCE}/judges.json`, dictionaryUrl : `${SOURCE}/dictionary.json`, dictionaryTimeStamp : `${SOURCE}/dictionary.json.timestamp`, textUrl : `${SOURCE}/texts.json`, textTimeStamp : `${SOURCE}/dictionary.json.timestamp`, details : `/judges/:key.json` }; export { URLS, NAVBAR };
Move judges info to separate folder Judges JSON contains not only declarations
Move judges info to separate folder Judges JSON contains not only declarations
TypeScript
mit
automaidan/judges,automaidan/judges,automaidan/judges,automaidan/judges
--- +++ @@ -22,7 +22,7 @@ dictionaryTimeStamp : `${SOURCE}/dictionary.json.timestamp`, textUrl : `${SOURCE}/texts.json`, textTimeStamp : `${SOURCE}/dictionary.json.timestamp`, - details : `/declarations/:key.json` + details : `/judges/:key.json` };
8d7f0f35439327065e8cdeb8169609df5edba340
src/ts/Framework/Logging/ErrorLogging.ts
src/ts/Framework/Logging/ErrorLogging.ts
/* Copyright 2016 James Craig Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /// <reference path="FunctionExtensions.ts" /> //Handles error logging export class ErrorLogging { //constructor constructor() { this.logError = (ex,stack) => { }; } //Logs the error message. Includes the message and stack trace information. public logError: (message: string, stack: any[]) => void; //Sets the logging function that the system uses public setLoggingFunction(logger: (message: string, stack: any[]) => void): void { this.logError = logger; } //called when an error is thrown. public onError(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void { this.logError(message, arguments.callee.trace()); } }
/* Copyright 2016 James Craig Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ /// <reference path="FunctionExtensions.ts" /> //Handles error logging export class ErrorLogging { //constructor constructor() { this.logError = (ex,stack) => { }; } //Logs the error message. Includes the message and stack trace information. public logError: (message: string, stack: string) => void; //Sets the logging function that the system uses public setLoggingFunction(logger: (message: string, stack: string) => void): void { this.logError = logger; } //called when an error is thrown. public onError(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void { this.logError(message, error.stack); } }
Change to error logging for EcmaScript 5.
Change to error logging for EcmaScript 5.
TypeScript
apache-2.0
JaCraig/clarity.js,JaCraig/clarity.js,JaCraig/clarity.js
--- +++ @@ -24,15 +24,15 @@ } //Logs the error message. Includes the message and stack trace information. - public logError: (message: string, stack: any[]) => void; + public logError: (message: string, stack: string) => void; //Sets the logging function that the system uses - public setLoggingFunction(logger: (message: string, stack: any[]) => void): void { + public setLoggingFunction(logger: (message: string, stack: string) => void): void { this.logError = logger; } //called when an error is thrown. public onError(message: string, filename?: string, lineno?: number, colno?: number, error?:Error): void { - this.logError(message, arguments.callee.trace()); + this.logError(message, error.stack); } }
552c6e9e3c1ab8415916eee2b52b2c5fe792a246
harness/client.ts
harness/client.ts
/** * Decode the window's hash component as if it were a query string. Return a * key--value map. */ function decode_hash(s: string): { [key: string]: string } { if (s[0] === "#") { s = s.slice(1); } let out: { [key: string]: string } = {}; for (let part of s.split('&')) { let [key, value] = part.split('='); out[decodeURIComponent(key)] = decodeURIComponent(value); } return out; } declare function sscDingus(el: any, config: any): any; document.addEventListener("DOMContentLoaded", function () { // Set up the dingus. let base = document.querySelector('.sscdingus'); let dingus = sscDingus(base, { history: false, fpsCallback: (fps: number) => { console.log("FPS!", fps); }, }); // Load code into the dingus. function handle_hash() { let values = decode_hash(location.hash); let code = values['code']; if (code) { dingus.run(code, 'webgl'); } } // Set up hash handler. window.addEventListener('hashchange', function () { handle_hash(); }); handle_hash(); });
// Eventually, it would be nice to import the .d.ts for the dingus, but it's // not currently possible to emit those definitions. declare function sscDingus(el: any, config: any): any; /** * Decode the window's hash component as if it were a query string. Return a * key--value map. */ function decode_hash(s: string): { [key: string]: string } { if (s[0] === "#") { s = s.slice(1); } let out: { [key: string]: string } = {}; for (let part of s.split('&')) { let [key, value] = part.split('='); out[decodeURIComponent(key)] = decodeURIComponent(value); } return out; } /** * Log a message to the harness server. */ function log(obj: any) { let msg = JSON.stringify(obj); var req = new XMLHttpRequest(); req.open("GET", "/log?msg=" + encodeURIComponent(msg)); req.send(); } document.addEventListener("DOMContentLoaded", function () { // Set up the dingus. let base = document.querySelector('.sscdingus'); let dingus = sscDingus(base, { history: false, fpsCallback: (fps: number) => { log({ fps }); }, }); // Load code into the dingus. function handle_hash() { let values = decode_hash(location.hash); let code = values['code']; if (code) { dingus.run(code, 'webgl'); } } // Set up hash handler. window.addEventListener('hashchange', function () { handle_hash(); }); handle_hash(); });
Send the FPS back to the server
Send the FPS back to the server
TypeScript
mit
guoyiteng/braid,guoyiteng/braid,guoyiteng/braid,cucapra/braid,cucapra/braid,cucapra/braid,guoyiteng/braid,cucapra/braid,guoyiteng/braid,cucapra/braid,guoyiteng/braid,cucapra/braid
--- +++ @@ -1,3 +1,7 @@ +// Eventually, it would be nice to import the .d.ts for the dingus, but it's +// not currently possible to emit those definitions. +declare function sscDingus(el: any, config: any): any; + /** * Decode the window's hash component as if it were a query string. Return a * key--value map. @@ -15,7 +19,15 @@ return out; } -declare function sscDingus(el: any, config: any): any; +/** + * Log a message to the harness server. + */ +function log(obj: any) { + let msg = JSON.stringify(obj); + var req = new XMLHttpRequest(); + req.open("GET", "/log?msg=" + encodeURIComponent(msg)); + req.send(); +} document.addEventListener("DOMContentLoaded", function () { // Set up the dingus. @@ -23,7 +35,7 @@ let dingus = sscDingus(base, { history: false, fpsCallback: (fps: number) => { - console.log("FPS!", fps); + log({ fps }); }, });
1e7f4c26875cf6957085b44b14790b9c6318a9cc
src/lib/EventPhase.ts
src/lib/EventPhase.ts
/** * An enum for possible event phases that an event can be in */ const enum EventPhase { /** * Indicates that the event is currently not being dispatched */ NONE = 0, /** * Indicates that the event is in the capturing phase, moving down from the top-most EventDispatcher * instance to the parent of the target EventDispatcher */ CAPTURING_PHASE = 1, /** * Indicates that we are currently calling the event listeners on the event target during dispatch. */ AT_TARGET = 2, /** * Indicates that we are currently moving back up from the parent of the target EventDispatcher to * the top-most EventDispatcher instance. */ BUBBLING_PHASE = 3, } export default EventPhase;
/** * An enum for possible event phases that an event can be in */ const enum EventPhase { /** * Indicates that the event is currently not being dispatched */ NONE, /** * Indicates that the event is in the capturing phase, moving down from the top-most EventDispatcher * instance to the parent of the target EventDispatcher */ CAPTURING_PHASE, /** * Indicates that we are currently calling the event listeners on the event target during dispatch. */ AT_TARGET, /** * Indicates that we are currently moving back up from the parent of the target EventDispatcher to * the top-most EventDispatcher instance. */ BUBBLING_PHASE, } export default EventPhase;
Remove self assigned values of the eventPhase enum
Remove self assigned values of the eventPhase enum
TypeScript
mit
mediamonks/seng-event,mediamonks/seng-event
--- +++ @@ -5,21 +5,21 @@ /** * Indicates that the event is currently not being dispatched */ - NONE = 0, + NONE, /** * Indicates that the event is in the capturing phase, moving down from the top-most EventDispatcher * instance to the parent of the target EventDispatcher */ - CAPTURING_PHASE = 1, + CAPTURING_PHASE, /** * Indicates that we are currently calling the event listeners on the event target during dispatch. */ - AT_TARGET = 2, + AT_TARGET, /** * Indicates that we are currently moving back up from the parent of the target EventDispatcher to * the top-most EventDispatcher instance. */ - BUBBLING_PHASE = 3, + BUBBLING_PHASE, }
69b89cdf15c827376d20aa75dfb89abcc514892f
src/app/store/auth/reducers.ts
src/app/store/auth/reducers.ts
import { Action, ActionReducer } from '@ngrx/store'; import { isType } from 'typescript-fsa'; import { environment } from '../../../environments/environment'; import { login, loginSuccess, loginRedirect, logout } from '../actions'; import { AuthState, State } from '../state'; const initialState = { config: environment.auth, }; export function loginReducer(state: AuthState = initialState, action: Action) { if (isType(action, login)) { return { ...state, fromUrl: action.payload }; } if (isType(action, loginSuccess)) { return { ...state, token: action.payload }; } if (isType(action, loginRedirect)) { return { ...state, fromUrl: undefined }; } return state; }; export function logoutReducer(reducer: ActionReducer<any>) { return (state: State, action: Action) => { if (isType(action, logout)) { state = undefined; } return reducer(state, action); }; }
import { Action, ActionReducer } from '@ngrx/store'; import { isType } from 'typescript-fsa'; import { environment } from '../../../environments/environment'; import { login, loginSuccess, loginRedirect, logout } from '../actions'; import { AuthState, State } from '../state'; const initialState = { config: { ...environment.auth }, }; export function loginReducer(state: AuthState = initialState, action: Action) { if (isType(action, login)) { return { ...state, fromUrl: action.payload }; } if (isType(action, loginSuccess)) { return { ...state, token: action.payload }; } if (isType(action, loginRedirect)) { return { ...state, fromUrl: undefined }; } return state; }; export function logoutReducer(reducer: ActionReducer<any>) { return (state: State, action: Action) => { if (isType(action, logout)) { state = undefined; } return reducer(state, action); }; }
Copy environment config to initial state of authReducer
Copy environment config to initial state of authReducer This change makes the initial state immutable (as long as it is a simple dictionary) in an unlikely case that environment is modified.
TypeScript
bsd-3-clause
cumulous/web,cumulous/web,cumulous/web,cumulous/web
--- +++ @@ -7,7 +7,7 @@ import { AuthState, State } from '../state'; const initialState = { - config: environment.auth, + config: { ...environment.auth }, }; export function loginReducer(state: AuthState = initialState, action: Action) {
71ae78672effcd6bc33f56302d61a48e346ad569
lib/tasks/Test.ts
lib/tasks/Test.ts
import {buildHelper as helper, taskRunner} from "../Container"; import Util from "../Util"; const gulp = require("gulp4"); const mocha = require("gulp-mocha"); export default function Test() { return gulp.src(helper.getSettings().test, {read: false}) .pipe(mocha({ reporter: 'spec', compilers: { ts: require('ts-node/register') } })) .on("error", (error) => { console.error(Util.formatError(error)); process.exit(1) }); }
import {buildHelper as helper, taskRunner} from "../Container"; import Util from "../Util"; const gulp = require("gulp4"); const mocha = require("gulp-mocha"); export default function Test() { return gulp.src(helper.getSettings().test, {read: false}) .pipe(mocha({ reporter: 'spec', compilers: { ts: require('ts-node/register') } })) .once('end', function () { process.exit(); }) .on("error", (error) => { console.error(Util.formatError(error)); process.exit(1) }); }
Exit karma on test end to fix hanging tests
Exit karma on test end to fix hanging tests
TypeScript
mit
mtfranchetto/smild,mtfranchetto/smild,mtfranchetto/smild
--- +++ @@ -11,6 +11,9 @@ ts: require('ts-node/register') } })) + .once('end', function () { + process.exit(); + }) .on("error", (error) => { console.error(Util.formatError(error)); process.exit(1)
9347ee8d78cb1c2080edb987b76d8ddf42361e5e
resources/scripts/plugins/usePermissions.ts
resources/scripts/plugins/usePermissions.ts
import { ServerContext } from '@/state/server'; import { useDeepMemo } from '@/plugins/useDeepMemo'; export const usePermissions = (action: string | string[]): boolean[] => { const userPermissions = ServerContext.useStoreState(state => state.server.permissions); return useDeepMemo(() => { return (Array.isArray(action) ? action : [ action ]) .map(permission => ( // Allows checking for any permission matching a name, for example files.* // will return if the user has any permission under the file.XYZ namespace. ( permission.endsWith('.*') && permission !== 'websocket.*' && userPermissions.filter(p => p.startsWith(permission.split('.')[0])).length > 0 ) || // Otherwise just check if the entire permission exists in the array or not. userPermissions.indexOf(permission) >= 0 ), ); }, [ action, userPermissions ]); };
import { ServerContext } from '@/state/server'; import { useDeepMemo } from '@/plugins/useDeepMemo'; export const usePermissions = (action: string | string[]): boolean[] => { const userPermissions = ServerContext.useStoreState(state => state.server.permissions); return useDeepMemo(() => { if (userPermissions[0] === '*') { return ([] as boolean[]).fill( true, 0, Array.isArray(action) ? action.length : 1, ); } return (Array.isArray(action) ? action : [ action ]) .map(permission => ( // Allows checking for any permission matching a name, for example files.* // will return if the user has any permission under the file.XYZ namespace. ( permission.endsWith('.*') && permission !== 'websocket.*' && userPermissions.filter(p => p.startsWith(permission.split('.')[0])).length > 0 ) || // Otherwise just check if the entire permission exists in the array or not. userPermissions.indexOf(permission) >= 0 )); }, [ action, userPermissions ]); };
Fix permissions handling logic for admins/owners
Fix permissions handling logic for admins/owners
TypeScript
mit
Pterodactyl/Panel,Pterodactyl/Panel,Pterodactyl/Panel,Pterodactyl/Panel
--- +++ @@ -5,18 +5,23 @@ const userPermissions = ServerContext.useStoreState(state => state.server.permissions); return useDeepMemo(() => { + if (userPermissions[0] === '*') { + return ([] as boolean[]).fill( + true, 0, Array.isArray(action) ? action.length : 1, + ); + } + return (Array.isArray(action) ? action : [ action ]) .map(permission => ( - // Allows checking for any permission matching a name, for example files.* - // will return if the user has any permission under the file.XYZ namespace. - ( - permission.endsWith('.*') && - permission !== 'websocket.*' && - userPermissions.filter(p => p.startsWith(permission.split('.')[0])).length > 0 - ) || - // Otherwise just check if the entire permission exists in the array or not. - userPermissions.indexOf(permission) >= 0 - ), - ); + // Allows checking for any permission matching a name, for example files.* + // will return if the user has any permission under the file.XYZ namespace. + ( + permission.endsWith('.*') && + permission !== 'websocket.*' && + userPermissions.filter(p => p.startsWith(permission.split('.')[0])).length > 0 + ) || + // Otherwise just check if the entire permission exists in the array or not. + userPermissions.indexOf(permission) >= 0 + )); }, [ action, userPermissions ]); };
e5fc6b598325c861a7696e320b8de0eecb856cc7
server/helpers/custom-validators/servers.ts
server/helpers/custom-validators/servers.ts
import validator from 'validator' import { CONSTRAINTS_FIELDS } from '../../initializers/constants' import { isTestOrDevInstance } from '../core-utils' import { exists, isArray } from './misc' function isHostValid (host: string) { const isURLOptions = { require_host: true, require_tld: true } // We validate 'localhost', so we don't have the top level domain if (isTestOrDevInstance()) { isURLOptions.require_tld = false } return exists(host) && validator.isURL(host, isURLOptions) && host.split('://').length === 1 } function isEachUniqueHostValid (hosts: string[]) { return isArray(hosts) && hosts.every(host => { return isHostValid(host) && hosts.indexOf(host) === hosts.lastIndexOf(host) }) } function isValidContactBody (value: any) { return exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.CONTACT_FORM.BODY) } function isValidContactFromName (value: any) { return exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.CONTACT_FORM.FROM_NAME) } // --------------------------------------------------------------------------- export { isValidContactBody, isValidContactFromName, isEachUniqueHostValid, isHostValid }
import validator from 'validator' import { CONFIG } from '@server/initializers/config' import { CONSTRAINTS_FIELDS } from '../../initializers/constants' import { exists, isArray } from './misc' function isHostValid (host: string) { const isURLOptions = { require_host: true, require_tld: true } // We validate 'localhost', so we don't have the top level domain if (CONFIG.WEBSERVER.HOSTNAME === 'localhost') { isURLOptions.require_tld = false } return exists(host) && validator.isURL(host, isURLOptions) && host.split('://').length === 1 } function isEachUniqueHostValid (hosts: string[]) { return isArray(hosts) && hosts.every(host => { return isHostValid(host) && hosts.indexOf(host) === hosts.lastIndexOf(host) }) } function isValidContactBody (value: any) { return exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.CONTACT_FORM.BODY) } function isValidContactFromName (value: any) { return exists(value) && validator.isLength(value, CONSTRAINTS_FIELDS.CONTACT_FORM.FROM_NAME) } // --------------------------------------------------------------------------- export { isValidContactBody, isValidContactFromName, isEachUniqueHostValid, isHostValid }
Fix host validation on locahost
Fix host validation on locahost
TypeScript
agpl-3.0
Chocobozzz/PeerTube,Chocobozzz/PeerTube,Chocobozzz/PeerTube,Chocobozzz/PeerTube
--- +++ @@ -1,6 +1,6 @@ import validator from 'validator' +import { CONFIG } from '@server/initializers/config' import { CONSTRAINTS_FIELDS } from '../../initializers/constants' -import { isTestOrDevInstance } from '../core-utils' import { exists, isArray } from './misc' function isHostValid (host: string) { @@ -10,7 +10,7 @@ } // We validate 'localhost', so we don't have the top level domain - if (isTestOrDevInstance()) { + if (CONFIG.WEBSERVER.HOSTNAME === 'localhost') { isURLOptions.require_tld = false }
20f5e9b6de4e86a6d179b107553bb1a3ef0a4698
dangerfile.ts
dangerfile.ts
/* eslint-disable jest/no-jasmine-globals */ import { danger } from "danger" import * as fs from "fs" /** * Helpers */ const filesOnly = (file: string) => fs.existsSync(file) && fs.lstatSync(file).isFile() // Modified or Created can be treated the same a lot of the time const getCreatedFiles = (createdFiles: string[]) => createdFiles.filter(filesOnly) /** * Rules */ function preventDefaultQueryRenderImport() { const newQueryRendererImports = getCreatedFiles( danger.git.created_files ).filter(filename => { const content = fs.readFileSync(filename).toString() return content.includes("<QueryRenderer") }) if (newQueryRendererImports.length > 0) { fail(`Please use \`<SystemQueryRenderer />\` instead of \`<QueryRender />\`. This prevents double fetching during the server-side render pass. See: > ${newQueryRendererImports.map(filename => `\`${filename}\``).join("\n")}`) } } ;(async function () { preventDefaultQueryRenderImport() })()
/* eslint-disable jest/no-jasmine-globals */ import { danger, warn } from "danger" import * as fs from "fs" /** * Helpers */ const filesOnly = (file: string) => fs.existsSync(file) && fs.lstatSync(file).isFile() // Modified or Created can be treated the same a lot of the time const getCreatedFiles = (createdFiles: string[]) => createdFiles.filter(filesOnly) /** * Rules */ function preventDefaultQueryRenderImport() { const newQueryRendererImports = getCreatedFiles( danger.git.created_files ).filter(filename => { const content = fs.readFileSync(filename).toString() return content.includes("<QueryRenderer") }) if (newQueryRendererImports.length > 0) { fail(`Please use \`<SystemQueryRenderer />\` instead of \`<QueryRender />\`. This prevents double fetching during the server-side render pass. See: > ${newQueryRendererImports.map(filename => `\`${filename}\``).join("\n")}`) } } function warnCreateSmokeTestIfRoutesFileChanged() { const modified = danger.git.modified_files console.log(modified) if (modified.includes("src/v2/routes.tsx")) { warn( "Routes added to `routes.tsx` should have a corresponding cypress.js smoke test. See the `cypress/integration` folder for examples." ) } } ;(async function () { preventDefaultQueryRenderImport() warnCreateSmokeTestIfRoutesFileChanged() })()
Add danger rule warning about routes smoke test
toolchain: Add danger rule warning about routes smoke test
TypeScript
mit
artsy/force,joeyAghion/force,joeyAghion/force,joeyAghion/force,artsy/force-public,joeyAghion/force,artsy/force,artsy/force-public,artsy/force,artsy/force
--- +++ @@ -1,5 +1,5 @@ /* eslint-disable jest/no-jasmine-globals */ -import { danger } from "danger" +import { danger, warn } from "danger" import * as fs from "fs" /** @@ -29,6 +29,18 @@ } } +function warnCreateSmokeTestIfRoutesFileChanged() { + const modified = danger.git.modified_files + console.log(modified) + + if (modified.includes("src/v2/routes.tsx")) { + warn( + "Routes added to `routes.tsx` should have a corresponding cypress.js smoke test. See the `cypress/integration` folder for examples." + ) + } +} + ;(async function () { preventDefaultQueryRenderImport() + warnCreateSmokeTestIfRoutesFileChanged() })()
77ebe87ec8683651001f041c947d642994cbdfea
scripts/build-watch.ts
scripts/build-watch.ts
import buildTypings from './utils/buildTypings'; import generateTypings, { Logger } from './utils/generateTypings'; import clearCache from './utils/clearCache'; const nodemon = require('nodemon'); const configsFile = 'src/configs.ts'; nodemon({ script: './scripts/nothing.js', ext: 'ts md', watch: ['templates/', configsFile], }); const leftpad = (num: number) => (num < 10) ? '0' + num : num.toString(); const logger: Logger = ({ input, output }) => { const date = new Date(); console.log(`[${ leftpad(date.getHours()) }:${ leftpad(date.getMinutes()) }:${ leftpad(date.getSeconds()) }] ${input} -> ${output}`); }; buildTypings(logger); nodemon.on('restart', (files?: string[]) => { console.log(); clearCache(); if (!files || files.some(x => x.indexOf(configsFile) !== -1)) { buildTypings(logger); } else { generateTypings(files, logger); } });
import buildTypings from './utils/buildTypings'; import generateTypings, { Logger } from './utils/generateTypings'; import clearCache from './utils/clearCache'; import * as path from 'path'; const configs = require('./configs.json'); const nodemon = require('nodemon'); const configsFile = 'src/configs.ts'; const cwd = process.cwd(); const templateDir = path.relative(cwd, configs.templateDir); const indexTs = path.join(cwd, configs.templateDir,'index.ts'); nodemon({ script: './scripts/nothing.js', ext: 'ts md', watch: [templateDir, configsFile], }); const leftpad = (num: number) => (num < 10) ? '0' + num : num.toString(); const logger: Logger = ({ input, output }) => { const date = new Date(); console.log(`[${ leftpad(date.getHours()) }:${ leftpad(date.getMinutes()) }:${ leftpad(date.getSeconds()) }] ${input} -> ${output}`); }; buildTypings(logger); nodemon.on('restart', (files?: string[]) => { console.log(); clearCache(); if (!files || files.some(x => x.indexOf(configsFile) !== -1)) { buildTypings(logger); } else { generateTypings([...files, indexTs], logger); } });
Update scripts generate index.d.ts after other d.ts
Update scripts generate index.d.ts after other d.ts
TypeScript
mit
ikatyang/types-ramda,ikatyang/types-ramda
--- +++ @@ -1,14 +1,22 @@ import buildTypings from './utils/buildTypings'; import generateTypings, { Logger } from './utils/generateTypings'; import clearCache from './utils/clearCache'; +import * as path from 'path'; + +const configs = require('./configs.json'); const nodemon = require('nodemon'); const configsFile = 'src/configs.ts'; +const cwd = process.cwd(); + +const templateDir = path.relative(cwd, configs.templateDir); +const indexTs = path.join(cwd, configs.templateDir,'index.ts'); + nodemon({ script: './scripts/nothing.js', ext: 'ts md', - watch: ['templates/', configsFile], + watch: [templateDir, configsFile], }); const leftpad = (num: number) => (num < 10) ? '0' + num : num.toString(); @@ -31,6 +39,6 @@ if (!files || files.some(x => x.indexOf(configsFile) !== -1)) { buildTypings(logger); } else { - generateTypings(files, logger); + generateTypings([...files, indexTs], logger); } });
7dc95bb73ec4ea1ebece027d9f78610b4c750c65
server/model.config.ts
server/model.config.ts
/// <reference path="../typings/tsd.d.ts" /> import mongoose = require('mongoose'); export var dbUri = process.env.MONGODB_URI || 'mongodb://localhost:27017/vimfika'; export var dbConnection = mongoose.createConnection(dbUri); export function isUniqueKeyConstraint(error: any) { return error && error.name == 'MongoError' && error.code == 11000; }
/// <reference path="../typings/tsd.d.ts" /> import mongoose = require('mongoose'); export var dbUri = process.env.VIMFIKA_MONGODB_URI || process.env.MONGODB_URI || 'mongodb://localhost:27017/vimfika'; export var dbConnection = mongoose.createConnection(dbUri); export function isUniqueKeyConstraint(error: any) { return error && error.name == 'MongoError' && error.code == 11000; }
Add new environment variable for mongodb url
Add new environment variable for mongodb url
TypeScript
mit
pgrm/vimfika,pgrm/vimfika
--- +++ @@ -2,7 +2,7 @@ import mongoose = require('mongoose'); -export var dbUri = process.env.MONGODB_URI || 'mongodb://localhost:27017/vimfika'; +export var dbUri = process.env.VIMFIKA_MONGODB_URI || process.env.MONGODB_URI || 'mongodb://localhost:27017/vimfika'; export var dbConnection = mongoose.createConnection(dbUri); export function isUniqueKeyConstraint(error: any) {
7a8c7f4925b18cf1ee5df8fdc0be83bb6de28170
ui/ui-app/src/main/resources/static/js/repository/ng5-import-template.component.ts
ui/ui-app/src/main/resources/static/js/repository/ng5-import-template.component.ts
import {Component, Directive, ElementRef, Injector, Input} from "@angular/core"; import {UpgradeComponent} from "@angular/upgrade/static"; import * as angular from 'angular'; /** * Angular 5 entry component for Import Template page. */ @Component({ template: ` <ng5-import-template [template]="template"></ng5-import-template> ` }) export class ImportTemplateComponent { @Input() template: any; } /** * Upgrades Import Template AngularJS entry component to Angular 5. */ @Directive({ providers: [ {provide: "$injector", useFactory: () => angular.element(document.body).injector()} ], selector: 'ng5-import-template' }) export class ImportTemplateDirective extends UpgradeComponent { @Input() template: any; constructor(elementRef: ElementRef, injector: Injector) { super('importTemplateControllerEmbedded', elementRef, injector); } }
import {Component, Directive, ElementRef, Injector, Input} from "@angular/core"; import {UpgradeComponent} from "@angular/upgrade/static"; /** * Angular 5 entry component for Import Template page. */ @Component({ template: ` <ng5-import-template [template]="template"></ng5-import-template> ` }) export class ImportTemplateComponent { @Input() template: any; } /** * Upgrades Import Template AngularJS entry component to Angular 5. */ @Directive({ providers: [ {provide: "$injector", useFactory: () => angular.element(document.body).injector()} ], selector: 'ng5-import-template' }) export class ImportTemplateDirective extends UpgradeComponent { @Input() template: any; constructor(elementRef: ElementRef, injector: Injector) { super('importTemplateControllerEmbedded', elementRef, injector); } }
Revert "Added missing import, fix build failure"
Revert "Added missing import, fix build failure" This reverts commit 9e3cb4b4a1a79e297d34472c2ee2645c6dab8ff9.
TypeScript
apache-2.0
Teradata/kylo,Teradata/kylo,Teradata/kylo,Teradata/kylo,Teradata/kylo
--- +++ @@ -1,6 +1,5 @@ import {Component, Directive, ElementRef, Injector, Input} from "@angular/core"; import {UpgradeComponent} from "@angular/upgrade/static"; -import * as angular from 'angular'; /**
2b8f0470dc08bc29e0e52dc549b2a33498d38887
src/v2/pages/channel/components/ChannelPageMetaTags/fragments/channelPageMetaTags.ts
src/v2/pages/channel/components/ChannelPageMetaTags/fragments/channelPageMetaTags.ts
import { gql } from '@apollo/client' export const channelPageMetaTagsFragment = gql` fragment ChannelPageMetaTags on Channel { __typename id meta_title: title meta_description: description(format: MARKDOWN) canonical: href(absolute: true) is_nsfw image_url(size: DISPLAY) } `
import { gql } from '@apollo/client' export const channelPageMetaTagsFragment = gql` fragment ChannelPageMetaTags on Channel { __typename id meta_title: title meta_description: description(format: MARKDOWN) canonical: href(absolute: true) is_nsfw image_url(size: DISPLAY) visibility } `
Add RSS meta tag to channel
Add RSS meta tag to channel
TypeScript
mit
aredotna/ervell,aredotna/ervell,aredotna/ervell,aredotna/ervell,aredotna/ervell
--- +++ @@ -9,5 +9,6 @@ canonical: href(absolute: true) is_nsfw image_url(size: DISPLAY) + visibility } `
dc2215787a3ce11035e8ebfe58e1bc66499aedbb
e2e/steps/app.ts
e2e/steps/app.ts
import { $, location, locationOf, navigateTo, steps } from '../support/world'; steps(({When, Then}) => { When(/^I open our app$/, () => { navigateTo('/'); }); Then(/^I should see a message saying that the app works$/, () => { $('app-root h1').getText().should.become('app works!'); }); Then(/^I should see the "(.*)" page$/, page => { location().should.become(locationOf(page)); }); });
import { $, location, locationOf, navigateTo, steps } from '../support/world'; steps(({Given, When, Then}) => { Given(/^I am on the "(.*)" page$/, page => navigateTo((locationOf(page)))); When(/^I open our app$/, () => navigateTo('/')); Then(/^I should see a message saying that the app works$/, () => $('app-root h1').getText().should.become('app works!')); Then(/^I should see the "(.*)" page$/, page => location().should.become(locationOf(page))); });
Fix async e2e tests and shorten their syntax
Fix async e2e tests and shorten their syntax It turns out that to properly support async tests, we need to RETURN their output (as Promise) instead of just calling them. We now use the shorthand return syntax (() => ...), which also renders the steps more succinct.
TypeScript
bsd-3-clause
cumulous/web,cumulous/web,cumulous/web,cumulous/web
--- +++ @@ -1,13 +1,12 @@ import { $, location, locationOf, navigateTo, steps } from '../support/world'; -steps(({When, Then}) => { - When(/^I open our app$/, () => { - navigateTo('/'); - }); - Then(/^I should see a message saying that the app works$/, () => { - $('app-root h1').getText().should.become('app works!'); - }); - Then(/^I should see the "(.*)" page$/, page => { - location().should.become(locationOf(page)); - }); +steps(({Given, When, Then}) => { + Given(/^I am on the "(.*)" page$/, page => + navigateTo((locationOf(page)))); + When(/^I open our app$/, () => + navigateTo('/')); + Then(/^I should see a message saying that the app works$/, () => + $('app-root h1').getText().should.become('app works!')); + Then(/^I should see the "(.*)" page$/, page => + location().should.become(locationOf(page))); });
0e3204fc14ce6fce37af45a2357c60b182d9f5f6
src/components/list-bullet/list-bullet.ts
src/components/list-bullet/list-bullet.ts
import Vue from 'vue'; import { PluginObject } from 'vue'; import Component from 'vue-class-component'; import { Prop } from 'vue-property-decorator'; import WithRender from './list-bullet.html?style=./list-bullet.scss'; import { LIST_BULLET_NAME } from '../component-names'; @WithRender @Component export class MList extends Vue { @Prop({ default: ['Element 1', 'Element 2', 'Element 3'] }) public values: string[]; private componentName = LIST_BULLET_NAME; } const ListPlugin: PluginObject<any> = { install(v, options) { v.component(LIST_BULLET_NAME, MList); } }; export default ListPlugin;
import Vue from 'vue'; import { PluginObject } from 'vue'; import Component from 'vue-class-component'; import { Prop } from 'vue-property-decorator'; import WithRender from './list-bullet.html?style=./list-bullet.scss'; import { LIST_BULLET_NAME } from '../component-names'; @WithRender @Component export class MListBullet extends Vue { @Prop({ default: ['Element 1', 'Element 2', 'Element 3'] }) public values: string[]; private componentName = LIST_BULLET_NAME; } const ListBulletPlugin: PluginObject<any> = { install(v, options) { v.component(LIST_BULLET_NAME, MListBullet); } }; export default ListBulletPlugin;
Change name of list bullet component
Change name of list bullet component
TypeScript
apache-2.0
ulaval/modul-components,ulaval/modul-components,ulaval/modul-components
--- +++ @@ -7,16 +7,16 @@ @WithRender @Component -export class MList extends Vue { +export class MListBullet extends Vue { @Prop({ default: ['Element 1', 'Element 2', 'Element 3'] }) public values: string[]; private componentName = LIST_BULLET_NAME; } -const ListPlugin: PluginObject<any> = { +const ListBulletPlugin: PluginObject<any> = { install(v, options) { - v.component(LIST_BULLET_NAME, MList); + v.component(LIST_BULLET_NAME, MListBullet); } }; -export default ListPlugin; +export default ListBulletPlugin;
c1b97e5d1f8c97fdf2d35d95f2a34e3a52662369
desktop/app/src/utils/getDefaultPluginsIndex.tsx
desktop/app/src/utils/getDefaultPluginsIndex.tsx
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format */ export default function () { // eslint-disable-next-line import/no-unresolved return require('../defaultPlugins'); }
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format */ export default function () { // eslint-disable-next-line import/no-unresolved const index = require('../defaultPlugins'); return index.default || index; }
Fix loading plugins in dev mode
Fix loading plugins in dev mode Summary: Fixed loading plugins in dev mode Reviewed By: timur-valiev Differential Revision: D21262894 fbshipit-source-id: c4ab6902d3153c3580c71f27df91290122627fae
TypeScript
mit
facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper,facebook/flipper
--- +++ @@ -9,5 +9,6 @@ export default function () { // eslint-disable-next-line import/no-unresolved - return require('../defaultPlugins'); + const index = require('../defaultPlugins'); + return index.default || index; }
bb19cabf25e3bfff0f82876fce7c987f28fa5942
frontend/src/app/private-route/private-route.tsx
frontend/src/app/private-route/private-route.tsx
import { Redirect } from "@reach/router"; import React, { Component } from "react"; import { useLoginState } from "../profile/hooks"; export const PrivateRoute = ({ component: PrivateComponent, lang, ...rest }: any) => { const [loggedIn, _] = useLoginState(false); const loginUrl = `${lang}/login`; if (!loggedIn) { return <Redirect to={loginUrl} noThrow={true} />; } return <PrivateComponent {...rest} />; };
import { Redirect } from "@reach/router"; import React, { Component } from "react"; import { useLoginState } from "../profile/hooks"; export const PrivateRoute = ({ component: PrivateComponent, lang, ...rest }: any) => { const [loggedIn, _] = useLoginState(false); const loginUrl = `${lang}/login`; if (!loggedIn) { return <Redirect to={loginUrl} noThrow={true} />; } return <PrivateComponent lang={lang} {...rest} />; };
Fix PrivateRoute pass lang prop
Fix PrivateRoute pass lang prop
TypeScript
mit
patrick91/pycon,patrick91/pycon
--- +++ @@ -15,5 +15,5 @@ return <Redirect to={loginUrl} noThrow={true} />; } - return <PrivateComponent {...rest} />; + return <PrivateComponent lang={lang} {...rest} />; };
6af5520c3f48b944f56e78f386c1001012665931
source/danger/peril_platform.ts
source/danger/peril_platform.ts
import { GitHub } from "danger/distribution/platforms/GitHub" import { Platform } from "danger/distribution/platforms/platform" import { dsl } from "./danger_run" /** * When Peril is running a dangerfile for a PR we can use the default GitHub from Danger * however, an event like an issue comment or a user creation has no way to provide any kind of * feedback or DSL. To work around that we use the event provided by GitHub and provide it to Danger. */ const getPerilPlatformForDSL = (type: dsl, github: GitHub | null, githubEvent: any): Platform => { if (type === dsl.pr && github) { return github } else { const nullFunc: any = () => "" const platform: Platform = { createComment: github ? github.createComment : nullFunc, deleteMainComment: github ? github.deleteMainComment : nullFunc, editMainComment: github ? github.editMainComment : nullFunc, getPlatformDSLRepresentation: async () => { return githubEvent }, getPlatformGitRepresentation: async () => { return {} as any }, name: "", updateOrCreateComment: github ? github.updateOrCreateComment : nullFunc, updateStatus: github ? github.updateStatus : nullFunc, } return platform } } export default getPerilPlatformForDSL
import { GitHub } from "danger/distribution/platforms/GitHub" import { Platform } from "danger/distribution/platforms/platform" import { dsl } from "./danger_run" /** * When Peril is running a dangerfile for a PR we can use the default GitHub from Danger * however, an event like an issue comment or a user creation has no way to provide any kind of * feedback or DSL. To work around that we use the event provided by GitHub and provide it to Danger. */ const getPerilPlatformForDSL = (type: dsl, github: GitHub | null, githubEvent: any): Platform => { if (type === dsl.pr && github) { return github } else { const nullFunc: any = () => "" const platform: Platform = { createComment: github ? github.createComment : nullFunc, deleteMainComment: github ? github.deleteMainComment : nullFunc, editMainComment: github ? github.editMainComment : nullFunc, getPlatformDSLRepresentation: async () => { return githubEvent }, getPlatformGitRepresentation: async () => { return {} as any }, name: "", updateOrCreateComment: github ? github.updateOrCreateComment : nullFunc, updateStatus: nullFunc, } return platform } } export default getPerilPlatformForDSL
REmove the updateStatus function from non-PR runs
REmove the updateStatus function from non-PR runs
TypeScript
mit
danger/peril,danger/peril,danger/peril,danger/peril,danger/peril
--- +++ @@ -25,7 +25,7 @@ }, name: "", updateOrCreateComment: github ? github.updateOrCreateComment : nullFunc, - updateStatus: github ? github.updateStatus : nullFunc, + updateStatus: nullFunc, } return platform }
a0db190fa3526919f15a1eb410f96c7406f793e4
jquery.are-you-sure/jquery.are-you-sure.d.ts
jquery.are-you-sure/jquery.are-you-sure.d.ts
// Type definitions for jquery.are-you-sure.js // Project: https://github.com/codedance/jquery.AreYouSure // Definitions by: Jon Egerton <https://github.com/jonegerton> // Definitions: https://github.com/borisyankov/DefinitelyTyped /// <reference path="../jquery/jquery.d.ts" /> /**Options available to control dirty form checking*/ interface AreYouSureOptions { /**Message to show when attempting to quit a dirty form without saving*/ message?: string; /**Class to assign to the form when dirty*/ dirtyClass?: string; /**Callback when form is found to be dirty - allows control of submit/reset buttons etc*/ change?: Function; /**Jquery selector to use to find input elements*/ fieldSelector?: string; /**Make Are-You-Sure "silent" by disabling the warning message*/ silent: boolean; } interface AreYouSure { (): JQuery; (options: AreYouSureOptions): JQuery; } interface JQuery { areYouSure: AreYouSure; }
// Type definitions for jquery.are-you-sure.js // Project: https://github.com/codedance/jquery.AreYouSure // Definitions by: Jon Egerton <https://github.com/jonegerton> // Definitions: https://github.com/borisyankov/DefinitelyTyped /// <reference path="../jquery/jquery.d.ts" /> /**Options available to control dirty form checking*/ interface AreYouSureOptions { /**Message to show when attempting to quit a dirty form without saving*/ message?: string; /**Class to assign to the form when dirty*/ dirtyClass?: string; /**Callback when form is found to be dirty - allows control of submit/reset buttons etc*/ change?: Function; /**Jquery selector to use to find input elements*/ fieldSelector?: string; /**Make Are-You-Sure "silent" by disabling the warning message*/ silent?: boolean; } interface AreYouSure { (): JQuery; (options: AreYouSureOptions): JQuery; } interface JQuery { areYouSure: AreYouSure; }
Make silent option on AreYouSureOptions optional
Make silent option on AreYouSureOptions optional Make silent option on AreYouSureOptions optional
TypeScript
mit
igorraush/DefinitelyTyped,nitintutlani/DefinitelyTyped,jsaelhof/DefinitelyTyped,thSoft/DefinitelyTyped,panuhorsmalahti/DefinitelyTyped,44ka28ta/DefinitelyTyped,chrismbarr/DefinitelyTyped,aroder/DefinitelyTyped,davidpricedev/DefinitelyTyped,lightswitch05/DefinitelyTyped,scriby/DefinitelyTyped,pocesar/DefinitelyTyped,AgentME/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,Belelros/DefinitelyTyped,evansolomon/DefinitelyTyped,BrandonCKrueger/DefinitelyTyped,paxibay/DefinitelyTyped,laball/DefinitelyTyped,pkhayundi/DefinitelyTyped,hx0day/DefinitelyTyped,ayanoin/DefinitelyTyped,billccn/DefinitelyTyped,munxar/DefinitelyTyped,jraymakers/DefinitelyTyped,rolandzwaga/DefinitelyTyped,mcliment/DefinitelyTyped,florentpoujol/DefinitelyTyped,algas/DefinitelyTyped,gorcz/DefinitelyTyped,nitintutlani/DefinitelyTyped,onecentlin/DefinitelyTyped,martinduparc/DefinitelyTyped,pkaul/DefinitelyTyped,bencoveney/DefinitelyTyped,jbrantly/DefinitelyTyped,aindlq/DefinitelyTyped,vote539/DefinitelyTyped,applesaucers/lodash-invokeMap,Karabur/DefinitelyTyped,trystanclarke/DefinitelyTyped,markogresak/DefinitelyTyped,sorskoot/DefinitelyTyped,wcomartin/DefinitelyTyped,ciriarte/DefinitelyTyped,tan9/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,IAPark/DefinitelyTyped,mattanja/DefinitelyTyped,teves-castro/DefinitelyTyped,Carreau/DefinitelyTyped,mcrawshaw/DefinitelyTyped,olivierlemasle/DefinitelyTyped,Litee/DefinitelyTyped,benishouga/DefinitelyTyped,tan9/DefinitelyTyped,trystanclarke/DefinitelyTyped,duongphuhiep/DefinitelyTyped,nodeframe/DefinitelyTyped,sledorze/DefinitelyTyped,PawelStroinski/DefinitelyTyped,AgentME/DefinitelyTyped,omidkrad/DefinitelyTyped,magny/DefinitelyTyped,ArturSoler/DefinitelyTyped,dmoonfire/DefinitelyTyped,colindembovsky/DefinitelyTyped,blink1073/DefinitelyTyped,scriby/DefinitelyTyped,manekovskiy/DefinitelyTyped,rcchen/DefinitelyTyped,donnut/DefinitelyTyped,JeremyCBrooks/DefinitelyTyped,fnipo/DefinitelyTyped,wilfrem/DefinitelyTyped,hesselink/DefinitelyTyped,dpsthree/DefinitelyTyped,axelcostaspena/DefinitelyTyped,stimms/DefinitelyTyped,miguelmq/DefinitelyTyped,Zzzen/DefinitelyTyped,greglo/DefinitelyTyped,Stephanvs/DefinitelyTyped,musakarakas/DefinitelyTyped,AGBrown/DefinitelyTyped-ABContrib,musicist288/DefinitelyTyped,cherrydev/DefinitelyTyped,Airblader/DefinitelyTyped,Zorgatone/DefinitelyTyped,jraymakers/DefinitelyTyped,JoshRosen/DefinitelyTyped,digitalpixies/DefinitelyTyped,psnider/DefinitelyTyped,ryan-codingintrigue/DefinitelyTyped,georgemarshall/DefinitelyTyped,xStrom/DefinitelyTyped,magny/DefinitelyTyped,toedter/DefinitelyTyped,colindembovsky/DefinitelyTyped,sclausen/DefinitelyTyped,designxtek/DefinitelyTyped,biomassives/DefinitelyTyped,sixinli/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,ml-workshare/DefinitelyTyped,subash-a/DefinitelyTyped,bayitajesi/DefinitelyTyped,chrootsu/DefinitelyTyped,stephenjelfs/DefinitelyTyped,ajtowf/DefinitelyTyped,jpevarnek/DefinitelyTyped,mjjames/DefinitelyTyped,DeadAlready/DefinitelyTyped,RX14/DefinitelyTyped,zensh/DefinitelyTyped,borisyankov/DefinitelyTyped,timjk/DefinitelyTyped,michalczukm/DefinitelyTyped,arma-gast/DefinitelyTyped,glenndierckx/DefinitelyTyped,sventschui/DefinitelyTyped,Saneyan/DefinitelyTyped,PawelStroinski/DefinitelyTyped,uestcNaldo/DefinitelyTyped,bayitajesi/DefinitelyTyped,designxtek/DefinitelyTyped,Wordenskjold/DefinitelyTyped,AgentME/DefinitelyTyped,takenet/DefinitelyTyped,quantumman/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,Jwsonic/DefinitelyTyped,lseguin42/DefinitelyTyped,MugeSo/DefinitelyTyped,tscho/DefinitelyTyped,takenet/DefinitelyTyped,nabeix/DefinitelyTyped,OliveTreeBible/DefinitelyTyped,OfficeDev/DefinitelyTyped,jeremyhayes/DefinitelyTyped,maglar0/DefinitelyTyped,TanakaYutaro/DefinitelyTyped,nainslie/DefinitelyTyped,OliveTreeBible/DefinitelyTyped,zuohaocheng/DefinitelyTyped,DenEwout/DefinitelyTyped,gedaiu/DefinitelyTyped,erosb/DefinitelyTyped,arcticwaters/DefinitelyTyped,tgrospic/DefinitelyTyped,alexdresko/DefinitelyTyped,OpenMaths/DefinitelyTyped,elisee/DefinitelyTyped,zuzusik/DefinitelyTyped,kmeurer/DefinitelyTyped,hatz48/DefinitelyTyped,paulmorphy/DefinitelyTyped,nwolverson/DefinitelyTyped,Garciat/DefinitelyTyped,georgemarshall/DefinitelyTyped,TildaLabs/DefinitelyTyped,fredgalvao/DefinitelyTyped,Chris380/DefinitelyTyped,mjjames/DefinitelyTyped,brainded/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,akonwi/DefinitelyTyped,superduper/DefinitelyTyped,jimthedev/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,johan-gorter/DefinitelyTyped,OliveTreeBible/DefinitelyTyped,bobslaede/DefinitelyTyped,dumbmatter/DefinitelyTyped,Airblader/DefinitelyTyped,stimms/DefinitelyTyped,daptiv/DefinitelyTyped,benishouga/DefinitelyTyped,paypac/DefinitelyTyped,isman-usoh/DefinitelyTyped,modifyink/DefinitelyTyped,vote539/DefinitelyTyped,Dominator008/DefinitelyTyped,amanmahajan7/DefinitelyTyped,OliveTreeBible/DefinitelyTyped,yuit/DefinitelyTyped,subash-a/DefinitelyTyped,rerezz/DefinitelyTyped,micurs/DefinitelyTyped,Belelros/DefinitelyTyped,Ptival/DefinitelyTyped,stimms/DefinitelyTyped,chrismbarr/DefinitelyTyped,abner/DefinitelyTyped,pocke/DefinitelyTyped,mattanja/DefinitelyTyped,teves-castro/DefinitelyTyped,olemp/DefinitelyTyped,shlomiassaf/DefinitelyTyped,herrmanno/DefinitelyTyped,EnableSoftware/DefinitelyTyped,esperco/DefinitelyTyped,vincentw56/DefinitelyTyped,eugenpodaru/DefinitelyTyped,M-Zuber/DefinitelyTyped,aaharu/DefinitelyTyped,jtlan/DefinitelyTyped,balassy/DefinitelyTyped,gandjustas/DefinitelyTyped,borisyankov/DefinitelyTyped,jasonswearingen/DefinitelyTyped,balassy/DefinitelyTyped,AgentME/DefinitelyTyped,paulbakker/DefinitelyTyped,use-strict/DefinitelyTyped,mareek/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,alvarorahul/DefinitelyTyped,shlomiassaf/DefinitelyTyped,CSharpFan/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,innerverse/DefinitelyTyped,akonwi/DefinitelyTyped,HPFOD/DefinitelyTyped,philippstucki/DefinitelyTyped,danfma/DefinitelyTyped,ArturSoler/DefinitelyTyped,arueckle/DefinitelyTyped,jimthedev/DefinitelyTyped,bayitajesi/DefinitelyTyped,johnnycrab/DefinitelyTyped,abbasmhd/DefinitelyTyped,MidnightDesign/DefinitelyTyped,damianog/DefinitelyTyped,Zorgatone/DefinitelyTyped,mshmelev/DefinitelyTyped,icereed/DefinitelyTyped,fishgoh0nk/DefinitelyTyped,unknownloner/DefinitelyTyped,ajtowf/DefinitelyTyped,sledorze/DefinitelyTyped,Zenorbi/DefinitelyTyped,GodsBreath/DefinitelyTyped,Bunkerbewohner/DefinitelyTyped,emanuelhp/DefinitelyTyped,OpenMaths/DefinitelyTyped,ducin/DefinitelyTyped,Stephanvs/DefinitelyTyped,robert-voica/DefinitelyTyped,MugeSo/DefinitelyTyped,bkristensen/DefinitelyTyped,hellopao/DefinitelyTyped,pafflique/DefinitelyTyped,toedter/DefinitelyTyped,hafenr/DefinitelyTyped,ashwinr/DefinitelyTyped,behzad888/DefinitelyTyped,chocolatechipui/DefinitelyTyped,tboyce/DefinitelyTyped,Dashlane/DefinitelyTyped,Seltzer/DefinitelyTyped,eekboom/DefinitelyTyped,xStrom/DefinitelyTyped,dflor003/DefinitelyTyped,gcastre/DefinitelyTyped,aciccarello/DefinitelyTyped,raijinsetsu/DefinitelyTyped,spion/DefinitelyTyped,nmalaguti/DefinitelyTyped,bluong/DefinitelyTyped,RedSeal-co/DefinitelyTyped,paulmorphy/DefinitelyTyped,WritingPanda/DefinitelyTyped,jsaelhof/DefinitelyTyped,wilkerlucio/DefinitelyTyped,newclear/DefinitelyTyped,GregOnNet/DefinitelyTyped,jacqt/DefinitelyTyped,glenndierckx/DefinitelyTyped,algas/DefinitelyTyped,KonaTeam/DefinitelyTyped,UzEE/DefinitelyTyped,Bobjoy/DefinitelyTyped,jiaz/DefinitelyTyped,kuon/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,zalamtech/DefinitelyTyped,schmuli/DefinitelyTyped,teddyward/DefinitelyTyped,arusakov/DefinitelyTyped,kanreisa/DefinitelyTyped,schmuli/DefinitelyTyped,gregoryagu/DefinitelyTyped,syntax42/DefinitelyTyped,wilkerlucio/DefinitelyTyped,demerzel3/DefinitelyTyped,Stephanvs/DefinitelyTyped,gandjustas/DefinitelyTyped,chbrown/DefinitelyTyped,mareek/DefinitelyTyped,bdukes/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,TheBay0r/DefinitelyTyped,harcher81/DefinitelyTyped,Pro/DefinitelyTyped,tgfjt/DefinitelyTyped,HereSinceres/DefinitelyTyped,paulbakker/DefinitelyTyped,cvrajeesh/DefinitelyTyped,acepoblete/DefinitelyTyped,JeremyCBrooks/DefinitelyTyped,sandersky/DefinitelyTyped,lekaha/DefinitelyTyped,egeland/DefinitelyTyped,mweststrate/DefinitelyTyped,Lorisu/DefinitelyTyped,ErykB2000/DefinitelyTyped,donnut/DefinitelyTyped,robertbaker/DefinitelyTyped,alextkachman/DefinitelyTyped,kabogo/DefinitelyTyped,martinduparc/DefinitelyTyped,fredgalvao/DefinitelyTyped,pkaul/DefinitelyTyped,psnider/DefinitelyTyped,tgrospic/DefinitelyTyped,jaysoo/DefinitelyTyped,behzad888/DefinitelyTyped,sorskoot/DefinitelyTyped,aaharu/DefinitelyTyped,tarruda/DefinitelyTyped,use-strict/DefinitelyTyped,toedter/DefinitelyTyped,demerzel3/DefinitelyTyped,NCARalph/DefinitelyTyped,syuilo/DefinitelyTyped,stacktracejs/DefinitelyTyped,grahammendick/DefinitelyTyped,wilkerlucio/DefinitelyTyped,Minishlink/DefinitelyTyped,david-driscoll/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,mrozhin/DefinitelyTyped,minodisk/DefinitelyTyped,Penryn/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,algas/DefinitelyTyped,JoshRosen/DefinitelyTyped,isman-usoh/DefinitelyTyped,JoshRosen/DefinitelyTyped,abbasmhd/DefinitelyTyped,davidsidlinger/DefinitelyTyped,ArturSoler/DefinitelyTyped,nobuoka/DefinitelyTyped,amir-arad/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,dydek/DefinitelyTyped,axefrog/DefinitelyTyped,amanmahajan7/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,egeland/DefinitelyTyped,flyfishMT/DefinitelyTyped,muenchdo/DefinitelyTyped,bennett000/DefinitelyTyped,one-pieces/DefinitelyTyped,hypno2000/typings,reppners/DefinitelyTyped,nelsonmorais/DefinitelyTyped,leoromanovsky/DefinitelyTyped,44ka28ta/DefinitelyTyped,abmohan/DefinitelyTyped,YousefED/DefinitelyTyped,Deathspike/DefinitelyTyped,igorsechyn/DefinitelyTyped,timramone/DefinitelyTyped,bobslaede/DefinitelyTyped,dsebastien/DefinitelyTyped,tdmckinn/DefinitelyTyped,nseckinoral/DefinitelyTyped,vsavkin/DefinitelyTyped,spion/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,iislucas/DefinitelyTyped,david-driscoll/DefinitelyTyped,flyfishMT/DefinitelyTyped,sclausen/DefinitelyTyped,44ka28ta/DefinitelyTyped,awerlang/DefinitelyTyped,dmoonfire/DefinitelyTyped,mhegazy/DefinitelyTyped,thSoft/DefinitelyTyped,mhegazy/DefinitelyTyped,chrootsu/DefinitelyTyped,Penryn/DefinitelyTyped,michaelbromley/DefinitelyTyped,nwolverson/DefinitelyTyped,optical/DefinitelyTyped,Wordenskjold/DefinitelyTyped,QuatroCode/DefinitelyTyped,richardTowers/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,david-driscoll/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,aqua89/DefinitelyTyped,bilou84/DefinitelyTyped,alexdresko/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,jesseschalken/DefinitelyTyped,benishouga/DefinitelyTyped,bdoss/DefinitelyTyped,bdukes/DefinitelyTyped,HPFOD/DefinitelyTyped,johnnycrab/DefinitelyTyped,thSoft/DefinitelyTyped,designxtek/DefinitelyTyped,haskellcamargo/DefinitelyTyped,mwain/DefinitelyTyped,algas/DefinitelyTyped,algorithme/DefinitelyTyped,dsebastien/DefinitelyTyped,wbuchwalter/DefinitelyTyped,tomtheisen/DefinitelyTyped,sorskoot/DefinitelyTyped,ashwinr/DefinitelyTyped,wilfrem/DefinitelyTyped,iislucas/DefinitelyTyped,goaty92/DefinitelyTyped,optical/DefinitelyTyped,hatz48/DefinitelyTyped,3x14159265/DefinitelyTyped,tgrospic/DefinitelyTyped,stanislavHamara/DefinitelyTyped,newclear/DefinitelyTyped,Trapulo/DefinitelyTyped,greglockwood/DefinitelyTyped,georgemarshall/DefinitelyTyped,demerzel3/DefinitelyTyped,frogcjn/DefinitelyTyped,colindembovsky/DefinitelyTyped,jccarvalhosa/DefinitelyTyped,masonkmeyer/DefinitelyTyped,3x14159265/DefinitelyTyped,schmuli/DefinitelyTyped,martinduparc/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,smrq/DefinitelyTyped,nakakura/DefinitelyTyped,moonpyk/DefinitelyTyped,lucyhe/DefinitelyTyped,angelobelchior8/DefinitelyTyped,Almouro/DefinitelyTyped,modifyink/DefinitelyTyped,anweiss/DefinitelyTyped,gdi2290/DefinitelyTyped,sorskoot/DefinitelyTyped,vagarenko/DefinitelyTyped,gyohk/DefinitelyTyped,fearthecowboy/DefinitelyTyped,vagarenko/DefinitelyTyped,takfjt/DefinitelyTyped,psnider/DefinitelyTyped,axefrog/DefinitelyTyped,greglo/DefinitelyTyped,DeluxZ/DefinitelyTyped,axefrog/DefinitelyTyped,mshmelev/DefinitelyTyped,anweiss/DefinitelyTyped,paypac/DefinitelyTyped,nobuoka/DefinitelyTyped,jeffbcross/DefinitelyTyped,tomtarrot/DefinitelyTyped,pkaul/DefinitelyTyped,esperco/DefinitelyTyped,Dashlane/DefinitelyTyped,mszczepaniak/DefinitelyTyped,ecramer89/DefinitelyTyped,minodisk/DefinitelyTyped,georgemarshall/DefinitelyTyped,Airblader/DefinitelyTyped,cesarmarinhorj/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,tinganho/DefinitelyTyped,rfranco/DefinitelyTyped,brettle/DefinitelyTyped,mvarblow/DefinitelyTyped,MarlonFan/DefinitelyTyped,YousefED/DefinitelyTyped,corps/DefinitelyTyped,ArturSoler/DefinitelyTyped,xswordsx/DefinitelyTyped,PawelStroinski/DefinitelyTyped,vpineda1996/DefinitelyTyped,dwango-js/DefinitelyTyped,michaelbromley/DefinitelyTyped,Fraegle/DefinitelyTyped,wkrueger/DefinitelyTyped,Dominator008/DefinitelyTyped,miguelmq/DefinitelyTyped,zhiyiting/DefinitelyTyped,lbguilherme/DefinitelyTyped,opichals/DefinitelyTyped,bdukes/DefinitelyTyped,michaelbromley/DefinitelyTyped,arcticwaters/DefinitelyTyped,samwgoldman/DefinitelyTyped,colindembovsky/DefinitelyTyped,rushi216/DefinitelyTyped,Airblader/DefinitelyTyped,furny/DefinitelyTyped,hiraash/DefinitelyTyped,duncanmak/DefinitelyTyped,applesaucers/lodash-invokeMap,rockclimber90/DefinitelyTyped,shiwano/DefinitelyTyped,bdukes/DefinitelyTyped,JeremyCBrooks/DefinitelyTyped,arusakov/DefinitelyTyped,rcchen/DefinitelyTyped,zuzusik/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,hellopao/DefinitelyTyped,UzEE/DefinitelyTyped,frogcjn/DefinitelyTyped,abner/DefinitelyTyped,alextkachman/DefinitelyTyped,Belelros/DefinitelyTyped,Mek7/DefinitelyTyped,rschmukler/DefinitelyTyped,nmalaguti/DefinitelyTyped,Asido/DefinitelyTyped,Syati/DefinitelyTyped,bardt/DefinitelyTyped,balassy/DefinitelyTyped,Pro/DefinitelyTyped,deeleman/DefinitelyTyped,spion/DefinitelyTyped,aldo-roman/DefinitelyTyped,44ka28ta/DefinitelyTyped,progre/DefinitelyTyped,akonwi/DefinitelyTyped,drillbits/DefinitelyTyped,pwelter34/DefinitelyTyped,panuhorsmalahti/DefinitelyTyped,lbesson/DefinitelyTyped,bpowers/DefinitelyTyped,scsouthw/DefinitelyTyped,mattblang/DefinitelyTyped,Riron/DefinitelyTyped,bruennijs/DefinitelyTyped,elisee/DefinitelyTyped,progre/DefinitelyTyped,QuatroCode/DefinitelyTyped,nfriend/DefinitelyTyped,RX14/DefinitelyTyped,Pipe-shen/DefinitelyTyped,pocesar/DefinitelyTyped,whoeverest/DefinitelyTyped,wilkerlucio/DefinitelyTyped,kalloc/DefinitelyTyped,bdoss/DefinitelyTyped,spearhead-ea/DefinitelyTyped,alainsahli/DefinitelyTyped,nakakura/DefinitelyTyped,paypac/DefinitelyTyped,hellopao/DefinitelyTyped,balassy/DefinitelyTyped,axefrog/DefinitelyTyped,adammartin1981/DefinitelyTyped,tgfjt/DefinitelyTyped,harcher81/DefinitelyTyped,subjectix/DefinitelyTyped,philippsimon/DefinitelyTyped,aciccarello/DefinitelyTyped,theyelllowdart/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,paulbakker/DefinitelyTyped,felipe3dfx/DefinitelyTyped,3x14159265/DefinitelyTyped,sventschui/DefinitelyTyped,Syati/DefinitelyTyped,stacktracejs/DefinitelyTyped,aciccarello/DefinitelyTyped,onecentlin/DefinitelyTyped,arma-gast/DefinitelyTyped,DustinWehr/DefinitelyTyped,Stephanvs/DefinitelyTyped,syuilo/DefinitelyTyped,forumone/DefinitelyTyped,aaharu/DefinitelyTyped,bennett000/DefinitelyTyped,musically-ut/DefinitelyTyped,rschmukler/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,alvarorahul/DefinitelyTyped,behzad88/DefinitelyTyped,JaminFarr/DefinitelyTyped,florentpoujol/DefinitelyTyped,darkl/DefinitelyTyped,lukehoban/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,the41/DefinitelyTyped,hor-crux/DefinitelyTyped,mrk21/DefinitelyTyped,demerzel3/DefinitelyTyped,drinchev/DefinitelyTyped,dariajung/DefinitelyTyped,stylelab-io/DefinitelyTyped,arusakov/DefinitelyTyped,brentonhouse/DefinitelyTyped,nainslie/DefinitelyTyped,gyohk/DefinitelyTyped,Gmulti/DefinitelyTyped,stephenjelfs/DefinitelyTyped,almstrand/DefinitelyTyped,EnableSoftware/DefinitelyTyped,gcastre/DefinitelyTyped,Asido/DefinitelyTyped,dydek/DefinitelyTyped,PopSugar/DefinitelyTyped,smrq/DefinitelyTyped,danfma/DefinitelyTyped,drinchev/DefinitelyTyped,harcher81/DefinitelyTyped,johan-gorter/DefinitelyTyped,jimthedev/DefinitelyTyped,designxtek/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,scatcher/DefinitelyTyped,jasonswearingen/DefinitelyTyped,Seikho/DefinitelyTyped,laco0416/DefinitelyTyped,Kuniwak/DefinitelyTyped,ahmedalsudani/DefinitelyTyped,SebastianCoetzee/DefinitelyTyped,yuit/DefinitelyTyped,benliddicott/DefinitelyTyped,gildorwang/DefinitelyTyped,nwolverson/DefinitelyTyped,pwelter34/DefinitelyTyped,sventschui/DefinitelyTyped,shiwano/DefinitelyTyped,philippstucki/DefinitelyTyped,iCoreSolutions/DefinitelyTyped,Nemo157/DefinitelyTyped,chrilith/DefinitelyTyped,tigerxy/DefinitelyTyped,maxlang/DefinitelyTyped,spion/DefinitelyTyped,rolandzwaga/DefinitelyTyped,bjfletcher/DefinitelyTyped,samdark/DefinitelyTyped,NelsonLamprecht/DefinitelyTyped,anweiss/DefinitelyTyped,mattblang/DefinitelyTyped,johnnycrab/DefinitelyTyped,mcrawshaw/DefinitelyTyped,dreampulse/DefinitelyTyped,robl499/DefinitelyTyped,xica/DefinitelyTyped,dragouf/DefinitelyTyped,mendix/DefinitelyTyped,nycdotnet/DefinitelyTyped,nwolverson/DefinitelyTyped,tjoskar/DefinitelyTyped,philippsimon/DefinitelyTyped,vasek17/DefinitelyTyped,LordJZ/DefinitelyTyped,pkaul/DefinitelyTyped,evandrewry/DefinitelyTyped,pocesar/DefinitelyTyped,Litee/DefinitelyTyped,ryan10132/DefinitelyTyped,adamcarr/DefinitelyTyped,Zzzen/DefinitelyTyped,JoshRosen/DefinitelyTyped,shahata/DefinitelyTyped,Shiak1/DefinitelyTyped,basp/DefinitelyTyped,shovon/DefinitelyTyped,emanuelhp/DefinitelyTyped,sventschui/DefinitelyTyped,chadoliver/DefinitelyTyped,zuzusik/DefinitelyTyped,harcher81/DefinitelyTyped,davidpricedev/DefinitelyTyped,Ridermansb/DefinitelyTyped,3x14159265/DefinitelyTyped,giggio/DefinitelyTyped,Ptival/DefinitelyTyped,nycdotnet/DefinitelyTyped,paypac/DefinitelyTyped,PascalSenn/DefinitelyTyped,reppners/DefinitelyTyped,nojaf/DefinitelyTyped,olemp/DefinitelyTyped,Belelros/DefinitelyTyped,raijinsetsu/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,Karabur/DefinitelyTyped,damianog/DefinitelyTyped
--- +++ @@ -21,7 +21,7 @@ fieldSelector?: string; /**Make Are-You-Sure "silent" by disabling the warning message*/ - silent: boolean; + silent?: boolean; } interface AreYouSure {
da084cb560d0e4053249e72d842623166afa16c0
src/app/common/forms.service.ts
src/app/common/forms.service.ts
import { Injectable } from '@angular/core'; import { DynamicFormControlModel, DynamicInputModel } from '@ng2-dynamic-forms/core'; @Injectable() export class FormFactoryService { createFormModel(properties: Map<string, any>): DynamicFormControlModel[] { const answer = <DynamicFormControlModel[]>[]; for (const key in properties) { if (!properties.hasOwnProperty(key)) { continue; } const value: any = properties[key]; let formField: any; let type = (value.type || '').toLowerCase(); switch (value.type.toLowerCase()) { case 'string': case 'text': case 'number': case 'boolean': case 'password': case 'java.lang.string': if (type === 'java.lang.string') { type = 'text'; } formField = new DynamicInputModel({ id: value.name || key, label: value.title || value.label, hint: value.description, inputType: type, }); break; default: break; } if (formField) { answer.push(formField); } } return answer; } }
import { Injectable } from '@angular/core'; import { DynamicFormControlModel, DynamicInputModel } from '@ng2-dynamic-forms/core'; @Injectable() export class FormFactoryService { createFormModel(properties: Map<string, any>): DynamicFormControlModel[] { const answer = <DynamicFormControlModel[]>[]; for (const key in properties) { if (!properties.hasOwnProperty(key)) { continue; } const value: any = properties[key]; let formField: any; let type = (value.type || '').toLowerCase(); switch (value.type.toLowerCase()) { case 'string': case 'text': case 'number': case 'boolean': case 'password': case 'java.lang.string': if (type === 'java.lang.string') { type = 'text'; } formField = new DynamicInputModel({ id: value.name || key, label: value.title || value.displayName || value.name || key, hint: value.description, inputType: type, }); break; default: break; } if (formField) { answer.push(formField); } } return answer; } }
Use best option for form labels
Use best option for form labels
TypeScript
apache-2.0
kahboom/ipaas-client,kahboom/ipaas-client,kahboom/ipaas-client,kahboom/ipaas-client
--- +++ @@ -25,7 +25,7 @@ } formField = new DynamicInputModel({ id: value.name || key, - label: value.title || value.label, + label: value.title || value.displayName || value.name || key, hint: value.description, inputType: type, });
3904733823a9da50033708d6badb7508348650b5
packages/@glimmer/util/lib/platform-utils.ts
packages/@glimmer/util/lib/platform-utils.ts
export type Option<T> = T | null; export type Maybe<T> = Option<T> | undefined | void; export type Factory<T> = new (...args: unknown[]) => T; export function keys<T>(obj: T): Array<keyof T> { return Object.keys(obj) as Array<keyof T>; } export function unwrap<T>(val: Maybe<T>): T { if (val === null || val === undefined) throw new Error(`Expected value to be present`); return val as T; } export function expect<T>(val: Maybe<T>, message: string): T { if (val === null || val === undefined) throw new Error(message); return val as T; } export function unreachable(message = 'unreachable'): Error { return new Error(message); } export function exhausted(value: never): never { throw new Error(`Exhausted ${value}`); } export type Lit = string | number | boolean | undefined | null | void | {}; export const tuple = <T extends Lit[]>(...args: T) => args; export const symbol = typeof Symbol !== 'undefined' ? Symbol : (key: string) => `__${key}${Math.floor(Math.random() * Date.now())}__` as any;
export type Option<T> = T | null; export type Maybe<T> = Option<T> | undefined | void; export type Factory<T> = new (...args: unknown[]) => T; export const HAS_NATIVE_SYMBOL = (function () { if (typeof Symbol !== 'function') { return false; } // eslint-disable-next-line symbol-description return typeof Symbol() === 'symbol'; })(); export function keys<T>(obj: T): Array<keyof T> { return Object.keys(obj) as Array<keyof T>; } export function unwrap<T>(val: Maybe<T>): T { if (val === null || val === undefined) throw new Error(`Expected value to be present`); return val as T; } export function expect<T>(val: Maybe<T>, message: string): T { if (val === null || val === undefined) throw new Error(message); return val as T; } export function unreachable(message = 'unreachable'): Error { return new Error(message); } export function exhausted(value: never): never { throw new Error(`Exhausted ${value}`); } export type Lit = string | number | boolean | undefined | null | void | {}; export const tuple = <T extends Lit[]>(...args: T) => args; export const symbol = HAS_NATIVE_SYMBOL ? Symbol : (key: string) => `__${key}${Math.floor(Math.random() * Date.now())}__` as any;
Use custom symbol whenever native is not present
[BUGFIX] Use custom symbol whenever native is not present Uses the custom symbol logic whenever native is not present, preventing us from using polyfills. This ensures that our polyfilled symbols have the same assignment semantics as native symbols, specifically Object.assign.
TypeScript
mit
tildeio/glimmer,glimmerjs/glimmer-vm,glimmerjs/glimmer-vm,tildeio/glimmer,glimmerjs/glimmer-vm,tildeio/glimmer
--- +++ @@ -2,6 +2,15 @@ export type Maybe<T> = Option<T> | undefined | void; export type Factory<T> = new (...args: unknown[]) => T; + +export const HAS_NATIVE_SYMBOL = (function () { + if (typeof Symbol !== 'function') { + return false; + } + + // eslint-disable-next-line symbol-description + return typeof Symbol() === 'symbol'; +})(); export function keys<T>(obj: T): Array<keyof T> { return Object.keys(obj) as Array<keyof T>; @@ -29,7 +38,6 @@ export const tuple = <T extends Lit[]>(...args: T) => args; -export const symbol = - typeof Symbol !== 'undefined' - ? Symbol - : (key: string) => `__${key}${Math.floor(Math.random() * Date.now())}__` as any; +export const symbol = HAS_NATIVE_SYMBOL + ? Symbol + : (key: string) => `__${key}${Math.floor(Math.random() * Date.now())}__` as any;
efd95a8b7a86184c93f5a27595d0594b356d0db3
src/types/components/controller.d.ts
src/types/components/controller.d.ts
import Swiper from '../swiper-class'; export interface ControllerMethods { /** * Pass here another Swiper instance or array with Swiper instances that should be controlled * by this Swiper */ control?: Swiper; } export interface ControllerEvents {} export interface ControllerOptions { /** * Pass here another Swiper instance or array with Swiper instances that should be controlled * by this Swiper */ control?: Swiper; /** * Set to `true` and controlling will be in inverse direction * * @default false */ inverse?: boolean; /** * Defines a way how to control another slider: slide by slide * (with respect to other slider's grid) or depending on all slides/container * (depending on total slider percentage). * * @default 'slide' */ by?: 'slide' | 'container'; }
import Swiper from '../swiper-class'; export interface ControllerMethods { /** * Pass here another Swiper instance or array with Swiper instances that should be controlled * by this Swiper */ control?: Swiper; } export interface ControllerEvents {} export interface ControllerOptions { /** * Pass here another Swiper instance or array with Swiper instances that should be controlled * by this Swiper */ control?: Swiper | Swiper[]; /** * Set to `true` and controlling will be in inverse direction * * @default false */ inverse?: boolean; /** * Defines a way how to control another slider: slide by slide * (with respect to other slider's grid) or depending on all slides/container * (depending on total slider percentage). * * @default 'slide' */ by?: 'slide' | 'container'; }
Fix control type in ControllerOptions interface
Fix control type in ControllerOptions interface Regarding the documentation `control` could be Swiper instance or array with Swiper instances. Read more - https://swiperjs.com/swiper-api#controller-methods.
TypeScript
mit
nolimits4web/Swiper,nolimits4web/Swiper
--- +++ @@ -15,7 +15,7 @@ * Pass here another Swiper instance or array with Swiper instances that should be controlled * by this Swiper */ - control?: Swiper; + control?: Swiper | Swiper[]; /** * Set to `true` and controlling will be in inverse direction
f740459678fdb7458338cfb3396edfb317d4fb03
packages/tux/src/components/AlertBar/index.tsx
packages/tux/src/components/AlertBar/index.tsx
import React from 'react' import classNames from 'classnames' import { tuxColors } from '../../styles' const AlertBar = () => ( <div className="AlertBar"> <p>You are in edit mode. Any changes you make will be published.</p> <style jsx>{` .AlertBar { background: ${tuxColors.colorPink}; color: #FFF; display: flex; justify-content: center; padding: 5px; position: fixed; text-align: center; bottom: 0; width: 100%; z-index: 50; } `}</style> </div> ) export default AlertBar
import React, { Component } from 'react' import classNames from 'classnames' import { tuxColors } from '../../styles' class AlertBar extends Component { hideDelay = 1500 state = { isHidden: false, } componentDidMount() { this.timer = setTimeout(() => { this.setState({ isHidden: true }) }, this.hideDelay) } componentWillUnmount() { clearTimeout(this.timer) } render() { const { isHidden } = this.state return ( <div className={classNames('AlertBar', isHidden && 'is-hidden' )}> <p className="AlertBar-text">You are in edit mode. Any changes you make will be published.</p> <style jsx>{` .AlertBar { background: ${tuxColors.colorPink}; bottom: 0; color: #FFF; display: flex; justify-content: center; padding: 5px; position: fixed; text-align: center; transform: 0; transition: transform; width: 100%; will-change: transform; z-index: 50; } .AlertBar.is-hidden { transform: translateY(80%); transition-duration: 0.15s; transition-timing-function: ease-out; } .ALertBar.is-hidden:hover { transform: translateY(0); transition-duration: 0.30s; } .AlertBar-text { cursor: default; } `}</style> </div> ) } } export default AlertBar
Make AlertBar hide after X ms. Appear on hover.
Make AlertBar hide after X ms. Appear on hover.
TypeScript
mit
aranja/tux,aranja/tux,aranja/tux
--- +++ @@ -1,25 +1,65 @@ -import React from 'react' +import React, { Component } from 'react' import classNames from 'classnames' import { tuxColors } from '../../styles' -const AlertBar = () => ( - <div className="AlertBar"> - <p>You are in edit mode. Any changes you make will be published.</p> - <style jsx>{` - .AlertBar { - background: ${tuxColors.colorPink}; - color: #FFF; - display: flex; - justify-content: center; - padding: 5px; - position: fixed; - text-align: center; - bottom: 0; - width: 100%; - z-index: 50; - } - `}</style> - </div> -) +class AlertBar extends Component { + hideDelay = 1500 + + state = { + isHidden: false, + } + + componentDidMount() { + this.timer = setTimeout(() => { + this.setState({ + isHidden: true + }) + }, this.hideDelay) + } + + componentWillUnmount() { + clearTimeout(this.timer) + } + + render() { + const { isHidden } = this.state + + return ( + <div className={classNames('AlertBar', isHidden && 'is-hidden' )}> + <p className="AlertBar-text">You are in edit mode. Any changes you make will be published.</p> + <style jsx>{` + .AlertBar { + background: ${tuxColors.colorPink}; + bottom: 0; + color: #FFF; + display: flex; + justify-content: center; + padding: 5px; + position: fixed; + text-align: center; + transform: 0; + transition: transform; + width: 100%; + will-change: transform; + z-index: 50; + } + .AlertBar.is-hidden { + transform: translateY(80%); + transition-duration: 0.15s; + transition-timing-function: ease-out; + } + .ALertBar.is-hidden:hover { + transform: translateY(0); + transition-duration: 0.30s; + } + .AlertBar-text { + cursor: default; + } + `}</style> + </div> + ) + } + +} export default AlertBar
58b5927fa5680c23be45d46d792cbd3f6e7e67c8
packages/mugshot/src/interfaces/screenshotter.ts
packages/mugshot/src/interfaces/screenshotter.ts
import { MugshotSelector } from '../lib/mugshot'; export interface ScreenshotOptions { /** * All elements identified by this selector will be painted black * before taking the screenshot. * TODO: support rects * TODO: configure the color */ ignore?: string; } /** * Thrown when the selector passed to [[Mugshot.check]] matches more than one * element. */ export class TooManyElementsError extends Error { constructor(selector: MugshotSelector) { super(`More than 1 elements matches ${selector}. You can only take a screenshot of one element. Please narrow down your selector.`); } } export default interface Screenshotter { /** * Take a viewport screenshot. */ takeScreenshot(options?: ScreenshotOptions): Promise<Buffer>; /** * Take a screenshot of a single element. * * Will throw [[TooManyElementsError]] if `selector` matches more than one element. */ takeScreenshot( selector: MugshotSelector, options?: ScreenshotOptions ): Promise<Buffer>; }
import { MugshotSelector } from '../lib/mugshot'; export interface ScreenshotOptions { /** * All elements identified by this selector will be painted black * before taking the screenshot. * TODO: configure the color */ ignore?: MugshotSelector; } /** * Thrown when the selector passed to [[Mugshot.check]] matches more than one * element. */ export class TooManyElementsError extends Error { constructor(selector: MugshotSelector) { super(`More than 1 elements matches ${selector}. You can only take a screenshot of one element. Please narrow down your selector.`); } } export default interface Screenshotter { /** * Take a viewport screenshot. */ takeScreenshot(options?: ScreenshotOptions): Promise<Buffer>; /** * Take a screenshot of a single element. * * Will throw [[TooManyElementsError]] if `selector` matches more than one element. */ takeScreenshot( selector: MugshotSelector, options?: ScreenshotOptions ): Promise<Buffer>; }
Change ignore type to be MugshotSelector
Change ignore type to be MugshotSelector
TypeScript
mit
uberVU/mugshot,uberVU/mugshot
--- +++ @@ -4,10 +4,9 @@ /** * All elements identified by this selector will be painted black * before taking the screenshot. - * TODO: support rects * TODO: configure the color */ - ignore?: string; + ignore?: MugshotSelector; } /**
739cea11323ea2efe26ab6c3fa2631eccb1de1af
assets/components/tsx/Header.tsx
assets/components/tsx/Header.tsx
import h from '../../../lib/tsx/TsxParser'; export interface LinkProps { href: string; title: string; } function Link(props: Partial<LinkProps>): JSX.Element { const { href, title } = props as LinkProps; return ( <a href={href} title={title} target="_blank" rel="noopener"> {title} </a> ); } interface HeaderProps { firstName: string; lastName: string; links: LinkProps[]; } export function Header(props: Partial<HeaderProps>): JSX.Element { const { firstName, lastName, links } = props as HeaderProps; const linkElements = links.map((link: LinkProps) => ( <Link href={link.href} title={link.title} /> )); return ( <header> <div className="top-avatar" /> <h1> {firstName} <strong>{lastName}</strong> </h1> <nav>{linkElements}</nav> </header> ); }
import h from '../../../lib/tsx/TsxParser'; export interface LinkProps { href: string; title: string; } function Link(props: Partial<LinkProps>): JSX.Element { const { href, title } = props as LinkProps; return ( <a href={href} title={title} target="_blank" rel="noopener"> {title} </a> ); } interface HeaderProps { firstName: string; lastName: string; links: LinkProps[]; } export function Header(props: Partial<HeaderProps>): JSX.Element { const { firstName, lastName, links } = props as HeaderProps; const linkElements = links.map((link: LinkProps) => ( <Link href={link.href} title={link.title} /> )); return ( <header> <div className="top-avatar" /> <h1> {firstName} <strong>{lastName}</strong> </h1> <nav>{linkElements.join('')}</nav> </header> ); }
Fix links being comma seperated.
Fix links being comma seperated.
TypeScript
mit
birkett/a-birkett.co.uk
--- +++ @@ -36,7 +36,7 @@ {firstName} <strong>{lastName}</strong> </h1> - <nav>{linkElements}</nav> + <nav>{linkElements.join('')}</nav> </header> ); }
5938a872641614d7f4a6af8505791f2aa68df701
packages/components/containers/filePreview/UnsupportedPreview.tsx
packages/components/containers/filePreview/UnsupportedPreview.tsx
import React from 'react'; import { c } from 'ttag'; import unsupportedPreviewSvg from 'design-system/assets/img/errors/broken-file.svg'; import corruptedPreviewSvg from 'design-system/assets/img/errors/broken-image.svg'; import { PrimaryButton } from '../../components'; import { useActiveBreakpoint } from '../../hooks'; import { classnames } from '../../helpers'; interface Props { type?: 'file' | 'image'; onSave?: () => void; } const UnsupportedPreview = ({ onSave, type = 'file' }: Props) => { const { isNarrow } = useActiveBreakpoint(); return ( <div className="centered-absolute text-center w100 pl1 pr1"> <img className={classnames(['mb1', isNarrow ? 'w150p' : 'w200p'])} src={type === 'file' ? unsupportedPreviewSvg : corruptedPreviewSvg} alt={c('Info').t`Unsupported file`} /> <h2 className={classnames(['p0-25 text-bold', isNarrow && 'h3'])}>{c('Info').t`No preview available`}</h2> {onSave && ( <PrimaryButton size={!isNarrow ? 'large' : undefined} className={classnames(['text-bold', !isNarrow && 'w150p'])} onClick={onSave} >{c('Action').t`Download`}</PrimaryButton> )} </div> ); }; export default UnsupportedPreview;
import React from 'react'; import { c } from 'ttag'; import unsupportedPreviewSvg from 'design-system/assets/img/errors/preview-unavailable.svg'; import corruptedPreviewSvg from 'design-system/assets/img/errors/broken-image.svg'; import { PrimaryButton } from '../../components'; import { useActiveBreakpoint } from '../../hooks'; import { classnames } from '../../helpers'; interface Props { type?: 'file' | 'image'; onSave?: () => void; } const UnsupportedPreview = ({ onSave, type = 'file' }: Props) => { const { isNarrow } = useActiveBreakpoint(); return ( <div className="centered-absolute text-center w100 pl1 pr1"> <img className={classnames(['mb1', isNarrow ? 'w150p' : 'w200p'])} src={type === 'file' ? unsupportedPreviewSvg : corruptedPreviewSvg} alt={c('Info').t`Unsupported file`} /> <h2 className={classnames(['p0-25 text-bold', isNarrow && 'h3'])}>{c('Info').t`No preview available`}</h2> {onSave && ( <PrimaryButton size={!isNarrow ? 'large' : undefined} className={classnames(['text-bold', !isNarrow && 'w150p'])} onClick={onSave} >{c('Action').t`Download`}</PrimaryButton> )} </div> ); }; export default UnsupportedPreview;
Replace illustration for unavailable preview
Replace illustration for unavailable preview
TypeScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -1,6 +1,6 @@ import React from 'react'; import { c } from 'ttag'; -import unsupportedPreviewSvg from 'design-system/assets/img/errors/broken-file.svg'; +import unsupportedPreviewSvg from 'design-system/assets/img/errors/preview-unavailable.svg'; import corruptedPreviewSvg from 'design-system/assets/img/errors/broken-image.svg'; import { PrimaryButton } from '../../components'; import { useActiveBreakpoint } from '../../hooks';
49eec36c2b336446a30b0c80fcebe53bba3079d2
src/logger/index.ts
src/logger/index.ts
import chalk from 'chalk'; import { RuleToRuleApplicationResult } from './../types'; import logToConsole from './console'; import { compactProjectLogs } from './flatten'; export const consoleLogger = (projectResult: RuleToRuleApplicationResult): number => { const projectLogs = compactProjectLogs(projectResult); if (projectLogs.length) { console.log(chalk.bgBlackBright('Project')); logToConsole(projectLogs); } return projectLogs.length; };
import chalk from 'chalk'; import { RuleToRuleApplicationResult } from './../types'; import logToConsole from './console'; import { compactProjectLogs } from './flatten'; export const consoleLogger = (projectResult: RuleToRuleApplicationResult): number => { const projectLogs = compactProjectLogs(projectResult); if (projectLogs.length) { console.log(chalk.bgBlackBright('Project')); logToConsole(projectLogs); } const errorCount = Object.values(projectLogs).reduce( (acc, i) => acc + ((i.errors && i.errors.length) || 0), 0, ); return errorCount; };
Return an error code equal to the number of errors found
Return an error code equal to the number of errors found
TypeScript
mit
stricter/stricter,stricter/stricter
--- +++ @@ -5,10 +5,16 @@ export const consoleLogger = (projectResult: RuleToRuleApplicationResult): number => { const projectLogs = compactProjectLogs(projectResult); + if (projectLogs.length) { console.log(chalk.bgBlackBright('Project')); logToConsole(projectLogs); } - return projectLogs.length; + const errorCount = Object.values(projectLogs).reduce( + (acc, i) => acc + ((i.errors && i.errors.length) || 0), + 0, + ); + + return errorCount; };
a24594d7912b686d8f8df1c3db542a6a948ff4bd
test/app/settings/settings.component.spec.ts
test/app/settings/settings.component.spec.ts
import { TestBed, ComponentFixture } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { FormsModule } from '@angular/forms'; import { Title } from '@angular/platform-browser'; import { DragulaService } from 'ng2-dragula'; import { SettingsComponent } from '../../../src/app/settings/settings.component'; import { SettingsModule } from '../../../src/app/settings/settings.module'; import { SettingsService } from '../../../src/app/settings/settings.service'; import { StringsService } from '../../../src/app/shared/services'; describe('Settings', () => { let component: SettingsComponent; let fixture: ComponentFixture<SettingsComponent>; beforeEach(() => { TestBed.configureTestingModule({ imports: [ RouterTestingModule, HttpClientTestingModule, FormsModule, SettingsModule ], providers: [ Title, DragulaService, SettingsService, { provide: StringsService, useValue: { stringsChanged: { subscribe: (fn: any) => { fn({ settings: 'Settings' }); return { unsubscribe: () => {} }; } } } } ] }).compileComponents(); }); beforeEach(() => { fixture = TestBed.createComponent(SettingsComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it('sets the title when constructed', () => { expect((component as any).title.getTitle()).toEqual('TaskBoard - Settings'); }); });
import { TestBed, ComponentFixture } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { FormsModule } from '@angular/forms'; import { Title } from '@angular/platform-browser'; import { SettingsComponent } from '../../../src/app/settings/settings.component'; import { SettingsModule } from '../../../src/app/settings/settings.module'; import { SettingsService } from '../../../src/app/settings/settings.service'; import { StringsService } from '../../../src/app/shared/services'; describe('Settings', () => { let component: SettingsComponent; let fixture: ComponentFixture<SettingsComponent>; beforeEach(() => { TestBed.configureTestingModule({ imports: [ RouterTestingModule, HttpClientTestingModule, FormsModule, SettingsModule ], providers: [ Title, SettingsService, { provide: StringsService, useValue: { stringsChanged: { subscribe: (fn: any) => { fn({ settings: 'Settings' }); return { unsubscribe: () => {} }; } } } } ] }).compileComponents(); }); beforeEach(() => { fixture = TestBed.createComponent(SettingsComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it('sets the title when constructed', () => { expect((component as any).title.getTitle()).toEqual('TaskBoard - Settings'); }); });
Remove Dragula from tests as well
Remove Dragula from tests as well
TypeScript
mit
kiswa/TaskBoard,kiswa/TaskBoard,kiswa/TaskBoard,kiswa/TaskBoard,kiswa/TaskBoard
--- +++ @@ -3,8 +3,6 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { FormsModule } from '@angular/forms'; import { Title } from '@angular/platform-browser'; - -import { DragulaService } from 'ng2-dragula'; import { SettingsComponent } from '../../../src/app/settings/settings.component'; import { SettingsModule } from '../../../src/app/settings/settings.module'; @@ -25,7 +23,6 @@ ], providers: [ Title, - DragulaService, SettingsService, { provide: StringsService,
8cce17ecad84efc17cc2ebaf6ffc0bfced237aaf
packages/components/containers/autoReply/AutoReplyForm/fields/DaysOfWeekField.tsx
packages/components/containers/autoReply/AutoReplyForm/fields/DaysOfWeekField.tsx
import { c } from 'ttag'; import { getFormattedWeekdays } from '@proton/shared/lib/date/date'; import { dateLocale } from '@proton/shared/lib/i18n'; import { Checkbox } from '../../../../components'; import SettingsLayout from '../../../account/SettingsLayout'; import SettingsLayoutRight from '../../../account/SettingsLayoutRight'; import SettingsLayoutLeft from '../../../account/SettingsLayoutLeft'; interface Props { value?: number[]; onChange: (days: number[]) => void; } const DaysOfWeekField = ({ value = [], onChange }: Props) => { const handleChange = (weekday: number) => () => onChange(value.includes(weekday) ? value.filter((existing) => weekday !== existing) : [...value, weekday]); return ( <SettingsLayout> <SettingsLayoutLeft> <label className="text-semibold">{c('Label').t`Days of the week`}</label> </SettingsLayoutLeft> <SettingsLayoutRight> <div className="flex flex-column"> {getFormattedWeekdays('iiii', { locale: dateLocale }).map((text, i) => ( <Checkbox id={`weekday-${i}`} key={text} checked={value.includes(i)} onChange={handleChange(i)}> {text} </Checkbox> ))} </div> </SettingsLayoutRight> </SettingsLayout> ); }; export default DaysOfWeekField;
import { c } from 'ttag'; import { getFormattedWeekdays } from '@proton/shared/lib/date/date'; import { dateLocale } from '@proton/shared/lib/i18n'; import { Checkbox } from '../../../../components'; import SettingsLayout from '../../../account/SettingsLayout'; import SettingsLayoutRight from '../../../account/SettingsLayoutRight'; import SettingsLayoutLeft from '../../../account/SettingsLayoutLeft'; interface Props { value?: number[]; onChange: (days: number[]) => void; } const DaysOfWeekField = ({ value = [], onChange }: Props) => { const handleChange = (weekday: number) => () => onChange(value.includes(weekday) ? value.filter((existing) => weekday !== existing) : [...value, weekday]); return ( <SettingsLayout> <SettingsLayoutLeft> <span id="label-days-of-week" className="label text-semibold">{c('Label').t`Days of the week`}</span> </SettingsLayoutLeft> <SettingsLayoutRight> <div className="flex flex-column pt0-25"> {getFormattedWeekdays('iiii', { locale: dateLocale }).map((text, i) => ( <Checkbox className="mb0-25" id={`weekday-${i}`} key={text} checked={value.includes(i)} onChange={handleChange(i)} aria-describedby="label-days-of-week" > {text} </Checkbox> ))} </div> </SettingsLayoutRight> </SettingsLayout> ); }; export default DaysOfWeekField;
Fix auto-reply daily option display
Fix auto-reply daily option display - added some margin - fix vocalization "because we worth it"
TypeScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -20,12 +20,19 @@ return ( <SettingsLayout> <SettingsLayoutLeft> - <label className="text-semibold">{c('Label').t`Days of the week`}</label> + <span id="label-days-of-week" className="label text-semibold">{c('Label').t`Days of the week`}</span> </SettingsLayoutLeft> <SettingsLayoutRight> - <div className="flex flex-column"> + <div className="flex flex-column pt0-25"> {getFormattedWeekdays('iiii', { locale: dateLocale }).map((text, i) => ( - <Checkbox id={`weekday-${i}`} key={text} checked={value.includes(i)} onChange={handleChange(i)}> + <Checkbox + className="mb0-25" + id={`weekday-${i}`} + key={text} + checked={value.includes(i)} + onChange={handleChange(i)} + aria-describedby="label-days-of-week" + > {text} </Checkbox> ))}
870757470473a692eb09947ea6ed2e3d45e4027f
src/extension.ts
src/extension.ts
'use strict'; import * as net from 'net'; import { workspace, ExtensionContext, Uri } from 'vscode'; import { ServerOptions, Executable, LanguageClient, LanguageClientOptions, TransportKind } from 'vscode-languageclient'; // this method is called when your extension is activated // your extension is activated the very first time the command is executed export function activate(context: ExtensionContext) { // Load the path to the language server from settings let executableCommand = workspace.getConfiguration("swift") .get("languageServerPath", "/usr/local/bin/LanguageServer"); let run: Executable = { command: executableCommand }; let debug: Executable = run; let serverOptions: ServerOptions = { run: run, debug: debug }; // client extensions configure their server let clientOptions: LanguageClientOptions = { documentSelector: ['swift'], synchronize: { configurationSection: 'swift', fileEvents: workspace.createFileSystemWatcher('**/*.swift', false, true, false) } } let client = new LanguageClient('Swift', serverOptions, clientOptions); // Push the disposable to the context's subscriptions so that the // client can be deactivated on extension deactivation context.subscriptions.push(client.start()); } // this method is called when your extension is deactivated export function deactivate() { }
'use strict'; import * as net from 'net'; import { workspace, ExtensionContext, Uri } from 'vscode'; import { ServerOptions, Executable, LanguageClient, LanguageClientOptions, TransportKind } from 'vscode-languageclient'; // this method is called when your extension is activated // your extension is activated the very first time the command is executed export function activate(context: ExtensionContext) { // Load the path to the language server from settings let executableCommand = workspace.getConfiguration("swift") .get("languageServerPath", "/usr/local/bin/LanguageServer"); let run: Executable = { command: executableCommand }; let debug: Executable = run; let serverOptions: ServerOptions = { run: run, debug: debug }; // client extensions configure their server let clientOptions: LanguageClientOptions = { documentSelector: ['swift'], synchronize: { configurationSection: 'swift', fileEvents: [ workspace.createFileSystemWatcher('**/*.swift', false, true, false), workspace.createFileSystemWatcher('**/.build/{debug,release}.yaml', false, false, false) ] } } let client = new LanguageClient('Swift', serverOptions, clientOptions); // Push the disposable to the context's subscriptions so that the // client can be deactivated on extension deactivation context.subscriptions.push(client.start()); } // this method is called when your extension is deactivated export function deactivate() { }
Watch for changes to SwiftPM llbuild configurations
Watch for changes to SwiftPM llbuild configurations
TypeScript
mit
RLovelett/vscode-swift
--- +++ @@ -24,7 +24,10 @@ documentSelector: ['swift'], synchronize: { configurationSection: 'swift', - fileEvents: workspace.createFileSystemWatcher('**/*.swift', false, true, false) + fileEvents: [ + workspace.createFileSystemWatcher('**/*.swift', false, true, false), + workspace.createFileSystemWatcher('**/.build/{debug,release}.yaml', false, false, false) + ] } }
f5daff0d00407cc9d57b780f2d6fd33a16ab65b7
projects/library/drawer/src/drawer-animations.ts
projects/library/drawer/src/drawer-animations.ts
import { animate, AnimationTriggerMetadata, state, style, transition, trigger, } from '@angular/animations'; /** * Animations used by the {@link TsDrawerComponent}. */ export const tsDrawerAnimations: { readonly transformDrawer: AnimationTriggerMetadata; } = { // Animation that expands and collapses a drawer. transformDrawer: trigger('transform', [ state('open, open-instant', style({ transform: 'none', visibility: 'visible', width: '{{ expandedSize }}', }), { params: { expandedSize: '12.5rem' } }), state('void', style({ 'box-shadow': 'none', 'visibility': 'visible', 'width': '{{ collapsedSize }}', }), { params: { collapsedSize: '3.75rem' } }), state('void-shadow', style({ visibility: 'visible', width: '{{ collapsedSize }}', }), { params: { collapsedSize: '3.75rem' } }), transition('void => open-instant', animate('0ms')), transition('void <=> open, open-instant => void, left-close <=> open, right-close <=> open', animate('400ms cubic-bezier(0.25, 0.8, 0.25, 1)')), ]), };
import { animate, AnimationTriggerMetadata, state, style, transition, trigger, } from '@angular/animations'; /** * Animations used by the {@link TsDrawerComponent}. */ export const tsDrawerAnimations: { readonly transformDrawer: AnimationTriggerMetadata; } = { // Animation that expands and collapses a drawer. transformDrawer: trigger('transform', [ state('open, open-instant', style({ transform: 'none', visibility: 'visible', width: '{{ expandedSize }}', }), { params: { expandedSize: '12.5rem' } }), state('void', style({ 'box-shadow': 'none', 'visibility': 'visible', 'width': '{{ collapsedSize }}', }), { params: { collapsedSize: '3.75rem' } }), state('void-shadow', style({ visibility: 'visible', width: '{{ collapsedSize }}', }), { params: { collapsedSize: '3.75rem' } }), transition('void => open-instant', animate('0ms')), transition('void <=> open, open-instant => void, void-shadow <=> open, open-instant => void-shadow', animate('400ms cubic-bezier(0.25, 0.8, 0.25, 1)')), ]), };
Fix missing animation when shadow is always visible
fix(Drawer): Fix missing animation when shadow is always visible
TypeScript
mit
GetTerminus/terminus-ui,GetTerminus/terminus-ui,GetTerminus/terminus-ui,GetTerminus/terminus-ui
--- +++ @@ -30,7 +30,7 @@ width: '{{ collapsedSize }}', }), { params: { collapsedSize: '3.75rem' } }), transition('void => open-instant', animate('0ms')), - transition('void <=> open, open-instant => void, left-close <=> open, right-close <=> open', + transition('void <=> open, open-instant => void, void-shadow <=> open, open-instant => void-shadow', animate('400ms cubic-bezier(0.25, 0.8, 0.25, 1)')), ]), };
f70989b38ecfc6c94ce9567394f39f2acea185bb
src/index.ts
src/index.ts
import TBufferedTransport = require('thrift/lib/nodejs/lib/thrift/buffered_transport') import TJSONProtocol = require('thrift/lib/nodejs/lib/thrift/json_protocol') import InputBufferUnderrunError = require('thrift/lib/nodejs/lib/thrift/input_buffer_underrun_error') function handleBody(processor, buffer) { const transportWithData = new TBufferedTransport() transportWithData.inBuf = buffer transportWithData.writeCursor = buffer.length const input = new TJSONProtocol(transportWithData) return new Promise((resolve, reject) => { const output = new TJSONProtocol(new TBufferedTransport(undefined, resolve)) try { processor.process(input, output) transportWithData.commitPosition() resolve() } catch (err) { if (err instanceof InputBufferUnderrunError) { transportWithData.rollbackPosition() } else { reject(err) } } }) } export function thriftExpress(Service, handlers) { async function handler(req, res) { if (req.method !== 'POST') { return res.status(403).send('Method must be POST') } try { const result = await handleBody(new Service(handlers), req.body) res.status(200).end(result) } catch (err) { console.log(err) } } return handler }
import TBufferedTransport = require('thrift/lib/nodejs/lib/thrift/buffered_transport') import InputBufferUnderrunError = require('thrift/lib/nodejs/lib/thrift/input_buffer_underrun_error') import TJSONProtocol = require('thrift/lib/nodejs/lib/thrift/json_protocol') function handleBody(processor, buffer) { const transportWithData = new TBufferedTransport() transportWithData.inBuf = buffer transportWithData.writeCursor = buffer.length const input = new TJSONProtocol(transportWithData) return new Promise((resolve, reject) => { const output = new TJSONProtocol(new TBufferedTransport(undefined, resolve)) try { processor.process(input, output) transportWithData.commitPosition() } catch (err) { if (err instanceof InputBufferUnderrunError) { transportWithData.rollbackPosition() } reject(err) } }) } export function thriftExpress(Service, handlers) { async function handler(req, res) { if (req.method !== 'POST') { return res.status(403).send('Method must be POST') } try { const result = await handleBody(new Service(handlers), req.body) res.status(200).end(result) } catch (err) { console.log(err) } } return handler }
Fix a couple things with plugin resolution
Fix a couple things with plugin resolution
TypeScript
apache-2.0
creditkarma/thrift-server,creditkarma/thrift-server
--- +++ @@ -1,6 +1,6 @@ import TBufferedTransport = require('thrift/lib/nodejs/lib/thrift/buffered_transport') +import InputBufferUnderrunError = require('thrift/lib/nodejs/lib/thrift/input_buffer_underrun_error') import TJSONProtocol = require('thrift/lib/nodejs/lib/thrift/json_protocol') -import InputBufferUnderrunError = require('thrift/lib/nodejs/lib/thrift/input_buffer_underrun_error') function handleBody(processor, buffer) { const transportWithData = new TBufferedTransport() @@ -14,13 +14,11 @@ try { processor.process(input, output) transportWithData.commitPosition() - resolve() } catch (err) { if (err instanceof InputBufferUnderrunError) { transportWithData.rollbackPosition() - } else { - reject(err) } + reject(err) } }) }
96e712b399998437309ab11c2864b3bf30ae9c2c
src/index.ts
src/index.ts
import { getAST } from './ast'; import { emit } from './emitter'; declare function require(name: string); declare var process: any; (function () { if (typeof process !== 'undefined' && process.nextTick && !process.browser && typeof require !== "undefined") { var fs = require('fs'); if (process.argv.length < 2) process.exit(); var fileNames = process.argv.slice(2); const sourceFile = getAST(fileNames); const result = emit(sourceFile, { include_headers: '' }); console.log(result.emitted_string); process.exit(); } })();
import { getAST } from './ast'; import { emit } from './emitter'; declare function require(name: string); declare var process: any; const util = require('util'); (function () { if (typeof process !== 'undefined' && process.nextTick && !process.browser && typeof require !== "undefined") { var fs = require('fs'); if (process.argv.length < 2) process.exit(); var fileNames = process.argv.slice(2); const sourceFile = getAST(fileNames); const result = emit(sourceFile, { include_headers: '' }); process.stdout.write(util.format.apply(null, [result.emitted_string]) + '\n'); process.exit(); } })();
Use process.stdout.write instead of console.log
Use process.stdout.write instead of console.log
TypeScript
mit
AmnisIO/typewriter,AmnisIO/typewriter,AmnisIO/typewriter
--- +++ @@ -3,6 +3,7 @@ declare function require(name: string); declare var process: any; +const util = require('util'); (function () { if (typeof process !== 'undefined' && process.nextTick && !process.browser && typeof require !== "undefined") { @@ -12,7 +13,7 @@ var fileNames = process.argv.slice(2); const sourceFile = getAST(fileNames); const result = emit(sourceFile, { include_headers: '' }); - console.log(result.emitted_string); + process.stdout.write(util.format.apply(null, [result.emitted_string]) + '\n'); process.exit(); } })();
96d2479d4cb4c0350ea81699469096d94257dd8c
src/queue.ts
src/queue.ts
class Queue { private _running = false; private _queue: Function[] = []; public push(f: Function) { this._queue.push(f); if (!this._running) { // if nothing is running, then start the engines! this._next(); } return this; // for chaining fun! } private _next() { this._running = false; if(shift) { this._running = true; shift(()=> { this._next(); }); // get the first element off the queue let action = this._queue.shift(); } } } export default Queue;
class Queue { private _running = false; private _queue: Function[] = []; public push(f: Function) { this._queue.push(f); if (!this._running) { // if nothing is running, then start the engines! this._next(); } return this; // for chaining fun! } private _next() { this._running = false; // get the first element off the queue let action = this._queue.shift(); if (action) { this._running = true; new Promise((reject, resolve) => action(resolve)).then(this._next) // action(() => { // this._next(); // }); } } } export default Queue;
Fix ' Cannot find name 'shift'' eror
Fix ' Cannot find name 'shift'' eror
TypeScript
apache-2.0
KamiKillertO/vscode-colorize,KamiKillertO/vscode-colorize
--- +++ @@ -16,13 +16,14 @@ } private _next() { this._running = false; - if(shift) { - this._running = true; - shift(()=> { - this._next(); - }); // get the first element off the queue let action = this._queue.shift(); + if (action) { + this._running = true; + new Promise((reject, resolve) => action(resolve)).then(this._next) + // action(() => { + // this._next(); + // }); } } }
df870f4e363e0d3df9afc9d44f7aaf2d3451a9b7
applications/account/src/app/content/AccountPublicLayoutWrapper.tsx
applications/account/src/app/content/AccountPublicLayoutWrapper.tsx
import * as React from 'react'; import { c } from 'ttag'; import locales from 'proton-shared/lib/i18n/locales'; import { ProtonLogo, AccountSupportDropdown } from 'react-components'; import AccountPublicLayout, { Props as AccountProps } from 'react-components/containers/signup/AccountPublicLayout'; const AccountPublicLayoutWrapper = ({ children, ...rest }: AccountProps) => { return ( <AccountPublicLayout locales={locales} center={<ProtonLogo />} right={ <AccountSupportDropdown noCaret className="link"> {c('Action').t`Need help?`} </AccountSupportDropdown> } {...rest} > {children} </AccountPublicLayout> ); }; export default AccountPublicLayoutWrapper;
import * as React from 'react'; import { c } from 'ttag'; import locales from 'proton-shared/lib/i18n/locales'; import { ProtonLogo, AccountSupportDropdown } from 'react-components'; import AccountPublicLayout, { Props as AccountProps } from 'react-components/containers/signup/AccountPublicLayout'; const AccountPublicLayoutWrapper = ({ children, ...rest }: AccountProps) => { return ( <AccountPublicLayout locales={locales} center={<ProtonLogo />} right={ <AccountSupportDropdown noCaret className="link nodecoration"> {c('Action').t`Need help?`} </AccountSupportDropdown> } {...rest} > {children} </AccountPublicLayout> ); }; export default AccountPublicLayoutWrapper;
Fix - link without decoration
Fix - link without decoration
TypeScript
mit
ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient
--- +++ @@ -10,7 +10,7 @@ locales={locales} center={<ProtonLogo />} right={ - <AccountSupportDropdown noCaret className="link"> + <AccountSupportDropdown noCaret className="link nodecoration"> {c('Action').t`Need help?`} </AccountSupportDropdown> }
a433e28800718998eae856ae352bf6ab97155612
src/home/components/games-table.component.ts
src/home/components/games-table.component.ts
import {Component, Input} from 'angular2/core'; import {ROUTER_DIRECTIVES} from 'angular2/router'; import {Game} from '../../shared/models/game.model'; import {FactionBadgeComponent} from '../../shared/components/faction-badge.component'; import {AgendaBadgeComponent} from '../../shared/components/agenda-badge.component'; import {PlayerLinkComponent} from '../../shared/components/player-link.component'; import {TimeAgoPipe} from '../../shared/pipes/time-ago-pipe'; import {DateFormatPipe} from '../../shared/pipes/date-format-pipe'; @Component({ selector: 'agot-games-table', moduleId: module.id, templateUrl: './games-table.html', pipes: [TimeAgoPipe, DateFormatPipe], directives: [ROUTER_DIRECTIVES, PlayerLinkComponent, FactionBadgeComponent, AgendaBadgeComponent] }) export class GamesTableComponent { @Input() games:Game[]; }
import {Component, Input, ChangeDetectionStrategy} from 'angular2/core'; import {ROUTER_DIRECTIVES} from 'angular2/router'; import {Game} from '../../shared/models/game.model'; import {FactionBadgeComponent} from '../../shared/components/faction-badge.component'; import {AgendaBadgeComponent} from '../../shared/components/agenda-badge.component'; import {PlayerLinkComponent} from '../../shared/components/player-link.component'; import {TimeAgoPipe} from '../../shared/pipes/time-ago-pipe'; import {DateFormatPipe} from '../../shared/pipes/date-format-pipe'; @Component({ selector: 'agot-games-table', moduleId: module.id, templateUrl: './games-table.html', pipes: [TimeAgoPipe, DateFormatPipe], changeDetection: ChangeDetectionStrategy.OnPush, directives: [ROUTER_DIRECTIVES, PlayerLinkComponent, FactionBadgeComponent, AgendaBadgeComponent] }) export class GamesTableComponent { @Input() games:Game[]; }
Enforce onPush for games table, no changed-after-render
Enforce onPush for games table, no changed-after-render
TypeScript
mit
davewragg/agot-spa,davewragg/agot-spa,davewragg/agot-spa
--- +++ @@ -1,4 +1,4 @@ -import {Component, Input} from 'angular2/core'; +import {Component, Input, ChangeDetectionStrategy} from 'angular2/core'; import {ROUTER_DIRECTIVES} from 'angular2/router'; import {Game} from '../../shared/models/game.model'; @@ -13,6 +13,7 @@ moduleId: module.id, templateUrl: './games-table.html', pipes: [TimeAgoPipe, DateFormatPipe], + changeDetection: ChangeDetectionStrategy.OnPush, directives: [ROUTER_DIRECTIVES, PlayerLinkComponent, FactionBadgeComponent, AgendaBadgeComponent] }) export class GamesTableComponent {
56bb5e56e0c666457a1e19d22d3c73aaa8780161
src/app/collections/Metrics.tsx
src/app/collections/Metrics.tsx
import { D2ManifestDefinitions } from 'app/destiny2/d2-definitions'; import BungieImage from 'app/dim-ui/BungieImage'; import { ALL_TRAIT } from 'app/search/d2-known-values'; import _ from 'lodash'; import React from 'react'; import Metric from './Metric'; import styles from './Metrics.m.scss'; import { DimMetric } from './presentation-nodes'; export default function Metrics({ metrics, defs, }: { metrics: DimMetric[]; defs: D2ManifestDefinitions; }) { const groupedMetrics = _.groupBy( metrics, (metric) => metric.metricDef.traitHashes.filter((h) => h !== ALL_TRAIT)[0] ); const traits = _.keyBy( Object.keys(groupedMetrics).map((th) => defs.Trait.get(Number(th))), (t) => t.hash ); return ( <div className={styles.metrics}> {_.map(groupedMetrics, (metrics, traitHash) => ( <div> <div className={styles.title}> <BungieImage src={traits[traitHash].displayProperties.icon} /> {traits[traitHash].displayProperties.name} </div> {metrics.map((metric) => ( <Metric key={metric.metricDef.hash} metric={metric} defs={defs} /> ))} </div> ))} </div> ); }
import { D2ManifestDefinitions } from 'app/destiny2/d2-definitions'; import BungieImage from 'app/dim-ui/BungieImage'; import { ALL_TRAIT } from 'app/search/d2-known-values'; import _ from 'lodash'; import React from 'react'; import Metric from './Metric'; import styles from './Metrics.m.scss'; import { DimMetric } from './presentation-nodes'; export default function Metrics({ metrics, defs, }: { metrics: DimMetric[]; defs: D2ManifestDefinitions; }) { const groupedMetrics = _.groupBy( metrics, (metric) => metric.metricDef.traitHashes.filter((h) => h !== ALL_TRAIT)[0] ); const traits = _.keyBy( Object.keys(groupedMetrics).map((th) => defs.Trait.get(Number(th))), (t) => t.hash ); return ( <div className={styles.metrics}> {_.map(groupedMetrics, (metrics, traitHash) => ( <div key={traitHash}> <div className={styles.title}> <BungieImage src={traits[traitHash].displayProperties.icon} /> {traits[traitHash].displayProperties.name} </div> {metrics.map((metric) => ( <Metric key={metric.metricDef.hash} metric={metric} defs={defs} /> ))} </div> ))} </div> ); }
Add a key to metrics
Add a key to metrics
TypeScript
mit
DestinyItemManager/DIM,DestinyItemManager/DIM,delphiactual/DIM,delphiactual/DIM,delphiactual/DIM,DestinyItemManager/DIM,DestinyItemManager/DIM,delphiactual/DIM
--- +++ @@ -27,7 +27,7 @@ return ( <div className={styles.metrics}> {_.map(groupedMetrics, (metrics, traitHash) => ( - <div> + <div key={traitHash}> <div className={styles.title}> <BungieImage src={traits[traitHash].displayProperties.icon} /> {traits[traitHash].displayProperties.name}
430945d064450ec0e59477b3b4a49b3ba50f7b70
src/shared/lib/getOverlappingStudies.spec.ts
src/shared/lib/getOverlappingStudies.spec.ts
// import { assert } from 'chai'; // import getOverlappingStudies from "./getOverlappingStudies"; // // describe('',()=>{ // // it('', ()=>{ // const ret = getOverlappingStudies() // }) // // })
import { assert } from 'chai'; import getOverlappingStudies from "./getOverlappingStudies"; import {CancerStudy} from "../api/generated/CBioPortalAPI"; describe('getOverlappingStudies',()=>{ it('finds overlapping studies based on pub/nonpub signature in studyId', ()=>{ let studies = [ { studyId:'moo_tcga'}, { studyId: 'moo1_tcga_pub'} ]; let ret = getOverlappingStudies(studies as CancerStudy[]); assert.equal(ret.length, 0); // now adjust studies = [ { studyId:'moo_tcga'}, { studyId: 'moo_tcga_pub'} ]; ret = getOverlappingStudies(studies as CancerStudy[]); assert.equal(ret[0][0].studyId,'moo_tcga'); assert.equal(ret[0][1].studyId,'moo_tcga_pub'); }); })
Add some tests for getOverlappingStudies
Add some tests for getOverlappingStudies Former-commit-id: 09cbdd2b41fd6701bee5cc59799fe69afee1b240
TypeScript
agpl-3.0
alisman/cbioportal-frontend,cBioPortal/cbioportal-frontend,cBioPortal/cbioportal-frontend,cBioPortal/cbioportal-frontend,cBioPortal/cbioportal-frontend,alisman/cbioportal-frontend,cBioPortal/cbioportal-frontend,alisman/cbioportal-frontend,alisman/cbioportal-frontend,alisman/cbioportal-frontend,alisman/cbioportal-frontend,cBioPortal/cbioportal-frontend
--- +++ @@ -1,10 +1,31 @@ -// import { assert } from 'chai'; -// import getOverlappingStudies from "./getOverlappingStudies"; -// -// describe('',()=>{ -// -// it('', ()=>{ -// const ret = getOverlappingStudies() -// }) -// -// }) +import { assert } from 'chai'; +import getOverlappingStudies from "./getOverlappingStudies"; +import {CancerStudy} from "../api/generated/CBioPortalAPI"; + +describe('getOverlappingStudies',()=>{ + + it('finds overlapping studies based on pub/nonpub signature in studyId', ()=>{ + + let studies = [ + { studyId:'moo_tcga'}, + { studyId: 'moo1_tcga_pub'} + ]; + + let ret = getOverlappingStudies(studies as CancerStudy[]); + + assert.equal(ret.length, 0); + + // now adjust + studies = [ + { studyId:'moo_tcga'}, + { studyId: 'moo_tcga_pub'} + ]; + + ret = getOverlappingStudies(studies as CancerStudy[]); + + assert.equal(ret[0][0].studyId,'moo_tcga'); + assert.equal(ret[0][1].studyId,'moo_tcga_pub'); + + }); + +})
fe6b37dfd0eba9df711d28f0ffa81e2b2b72ee61
src/store.ts
src/store.ts
import { createStore, compose, applyMiddleware } from 'redux'; import createSagaMiddleware from 'redux-saga'; import * as immutableTransform from 'redux-persist-transform-immutable'; import { autoRehydrate, persistStore } from 'redux-persist'; import * as localForage from 'localforage'; import { rootReducer } from './reducers'; import rootSaga from './sagas'; // tslint:disable:no-any // tslint:disable:no-string-literal const devtools: any = window['__REDUX_DEVTOOLS_EXTENSION__'] ? window['__REDUX_DEVTOOLS_EXTENSION__']() : (f: any) => f; const sagaMiddleware = createSagaMiddleware(); const store = createStore<any>( rootReducer, compose(applyMiddleware(sagaMiddleware), autoRehydrate(), devtools) ); sagaMiddleware.run(rootSaga); persistStore(store, { whitelist: [ 'hitBlocklist', 'requesterBlocklist', 'searchFormActive', 'tab', 'queue', 'sortingOption', 'searchOptions', 'topticonSettings' ], storage: localForage, transforms: [ immutableTransform({ whitelist: [ 'hitBlocklist', 'requesterBlocklist', 'queue' ] }) ] }); export default store;
import { createStore, compose, applyMiddleware } from 'redux'; import createSagaMiddleware from 'redux-saga'; import * as immutableTransform from 'redux-persist-transform-immutable'; import { autoRehydrate, persistStore } from 'redux-persist'; import * as localForage from 'localforage'; import { rootReducer } from './reducers'; import rootSaga from './sagas'; // tslint:disable:no-any // tslint:disable:no-string-literal const devtools: any = window['__REDUX_DEVTOOLS_EXTENSION__'] ? window['__REDUX_DEVTOOLS_EXTENSION__']() : (f: any) => f; const sagaMiddleware = createSagaMiddleware(); const store = createStore<any>( rootReducer, compose(applyMiddleware(sagaMiddleware), autoRehydrate(), devtools) ); sagaMiddleware.run(rootSaga); persistStore(store, { whitelist: [ 'hitBlocklist', 'requesterBlocklist', 'searchFormActive', 'tab', 'queue', 'sortingOption', 'searchOptions', 'topticonSettings', 'watchers' ], storage: localForage, transforms: [ immutableTransform({ whitelist: [ 'hitBlocklist', 'requesterBlocklist', 'queue', 'watchers' ] }) ] }); export default store;
Add watchers to persistated state.
Add watchers to persistated state.
TypeScript
mit
Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine
--- +++ @@ -31,12 +31,13 @@ 'queue', 'sortingOption', 'searchOptions', - 'topticonSettings' + 'topticonSettings', + 'watchers' ], storage: localForage, transforms: [ immutableTransform({ - whitelist: [ 'hitBlocklist', 'requesterBlocklist', 'queue' ] + whitelist: [ 'hitBlocklist', 'requesterBlocklist', 'queue', 'watchers' ] }) ] });
9b31d8325e5cc8833b9eb93b1cee7cc71350ebbc
src/graph/edge/EdgeDirection.ts
src/graph/edge/EdgeDirection.ts
/** Enumeration for directions * @enum string * @readonly */ export enum EdgeDirection { /** * Next photo in the sequence */ NEXT = 0, /** * Previous photo in the sequence */ PREV = 3, /** * Step to the photo on the left */ STEP_LEFT, /** * Step to the photo on the right */ STEP_RIGHT, /** * Step to the photo forward (equivalent of moving forward) */ STEP_FORWARD, /** * Step to the photo backward (equivalent of moving backward) */ STEP_BACKWARD, /** * Rotate ~90deg to the left from the current photo */ TURN_LEFT, /** * Rotate ~90deg to the right from the current photo */ TURN_RIGHT, /** * Turn around, relative to the dirrection of the current photo */ TURN_U, ROTATE_LEFT, ROTATE_RIGHT, HOMOGRAPHY, CLOSE, PANO };
/** * Enumeration for edge directions * @enum {number} * @readonly * @description Directions for edges in node graph describing * sequence, spatial and node type relations between nodes. */ export enum EdgeDirection { /** * Next node in the sequence */ NEXT = 0, /** * Previous node in the sequence */ PREV = 3, /** * Step to the left keeping viewing direction */ STEP_LEFT, /** * Step to the right keeping viewing direction */ STEP_RIGHT, /** * Step forward keeping viewing direction */ STEP_FORWARD, /** * Step backward keeping viewing direction */ STEP_BACKWARD, /** * Turn 90 degrees counter clockwise */ TURN_LEFT, /** * Turn 90 degrees clockwise */ TURN_RIGHT, /** * Turn 180 degrees */ TURN_U, /** * Rotate with small counter clockwise angle change */ ROTATE_LEFT, /** * Rotate with small clockwise angle change */ ROTATE_RIGHT, /** * Panorama in general direction */ PANO };
Comment all edge directions and remove unused.
Comment all edge directions and remove unused.
TypeScript
mit
mapillary/mapillary-js,mapillary/mapillary-js
--- +++ @@ -1,55 +1,69 @@ -/** Enumeration for directions - * @enum string +/** + * Enumeration for edge directions + * @enum {number} * @readonly + * @description Directions for edges in node graph describing + * sequence, spatial and node type relations between nodes. */ export enum EdgeDirection { + /** - * Next photo in the sequence + * Next node in the sequence */ NEXT = 0, /** - * Previous photo in the sequence + * Previous node in the sequence */ PREV = 3, /** - * Step to the photo on the left + * Step to the left keeping viewing direction */ STEP_LEFT, /** - * Step to the photo on the right + * Step to the right keeping viewing direction */ STEP_RIGHT, /** - * Step to the photo forward (equivalent of moving forward) + * Step forward keeping viewing direction */ STEP_FORWARD, /** - * Step to the photo backward (equivalent of moving backward) + * Step backward keeping viewing direction */ STEP_BACKWARD, /** - * Rotate ~90deg to the left from the current photo + * Turn 90 degrees counter clockwise */ TURN_LEFT, /** - * Rotate ~90deg to the right from the current photo + * Turn 90 degrees clockwise */ TURN_RIGHT, /** - * Turn around, relative to the dirrection of the current photo + * Turn 180 degrees */ TURN_U, + + /** + * Rotate with small counter clockwise angle change + */ ROTATE_LEFT, + + /** + * Rotate with small clockwise angle change + */ ROTATE_RIGHT, - HOMOGRAPHY, - CLOSE, + + /** + * Panorama in general direction + */ PANO };
5af0ccb73971eb5699f94a46db1132a5b4a6ba8f
AntSharesApp/scripts/AntShares/UI/TabBase.ts
AntSharesApp/scripts/AntShares/UI/TabBase.ts
namespace AntShares.UI { export abstract class TabBase { private static _tabs = new Object(); protected target: Element; protected oncreate(): void { } protected onload(args: any[]): void { } public static showTab(id: string, ...args): void { $('.content>.tab-content>.tab-pane').removeClass("active"); $(id).addClass("active"); let className = id.replace("#Tab_", "AntShares.UI.").replace(/_/g, '.'); let tab: TabBase; if (TabBase._tabs[className] == null) { let t: () => void; try { t = eval(className); } catch (ex) { } if (t == null) return; tab = new t() as TabBase; tab.target = $(id)[0]; tab.oncreate(); TabBase._tabs[className] = tab; } else { tab = TabBase._tabs[className]; } tab.onload(args); } } $('.tab-trigger').click(function (event) { event.preventDefault(); TabBase.showTab($(this).attr("href"), $(this).data("args")); }); $(function () { TabBase.showTab('#' + $('.content>.tab-content>.tab-pane.active').attr("id")); }); }
namespace AntShares.UI { export abstract class TabBase { private static _tabs = new Object(); protected target: Element; protected oncreate(): void { } protected onload(args: any[]): void { } public static showTab(id: string, ...args): void { $('.content>.tab-content>.tab-pane').removeClass("active"); $(id).addClass("active"); let className = id.replace("#Tab_", "AntShares.UI.").replace(/_/g, '.'); let tab: TabBase; if (TabBase._tabs[className] == null) { let t: () => void; try { t = eval(className); } catch (ex) { } if (t == null) return; tab = new t() as TabBase; tab.target = $(id)[0]; tab.oncreate(); TabBase._tabs[className] = tab; } else { tab = TabBase._tabs[className]; } $("#menu").find("li").removeClass("mm-selected"); let menuList = $("#menu").find("li"); for (let i = 0; i < menuList.length; i++) { if ($(menuList[i]).find("a").attr("href") == id) { $(menuList[i]).addClass("mm-selected"); break; } } tab.onload(args); } } $('.tab-trigger').click(function (event) { event.preventDefault(); TabBase.showTab($(this).attr("href"), $(this).data("args")); }); $(function () { TabBase.showTab('#' + $('.content>.tab-content>.tab-pane.active').attr("id")); }); }
Modify the menu style is "selected" when page jumps via TS code.
Modify the menu style is "selected" when page jumps via TS code.
TypeScript
mit
AntShares/AntSharesApp,AntShares/AntSharesApp,AntShares/AntSharesApp,AntShares/AntSharesApp,AntShares/AntSharesApp,AntShares/AntSharesApp,AntShares/AntSharesApp
--- +++ @@ -28,6 +28,16 @@ { tab = TabBase._tabs[className]; } + $("#menu").find("li").removeClass("mm-selected"); + let menuList = $("#menu").find("li"); + for (let i = 0; i < menuList.length; i++) + { + if ($(menuList[i]).find("a").attr("href") == id) + { + $(menuList[i]).addClass("mm-selected"); + break; + } + } tab.onload(args); } }
8f691ebc40df0a6b14c74be0bec64e2dfb2dcff0
src/regimens/list/__tests__/add_button_test.tsx
src/regimens/list/__tests__/add_button_test.tsx
jest.unmock("../../actions"); import * as React from "react"; import { AddRegimen } from "../add_button"; import { AddRegimenProps } from "../../interfaces"; import { shallow } from "enzyme"; describe("<AddRegimen/>", () => { function btn(props: AddRegimenProps) { return shallow(React.createElement(AddRegimen, props)); } it("transfers class name", () => { expect(btn({ className: "foo", dispatch: jest.fn(), length: 5 }).hasClass("foo")).toBeTruthy(); }); it("dispatches a new regimen onclick", () => { let dispatch = jest.fn(); let b = btn({ dispatch, length }); b.find("button").simulate("click"); expect(dispatch.mock.calls.length).toEqual(1); let action = dispatch.mock.calls[0][0]; expect(action.type).toEqual("INIT_RESOURCE"); expect(action.payload).toBeTruthy(); expect(action.payload.kind).toEqual("regimens"); }); it("has children (or defaults)"); });
jest.unmock("../../actions"); let mockPush = jest.fn(); jest.mock("../../../history", () => ({ push: mockPush })); import * as React from "react"; import { AddRegimen } from "../add_button"; import { AddRegimenProps } from "../../interfaces"; import { shallow } from "enzyme"; describe("<AddRegimen/>", () => { function btn(props: AddRegimenProps) { return shallow(<AddRegimen {...props} />); } it("transfers class name", () => { expect(btn({ className: "foo", dispatch: jest.fn(), length: 5 }).hasClass("foo")).toBeTruthy(); }); it("dispatches a new regimen onclick", () => { let dispatch = jest.fn(); let b = btn({ dispatch, length }); expect(mockPush.mock.calls.length).toBe(0); b.find("button").simulate("click"); expect(dispatch.mock.calls.length).toEqual(1); let action = dispatch.mock.calls[0][0]; expect(action.type).toEqual("INIT_RESOURCE"); expect(action.payload).toBeTruthy(); expect(action.payload.kind).toEqual("regimens"); }); it("has children (or defaults)"); });
Fix security exception error in a test
Fix security exception error in a test
TypeScript
mit
gabrielburnworth/Farmbot-Web-App,FarmBot/Farmbot-Web-API,MrChristofferson/Farmbot-Web-API,MrChristofferson/Farmbot-Web-API,gabrielburnworth/Farmbot-Web-App,FarmBot/farmbot-web-app,gabrielburnworth/Farmbot-Web-App,MrChristofferson/Farmbot-Web-API,RickCarlino/farmbot-web-app,FarmBot/Farmbot-Web-API,FarmBot/Farmbot-Web-API,RickCarlino/farmbot-web-app,FarmBot/farmbot-web-app,FarmBot/farmbot-web-app,gabrielburnworth/Farmbot-Web-App,RickCarlino/farmbot-web-app,gabrielburnworth/Farmbot-Web-App,RickCarlino/farmbot-web-app,FarmBot/Farmbot-Web-API,MrChristofferson/Farmbot-Web-API,FarmBot/Farmbot-Web-API,RickCarlino/farmbot-web-app
--- +++ @@ -1,4 +1,6 @@ jest.unmock("../../actions"); +let mockPush = jest.fn(); +jest.mock("../../../history", () => ({ push: mockPush })); import * as React from "react"; import { AddRegimen } from "../add_button"; import { AddRegimenProps } from "../../interfaces"; @@ -6,7 +8,7 @@ describe("<AddRegimen/>", () => { function btn(props: AddRegimenProps) { - return shallow(React.createElement(AddRegimen, props)); + return shallow(<AddRegimen {...props} />); } it("transfers class name", () => { expect(btn({ @@ -19,6 +21,7 @@ it("dispatches a new regimen onclick", () => { let dispatch = jest.fn(); let b = btn({ dispatch, length }); + expect(mockPush.mock.calls.length).toBe(0); b.find("button").simulate("click"); expect(dispatch.mock.calls.length).toEqual(1); let action = dispatch.mock.calls[0][0];
8eedc2823bda12adb08a022cf606d14ac4b49d21
src/dispatch/fetchQueue.ts
src/dispatch/fetchQueue.ts
// import { Dispatch } from 'react-redux'; import { SearchItem } from '../types'; import { Map } from 'immutable'; // import { fetchQueueSuccess, fetchQueueFailure, QueueAction } from '../actions/queue'; import { getQueuePage } from '../utils/fetchQueue'; // import { generateQueueToast, failedQueueToast } from '../utils/toastr'; // export const fetchQueue = (dispatch: Dispatch<QueueAction>) => async () => { // try { // const queueData = await getQueuePage(); // const empty = !queueData.isEmpty(); // generateQueueToast(empty); // dispatch(fetchQueueSuccess(queueData)); // return queueData; // } catch (e) { // dispatch(fetchQueueFailure()); // failedQueueToast(); // return Map<string, SearchItem>(); // } // }; export const fetchQueue = async () => { try { const queueData = await getQueuePage(); return queueData; } catch (e) { return Map<string, SearchItem>(); } };
// import { Dispatch } from 'react-redux'; import { QueueItem } from '../types'; import { Map } from 'immutable'; // import { fetchQueueSuccess, fetchQueueFailure, QueueAction } from '../actions/queue'; import { getQueuePage } from '../utils/fetchQueue'; // import { generateQueueToast, failedQueueToast } from '../utils/toastr'; // export const fetchQueue = (dispatch: Dispatch<QueueAction>) => async () => { // try { // const queueData = await getQueuePage(); // const empty = !queueData.isEmpty(); // generateQueueToast(empty); // dispatch(fetchQueueSuccess(queueData)); // return queueData; // } catch (e) { // dispatch(fetchQueueFailure()); // failedQueueToast(); // return Map<string, SearchItem>(); // } // }; export const fetchQueue = async () => { try { const queueData = await getQueuePage(); return queueData; } catch (e) { return Promise.resolve(Map<string, QueueItem>()); } };
Simplify function signature and fix incorrect interface usage.
Simplify function signature and fix incorrect interface usage.
TypeScript
mit
Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine
--- +++ @@ -1,5 +1,5 @@ // import { Dispatch } from 'react-redux'; -import { SearchItem } from '../types'; +import { QueueItem } from '../types'; import { Map } from 'immutable'; // import { fetchQueueSuccess, fetchQueueFailure, QueueAction } from '../actions/queue'; import { getQueuePage } from '../utils/fetchQueue'; @@ -24,6 +24,6 @@ const queueData = await getQueuePage(); return queueData; } catch (e) { - return Map<string, SearchItem>(); + return Promise.resolve(Map<string, QueueItem>()); } };
56ef83799af789d8a3e9b14659fe5a5c4af0b226
lib/index.ts
lib/index.ts
import * as debug from 'debug'; import { Client } from './client'; import { BasiqAPIOptions } from './interfaces'; import { Account } from './resources/accounts'; import { Connection } from './resources/connections'; import { Institution } from './resources/institutions'; import { Transaction } from './resources/transactions'; const log = debug('basiq-api'); const resources = { connections: Connection, accounts: Account, transactions: Transaction, institutions: Institution, }; export class BasiqAPI { public accounts: Account; public connections: Connection; public transactions: Transaction; public institutions: Institution; protected _client: Client; constructor(options: BasiqAPIOptions) { const client = new Client(options); Object.defineProperty(this, '_client', { value: client, writable: false, enumerable: false, configurable: false, }); Object.keys(resources) .forEach((resource: string) => { Object.defineProperty(this, resource, { value: new resources[resource](this._client), writable: true, enumerable: false, configurable: true, }); }); } } export { BasiqAPIOptions, AuthenticationOptions, ConnectionCreateOptions, ConnectionUpdateOptions, BasiqResponse, BasiqPromise, } from './interfaces';
import * as debug from 'debug'; import { Client } from './client'; import { BasiqAPIOptions } from './interfaces'; import { Account } from './resources/accounts'; import { Connection } from './resources/connections'; import { Institution } from './resources/institutions'; import { Transaction } from './resources/transactions'; const log = debug('basiq-api'); export class BasiqAPI { public accounts: Account; public connections: Connection; public transactions: Transaction; public institutions: Institution; protected _client: Client; constructor(options: BasiqAPIOptions) { const client = new Client(options); const resources = { connections: Connection, accounts: Account, transactions: Transaction, institutions: Institution, }; Object.defineProperty(this, '_client', { value: client, writable: false, enumerable: false, configurable: false, }); Object.keys(resources) .forEach((resource: string) => { Object.defineProperty(this, resource, { value: new resources[resource](this._client), writable: true, enumerable: false, configurable: true, }); }); } } export { BasiqAPIOptions, AuthenticationOptions, ConnectionCreateOptions, ConnectionUpdateOptions, BasiqResponse, BasiqPromise, } from './interfaces';
Change scope of resources object
Change scope of resources object
TypeScript
bsd-2-clause
FluentDevelopment/basiq-api
--- +++ @@ -8,13 +8,6 @@ import { Transaction } from './resources/transactions'; const log = debug('basiq-api'); - -const resources = { - connections: Connection, - accounts: Account, - transactions: Transaction, - institutions: Institution, -}; export class BasiqAPI { @@ -30,6 +23,13 @@ constructor(options: BasiqAPIOptions) { const client = new Client(options); + + const resources = { + connections: Connection, + accounts: Account, + transactions: Transaction, + institutions: Institution, + }; Object.defineProperty(this, '_client', { value: client, @@ -58,3 +58,4 @@ BasiqResponse, BasiqPromise, } from './interfaces'; +
2a66e3e5cf17ced23f8e50c5ea0dc8dc8cce4546
src/effects/local_storage.ts
src/effects/local_storage.ts
import { always, merge, objOf, pipe } from 'ramda'; import { Clear, Delete, Read, Write } from '../commands/local_storage'; import { constructMessage, safeParse, safeStringify } from '../util'; const get = (() => ( typeof window === 'undefined' ? always('<running outside browser context>') : window && window.localStorage && window.localStorage.getItem.bind(window.localStorage) )()); export default new Map([ [Read, ({ key, result }, dispatch) => pipe( get, safeParse, objOf('value'), merge({ key }), constructMessage(result), dispatch )(key)], [Write, ({ key, value }) => window.localStorage.setItem(key, safeStringify(value))], [Delete, ({ key }) => window.localStorage.removeItem(key)], [Clear, () => window.localStorage.clear()], ]);
import { always, merge, objOf, pipe } from 'ramda'; import { Clear, Delete, Read, Write } from '../commands/local_storage'; import { constructMessage, safeParse, safeStringify } from '../util'; const get = (() => ( typeof window === 'undefined' ? always('<running outside browser context>') : window && window.localStorage && window.localStorage.getItem.bind(window.localStorage) ))(); export default new Map([ [Read, ({ key, result }, dispatch) => pipe( get, safeParse, objOf('value'), merge({ key }), constructMessage(result), dispatch )(key)], [Write, ({ key, value }) => window.localStorage.setItem(key, safeStringify(value))], [Delete, ({ key }) => window.localStorage.removeItem(key)], [Clear, () => window.localStorage.clear()], ]);
Fix syntax for factorying local storage function
Fix syntax for factorying local storage function
TypeScript
apache-2.0
ai-labs-team/architecture,ai-labs-team/architecture
--- +++ @@ -5,7 +5,7 @@ const get = (() => ( typeof window === 'undefined' ? always('<running outside browser context>') : window && window.localStorage && window.localStorage.getItem.bind(window.localStorage) -)()); +))(); export default new Map([ [Read, ({ key, result }, dispatch) => pipe(
6e8abee9cb9e256f4e195faea4252a38c80cd369
app/src/ui/preferences/advanced.tsx
app/src/ui/preferences/advanced.tsx
import * as React from 'react' import { Dispatcher } from '../../lib/dispatcher' import { DialogContent } from '../dialog' import { Checkbox, CheckboxValue } from '../lib/checkbox' import { LinkButton } from '../lib/link-button' interface IAdvancedPreferencesProps { readonly dispatcher: Dispatcher } interface IAdvancedPreferencesState { readonly reportingOptOut: boolean, } const SamplesURL = 'https://desktop.github.com/samples/' export class Advanced extends React.Component<IAdvancedPreferencesProps, IAdvancedPreferencesState> { public constructor(props: IAdvancedPreferencesProps) { super(props) this.state = { reportingOptOut: false, } } public componentDidMount() { const optOut = this.props.dispatcher.getStatsOptOut() this.setState({ reportingOptOut: optOut, }) } private onChange = (event: React.FormEvent<HTMLInputElement>) => { const value = !event.currentTarget.checked this.props.dispatcher.setStatsOptOut(value) this.setState({ reportingOptOut: value, }) } public render() { return ( <DialogContent> <div> Would you like to help us improve GitHub Desktop by periodically submitting <LinkButton uri={SamplesURL}>anonymous usage data</LinkButton>? </div> <Checkbox label='Yes, submit anonymized usage data' value={this.state.reportingOptOut ? CheckboxValue.Off : CheckboxValue.On} onChange={this.onChange} /> </DialogContent> ) } }
import * as React from 'react' import { Dispatcher } from '../../lib/dispatcher' import { DialogContent } from '../dialog' import { Checkbox, CheckboxValue } from '../lib/checkbox' import { LinkButton } from '../lib/link-button' interface IAdvancedPreferencesProps { readonly dispatcher: Dispatcher } interface IAdvancedPreferencesState { readonly reportingOptOut: boolean, } const SamplesURL = 'https://desktop.github.com/samples/' export class Advanced extends React.Component<IAdvancedPreferencesProps, IAdvancedPreferencesState> { public constructor(props: IAdvancedPreferencesProps) { super(props) this.state = { reportingOptOut: false, } } public componentDidMount() { const optOut = this.props.dispatcher.getStatsOptOut() this.setState({ reportingOptOut: optOut, }) } private onChange = (event: React.FormEvent<HTMLInputElement>) => { const value = !event.currentTarget.checked this.props.dispatcher.setStatsOptOut(value) this.setState({ reportingOptOut: value, }) } public render() { return ( <DialogContent> <div> Would you like to help us improve GitHub Desktop by periodically submitting <LinkButton uri={SamplesURL}>anonymous usage data</LinkButton>? </div> <br /> <Checkbox label='Yes, submit anonymized usage data' value={this.state.reportingOptOut ? CheckboxValue.Off : CheckboxValue.On} onChange={this.onChange} /> </DialogContent> ) } }
Add space between content and input
Add space between content and input
TypeScript
mit
artivilla/desktop,BugTesterTest/desktops,hjobrien/desktop,hjobrien/desktop,say25/desktop,hjobrien/desktop,kactus-io/kactus,shiftkey/desktop,say25/desktop,j-f1/forked-desktop,kactus-io/kactus,artivilla/desktop,gengjiawen/desktop,desktop/desktop,BugTesterTest/desktops,j-f1/forked-desktop,shiftkey/desktop,say25/desktop,BugTesterTest/desktops,gengjiawen/desktop,j-f1/forked-desktop,shiftkey/desktop,desktop/desktop,say25/desktop,shiftkey/desktop,j-f1/forked-desktop,desktop/desktop,BugTesterTest/desktops,kactus-io/kactus,hjobrien/desktop,kactus-io/kactus,desktop/desktop,artivilla/desktop,gengjiawen/desktop,gengjiawen/desktop,artivilla/desktop
--- +++ @@ -48,6 +48,8 @@ Would you like to help us improve GitHub Desktop by periodically submitting <LinkButton uri={SamplesURL}>anonymous usage data</LinkButton>? </div> + <br /> + <Checkbox label='Yes, submit anonymized usage data' value={this.state.reportingOptOut ? CheckboxValue.Off : CheckboxValue.On}
e86f41c6d9cf9296e51b13cc3dbfe4b2f75cd5a8
tools/env/base.ts
tools/env/base.ts
import { EnvConfig } from './env-config.interface'; const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.14.1', RELEASEVERSION: '0.14.1' }; export = BaseConfig;
import { EnvConfig } from './env-config.interface'; const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.15.0', RELEASEVERSION: '0.15.0' }; export = BaseConfig;
Update release version to 0.15.0.
Update release version to 0.15.0.
TypeScript
mit
nie-ine/raeber-website,nie-ine/raeber-website,nie-ine/raeber-website,nie-ine/raeber-website
--- +++ @@ -3,8 +3,8 @@ const BaseConfig: EnvConfig = { // Sample API url API: 'https://demo.com', - RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.14.1', - RELEASEVERSION: '0.14.1' + RELEASEURL: 'https://github.com/nie-ine/raeber-website/releases/tag/0.15.0', + RELEASEVERSION: '0.15.0' }; export = BaseConfig;
9454a664a3e92820cac3a8435eb591dd4cbfc275
src/lib/moneyHelper.ts
src/lib/moneyHelper.ts
interface MoneyField { amount: number currencyCode: String } export const moneyFieldToUnit = (moneyField: MoneyField) => { switch (moneyField.currencyCode) { case "USD": return moneyField.amount * 100 default: throw new Error("Unknown currency, cannot process.") } }
interface MoneyField { amount: number currencyCode: String } export const moneyFieldToUnit = (moneyField: MoneyField) => { // this currently only supports currencies with cents // and multiply the major value to 100 to get cent value return moneyField.amount * 100 }
Switch to always multiply by 100
Switch to always multiply by 100
TypeScript
mit
mzikherman/metaphysics-1,artsy/metaphysics,mzikherman/metaphysics-1,mzikherman/metaphysics-1,artsy/metaphysics,mzikherman/metaphysics-1,artsy/metaphysics
--- +++ @@ -4,10 +4,7 @@ } export const moneyFieldToUnit = (moneyField: MoneyField) => { - switch (moneyField.currencyCode) { - case "USD": - return moneyField.amount * 100 - default: - throw new Error("Unknown currency, cannot process.") - } + // this currently only supports currencies with cents + // and multiply the major value to 100 to get cent value + return moneyField.amount * 100 }
b58237f4fc2ba6112fda02f7d09c6470560806a2
client/src/app/app.routing.ts
client/src/app/app.routing.ts
import { Routes, RouterModule } from '@angular/router'; import { ListPageComponent } from './list-page/list-page.component'; import { DetailPageComponent } from './detail-page/detail-page.component'; const isariRoutes: Routes = [ { path: '', redirectTo: '/people', pathMatch: 'full' }, { path: ':feature', children: [ { path: '', component: ListPageComponent }, { path: ':id', component: DetailPageComponent } ] } ]; const appRoutes: Routes = [ ...isariRoutes ]; export const appRoutingProviders: any[] = []; export const routing = RouterModule.forRoot(appRoutes);
import { Routes, RouterModule } from '@angular/router'; import { ListPageComponent } from './list-page/list-page.component'; import { DetailPageComponent } from './detail-page/detail-page.component'; const isariRoutes: Routes = [ { path: '', redirectTo: '/people/1', pathMatch: 'full' }, { path: ':feature', children: [ { path: '', component: ListPageComponent }, { path: ':id', component: DetailPageComponent } ] } ]; const appRoutes: Routes = [ ...isariRoutes ]; export const appRoutingProviders: any[] = []; export const routing = RouterModule.forRoot(appRoutes);
Change default route to people/1 for dev simplification
Change default route to people/1 for dev simplification
TypeScript
agpl-3.0
SciencesPo/isari,SciencesPo/isari,SciencesPo/isari,SciencesPo/isari
--- +++ @@ -6,7 +6,7 @@ const isariRoutes: Routes = [ { path: '', - redirectTo: '/people', + redirectTo: '/people/1', pathMatch: 'full' }, {
be7f3d86adc60afd3bf5543cd063d3443116c5fe
src/app/components/WindowButton/styles.ts
src/app/components/WindowButton/styles.ts
import styled from 'styled-components'; import images from '../../../shared/mixins/images'; import { HOVER_DURATION } from '../../constants/design'; import { Icons } from '../../../shared/enums'; interface IButtonProps { icon: Icons; } export const Button = styled.div` height: 100%; -webkit-app-region: no-drag; width: 45px; position: relative; transition: ${HOVER_DURATION}s background-color; &:hover { background-color: ${(props: IButtonProps) => (props.icon !== Icons.Close ? 'rgba(196, 196, 196, 0.4)' : '#e81123')}; } `; interface IIconProps { icon: Icons; } export const Icon = styled.div` width: 100%; height: 100%; transition: ${HOVER_DURATION}s filter; background-image: ${(props: IIconProps) => `url(../../src/app/icons/${props.icon})`}; ${images.center('11px', '11px')} &:hover { filter: ${props => props.icon === Icons.Close && 'invert(100%);'}; } `;
import styled from 'styled-components'; import images from '../../../shared/mixins/images'; import { HOVER_DURATION } from '../../constants/design'; import { Icons } from '../../../shared/enums'; interface IButtonProps { icon: Icons; } export const Button = styled.div` height: 100%; -webkit-app-region: no-drag; width: 45px; position: relative; transition: ${HOVER_DURATION}s background-color; &:hover { background-color: ${(props: IButtonProps) => (props.icon !== Icons.Close ? 'rgba(196, 196, 196, 0.4)' : '#e81123')}; } `; interface IIconProps { icon: Icons; } export const Icon = styled.div` width: 100%; height: 100%; transition: ${HOVER_DURATION}s filter; background-image: ${(props: IIconProps) => `url(../../src/shared/icons/${props.icon})`}; ${images.center('11px', '11px')} &:hover { filter: ${props => props.icon === Icons.Close && 'invert(100%);'}; } `;
Fix window buttons for Windows
:bug: Fix window buttons for Windows
TypeScript
apache-2.0
Nersent/Wexond,Nersent/Wexond
--- +++ @@ -30,7 +30,7 @@ height: 100%; transition: ${HOVER_DURATION}s filter; - background-image: ${(props: IIconProps) => `url(../../src/app/icons/${props.icon})`}; + background-image: ${(props: IIconProps) => `url(../../src/shared/icons/${props.icon})`}; ${images.center('11px', '11px')} &:hover { filter: ${props => props.icon === Icons.Close && 'invert(100%);'}; }
4da45c16e1ce0ae557cdf0fe9a585e0585e5b121
helpers/session.ts
helpers/session.ts
import * as cookie from "cookie"; import * as http from "http"; import * as orm from "typeorm"; import * as eta from "../eta"; export default class HelperSession { public static async getFromRequest(req: http.IncomingMessage): Promise<{[key: string]: any}> { let sid: string; try { sid = cookie.parse(req.headers.cookie)["connect.sid"]; } catch (err) { return null; } if (!sid) { return null; } sid = sid.split(".")[0].substring(2); let queryRunner: orm.QueryRunner = await eta.db.driver.createQueryRunner(); let rows: any[] = await queryRunner.query("SELECT expire, sess FROM session WHERE sid = $1::text", [sid]); if (!rows || rows.length == 0) { return null; } if (rows[0].expire.getTime() < new Date().getTime()) { return null; } return rows[0].sess; } }
import * as cookie from "cookie"; import * as http from "http"; import * as orm from "typeorm"; import * as eta from "../eta"; export default class HelperSession { public static async getFromRequest(req: http.IncomingMessage): Promise<{[key: string]: any}> { let sid: string; try { sid = cookie.parse(req.headers.cookie)["connect.sid"].toString(); } catch (err) { return null; } if (!sid) { return null; } sid = sid.split(".")[0].substring(2); let queryRunner: orm.QueryRunner = await eta.db.driver.createQueryRunner(); let rows: any[] = await queryRunner.query("SELECT expire, sess FROM session WHERE sid = $1::text", [sid]); if (!rows || rows.length == 0) { return null; } if (rows[0].expire.getTime() < new Date().getTime()) { return null; } return rows[0].sess; } }
Fix build error in HelperSession
Fix build error in HelperSession
TypeScript
mit
crossroads-education/eta,crossroads-education/eta
--- +++ @@ -7,7 +7,7 @@ public static async getFromRequest(req: http.IncomingMessage): Promise<{[key: string]: any}> { let sid: string; try { - sid = cookie.parse(req.headers.cookie)["connect.sid"]; + sid = cookie.parse(req.headers.cookie)["connect.sid"].toString(); } catch (err) { return null; }
e8515f5835909162a34cfbb9bc59ea9baedaf74d
src/logger.ts
src/logger.ts
const logger = { info: (message: string) => { // tslint:disable-next-line:no-console // tslint:disable-next-line:strict-type-predicates if (console && typeof console.info === 'function') { // tslint:disable-next-line:no-console console.info(`Canvasimo: ${message}`); } }, warn: (message: string) => { // tslint:disable-next-line:no-console // tslint:disable-next-line:strict-type-predicates if (console && typeof console.warn === 'function') { // tslint:disable-next-line:no-console console.warn(`Canvasimo: ${message}`); } }, }; export default logger;
const consoleExists = Boolean(window.console); const logger = { info: (message: string) => { if (consoleExists) { window.console.info(`Canvasimo: ${message}`); } }, warn: (message: string) => { if (consoleExists) { window.console.warn(`Canvasimo: ${message}`); } }, }; export default logger;
Check for window.console and use this for logs
Check for window.console and use this for logs
TypeScript
mit
JakeSidSmith/canvasimo,JakeSidSmith/canvasimo,JakeSidSmith/sensible-canvas-interface
--- +++ @@ -1,18 +1,14 @@ +const consoleExists = Boolean(window.console); + const logger = { info: (message: string) => { - // tslint:disable-next-line:no-console - // tslint:disable-next-line:strict-type-predicates - if (console && typeof console.info === 'function') { - // tslint:disable-next-line:no-console - console.info(`Canvasimo: ${message}`); + if (consoleExists) { + window.console.info(`Canvasimo: ${message}`); } }, warn: (message: string) => { - // tslint:disable-next-line:no-console - // tslint:disable-next-line:strict-type-predicates - if (console && typeof console.warn === 'function') { - // tslint:disable-next-line:no-console - console.warn(`Canvasimo: ${message}`); + if (consoleExists) { + window.console.warn(`Canvasimo: ${message}`); } }, };
b9b375a3d666b64ada5220e1dbfbbe34465e97c3
{{cookiecutter.github_project_name}}/src/plugin.ts
{{cookiecutter.github_project_name}}/src/plugin.ts
// Copyright (c) {{ cookiecutter.author_name }} // Distributed under the terms of the Modified BSD License. import { Application, IPlugin } from '@phosphor/application'; import { Widget } from '@phosphor/widgets'; import { IJupyterWidgetRegistry } from '@jupyter-widgets/base'; import * as widgetExports from './widget'; import { MODULE_NAME, MODULE_VERSION } from './version'; const EXTENSION_ID = '{{ cookiecutter.npm_package_name }}:plugin'; /** * The example plugin. */ const examplePlugin: IPlugin<Application<Widget>, void> = { id: EXTENSION_ID, requires: [IJupyterWidgetRegistry], activate: activateWidgetExtension, autoStart: true }; export default examplePlugin; /** * Activate the widget extension. */ function activateWidgetExtension(app: Application<Widget>, registry: IJupyterWidgetRegistry): void { registry.registerWidget({ name: MODULE_NAME, version: MODULE_VERSION, exports: widgetExports, }); }
// Copyright (c) {{ cookiecutter.author_name }} // Distributed under the terms of the Modified BSD License. import { Application, IPlugin } from '@phosphor/application'; import { Widget } from '@phosphor/widgets'; import { IJupyterWidgetRegistry } from '@jupyter-widgets/base'; import * as widgetExports from './widget'; import { MODULE_NAME, MODULE_VERSION } from './version'; const EXTENSION_ID = '{{ cookiecutter.npm_package_name }}:plugin'; /** * The example plugin. */ const examplePlugin: IPlugin<Application<Widget>, void> = { id: EXTENSION_ID, requires: [IJupyterWidgetRegistry], activate: activateWidgetExtension, autoStart: true } as unknown as IPlugin<Application<Widget>, void>; // the "as unknown as ..." typecast above is solely to support JupyterLab 1 // and 2 in the same codebase and should be removed when we migrate to Lumino. export default examplePlugin; /** * Activate the widget extension. */ function activateWidgetExtension(app: Application<Widget>, registry: IJupyterWidgetRegistry): void { registry.registerWidget({ name: MODULE_NAME, version: MODULE_VERSION, exports: widgetExports, }); }
Add necessary typecast for supporting jlab 1 and 2
Add necessary typecast for supporting jlab 1 and 2
TypeScript
bsd-3-clause
jupyter-widgets/widget-ts-cookiecutter,jupyter-widgets/widget-ts-cookiecutter,jupyter-widgets/widget-ts-cookiecutter
--- +++ @@ -29,7 +29,9 @@ requires: [IJupyterWidgetRegistry], activate: activateWidgetExtension, autoStart: true -}; +} as unknown as IPlugin<Application<Widget>, void>; +// the "as unknown as ..." typecast above is solely to support JupyterLab 1 +// and 2 in the same codebase and should be removed when we migrate to Lumino. export default examplePlugin;
5b636fa9254ddfed57242087396a2ed050e0a365
src/app/views/sessions/session/visualization/visualizationconstants.ts
src/app/views/sessions/session/visualization/visualizationconstants.ts
export default [ { id: 'spreadsheet', name: 'Spreadsheet', extensions: ['tsv', 'bed'], anyInputCountSupported: false, supportedInputFileCounts: [1] }, { id: 'text', name: 'Text', extensions: ['txt', 'tsv', 'bed'], anyInputCountSupported: false, supportedInputFileCounts: [1] }, { id: 'expressionprofile', name: 'Expression profile', extensions: ['tsv'], anyInputCountSupported: false, supportedInputFileCounts: [1] }, { id: 'image', name: 'Image', extensions: ['png', "jpg", "jpeg"], anyInputCountSupported: false, supportedInputFileCounts: [1] }, { id: 'pdf', name: 'PDF', extensions: ['pdf'], anyInputCountSupported: false, supportedInputFileCounts: [1] }, { id: 'phenodata', name: 'Phenodata', extensions: ['tsv', 'bam'], anyInputCountSupported: true }, { id: 'html', name: 'Html', extensions: ['html'], anyInputCountSupported: false, supportedInputFileCounts: [1] }, { id: 'venn', name: 'Venn-Diagram', extensions: ['tsv'], anyInputCountSupported: false, supportedInputFileCounts: [2, 3] } ];
export default [ { id: 'spreadsheet', name: 'Spreadsheet', extensions: ['tsv', 'bed', 'gtf'], anyInputCountSupported: false, supportedInputFileCounts: [1] }, { id: 'text', name: 'Text', extensions: ['txt', 'tsv', 'bed', 'gtf'], anyInputCountSupported: false, supportedInputFileCounts: [1] }, { id: 'expressionprofile', name: 'Expression profile', extensions: ['tsv'], anyInputCountSupported: false, supportedInputFileCounts: [1] }, { id: 'image', name: 'Image', extensions: ['png', "jpg", "jpeg"], anyInputCountSupported: false, supportedInputFileCounts: [1] }, { id: 'pdf', name: 'PDF', extensions: ['pdf'], anyInputCountSupported: false, supportedInputFileCounts: [1] }, { id: 'phenodata', name: 'Phenodata', extensions: ['tsv', 'bam'], anyInputCountSupported: true }, { id: 'html', name: 'Html', extensions: ['html'], anyInputCountSupported: false, supportedInputFileCounts: [1] }, { id: 'venn', name: 'Venn-Diagram', extensions: ['tsv'], anyInputCountSupported: false, supportedInputFileCounts: [2, 3] } ];
Add gtf to text and spreadsheet extensions
Add gtf to text and spreadsheet extensions
TypeScript
mit
chipster/chipster-web,chipster/chipster-web,chipster/chipster-web
--- +++ @@ -2,14 +2,14 @@ { id: 'spreadsheet', name: 'Spreadsheet', - extensions: ['tsv', 'bed'], + extensions: ['tsv', 'bed', 'gtf'], anyInputCountSupported: false, supportedInputFileCounts: [1] }, { id: 'text', name: 'Text', - extensions: ['txt', 'tsv', 'bed'], + extensions: ['txt', 'tsv', 'bed', 'gtf'], anyInputCountSupported: false, supportedInputFileCounts: [1] },
1ed86220621ab59c446a95f99745b169bf838b9b
client/Library/EncounterLibraryViewModel.ts
client/Library/EncounterLibraryViewModel.ts
module ImprovedInitiative { export class EncounterLibraryViewModel { constructor( private encounterCommander: EncounterCommander, private library: EncounterLibrary ) { } LibraryFilter = ko.observable(""); FilteredEncounters = ko.pureComputed<string []>(() => { const filter = (ko.unwrap(this.LibraryFilter) || '').toLocaleLowerCase(), index = this.library.Index(); if (filter.length == 0) { return index; } return index.filter(name => name.indexOf(filter) > -1); }); ClickEntry = (name: string) => this.encounterCommander.LoadEncounterByName(name); ClickDelete = (name: string) => this.encounterCommander.DeleteSavedEncounter(name); ClickHide = () => this.encounterCommander.HideLibraries(); ClickAdd = () => this.encounterCommander.SaveEncounter(); } }
module ImprovedInitiative { export class EncounterLibraryViewModel { constructor( private encounterCommander: EncounterCommander, private library: EncounterLibrary ) { } LibraryFilter = ko.observable(""); FilteredEncounters = ko.pureComputed<string []>(() => { const filter = (ko.unwrap(this.LibraryFilter) || '').toLocaleLowerCase(), index = this.library.Index(); if (filter.length == 0) { return index; } return index.filter(name => name.toLocaleLowerCase().indexOf(filter) > -1); }); ClickEntry = (name: string) => this.encounterCommander.LoadEncounterByName(name); ClickDelete = (name: string) => this.encounterCommander.DeleteSavedEncounter(name); ClickHide = () => this.encounterCommander.HideLibraries(); ClickAdd = () => this.encounterCommander.SaveEncounter(); } }
Make encounter library filter case insensitive
Make encounter library filter case insensitive
TypeScript
mit
cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative
--- +++ @@ -15,7 +15,7 @@ return index; } - return index.filter(name => name.indexOf(filter) > -1); + return index.filter(name => name.toLocaleLowerCase().indexOf(filter) > -1); }); ClickEntry = (name: string) => this.encounterCommander.LoadEncounterByName(name);
e5b8656b18baf8fa7ec988e5eab7647c0d489989
directives/angular2-google-chart.directive.ts
directives/angular2-google-chart.directive.ts
import {Directive,ElementRef,Input,OnInit} from '@angular/core'; declare var google:any; declare var googleLoaded:any; @Directive({ selector: '[GoogleChart]', // properties: [ // 'chartType', // 'chartOptions', // 'chartData' // ] }) export class GoogleChart implements OnInit { public _element:any; @Input('chartType') public chartType:string; @Input('chartOptions') public chartOptions: Object; @Input('chartData') public chartData: Object; constructor(public element: ElementRef) { this._element = this.element.nativeElement; } ngOnInit() { if(!googleLoaded) { googleLoaded = true; google.charts.load('current', {'packages':['corechart', 'gauge']}); } setTimeout(() =>this.drawGraph(this.chartOptions,this.chartType,this.chartData,this._element),1000); } drawGraph (chartOptions,chartType,chartData,ele) { google.charts.setOnLoadCallback(drawChart); function drawChart() { var wrapper; wrapper = new google.visualization.ChartWrapper({ chartType: chartType, dataTable:chartData , options:chartOptions || {}, containerId: ele.id }); wrapper.draw(); } } }
import {Directive,ElementRef,Input,OnInit} from '@angular/core'; declare var google:any; declare var googleLoaded:any; @Directive({ selector: '[GoogleChart]', // properties: [ // 'chartType', // 'chartOptions', // 'chartData' // ] }) export class GoogleChart implements OnInit { public _element:any; @Input('chartType') public chartType:string; @Input('chartOptions') public chartOptions: Object; @Input('chartData') public chartData: Object; constructor(public element: ElementRef) { this._element = this.element.nativeElement; } ngOnInit() { if(!googleLoaded) { googleLoaded = true; google.charts.load('current', {'packages':['corechart', 'gauge']}); } setTimeout(() =>this.drawGraph(this.chartOptions,this.chartType,this.chartData,this._element),1000); } drawGraph (chartOptions,chartType,chartData,ele) { google.charts.setOnLoadCallback(drawChart); function drawChart() { var wrapper; wrapper = new google.visualization.ChartWrapper({ chartType: chartType, dataTable:chartData , options:chartOptions || {} }); wrapper.draw(ele); } } }
Fix GoogleChart to work with Shadow Dom
Fix GoogleChart to work with Shadow Dom Referencing the container by ele.id breaks when Shadow Dom is used. Fixed this by passing in the element directly to the draw function.
TypeScript
mit
vimalavinisha/angular2-google-chart,vimalavinisha/angular2-google-chart,vimalavinisha/angular2-google-chart
--- +++ @@ -31,10 +31,9 @@ wrapper = new google.visualization.ChartWrapper({ chartType: chartType, dataTable:chartData , - options:chartOptions || {}, - containerId: ele.id + options:chartOptions || {} }); - wrapper.draw(); + wrapper.draw(ele); } } }
7f13eaff8132c6a540eefb8a81b696a2b9cadd89
src/pages/user/index.ts
src/pages/user/index.ts
import { inject } from 'aurelia-framework'; import { Router } from 'aurelia-router'; import { HackerNewsApi } from '../../services/api'; @inject(Router, HackerNewsApi) export class User { user: any; private readonly router: Router; private readonly api: HackerNewsApi; private id: string; constructor(router: Router, api: HackerNewsApi) { this.router = router; this.api = api; } async activate(params: any): Promise<void> { if (params.id === undefined) { this.router.navigateToRoute('news'); return; } this.id = params.id; this.user = await this.api.fetch('user/' + this.id); } }
import { inject } from 'aurelia-framework'; import { Router } from 'aurelia-router'; import { HackerNewsApi } from '../../services/api'; @inject(Router, HackerNewsApi) export class User { user: any; private readonly router: Router; private readonly api: HackerNewsApi; private id: string; constructor(router: Router, api: HackerNewsApi) { this.router = router; this.api = api; } async activate(params: any): Promise<void> { if (params.id === undefined) { this.router.navigateToRoute('news'); return; } this.id = params.id; this.user = await this.api.fetch(`user/${this.id}`); } }
Use template string in User view-model
Use template string in User view-model
TypeScript
isc
MikeBull94/aurelia-hacker-news,michaelbull/aurelia-hacker-news,michaelbull/aurelia-hacker-news,michaelbull/aurelia-hacker-news,MikeBull94/aurelia-hacker-news
--- +++ @@ -22,6 +22,6 @@ } this.id = params.id; - this.user = await this.api.fetch('user/' + this.id); + this.user = await this.api.fetch(`user/${this.id}`); } }
cb9d46462278597b4e70de97e2aed007a70db113
src/elements/members/__tests__/enum-member.ts
src/elements/members/__tests__/enum-member.ts
jest.unmock('../enum-member'); import {Stack} from '../../../stack'; import {VariableDeclaration} from '../../declarations/variable-declaration'; import {EnumMember} from '../enum-member'; describe('#_emit()', () => { it('should return correctly', () => { const fn = (): number => 1; expect(new EnumMember({ owned: new VariableDeclaration({name: 'x'}), })._emit(new Stack(), fn)).toMatchSnapshot(); }); });
jest.unmock('../enum-member'); import {Stack} from '../../../stack'; import {VariableDeclaration} from '../../declarations/variable-declaration'; import {EnumMember} from '../enum-member'; describe('#emit()', () => { it('should return correctly', () => { const fn = (): number => 1; expect(new EnumMember({ owned: new VariableDeclaration({name: 'x'}), }).emit(new Stack(), fn)).toMatchSnapshot(); }); });
Update tests use emit() instead of _emit()
Update tests use emit() instead of _emit()
TypeScript
mit
ikatyang/dts-element,ikatyang/dts-element
--- +++ @@ -4,11 +4,11 @@ import {VariableDeclaration} from '../../declarations/variable-declaration'; import {EnumMember} from '../enum-member'; -describe('#_emit()', () => { +describe('#emit()', () => { it('should return correctly', () => { const fn = (): number => 1; expect(new EnumMember({ owned: new VariableDeclaration({name: 'x'}), - })._emit(new Stack(), fn)).toMatchSnapshot(); + }).emit(new Stack(), fn)).toMatchSnapshot(); }); });
33eebc5508045282a6f266cea49707811f699438
src/index.ts
src/index.ts
/** Types of elements found in the DOM */ export const enum ElementType { Text = "text", //Text Directive = "directive", //<? ... ?> Comment = "comment", //<!-- ... --> Script = "script", //<script> tags Style = "style", //<style> tags Tag = "tag", //Any tag CDATA = "cdata", //<![CDATA[ ... ]]> Doctype = "doctype", } /** * Tests whether an element is a tag or not. * * @param elem Element to test */ export function isTag(elem: { type: ElementType }): boolean { return ( elem.type === ElementType.Tag || elem.type === ElementType.Script || elem.type === ElementType.Style ); } // Exports for backwards compatibility export const Text = ElementType.Text; //Text export const Directive = ElementType.Directive; //<? ... ?> export const Comment = ElementType.Comment; //<!-- ... --> export const Script = ElementType.Script; //<script> tags export const Style = ElementType.Style; //<style> tags export const Tag = ElementType.Tag; //Any tag export const CDATA = ElementType.CDATA; //<![CDATA[ ... ]]> export const Doctype = ElementType.Doctype;
/** Types of elements found in htmlparser2's DOM */ export const enum ElementType { /** Type for Text */ Text = "text", /** Type for <? ... ?> */ Directive = "directive", /** Type for <!-- ... --> */ Comment = "comment", /** Type for <script> tags */ Script = "script", /** Type for <style> tags */ Style = "style", /** Type for Any tag */ Tag = "tag", /** Type for <![CDATA[ ... ]]> */ CDATA = "cdata", /** Type for <!doctype ...> */ Doctype = "doctype", } /** * Tests whether an element is a tag or not. * * @param elem Element to test */ export function isTag(elem: { type: ElementType }): boolean { return ( elem.type === ElementType.Tag || elem.type === ElementType.Script || elem.type === ElementType.Style ); } // Exports for backwards compatibility /** Type for Text */ export const Text = ElementType.Text; /** Type for <? ... ?> */ export const Directive = ElementType.Directive; /** Type for <!-- ... --> */ export const Comment = ElementType.Comment; /** Type for <script> tags */ export const Script = ElementType.Script; /** Type for <style> tags */ export const Style = ElementType.Style; /** Type for Any tag */ export const Tag = ElementType.Tag; /** Type for <![CDATA[ ... ]]> */ export const CDATA = ElementType.CDATA; /** Type for <!doctype ...> */ export const Doctype = ElementType.Doctype;
Update documentation for exported values
docs: Update documentation for exported values
TypeScript
bsd-2-clause
fb55/domelementtype
--- +++ @@ -1,12 +1,20 @@ -/** Types of elements found in the DOM */ +/** Types of elements found in htmlparser2's DOM */ export const enum ElementType { - Text = "text", //Text - Directive = "directive", //<? ... ?> - Comment = "comment", //<!-- ... --> - Script = "script", //<script> tags - Style = "style", //<style> tags - Tag = "tag", //Any tag - CDATA = "cdata", //<![CDATA[ ... ]]> + /** Type for Text */ + Text = "text", + /** Type for <? ... ?> */ + Directive = "directive", + /** Type for <!-- ... --> */ + Comment = "comment", + /** Type for <script> tags */ + Script = "script", + /** Type for <style> tags */ + Style = "style", + /** Type for Any tag */ + Tag = "tag", + /** Type for <![CDATA[ ... ]]> */ + CDATA = "cdata", + /** Type for <!doctype ...> */ Doctype = "doctype", } @@ -24,11 +32,19 @@ } // Exports for backwards compatibility -export const Text = ElementType.Text; //Text -export const Directive = ElementType.Directive; //<? ... ?> -export const Comment = ElementType.Comment; //<!-- ... --> -export const Script = ElementType.Script; //<script> tags -export const Style = ElementType.Style; //<style> tags -export const Tag = ElementType.Tag; //Any tag -export const CDATA = ElementType.CDATA; //<![CDATA[ ... ]]> +/** Type for Text */ +export const Text = ElementType.Text; +/** Type for <? ... ?> */ +export const Directive = ElementType.Directive; +/** Type for <!-- ... --> */ +export const Comment = ElementType.Comment; +/** Type for <script> tags */ +export const Script = ElementType.Script; +/** Type for <style> tags */ +export const Style = ElementType.Style; +/** Type for Any tag */ +export const Tag = ElementType.Tag; +/** Type for <![CDATA[ ... ]]> */ +export const CDATA = ElementType.CDATA; +/** Type for <!doctype ...> */ export const Doctype = ElementType.Doctype;
293598303c9c92408f71e6bd13c4dde4c875398c
coffee-chats/src/main/webapp/src/util/fetch.ts
coffee-chats/src/main/webapp/src/util/fetch.ts
import React from "react"; interface ResponseRaceDetect { response: Response; json: any; raceOccurred: boolean; } const fetchAndDetectRaces: (url: string) => Promise<ResponseRaceDetect> = (() => { let requestId = 0; return async (url: string) => { const currentRequestId = ++requestId; const response = await fetch(url); const json = await response.json(); const raceOccurred = requestId != currentRequestId; return {response, json, raceOccurred}; } })(); /** * A hook that fetches JSON data from a URL using a GET request * * @param url: URL to fetch data from */ export function useFetch(url: string): any { const [data, setData] = React.useState(null); React.useEffect(() => { (async () => { const {response, json, raceOccurred} = await fetchAndDetectRaces(url); if (raceOccurred) { return; } if (!response.ok && json.loginUrl) { window.location.href = json.loginUrl; } else { setData(json); } })(); }, [url]); return data; }
import React from "react"; /** * A hook that fetches JSON data from a URL using a GET request * * @param url: URL to fetch data from */ export function useFetch(url: string): any { const [data, setData] = React.useState(null); const requestId = React.useRef(0); React.useEffect(() => { (async () => { const currentRequestId = ++requestId.current; const response = await fetch(url); const json = await response.json(); const raceOccurred = requestId.current !== currentRequestId; if (raceOccurred) { return; } if (!response.ok && json.loginUrl) { window.location.href = json.loginUrl; } else { setData(json); } })(); }, [url]); return data; }
Use useRef for race detection in useFetch
Use useRef for race detection in useFetch
TypeScript
apache-2.0
googleinterns/step250-2020,googleinterns/step250-2020,googleinterns/step250-2020,googleinterns/step250-2020
--- +++ @@ -1,24 +1,4 @@ import React from "react"; - -interface ResponseRaceDetect { - response: Response; - json: any; - raceOccurred: boolean; -} - -const fetchAndDetectRaces: (url: string) => Promise<ResponseRaceDetect> = (() => { - let requestId = 0; - - return async (url: string) => { - const currentRequestId = ++requestId; - - const response = await fetch(url); - const json = await response.json(); - const raceOccurred = requestId != currentRequestId; - - return {response, json, raceOccurred}; - } -})(); /** * A hook that fetches JSON data from a URL using a GET request @@ -27,10 +7,14 @@ */ export function useFetch(url: string): any { const [data, setData] = React.useState(null); + const requestId = React.useRef(0); React.useEffect(() => { (async () => { - const {response, json, raceOccurred} = await fetchAndDetectRaces(url); + const currentRequestId = ++requestId.current; + const response = await fetch(url); + const json = await response.json(); + const raceOccurred = requestId.current !== currentRequestId; if (raceOccurred) { return;
49770262471fd7cfeea0c45ec867ace3dd3655e7
client/src/app/plants/bed.component.ts
client/src/app/plants/bed.component.ts
import { Component, OnInit } from '@angular/core'; import { PlantListService } from "./plant-list.service"; import { Plant } from "./plant"; import { FilterBy } from "../plants/filter.pipe"; import {Params, ActivatedRoute, Router} from "@angular/router"; @Component({ selector: 'bed-component', templateUrl: 'bed.component.html', providers: [ FilterBy ] }) export class BedComponent implements OnInit { public bed : string; public plants: Plant[] = []; public locations: Plant[]; constructor(private plantListService: PlantListService, private route: ActivatedRoute, private router: Router) { // this.plants = this.plantListService.getPlants() //Get the bed from the params of the route this.router.events.subscribe((val) => { this.bed = this.route.snapshot.params["gardenLocation"]; this.refreshInformation(); }); } ngOnInit(): void{ } refreshInformation() : void { this.plantListService.getFlowersByBed(this.bed).subscribe ( plants => this.plants = plants, err => { console.log(err); } ); this.plantListService.getGardenLocations().subscribe( locations => this.locations = locations, err => { console.log(err); } ); } }
import { Component, OnInit } from '@angular/core'; import { PlantListService } from "./plant-list.service"; import { Plant } from "./plant"; import { FilterBy } from "../plants/filter.pipe"; import {Params, ActivatedRoute, Router} from "@angular/router"; @Component({ selector: 'bed-component', templateUrl: 'bed.component.html', providers: [ FilterBy ] }) export class BedComponent implements OnInit { public bed : string; public plants: Plant[] = []; constructor(private plantListService: PlantListService, private route: ActivatedRoute, private router: Router) { // this.plants = this.plantListService.getPlants() //Get the bed from the params of the route this.router.events.subscribe((val) => { this.bed = this.route.snapshot.params["gardenLocation"]; this.refreshInformation(); }); } ngOnInit(): void{ } refreshInformation() : void { this.plantListService.getFlowersByBed(this.bed).subscribe ( plants => this.plants = plants, err => { console.log(err); } ); } }
Remove un-used variable from BedComponent
Remove un-used variable from BedComponent
TypeScript
mit
UMM-CSci-3601-S17/digital-display-garden-iteration-4-dorfner-v2,UMM-CSci-3601-S17/digital-display-garden-iteration-3-dorfner,UMM-CSci-3601-S17/digital-display-garden-iteration-4-dorfner-v2,UMM-CSci-3601-S17/digital-display-garden-iteration-3-dorfner,UMM-CSci-3601-S17/digital-display-garden-iteration-4-dorfner-v2,UMM-CSci-3601-S17/digital-display-garden-iteration-3-dorfner,UMM-CSci-3601-S17/digital-display-garden-iteration-3-dorfner,UMM-CSci-3601-S17/digital-display-garden-iteration-4-dorfner-v2,UMM-CSci-3601-S17/digital-display-garden-iteration-4-dorfner-v2
--- +++ @@ -13,7 +13,6 @@ export class BedComponent implements OnInit { public bed : string; public plants: Plant[] = []; - public locations: Plant[]; constructor(private plantListService: PlantListService, private route: ActivatedRoute, private router: Router) { // this.plants = this.plantListService.getPlants() @@ -38,12 +37,6 @@ } ); - this.plantListService.getGardenLocations().subscribe( - locations => this.locations = locations, - err => { - console.log(err); - } - ); }
00df897ee343bfb2eeba651697e8187d664711cd
src/takeoff-detector.ts
src/takeoff-detector.ts
import * as turf from '@turf/turf'; import {Fix} from "./read-flight"; const Emitter = require('tiny-emitter'); export class TakeoffDetector { private _lastFix: Fix | undefined = undefined; flying: boolean = false; private readonly _emitter = new Emitter(); update(fix: Fix) { let speed = this._currentSpeed(fix); let flying = this._isFlightSpeed(speed); if (flying && !this.flying) { this._emitter.emit('takeoff', fix) } if (!flying && this.flying) { this._emitter.emit('landing', fix) } this.flying = flying; this._lastFix = fix; } _currentSpeed(fix: Fix): number { if (!this._lastFix) return 0; let distance = turf.distance(this._lastFix.coordinate, fix.coordinate); let milliseconds = fix.time - this._lastFix.time; let hours = milliseconds / 3600000; return distance / hours; } _isFlightSpeed(speed: number): boolean { return speed > 50; } on(event: string, handler: Function) { return this._emitter.on(event, handler); } }
import * as cheapRuler from "cheap-ruler"; import {Fix} from "./read-flight"; const Emitter = require('tiny-emitter'); export class TakeoffDetector { private _lastFix: Fix | undefined = undefined; flying: boolean = false; private readonly _emitter = new Emitter(); update(fix: Fix) { let speed = this._currentSpeed(fix); let flying = this._isFlightSpeed(speed); if (flying && !this.flying) { this._emitter.emit('takeoff', fix) } if (!flying && this.flying) { this._emitter.emit('landing', fix) } this.flying = flying; this._lastFix = fix; } _currentSpeed(fix: Fix): number { if (!this._lastFix) return 0; let distance = cheapRuler(fix.coordinate[1]).distance(this._lastFix.coordinate, fix.coordinate); let milliseconds = fix.time - this._lastFix.time; let hours = milliseconds / 3600000; return distance / hours; } _isFlightSpeed(speed: number): boolean { return speed > 50; } on(event: string, handler: Function) { return this._emitter.on(event, handler); } }
Use "cheap-ruler" instead of "turf"
TakeoffDetector: Use "cheap-ruler" instead of "turf"
TypeScript
mit
Turbo87/aeroscore,Turbo87/aeroscore
--- +++ @@ -1,4 +1,4 @@ -import * as turf from '@turf/turf'; +import * as cheapRuler from "cheap-ruler"; import {Fix} from "./read-flight"; @@ -29,7 +29,7 @@ _currentSpeed(fix: Fix): number { if (!this._lastFix) return 0; - let distance = turf.distance(this._lastFix.coordinate, fix.coordinate); + let distance = cheapRuler(fix.coordinate[1]).distance(this._lastFix.coordinate, fix.coordinate); let milliseconds = fix.time - this._lastFix.time; let hours = milliseconds / 3600000; return distance / hours;
b51a8da34bd7b724123e0490fc083353c6ef8d9e
types/react-router/test/WithRouterDecorator.tsx
types/react-router/test/WithRouterDecorator.tsx
import * as React from 'react'; import { withRouter, RouteComponentProps } from 'react-router-dom'; interface TOwnProps { username: string; } @withRouter class Component extends React.Component<TOwnProps, {}> { render() { return ( <h2>Welcome {this.props.username}</h2> ); } } const WithRouterTest = () => (<Component username="John" />); export default WithRouterTest;
import * as React from 'react'; import { withRouter, RouteComponentProps } from 'react-router-dom'; interface TOwnProps { username: string; } // $ExpectType Component @withRouter class Component extends React.Component<TOwnProps, {}> { render() { return ( <h2>Welcome {this.props.username}</h2> ); } } const WithRouterTest = () => (<Component username="John" />); // $ExpectType Element WithRouterTest(); export default WithRouterTest;
Add dtslint type assertion test.
Add dtslint type assertion test.
TypeScript
mit
benishouga/DefinitelyTyped,ashwinr/DefinitelyTyped,rolandzwaga/DefinitelyTyped,chrootsu/DefinitelyTyped,rolandzwaga/DefinitelyTyped,jimthedev/DefinitelyTyped,arusakov/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,jimthedev/DefinitelyTyped,dsebastien/DefinitelyTyped,one-pieces/DefinitelyTyped,aciccarello/DefinitelyTyped,arusakov/DefinitelyTyped,magny/DefinitelyTyped,georgemarshall/DefinitelyTyped,benliddicott/DefinitelyTyped,mcliment/DefinitelyTyped,benishouga/DefinitelyTyped,ashwinr/DefinitelyTyped,markogresak/DefinitelyTyped,dsebastien/DefinitelyTyped,abbasmhd/DefinitelyTyped,borisyankov/DefinitelyTyped,zuzusik/DefinitelyTyped,borisyankov/DefinitelyTyped,georgemarshall/DefinitelyTyped,magny/DefinitelyTyped,aciccarello/DefinitelyTyped,abbasmhd/DefinitelyTyped,aciccarello/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,nycdotnet/DefinitelyTyped,arusakov/DefinitelyTyped,zuzusik/DefinitelyTyped,AgentME/DefinitelyTyped,AgentME/DefinitelyTyped,AgentME/DefinitelyTyped,AgentME/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,nycdotnet/DefinitelyTyped,chrootsu/DefinitelyTyped,benishouga/DefinitelyTyped,zuzusik/DefinitelyTyped,alexdresko/DefinitelyTyped,alexdresko/DefinitelyTyped,jimthedev/DefinitelyTyped,georgemarshall/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,georgemarshall/DefinitelyTyped
--- +++ @@ -5,6 +5,7 @@ username: string; } +// $ExpectType Component @withRouter class Component extends React.Component<TOwnProps, {}> { render() { @@ -16,4 +17,7 @@ const WithRouterTest = () => (<Component username="John" />); +// $ExpectType Element +WithRouterTest(); + export default WithRouterTest;
06e31bb0becfc0322e21cd730a90eaae8f01fe5f
app/javascript/retrospring/features/lists/create.ts
app/javascript/retrospring/features/lists/create.ts
import Rails from '@rails/ujs'; import I18n from '../../../legacy/i18n'; export function createListHandler(event: Event): void { const button = event.target as HTMLButtonElement; const input = document.querySelector<HTMLInputElement>('input#new-list-name'); Rails.ajax({ url: '/ajax/create_list', type: 'POST', data: new URLSearchParams({ name: input.value, user: button.dataset.user }).toString(), success: (data) => { if (data.success) { document.querySelector('#lists-list ul.list-group').insertAdjacentHTML('beforeend', data.render); } window['showNotification'](data.message, data.success); }, error: (data, status, xhr) => { console.log(data, status, xhr); window['showNotification'](I18n.translate('frontend.error.message'), false); } }); } export function createListInputHandler(event: KeyboardEvent): void { if (event.which === 13) { event.preventDefault(); document.querySelector<HTMLButtonElement>('button#create-list').click(); } }
import Rails from '@rails/ujs'; import I18n from '../../../legacy/i18n'; export function createListHandler(event: Event): void { const button = event.target as HTMLButtonElement; const input = document.querySelector<HTMLInputElement>('input#new-list-name'); Rails.ajax({ url: '/ajax/create_list', type: 'POST', data: new URLSearchParams({ name: input.value, user: button.dataset.user }).toString(), success: (data) => { if (data.success) { document.querySelector('#lists-list ul.list-group').insertAdjacentHTML('beforeend', data.render); } window['showNotification'](data.message, data.success); }, error: (data, status, xhr) => { console.log(data, status, xhr); window['showNotification'](I18n.translate('frontend.error.message'), false); } }); } export function createListInputHandler(event: KeyboardEvent): void { // Return key if (event.which === 13) { event.preventDefault(); document.querySelector<HTMLButtonElement>('button#create-list').click(); } }
Apply review suggestion from @raccube
Apply review suggestion from @raccube
TypeScript
agpl-3.0
Retrospring/retrospring,Retrospring/retrospring,Retrospring/retrospring,Retrospring/retrospring,Retrospring/retrospring
--- +++ @@ -27,6 +27,7 @@ } export function createListInputHandler(event: KeyboardEvent): void { + // Return key if (event.which === 13) { event.preventDefault(); document.querySelector<HTMLButtonElement>('button#create-list').click();
2a5f7d1e058474ad38d6430d430672819639da0d
public/app/core/components/Tooltip/Popper.tsx
public/app/core/components/Tooltip/Popper.tsx
import React, { PureComponent } from 'react'; import { Manager, Popper as ReactPopper, Reference } from 'react-popper'; interface Props { renderContent: (content: any) => any; show: boolean; placement?: any; content: string | ((props: any) => JSX.Element); refClassName?: string; } class Popper extends PureComponent<Props> { render() { const { children, renderContent, show, placement, refClassName } = this.props; const { content } = this.props; return ( <Manager> <Reference> {({ ref }) => ( <div className={`popper_ref ${refClassName || ''}`} ref={ref}> {children} </div> )} </Reference> {show && ( <ReactPopper placement={placement}> {({ ref, style, placement, arrowProps }) => { return ( <div ref={ref} style={style} data-placement={placement} className="popper"> <div className="popper__background"> {renderContent(content)} <div ref={arrowProps.ref} data-placement={placement} className="popper__arrow" /> </div> </div> ); }} </ReactPopper> )} </Manager> ); } } export default Popper;
import React, { PureComponent } from 'react'; import { Manager, Popper as ReactPopper, Reference } from 'react-popper'; import Transition from 'react-transition-group/Transition'; const defaultTransitionStyles = { transition: 'opacity 200ms linear', opacity: 0, }; const transitionStyles = { exited: { opacity: 0 }, entering: { opacity: 0 }, entered: { opacity: 1 }, exiting: { opacity: 0 }, }; interface Props { renderContent: (content: any) => any; show: boolean; placement?: any; content: string | ((props: any) => JSX.Element); refClassName?: string; } class Popper extends PureComponent<Props> { render() { const { children, renderContent, show, placement, refClassName } = this.props; const { content } = this.props; return ( <Manager> <Reference> {({ ref }) => ( <div className={`popper_ref ${refClassName || ''}`} ref={ref}> {children} </div> )} </Reference> <Transition in={show} timeout={100}> {transitionState => ( <ReactPopper placement={placement}> {({ ref, style, placement, arrowProps }) => { return ( <div ref={ref} style={{ ...style, ...defaultTransitionStyles, ...transitionStyles[transitionState], }} data-placement={placement} className="popper" > <div className="popper__background"> {renderContent(content)} <div ref={arrowProps.ref} data-placement={placement} className="popper__arrow" /> </div> </div> ); }} </ReactPopper> )} </Transition> </Manager> ); } } export default Popper;
Add fade in transition to tooltip
panel-header: Add fade in transition to tooltip
TypeScript
agpl-3.0
grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana,grafana/grafana
--- +++ @@ -1,5 +1,18 @@ import React, { PureComponent } from 'react'; import { Manager, Popper as ReactPopper, Reference } from 'react-popper'; +import Transition from 'react-transition-group/Transition'; + +const defaultTransitionStyles = { + transition: 'opacity 200ms linear', + opacity: 0, +}; + +const transitionStyles = { + exited: { opacity: 0 }, + entering: { opacity: 0 }, + entered: { opacity: 1 }, + exiting: { opacity: 0 }, +}; interface Props { renderContent: (content: any) => any; @@ -13,6 +26,7 @@ render() { const { children, renderContent, show, placement, refClassName } = this.props; const { content } = this.props; + return ( <Manager> <Reference> @@ -22,20 +36,31 @@ </div> )} </Reference> - {show && ( - <ReactPopper placement={placement}> - {({ ref, style, placement, arrowProps }) => { - return ( - <div ref={ref} style={style} data-placement={placement} className="popper"> - <div className="popper__background"> - {renderContent(content)} - <div ref={arrowProps.ref} data-placement={placement} className="popper__arrow" /> + <Transition in={show} timeout={100}> + {transitionState => ( + <ReactPopper placement={placement}> + {({ ref, style, placement, arrowProps }) => { + return ( + <div + ref={ref} + style={{ + ...style, + ...defaultTransitionStyles, + ...transitionStyles[transitionState], + }} + data-placement={placement} + className="popper" + > + <div className="popper__background"> + {renderContent(content)} + <div ref={arrowProps.ref} data-placement={placement} className="popper__arrow" /> + </div> </div> - </div> - ); - }} - </ReactPopper> - )} + ); + }} + </ReactPopper> + )} + </Transition> </Manager> ); }
d42a6447fa5d117d760d39dfec887447f63647fa
app/src/ui/lib/context-menu.ts
app/src/ui/lib/context-menu.ts
const RestrictedFileExtensions = ['.cmd', '.exe', '.bat', '.sh'] export const CopyFilePathLabel = __DARWIN__ ? 'Copy File Path' : 'Copy file path' export const DefaultEditorLabel = __DARWIN__ ? 'Open in External Editor' : 'Open in external editor' export const RevealInFileManagerLabel = __DARWIN__ ? 'Reveal in Finder' : __WIN32__ ? 'Show in Explorer' : 'Show in your File Manager' export const TrashNameLabel = __DARWIN__ ? 'Trash' : 'Recycle Bin' export const OpenWithDefaultProgramLabel = __DARWIN__ ? 'Open with Default Program' : 'Open with default program' export function isSafeFileExtension(extension: string): boolean { if (__WIN32__) { return RestrictedFileExtensions.indexOf(extension.toLowerCase()) === -1 } return true }
const RestrictedFileExtensions = ['.cmd', '.exe', '.bat', '.sh'] export const CopyFilePathLabel = __DARWIN__ ? 'Copy File Path' : 'Copy file path' export const DefaultEditorLabel = __DARWIN__ ? 'Open in External Editor' : 'Open in external editor' export const RevealInFileManagerLabel = __DARWIN__ ? 'Reveal in Finder' : __WIN32__ ? 'Show in Explorer' : 'Show in your File Manager' export const TrashNameLabel = __WIN32__ ? 'Recycle Bin' : 'Trash' export const OpenWithDefaultProgramLabel = __DARWIN__ ? 'Open with Default Program' : 'Open with default program' export function isSafeFileExtension(extension: string): boolean { if (__WIN32__) { return RestrictedFileExtensions.indexOf(extension.toLowerCase()) === -1 } return true }
Use Recycle Bin name only on Windows
Use Recycle Bin name only on Windows On Linux Mint I see "Recycle Bin" on the dialog box when it should be "Trash." This PR changes the label such that "Recycle Bin" only appears on Windows and "Trash" appears for everything else.
TypeScript
mit
desktop/desktop,artivilla/desktop,shiftkey/desktop,j-f1/forked-desktop,shiftkey/desktop,shiftkey/desktop,say25/desktop,j-f1/forked-desktop,artivilla/desktop,say25/desktop,desktop/desktop,desktop/desktop,artivilla/desktop,artivilla/desktop,say25/desktop,j-f1/forked-desktop,j-f1/forked-desktop,desktop/desktop,say25/desktop,shiftkey/desktop
--- +++ @@ -13,7 +13,7 @@ ? 'Show in Explorer' : 'Show in your File Manager' -export const TrashNameLabel = __DARWIN__ ? 'Trash' : 'Recycle Bin' +export const TrashNameLabel = __WIN32__ ? 'Recycle Bin' : 'Trash' export const OpenWithDefaultProgramLabel = __DARWIN__ ? 'Open with Default Program'
1f60ab28c3f40d70e4a591deacff0c0773939f19
src/init.ts
src/init.ts
namespace webcrypto.liner { let _w: any = window; export const nativeCrypto: NativeCrypto = _w.crypto || _w.msCrypto; export const nativeSubtle = nativeCrypto.subtle || (nativeCrypto as any).webkitSubtle; }
namespace webcrypto.liner { let _w: any = window; export const nativeCrypto: NativeCrypto = _w.msCrypto || _w.crypto; export const nativeSubtle = nativeCrypto.subtle || (nativeCrypto as any).webkitSubtle; }
Fix error with native crypto for IE - elliptic.js creats it own crypto object. So we must check for msCrypto first
Fix error with native crypto for IE - elliptic.js creats it own crypto object. So we must check for msCrypto first
TypeScript
mit
PeculiarVentures/webcrypto-liner,PeculiarVentures/webcrypto-liner
--- +++ @@ -1,6 +1,6 @@ namespace webcrypto.liner { let _w: any = window; - export const nativeCrypto: NativeCrypto = _w.crypto || _w.msCrypto; + export const nativeCrypto: NativeCrypto = _w.msCrypto || _w.crypto; export const nativeSubtle = nativeCrypto.subtle || (nativeCrypto as any).webkitSubtle; }
48a8a172a842e325082d16640cac08b3bb17800d
src/test-utils.tsx
src/test-utils.tsx
import * as React from 'react'; import ApolloClient from 'apollo-client'; import { DefaultOptions } from 'apollo-client/ApolloClient'; import { InMemoryCache as Cache } from 'apollo-cache-inmemory'; import { ApolloProvider } from './index'; import { MockedResponse, MockLink } from './test-links'; import { ApolloCache } from 'apollo-cache'; export * from './test-links'; export interface MockedProviderProps<TSerializedCache = {}> { mocks?: ReadonlyArray<MockedResponse>; addTypename?: boolean; defaultOptions?: DefaultOptions; cache?: ApolloCache<TSerializedCache>; } export interface MockedProviderState { client: ApolloClient<any>; } export class MockedProvider extends React.Component<MockedProviderProps, MockedProviderState> { public static defaultProps: MockedProviderProps = { addTypename: true, }; constructor(props: MockedProviderProps) { super(props); const { mocks, addTypename, defaultOptions, cache } = this.props; const client = new ApolloClient({ cache: cache || new Cache({ addTypename }), defaultOptions, link: new MockLink(mocks || [], addTypename), }); this.state = { client }; } public render() { return <ApolloProvider client={this.state.client}>{this.props.children}</ApolloProvider>; } public componentWillUnmount() { // Since this.state.client was created in the constructor, it's this // MockedProvider's responsibility to terminate it. this.state.client.stop(); } }
import * as React from 'react'; import ApolloClient from 'apollo-client'; import { DefaultOptions } from 'apollo-client'; import { InMemoryCache as Cache } from 'apollo-cache-inmemory'; import { ApolloProvider } from './index'; import { MockedResponse, MockLink } from './test-links'; import { ApolloCache } from 'apollo-cache'; export * from './test-links'; export interface MockedProviderProps<TSerializedCache = {}> { mocks?: ReadonlyArray<MockedResponse>; addTypename?: boolean; defaultOptions?: DefaultOptions; cache?: ApolloCache<TSerializedCache>; } export interface MockedProviderState { client: ApolloClient<any>; } export class MockedProvider extends React.Component<MockedProviderProps, MockedProviderState> { public static defaultProps: MockedProviderProps = { addTypename: true, }; constructor(props: MockedProviderProps) { super(props); const { mocks, addTypename, defaultOptions, cache } = this.props; const client = new ApolloClient({ cache: cache || new Cache({ addTypename }), defaultOptions, link: new MockLink(mocks || [], addTypename), }); this.state = { client }; } public render() { return <ApolloProvider client={this.state.client}>{this.props.children}</ApolloProvider>; } public componentWillUnmount() { // Since this.state.client was created in the constructor, it's this // MockedProvider's responsibility to terminate it. this.state.client.stop(); } }
Remove nested Apollo Client `DefaultOptions` import
Remove nested Apollo Client `DefaultOptions` import
TypeScript
mit
apollographql/react-apollo,apollostack/react-apollo,apollostack/react-apollo,apollographql/react-apollo
--- +++ @@ -1,6 +1,6 @@ import * as React from 'react'; import ApolloClient from 'apollo-client'; -import { DefaultOptions } from 'apollo-client/ApolloClient'; +import { DefaultOptions } from 'apollo-client'; import { InMemoryCache as Cache } from 'apollo-cache-inmemory'; import { ApolloProvider } from './index';
278eb5b3a10fc9234ed084ca5bb73323693d7dee
src/controllers/EventActionsImpl.ts
src/controllers/EventActionsImpl.ts
import { EventActions } from './EventActions' import { Event, User, Permission } from '../models' import { rejectIfNull } from './util' import * as mongodb from '../mongodb/Event' export class EventActionsImpl implements EventActions { getEvents(auth: User): Promise<Event[]> { if (auth) { // All fields return mongodb.Event.find().exec() } else { // Public event return mongodb.Event.find({}, { 'id': true, 'companyName': true, 'publicDescription': true, 'date': true, 'pictures': true, }).exec() } } createEvent(auth: User, companyName: string, fields: Partial<Event>): Promise<Event> { if (!auth.permissions.includes(Permission.Events)) return Promise.reject('Insufficient permissions') const event = new mongodb.Event({ companyName, ...fields, }) return event.save() } updateEvent(auth: User, id: string, fields: Partial<Event>): Promise<Event> { if (!auth.permissions.includes(Permission.Events)) return Promise.reject('Insufficient permissions') return mongodb.Event.findOneAndUpdate( { _id: id }, { ...fields }, { new: true } ).then(rejectIfNull('No event exists for given id')) } removeEvent(id: string): Promise<boolean> { return mongodb.Event.findOneAndRemove({ _id: id }) .then(event => { return (event != undefined) }) } }
import { EventActions } from './EventActions' import { Event, User, Permission } from '../models' import { rejectIfNull } from './util' import * as mongodb from '../mongodb/Event' export class EventActionsImpl implements EventActions { getEvents(auth: User): Promise<Event[]> { if (auth) { // All fields return mongodb.Event.find().exec() } else { // Public event return mongodb.Event.find({}, { 'id': true, 'companyName': true, 'publicDescription': true, 'date': true, 'pictures': true, 'published': true, }).exec() } } createEvent(auth: User, companyName: string, fields: Partial<Event>): Promise<Event> { if (!auth.permissions.includes(Permission.Events)) return Promise.reject('Insufficient permissions') const event = new mongodb.Event({ companyName, ...fields, }) return event.save() } updateEvent(auth: User, id: string, fields: Partial<Event>): Promise<Event> { if (!auth.permissions.includes(Permission.Events)) return Promise.reject('Insufficient permissions') return mongodb.Event.findOneAndUpdate( { _id: id }, { ...fields }, { new: true } ).then(rejectIfNull('No event exists for given id')) } removeEvent(id: string): Promise<boolean> { return mongodb.Event.findOneAndRemove({ _id: id }) .then(event => { return (event != undefined) }) } }
Make 'published' a public field on events
HOTFIX: Make 'published' a public field on events
TypeScript
mit
studieresan/overlord,studieresan/overlord,studieresan/overlord,studieresan/overlord,studieresan/overlord
--- +++ @@ -17,6 +17,7 @@ 'publicDescription': true, 'date': true, 'pictures': true, + 'published': true, }).exec() } }
684044487767ccc0d18c78de34e56afa89983b17
src/renderer/pages/BrowserPage/newTabItems.ts
src/renderer/pages/BrowserPage/newTabItems.ts
import urls from "common/constants/urls"; export const newTabPrimaryItems = [ { label: ["sidebar.explore"], icon: "earth", url: "itch://featured", }, { label: ["sidebar.library"], icon: "heart-filled", url: "itch://library", }, { label: ["sidebar.collections"], icon: "video_collection", url: "itch://collections", }, { label: ["sidebar.dashboard"], icon: "archive", url: "itch://dashboard", }, ]; export const newTabSecondaryItems = [ { label: ["new_tab.twitter"], icon: "twitter", url: "https://twitter.com/search?q=itch.io&src=typd", }, { label: ["new_tab.random"], icon: "shuffle", url: urls.itchio + "/randomizer", }, { label: ["new_tab.on_sale"], icon: "shopping_cart", url: urls.itchio + "/games/on-sale", }, { label: ["new_tab.top_sellers"], icon: "star", url: urls.itchio + "/games/top-sellers", }, { label: ["new_tab.devlogs"], icon: "fire", url: urls.itchio + "/featured-games-feed?filter=devlogs", }, ];
import urls from "common/constants/urls"; export const newTabPrimaryItems = [ { label: ["sidebar.explore"], icon: "earth", url: "itch://featured", }, { label: ["sidebar.library"], icon: "heart-filled", url: "itch://library", }, { label: ["sidebar.collections"], icon: "video_collection", url: "itch://collections", }, { label: ["sidebar.dashboard"], icon: "archive", url: "itch://dashboard", }, ]; export const newTabSecondaryItems = [ { label: ["new_tab.twitter"], icon: "twitter", url: "https://twitter.com/search?q=itch.io&src=typd", }, { label: ["new_tab.random"], icon: "shuffle", url: urls.itchio + "/randomizer", }, { label: ["new_tab.on_sale"], icon: "shopping_cart", url: urls.itchio + "/games/on-sale", }, { label: ["new_tab.top_sellers"], icon: "star", url: urls.itchio + "/games/top-sellers", }, { label: ["new_tab.devlogs"], icon: "fire", url: urls.itchio + "/devlogs", }, ];
Make devlogs button open new devlogs page
Make devlogs button open new devlogs page
TypeScript
mit
itchio/itch,itchio/itchio-app,leafo/itchio-app,itchio/itch,itchio/itchio-app,leafo/itchio-app,leafo/itchio-app,itchio/itch,itchio/itch,itchio/itchio-app,itchio/itch,itchio/itch
--- +++ @@ -47,6 +47,6 @@ { label: ["new_tab.devlogs"], icon: "fire", - url: urls.itchio + "/featured-games-feed?filter=devlogs", + url: urls.itchio + "/devlogs", }, ];
f0c51a8d5f1fd95c4936bf41bfd6366da608e44b
src/app/map/suitability-map-panel/suitability-map-panel.component.spec.ts
src/app/map/suitability-map-panel/suitability-map-panel.component.spec.ts
/* tslint:disable:no-unused-variable */ /*! * Suitability Map Panel Component Test * * Copyright(c) Exequiel Ceasar Navarrete <esnavarrete1@up.edu.ph> * Licensed under MIT */ import { Renderer } from '@angular/core'; import { TestBed, async, inject } from '@angular/core/testing'; import { Router } from '@angular/router'; import { provideStore } from '@ngrx/store'; import { LeafletMapService } from '../../leaflet'; import { SuitabilityMapService } from '../suitability-map.service'; import { MapLayersReducer, SuitabilityLevelsReducer } from '../../store'; import { MockRouter } from '../../mocks/router'; import { SuitabilityMapPanelComponent } from './suitability-map-panel.component'; describe('Component: SuitabilityMapPanel', () => { let mockRouter: MockRouter; beforeEach(() => { mockRouter = new MockRouter(); TestBed.configureTestingModule({ providers: [ Renderer, LeafletMapService, SuitabilityMapService, SuitabilityMapPanelComponent, { provide: Router, useValue: mockRouter }, provideStore({ mapLayers: MapLayersReducer, suitabilityLevels: SuitabilityLevelsReducer }) ] }); }); it('should create an instance', inject([SuitabilityMapPanelComponent], (component: SuitabilityMapPanelComponent) => { expect(component).toBeTruthy(); })); });
/* tslint:disable:no-unused-variable */ /*! * Suitability Map Panel Component Test * * Copyright(c) Exequiel Ceasar Navarrete <esnavarrete1@up.edu.ph> * Licensed under MIT */ import { Renderer } from '@angular/core'; import { TestBed, async, inject } from '@angular/core/testing'; import { Router } from '@angular/router'; import { provideStore } from '@ngrx/store'; import { LeafletMapService } from '../../leaflet'; import { SuitabilityMapService } from '../suitability-map.service'; import { MapLayersReducer, SuitabilityLevelsReducer } from '../../store'; import { MockRouter } from '../../mocks/router'; import { MockSuitabilityMapService } from '../../mocks/map'; import { SuitabilityMapPanelComponent } from './suitability-map-panel.component'; describe('Component: SuitabilityMapPanel', () => { let mockRouter: MockRouter; beforeEach(() => { mockRouter = new MockRouter(); TestBed.configureTestingModule({ providers: [ Renderer, LeafletMapService, SuitabilityMapPanelComponent, { provide: SuitabilityMapService, useClass: MockSuitabilityMapService } { provide: Router, useValue: mockRouter }, provideStore({ mapLayers: MapLayersReducer, suitabilityLevels: SuitabilityLevelsReducer }) ] }); }); it('should create an instance', inject([SuitabilityMapPanelComponent], (component: SuitabilityMapPanelComponent) => { expect(component).toBeTruthy(); })); });
Fix broken test due to direct provision of the actual service rather than a test double
Fix broken test due to direct provision of the actual service rather than a test double
TypeScript
mit
ecsnavarretemit/sarai-ng2,ecsnavarretemit/sarai-interactive-maps,ecsnavarretemit/sarai-ng2,ecsnavarretemit/sarai-interactive-maps,ecsnavarretemit/sarai-ng2,ecsnavarretemit/sarai-interactive-maps
--- +++ @@ -15,6 +15,7 @@ import { SuitabilityMapService } from '../suitability-map.service'; import { MapLayersReducer, SuitabilityLevelsReducer } from '../../store'; import { MockRouter } from '../../mocks/router'; +import { MockSuitabilityMapService } from '../../mocks/map'; import { SuitabilityMapPanelComponent } from './suitability-map-panel.component'; describe('Component: SuitabilityMapPanel', () => { @@ -27,9 +28,9 @@ providers: [ Renderer, LeafletMapService, - SuitabilityMapService, SuitabilityMapPanelComponent, + { provide: SuitabilityMapService, useClass: MockSuitabilityMapService } { provide: Router, useValue: mockRouter }, provideStore({
77e98396bc486119fa5b57aae1f5ed525ba9de6a
src/app/gallery/gallery-format.pipe.spec.ts
src/app/gallery/gallery-format.pipe.spec.ts
import { GalleryFormatPipe } from './gallery-format.pipe'; describe('GalleryFormatPipe', () => { it('create an instance', () => { const pipe = new GalleryFormatPipe(); expect(pipe).toBeTruthy(); }); });
import { GalleryFormatPipe } from './gallery-format.pipe'; describe('GalleryFormatPipe', () => { it('create an instance', () => { const pipe = new GalleryFormatPipe(); expect(pipe).toBeTruthy(); }); it('should concatenate album titles', () => { const albumInfo = [ { title: 'one', name: '' }, { title: 'two', name: '' }, { title: 'three', name: '' } ]; const pipe = new GalleryFormatPipe(); const actualOutput = pipe.transform(albumInfo); expect(actualOutput).toBe('one, two, three'); }); it('should return ‘None’ if the information array is empty', () => { const pipe = new GalleryFormatPipe(); const actualOutput = pipe.transform([]); expect(actualOutput).toBe('None'); }); });
Add tests for gallery formatting pipe
Add tests for gallery formatting pipe
TypeScript
apache-2.0
jbrowneuk/jblog,jbrowneuk/jblog,jbrowneuk/jblog,jbrowneuk/jblog
--- +++ @@ -5,4 +5,24 @@ const pipe = new GalleryFormatPipe(); expect(pipe).toBeTruthy(); }); + + it('should concatenate album titles', () => { + const albumInfo = [ + { title: 'one', name: '' }, + { title: 'two', name: '' }, + { title: 'three', name: '' } + ]; + + const pipe = new GalleryFormatPipe(); + const actualOutput = pipe.transform(albumInfo); + + expect(actualOutput).toBe('one, two, three'); + }); + + it('should return ‘None’ if the information array is empty', () => { + const pipe = new GalleryFormatPipe(); + const actualOutput = pipe.transform([]); + + expect(actualOutput).toBe('None'); + }); });
9d6ca92f744491dc2d808cbd4e6f517c66b89f21
src/customer/list/SupportCustomerFilter.tsx
src/customer/list/SupportCustomerFilter.tsx
import { FunctionComponent } from 'react'; import { Row } from 'react-bootstrap'; import { reduxForm } from 'redux-form'; import { AccountingRunningField, getOptions as AccountingRunningFieldOptions, } from '@waldur/customer/list/AccountingRunningField'; import { SUPPORT_CUSTOMERS_FORM_ID } from '@waldur/customer/list/constants'; import { DivisionTypeFilter } from '@waldur/customer/list/DivisionTypeFilter'; import { SelectOrganizationDivisionField } from '@waldur/customer/list/SelectOrganizationDivisionField'; import { getOptions as ServiceProviderFilterOptions, ServiceProviderFilter, } from '@waldur/customer/list/ServiceProviderFilter'; import { translate } from '@waldur/i18n'; export const PureSupportCustomerFilter: FunctionComponent = () => ( <Row> <div className="form-group col-sm-3"> <label className="control-label">{translate('Accounting running')}</label> <AccountingRunningField /> </div> <ServiceProviderFilter /> <SelectOrganizationDivisionField isFilterForm={true} /> <DivisionTypeFilter /> </Row> ); export const SupportCustomerFilter = reduxForm<{}, any>({ form: SUPPORT_CUSTOMERS_FORM_ID, initialValues: { accounting_is_running: AccountingRunningFieldOptions()[0], is_service_provider: ServiceProviderFilterOptions()[0], }, })(PureSupportCustomerFilter);
import { FunctionComponent } from 'react'; import { Row } from 'react-bootstrap'; import { reduxForm } from 'redux-form'; import { AccountingRunningField, getOptions as AccountingRunningFieldOptions, } from '@waldur/customer/list/AccountingRunningField'; import { SUPPORT_CUSTOMERS_FORM_ID } from '@waldur/customer/list/constants'; import { DivisionTypeFilter } from '@waldur/customer/list/DivisionTypeFilter'; import { SelectOrganizationDivisionField } from '@waldur/customer/list/SelectOrganizationDivisionField'; import { ServiceProviderFilter } from '@waldur/customer/list/ServiceProviderFilter'; import { translate } from '@waldur/i18n'; export const PureSupportCustomerFilter: FunctionComponent = () => ( <Row> <div className="form-group col-sm-3"> <label className="control-label">{translate('Accounting running')}</label> <AccountingRunningField /> </div> <ServiceProviderFilter /> <SelectOrganizationDivisionField isFilterForm={true} /> <DivisionTypeFilter /> </Row> ); export const SupportCustomerFilter = reduxForm<{}, any>({ form: SUPPORT_CUSTOMERS_FORM_ID, initialValues: { accounting_is_running: AccountingRunningFieldOptions()[0], }, })(PureSupportCustomerFilter);
Drop 'Service provider' as a default filter in list of organizations
Drop 'Service provider' as a default filter in list of organizations
TypeScript
mit
opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport
--- +++ @@ -9,10 +9,7 @@ import { SUPPORT_CUSTOMERS_FORM_ID } from '@waldur/customer/list/constants'; import { DivisionTypeFilter } from '@waldur/customer/list/DivisionTypeFilter'; import { SelectOrganizationDivisionField } from '@waldur/customer/list/SelectOrganizationDivisionField'; -import { - getOptions as ServiceProviderFilterOptions, - ServiceProviderFilter, -} from '@waldur/customer/list/ServiceProviderFilter'; +import { ServiceProviderFilter } from '@waldur/customer/list/ServiceProviderFilter'; import { translate } from '@waldur/i18n'; export const PureSupportCustomerFilter: FunctionComponent = () => ( @@ -31,6 +28,5 @@ form: SUPPORT_CUSTOMERS_FORM_ID, initialValues: { accounting_is_running: AccountingRunningFieldOptions()[0], - is_service_provider: ServiceProviderFilterOptions()[0], }, })(PureSupportCustomerFilter);
b5a502290b8f1fb74c74ad32e6867184d054f0c6
packages/schematics/src/scam/index.ts
packages/schematics/src/scam/index.ts
import { chain, externalSchematic, Rule } from '@angular-devkit/schematics'; import { Schema as NgComponentOptions } from '@schematics/angular/component/schema'; export interface ScamOptions extends NgComponentOptions { separateModule: boolean; } export const _mergeModuleIntoComponentFile: Rule = (tree, context) => tree; export function scam(options: ScamOptions): Rule { let ruleList = [ externalSchematic('@schematics/angular', 'module', options), externalSchematic('@schematics/angular', 'component', { ...options, export: true, module: options.name }) ]; if (!options.separateModule) { ruleList = [ ...ruleList, _mergeModuleIntoComponentFile ]; } return chain(ruleList); }
import { chain, externalSchematic, Rule } from '@angular-devkit/schematics'; import { Schema as NgComponentOptions } from '@schematics/angular/component/schema'; export interface ScamOptions extends NgComponentOptions { separateModule: boolean; } export const _mergeModuleIntoComponentFile: Rule = (tree, context) => { return tree; }; export function scam(options: ScamOptions): Rule { let ruleList = [ externalSchematic('@schematics/angular', 'module', options), externalSchematic('@schematics/angular', 'component', { ...options, export: true, module: options.name }) ]; if (!options.separateModule) { ruleList = [ ...ruleList, _mergeModuleIntoComponentFile ]; } return chain(ruleList); }
Merge module and component as default behavior.
@wishtack/schematics:scam: Merge module and component as default behavior.
TypeScript
mit
wishtack/wishtack-steroids,wishtack/wishtack-steroids,wishtack/wishtack-steroids,wishtack/ng-steroids,wishtack/ng-steroids
--- +++ @@ -5,7 +5,9 @@ separateModule: boolean; } -export const _mergeModuleIntoComponentFile: Rule = (tree, context) => tree; +export const _mergeModuleIntoComponentFile: Rule = (tree, context) => { + return tree; +}; export function scam(options: ScamOptions): Rule {
0d400f0b20b6ec6e88c786061486aa3f9ab5c9b2
src/api/machine-container-api.ts
src/api/machine-container-api.ts
import * as request from 'superagent'; import { Response } from 'superagent'; import { Api, Options} from './api' class MachineContainerApi extends Api { list(machineName: string): Promise<Response> { return this._exec(request.get(`${this._buildPath(machineName)}`)); } protected _buildPath(machineName: string): string { return `${this.baseUrl}/machines/${machineName}/containers`; } } export default new MachineContainerApi();
import * as request from 'superagent'; import { Response } from 'superagent'; import { Api, Options} from './api' class MachineContainerApi extends Api { list(machineName: string, options: Options): Promise<Response> { return this._exec(request.get(`${this._buildPath(machineName)}`).query(options)); } protected _buildPath(machineName: string): string { return `${this.baseUrl}/machines/${machineName}/containers`; } } export default new MachineContainerApi();
Allow options in list containers
Allow options in list containers
TypeScript
apache-2.0
lawrence0819/neptune-front,lawrence0819/neptune-front
--- +++ @@ -4,8 +4,8 @@ class MachineContainerApi extends Api { - list(machineName: string): Promise<Response> { - return this._exec(request.get(`${this._buildPath(machineName)}`)); + list(machineName: string, options: Options): Promise<Response> { + return this._exec(request.get(`${this._buildPath(machineName)}`).query(options)); } protected _buildPath(machineName: string): string {
1b3ad4bcb375ba604d2f32279bb97b0723d32408
src/ts/production-ipc-emitter.ts
src/ts/production-ipc-emitter.ts
import { IpcEmitter } from "./ipc-emitter"; import { ipcMain } from "electron"; import { IpcChannels } from "./ipc-channels"; export class ProductionIpcEmitter implements IpcEmitter { public emitResetUserInput(): void { ipcMain.emit(IpcChannels.resetUserInput); } public emitHideWindow(): void { ipcMain.emit(IpcChannels.hideWindow); } }
import { IpcEmitter } from "./ipc-emitter"; import { ipcMain } from "electron"; import { IpcChannels } from "./ipc-channels"; export class ProductionIpcEmitter implements IpcEmitter { private windowHideDelayInMilliSeconds = 50; public emitResetUserInput(): void { ipcMain.emit(IpcChannels.resetUserInput); } public emitHideWindow(): void { setTimeout((): void => { ipcMain.emit(IpcChannels.hideWindow); }, this.windowHideDelayInMilliSeconds); // set delay when hiding main window so user input can be reset properly } }
Set delay when hiding window (again)
Set delay when hiding window (again)
TypeScript
mit
oliverschwendener/electronizr,oliverschwendener/electronizr
--- +++ @@ -3,11 +3,16 @@ import { IpcChannels } from "./ipc-channels"; export class ProductionIpcEmitter implements IpcEmitter { + private windowHideDelayInMilliSeconds = 50; + public emitResetUserInput(): void { ipcMain.emit(IpcChannels.resetUserInput); } public emitHideWindow(): void { - ipcMain.emit(IpcChannels.hideWindow); + + setTimeout((): void => { + ipcMain.emit(IpcChannels.hideWindow); + }, this.windowHideDelayInMilliSeconds); // set delay when hiding main window so user input can be reset properly } }