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 |
|---|---|---|---|---|---|---|---|---|---|---|
19afef35b34bc2bb86bc692242c0ae6c45bc6adc | types/gulp-jsonmin/gulp-jsonmin-tests.ts | types/gulp-jsonmin/gulp-jsonmin-tests.ts | import * as GulpJsonmin from 'gulp-jsonmin';
GulpJsonmin();
GulpJsonmin({});
GulpJsonmin({ verbose: true });
| import GulpJsonmin = require('gulp-jsonmin');
GulpJsonmin();
GulpJsonmin({ verbose: true });
| Fix how modules are imported | Fix how modules are imported
| TypeScript | mit | markogresak/DefinitelyTyped,magny/DefinitelyTyped,georgemarshall/DefinitelyTyped,AgentME/DefinitelyTyped,georgemarshall/DefinitelyTyped,borisyankov/DefinitelyTyped,AgentME/DefinitelyTyped,borisyankov/DefinitelyTyped,dsebastien/DefinitelyTyped,dsebastien/DefinitelyTyped,AgentME/DefinitelyTyped,georgemarshall/DefinitelyTyped,magny/DefinitelyTyped,AgentME/DefinitelyTyped,mcliment/DefinitelyTyped,georgemarshall/DefinitelyTyped | ---
+++
@@ -1,5 +1,4 @@
-import * as GulpJsonmin from 'gulp-jsonmin';
+import GulpJsonmin = require('gulp-jsonmin');
GulpJsonmin();
-GulpJsonmin({});
GulpJsonmin({ verbose: true }); |
f8aac97c3eb50f3b73a72c3568f4989cf17fec09 | ui/src/shared/document/document-utils.ts | ui/src/shared/document/document-utils.ts | import { ResultDocument } from '../../api/result';
import CONFIGURATION from '../../configuration.json';
const IMAGE_CATEGORIES = ['Image', 'Photo', 'Drawing'];
export const getDocumentLink = (doc: ResultDocument, project: string, currentBaseUrl?: string): string => {
const [baseUrl, path] = isImage(doc)
? ['', `/image/${project}/${doc.resource.id}`]
: isCategory(doc, 'Type') || isCategory(doc, 'TypeCatalog')
? [CONFIGURATION.shapesUrl, `/document/${doc.resource.id}`]
: [CONFIGURATION.fieldUrl, `/project/${project}/${doc.resource.id}`];
if (currentBaseUrl && baseUrl) {
return (currentBaseUrl === baseUrl) ? path : baseUrl + path;
} else {
return path;
}
};
export const getHierarchyLink = (doc: ResultDocument): string =>
`/project/${doc.project}?parent=${doc.resource.id}`;
export const isImage = (document: ResultDocument): boolean =>
IMAGE_CATEGORIES.includes(document.resource.category.name);
export const isCategory = (document: ResultDocument, category: string): boolean =>
document.resource.category.name === category;
| import { ResultDocument } from '../../api/result';
import CONFIGURATION from '../../configuration.json';
const IMAGE_CATEGORIES = ['Image', 'Photo', 'Drawing'];
export const getDocumentLink = (doc: ResultDocument, project: string, currentBaseUrl?: string): string => {
const [baseUrl, path] = isImage(doc)
? ['', `/image/${project}/${doc.resource.id}`]
: isCategory(doc, 'Type') || isCategory(doc, 'TypeCatalog')
? [CONFIGURATION.shapesUrl, `/document/${doc.resource.id}`]
: [CONFIGURATION.fieldUrl,
`/project/${project}/${ isCategory(doc, 'Project') ? doc.resource.identifier : doc.resource.id }`];
if (currentBaseUrl && baseUrl) {
return (currentBaseUrl === baseUrl) ? path : baseUrl + path;
} else {
return path;
}
};
export const getHierarchyLink = (doc: ResultDocument): string =>
`/project/${doc.project}?parent=${doc.resource.id}`;
export const isImage = (document: ResultDocument): boolean =>
IMAGE_CATEGORIES.includes(document.resource.category.name);
export const isCategory = (document: ResultDocument, category: string): boolean =>
document.resource.category.name === category;
| Fix links from images to project document | Fix links from images to project document
| TypeScript | apache-2.0 | dainst/idai-field-web,dainst/idai-field-web,dainst/idai-field-web | ---
+++
@@ -10,7 +10,8 @@
? ['', `/image/${project}/${doc.resource.id}`]
: isCategory(doc, 'Type') || isCategory(doc, 'TypeCatalog')
? [CONFIGURATION.shapesUrl, `/document/${doc.resource.id}`]
- : [CONFIGURATION.fieldUrl, `/project/${project}/${doc.resource.id}`];
+ : [CONFIGURATION.fieldUrl,
+ `/project/${project}/${ isCategory(doc, 'Project') ? doc.resource.identifier : doc.resource.id }`];
if (currentBaseUrl && baseUrl) {
return (currentBaseUrl === baseUrl) ? path : baseUrl + path; |
f5fab719873d95f33c8a1ab8543fb7e4c2e631d9 | src/openstack/openstack-backup/actions/EditAction.ts | src/openstack/openstack-backup/actions/EditAction.ts | import { translate } from '@waldur/i18n';
import {
createDefaultEditAction,
createLatinNameField,
validateState,
createDescriptionField
} from '@waldur/resource/actions/base';
import { ResourceAction } from '@waldur/resource/actions/types';
import { mergeActions } from '@waldur/resource/actions/utils';
export default function createAction(): ResourceAction {
return mergeActions(createDefaultEditAction(), {
successMessage: translate('Backup has been updated.'),
fields: [
createLatinNameField(),
createDescriptionField(),
{
name: 'kept_until',
help_text: translate('Guaranteed time of backup retention. If null - keep forever.'),
label: translate('Kept until'),
required: false,
type: 'datetime',
},
],
validators: [validateState('OK')],
});
}
| import { translate } from '@waldur/i18n';
import {
createDefaultEditAction,
createNameField,
validateState,
createDescriptionField
} from '@waldur/resource/actions/base';
import { ResourceAction } from '@waldur/resource/actions/types';
import { mergeActions } from '@waldur/resource/actions/utils';
export default function createAction(): ResourceAction {
return mergeActions(createDefaultEditAction(), {
successMessage: translate('Backup has been updated.'),
fields: [
createNameField(),
createDescriptionField(),
{
name: 'kept_until',
help_text: translate('Guaranteed time of backup retention. If null - keep forever.'),
label: translate('Kept until'),
required: false,
type: 'datetime',
},
],
validators: [validateState('OK')],
});
}
| Fix name validator for backup edit action | Fix name validator for backup edit action [WAL-2036]
| TypeScript | mit | opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport | ---
+++
@@ -1,7 +1,7 @@
import { translate } from '@waldur/i18n';
import {
createDefaultEditAction,
- createLatinNameField,
+ createNameField,
validateState,
createDescriptionField
} from '@waldur/resource/actions/base';
@@ -12,7 +12,7 @@
return mergeActions(createDefaultEditAction(), {
successMessage: translate('Backup has been updated.'),
fields: [
- createLatinNameField(),
+ createNameField(),
createDescriptionField(),
{
name: 'kept_until', |
270e9df7fa9fd24874bad3334a600035bdae8a84 | client/src/components/projects/projectActions.tsx | client/src/components/projects/projectActions.tsx | import * as React from 'react';
import { Dropdown, MenuItem } from 'react-bootstrap';
import '../actions.less';
export interface Props {
onDelete: () => any;
notebookActionCallback?: () => any;
tensorboardActionCallback?: () => any;
hasNotebook?: boolean;
hasTensorboard?: boolean;
pullRight: boolean;
}
function ProjectActions(props: Props) {
return (
<span className={props.pullRight ? 'actions pull-right' : 'actions'}>
<Dropdown
pullRight={true}
key={1}
id={`dropdown-actions-1`}
>
<Dropdown.Toggle
bsStyle="default"
bsSize="small"
noCaret={true}
>
<i className="fa fa-ellipsis-h icon" aria-hidden="true"/>
</Dropdown.Toggle>
<Dropdown.Menu>
{props.notebookActionCallback && props.hasTensorboard &&
<MenuItem eventKey="2" onClick={props.notebookActionCallback}>
<i
className="fa fa-stop icon"
aria-hidden="true"
/> 'Stop Notebook'
</MenuItem>
}
{props.tensorboardActionCallback && props.hasTensorboard &&
<MenuItem eventKey="2" onClick={props.tensorboardActionCallback}>
<i
className="fa fa-stop icon"
aria-hidden="true"
/> Stop Tensorboard
</MenuItem>
}
<MenuItem eventKey="2" onClick={props.onDelete}>
<i className="fa fa-trash icon" aria-hidden="true"/> Delete
</MenuItem>
</Dropdown.Menu>
</Dropdown>
</span>
);
}
export default ProjectActions;
| import * as React from 'react';
import { Dropdown, MenuItem } from 'react-bootstrap';
import '../actions.less';
export interface Props {
onDelete: () => any;
notebookActionCallback?: () => any;
tensorboardActionCallback?: () => any;
hasNotebook?: boolean;
hasTensorboard?: boolean;
pullRight: boolean;
}
function ProjectActions(props: Props) {
return (
<span className={props.pullRight ? 'actions pull-right' : 'actions'}>
<Dropdown
pullRight={true}
key={1}
id={`dropdown-actions-1`}
>
<Dropdown.Toggle
bsStyle="default"
bsSize="small"
noCaret={true}
>
<i className="fa fa-ellipsis-h icon" aria-hidden="true"/>
</Dropdown.Toggle>
<Dropdown.Menu>
{props.notebookActionCallback && props.hasNotebook &&
<MenuItem eventKey="2" onClick={props.notebookActionCallback}>
<i
className="fa fa-stop icon"
aria-hidden="true"
/> 'Stop Notebook'
</MenuItem>
}
{props.tensorboardActionCallback && props.hasTensorboard &&
<MenuItem eventKey="2" onClick={props.tensorboardActionCallback}>
<i
className="fa fa-stop icon"
aria-hidden="true"
/> Stop Tensorboard
</MenuItem>
}
<MenuItem eventKey="2" onClick={props.onDelete}>
<i className="fa fa-trash icon" aria-hidden="true"/> Delete
</MenuItem>
</Dropdown.Menu>
</Dropdown>
</span>
);
}
export default ProjectActions;
| Fix notebook stop action in the dropdown | Fix notebook stop action in the dropdown
| TypeScript | apache-2.0 | polyaxon/polyaxon,polyaxon/polyaxon,polyaxon/polyaxon | ---
+++
@@ -28,7 +28,7 @@
<i className="fa fa-ellipsis-h icon" aria-hidden="true"/>
</Dropdown.Toggle>
<Dropdown.Menu>
- {props.notebookActionCallback && props.hasTensorboard &&
+ {props.notebookActionCallback && props.hasNotebook &&
<MenuItem eventKey="2" onClick={props.notebookActionCallback}>
<i
className="fa fa-stop icon" |
913fe06e4864302e1d7c3acbfeace85027e122a6 | src/dashboard-refactor/colors.tsx | src/dashboard-refactor/colors.tsx | const colors = {
white: '#FFF',
onHover: '#BABABA',
onSelect: '#B6B6B6', // used for sidebar list item in selected state
midGrey: '#C4C4C4', // used for Sidebar Toggle hovered/selected state
lightGrey: '#E1E1E1', // used for Search Bar
lighterGrey: '#CCC', // used for divider on white background
iconDefault: '#3A2F45',
fonts: {
primary: '#000',
secondary: '#535353',
},
}
export default colors
| const colors = {
white: '#FFF',
onHover: '#BABABA',
onSelect: '#B6B6B6', // used for sidebar list item in selected state
midGrey: '#C4C4C4', // used for Sidebar Toggle hovered/selected state and new items count background
lightMidGrey: '#DDD',
lightGrey: '#E1E1E1', // used for Header Search Bar background
lighterGrey: '#CCC', // used for divider on white background
iconDefault: '#3A2F45',
fonts: {
primary: '#000',
secondary: '#535353',
},
}
export default colors
| Add different background color for searchbar on peek | Add different background color for searchbar on peek
| TypeScript | mit | WorldBrain/WebMemex,WorldBrain/WebMemex | ---
+++
@@ -2,8 +2,9 @@
white: '#FFF',
onHover: '#BABABA',
onSelect: '#B6B6B6', // used for sidebar list item in selected state
- midGrey: '#C4C4C4', // used for Sidebar Toggle hovered/selected state
- lightGrey: '#E1E1E1', // used for Search Bar
+ midGrey: '#C4C4C4', // used for Sidebar Toggle hovered/selected state and new items count background
+ lightMidGrey: '#DDD',
+ lightGrey: '#E1E1E1', // used for Header Search Bar background
lighterGrey: '#CCC', // used for divider on white background
iconDefault: '#3A2F45',
fonts: { |
47b729cbc2c329072a3ef33091ad8ed455f50626 | app/renderer/js/utils/translation-util.ts | app/renderer/js/utils/translation-util.ts | 'use strict';
import path = require('path');
import electron = require('electron');
import i18n = require('i18n');
let instance: TranslationUtil = null;
let app: Electron.App = null;
/* To make the util runnable in both main and renderer process */
if (process.type === 'renderer') {
app = electron.remote.app;
} else {
app = electron.app;
}
class TranslationUtil {
constructor() {
if (instance) {
return this;
}
instance = this;
i18n.configure({
directory: path.join(__dirname, '../../../translations/'),
register: this
});
}
__(phrase: string): string {
return i18n.__({ phrase, locale: app.getLocale() });
}
}
export = new TranslationUtil();
| 'use strict';
import path = require('path');
import electron = require('electron');
import i18n = require('i18n');
let instance: TranslationUtil = null;
let app: Electron.App = null;
/* To make the util runnable in both main and renderer process */
if (process.type === 'renderer') {
app = electron.remote.app;
} else {
app = electron.app;
}
class TranslationUtil {
constructor() {
if (instance) {
return this;
}
instance = this;
i18n.configure({
directory: path.join(__dirname, '../../../translations/'),
register: this
});
}
__(phrase: string): string {
return i18n.__({ phrase, locale: app.getLocale() ? app.getLocale() : 'en' });
}
}
export = new TranslationUtil();
| Use English as fallback language. | i18n: Use English as fallback language.
In case app.getLocale() returns a falsey value, English is used as the
app language.
| TypeScript | apache-2.0 | zulip/zulip-desktop,zulip/zulip-desktop,zulip/zulip-desktop,zulip/zulip-desktop | ---
+++
@@ -28,7 +28,7 @@
}
__(phrase: string): string {
- return i18n.__({ phrase, locale: app.getLocale() });
+ return i18n.__({ phrase, locale: app.getLocale() ? app.getLocale() : 'en' });
}
}
|
6d61344eed54d3a729e53b39e2b32d2ac355cf62 | e2e/app.e2e-spec.ts | e2e/app.e2e-spec.ts | import { PortfolioOptimizerPage } from './app.po';
describe('portfolio-optimizer App', function() {
let page: PortfolioOptimizerPage;
beforeEach(() => {
page = new PortfolioOptimizerPage();
});
it('should display message saying app works', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('app works!');
});
});
| import { PortfolioOptimizerPage } from './app.po';
describe('The portfolio optimizer app', function() {
let page: PortfolioOptimizerPage;
beforeEach(() => {
page = new PortfolioOptimizerPage();
});
it('should have the correct title.', () => {
page.navigateTo();
expect(page.getTitle()).toEqual('Coshx Finance Tools');
});
it('should have three panels with correct titles.', () => {
page.navigateTo();
expect(page.getPanelTitles()).toEqual(['Add Stocks', 'Optimal Allocations Chart', 'Results Table']);
});
it('should have a default allocations chart.', () => {
page.navigateTo();
expect(page.getAllocationsChart()).toBeTruthy();
// TODO: Add more verification if possible
});
it('should have a default results table.', () => {
page.navigateTo();
expect(page.getResultsTableHeader()).toEqual(['Stock', 'Starting Value', 'Ending Value', 'Sharpe Ratio']);
// TODO: Verify correct values: {"FB":0.4510450475179859,"AAPL":0,"GOOG":0.5489549524820141}
});
/*
it('should have the correct default form text', () => {
page.navigateTo();
expect(page.getTickerSymbols()).toEqual('AAPL, GOOG, FB');
expect(page.getStartDate()).toEqual('01/01/2012');
expect(page.getEndDate()).toEqual('03/20/2016');
expect(page.getInitialInvestment()).toEqual('1000');
});
*/
});
| Revert bad changes to e2e tests from upgrade. | Revert bad changes to e2e tests from upgrade.
| TypeScript | mit | coshx/portfolio_optimizer,coshx/portfolio_optimizer,coshx/portfolio_optimizer,coshx/portfolio_optimizer | ---
+++
@@ -1,14 +1,41 @@
import { PortfolioOptimizerPage } from './app.po';
-describe('portfolio-optimizer App', function() {
+describe('The portfolio optimizer app', function() {
let page: PortfolioOptimizerPage;
beforeEach(() => {
page = new PortfolioOptimizerPage();
});
- it('should display message saying app works', () => {
+ it('should have the correct title.', () => {
page.navigateTo();
- expect(page.getParagraphText()).toEqual('app works!');
+ expect(page.getTitle()).toEqual('Coshx Finance Tools');
});
+
+ it('should have three panels with correct titles.', () => {
+ page.navigateTo();
+ expect(page.getPanelTitles()).toEqual(['Add Stocks', 'Optimal Allocations Chart', 'Results Table']);
+ });
+
+ it('should have a default allocations chart.', () => {
+ page.navigateTo();
+ expect(page.getAllocationsChart()).toBeTruthy();
+ // TODO: Add more verification if possible
+ });
+
+ it('should have a default results table.', () => {
+ page.navigateTo();
+ expect(page.getResultsTableHeader()).toEqual(['Stock', 'Starting Value', 'Ending Value', 'Sharpe Ratio']);
+ // TODO: Verify correct values: {"FB":0.4510450475179859,"AAPL":0,"GOOG":0.5489549524820141}
+ });
+
+ /*
+ it('should have the correct default form text', () => {
+ page.navigateTo();
+ expect(page.getTickerSymbols()).toEqual('AAPL, GOOG, FB');
+ expect(page.getStartDate()).toEqual('01/01/2012');
+ expect(page.getEndDate()).toEqual('03/20/2016');
+ expect(page.getInitialInvestment()).toEqual('1000');
+ });
+*/
}); |
48a66b03c267e70e5eef170942fcb3c9390bc72d | client/src/app/models/project.model.ts | client/src/app/models/project.model.ts | import { ProjectWizardData } from './project-wizard-data.model';
export class Project {
public projectName: string;
public freelancer: string;
public client: string;
public startDate: number;
public endDate: number;
public budget: number;
public paymentType: string;
public paymentTrigger: string;
public description: string;
public deliverables: string;
public jobRequirements: string[];
public location: string;
public hoursPerWeek: number;
public creatorID?: string;
public status?: string;
public lastUpdated?: number;
public static convert(wizardData: ProjectWizardData): Project {
return {
projectName: wizardData.project.projectName,
freelancer: wizardData.freelancer.kvkNumber,
client: wizardData.client.kvkNumber,
startDate: +Date.UTC(wizardData.project.startYear, +wizardData.project.startMonth - 1, wizardData.project.startDay),
endDate: +Date.UTC(wizardData.project.endYear, +wizardData.project.endMonth - 1, wizardData.project.endDay),
budget: +wizardData.project.budget,
paymentType: wizardData.project.paymentMethod,
paymentTrigger: wizardData.project.paymentTrigger,
description: wizardData.project.projectDescription,
deliverables: '',
jobRequirements: [],
location: '',
hoursPerWeek: 0
};
}
}
| import { ProjectWizardData } from './project-wizard-data.model';
export class Project {
public projectName: string;
public freelancer: string;
public client: string;
public startDate: number;
public endDate: number;
public budget: number;
public billingMethod: string;
public paymentType: string;
public paymentTrigger: string;
public paymentComments: string;
public description: string;
public deliverables: string;
public jobRequirements: string[];
public location: string;
public hoursPerWeek: number;
public creatorID?: string;
public status?: string;
public lastUpdated?: number;
public static convert(wizardData: ProjectWizardData): Project {
return {
projectName: wizardData.project.projectName,
freelancer: wizardData.freelancer.kvkNumber,
client: wizardData.client.kvkNumber,
startDate: +Date.UTC(wizardData.project.startYear, +wizardData.project.startMonth - 1, wizardData.project.startDay),
endDate: +Date.UTC(wizardData.project.endYear, +wizardData.project.endMonth - 1, wizardData.project.endDay),
budget: +wizardData.project.budget,
billingMethod: wizardData.project.paymentMethod,
paymentType: wizardData.project.budgetType,
paymentTrigger: wizardData.project.paymentTrigger,
paymentComments: wizardData.project.paymentInfo,
description: wizardData.project.projectDescription,
deliverables: '',
jobRequirements: [],
location: '',
hoursPerWeek: 0
};
}
}
| Add support for new blockchain fields. | Add support for new blockchain fields.
| TypeScript | apache-2.0 | IBMZissou/dbh17-zissou,IBMZissou/dbh17-zissou,IBMZissou/dbh17-zissou,IBMZissou/dbh17-zissou,IBMZissou/dbh17-zissou | ---
+++
@@ -7,8 +7,10 @@
public startDate: number;
public endDate: number;
public budget: number;
+ public billingMethod: string;
public paymentType: string;
public paymentTrigger: string;
+ public paymentComments: string;
public description: string;
public deliverables: string;
public jobRequirements: string[];
@@ -26,8 +28,10 @@
startDate: +Date.UTC(wizardData.project.startYear, +wizardData.project.startMonth - 1, wizardData.project.startDay),
endDate: +Date.UTC(wizardData.project.endYear, +wizardData.project.endMonth - 1, wizardData.project.endDay),
budget: +wizardData.project.budget,
- paymentType: wizardData.project.paymentMethod,
+ billingMethod: wizardData.project.paymentMethod,
+ paymentType: wizardData.project.budgetType,
paymentTrigger: wizardData.project.paymentTrigger,
+ paymentComments: wizardData.project.paymentInfo,
description: wizardData.project.projectDescription,
deliverables: '',
jobRequirements: [], |
21bba51d4176aa4188c503a78bba36005b52633f | packages/react-form-with-constraints/src/index.ts | packages/react-form-with-constraints/src/index.ts | export * from './FormWithConstraints';
export * from './FieldFeedbacks';
export * from './FieldFeedback';
export * from './FieldFeedbackWhenValid';
export * from './Async';
import Field from './Field';
export { Field };
export * from './FieldsStore';
export * from './EventEmitter';
export * from './withValidateFieldEventEmitter';
export * from './withFieldWillValidateEventEmitter';
export * from './withFieldDidValidateEventEmitter';
export * from './withResetEventEmitter';
import FieldFeedbackValidation from './FieldFeedbackValidation';
export { FieldFeedbackValidation };
export * from './InputElement';
import Constructor from './Constructor';
export { Constructor };
export * from './Input';
import deepForEach from './deepForEach';
export { deepForEach };
| export * from './FormWithConstraints';
export * from './FieldFeedbacks';
export * from './FieldFeedback';
export * from './FieldFeedbackWhenValid';
export * from './Async';
export { default as Field } from './Field';
export * from './FieldsStore';
export * from './EventEmitter';
export * from './withValidateFieldEventEmitter';
export * from './withFieldWillValidateEventEmitter';
export * from './withFieldDidValidateEventEmitter';
export * from './withResetEventEmitter';
export { default as FieldFeedbackValidation } from './FieldFeedbackValidation';
export * from './InputElement';
export { default as Constructor } from './Constructor';
export * from './Input';
export { default as deepForEach } from './deepForEach';
| Use export { default as ... } syntax | Use export { default as ... } syntax
| TypeScript | mit | tkrotoff/react-form-with-constraints,tkrotoff/react-form-with-constraints,tkrotoff/react-form-with-constraints | ---
+++
@@ -3,19 +3,15 @@
export * from './FieldFeedback';
export * from './FieldFeedbackWhenValid';
export * from './Async';
-import Field from './Field';
-export { Field };
+export { default as Field } from './Field';
export * from './FieldsStore';
export * from './EventEmitter';
export * from './withValidateFieldEventEmitter';
export * from './withFieldWillValidateEventEmitter';
export * from './withFieldDidValidateEventEmitter';
export * from './withResetEventEmitter';
-import FieldFeedbackValidation from './FieldFeedbackValidation';
-export { FieldFeedbackValidation };
+export { default as FieldFeedbackValidation } from './FieldFeedbackValidation';
export * from './InputElement';
-import Constructor from './Constructor';
-export { Constructor };
+export { default as Constructor } from './Constructor';
export * from './Input';
-import deepForEach from './deepForEach';
-export { deepForEach };
+export { default as deepForEach } from './deepForEach'; |
3b8ef37392fd28e76af3f50ff7a1645678eb3606 | assets/components/tsx/Footer.tsx | assets/components/tsx/Footer.tsx | import h, { FunctionComponent } from '../../../lib/tsx/TsxParser';
import { Link } from './Link';
interface FooterProps {
firstName: string;
lastName: string;
gitRevision: string;
githubLink: string;
}
export const Footer: FunctionComponent<FooterProps> = (props: FooterProps) => {
const { firstName, lastName, gitRevision, githubLink } = props;
return (
<footer>
<p>
© {firstName} {lastName}
</p>
<p>
This site is Open Source. Current revision {gitRevision}.
<Link href={githubLink} title="GitHub" content="Code available on GitHub." />
</p>
</footer>
);
};
| import h, { FunctionComponent } from '../../../lib/tsx/TsxParser';
import { Link } from './Link';
interface FooterProps {
firstName: string;
lastName: string;
gitRevision: string;
githubLink: string;
}
export const Footer: FunctionComponent<FooterProps> = (props: FooterProps) => {
const { firstName, lastName, gitRevision, githubLink } = props;
return (
<footer>
<p>
© {firstName} {lastName}
</p>
<p>
This site is Open Source. Current revision {gitRevision}.
<Link href={githubLink} title="GitHub" content="Code available on GitHub." />
</p>
</footer>
);
};
| Fix missing space before Github link. | Fix missing space before Github link.
| TypeScript | mit | birkett/a-birkett.co.uk | ---
+++
@@ -17,7 +17,7 @@
© {firstName} {lastName}
</p>
<p>
- This site is Open Source. Current revision {gitRevision}.
+ This site is Open Source. Current revision {gitRevision}.
<Link href={githubLink} title="GitHub" content="Code available on GitHub." />
</p>
</footer> |
1667eef999fe213320bc60467f01d941824cf914 | src/features/CodeActions.ts | src/features/CodeActions.ts | import vscode = require('vscode');
import { LanguageClient, RequestType, NotificationType } from 'vscode-languageclient';
import Window = vscode.window;
import { IFeature } from '../feature';
export class CodeActionsFeature implements IFeature {
private command: vscode.Disposable;
private languageClient: LanguageClient;
constructor() {
this.command = vscode.commands.registerCommand('PowerShell.ApplyCodeActionEdits', (edit: any) => {
var editor = Window.activeTextEditor;
var filePath = editor.document.fileName;
var workspaceEdit = new vscode.WorkspaceEdit();
workspaceEdit.set(
vscode.Uri.file(filePath),
[
new vscode.TextEdit(
new vscode.Range(
edit.StartLineNumber - 1,
edit.StartColumnNumber - 1,
edit.EndLineNumber - 1,
edit.EndColumnNumber - 1),
edit.Text)
]);
vscode.workspace.applyEdit(workspaceEdit);
});
}
public setLanguageClient(languageclient: LanguageClient) {
this.languageClient = languageclient;
}
public dispose() {
this.command.dispose();
}
} | import vscode = require('vscode');
import { LanguageClient, RequestType, NotificationType } from 'vscode-languageclient';
import Window = vscode.window;
import { IFeature } from '../feature';
export class CodeActionsFeature implements IFeature {
private command: vscode.Disposable;
private languageClient: LanguageClient;
constructor() {
this.command = vscode.commands.registerCommand('PowerShell.ApplyCodeActionEdits', (edit: any) => {
Window.activeTextEditor.edit((editBuilder) => {
editBuilder.replace(
new vscode.Range(
edit.StartLineNumber - 1,
edit.StartColumnNumber - 1,
edit.EndLineNumber - 1,
edit.EndColumnNumber - 1),
edit.Text);
});
});
}
public setLanguageClient(languageclient: LanguageClient) {
this.languageClient = languageclient;
}
public dispose() {
this.command.dispose();
}
} | Allow quick fix to work in untitled documents | Allow quick fix to work in untitled documents
In the previous iteration of this feature, the edits can be applied to files open in a workspace. This commit removes that restriction.
| TypeScript | mit | PowerShell/vscode-powershell | ---
+++
@@ -9,21 +9,15 @@
constructor() {
this.command = vscode.commands.registerCommand('PowerShell.ApplyCodeActionEdits', (edit: any) => {
- var editor = Window.activeTextEditor;
- var filePath = editor.document.fileName;
- var workspaceEdit = new vscode.WorkspaceEdit();
- workspaceEdit.set(
- vscode.Uri.file(filePath),
- [
- new vscode.TextEdit(
- new vscode.Range(
- edit.StartLineNumber - 1,
- edit.StartColumnNumber - 1,
- edit.EndLineNumber - 1,
- edit.EndColumnNumber - 1),
- edit.Text)
- ]);
- vscode.workspace.applyEdit(workspaceEdit);
+ Window.activeTextEditor.edit((editBuilder) => {
+ editBuilder.replace(
+ new vscode.Range(
+ edit.StartLineNumber - 1,
+ edit.StartColumnNumber - 1,
+ edit.EndLineNumber - 1,
+ edit.EndColumnNumber - 1),
+ edit.Text);
+ });
});
}
|
f5cce7bb3c5902940608c0b65c64f448aa0dd911 | lib/ui/src/components/sidebar/Heading.tsx | lib/ui/src/components/sidebar/Heading.tsx | import React, { FunctionComponent, ComponentProps } from 'react';
import { styled } from '@storybook/theming';
import { Brand } from './Brand';
import { SidebarMenu, MenuList } from './Menu';
export interface HeadingProps {
menuHighlighted?: boolean;
menu: MenuList;
}
const BrandArea = styled.div(({ theme }) => ({
fontSize: theme.typography.size.s2,
fontWeight: theme.typography.weight.bold,
color: theme.color.defaultText,
marginRight: 40,
display: 'flex',
width: '100%',
alignItems: 'center',
minHeight: 22,
'& > *': {
maxWidth: '100%',
height: 'auto',
display: 'block',
flex: '1 1 auto',
},
}));
const HeadingWrapper = styled.div({
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
position: 'relative',
});
export const Heading: FunctionComponent<HeadingProps & ComponentProps<typeof HeadingWrapper>> = ({
menuHighlighted = false,
menu,
...props
}) => {
return (
<HeadingWrapper {...props}>
<BrandArea>
<Brand />
</BrandArea>
<SidebarMenu menu={menu} isHighlighted={menuHighlighted} />
</HeadingWrapper>
);
};
| import React, { FunctionComponent, ComponentProps } from 'react';
import { styled } from '@storybook/theming';
import { Brand } from './Brand';
import { SidebarMenu, MenuList } from './Menu';
export interface HeadingProps {
menuHighlighted?: boolean;
menu: MenuList;
}
const BrandArea = styled.div(({ theme }) => ({
fontSize: theme.typography.size.s2,
fontWeight: theme.typography.weight.bold,
color: theme.color.defaultText,
marginRight: 20,
display: 'flex',
width: '100%',
alignItems: 'center',
minHeight: 22,
'& > *': {
maxWidth: '100%',
height: 'auto',
display: 'block',
flex: '1 1 auto',
},
}));
const HeadingWrapper = styled.div({
display: 'flex',
alignItems: 'center',
justifyContent: 'space-between',
position: 'relative',
});
export const Heading: FunctionComponent<HeadingProps & ComponentProps<typeof HeadingWrapper>> = ({
menuHighlighted = false,
menu,
...props
}) => {
return (
<HeadingWrapper {...props}>
<BrandArea>
<Brand />
</BrandArea>
<SidebarMenu menu={menu} isHighlighted={menuHighlighted} />
</HeadingWrapper>
);
};
| Reduce spacing to support a larger brandImage | Reduce spacing to support a larger brandImage | TypeScript | mit | storybooks/storybook,kadirahq/react-storybook,storybooks/storybook,storybooks/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/react-storybook,storybooks/storybook,storybooks/react-storybook,storybooks/storybook,kadirahq/react-storybook,storybooks/storybook,storybooks/react-storybook | ---
+++
@@ -13,7 +13,7 @@
fontSize: theme.typography.size.s2,
fontWeight: theme.typography.weight.bold,
color: theme.color.defaultText,
- marginRight: 40,
+ marginRight: 20,
display: 'flex',
width: '100%',
alignItems: 'center', |
fc1bb07c1e403d52b68170dff314526ed1c55862 | src/decorator/field.decorator.ts | src/decorator/field.decorator.ts | import { SchemaFactoryError, SchemaFactoryErrorType } from '../type-factory';
import { FieldOption } from '../metadata';
import { PaginationMiddleware } from '../middleware';
import { getMetadataArgsStorage } from '../metadata-builder';
/**
* GraphQL Schema field
* See [GraphQL Documentation - Field]{@link http://graphql.org/learn/queries/#fields}
*
* @param option Options for an Schema
*/
export function Field(option?: FieldOption) {
return function (target: any, propertyKey: any, methodDescriptor?: any) {
if (option && option.pagination && (!methodDescriptor || !methodDescriptor.value)) {
throw new SchemaFactoryError(`Field '${propertyKey}' can't have pagination enabled`,
SchemaFactoryErrorType.INPUT_FIELD_SHOULD_NOT_BE_PAGINATED);
}
getMetadataArgsStorage().fields.push({
target: target,
name: option.name || propertyKey,
description: option ? option.description : null,
property: propertyKey,
type: option ? option.type : null,
nonNull: option ? option.nonNull : null,
isList: option ? option.isList : null,
pagination: option ? option.pagination : null,
});
if (option && option.pagination) {
return PaginationMiddleware(target, propertyKey, methodDescriptor);
}
} as Function;
}
| import { SchemaFactoryError, SchemaFactoryErrorType } from '../type-factory';
import { FieldOption } from '../metadata';
import { PaginationMiddleware } from '../middleware';
import { getMetadataArgsStorage } from '../metadata-builder';
/**
* GraphQL Schema field
* See [GraphQL Documentation - Field]{@link http://graphql.org/learn/queries/#fields}
*
* @param option Options for an Schema
*/
export function Field(option?: FieldOption) {
return function (target: any, propertyKey: any, methodDescriptor?: any) {
if (option && option.pagination && (!methodDescriptor || !methodDescriptor.value)) {
throw new SchemaFactoryError(`Field '${propertyKey}' can't have pagination enabled`,
SchemaFactoryErrorType.INPUT_FIELD_SHOULD_NOT_BE_PAGINATED);
}
getMetadataArgsStorage().fields.push({
target: target,
name: (option && option.name) ? option.name : propertyKey,
description: option ? option.description : null,
property: propertyKey,
type: option ? option.type : null,
nonNull: option ? option.nonNull : null,
isList: option ? option.isList : null,
pagination: option ? option.pagination : null,
});
if (option && option.pagination) {
return PaginationMiddleware(target, propertyKey, methodDescriptor);
}
} as Function;
}
| Fix test for undefined option | Fix test for undefined option
| TypeScript | mit | indigotech/graphql-schema-decorator,indigotech/graphql-schema-decorator | ---
+++
@@ -18,7 +18,7 @@
}
getMetadataArgsStorage().fields.push({
target: target,
- name: option.name || propertyKey,
+ name: (option && option.name) ? option.name : propertyKey,
description: option ? option.description : null,
property: propertyKey,
type: option ? option.type : null, |
b36e8a60bd21cb7637ee2e9b50d9497db324c1c4 | components/BlogPostPreview.tsx | components/BlogPostPreview.tsx | import Link from "next/link"
import { FunctionComponent } from "react"
import TagsList from "./TagsList"
import BlogPostPreview from "../models/BlogPostPreview"
import FormattedDate from "./FormattedDate"
import HorizontalRule from "./HorizontalRule"
interface Props {
post: BlogPostPreview
}
const BlogPostPreviewComponent: FunctionComponent<Props> = ({
post,
}: Props) => {
return (
<article key={post.slug}>
<header>
<Link href="/posts/[slug]" as={`/posts/${post.slug}`}>
<a>
<h1>{post.title}</h1>
</a>
</Link>
<FormattedDate date={post.date} prefix="Published" />
{post.tags.length > 0 && <TagsList tags={post.tags} />}
</header>
<HorizontalRule />
<div>
<div dangerouslySetInnerHTML={{ __html: post.contentHTML }} />
<Link href="/posts/[slug]" as={`/posts/${post.slug}`}>
<a>Read More</a>
</Link>
</div>
</article>
)
}
export default BlogPostPreviewComponent
| import Link from "next/link"
import { FunctionComponent } from "react"
import TagsList from "./TagsList"
import BlogPostPreview from "../models/BlogPostPreview"
import FormattedDate from "./FormattedDate"
import HorizontalRule from "./HorizontalRule"
interface Props {
post: BlogPostPreview
}
const BlogPostPreviewComponent: FunctionComponent<Props> = ({
post,
}: Props) => {
return (
<article key={post.slug}>
<header>
<Link href="/posts/[slug]" as={`/posts/${post.slug}`}>
<a>
<h1>{post.title}</h1>
</a>
</Link>
<FormattedDate date={post.date} prefix="Published" />
{post.tags.length > 0 && <TagsList tags={post.tags} />}
</header>
<HorizontalRule />
<div>
<div dangerouslySetInnerHTML={{ __html: post.contentHTML }} />
<Link href="/posts/[slug]" as={`/posts/${post.slug}`}>
<a title={`Keep reading ${post.title}`}>Keep Reading</a>
</Link>
</div>
</article>
)
}
export default BlogPostPreviewComponent
| Add missing title to anhcors | Add missing title to anhcors
| TypeScript | mit | JosephDuffy/josephduffy.co.uk,JosephDuffy/josephduffy.co.uk,JosephDuffy/josephduffy.co.uk | ---
+++
@@ -27,7 +27,7 @@
<div>
<div dangerouslySetInnerHTML={{ __html: post.contentHTML }} />
<Link href="/posts/[slug]" as={`/posts/${post.slug}`}>
- <a>Read More</a>
+ <a title={`Keep reading ${post.title}`}>Keep Reading</a>
</Link>
</div>
</article> |
814340df89bf38a43d2cdf131f1e2fd33a96fa26 | examples/typescript/06_core/hello-world/src/app.ts | examples/typescript/06_core/hello-world/src/app.ts | import { FileDb } from 'jovo-db-filedb';
import { App } from 'jovo-framework';
import { CorePlatform } from 'jovo-platform-core';
import { JovoDebugger } from 'jovo-plugin-debugger';
import { AmazonCredentials, LexSlu } from 'jovo-slu-lex';
const app = new App();
const corePlatform = new CorePlatform();
const credentials: AmazonCredentials = {
accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
secretAccessKey: process.env.AWS_SECRET_KEY!,
region: process.env.AWS_REGION!
};
corePlatform.use(
new LexSlu({
credentials,
botAlias: 'WebTest',
botName: 'WebAssistantTest'
})
);
app.use(corePlatform, new JovoDebugger(), new FileDb());
app.setHandler({
LAUNCH() {
return this.toIntent('HelloWorldIntent');
},
HelloWorldIntent() {
this.$corePlatformApp?.$actions.addQuickReplies(['John', 'Jack', 'Joe']);
this.ask("Hello World! What's your name?", 'Please tell me your name.');
},
MyNameIsIntent() {
this.tell('Hey ' + this.$inputs.name.value + ', nice to meet you!');
},
DefaultFallbackIntent() {
this.tell('Good Bye!');
}
});
export { app };
| import { FileDb } from 'jovo-db-filedb';
import { App } from 'jovo-framework';
import { CorePlatform } from 'jovo-platform-core';
import { JovoDebugger } from 'jovo-plugin-debugger';
import { AmazonCredentials, LexSlu } from 'jovo-slu-lex';
const app = new App();
const corePlatform = new CorePlatform();
const credentials: AmazonCredentials = {
accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
secretAccessKey: process.env.AWS_SECRET_KEY!,
region: process.env.AWS_REGION!
};
corePlatform.use(
new LexSlu({
credentials,
botAlias: 'WebTest',
botName: 'WebAssistantTest'
})
);
app.use(corePlatform, new JovoDebugger(), new FileDb());
app.setHandler({
LAUNCH() {
return this.toIntent('HelloWorldIntent');
},
HelloWorldIntent() {
this.$corePlatformApp?.$actions.addQuickReplies(['John', 'Jack', 'Max']);
this.ask("Hello World! What's your name?", 'Please tell me your name.');
},
MyNameIsIntent() {
this.tell('Hey ' + this.$inputs.name.value + ', nice to meet you!');
},
DefaultFallbackIntent() {
this.tell('Good Bye!');
}
});
export { app };
| Fix QuickReply value in example | :bug: Fix QuickReply value in example
| TypeScript | apache-2.0 | jovotech/jovo-framework-nodejs,jovotech/jovo-framework-nodejs | ---
+++
@@ -30,7 +30,7 @@
},
HelloWorldIntent() {
- this.$corePlatformApp?.$actions.addQuickReplies(['John', 'Jack', 'Joe']);
+ this.$corePlatformApp?.$actions.addQuickReplies(['John', 'Jack', 'Max']);
this.ask("Hello World! What's your name?", 'Please tell me your name.');
},
|
3b482424e3d2de58ac2dd266e9dc182be4cdedab | src/dashboard-refactor/header/sync-status-menu/util.ts | src/dashboard-refactor/header/sync-status-menu/util.ts | import moment from 'moment'
import type { RootState } from './types'
export const deriveStatusIconColor = ({
syncState,
backupState,
lastSuccessfulSyncDate,
}: RootState): 'green' | 'red' | 'yellow' => {
const daysSinceLastSync = moment().diff(
moment(lastSuccessfulSyncDate),
'days',
)
if (
syncState === 'error' ||
daysSinceLastSync > 7 ||
backupState === 'error'
) {
return 'red'
}
if (
(syncState === 'disabled' || daysSinceLastSync > 3) &&
backupState === 'disabled'
) {
return 'yellow'
}
return 'green'
}
| import moment from 'moment'
import type { RootState } from './types'
const getDaysSinceDate = (date: Date | null): number =>
date == null ? 0 : moment().diff(moment(date), 'days')
export const deriveStatusIconColor = ({
syncState,
backupState,
lastSuccessfulSyncDate,
lastSuccessfulBackupDate,
}: RootState): 'green' | 'red' | 'yellow' => {
const daysSinceLastSync = getDaysSinceDate(lastSuccessfulSyncDate)
const daysSinceLastBackup = getDaysSinceDate(lastSuccessfulBackupDate)
if (
syncState === 'error' ||
backupState === 'error' ||
daysSinceLastSync > 7 ||
daysSinceLastBackup > 7
) {
return 'red'
}
if (
(syncState === 'disabled' && backupState === 'disabled') ||
daysSinceLastBackup > 3 ||
daysSinceLastSync > 3
) {
return 'yellow'
}
return 'green'
}
| Add missing conditions for sync/backup dashboard status | Add missing conditions for sync/backup dashboard status
| TypeScript | mit | WorldBrain/WebMemex,WorldBrain/WebMemex | ---
+++
@@ -1,28 +1,32 @@
import moment from 'moment'
import type { RootState } from './types'
+
+const getDaysSinceDate = (date: Date | null): number =>
+ date == null ? 0 : moment().diff(moment(date), 'days')
export const deriveStatusIconColor = ({
syncState,
backupState,
lastSuccessfulSyncDate,
+ lastSuccessfulBackupDate,
}: RootState): 'green' | 'red' | 'yellow' => {
- const daysSinceLastSync = moment().diff(
- moment(lastSuccessfulSyncDate),
- 'days',
- )
+ const daysSinceLastSync = getDaysSinceDate(lastSuccessfulSyncDate)
+ const daysSinceLastBackup = getDaysSinceDate(lastSuccessfulBackupDate)
if (
syncState === 'error' ||
+ backupState === 'error' ||
daysSinceLastSync > 7 ||
- backupState === 'error'
+ daysSinceLastBackup > 7
) {
return 'red'
}
if (
- (syncState === 'disabled' || daysSinceLastSync > 3) &&
- backupState === 'disabled'
+ (syncState === 'disabled' && backupState === 'disabled') ||
+ daysSinceLastBackup > 3 ||
+ daysSinceLastSync > 3
) {
return 'yellow'
} |
dd91ea55ee1ab4c0b90e5d64ebd9c19b9bd1fbea | src/components/SearchCard/ExternalPlainButtons.tsx | src/components/SearchCard/ExternalPlainButtons.tsx | import * as React from 'react';
import { ButtonGroup, Button } from '@shopify/polaris';
import { SearchResult } from '../../types';
import TOpticonButton from './TOpticonButton';
import { generateAcceptUrl, generatePreviewUrl } from '../../utils/urls';
export interface Props {
readonly hit: SearchResult;
}
class MiscActionsPopOver extends React.PureComponent<Props, never> {
public render() {
const { hit: { groupId, requester } } = this.props;
return (
<ButtonGroup>
<Button plain external url={generateAcceptUrl(groupId)}>
Accept
</Button>
<Button plain external url={generatePreviewUrl(groupId)}>
Preview
</Button>
<TOpticonButton
requesterId={requester.id}
turkopticon={requester.turkopticon}
/>
</ButtonGroup>
);
}
}
export default MiscActionsPopOver;
| import * as React from 'react';
import { ButtonGroup, Button } from '@shopify/polaris';
import { SearchResult } from '../../types';
import TOpticonButton from './TOpticonButton';
import { generateAcceptUrl, generatePreviewUrl } from '../../utils/urls';
export interface Props {
readonly hit: SearchResult;
}
class MiscActionsPopOver extends React.PureComponent<Props, never> {
public render() {
const { hit: { groupId, requester, qualified, canPreview } } = this.props;
return (
<ButtonGroup>
<Button
plain
external
url={generateAcceptUrl(groupId)}
disabled={!qualified}
>
Accept
</Button>
<Button
plain
external
url={generatePreviewUrl(groupId)}
disabled={!canPreview}
>
Preview
</Button>
<TOpticonButton
requesterId={requester.id}
turkopticon={requester.turkopticon}
/>
</ButtonGroup>
);
}
}
export default MiscActionsPopOver;
| Disable accept and preview buttons according to user's qualifications. | Disable accept and preview buttons according to user's qualifications.
| TypeScript | mit | Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine | ---
+++
@@ -10,14 +10,24 @@
class MiscActionsPopOver extends React.PureComponent<Props, never> {
public render() {
- const { hit: { groupId, requester } } = this.props;
+ const { hit: { groupId, requester, qualified, canPreview } } = this.props;
return (
<ButtonGroup>
- <Button plain external url={generateAcceptUrl(groupId)}>
+ <Button
+ plain
+ external
+ url={generateAcceptUrl(groupId)}
+ disabled={!qualified}
+ >
Accept
</Button>
- <Button plain external url={generatePreviewUrl(groupId)}>
+ <Button
+ plain
+ external
+ url={generatePreviewUrl(groupId)}
+ disabled={!canPreview}
+ >
Preview
</Button>
<TOpticonButton |
1993daa08d4d836869ee9eff10020d49d547c533 | src/app/core/local-storage/local-storage.service.ts | src/app/core/local-storage/local-storage.service.ts | import { Injectable } from '@angular/core'
declare const jIO: any
declare const RSVP: any
@Injectable()
export class LocalStorageService {
private instance: any
constructor() {
this.instance = jIO.createJIO({
type: 'query',
sub_storage: {
type: 'uuid',
sub_storage: {
type: 'indexeddb',
database: 'mute'
}
}
})
}
get (name: string): Promise<any> {
return this.instance.get(name)
}
put (name: string, object: any): Promise<string> {
return this.instance.put(name, object)
}
}
| import { Injectable } from '@angular/core'
import { AbstractStorageService } from '../AbstractStorageService'
declare const jIO: any
@Injectable()
export class LocalStorageService extends AbstractStorageService {
private instance: any
readonly name: string = 'Local Storage'
constructor() {
super()
this.instance = jIO.createJIO({
type: 'query',
sub_storage: {
type: 'uuid',
sub_storage: {
type: 'indexeddb',
database: 'mute'
}
}
})
}
get (name: string): Promise<any> {
return this.instance.get(name)
}
put (name: string, object: any): Promise<string> {
return this.instance.put(name, object)
}
isReachable (): Promise<boolean> {
return Promise.resolve(true)
}
getDocuments (): Promise<any[]> {
const docs = [
{
id: 'id1',
title: 'title1'
},
{
id: 'id2',
title: 'title2'
},
{
id: 'id3',
title: 'title3'
},
]
return Promise.resolve(docs)
}
}
| Edit LocalStorageService to extend AbstractStorageService | feat(localStorage): Edit LocalStorageService to extend AbstractStorageService
| TypeScript | agpl-3.0 | coast-team/mute,coast-team/mute,oster/mute,oster/mute,coast-team/mute,oster/mute,coast-team/mute | ---
+++
@@ -1,14 +1,17 @@
import { Injectable } from '@angular/core'
+import { AbstractStorageService } from '../AbstractStorageService'
+
declare const jIO: any
-declare const RSVP: any
@Injectable()
-export class LocalStorageService {
+export class LocalStorageService extends AbstractStorageService {
private instance: any
+ readonly name: string = 'Local Storage'
constructor() {
+ super()
this.instance = jIO.createJIO({
type: 'query',
sub_storage: {
@@ -29,4 +32,26 @@
return this.instance.put(name, object)
}
+ isReachable (): Promise<boolean> {
+ return Promise.resolve(true)
+ }
+
+ getDocuments (): Promise<any[]> {
+ const docs = [
+ {
+ id: 'id1',
+ title: 'title1'
+ },
+ {
+ id: 'id2',
+ title: 'title2'
+ },
+ {
+ id: 'id3',
+ title: 'title3'
+ },
+ ]
+ return Promise.resolve(docs)
+ }
+
} |
82c58871829f210c1711845b388c5653a5af28ad | addons/docs/src/frameworks/html/config.tsx | addons/docs/src/frameworks/html/config.tsx | import React from 'react';
import { StoryFn } from '@storybook/addons';
export const parameters = {
docs: {
inlineStories: true,
prepareForInline: (storyFn: StoryFn<string>) => (
// eslint-disable-next-line react/no-danger
<div dangerouslySetInnerHTML={{ __html: storyFn() }} />
),
},
};
| import React from 'react';
import { StoryFn } from '@storybook/addons';
export const parameters = {
docs: {
inlineStories: true,
prepareForInline: (storyFn: StoryFn<string>) => {
const html = storyFn();
if (typeof html === 'string') {
// eslint-disable-next-line react/no-danger
return <div dangerouslySetInnerHTML={{ __html: html }} />;
}
return <div ref={(node) => (node ? node.appendChild(html) : null)} />;
},
},
};
| Fix inline rendering for DOM nodes in HTML | Addon-docs: Fix inline rendering for DOM nodes in HTML
| TypeScript | mit | storybooks/storybook,storybooks/react-storybook,storybooks/storybook,storybooks/react-storybook,storybooks/storybook,storybooks/storybook,kadirahq/react-storybook,kadirahq/react-storybook,storybooks/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/react-storybook | ---
+++
@@ -4,9 +4,13 @@
export const parameters = {
docs: {
inlineStories: true,
- prepareForInline: (storyFn: StoryFn<string>) => (
- // eslint-disable-next-line react/no-danger
- <div dangerouslySetInnerHTML={{ __html: storyFn() }} />
- ),
+ prepareForInline: (storyFn: StoryFn<string>) => {
+ const html = storyFn();
+ if (typeof html === 'string') {
+ // eslint-disable-next-line react/no-danger
+ return <div dangerouslySetInnerHTML={{ __html: html }} />;
+ }
+ return <div ref={(node) => (node ? node.appendChild(html) : null)} />;
+ },
},
}; |
29ae6523e8dec1d181c0f7667ff7ea37bc1aeb89 | client/LauncherViewModel.ts | client/LauncherViewModel.ts | import { env } from "./Environment";
import { Metrics } from "./Utility/Metrics";
export class LauncherViewModel {
constructor() {
Metrics.TrackEvent('LandingPage');
}
GeneratedEncounterId = env.EncounterId;
JoinEncounterInput = ko.observable<string>('');
StartEncounter = () => {
var encounterId = this.JoinEncounterInput().split('/').pop();
window.location.href = `e/${encounterId || this.GeneratedEncounterId}`;
}
JoinEncounter = () => {
var encounterId = this.JoinEncounterInput().split('/').pop();
if (encounterId) {
window.location.href = `p/${encounterId}`;
}
}
JoinEncounterButtonClass = () => {
var encounterId = this.JoinEncounterInput().split('/').pop();
return encounterId ? 'enabled' : 'disabled';
}
}
| import { env } from "./Environment";
import { Metrics } from "./Utility/Metrics";
export class LauncherViewModel {
constructor() {
Metrics.TrackEvent('LandingPageLoad');
}
GeneratedEncounterId = env.EncounterId;
JoinEncounterInput = ko.observable<string>('');
StartEncounter = () => {
var encounterId = this.JoinEncounterInput().split('/').pop();
window.location.href = `e/${encounterId || this.GeneratedEncounterId}`;
}
JoinEncounter = () => {
var encounterId = this.JoinEncounterInput().split('/').pop();
if (encounterId) {
window.location.href = `p/${encounterId}`;
}
}
JoinEncounterButtonClass = () => {
var encounterId = this.JoinEncounterInput().split('/').pop();
return encounterId ? 'enabled' : 'disabled';
}
}
| Rename Metrics event LandingPage -> LandingPageLoad | Rename Metrics event LandingPage -> LandingPageLoad
| TypeScript | mit | cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative | ---
+++
@@ -3,7 +3,7 @@
export class LauncherViewModel {
constructor() {
- Metrics.TrackEvent('LandingPage');
+ Metrics.TrackEvent('LandingPageLoad');
}
GeneratedEncounterId = env.EncounterId; |
755f12312bc87bcc11d46842e953da2347cc0b27 | src/app/modal/modal.component.ts | src/app/modal/modal.component.ts | import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-modal',
templateUrl: './modal.component.html',
styleUrls: ['./modal.component.css']
})
export class ModalComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
| import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-modal',
templateUrl: './modal.component.html',
styleUrls: ['./modal.component.css']
})
export class ModalComponent implements OnInit {
private show: boolean = true;
constructor() { }
ngOnInit() {
}
}
| Add show boolean that wll control display 👁 | Add show boolean that wll control display 👁
| TypeScript | mit | filoxo/an-angular-modal,filoxo/an-angular-modal,filoxo/an-angular-modal | ---
+++
@@ -7,6 +7,7 @@
})
export class ModalComponent implements OnInit {
+ private show: boolean = true;
constructor() { }
ngOnInit() { |
0c507747c89bd01d183b8d82c55fefa1fcbda104 | tests/cases/fourslash/renameStingLiterals.ts | tests/cases/fourslash/renameStingLiterals.ts | /// <reference path='fourslash.ts' />
////var x = "/*1*/string";
////function f(a = "/*2*/initial value") { }
goTo.marker("1");
verify.renameInfoFailed();
goTo.marker("2");
verify.renameInfoFailed();
| /// <reference path='fourslash.ts' />
////var y: "string" = "string;
////var x = "/*1*/string";
////function f(a = "/*2*/initial value") { }
goTo.marker("1");
verify.renameInfoFailed();
goTo.marker("2");
verify.renameInfoFailed();
| Add a contextual type in test case | Add a contextual type in test case
| TypeScript | apache-2.0 | mihailik/TypeScript,RyanCavanaugh/TypeScript,thr0w/Thr0wScript,erikmcc/TypeScript,kitsonk/TypeScript,DLehenbauer/TypeScript,erikmcc/TypeScript,donaldpipowitch/TypeScript,jwbay/TypeScript,nojvek/TypeScript,SaschaNaz/TypeScript,Microsoft/TypeScript,thr0w/Thr0wScript,Eyas/TypeScript,ziacik/TypeScript,chuckjaz/TypeScript,weswigham/TypeScript,erikmcc/TypeScript,nojvek/TypeScript,ziacik/TypeScript,donaldpipowitch/TypeScript,SaschaNaz/TypeScript,basarat/TypeScript,jwbay/TypeScript,kpreisser/TypeScript,jeremyepling/TypeScript,vilic/TypeScript,donaldpipowitch/TypeScript,vilic/TypeScript,DLehenbauer/TypeScript,nojvek/TypeScript,mihailik/TypeScript,minestarks/TypeScript,plantain-00/TypeScript,kpreisser/TypeScript,Eyas/TypeScript,Eyas/TypeScript,SaschaNaz/TypeScript,microsoft/TypeScript,mihailik/TypeScript,Eyas/TypeScript,weswigham/TypeScript,TukekeSoft/TypeScript,kitsonk/TypeScript,synaptek/TypeScript,minestarks/TypeScript,DLehenbauer/TypeScript,plantain-00/TypeScript,vilic/TypeScript,ziacik/TypeScript,thr0w/Thr0wScript,synaptek/TypeScript,basarat/TypeScript,alexeagle/TypeScript,chuckjaz/TypeScript,weswigham/TypeScript,TukekeSoft/TypeScript,plantain-00/TypeScript,nojvek/TypeScript,chuckjaz/TypeScript,alexeagle/TypeScript,Microsoft/TypeScript,SaschaNaz/TypeScript,RyanCavanaugh/TypeScript,synaptek/TypeScript,TukekeSoft/TypeScript,mihailik/TypeScript,chuckjaz/TypeScript,plantain-00/TypeScript,DLehenbauer/TypeScript,kpreisser/TypeScript,kitsonk/TypeScript,ziacik/TypeScript,basarat/TypeScript,basarat/TypeScript,vilic/TypeScript,synaptek/TypeScript,jwbay/TypeScript,thr0w/Thr0wScript,donaldpipowitch/TypeScript,microsoft/TypeScript,Microsoft/TypeScript,minestarks/TypeScript,jwbay/TypeScript,alexeagle/TypeScript,RyanCavanaugh/TypeScript,jeremyepling/TypeScript,jeremyepling/TypeScript,erikmcc/TypeScript,microsoft/TypeScript | ---
+++
@@ -1,5 +1,6 @@
/// <reference path='fourslash.ts' />
+////var y: "string" = "string;
////var x = "/*1*/string";
////function f(a = "/*2*/initial value") { }
|
0b2792142c024e1a32075ab4cab0ad08e02eaa16 | client/Commands/Prompts/components/ApplyDamagePrompt.tsx | client/Commands/Prompts/components/ApplyDamagePrompt.tsx | import { Field } from "formik";
import React = require("react");
import { probablyUniqueString } from "../../../../common/Toolbox";
import { CombatantViewModel } from "../../../Combatant/CombatantViewModel";
import { SubmitButton } from "../../../Components/Button";
import { PromptProps } from "./PendingPrompts";
interface ApplyDamageModel {
damageAmount: string;
}
export const ApplyDamagePrompt = (
combatantViewModels: CombatantViewModel[],
suggestedDamage: string,
logHpChange: (damage: number, combatantNames: string) => void
): PromptProps<ApplyDamageModel> => {
const fieldLabelId = probablyUniqueString();
return {
onSubmit: (model: ApplyDamageModel) => {
const damageAmount = parseInt(model.damageAmount);
if (isNaN(damageAmount)) {
return false;
}
const combatantNames = combatantViewModels.map(c => c.Name());
logHpChange(damageAmount, combatantNames.join(", "));
combatantViewModels.forEach(c => c.ApplyDamage(model.damageAmount));
return true;
},
initialValues: { damageAmount: suggestedDamage },
autoFocusSelector: ".autofocus",
children: (
<div className="p-apply-damage">
<label htmlFor={fieldLabelId}>
{"Apply damage or healing to "}
{combatantViewModels.map(c => c.Name()).join(", ")}:
</label>
<Field id={fieldLabelId} className="autofocus" name="damageAmount" />
<SubmitButton />
</div>
)
};
};
| import { Field } from "formik";
import React = require("react");
import { probablyUniqueString } from "../../../../common/Toolbox";
import { CombatantViewModel } from "../../../Combatant/CombatantViewModel";
import { SubmitButton } from "../../../Components/Button";
import { PromptProps } from "./PendingPrompts";
interface ApplyDamageModel {
damageAmount: string;
}
export const ApplyDamagePrompt = (
combatantViewModels: CombatantViewModel[],
suggestedDamage: string,
logHpChange: (damage: number, combatantNames: string) => void
): PromptProps<ApplyDamageModel> => {
const fieldLabelId = probablyUniqueString();
return {
onSubmit: (model: ApplyDamageModel) => {
const damageAmount = parseInt(model.damageAmount);
if (isNaN(damageAmount)) {
return false;
}
const combatantNames = combatantViewModels.map(c => c.Name());
logHpChange(damageAmount, combatantNames.join(", "));
combatantViewModels.forEach(c => c.ApplyDamage(model.damageAmount));
return true;
},
initialValues: { damageAmount: suggestedDamage },
autoFocusSelector: ".autofocus",
children: (
<div className="p-apply-damage">
<label htmlFor={fieldLabelId}>
{"Apply damage or healing to "}
{combatantViewModels.map(c => c.Name()).join(", ")}:
</label>
<Field
id={fieldLabelId}
type="number"
className="autofocus"
name="damageAmount"
/>
<SubmitButton />
</div>
)
};
};
| Add number type to damage input field | Add number type to damage input field
| TypeScript | mit | cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative | ---
+++
@@ -39,7 +39,12 @@
{"Apply damage or healing to "}
{combatantViewModels.map(c => c.Name()).join(", ")}:
</label>
- <Field id={fieldLabelId} className="autofocus" name="damageAmount" />
+ <Field
+ id={fieldLabelId}
+ type="number"
+ className="autofocus"
+ name="damageAmount"
+ />
<SubmitButton />
</div>
) |
ecefa222047f47a35beff5189c775f9fa567ee3c | src/utils/helpers/qrCodes.ts | src/utils/helpers/qrCodes.ts | export interface QrCodeCapabilities {
useSizeInPath: boolean;
svgIsSupported: boolean;
}
export type QrCodeFormat = 'svg' | 'png';
export const buildQrCodeUrl = (
shortUrl: string,
size: number,
format: QrCodeFormat,
{ useSizeInPath, svgIsSupported }: QrCodeCapabilities,
): string => {
const sizeFragment = useSizeInPath ? `/${size}` : `?size=${size}`;
const formatFragment = !svgIsSupported ? '' : `format=${format}`;
const joinSymbol = useSizeInPath && svgIsSupported ? '?' : !useSizeInPath && svgIsSupported ? '&' : '';
return `${shortUrl}/qr-code${sizeFragment}${joinSymbol}${formatFragment}`;
};
| import { always, cond } from 'ramda';
export interface QrCodeCapabilities {
useSizeInPath: boolean;
svgIsSupported: boolean;
}
export type QrCodeFormat = 'svg' | 'png';
export const buildQrCodeUrl = (
shortUrl: string,
size: number,
format: QrCodeFormat,
{ useSizeInPath, svgIsSupported }: QrCodeCapabilities,
): string => {
const sizeFragment = useSizeInPath ? `/${size}` : `?size=${size}`;
const formatFragment = !svgIsSupported ? '' : `format=${format}`;
const joinSymbolResolver = cond([
[ () => useSizeInPath && svgIsSupported, always('?') ],
[ () => !useSizeInPath && svgIsSupported, always('&') ],
]);
const joinSymbol = joinSymbolResolver() ?? '';
return `${shortUrl}/qr-code${sizeFragment}${joinSymbol}${formatFragment}`;
};
| Replace nested ternary conditions with ramda's cond | Replace nested ternary conditions with ramda's cond
| TypeScript | mit | shlinkio/shlink-web-client,shlinkio/shlink-web-client,shlinkio/shlink-web-client,shlinkio/shlink-web-client | ---
+++
@@ -1,3 +1,5 @@
+import { always, cond } from 'ramda';
+
export interface QrCodeCapabilities {
useSizeInPath: boolean;
svgIsSupported: boolean;
@@ -13,7 +15,11 @@
): string => {
const sizeFragment = useSizeInPath ? `/${size}` : `?size=${size}`;
const formatFragment = !svgIsSupported ? '' : `format=${format}`;
- const joinSymbol = useSizeInPath && svgIsSupported ? '?' : !useSizeInPath && svgIsSupported ? '&' : '';
+ const joinSymbolResolver = cond([
+ [ () => useSizeInPath && svgIsSupported, always('?') ],
+ [ () => !useSizeInPath && svgIsSupported, always('&') ],
+ ]);
+ const joinSymbol = joinSymbolResolver() ?? '';
return `${shortUrl}/qr-code${sizeFragment}${joinSymbol}${formatFragment}`;
}; |
ba8d6dc3fa19fa3a8733caf1c5a84d7c280fe251 | src/mol-canvas3d/passes/passes.ts | src/mol-canvas3d/passes/passes.ts | /**
* Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
import { DrawPass } from './draw';
import { PickPass } from './pick';
import { MultiSamplePass } from './multi-sample';
import { WebGLContext } from '../../mol-gl/webgl/context';
import { AssetManager } from '../../mol-util/assets';
export class Passes {
readonly draw: DrawPass;
readonly pick: PickPass;
readonly multiSample: MultiSamplePass;
constructor(private webgl: WebGLContext, assetManager: AssetManager, attribs: Partial<{ pickScale: number, enableWboit: boolean, enableDpoit: boolean }> = {}) {
const { gl } = webgl;
this.draw = new DrawPass(webgl, assetManager, gl.drawingBufferWidth, gl.drawingBufferHeight, attribs.enableWboit || false, attribs.enableDpoit || false);
this.pick = new PickPass(webgl, this.draw, attribs.pickScale || 0.25);
this.multiSample = new MultiSamplePass(webgl, this.draw);
}
updateSize() {
const { gl } = this.webgl;
this.draw.setSize(gl.drawingBufferWidth, gl.drawingBufferHeight);
this.pick.syncSize();
this.multiSample.syncSize();
}
} | /**
* Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
import { DrawPass } from './draw';
import { PickPass } from './pick';
import { MultiSamplePass } from './multi-sample';
import { WebGLContext } from '../../mol-gl/webgl/context';
import { AssetManager } from '../../mol-util/assets';
export class Passes {
readonly draw: DrawPass;
readonly pick: PickPass;
readonly multiSample: MultiSamplePass;
constructor(private webgl: WebGLContext, assetManager: AssetManager, attribs: Partial<{ pickScale: number, enableWboit: boolean, enableDpoit: boolean }> = {}) {
const { gl } = webgl;
this.draw = new DrawPass(webgl, assetManager, gl.drawingBufferWidth, gl.drawingBufferHeight, attribs.enableWboit || false, attribs.enableDpoit || false);
this.pick = new PickPass(webgl, this.draw, attribs.pickScale || 0.25);
this.multiSample = new MultiSamplePass(webgl, this.draw);
}
updateSize() {
const { gl } = this.webgl;
// Avoid setting dimensions to 0x0 because it causes "empty textures are not allowed" error.
const width = Math.max(gl.drawingBufferWidth, 2);
const height = Math.max(gl.drawingBufferHeight, 2);
this.draw.setSize(width, height);
this.pick.syncSize();
this.multiSample.syncSize();
}
} | Fix "empty textures" error on empty canvas | Fix "empty textures" error on empty canvas
| TypeScript | mit | molstar/molstar,molstar/molstar,molstar/molstar | ---
+++
@@ -24,7 +24,10 @@
updateSize() {
const { gl } = this.webgl;
- this.draw.setSize(gl.drawingBufferWidth, gl.drawingBufferHeight);
+ // Avoid setting dimensions to 0x0 because it causes "empty textures are not allowed" error.
+ const width = Math.max(gl.drawingBufferWidth, 2);
+ const height = Math.max(gl.drawingBufferHeight, 2);
+ this.draw.setSize(width, height);
this.pick.syncSize();
this.multiSample.syncSize();
} |
99df7eac6b8254d30af2b2b5cf63b6c057e5d0d9 | types/shell-quote/index.d.ts | types/shell-quote/index.d.ts | // Type definitions for shell-quote 1.6
// Project: https://github.com/substack/node-shell-quote
// Definitions by: Jason Cheatham <https://github.com/jason0x43>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export function quote(args: string[]): string;
export function parse(
cmd: string,
env?: { [key: string]: string } | ((key: string) => string | object),
opts?: { [key: string]: string }
): string[];
| // Type definitions for shell-quote 1.6
// Project: https://github.com/substack/node-shell-quote
// Definitions by: Jason Cheatham <https://github.com/jason0x43>
// Cameron Diver <https://github.com/CameronDiver>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export type ParseEntry =
| string
| { op: string }
| { op: 'glob'; pattern: string }
| { comment: string };
export function quote(args: string[]): string;
export function parse(
cmd: string,
env?: { [key: string]: string } | ((key: string) => string | object),
opts?: { [key: string]: string }
): ParseEntry[];
| Fix parse function return in shell-quote | Fix parse function return in shell-quote
Signed-off-by: Cameron Diver <1d572acbfa68c7c6e541c7b840d6b622e5c0dc91@balena.io>
| TypeScript | mit | georgemarshall/DefinitelyTyped,dsebastien/DefinitelyTyped,borisyankov/DefinitelyTyped,georgemarshall/DefinitelyTyped,dsebastien/DefinitelyTyped,mcliment/DefinitelyTyped,georgemarshall/DefinitelyTyped,markogresak/DefinitelyTyped,borisyankov/DefinitelyTyped,georgemarshall/DefinitelyTyped | ---
+++
@@ -1,12 +1,19 @@
// Type definitions for shell-quote 1.6
// Project: https://github.com/substack/node-shell-quote
// Definitions by: Jason Cheatham <https://github.com/jason0x43>
+// Cameron Diver <https://github.com/CameronDiver>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
+
+export type ParseEntry =
+ | string
+ | { op: string }
+ | { op: 'glob'; pattern: string }
+ | { comment: string };
export function quote(args: string[]): string;
export function parse(
cmd: string,
env?: { [key: string]: string } | ((key: string) => string | object),
opts?: { [key: string]: string }
-): string[];
+): ParseEntry[]; |
7d05b15e33f7075740819c1e7d0305e635acf465 | src/reducers/listFeatureFactory.ts | src/reducers/listFeatureFactory.ts | import {createAction} from "reducers/createAction";
import ActionTypes from "actions/actionTypes";
import assign from "utils/assign";
export class ListFeatureFactory {
private id: string;
private initialState: any;
constructor(public name: string) {
this.id = `ListFeatureFactory__${name}`;
}
public createReducer(initialState, options) {
const { id } = this;
options = assign(options, {
mapListToState: (list) => list,
mapStateToList: (state) => state,
compare: (item, action) => item !== action.item
});
const { mapListToState, mapStateToList, compare } = options;
return function reducer(state, action) {
if (!state) return initialState;
const { $id$: actionId } = action;
if (actionId !== id) return state;
return createAction(initialState, {
[ActionTypes.listControl.REMOVE_ITEM](state) {
return assign({}, state, mapListToState(mapStateToList(state).filter(item => compare(item, action))));
},
[ActionTypes.listControl.ADD_ITEM](state) {
return assign({}, state, mapListToState([...mapStateToList(state), action.item ]))
}
});
}
}
}
export default ListFeatureFactory; | import {createAction} from "reducers/createAction";
import ActionTypes from "actions/actionTypes";
import assign from "utils/assign";
export class ListFeatureFactory {
private id: string;
private initialState: any;
constructor(public name: string) {
this.id = `ListFeatureFactory__${name}`;
}
public createActions() {
return {
addItem: (item) => ({
$id$: this.id,
type: ActionTypes.listControl.ADD_ITEM,
item
}),
removeItem: (item) => ({
$id$: this.id,
type: ActionTypes.listControl.REMOVE_ITEM,
item
})
};
}
public createReducer(initialState, options) {
const { id } = this;
options = assign(options, {
mapListToState: (list) => list,
mapStateToList: (state) => state,
compare: (item, action) => item !== action.item
});
const { mapListToState, mapStateToList, compare } = options;
return function reducer(state, action) {
if (!state) return initialState;
const { $id$: actionId } = action;
if (actionId !== id) return state;
return createAction(initialState, {
[ActionTypes.listControl.REMOVE_ITEM](state) {
return assign({}, state, mapListToState(mapStateToList(state).filter(item => compare(item, action))));
},
[ActionTypes.listControl.ADD_ITEM](state) {
return assign({}, state, mapListToState([...mapStateToList(state), action.item ]))
}
});
}
}
}
export default ListFeatureFactory; | Add createActions function to class | Add createActions function to class
| TypeScript | mit | szabototo89/kitchen-timer,szabototo89/kitchen-timer,szabototo89/kitchen-timer | ---
+++
@@ -8,6 +8,22 @@
constructor(public name: string) {
this.id = `ListFeatureFactory__${name}`;
+ }
+
+ public createActions() {
+ return {
+ addItem: (item) => ({
+ $id$: this.id,
+ type: ActionTypes.listControl.ADD_ITEM,
+ item
+ }),
+
+ removeItem: (item) => ({
+ $id$: this.id,
+ type: ActionTypes.listControl.REMOVE_ITEM,
+ item
+ })
+ };
}
public createReducer(initialState, options) { |
b6a93b57c5cf9661fc5d32f6505d471a2b6b843e | app/src/app/app-routing.module.ts | app/src/app/app-routing.module.ts | import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { AuthGuard } from './auth/guards/auth.guard';
import { UnauthGuard } from './auth/guards/unauth.guard';
import { HomePage, ProjectPage, LocalePage, ProjectKeysPage } from './pages';
import { LoginComponent, RegisterComponent } from './auth';
import { ProjectResolver, LocalesResolver } from './resolvers';
const appRoutes: Routes = [
{ path: 'register', component: RegisterComponent, canActivate: [UnauthGuard] },
{ path: 'login', component: LoginComponent, canActivate: [UnauthGuard] },
{ path: 'projects', component: HomePage, canLoad: [AuthGuard] },
{ path: 'projects/:projectId', component: ProjectPage, canLoad: [AuthGuard], resolve: { project: ProjectResolver, locales: LocalesResolver } },
{ path: 'projects/:projectId/keys', component: ProjectKeysPage, canLoad: [AuthGuard] },
{ path: 'projects/:projectId/locales/:localeIdent', component: LocalePage, canLoad: [AuthGuard] },
{ path: '', redirectTo: '/projects', pathMatch: 'full' },
];
@NgModule({
imports: [RouterModule.forRoot(appRoutes)],
exports: [RouterModule],
providers: [ProjectResolver, LocalesResolver]
})
export class AppRoutingModule { }
| import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { AuthGuard } from './auth/guards/auth.guard';
import { UnauthGuard } from './auth/guards/unauth.guard';
import { HomePage, ProjectPage, LocalePage, ProjectKeysPage } from './pages';
import { LoginComponent, RegisterComponent } from './auth';
import { ProjectResolver, LocalesResolver } from './resolvers';
const appRoutes: Routes = [
{ path: 'register', component: RegisterComponent, canActivate: [UnauthGuard] },
{ path: 'login', component: LoginComponent, canActivate: [UnauthGuard] },
{ path: 'projects', component: HomePage, canActivate: [AuthGuard] },
{ path: 'projects/:projectId', component: ProjectPage, canActivate: [AuthGuard], resolve: { project: ProjectResolver, locales: LocalesResolver } },
{ path: 'projects/:projectId/keys', component: ProjectKeysPage, canActivate: [AuthGuard] },
{ path: 'projects/:projectId/locales/:localeIdent', component: LocalePage, canActivate: [AuthGuard] },
{ path: '', redirectTo: '/projects', pathMatch: 'full' },
];
@NgModule({
imports: [RouterModule.forRoot(appRoutes)],
exports: [RouterModule],
providers: [ProjectResolver, LocalesResolver]
})
export class AppRoutingModule { }
| Revert to canActivate, unexpected behaviour with canLoad | Revert to canActivate, unexpected behaviour with canLoad
| TypeScript | mit | anthonynsimon/parrot,todes1/parrot,anthonynsimon/parrot,todes1/parrot,todes1/parrot,todes1/parrot,todes1/parrot,anthonynsimon/parrot,anthonynsimon/parrot,anthonynsimon/parrot,todes1/parrot,anthonynsimon/parrot | ---
+++
@@ -12,10 +12,10 @@
const appRoutes: Routes = [
{ path: 'register', component: RegisterComponent, canActivate: [UnauthGuard] },
{ path: 'login', component: LoginComponent, canActivate: [UnauthGuard] },
- { path: 'projects', component: HomePage, canLoad: [AuthGuard] },
- { path: 'projects/:projectId', component: ProjectPage, canLoad: [AuthGuard], resolve: { project: ProjectResolver, locales: LocalesResolver } },
- { path: 'projects/:projectId/keys', component: ProjectKeysPage, canLoad: [AuthGuard] },
- { path: 'projects/:projectId/locales/:localeIdent', component: LocalePage, canLoad: [AuthGuard] },
+ { path: 'projects', component: HomePage, canActivate: [AuthGuard] },
+ { path: 'projects/:projectId', component: ProjectPage, canActivate: [AuthGuard], resolve: { project: ProjectResolver, locales: LocalesResolver } },
+ { path: 'projects/:projectId/keys', component: ProjectKeysPage, canActivate: [AuthGuard] },
+ { path: 'projects/:projectId/locales/:localeIdent', component: LocalePage, canActivate: [AuthGuard] },
{ path: '', redirectTo: '/projects', pathMatch: 'full' },
];
@NgModule({ |
851f8a8756e8735a82d7220b48d766c2cba28391 | components/input-number/index.tsx | components/input-number/index.tsx | import React from 'react';
import classNames from 'classnames';
import RcInputNumber from 'rc-input-number';
export interface InputNumberProps {
prefixCls?: string;
min?: number;
max?: number;
value?: number;
step?: number | string;
defaultValue?: number;
onChange?: (value: number | string | undefined) => void;
disabled?: boolean;
size?: 'large' | 'small' | 'default';
formatter?: (value: number | string | undefined) => string;
placeholder?: string;
style?: React.CSSProperties;
className?: string;
}
export default class InputNumber extends React.Component<InputNumberProps, any> {
static defaultProps = {
prefixCls: 'ant-input-number',
step: 1,
};
render() {
const { className, size, ...others } = this.props;
const inputNumberClass = classNames({
[`${this.props.prefixCls}-lg`]: size === 'large',
[`${this.props.prefixCls}-sm`]: size === 'small',
}, className);
return <RcInputNumber className={inputNumberClass} {...others} />;
}
}
| import React from 'react';
import classNames from 'classnames';
import RcInputNumber from 'rc-input-number';
export interface InputNumberProps {
prefixCls?: string;
min?: number;
max?: number;
value?: number;
step?: number | string;
defaultValue?: number;
onChange?: (value: number | string | undefined) => void;
disabled?: boolean;
size?: 'large' | 'small' | 'default';
formatter?: (value: number | string | undefined) => string;
parser?: (displayValue: string | undefined) => number;
placeholder?: string;
style?: React.CSSProperties;
className?: string;
}
export default class InputNumber extends React.Component<InputNumberProps, any> {
static defaultProps = {
prefixCls: 'ant-input-number',
step: 1,
};
render() {
const { className, size, ...others } = this.props;
const inputNumberClass = classNames({
[`${this.props.prefixCls}-lg`]: size === 'large',
[`${this.props.prefixCls}-sm`]: size === 'small',
}, className);
return <RcInputNumber className={inputNumberClass} {...others} />;
}
}
| Add missing props(parser) into InputNumberProps | Add missing props(parser) into InputNumberProps
| TypeScript | mit | liekkas/ant-design,icaife/ant-design,mitchelldemler/ant-design,mitchelldemler/ant-design,ant-design/ant-design,zheeeng/ant-design,zheeeng/ant-design,havefive/ant-design,liekkas/ant-design,marswong/ant-design,vgeyi/ant-design,liekkas/ant-design,mitchelldemler/ant-design,elevensky/ant-design,vgeyi/ant-design,ant-design/ant-design,icaife/ant-design,elevensky/ant-design,vgeyi/ant-design,havefive/ant-design,elevensky/ant-design,marswong/ant-design,liekkas/ant-design,RaoHai/ant-design,mitchelldemler/ant-design,zheeeng/ant-design,icaife/ant-design,vgeyi/ant-design,icaife/ant-design,havefive/ant-design,havefive/ant-design,marswong/ant-design,RaoHai/ant-design,elevensky/ant-design,ant-design/ant-design,marswong/ant-design,zheeeng/ant-design,ant-design/ant-design,RaoHai/ant-design,RaoHai/ant-design | ---
+++
@@ -13,6 +13,7 @@
disabled?: boolean;
size?: 'large' | 'small' | 'default';
formatter?: (value: number | string | undefined) => string;
+ parser?: (displayValue: string | undefined) => number;
placeholder?: string;
style?: React.CSSProperties;
className?: string; |
0e60272c02155cd8fb7e243fe5479caa5772d52e | spec/performance/performance-suite.ts | spec/performance/performance-suite.ts | import { runBenchmarks } from './support/runner';
import { BenchmarkConfig, BenchmarkFactories } from './support/async-bench';
import { QUERY_BENCHMARKS } from './profiling/query-pipeline.perf';
import { COMPARISON } from './comparison/comparison';
import { runComparisons } from './support/compare-runner';
import { GraphQLHTTPTestEndpoint } from '../helpers/grapqhl-http-test/graphql-http-test-endpoint';
new GraphQLHTTPTestEndpoint().start(1337);
const benchmarks: BenchmarkFactories = [
...QUERY_BENCHMARKS
];
const comparisons: BenchmarkConfig[][] = [
COMPARISON
];
async function run() {
await runBenchmarks(benchmarks);
for (const comparison of comparisons) {
await runComparisons(comparison);
}
}
run(); | import { runBenchmarks } from './support/runner';
import { BenchmarkConfig, BenchmarkFactories } from './support/async-bench';
import { QUERY_BENCHMARKS } from './profiling/query-pipeline.perf';
import { COMPARISON } from './comparison/comparison';
import { runComparisons } from './support/compare-runner';
import { GraphQLHTTPTestEndpoint } from '../helpers/grapqhl-http-test/graphql-http-test-endpoint';
const benchmarks: BenchmarkFactories = [
...QUERY_BENCHMARKS
];
const comparisons: BenchmarkConfig[][] = [
COMPARISON
];
async function run() {
const testSever = new GraphQLHTTPTestEndpoint();
testSever.start(1337);
await runBenchmarks(benchmarks);
for (const comparison of comparisons) {
await runComparisons(comparison);
}
testSever.stop();
}
run();
| Stop test server after benchmarks are run | Stop test server after benchmarks are run
| TypeScript | mit | AEB-labs/graphql-weaver,AEB-labs/graphql-weaver | ---
+++
@@ -4,8 +4,6 @@
import { COMPARISON } from './comparison/comparison';
import { runComparisons } from './support/compare-runner';
import { GraphQLHTTPTestEndpoint } from '../helpers/grapqhl-http-test/graphql-http-test-endpoint';
-
-new GraphQLHTTPTestEndpoint().start(1337);
const benchmarks: BenchmarkFactories = [
...QUERY_BENCHMARKS
@@ -16,10 +14,15 @@
];
async function run() {
+ const testSever = new GraphQLHTTPTestEndpoint();
+ testSever.start(1337);
+
await runBenchmarks(benchmarks);
for (const comparison of comparisons) {
await runComparisons(comparison);
}
+
+ testSever.stop();
}
run(); |
56bdfc3b8aafca86016fde54f280faf1da86134f | src/app/pages/measure/measure.module.ts | src/app/pages/measure/measure.module.ts | import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { MeasureReportPageModule } from './measure-report/measure-report.module';
import { MeasureRoutingModule } from './measure-routing.module';
import { MeasureScanPageModule } from './measure-scan/measure-scan.module';
import { MeasureStepsPage } from './measure-steps/measure-steps.page';
@NgModule({
imports: [
IonicModule,
CommonModule,
FormsModule,
MeasureRoutingModule,
MeasureReportPageModule,
MeasureScanPageModule,
MeasureStepsPage
],
declarations: []
})
export class MeasureModule {}
| import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { IonicModule } from '@ionic/angular';
import { MeasureReportPageModule } from './measure-report/measure-report.module';
import { MeasureRoutingModule } from './measure-routing.module';
import { MeasureScanPageModule } from './measure-scan/measure-scan.module';
import { MeasureStepsPageModule } from './measure-steps/measure-steps.module';
@NgModule({
imports: [
IonicModule,
CommonModule,
FormsModule,
MeasureRoutingModule,
MeasureReportPageModule,
MeasureScanPageModule,
MeasureStepsPageModule
],
declarations: []
})
export class MeasureModule {}
| Fix build with new measure steps page | Fix build with new measure steps page
| TypeScript | apache-2.0 | openradiation/openradiation-mobile,openradiation/openradiation-mobile,openradiation/openradiation-mobile,openradiation/openradiation-mobile | ---
+++
@@ -6,7 +6,7 @@
import { MeasureReportPageModule } from './measure-report/measure-report.module';
import { MeasureRoutingModule } from './measure-routing.module';
import { MeasureScanPageModule } from './measure-scan/measure-scan.module';
-import { MeasureStepsPage } from './measure-steps/measure-steps.page';
+import { MeasureStepsPageModule } from './measure-steps/measure-steps.module';
@NgModule({
imports: [
@@ -16,7 +16,7 @@
MeasureRoutingModule,
MeasureReportPageModule,
MeasureScanPageModule,
- MeasureStepsPage
+ MeasureStepsPageModule
],
declarations: []
}) |
11fed58b5a9410c9ad3db31f506a7827e814d283 | src/app/ui/ui-hint/ui-hint.component.ts | src/app/ui/ui-hint/ui-hint.component.ts | import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-ui-hint',
templateUrl: './ui-hint.component.html',
styleUrls: ['./ui-hint.component.scss']
})
export class UiHintComponent {
@Input() hint: string;
@Input() placement = 'top';
@Input() triggers = 'focus';
}
| import { Component, OnInit, Input } from '@angular/core';
@Component({
selector: 'app-ui-hint',
templateUrl: './ui-hint.component.html',
styleUrls: ['./ui-hint.component.scss']
})
export class UiHintComponent {
@Input() hint: string;
@Input() placement = 'top';
@Input() triggers = 'click';
}
| Change hint trigger to click for browsers | Change hint trigger to click for browsers
| TypeScript | mit | EvictionLab/eviction-maps,EvictionLab/eviction-maps,EvictionLab/eviction-maps,EvictionLab/eviction-maps | ---
+++
@@ -8,5 +8,5 @@
export class UiHintComponent {
@Input() hint: string;
@Input() placement = 'top';
- @Input() triggers = 'focus';
+ @Input() triggers = 'click';
} |
305a75963e7343b9b66636ff3a748823787348fb | tests/__tests__/tsx-compilation.spec.ts | tests/__tests__/tsx-compilation.spec.ts | import runJest from '../__helpers__/runJest';
describe('TSX Compilation', () => {
it('Should compile a button succesfully', () => {
const result = runJest('../button', ['--no-cache', '-u']);
const stderr = result.stderr.toString();
const output = result.output.toString();
expect(result.status).toBe(1);
expect(output).toContain('1 failed, 1 passed, 2 total');
expect(stderr).toContain('Button renders correctly');
expect(stderr).toContain('BadButton should throw an error on line 18');
});
});
| import runJest from '../__helpers__/runJest';
describe('TSX Compilation', () => {
it('Should compile a button succesfully', () => {
const result = runJest('../button', ['--no-cache', '-u']);
const stderr = result.stderr.toString();
const output = result.output.toString();
expect(result.status).toBe(1);
expect(output).toContain('1 failed, 1 passed, 2 total');
expect(stderr).toContain('Button renders correctly');
expect(stderr).toContain('BadButton should throw an error on line 16');
});
});
| Fix line number in another test | Fix line number in another test
| TypeScript | mit | kulshekhar/ts-jest,kulshekhar/ts-jest | ---
+++
@@ -10,6 +10,6 @@
expect(result.status).toBe(1);
expect(output).toContain('1 failed, 1 passed, 2 total');
expect(stderr).toContain('Button renders correctly');
- expect(stderr).toContain('BadButton should throw an error on line 18');
+ expect(stderr).toContain('BadButton should throw an error on line 16');
});
}); |
fb1dc9eee1c3d300dd7ddbe2f5dd5c2892547d7d | examples/hello-world/src/app.ts | examples/hello-world/src/app.ts | import { Update, View, defineComponent } from 'myra/core'
import { div } from 'myra/html/elements'
/**
* Model
*/
type Model = string | undefined
const model: Model = undefined
/**
* Update
*/
const mount: Update<Model, any> = (_) => 'Hello world!'
/**
* View
*/
const view: View<Model> = (model) => div(model)
/**
* Define a component
*/
const appComponent = defineComponent({
name: 'HelloWorldApp',
init: model,
mount: mount,
view: view
})
/**
* Mount the component
*/
appComponent().mount(document.body) | import { Update, View, defineComponent } from 'myra/core'
import { p } from 'myra/html/elements'
/**
* Model
*/
type Model = string | undefined
const model: Model = undefined
/**
* Update
*/
const mount: Update<Model, any> = (_) => 'Hello world!'
/**
* View
*/
const view: View<Model> = (model) => p(model)
/**
* Define a component
*/
const appComponent = defineComponent({
name: 'HelloWorldApp',
init: model,
mount: mount,
view: view
})
/**
* Mount the component
*/
appComponent().mount(document.body) | Replace div with p tag | Replace div with p tag
| TypeScript | mit | jhdrn/myra,jhdrn/myra | ---
+++
@@ -1,5 +1,5 @@
import { Update, View, defineComponent } from 'myra/core'
-import { div } from 'myra/html/elements'
+import { p } from 'myra/html/elements'
/**
@@ -18,7 +18,7 @@
/**
* View
*/
-const view: View<Model> = (model) => div(model)
+const view: View<Model> = (model) => p(model)
/** |
541f407a84874f6b0d5330475062a800a4db2571 | tests/__tests__/jest-hoist.spec.ts | tests/__tests__/jest-hoist.spec.ts | import runJest from '../__helpers__/runJest';
describe('Jest.mock() calls', () => {
it('Should run all tests using jest.mock() underneath the imports succesfully.', () => {
const result = runJest('../hoist-test', ['--no-cache']);
const output = result.output.toString();
expect(output).toContain('4 passed, 4 total');
expect(result.status).toBe(0);
});
it('Should retain proper line endings while hoisting', () => {
const result = runJest('../hoist-errors', ['--no-cache']);
const stderr = result.stderr.toString();
expect(result.status).toBe(1);
expect(stderr).toContain('Hello.ts:22');
// The actual error occurs at line 16. However, because the mock calls
// are hoisted, this changes - in this case, to 26
expect(stderr).toContain('Hello.test.ts:26');
});
});
| import runJest from '../__helpers__/runJest';
describe('Jest.mock() calls', () => {
it('Should run all tests using jest.mock() underneath the imports succesfully.', () => {
const result = runJest('../hoist-test', ['--no-cache']);
const output = result.output.toString();
expect(output).toContain('4 passed, 4 total');
expect(result.status).toBe(0);
});
it('Should retain proper line endings while hoisting', () => {
const result = runJest('../hoist-errors', ['--no-cache']);
const stderr = result.stderr.toString();
expect(result.status).toBe(1);
expect(stderr).toContain('Hello.ts:22:11');
// The actual error occurs at line 16. However, because the mock calls
// are hoisted, this changes - in this case, to 26
// The column numbers are accurate.
expect(stderr).toContain('Hello.test.ts:26:19');
});
});
| Add column numbers to the hoist test | Add column numbers to the hoist test
| TypeScript | mit | kulshekhar/ts-jest,kulshekhar/ts-jest | ---
+++
@@ -17,9 +17,11 @@
const stderr = result.stderr.toString();
expect(result.status).toBe(1);
- expect(stderr).toContain('Hello.ts:22');
+ expect(stderr).toContain('Hello.ts:22:11');
+
// The actual error occurs at line 16. However, because the mock calls
// are hoisted, this changes - in this case, to 26
- expect(stderr).toContain('Hello.test.ts:26');
+ // The column numbers are accurate.
+ expect(stderr).toContain('Hello.test.ts:26:19');
});
}); |
17ec07595a8592f099c9aa6479d52506b2f40973 | polygerrit-ui/app/styles/gr-modal-styles.ts | polygerrit-ui/app/styles/gr-modal-styles.ts | /**
* @license
* Copyright 2022 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {css} from 'lit';
export const modalStyles = css`
dialog {
padding: 0;
border: 1px solid var(--border-color);
border-radius: var(--border-radius);
background: var(--dialog-background-color);
box-shadow: var(--elevation-level-5);
}
dialog::backdrop {
background-color: black;
opacity: var(--modal-opacity, 0.6);
}
`;
| /**
* @license
* Copyright 2022 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {css} from 'lit';
export const modalStyles = css`
dialog {
padding: 0;
border: 1px solid var(--border-color);
border-radius: var(--border-radius);
background: var(--dialog-background-color);
box-shadow: var(--elevation-level-5);
/*
* These styles are taken from main.css
* Dialog exists in the top-layer outside the body hence the styles
* in main.css were not being applied.
*/
font-family: var(--font-family, ''), 'Roboto', Arial, sans-serif;
font-size: var(--font-size-normal, 1rem);
line-height: var(--line-height-normal, 1.4);
color: var(--primary-text-color, black);
}
dialog::backdrop {
background-color: black;
opacity: var(--modal-opacity, 0.6);
}
`;
| Add missing styles from main.css | Add missing styles from main.css
Dialog exists in the top-layer outside the body hence the styles
in main.css were not being applied resulting in incorrect text
color in dark theme.
Google-bug-id: b/257083628
Release-Notes: skip
Change-Id: I5604c85742fa5ecf3b4a5eebc3d6a42e41282b5e
| TypeScript | apache-2.0 | GerritCodeReview/gerrit,GerritCodeReview/gerrit,GerritCodeReview/gerrit,GerritCodeReview/gerrit,GerritCodeReview/gerrit,GerritCodeReview/gerrit,GerritCodeReview/gerrit,GerritCodeReview/gerrit | ---
+++
@@ -12,7 +12,19 @@
border-radius: var(--border-radius);
background: var(--dialog-background-color);
box-shadow: var(--elevation-level-5);
+
+ /*
+ * These styles are taken from main.css
+ * Dialog exists in the top-layer outside the body hence the styles
+ * in main.css were not being applied.
+ */
+
+ font-family: var(--font-family, ''), 'Roboto', Arial, sans-serif;
+ font-size: var(--font-size-normal, 1rem);
+ line-height: var(--line-height-normal, 1.4);
+ color: var(--primary-text-color, black);
}
+
dialog::backdrop {
background-color: black;
opacity: var(--modal-opacity, 0.6); |
73b0962c2b376acc65417f0c99e049e1b16ac37f | src/app/shared/spinner/spinner.component.ts | src/app/shared/spinner/spinner.component.ts | import {Component, Input, OnDestroy} from 'angular2/core';
@Component({
selector: 'spinner',
styleUrls: ['app/shared/spinner/spinner.component.css'],
template: `
<div *ngIf="isSpinning" class="spinner" [class.inverse]="inverse"></div>
`
})
export class SpinnerComponent implements OnDestroy {
private currentTimeout: number;
private isSpinning: boolean = true;
@Input() public inverse: boolean = false;
@Input() public delay: number = 300;
@Input() public set spinning(value: boolean) {
if (!value) {
this.cancelTimeout();
this.isSpinning = false;
}
if (this.currentTimeout) {
return;
}
this.currentTimeout = setTimeout(() => {
this.isSpinning = value;
this.cancelTimeout();
}, this.delay);
}
private cancelTimeout(): void {
clearTimeout(this.currentTimeout);
this.currentTimeout = undefined;
}
ngOnDestroy(): any {
this.cancelTimeout();
}
}
| import {Component, Input, OnDestroy} from 'angular2/core';
@Component({
selector: 'spinner',
styleUrls: ['app/shared/spinner/spinner.component.css'],
template: `
<div *ngIf="isSpinning" class="spinner" [class.inverse]="inverse"></div>
`
})
export class SpinnerComponent implements OnDestroy {
private currentTimeout: number;
private isSpinning: boolean = true;
@Input() public inverse: boolean = false;
@Input() public delay: number = 300;
@Input() public set spinning(value: boolean) {
if (!value) {
this.cancelTimeout();
this.isSpinning = false;
}
if (this.currentTimeout) {
return;
}
this.currentTimeout = setTimeout(() => {
this.isSpinning = value;
this.cancelTimeout();
}, this.delay);
}
private cancelTimeout(): void {
if (this.currentTimeout) {
clearTimeout(this.currentTimeout);
this.currentTimeout = undefined;
}
}
ngOnDestroy(): any {
this.cancelTimeout();
}
}
| Check for current timeout before calling cancel | Check for current timeout before calling cancel
| TypeScript | agpl-3.0 | PRX/publish.prx.org,PRX/publish.prx.org,PRX/publish.prx.org,PRX/publish.prx.org | ---
+++
@@ -31,8 +31,10 @@
}
private cancelTimeout(): void {
- clearTimeout(this.currentTimeout);
- this.currentTimeout = undefined;
+ if (this.currentTimeout) {
+ clearTimeout(this.currentTimeout);
+ this.currentTimeout = undefined;
+ }
}
ngOnDestroy(): any { |
a148b17bfdc2a226dd2393d0abb8befb3307b941 | packages/components/containers/topBanners/WelcomeV5TopBanner.tsx | packages/components/containers/topBanners/WelcomeV5TopBanner.tsx | import React from 'react';
import { c } from 'ttag';
import { getStaticURL } from '@proton/shared/lib/helpers/url';
import TopBanner from './TopBanner';
import { Href } from '../../components';
const WelcomeV5TopBanner = () => {
const learnMoreLink = (
<Href key="learn-more-link" url={getStaticURL('/news/updated-proton')}>{c('new_plans: info')
.t`learn more`}</Href>
);
return (
<TopBanner className="bg-primary">
{c('new_plans: message displayed when user visit v5 login')
.jt`Introducing Proton's refreshed look. Many services, one mission. Sign in to continue or ${learnMoreLink}.`}
</TopBanner>
);
};
export default WelcomeV5TopBanner;
| import React from 'react';
import { c } from 'ttag';
import { getStaticURL } from '@proton/shared/lib/helpers/url';
import TopBanner from './TopBanner';
import { Href } from '../../components';
const WelcomeV5TopBanner = () => {
const learnMoreLink = (
<Href key="learn-more-link" className="color-inherit" url={getStaticURL('/news/updated-proton')}>{c(
'new_plans: info'
).t`learn more`}</Href>
);
return (
<TopBanner className="bg-primary">
{c('new_plans: message displayed when user visit v5 login')
.jt`Introducing Proton's refreshed look. Many services, one mission. Sign in to continue or ${learnMoreLink}.`}
</TopBanner>
);
};
export default WelcomeV5TopBanner;
| Add color-inherit override to welcome banner | Add color-inherit override to welcome banner
Override the welcome top banner specifically because it uses the norm bg
color
| TypeScript | mit | ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient | ---
+++
@@ -7,8 +7,9 @@
const WelcomeV5TopBanner = () => {
const learnMoreLink = (
- <Href key="learn-more-link" url={getStaticURL('/news/updated-proton')}>{c('new_plans: info')
- .t`learn more`}</Href>
+ <Href key="learn-more-link" className="color-inherit" url={getStaticURL('/news/updated-proton')}>{c(
+ 'new_plans: info'
+ ).t`learn more`}</Href>
);
return ( |
3038b664044b8bef7da7d740ae54f3d208fc2e0f | packages/graphql-codegen-core/src/schema/resolve-type.ts | packages/graphql-codegen-core/src/schema/resolve-type.ts | import { getNamedType, GraphQLInputType, GraphQLOutputType, GraphQLType } from 'graphql';
import { debugLog } from '../debugging';
export interface ResolvedType {
name: string;
isRequired: boolean;
isArray: boolean;
}
export function isRequired(type: GraphQLOutputType | GraphQLInputType): boolean {
return (String(type)).indexOf('!') > -1;
}
export function isArray(type: GraphQLOutputType | GraphQLInputType): boolean {
return (String(type)).indexOf('[') > -1;
}
export function resolveType(type: GraphQLType): ResolvedType {
const name = getNamedType(type).name;
debugLog(`[resolveType] resolving type ${name}`);
return {
name,
isRequired: isRequired(type),
isArray: isArray(type),
};
}
| import { getNamedType, GraphQLInputType, GraphQLOutputType, GraphQLType } from 'graphql';
import { debugLog } from '../debugging';
export interface ResolvedType {
name: string;
isRequired: boolean;
isArray: boolean;
}
export function isRequired(type: GraphQLOutputType | GraphQLInputType): boolean {
const stringType = String(type)
return stringType.lastIndexOf('!') === stringType.length - 1
}
export function isArray(type: GraphQLOutputType | GraphQLInputType): boolean {
return (String(type)).indexOf('[') > -1;
}
export function resolveType(type: GraphQLType): ResolvedType {
const name = getNamedType(type).name;
debugLog(`[resolveType] resolving type ${name}`);
return {
name,
isRequired: isRequired(type),
isArray: isArray(type),
};
}
| Handle lists and non-null properly | Handle lists and non-null properly | TypeScript | mit | dotansimha/graphql-code-generator,dotansimha/graphql-code-generator,dotansimha/graphql-code-generator | ---
+++
@@ -8,7 +8,8 @@
}
export function isRequired(type: GraphQLOutputType | GraphQLInputType): boolean {
- return (String(type)).indexOf('!') > -1;
+ const stringType = String(type)
+ return stringType.lastIndexOf('!') === stringType.length - 1
}
export function isArray(type: GraphQLOutputType | GraphQLInputType): boolean { |
eb5eca250e11655a39dcb51bda8213a932cd3bd2 | packages/rev-api-hapi/src/index.ts | packages/rev-api-hapi/src/index.ts |
import * as Hapi from 'hapi';
import { IRevApiOptions, RevApi } from './api/revapi';
let version = require('../package.json').version;
function RevApiPlugin(server: Hapi.Server, options: IRevApiOptions, next: any) {
server.expose('version', version);
server.expose('api', new RevApi(server, options));
next();
}
(RevApiPlugin as any).attributes = {
name: 'revApi',
version: version
};
export default RevApiPlugin;
|
import * as Hapi from 'hapi';
import { IRevApiOptions, RevApi } from './api/revapi';
let version: string = null;
try {
version = require('./package.json').version;
}
catch (e) {
version = require('../package.json').version;
}
function RevApiPlugin(server: Hapi.Server, options: IRevApiOptions, next: any) {
server.expose('version', version);
server.expose('api', new RevApi(server, options));
next();
}
(RevApiPlugin as any).attributes = {
name: 'revApi',
version: version
};
export default RevApiPlugin;
| Fix issue with loading version from package.json | Fix issue with loading version from package.json
| TypeScript | mit | RevFramework/rev-framework,RevFramework/rev-framework | ---
+++
@@ -2,7 +2,14 @@
import * as Hapi from 'hapi';
import { IRevApiOptions, RevApi } from './api/revapi';
-let version = require('../package.json').version;
+let version: string = null;
+
+try {
+ version = require('./package.json').version;
+}
+catch (e) {
+ version = require('../package.json').version;
+}
function RevApiPlugin(server: Hapi.Server, options: IRevApiOptions, next: any) {
server.expose('version', version); |
abbab3dd719f1a509e301f520981dd920f2e72aa | bokehjs/src/coffee/core/util/dom.ts | bokehjs/src/coffee/core/util/dom.ts | import * as _ from "underscore";
export function createElement(type: string, props: { [name: string]: any }, ...children: (string | HTMLElement)[]): HTMLElement {
const elem = document.createElement(type);
for (let k in props) {
let v = props[k];
if (k === "className")
k = "class";
if (k === "class" && _.isArray(v))
v = v.filter(c => c != null).join(" ");
elem.setAttribute(k, v);
}
for (const v of children) {
if (v instanceof HTMLElement) elem.appendChild(v);
else elem.insertAdjacentText("beforeend", v);
}
return elem;
}
| import * as _ from "underscore";
export function createElement(type: string, props: { [name: string]: any }, ...children: (string | HTMLElement)[]): HTMLElement {
let elem;
if (type === "fragment") {
elem = document.createDocumentFragment();
} else {
elem = document.createElement(type);
for (let k in props) {
let v = props[k];
if (k === "className")
k = "class";
if (k === "class" && _.isArray(v))
v = v.filter(c => c != null).join(" ");
if (v == null || _.isBoolean(v) && v)
continue
elem.setAttribute(k, v);
}
}
for (const v of children) {
if (v instanceof HTMLElement)
elem.appendChild(v);
else if (_.isString(v))
elem.appendChild(document.createTextNode(v))
}
return elem;
}
| Add support for HTML fragments to DOM.createElement() | Add support for HTML fragments to DOM.createElement()
| TypeScript | bsd-3-clause | mindriot101/bokeh,timsnyder/bokeh,schoolie/bokeh,aiguofer/bokeh,stonebig/bokeh,timsnyder/bokeh,draperjames/bokeh,DuCorey/bokeh,philippjfr/bokeh,philippjfr/bokeh,aavanian/bokeh,mindriot101/bokeh,philippjfr/bokeh,ericmjl/bokeh,jakirkham/bokeh,rs2/bokeh,schoolie/bokeh,dennisobrien/bokeh,jakirkham/bokeh,azjps/bokeh,bokeh/bokeh,aiguofer/bokeh,aiguofer/bokeh,percyfal/bokeh,dennisobrien/bokeh,Karel-van-de-Plassche/bokeh,rs2/bokeh,schoolie/bokeh,schoolie/bokeh,rs2/bokeh,bokeh/bokeh,percyfal/bokeh,jakirkham/bokeh,Karel-van-de-Plassche/bokeh,stonebig/bokeh,azjps/bokeh,azjps/bokeh,timsnyder/bokeh,percyfal/bokeh,bokeh/bokeh,DuCorey/bokeh,azjps/bokeh,mindriot101/bokeh,ericmjl/bokeh,dennisobrien/bokeh,jakirkham/bokeh,aavanian/bokeh,bokeh/bokeh,draperjames/bokeh,dennisobrien/bokeh,azjps/bokeh,rs2/bokeh,draperjames/bokeh,DuCorey/bokeh,stonebig/bokeh,rs2/bokeh,dennisobrien/bokeh,stonebig/bokeh,percyfal/bokeh,Karel-van-de-Plassche/bokeh,philippjfr/bokeh,aiguofer/bokeh,bokeh/bokeh,aavanian/bokeh,DuCorey/bokeh,timsnyder/bokeh,Karel-van-de-Plassche/bokeh,schoolie/bokeh,percyfal/bokeh,ericmjl/bokeh,draperjames/bokeh,jakirkham/bokeh,ericmjl/bokeh,aiguofer/bokeh,philippjfr/bokeh,aavanian/bokeh,aavanian/bokeh,ericmjl/bokeh,mindriot101/bokeh,DuCorey/bokeh,draperjames/bokeh,timsnyder/bokeh,Karel-van-de-Plassche/bokeh | ---
+++
@@ -1,18 +1,29 @@
import * as _ from "underscore";
export function createElement(type: string, props: { [name: string]: any }, ...children: (string | HTMLElement)[]): HTMLElement {
- const elem = document.createElement(type);
- for (let k in props) {
- let v = props[k];
- if (k === "className")
- k = "class";
- if (k === "class" && _.isArray(v))
- v = v.filter(c => c != null).join(" ");
- elem.setAttribute(k, v);
+ let elem;
+ if (type === "fragment") {
+ elem = document.createDocumentFragment();
+ } else {
+ elem = document.createElement(type);
+ for (let k in props) {
+ let v = props[k];
+ if (k === "className")
+ k = "class";
+ if (k === "class" && _.isArray(v))
+ v = v.filter(c => c != null).join(" ");
+ if (v == null || _.isBoolean(v) && v)
+ continue
+ elem.setAttribute(k, v);
+ }
}
+
for (const v of children) {
- if (v instanceof HTMLElement) elem.appendChild(v);
- else elem.insertAdjacentText("beforeend", v);
+ if (v instanceof HTMLElement)
+ elem.appendChild(v);
+ else if (_.isString(v))
+ elem.appendChild(document.createTextNode(v))
}
+
return elem;
} |
1e9ab6ef2abfe71454554385589020173ce9638a | resources/assets/lib/utils/html.ts | resources/assets/lib/utils/html.ts | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.
export function createClickCallback(htmlTarget: unknown, reloadDefault = false) {
const target = htmlTarget instanceof HTMLElement ? htmlTarget : undefined;
if (target != null || reloadDefault) {
return () => osu.executeAction(target);
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.
export function createClickCallback(target: unknown, reloadIfNotHtml = false) {
if (target instanceof HTMLElement) {
// plain javascript here doesn't trigger submit events
// which means jquery-ujs handler won't be triggered
// reference: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit
if (target instanceof HTMLFormElement) {
return () => $(target).submit();
}
// inversely, using jquery here won't actually click the thing
// reference: https://github.com/jquery/jquery/blob/f5aa89af7029ae6b9203c2d3e551a8554a0b4b89/src/event.js#L586
return () => target.click();
}
if (reloadIfNotHtml) {
return () => osu.reloadPage();
}
}
| Create own function instead of using executeAction | Create own function instead of using executeAction
The latter will be removed due to it being weird.
| TypeScript | agpl-3.0 | notbakaneko/osu-web,notbakaneko/osu-web,LiquidPL/osu-web,LiquidPL/osu-web,ppy/osu-web,nanaya/osu-web,nanaya/osu-web,ppy/osu-web,LiquidPL/osu-web,ppy/osu-web,nanaya/osu-web,notbakaneko/osu-web,ppy/osu-web,LiquidPL/osu-web,LiquidPL/osu-web,nanaya/osu-web,notbakaneko/osu-web,ppy/osu-web,notbakaneko/osu-web,nanaya/osu-web | ---
+++
@@ -1,10 +1,21 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.
-export function createClickCallback(htmlTarget: unknown, reloadDefault = false) {
- const target = htmlTarget instanceof HTMLElement ? htmlTarget : undefined;
+export function createClickCallback(target: unknown, reloadIfNotHtml = false) {
+ if (target instanceof HTMLElement) {
+ // plain javascript here doesn't trigger submit events
+ // which means jquery-ujs handler won't be triggered
+ // reference: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit
+ if (target instanceof HTMLFormElement) {
+ return () => $(target).submit();
+ }
- if (target != null || reloadDefault) {
- return () => osu.executeAction(target);
+ // inversely, using jquery here won't actually click the thing
+ // reference: https://github.com/jquery/jquery/blob/f5aa89af7029ae6b9203c2d3e551a8554a0b4b89/src/event.js#L586
+ return () => target.click();
+ }
+
+ if (reloadIfNotHtml) {
+ return () => osu.reloadPage();
}
} |
b96794d8e76b25dd9d29cb92fc1673c793ab4ace | src/db/connector.ts | src/db/connector.ts | /*
Copyright 2018 matrix-appservice-discord
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.
*/
export interface ISqlCommandParameters {
[paramKey: string]: number | boolean | string | Promise<number | boolean | string>;
}
export interface ISqlRow {
[key: string]: number | boolean | string;
}
export interface IDatabaseConnector {
Open(): void;
Get(sql: string, parameters?: ISqlCommandParameters): Promise<ISqlRow>;
All(sql: string, parameters?: ISqlCommandParameters): Promise<ISqlRow[]>;
Run(sql: string, parameters?: ISqlCommandParameters): Promise<void>;
Close(): Promise<void>;
Exec(sql: string): Promise<void>;
}
| /*
Copyright 2018 matrix-appservice-discord
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.
*/
type SQLTYPES = number | boolean | string | null;
export interface ISqlCommandParameters {
[paramKey: string]: SQLTYPES | Promise<SQLTYPES>;
}
export interface ISqlRow {
[key: string]: SQLTYPES;
}
export interface IDatabaseConnector {
Open(): void;
Get(sql: string, parameters?: ISqlCommandParameters): Promise<ISqlRow>;
All(sql: string, parameters?: ISqlCommandParameters): Promise<ISqlRow[]>;
Run(sql: string, parameters?: ISqlCommandParameters): Promise<void>;
Close(): Promise<void>;
Exec(sql: string): Promise<void>;
}
| Add a type for SQLTYPES | Add a type for SQLTYPES
| TypeScript | apache-2.0 | Half-Shot/matrix-appservice-discord | ---
+++
@@ -14,12 +14,14 @@
limitations under the License.
*/
+type SQLTYPES = number | boolean | string | null;
+
export interface ISqlCommandParameters {
- [paramKey: string]: number | boolean | string | Promise<number | boolean | string>;
+ [paramKey: string]: SQLTYPES | Promise<SQLTYPES>;
}
export interface ISqlRow {
- [key: string]: number | boolean | string;
+ [key: string]: SQLTYPES;
}
export interface IDatabaseConnector { |
ea8e9d64ad04a890cc6240baca6863b9e751d927 | lib/cli/src/generators/SVELTE/index.ts | lib/cli/src/generators/SVELTE/index.ts | import { baseGenerator, Generator } from '../baseGenerator';
const generator: Generator = async (packageManager, npmOptions, options) => {
baseGenerator(packageManager, npmOptions, options, 'svelte', {
extraPackages: ['svelte', 'svelte-loader'],
});
};
export default generator;
| import fse from 'fs-extra';
import { logger } from '@storybook/node-logger';
import { baseGenerator, Generator } from '../baseGenerator';
const generator: Generator = async (packageManager, npmOptions, options) => {
await baseGenerator(packageManager, npmOptions, options, 'svelte', {
extraPackages: ['svelte', 'svelte-loader'],
extraAddons: ['@storybook/addon-svelte-csf'],
});
let conf = fse.readFileSync('./.storybook/main.js').toString();
// add *.stories.svelte
conf = conf.replace(/js\|jsx/g, 'js|jsx|svelte');
let requirePreprocessor;
let preprocessStatement = 'undefined';
// svelte.config.js ?
if (fse.existsSync('./svelte.config.js')) {
logger.info("Configuring preprocessor from 'svelte.config.js'");
requirePreprocessor = `const preprocess = require("../svelte.config.js").preprocess;`;
preprocessStatement = 'preprocess';
} else {
// svelte-preprocess dependencies ?
const packageJson = packageManager.retrievePackageJson();
if (packageJson.devDependencies && packageJson.devDependencies['svelte-preprocess']) {
logger.info("Configuring preprocessor with 'svelte-preprocess'");
requirePreprocessor = 'const sveltePreprocess = require("svelte-preprocess");';
preprocessStatement = 'sveltePreprocess()';
}
}
const svelteOptions = ` "svelteOptions": {\n preprocess: ${preprocessStatement},\n },`;
if (requirePreprocessor) {
conf = `${requirePreprocessor}\n\n${conf}`;
}
conf = conf.replace(/\],/, `],\n${svelteOptions}`);
fse.writeFileSync('./.storybook/main.js', conf);
};
export default generator;
| Improve sb init for svelte | Improve sb init for svelte
| TypeScript | mit | kadirahq/react-storybook,storybooks/storybook,storybooks/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,kadirahq/react-storybook,storybooks/react-storybook,storybooks/react-storybook,storybooks/react-storybook,storybooks/storybook,storybooks/storybook | ---
+++
@@ -1,9 +1,47 @@
+import fse from 'fs-extra';
+import { logger } from '@storybook/node-logger';
+
import { baseGenerator, Generator } from '../baseGenerator';
const generator: Generator = async (packageManager, npmOptions, options) => {
- baseGenerator(packageManager, npmOptions, options, 'svelte', {
+ await baseGenerator(packageManager, npmOptions, options, 'svelte', {
extraPackages: ['svelte', 'svelte-loader'],
+ extraAddons: ['@storybook/addon-svelte-csf'],
});
+
+ let conf = fse.readFileSync('./.storybook/main.js').toString();
+
+ // add *.stories.svelte
+ conf = conf.replace(/js\|jsx/g, 'js|jsx|svelte');
+
+ let requirePreprocessor;
+ let preprocessStatement = 'undefined';
+
+ // svelte.config.js ?
+ if (fse.existsSync('./svelte.config.js')) {
+ logger.info("Configuring preprocessor from 'svelte.config.js'");
+
+ requirePreprocessor = `const preprocess = require("../svelte.config.js").preprocess;`;
+ preprocessStatement = 'preprocess';
+ } else {
+ // svelte-preprocess dependencies ?
+ const packageJson = packageManager.retrievePackageJson();
+ if (packageJson.devDependencies && packageJson.devDependencies['svelte-preprocess']) {
+ logger.info("Configuring preprocessor with 'svelte-preprocess'");
+
+ requirePreprocessor = 'const sveltePreprocess = require("svelte-preprocess");';
+ preprocessStatement = 'sveltePreprocess()';
+ }
+ }
+
+ const svelteOptions = ` "svelteOptions": {\n preprocess: ${preprocessStatement},\n },`;
+
+ if (requirePreprocessor) {
+ conf = `${requirePreprocessor}\n\n${conf}`;
+ }
+
+ conf = conf.replace(/\],/, `],\n${svelteOptions}`);
+ fse.writeFileSync('./.storybook/main.js', conf);
};
export default generator; |
0433e484d0c022b3cd6f6993dbd0570ab3f676f4 | src/app/js/component/feed-list.tsx | src/app/js/component/feed-list.tsx | import * as ReactDOM from "react-dom";
import * as React from "react";
import { CustomComponent } from "./../custom-component";
import { ComponentsRefs } from "./../components-refs";
import { Feed, FeedProp } from "./../component/feed";
export class FeedList extends CustomComponent<{}, FeedListState> {
constructor() {
super();
this.state = {
feeds: []
};
ComponentsRefs.feedList = this;
}
render() {
return (
<ul className="rss list">
{
this.state.feeds.map(feed => {
return <Feed key={feed.uuid} uuid={feed.uuid} title={feed.title} link={feed.link} />
})
}
</ul>
);
}
addFeed(newFeed: FeedProp) {
const newFeeds = this.state.feeds.slice(0);
newFeeds[newFeeds.length] = newFeed;
this.editState({ feeds: newFeeds })
}
}
interface FeedListState {
feeds: FeedProp[];
} | import * as ReactDOM from "react-dom";
import * as React from "react";
import { CustomComponent } from "./../custom-component";
import { ComponentsRefs } from "./../components-refs";
import { Feed, FeedProp } from "./feed";
export class FeedList extends CustomComponent<{}, FeedListState> {
feedComponents: Feed[] = [];
constructor() {
super();
this.state = {
feeds: []
};
ComponentsRefs.feedList = this;
}
render() {
return (
<ul className="rss list">
{
this.state.feeds.map(feed => {
return <Feed ref={feed => this.feedComponents[this.feedComponents.length] = feed} key={feed.uuid} uuid={feed.uuid} title={feed.title} link={feed.link} />
})
}
</ul>
);
}
addFeed(newFeed: FeedProp) {
const newFeeds = this.state.feeds.slice(0);
newFeeds[newFeeds.length] = newFeed;
this.editState({ feeds: newFeeds })
}
}
interface FeedListState {
feeds: FeedProp[];
} | Add key to array rendering | Add key to array rendering
| TypeScript | mit | Xstoudi/alduin,Xstoudi/alduin,Xstoudi/alduin | ---
+++
@@ -3,9 +3,11 @@
import { CustomComponent } from "./../custom-component";
import { ComponentsRefs } from "./../components-refs";
-import { Feed, FeedProp } from "./../component/feed";
+import { Feed, FeedProp } from "./feed";
export class FeedList extends CustomComponent<{}, FeedListState> {
+
+ feedComponents: Feed[] = [];
constructor() {
super();
@@ -22,7 +24,7 @@
<ul className="rss list">
{
this.state.feeds.map(feed => {
- return <Feed key={feed.uuid} uuid={feed.uuid} title={feed.title} link={feed.link} />
+ return <Feed ref={feed => this.feedComponents[this.feedComponents.length] = feed} key={feed.uuid} uuid={feed.uuid} title={feed.title} link={feed.link} />
})
}
</ul> |
00937579bc5e48013b91e1ab2594728d4dcd51b6 | src/app/services/app-insights.service.ts | src/app/services/app-insights.service.ts | import { Injectable } from '@angular/core';
import { AppInsights } from 'applicationinsights-js';
import { environment } from '../../environments/environment';
import { AdalService } from 'adal-angular4';
@Injectable()
export class AppInsightsService {
private config: Microsoft.ApplicationInsights.IConfig = {
instrumentationKey: environment.applicationInsights.instrumentationKey
};
constructor(public adalService: AdalService) {
if (!AppInsights.config) {
AppInsights.downloadAndSetup(this.config);
if(adalService.userInfo.authenticated) {
AppInsights.setAuthenticatedUserContext(adalService.userInfo.profile.upn);
}
}
}
logPageView(name?: string, url?: string, properties?: any, measurements?: any, duration?: number) {
AppInsights.trackPageView(name, url, properties, measurements, duration);
}
logEvent(name: string, properties?: any, measurements?: any) {
AppInsights.trackEvent(name, properties, measurements);
}
logException(exception: Error, handledAt?: string, properties?: any, measurements?: any) {
AppInsights.trackException(exception, handledAt, properties, measurements);
}
logTrace(message: string, properties?: any, severityLevel?: any) {
AppInsights.trackTrace(message, properties, severityLevel);
}
}
| import { Injectable } from '@angular/core';
import { AppInsights } from 'applicationinsights-js';
import { environment } from '../../environments/environment';
import { AdalService } from 'adal-angular4';
@Injectable()
export class AppInsightsService {
private config: Microsoft.ApplicationInsights.IConfig = {
instrumentationKey: environment.applicationInsights.instrumentationKey
};
constructor(public adalService: AdalService) {
if (!AppInsights.config) {
AppInsights.downloadAndSetup(this.config);
}
}
logPageView(name?: string, url?: string, properties?: any, measurements?: any, duration?: number) {
this.setUser();
AppInsights.trackPageView(name, url, properties, measurements, duration);
}
logEvent(name: string, properties?: any, measurements?: any) {
this.setUser();
AppInsights.trackEvent(name, properties, measurements);
}
logException(exception: Error, handledAt?: string, properties?: any, measurements?: any) {
this.setUser();
AppInsights.trackException(exception, handledAt, properties, measurements);
}
logTrace(message: string, properties?: any, severityLevel?: any) {
this.setUser();
AppInsights.trackTrace(message, properties, severityLevel);
}
setUser() {
if(this.adalService.userInfo.authenticated) {
AppInsights.setAuthenticatedUserContext(this.adalService.userInfo.profile.upn);
} else {
AppInsights.clearAuthenticatedUserContext();
}
}
}
| Add user data to app insights telemetry | Add user data to app insights telemetry
| TypeScript | mit | PaulGilchrist/Angular2NodeTemplate,PaulGilchrist/angular-template,PaulGilchrist/angular-template,PaulGilchrist/angular-template,PaulGilchrist/Angular2NodeTemplate,PaulGilchrist/Angular2NodeTemplate | ---
+++
@@ -14,26 +14,35 @@
constructor(public adalService: AdalService) {
if (!AppInsights.config) {
AppInsights.downloadAndSetup(this.config);
- if(adalService.userInfo.authenticated) {
- AppInsights.setAuthenticatedUserContext(adalService.userInfo.profile.upn);
- }
}
}
logPageView(name?: string, url?: string, properties?: any, measurements?: any, duration?: number) {
+ this.setUser();
AppInsights.trackPageView(name, url, properties, measurements, duration);
}
logEvent(name: string, properties?: any, measurements?: any) {
+ this.setUser();
AppInsights.trackEvent(name, properties, measurements);
}
logException(exception: Error, handledAt?: string, properties?: any, measurements?: any) {
+ this.setUser();
AppInsights.trackException(exception, handledAt, properties, measurements);
}
logTrace(message: string, properties?: any, severityLevel?: any) {
+ this.setUser();
AppInsights.trackTrace(message, properties, severityLevel);
}
+ setUser() {
+ if(this.adalService.userInfo.authenticated) {
+ AppInsights.setAuthenticatedUserContext(this.adalService.userInfo.profile.upn);
+ } else {
+ AppInsights.clearAuthenticatedUserContext();
+ }
+ }
+
} |
4d58e433773a1e64a3221330f7ce2a9434b11b70 | client/app/scripts/liveblog-common/components/modal/withContext.tsx | client/app/scripts/liveblog-common/components/modal/withContext.tsx | import React from 'react';
import ModalContext from './context';
// eslint-disable-next-line
import { IModalContext } from './types';
const withModalContext = <T extends object>(Component: React.ComponentType<T>): React.ComponentType<T> => {
class ComponentHOC extends React.Component<T> {
modal: React.RefObject<any>;
instance: React.ComponentType<T>;
constructor(props: T) {
super(props);
this.modal = React.createRef();
}
static get displayName() {
return `withModalContext(${Component.displayName || Component.name})`;
}
openModal = () => {
$(this.modal.current).modal('show');
// trick because we use custom styles
// for modal coming from superdesk
$('.modal-backdrop').addClass('modal__backdrop');
}
closeModal = () => {
$(this.modal.current).modal('hide');
}
render() {
const modalStore: IModalContext = {
openModal: this.openModal,
closeModal: this.closeModal,
modalRef: this.modal,
};
return (
<ModalContext.Provider value={modalStore}>
<Component {...this.props} ref={(el) => this.instance = el} />
</ModalContext.Provider>
);
}
}
return ComponentHOC;
};
export default withModalContext;
| import React from 'react';
import ModalContext from './context';
// eslint-disable-next-line
import { IModalContext } from './types';
const withModalContext = <T extends object>(Component: React.ComponentType<T>): React.ComponentType<T> => {
class ComponentHOC extends React.Component<T> {
modal: React.RefObject<any>;
instance: React.ComponentType<T>;
constructor(props: T) {
super(props);
this.modal = React.createRef();
}
static get displayName() {
return `withModalContext(${Component.displayName || Component.name})`;
}
openModal = () => {
$(this.modal.current).modal('show');
// trick because we use custom styles
// for modal coming from superdesk
$('.modal-backdrop').addClass('modal__backdrop');
}
closeModal = () => {
$(this.modal.current).modal('hide');
}
render() {
const modalStore: IModalContext = {
openModal: this.openModal,
closeModal: this.closeModal,
modalRef: this.modal,
};
return (
<ModalContext.Provider value={modalStore}>
<Component {...this.props} ref={(el) => this.instance = el} />
</ModalContext.Provider>
);
}
}
return ComponentHOC as any;
};
export default withModalContext;
| Fix tslint issue in test env | Fix tslint issue in test env
This issue is not possible to be reproduced in local. I have tried so many things and I was not able to reproduce it :(
| TypeScript | agpl-3.0 | liveblog/liveblog,liveblog/liveblog,liveblog/liveblog,liveblog/liveblog,liveblog/liveblog | ---
+++
@@ -46,7 +46,7 @@
}
}
- return ComponentHOC;
+ return ComponentHOC as any;
};
export default withModalContext; |
061f2efde8d3b81fbf4d5d419627b83275f0d580 | server/services/database/database.service.ts | server/services/database/database.service.ts | import { Service } from 'ts-express-decorators';
import { IDatabaseConnector, QueryType } from './database.connector';
import { SQLiteConnector } from './sqlite.connector';
import { populationQueries } from './population-queries';
@Service()
export class DatabaseService {
private databaseConnector: IDatabaseConnector;
constructor() {
let db = new SQLiteConnector('./countable-database.sqlite', true);
populationQueries.forEach(function (query) {
db.executeQuery(QueryType.INSERT, query, []);
});
this.databaseConnector = db;
}
public select(query: string, ...params: any[]): Promise<any[]> {
return this.databaseConnector.executeQuery(QueryType.SELECT, query, ...params);
}
public insert(query: string, ...params: any[]): Promise<any[]> {
return this.databaseConnector.executeQuery(QueryType.INSERT, query, ...params);
}
public update(query: string, ...params: any[]): Promise<any[]> {
return this.databaseConnector.executeQuery(QueryType.UPDATE, query, ...params);
}
public delete(query: string, ...params: any[]): Promise<any[]> {
return this.databaseConnector.executeQuery(QueryType.DELETE, query, ...params);
}
}
| import { Service } from 'ts-express-decorators';
import { IDatabaseConnector, QueryType } from './database.connector';
import { SQLiteConnector } from './sqlite.connector';
import { populationQueries } from './population-queries';
@Service()
export class DatabaseService {
private databaseConnector: IDatabaseConnector;
constructor() {
let db = new SQLiteConnector('./countable-database.sqlite', true);
populationQueries.forEach(function (query) {
db.executeQuery(QueryType.INSERT, query, []);
});
this.databaseConnector = db;
}
/**
* Executes query with given params and returns rows
* @param query
* @param params
* @returns {Promise<any[]>}
*/
public select(query: string, ...params: any[]): Promise<any[]> {
return this.databaseConnector.executeQuery(QueryType.SELECT, query, ...params);
}
/**
* Executes query with given params and returns the unique id of the inserted element
* @param query
* @param params
* @returns {Promise<any[]>}
*/
public insert(query: string, ...params: any[]): Promise<number> {
return this.databaseConnector.executeQuery(QueryType.INSERT, query, ...params);
}
/**
* Executes query with given params and returns the number of updated rows
* @param query
* @param params
* @returns {Promise<any[]>}
*/
public update(query: string, ...params: any[]): Promise<number> {
return this.databaseConnector.executeQuery(QueryType.UPDATE, query, ...params);
}
/**
* Executes query with given params and returns the number of deleted rows
* @param query
* @param params
* @returns {Promise<any[]>}
*/
public delete(query: string, ...params: any[]): Promise<number> {
return this.databaseConnector.executeQuery(QueryType.DELETE, query, ...params);
}
}
| Add comment and update signature type | Add comment and update signature type
| TypeScript | mit | DavidLevayer/countable,DavidLevayer/countable,DavidLevayer/countable | ---
+++
@@ -17,19 +17,43 @@
this.databaseConnector = db;
}
+ /**
+ * Executes query with given params and returns rows
+ * @param query
+ * @param params
+ * @returns {Promise<any[]>}
+ */
public select(query: string, ...params: any[]): Promise<any[]> {
return this.databaseConnector.executeQuery(QueryType.SELECT, query, ...params);
}
- public insert(query: string, ...params: any[]): Promise<any[]> {
+ /**
+ * Executes query with given params and returns the unique id of the inserted element
+ * @param query
+ * @param params
+ * @returns {Promise<any[]>}
+ */
+ public insert(query: string, ...params: any[]): Promise<number> {
return this.databaseConnector.executeQuery(QueryType.INSERT, query, ...params);
}
- public update(query: string, ...params: any[]): Promise<any[]> {
+ /**
+ * Executes query with given params and returns the number of updated rows
+ * @param query
+ * @param params
+ * @returns {Promise<any[]>}
+ */
+ public update(query: string, ...params: any[]): Promise<number> {
return this.databaseConnector.executeQuery(QueryType.UPDATE, query, ...params);
}
- public delete(query: string, ...params: any[]): Promise<any[]> {
+ /**
+ * Executes query with given params and returns the number of deleted rows
+ * @param query
+ * @param params
+ * @returns {Promise<any[]>}
+ */
+ public delete(query: string, ...params: any[]): Promise<number> {
return this.databaseConnector.executeQuery(QueryType.DELETE, query, ...params);
}
} |
7305d45c27003db740e1da07e50371e5a01b83f6 | src/app/loadout/known-values.ts | src/app/loadout/known-values.ts | import {
armor2PlugCategoryHashes,
armor2PlugCategoryHashesByName,
D2ArmorStatHashByName,
} from 'app/search/d2-known-values';
import { PlugCategoryHashes } from 'data/d2/generated-enums';
export const armorStatHashes = [
D2ArmorStatHashByName.intellect,
D2ArmorStatHashByName.discipline,
D2ArmorStatHashByName.strength,
D2ArmorStatHashByName.mobility,
D2ArmorStatHashByName.recovery,
D2ArmorStatHashByName.resilience,
];
export const slotSpecificPlugCategoryHashes = [
armor2PlugCategoryHashesByName.helmet,
armor2PlugCategoryHashesByName.gauntlets,
armor2PlugCategoryHashesByName.chest,
armor2PlugCategoryHashesByName.leg,
armor2PlugCategoryHashesByName.classitem,
];
// TODO generate this somehow so we dont need to maintain it
export const raidPlugCategoryHashes = [
PlugCategoryHashes.EnhancementsSeasonOutlaw, // last wish
PlugCategoryHashes.EnhancementsRaidGarden, // garden of salvation
PlugCategoryHashes.EnhancementsRaidDescent, // deep stone crypt
PlugCategoryHashes.EnhancementsRaidV520, // vault of glass
];
export const knownModPlugCategoryHashes = [...armor2PlugCategoryHashes, ...raidPlugCategoryHashes];
| import {
armor2PlugCategoryHashes,
armor2PlugCategoryHashesByName,
D2ArmorStatHashByName,
} from 'app/search/d2-known-values';
import raidModPlugCategoryHashes from 'data/d2/raid-mod-plug-category-hashes.json';
export const armorStatHashes = [
D2ArmorStatHashByName.intellect,
D2ArmorStatHashByName.discipline,
D2ArmorStatHashByName.strength,
D2ArmorStatHashByName.mobility,
D2ArmorStatHashByName.recovery,
D2ArmorStatHashByName.resilience,
];
export const slotSpecificPlugCategoryHashes = [
armor2PlugCategoryHashesByName.helmet,
armor2PlugCategoryHashesByName.gauntlets,
armor2PlugCategoryHashesByName.chest,
armor2PlugCategoryHashesByName.leg,
armor2PlugCategoryHashesByName.classitem,
];
export const raidPlugCategoryHashes: number[] =
Array.isArray(raidModPlugCategoryHashes) &&
raidModPlugCategoryHashes.every((pch) => typeof pch === 'number')
? raidModPlugCategoryHashes
: [];
export const knownModPlugCategoryHashes = [...armor2PlugCategoryHashes, ...raidPlugCategoryHashes];
| Use generated raid plug category hashes. | Use generated raid plug category hashes.
| TypeScript | mit | delphiactual/DIM,DestinyItemManager/DIM,DestinyItemManager/DIM,delphiactual/DIM,delphiactual/DIM,DestinyItemManager/DIM,delphiactual/DIM,DestinyItemManager/DIM | ---
+++
@@ -3,7 +3,7 @@
armor2PlugCategoryHashesByName,
D2ArmorStatHashByName,
} from 'app/search/d2-known-values';
-import { PlugCategoryHashes } from 'data/d2/generated-enums';
+import raidModPlugCategoryHashes from 'data/d2/raid-mod-plug-category-hashes.json';
export const armorStatHashes = [
D2ArmorStatHashByName.intellect,
@@ -22,12 +22,10 @@
armor2PlugCategoryHashesByName.classitem,
];
-// TODO generate this somehow so we dont need to maintain it
-export const raidPlugCategoryHashes = [
- PlugCategoryHashes.EnhancementsSeasonOutlaw, // last wish
- PlugCategoryHashes.EnhancementsRaidGarden, // garden of salvation
- PlugCategoryHashes.EnhancementsRaidDescent, // deep stone crypt
- PlugCategoryHashes.EnhancementsRaidV520, // vault of glass
-];
+export const raidPlugCategoryHashes: number[] =
+ Array.isArray(raidModPlugCategoryHashes) &&
+ raidModPlugCategoryHashes.every((pch) => typeof pch === 'number')
+ ? raidModPlugCategoryHashes
+ : [];
export const knownModPlugCategoryHashes = [...armor2PlugCategoryHashes, ...raidPlugCategoryHashes]; |
e141201412fe441cc16b019530100678c6877733 | app/src/ui/changes/undo-commit.tsx | app/src/ui/changes/undo-commit.tsx | import * as React from 'react'
import { Commit } from '../../models/commit'
import { RichText } from '../lib/rich-text'
import { RelativeTime } from '../relative-time'
import { Button } from '../lib/button'
interface IUndoCommitProps {
/** The function to call when the Undo button is clicked. */
readonly onUndo: () => void
/** The commit to undo. */
readonly commit: Commit
readonly emoji: Map<string, string>
}
/** The Undo Commit component. */
export class UndoCommit extends React.Component<IUndoCommitProps, void> {
public render() {
const authorDate = this.props.commit.author.date
return (
<div id='undo-commit'>
<div className='commit-info'>
<div className='ago'>Committed <RelativeTime date={authorDate} /></div>
<RichText
emoji={this.props.emoji}
className='summary'
text={this.props.commit.summary} />
</div>
<div className='actions'>
<Button size='small' onClick={this.props.onUndo}>Undo</Button>
</div>
</div>
)
}
}
| import * as React from 'react'
import { Commit } from '../../models/commit'
import { RichText } from '../lib/rich-text'
import { RelativeTime } from '../relative-time'
import { Button } from '../lib/button'
interface IUndoCommitProps {
/** The function to call when the Undo button is clicked. */
readonly onUndo: () => void
/** The commit to undo. */
readonly commit: Commit
readonly emoji: Map<string, string>
}
/** The Undo Commit component. */
export class UndoCommit extends React.Component<IUndoCommitProps, void> {
public render() {
const authorDate = this.props.commit.author.date
return (
<div id='undo-commit' role='group' aria-label='Undo commit'>
<div className='commit-info'>
<div className='ago'>Committed <RelativeTime date={authorDate} /></div>
<RichText
emoji={this.props.emoji}
className='summary'
text={this.props.commit.summary} />
</div>
<div className='actions'>
<Button size='small' onClick={this.props.onUndo}>Undo</Button>
</div>
</div>
)
}
}
| Mark up the undo section as a group | Mark up the undo section as a group
See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_group_role
| TypeScript | mit | say25/desktop,kactus-io/kactus,BugTesterTest/desktops,artivilla/desktop,hjobrien/desktop,shiftkey/desktop,hjobrien/desktop,BugTesterTest/desktops,desktop/desktop,j-f1/forked-desktop,artivilla/desktop,j-f1/forked-desktop,kactus-io/kactus,BugTesterTest/desktops,artivilla/desktop,j-f1/forked-desktop,hjobrien/desktop,gengjiawen/desktop,j-f1/forked-desktop,gengjiawen/desktop,shiftkey/desktop,gengjiawen/desktop,shiftkey/desktop,desktop/desktop,say25/desktop,gengjiawen/desktop,desktop/desktop,BugTesterTest/desktops,say25/desktop,hjobrien/desktop,desktop/desktop,say25/desktop,kactus-io/kactus,shiftkey/desktop,kactus-io/kactus,artivilla/desktop | ---
+++
@@ -20,7 +20,7 @@
public render() {
const authorDate = this.props.commit.author.date
return (
- <div id='undo-commit'>
+ <div id='undo-commit' role='group' aria-label='Undo commit'>
<div className='commit-info'>
<div className='ago'>Committed <RelativeTime date={authorDate} /></div>
<RichText |
3d7f2231f16f3dea6315f74b25a401d1e05fba81 | app/src/container/SignIn.tsx | app/src/container/SignIn.tsx | import * as React from "react";
import { Github } from "react-feather";
import { connect } from "react-redux";
import { Redirect } from "react-router-dom";
import actionCreators from "../redux/sign-in";
import "./style/SignIn.css";
interface IProps {
errorMessage: string;
halfway: boolean;
signedIn: boolean;
signIn: () => void;
}
class SignIn extends React.Component<IProps> {
public render() {
if (this.props.signedIn) {
return <Redirect to="/tasks" />;
} else if (this.props.halfway) {
return <div className="SignIn-container">Signing in...</div>;
}
return (
<div className="SignIn-container">
<div className="SignIn-main-container">
<div className="SignIn-title">code2d</div>
<div className="SignIn-description">
Productivity tools for software engineers.
</div>
</div>
<button className="SignIn-button" onClick={this.props.signIn}>
<div className="SignIn-icon"><Github /></div>
Sign in with GitHub
</button>
</div>
);
}
}
export default connect(
({ authState, signIn }) => ({ ...authState, ...signIn }),
actionCreators,
)(SignIn);
| import * as React from "react";
import { Github } from "react-feather";
import { connect } from "react-redux";
import { Redirect } from "react-router-dom";
import actionCreators from "../redux/sign-in";
import "./style/SignIn.css";
interface IProps {
error: Error;
halfway: boolean;
signedIn: boolean;
signIn: () => void;
}
class SignIn extends React.Component<IProps> {
public render() {
if (this.props.signedIn) {
return <Redirect to="/tasks" />;
} else if (this.props.halfway) {
return <div className="SignIn-container">Signing in...</div>;
}
return (
<div className="SignIn-container">
<div className="SignIn-main-container">
<div className="SignIn-title">code2d</div>
<div className="SignIn-description">
Productivity tools for software engineers.
</div>
</div>
<button className="SignIn-button" onClick={this.props.signIn}>
<div className="SignIn-icon"><Github /></div>
Sign in with GitHub
</button>
</div>
);
}
}
export default connect(
({ authState, signIn }) => ({ ...authState, ...signIn }),
actionCreators,
)(SignIn);
| Fix error prop of sign-in page | Fix error prop of sign-in page
| TypeScript | mit | raviqqe/code2d,raviqqe/code2d,raviqqe/code2d,raviqqe/code2d | ---
+++
@@ -7,7 +7,7 @@
import "./style/SignIn.css";
interface IProps {
- errorMessage: string;
+ error: Error;
halfway: boolean;
signedIn: boolean;
signIn: () => void; |
7b345cd513d7e56dc15134df67c44635bee42bf1 | packages/bms/src/notes/channels.ts | packages/bms/src/notes/channels.ts | export const IIDX_P1 = {
'11': '1',
'12': '2',
'13': '3',
'14': '4',
'15': '5',
'18': '6',
'19': '7',
'16': 'SC',
}
export const IIDX_DP = {
'11': 'L1',
'12': 'L2',
'13': 'L3',
'14': 'L4',
'15': 'l5',
'18': 'l6',
'19': 'L7',
'16': 'LSC',
'21': 'R1',
'22': 'R2',
'23': 'R3',
'24': 'R4',
'25': 'R5',
'28': 'R6',
'29': 'R7',
'26': 'RSC',
}
| export const IIDX_P1 = {
'11': '1',
'12': '2',
'13': '3',
'14': '4',
'15': '5',
'18': '6',
'19': '7',
'16': 'SC',
}
export const IIDX_DP = {
'11': '1',
'12': '2',
'13': '3',
'14': '4',
'15': '5',
'18': '6',
'19': '7',
'16': 'SC',
'21': '8',
'22': '9',
'23': '10',
'24': '11',
'25': '12',
'28': '13',
'29': '14',
'26': 'SC2',
}
| Update keymap number for DP | Update keymap number for DP
| TypeScript | agpl-3.0 | bemusic/bemuse,bemusic/bemuse,bemusic/bemuse,bemusic/bemuse,bemusic/bemuse | ---
+++
@@ -10,21 +10,21 @@
}
export const IIDX_DP = {
- '11': 'L1',
- '12': 'L2',
- '13': 'L3',
- '14': 'L4',
- '15': 'l5',
- '18': 'l6',
- '19': 'L7',
- '16': 'LSC',
+ '11': '1',
+ '12': '2',
+ '13': '3',
+ '14': '4',
+ '15': '5',
+ '18': '6',
+ '19': '7',
+ '16': 'SC',
- '21': 'R1',
- '22': 'R2',
- '23': 'R3',
- '24': 'R4',
- '25': 'R5',
- '28': 'R6',
- '29': 'R7',
- '26': 'RSC',
+ '21': '8',
+ '22': '9',
+ '23': '10',
+ '24': '11',
+ '25': '12',
+ '28': '13',
+ '29': '14',
+ '26': 'SC2',
} |
4277d91aa4acc36b18a5232c0661a06a4b5f3c54 | app/src/setupTests.ts | app/src/setupTests.ts | import "raf/polyfill";
import * as enzyme from "enzyme";
import Adapter = require("enzyme-adapter-react-16");
enzyme.configure({ adapter: new Adapter() });
class LocalStorageMock {
// https://stackoverflow.com/questions/32911630/how-do-i-deal-with-localstorage-in-jest-tests
private store: { [key: string]: any } = {};
public clear() {
this.store = {};
}
public getItem(key) {
return this.store[key] || null;
}
public setItem(key, value) {
this.store[key] = value.toString();
}
public removeItem(key) {
delete this.store[key];
}
}
(global as any).localStorage = new LocalStorageMock();
(global as any).Notification = class {
public static permission = "granted";
public static requestPermission() {
// Do nothing.
}
};
| import "raf/polyfill";
import * as enzyme from "enzyme";
import Adapter = require("enzyme-adapter-react-16");
enzyme.configure({ adapter: new Adapter() });
class LocalStorageMock {
// https://stackoverflow.com/questions/32911630/how-do-i-deal-with-localstorage-in-jest-tests
private store: { [key: string]: any } = {};
public clear() {
this.store = {};
}
public getItem(key) {
return this.store[key] || null;
}
public setItem(key, value) {
this.store[key] = value.toString();
}
public removeItem(key) {
delete this.store[key];
}
}
(global as any).localStorage = new LocalStorageMock();
(global as any).Notification = class {
public static permission = "granted";
public static requestPermission() {
// Do nothing.
}
};
(window as any).matchMedia = () => ({ matches: true });
| Set up polyfill of matchMedia | Set up polyfill of matchMedia
| TypeScript | mit | raviqqe/code2d,raviqqe/code2d,raviqqe/code2d,raviqqe/code2d | ---
+++
@@ -36,3 +36,5 @@
// Do nothing.
}
};
+
+(window as any).matchMedia = () => ({ matches: true }); |
52a2e103e0e9221b281d89ce08c3b3e8c12069e4 | src/client/src/rt-components/Environment/EnvironmentContext.tsx | src/client/src/rt-components/Environment/EnvironmentContext.tsx | import React from 'react'
export interface EnvironmentValue<Provider extends Window = Window> {
provider: Provider
openfin?: Provider | null
[key: string]: Provider | null
}
export interface Window {
type: string | 'desktop' | 'browser'
platform: string | 'openfin' | 'browser'
maximize: () => void
minimize: () => void
close: () => void
open: (url: string) => void
[key: string]: any
}
export function createEnvironment<Provider extends Window>(provider: any): EnvironmentValue<Provider> {
return {
provider,
get [provider.platform]() {
return provider && provider.isPresent ? provider : null
},
}
}
export const Environment = React.createContext<EnvironmentValue<Window>>(
createEnvironment<Window>({
type: 'browser',
platform: 'browser',
maximize: () => {},
minimize: () => {},
close: () => {},
open: () => {},
}),
)
export default Environment
| import React from 'react'
export interface EnvironmentValue<Provider extends WindowProvider = WindowProvider> {
provider: Provider
openfin?: Provider | null
[key: string]: Provider | null
}
export interface WindowProvider {
type: string | 'desktop' | 'browser'
platform: string | 'openfin' | 'browser'
maximize: () => void
minimize: () => void
close: () => void
open: (url: string) => void
[key: string]: any
}
export function createEnvironment<Provider extends WindowProvider>(provider: any): EnvironmentValue<Provider> {
return {
provider,
get [provider.platform]() {
return provider && provider.isPresent ? provider : null
},
}
}
export const Environment = React.createContext<EnvironmentValue<WindowProvider>>(
createEnvironment<WindowProvider>({
type: 'browser',
platform: 'browser',
maximize: () => {},
minimize: () => {},
close: () => {},
open: () => {},
}),
)
export default Environment
| Rename the Window type to WindowProvider | Rename the Window type to WindowProvider
| TypeScript | apache-2.0 | AdaptiveConsulting/ReactiveTraderCloud,AdaptiveConsulting/ReactiveTraderCloud,AdaptiveConsulting/ReactiveTraderCloud,AdaptiveConsulting/ReactiveTraderCloud | ---
+++
@@ -1,12 +1,12 @@
import React from 'react'
-export interface EnvironmentValue<Provider extends Window = Window> {
+export interface EnvironmentValue<Provider extends WindowProvider = WindowProvider> {
provider: Provider
openfin?: Provider | null
[key: string]: Provider | null
}
-export interface Window {
+export interface WindowProvider {
type: string | 'desktop' | 'browser'
platform: string | 'openfin' | 'browser'
maximize: () => void
@@ -16,7 +16,7 @@
[key: string]: any
}
-export function createEnvironment<Provider extends Window>(provider: any): EnvironmentValue<Provider> {
+export function createEnvironment<Provider extends WindowProvider>(provider: any): EnvironmentValue<Provider> {
return {
provider,
get [provider.platform]() {
@@ -25,8 +25,8 @@
}
}
-export const Environment = React.createContext<EnvironmentValue<Window>>(
- createEnvironment<Window>({
+export const Environment = React.createContext<EnvironmentValue<WindowProvider>>(
+ createEnvironment<WindowProvider>({
type: 'browser',
platform: 'browser',
maximize: () => {}, |
fd5c7bbafb436fa8a30209ea6e65d2ca71d159af | components/Header.tsx | components/Header.tsx | import Link from "next/link"
import { Fragment } from "react"
import HorizontalRule from "./HorizontalRule"
const Header = () => (
<Fragment>
<header>
<nav>
<Link href="/">
<a>Home</a>
</Link>
<Link href="/apps/">
<a>Apps</a>
</Link>
<Link href="/posts/">
<a>Posts</a>
</Link>
</nav>
<HorizontalRule />
</header>
<style jsx>{`
nav {
margin-top: 8px;
display: flex;
justify-content: center;
}
a {
padding: 8px;
font-size: 1.5em;
text-decoration: none;
}
a:hover,
a:active {
text-decoration: underline;
}
`}</style>
</Fragment>
)
export default Header
| import Link from "next/link"
import { Fragment } from "react"
import HorizontalRule from "./HorizontalRule"
const Header = () => (
<Fragment>
<header>
<nav>
<Link href="/">
<a>Home</a>
</Link>
<Link href="/apps">
<a>Apps</a>
</Link>
<Link href="/posts">
<a>Posts</a>
</Link>
</nav>
<HorizontalRule />
</header>
<style jsx>{`
nav {
margin-top: 8px;
display: flex;
justify-content: center;
}
a {
padding: 8px;
font-size: 1.5em;
text-decoration: none;
}
a:hover,
a:active {
text-decoration: underline;
}
`}</style>
</Fragment>
)
export default Header
| Remove trailing slash from /apps and /posts links | Remove trailing slash from /apps and /posts links
| TypeScript | mit | JosephDuffy/josephduffy.co.uk,JosephDuffy/josephduffy.co.uk,JosephDuffy/josephduffy.co.uk | ---
+++
@@ -9,10 +9,10 @@
<Link href="/">
<a>Home</a>
</Link>
- <Link href="/apps/">
+ <Link href="/apps">
<a>Apps</a>
</Link>
- <Link href="/posts/">
+ <Link href="/posts">
<a>Posts</a>
</Link>
</nav> |
eae82cc289c5a3935c829765d6fed621ac874f22 | frontend/src/app/profile/index.tsx | frontend/src/app/profile/index.tsx | /** @jsx jsx */
import { useQuery } from "@apollo/react-hooks";
import { RouteComponentProps } from "@reach/router";
import { Box } from "@theme-ui/components";
import { FormattedMessage } from "react-intl";
import { jsx } from "theme-ui";
import { MyProfileQuery } from "../../generated/graphql-backend";
import MY_PROFILE_QUERY from "./profile.graphql";
export const ProfileApp: React.SFC<RouteComponentProps> = () => {
const { loading, error, data: profileData } = useQuery<MyProfileQuery>(
MY_PROFILE_QUERY,
);
if (error) {
throw new Error(`Unable to fetch profile, ${error}`);
}
return (
<Box
sx={{
maxWidth: "container",
mx: "auto",
}}
>
<h1>
<FormattedMessage id="profile.header" />
</h1>
{loading && "Loading..."}
{!loading && (
<dl>
<dt>
<FormattedMessage id="profile.email" />
</dt>
<dd>{profileData!.me.email}</dd>
</dl>
)}
</Box>
);
};
| /** @jsx jsx */
import { useQuery } from "@apollo/react-hooks";
import { navigate, RouteComponentProps } from "@reach/router";
import { Box } from "@theme-ui/components";
import { useEffect } from "react";
import { FormattedMessage } from "react-intl";
import { jsx } from "theme-ui";
import { useCurrentLanguage } from "../../context/language";
import { MyProfileQuery } from "../../generated/graphql-backend";
import { useLoginState } from "./hooks";
import MY_PROFILE_QUERY from "./profile.graphql";
export const ProfileApp: React.SFC<RouteComponentProps> = () => {
const [_, setLoginState] = useLoginState(false);
const lang = useCurrentLanguage();
const { loading, error, data: profileData } = useQuery<MyProfileQuery>(
MY_PROFILE_QUERY,
);
useEffect(() => {
const loginUrl = `/${lang}/login`;
if (error) {
setLoginState(false);
navigate(loginUrl);
}
}, [error]);
if (error) {
return null;
}
return (
<Box
sx={{
maxWidth: "container",
mx: "auto",
}}
>
<h1>
<FormattedMessage id="profile.header" />
</h1>
{loading && "Loading..."}
{!loading && (
<dl>
<dt>
<FormattedMessage id="profile.email" />
</dt>
<dd>{profileData!.me.email}</dd>
</dl>
)}
</Box>
);
};
| Fix issue when not logged in | Fix issue when not logged in
| TypeScript | mit | patrick91/pycon,patrick91/pycon | ---
+++
@@ -1,20 +1,36 @@
/** @jsx jsx */
import { useQuery } from "@apollo/react-hooks";
-import { RouteComponentProps } from "@reach/router";
+import { navigate, RouteComponentProps } from "@reach/router";
import { Box } from "@theme-ui/components";
+import { useEffect } from "react";
import { FormattedMessage } from "react-intl";
import { jsx } from "theme-ui";
+import { useCurrentLanguage } from "../../context/language";
import { MyProfileQuery } from "../../generated/graphql-backend";
+import { useLoginState } from "./hooks";
import MY_PROFILE_QUERY from "./profile.graphql";
export const ProfileApp: React.SFC<RouteComponentProps> = () => {
+ const [_, setLoginState] = useLoginState(false);
+ const lang = useCurrentLanguage();
+
const { loading, error, data: profileData } = useQuery<MyProfileQuery>(
MY_PROFILE_QUERY,
);
+ useEffect(() => {
+ const loginUrl = `/${lang}/login`;
+
+ if (error) {
+ setLoginState(false);
+
+ navigate(loginUrl);
+ }
+ }, [error]);
+
if (error) {
- throw new Error(`Unable to fetch profile, ${error}`);
+ return null;
}
return ( |
81003c50c09539a7cecf2e7098fea672a5682ab7 | quicklaunch_ru.ts | quicklaunch_ru.ts | <?xml version="1.0" ?><!DOCTYPE TS><TS language="ru" version="2.0">
<context>
<name>QuickLaunchButton</name>
<message>
<source>Move left</source>
<translation>Сдвинуть влево</translation>
</message>
<message>
<source>Move right</source>
<translation>Сдвинуть вправо</translation>
</message>
<message>
<source>Remove from quicklaunch</source>
<translation>Удалить из быстрого запуска</translation>
</message>
</context>
<context>
<name>LxQtQuickLaunch</name>
<message>
<source>Drop Error</source>
<translation>Бросьте ошибки</translation>
</message>
<message>
<source>File/URL '%1' cannot be embedded into QuickLaunch for now</source>
<translation>Файл/URL-адрес '%1' не может быть встроена в быстрого запуска сейчас</translation>
</message>
</context>
</TS> | <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ru">
<context>
<name>LxQtQuickLaunch</name>
<message>
<location filename="../lxqtquicklaunch.cpp" line="222"/>
<source>Drop Error</source>
<translation>Ошибка бросания</translation>
</message>
<message>
<location filename="../lxqtquicklaunch.cpp" line="223"/>
<source>File/URL '%1' cannot be embedded into QuickLaunch for now</source>
<translation>Файл/URL-адрес '%1' не может быть встроен в быстрый запуск сейчас</translation>
</message>
<message>
<location filename="../lxqtquicklaunch.cpp" line="327"/>
<source>Drop application
icons here</source>
<translation>Бросьте значки
приложений сюда</translation>
</message>
</context>
<context>
<name>QuickLaunchButton</name>
<message>
<location filename="../quicklaunchbutton.cpp" line="53"/>
<source>Move left</source>
<translation>Сдвинуть влево</translation>
</message>
<message>
<location filename="../quicklaunchbutton.cpp" line="56"/>
<source>Move right</source>
<translation>Сдвинуть вправо</translation>
</message>
<message>
<location filename="../quicklaunchbutton.cpp" line="60"/>
<source>Remove from quicklaunch</source>
<translation>Удалить из быстрого запуска</translation>
</message>
</context>
</TS>
| Revert "Commit from LXDE Pootle server by user LStranger.: 391 of 391 strings translated (0 need review)." | Revert "Commit from LXDE Pootle server by user LStranger.: 391 of 391 strings translated (0 need review)."
This reverts commit d538764d91b1cf3ea993cdf0d6200eea2b2c9384.
It appeared this change was wrong because it was out of sync.
| TypeScript | lgpl-2.1 | lxde/lxqt-l10n | ---
+++
@@ -1,28 +1,42 @@
-<?xml version="1.0" ?><!DOCTYPE TS><TS language="ru" version="2.0">
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.1" language="ru">
+<context>
+ <name>LxQtQuickLaunch</name>
+ <message>
+ <location filename="../lxqtquicklaunch.cpp" line="222"/>
+ <source>Drop Error</source>
+ <translation>Ошибка бросания</translation>
+ </message>
+ <message>
+ <location filename="../lxqtquicklaunch.cpp" line="223"/>
+ <source>File/URL '%1' cannot be embedded into QuickLaunch for now</source>
+ <translation>Файл/URL-адрес '%1' не может быть встроен в быстрый запуск сейчас</translation>
+ </message>
+ <message>
+ <location filename="../lxqtquicklaunch.cpp" line="327"/>
+ <source>Drop application
+icons here</source>
+ <translation>Бросьте значки
+приложений сюда</translation>
+ </message>
+</context>
<context>
<name>QuickLaunchButton</name>
<message>
+ <location filename="../quicklaunchbutton.cpp" line="53"/>
<source>Move left</source>
<translation>Сдвинуть влево</translation>
</message>
<message>
+ <location filename="../quicklaunchbutton.cpp" line="56"/>
<source>Move right</source>
<translation>Сдвинуть вправо</translation>
</message>
<message>
+ <location filename="../quicklaunchbutton.cpp" line="60"/>
<source>Remove from quicklaunch</source>
<translation>Удалить из быстрого запуска</translation>
</message>
</context>
-<context>
- <name>LxQtQuickLaunch</name>
- <message>
- <source>Drop Error</source>
- <translation>Бросьте ошибки</translation>
- </message>
- <message>
- <source>File/URL '%1' cannot be embedded into QuickLaunch for now</source>
- <translation>Файл/URL-адрес '%1' не может быть встроена в быстрого запуска сейчас</translation>
- </message>
-</context>
</TS> |
60fc2923ba5eef81a292c5ad892bd0f7f59447cd | src/components/Output.tsx | src/components/Output.tsx | export const Output = ({
result,
reset,
}: {
result: string;
reset: () => void;
}) => {
return (
<>
<div className="results">
<button data-testid="reset" onClick={reset} className="button">
Restart
</button>
<a
href={`data:text/plain;charset=utf-8,${encodeURIComponent(result)}`}
download="ascii.txt"
data-testid="output-download"
className="result__download button icon-arrow-down"
>
Download
</a>
<pre
data-testid="result"
className="result"
style={{ fontSize: '4px' }}
>
<code>{result}</code>
</pre>
</div>
</>
);
};
| export const Output = ({
result,
reset,
}: {
result: string;
reset: () => void;
}) => {
return (
<>
<div className="results">
<button
data-testid="reset"
onClick={reset}
className="button--secondary"
>
Restart
</button>
<a
href={`data:text/plain;charset=utf-8,${encodeURIComponent(result)}`}
download="ascii.txt"
data-testid="output-download"
className="result__download button icon-arrow-down"
>
Download
</a>
<pre
data-testid="result"
className="result"
style={{ fontSize: '4px' }}
>
<code>{result}</code>
</pre>
</div>
</>
);
};
| Fix text restart btn styling | Fix text restart btn styling
| TypeScript | mit | whostolemyhat/ascii-react,whostolemyhat/ascii-react,whostolemyhat/ascii-react | ---
+++
@@ -8,7 +8,11 @@
return (
<>
<div className="results">
- <button data-testid="reset" onClick={reset} className="button">
+ <button
+ data-testid="reset"
+ onClick={reset}
+ className="button--secondary"
+ >
Restart
</button>
<a |
8cf34a1a2de5f7abc5d022f36122e74f4a2d84a1 | frontend/src/app/code-snippet/code-snippet.component.spec.ts | frontend/src/app/code-snippet/code-snippet.component.spec.ts | /*
* Copyright (c) 2014-2021 Bjoern Kimminich.
* SPDX-License-Identifier: MIT
*/
import { TranslateModule } from '@ngx-translate/core'
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog'
import { HttpClientTestingModule } from '@angular/common/http/testing'
import { MatDividerModule } from '@angular/material/divider'
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'
import { CodeSnippetComponent } from './code-snippet.component'
import { CodeSnippetService } from '../Services/code-snippet.service'
describe('UserDetailsComponent', () => {
let component: CodeSnippetComponent
let fixture: ComponentFixture<CodeSnippetComponent>
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
TranslateModule.forRoot(),
HttpClientTestingModule,
MatDividerModule,
MatDialogModule
],
declarations: [CodeSnippetComponent],
providers: [
CodeSnippetService,
{ provide: MatDialogRef, useValue: {} },
{ provide: MAT_DIALOG_DATA, useValue: { dialogData: {} } }
]
})
.compileComponents()
}))
beforeEach(() => {
fixture = TestBed.createComponent(CodeSnippetComponent)
component = fixture.componentInstance
fixture.detectChanges()
})
it('should create', () => {
expect(component).toBeTruthy()
})
})
| /*
* Copyright (c) 2014-2021 Bjoern Kimminich.
* SPDX-License-Identifier: MIT
*/
import { TranslateModule } from '@ngx-translate/core'
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog'
import { HttpClientTestingModule } from '@angular/common/http/testing'
import { MatDividerModule } from '@angular/material/divider'
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing'
import { CodeSnippetComponent } from './code-snippet.component'
import { CodeSnippetService } from '../Services/code-snippet.service'
import { CookieModule, CookieService } from 'ngx-cookie'
describe('CodeSnippetComponent', () => {
let component: CodeSnippetComponent
let fixture: ComponentFixture<CodeSnippetComponent>
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
CookieModule.forRoot(),
TranslateModule.forRoot(),
HttpClientTestingModule,
MatDividerModule,
MatDialogModule
],
declarations: [CodeSnippetComponent],
providers: [
CodeSnippetService,
CookieService,
{ provide: MatDialogRef, useValue: {} },
{ provide: MAT_DIALOG_DATA, useValue: { dialogData: {} } }
]
})
.compileComponents()
TestBed.inject(CookieService)
}))
beforeEach(() => {
fixture = TestBed.createComponent(CodeSnippetComponent)
component = fixture.componentInstance
fixture.detectChanges()
})
it('should create', () => {
expect(component).toBeTruthy()
})
})
| Add missing cookie service to test bed | Add missing cookie service to test bed
| TypeScript | mit | bkimminich/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop | ---
+++
@@ -11,14 +11,16 @@
import { CodeSnippetComponent } from './code-snippet.component'
import { CodeSnippetService } from '../Services/code-snippet.service'
+import { CookieModule, CookieService } from 'ngx-cookie'
-describe('UserDetailsComponent', () => {
+describe('CodeSnippetComponent', () => {
let component: CodeSnippetComponent
let fixture: ComponentFixture<CodeSnippetComponent>
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
+ CookieModule.forRoot(),
TranslateModule.forRoot(),
HttpClientTestingModule,
MatDividerModule,
@@ -27,11 +29,13 @@
declarations: [CodeSnippetComponent],
providers: [
CodeSnippetService,
+ CookieService,
{ provide: MatDialogRef, useValue: {} },
{ provide: MAT_DIALOG_DATA, useValue: { dialogData: {} } }
]
})
.compileComponents()
+ TestBed.inject(CookieService)
}))
beforeEach(() => { |
16a5177178c67999bc4bd7e8f7e60eaafe395da4 | packages/components/components/miniCalendar/LocalizedMiniCalendar.tsx | packages/components/components/miniCalendar/LocalizedMiniCalendar.tsx | import React, { useMemo, useCallback } from 'react';
import { c } from 'ttag';
import { getFormattedMonths, getFormattedWeekdays, getWeekStartsOn } from 'proton-shared/lib/date/date';
import { dateLocale } from 'proton-shared/lib/i18n';
import { format } from 'date-fns';
import MiniCalendar, { Props as MiniCalProps } from './MiniCalendar';
export type Props = MiniCalProps;
const LocalizedMiniCalendar = ({ weekStartsOn, ...rest }: Props) => {
const weekdaysLong = useMemo(() => {
return getFormattedWeekdays('cccc', { locale: dateLocale });
}, [dateLocale]);
const weekdaysShort = useMemo(() => {
return getFormattedWeekdays('ccccc', { locale: dateLocale });
}, [dateLocale]);
const months = useMemo(() => {
return getFormattedMonths('MMMM', { locale: dateLocale });
}, [dateLocale]);
const formatDay = useCallback(
(date) => {
return format(date, 'PPPP', { locale: dateLocale });
},
[dateLocale]
);
return (
<MiniCalendar
nextMonth={c('Action').t`Next month`}
prevMonth={c('Action').t`Previous month`}
weekdaysLong={weekdaysLong}
weekdaysShort={weekdaysShort}
months={months}
weekStartsOn={weekStartsOn !== undefined ? weekStartsOn : getWeekStartsOn(dateLocale)}
formatDay={formatDay}
{...rest}
/>
);
};
export default LocalizedMiniCalendar;
| import React, { useMemo, useCallback } from 'react';
import { c } from 'ttag';
import { getFormattedMonths, getFormattedWeekdays, getWeekStartsOn } from 'proton-shared/lib/date/date';
import { dateLocale } from 'proton-shared/lib/i18n';
import { format } from 'date-fns';
import MiniCalendar, { Props as MiniCalProps } from './MiniCalendar';
export type Props = MiniCalProps;
const LocalizedMiniCalendar = ({ weekStartsOn, ...rest }: Props) => {
const weekdaysLong = useMemo(() => {
return getFormattedWeekdays('cccc', { locale: dateLocale });
}, [dateLocale]);
const weekdaysShort = useMemo(() => {
return getFormattedWeekdays('ccccc', { locale: dateLocale });
}, [dateLocale]);
const months = useMemo(() => {
return getFormattedMonths('LLLL', { locale: dateLocale });
}, [dateLocale]);
const formatDay = useCallback(
(date) => {
return format(date, 'PPPP', { locale: dateLocale });
},
[dateLocale]
);
return (
<MiniCalendar
nextMonth={c('Action').t`Next month`}
prevMonth={c('Action').t`Previous month`}
weekdaysLong={weekdaysLong}
weekdaysShort={weekdaysShort}
months={months}
weekStartsOn={weekStartsOn !== undefined ? weekStartsOn : getWeekStartsOn(dateLocale)}
formatDay={formatDay}
{...rest}
/>
);
};
export default LocalizedMiniCalendar;
| Use standalone version for months in minicalendar | Use standalone version for months in minicalendar
CALWEB-2393
| TypeScript | mit | ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient | ---
+++
@@ -18,7 +18,7 @@
}, [dateLocale]);
const months = useMemo(() => {
- return getFormattedMonths('MMMM', { locale: dateLocale });
+ return getFormattedMonths('LLLL', { locale: dateLocale });
}, [dateLocale]);
const formatDay = useCallback( |
863a4d09cf218ea032d171cdf56269a07d22990b | src/components/ItemContext.spec.tsx | src/components/ItemContext.spec.tsx | import { mount } from 'enzyme';
import * as React from 'react';
import { Consumer, Provider } from './ItemContext';
describe('ItemContext', () => {
it('Propagates uuid by context', () => {
const mock = jest.fn(() => null);
const uuid = 'foo';
mount(
<Provider uuid={uuid}>
<Consumer>{mock}</Consumer>
</Provider>,
).instance();
expect(mock).toHaveBeenCalledWith(
expect.objectContaining({
uuid,
}),
);
});
it('renders Provider without children', () => {
expect(() => mount(<Provider uuid="foo" />)).not.toThrow();
});
});
| import * as React from 'react';
import { render } from 'react-testing-library';
import Accordion from './Accordion';
import { Consumer, Provider } from './ItemContext';
describe('ItemContext', () => {
it('renders children props', () => {
const { getByText } = render(
<Accordion>
<Provider uuid="FOO">
<Consumer>{(): string => 'Hello World'}</Consumer>
</Provider>
</Accordion>,
);
expect(getByText('Hello World')).toBeTruthy();
});
});
| Remove implementation details from ItemContext tests | Remove implementation details from ItemContext tests
| TypeScript | mit | springload/react-accessible-accordion,springload/react-accessible-accordion,springload/react-accessible-accordion | ---
+++
@@ -1,26 +1,18 @@
-import { mount } from 'enzyme';
import * as React from 'react';
+import { render } from 'react-testing-library';
+import Accordion from './Accordion';
import { Consumer, Provider } from './ItemContext';
describe('ItemContext', () => {
- it('Propagates uuid by context', () => {
- const mock = jest.fn(() => null);
- const uuid = 'foo';
+ it('renders children props', () => {
+ const { getByText } = render(
+ <Accordion>
+ <Provider uuid="FOO">
+ <Consumer>{(): string => 'Hello World'}</Consumer>
+ </Provider>
+ </Accordion>,
+ );
- mount(
- <Provider uuid={uuid}>
- <Consumer>{mock}</Consumer>
- </Provider>,
- ).instance();
-
- expect(mock).toHaveBeenCalledWith(
- expect.objectContaining({
- uuid,
- }),
- );
- });
-
- it('renders Provider without children', () => {
- expect(() => mount(<Provider uuid="foo" />)).not.toThrow();
+ expect(getByText('Hello World')).toBeTruthy();
});
}); |
f52c214fb708ea4d7ded8131fadc25cf81135fc7 | packages/react-alert/src/index.tsx | packages/react-alert/src/index.tsx | import React from 'react';
import classnames from 'classnames';
import Modal, { ModalProps } from '@uiw/react-modal';
import { IProps } from '@uiw/utils';
import './style/index.less';
export interface AlertProps extends IProps, ModalProps {
width?: number;
}
export default (props: AlertProps = {}) => {
const { prefixCls = 'w-alert', className, ...other } = props;
return (
<Modal {...other} className={classnames(prefixCls, className)}>
{props.children}
</Modal>
);
};
| import React from 'react';
import classnames from 'classnames';
import Modal, { ModalProps } from '@uiw/react-modal';
import { IProps } from '@uiw/utils';
import './style/index.less';
export interface AlertProps extends IProps, ModalProps {
width?: number;
}
export default (props: AlertProps = {}) => {
const { prefixCls = 'w-alert', className, width = 400, ...other } = props;
return (
<Modal
{...other}
width={width}
className={classnames(prefixCls, className)}
>
{props.children}
</Modal>
);
};
| Modify the value of width props. | fix(Alert): Modify the value of width props.
| TypeScript | mit | uiw-react/uiw,uiw-react/uiw | ---
+++
@@ -9,9 +9,13 @@
}
export default (props: AlertProps = {}) => {
- const { prefixCls = 'w-alert', className, ...other } = props;
+ const { prefixCls = 'w-alert', className, width = 400, ...other } = props;
return (
- <Modal {...other} className={classnames(prefixCls, className)}>
+ <Modal
+ {...other}
+ width={width}
+ className={classnames(prefixCls, className)}
+ >
{props.children}
</Modal>
); |
b0fb66134045b174c192e57bca62a81c56b5c7d1 | packages/components/containers/referral/rewards/RewardSection.tsx | packages/components/containers/referral/rewards/RewardSection.tsx | import { c } from 'ttag';
import { classnames, Loader, SettingsSectionWide } from '@proton/components';
import { useReferralInvitesContext } from '../ReferralInvitesContext';
import RewardsProgress from './RewardsProgress';
import RewardsTable from './table/RewardsTable';
import { getDeduplicatedReferrals } from './helpers';
const RewardSection = () => {
const {
invitedReferralsState: [invitedReferrals],
fetchedReferrals: { referrals, total, loading: loadingReferrals },
fetchedReferralStatus: { rewards, rewardsLimit, loading: loadingRewards },
} = useReferralInvitesContext();
const dedupReferrals = getDeduplicatedReferrals(referrals, invitedReferrals);
const showRewardSection = rewards > 0 || total > 0;
return (
<SettingsSectionWide>
<p className="color-weak">{c('Description')
.t`Track how many people click on your link, sign up, and become paid subscribers. Watch your free months add up.`}</p>
{loadingRewards ? (
<Loader />
) : (
<div className={classnames([showRewardSection && 'border-bottom pb1', 'mb4'])}>
{showRewardSection ? (
<RewardsProgress rewardsLimit={rewardsLimit} rewards={rewards} />
) : (
<p className="color-weak">{c('Description').t`Track your referral link activities here.`}</p>
)}
</div>
)}
<RewardsTable referrals={dedupReferrals} loading={loadingReferrals} />
</SettingsSectionWide>
);
};
export default RewardSection;
| import { c } from 'ttag';
import { Loader, SettingsSectionWide } from '@proton/components';
import { useReferralInvitesContext } from '../ReferralInvitesContext';
import RewardsProgress from './RewardsProgress';
import RewardsTable from './table/RewardsTable';
import { getDeduplicatedReferrals } from './helpers';
const RewardSection = () => {
const {
invitedReferralsState: [invitedReferrals],
fetchedReferrals: { referrals, total, loading: loadingReferrals },
fetchedReferralStatus: { rewards, rewardsLimit, loading: loadingRewards },
} = useReferralInvitesContext();
const dedupReferrals = getDeduplicatedReferrals(referrals, invitedReferrals);
const showRewardSection = rewards > 0 || total > 0;
return (
<SettingsSectionWide>
<p className="color-weak">{c('Description')
.t`Track how many people click on your link, sign up, and become paid subscribers. Watch your free months add up.`}</p>
{loadingRewards && <Loader />}
{showRewardSection && (
<div className="border-bottom pb1 mb4">
<RewardsProgress rewardsLimit={rewardsLimit} rewards={rewards} />
</div>
)}
<RewardsTable referrals={dedupReferrals} loading={loadingReferrals} />
</SettingsSectionWide>
);
};
export default RewardSection;
| Remove duplicate string in reward section | Remove duplicate string in reward section
| TypeScript | mit | ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient | ---
+++
@@ -1,6 +1,6 @@
import { c } from 'ttag';
-import { classnames, Loader, SettingsSectionWide } from '@proton/components';
+import { Loader, SettingsSectionWide } from '@proton/components';
import { useReferralInvitesContext } from '../ReferralInvitesContext';
import RewardsProgress from './RewardsProgress';
@@ -22,16 +22,10 @@
<SettingsSectionWide>
<p className="color-weak">{c('Description')
.t`Track how many people click on your link, sign up, and become paid subscribers. Watch your free months add up.`}</p>
-
- {loadingRewards ? (
- <Loader />
- ) : (
- <div className={classnames([showRewardSection && 'border-bottom pb1', 'mb4'])}>
- {showRewardSection ? (
- <RewardsProgress rewardsLimit={rewardsLimit} rewards={rewards} />
- ) : (
- <p className="color-weak">{c('Description').t`Track your referral link activities here.`}</p>
- )}
+ {loadingRewards && <Loader />}
+ {showRewardSection && (
+ <div className="border-bottom pb1 mb4">
+ <RewardsProgress rewardsLimit={rewardsLimit} rewards={rewards} />
</div>
)}
<RewardsTable referrals={dedupReferrals} loading={loadingReferrals} /> |
9f7b2861d6ec30261ae892f5a25dc99f8c0f3f47 | components/theme/preset/preset.model.ts | components/theme/preset/preset.model.ts | import { Model } from '../../model/model.service';
export class ThemePreset extends Model {
name: string;
highlight: string;
backlight: string;
notice: string;
tint?: string;
}
Model.create(ThemePreset);
export const DefaultThemePreset = new ThemePreset({
id: 0,
name: 'Game Jolt',
highlight: 'ccff00',
backlight: '2f7f6f',
notice: 'ff3fac',
});
| import { Model } from '../../model/model.service';
export class ThemePreset extends Model {
name: string;
highlight: string;
backlight: string;
notice: string;
tint?: string;
}
Model.create(ThemePreset);
| Remove default theme preset from theme preset | Remove default theme preset from theme preset
| TypeScript | mit | gamejolt/frontend-lib,gamejolt/frontend-lib,gamejolt/frontend-lib,gamejolt/frontend-lib | ---
+++
@@ -9,11 +9,3 @@
}
Model.create(ThemePreset);
-
-export const DefaultThemePreset = new ThemePreset({
- id: 0,
- name: 'Game Jolt',
- highlight: 'ccff00',
- backlight: '2f7f6f',
- notice: 'ff3fac',
-}); |
82cba55ca7b81f6532256e76ad176287776f11b0 | src/SyntaxNodes/Blockquote.ts | src/SyntaxNodes/Blockquote.ts | import { RichOutlineSyntaxNode } from './RichOutlineSyntaxNode'
import { UpDocument } from './UpDocument'
import { Writer } from '../Writing/Writer'
export class Blockquote extends RichOutlineSyntaxNode {
// As a rule, we don't want to include any blockquoted content in the table of contents.
descendantsToIncludeInTableOfContents(): UpDocument.TableOfContents.Entry[] {
return []
}
write(writer: Writer): string {
return writer.blockquote(this)
}
protected BLOCKQUOTE(): void { }
}
| import { RichOutlineSyntaxNode } from './RichOutlineSyntaxNode'
import { Writer } from '../Writing/Writer'
export class Blockquote extends RichOutlineSyntaxNode {
write(writer: Writer): string {
return writer.blockquote(this)
}
protected BLOCKQUOTE(): void { }
}
| Include headings within blockquotes in TOC | Include headings within blockquotes in TOC
| TypeScript | mit | start/up,start/up | ---
+++
@@ -1,14 +1,8 @@
import { RichOutlineSyntaxNode } from './RichOutlineSyntaxNode'
-import { UpDocument } from './UpDocument'
import { Writer } from '../Writing/Writer'
export class Blockquote extends RichOutlineSyntaxNode {
- // As a rule, we don't want to include any blockquoted content in the table of contents.
- descendantsToIncludeInTableOfContents(): UpDocument.TableOfContents.Entry[] {
- return []
- }
-
write(writer: Writer): string {
return writer.blockquote(this)
} |
3d6b18467eae8940f5834142d38f0a2d15817854 | types/hapi/v17/test/server/server-info.ts | types/hapi/v17/test/server/server-info.ts | // https://github.com/hapijs/hapi/blob/master/API.md#-serverinfo
import {Server} from "hapi";
import * as assert from "assert";
const server = new Server({
port: 8000,
});
server.start();
// check the correct port
console.log(server.info);
if (server.info) assert(server.info.port === 8000);
assert(server.info !== null);
console.log('Server started at: ' + server.info.uri);
| // https://github.com/hapijs/hapi/blob/master/API.md#-serverinfo
import {Server} from "hapi";
const server = new Server({
port: 8000,
});
server.start();
console.log(server.info);
console.log('Server started at: ' + server.info.uri);
| Remove asserts. It's not necessary here. | Remove asserts. It's not necessary here.
| TypeScript | mit | zuzusik/DefinitelyTyped,zuzusik/DefinitelyTyped,alexdresko/DefinitelyTyped,georgemarshall/DefinitelyTyped,AgentME/DefinitelyTyped,AgentME/DefinitelyTyped,arusakov/DefinitelyTyped,rolandzwaga/DefinitelyTyped,arusakov/DefinitelyTyped,alexdresko/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,rolandzwaga/DefinitelyTyped,mcliment/DefinitelyTyped,chrootsu/DefinitelyTyped,markogresak/DefinitelyTyped,magny/DefinitelyTyped,one-pieces/DefinitelyTyped,georgemarshall/DefinitelyTyped,chrootsu/DefinitelyTyped,AgentME/DefinitelyTyped,georgemarshall/DefinitelyTyped,arusakov/DefinitelyTyped,zuzusik/DefinitelyTyped,AgentME/DefinitelyTyped,georgemarshall/DefinitelyTyped,magny/DefinitelyTyped,dsebastien/DefinitelyTyped,borisyankov/DefinitelyTyped,borisyankov/DefinitelyTyped,dsebastien/DefinitelyTyped | ---
+++
@@ -1,15 +1,10 @@
// https://github.com/hapijs/hapi/blob/master/API.md#-serverinfo
import {Server} from "hapi";
-import * as assert from "assert";
const server = new Server({
port: 8000,
});
server.start();
-// check the correct port
console.log(server.info);
-if (server.info) assert(server.info.port === 8000);
-
-assert(server.info !== null);
console.log('Server started at: ' + server.info.uri); |
e4a71461cc87a3121d1ba576d3d07b2b69a9545f | packages/compile-common/src/index.ts | packages/compile-common/src/index.ts | import { Profiler } from "./profiler";
export { Profiler };
| import { Profiler } from "./profiler";
export { Profiler };
type Compilation = {
sourceIndexes: string[];
contracts: CompiledContract[];
compiler: {
name: string;
version: string;
};
};
type CompilerResult = Compilation[];
type CompiledContract = {
contractName: string;
contract_name: string;
sourcePath: string;
source: string;
sourceMap: string;
deployedSourceMap: string;
legacyAST: object;
ast: object;
abi: object[];
metadata: string;
bytecode: string;
deployedBytecode: string;
compiler: {
name: string;
version: string;
};
devdoc: object;
userdoc: object;
};
type ContractObject = {
contract_name: string;
sourcePath: string;
source: string;
sourceMap: string;
deployedSourceMap: string;
legacyAST: object;
ast: object;
abi: object[];
metadata: string;
bytecode: string;
deployedBytecode: string;
unlinked_binary: string;
compiler: {
name: string;
version: string;
};
devdoc: object;
userdoc: object;
immutableReferences;
};
interface WorkflowCompileResult {
compilations: Compilation[];
contracts: ContractObject[];
}
| Add some typings to @truffle/compile-common to be used later | Add some typings to @truffle/compile-common to be used later
| TypeScript | mit | ConsenSys/truffle | ---
+++
@@ -1,2 +1,61 @@
import { Profiler } from "./profiler";
export { Profiler };
+
+type Compilation = {
+ sourceIndexes: string[];
+ contracts: CompiledContract[];
+ compiler: {
+ name: string;
+ version: string;
+ };
+};
+
+type CompilerResult = Compilation[];
+
+type CompiledContract = {
+ contractName: string;
+ contract_name: string;
+ sourcePath: string;
+ source: string;
+ sourceMap: string;
+ deployedSourceMap: string;
+ legacyAST: object;
+ ast: object;
+ abi: object[];
+ metadata: string;
+ bytecode: string;
+ deployedBytecode: string;
+ compiler: {
+ name: string;
+ version: string;
+ };
+ devdoc: object;
+ userdoc: object;
+};
+
+type ContractObject = {
+ contract_name: string;
+ sourcePath: string;
+ source: string;
+ sourceMap: string;
+ deployedSourceMap: string;
+ legacyAST: object;
+ ast: object;
+ abi: object[];
+ metadata: string;
+ bytecode: string;
+ deployedBytecode: string;
+ unlinked_binary: string;
+ compiler: {
+ name: string;
+ version: string;
+ };
+ devdoc: object;
+ userdoc: object;
+ immutableReferences;
+};
+
+interface WorkflowCompileResult {
+ compilations: Compilation[];
+ contracts: ContractObject[];
+} |
4d5d38721a2299f7548458d4c27c21548305d3ab | src/reducers/watcherTimers.ts | src/reducers/watcherTimers.ts | import { WatcherTimerMap, WatcherTimer, GroupId } from '../types';
import {
SetWatcherTimer,
CancelWatcherTick,
DeleteWatcher
} from '../actions/watcher';
import {
SET_WATCHER_TIMER,
CANCEL_NEXT_WATCHER_TICK,
DELETE_WATCHER
} from '../constants';
import { Map } from 'immutable';
import { calculateTimeFromDelay } from '../utils/dates';
const initial: WatcherTimerMap = Map<GroupId, WatcherTimer>();
type WatcherTimerAction = CancelWatcherTick | SetWatcherTimer | DeleteWatcher;
export default (state = initial, action: WatcherTimerAction) => {
switch (action.type) {
case SET_WATCHER_TIMER:
return state.set(action.id, {
date: calculateTimeFromDelay(action.delayInSeconds),
origin: action.origin
});
case DELETE_WATCHER:
case CANCEL_NEXT_WATCHER_TICK:
return state.delete(action.groupId);
default:
return state;
}
};
| import { WatcherTimerMap, WatcherTimer, GroupId } from '../types';
import {
SetWatcherTimer,
CancelWatcherTick,
DeleteWatcher
} from '../actions/watcher';
import {
SET_WATCHER_TIMER,
CANCEL_NEXT_WATCHER_TICK,
DELETE_WATCHER,
API_LIMIT_EXCEEDED
} from '../constants';
import { Map } from 'immutable';
import { calculateTimeFromDelay } from '../utils/dates';
import { ApiRateLimitExceeded } from 'actions/api';
const initial: WatcherTimerMap = Map<GroupId, WatcherTimer>();
type WatcherTimerAction =
| CancelWatcherTick
| SetWatcherTimer
| DeleteWatcher
| ApiRateLimitExceeded;
export default (state = initial, action: WatcherTimerAction) => {
switch (action.type) {
case SET_WATCHER_TIMER:
return state.set(action.id, {
date: calculateTimeFromDelay(action.delayInSeconds),
origin: action.origin
});
case API_LIMIT_EXCEEDED:
return state.delete(action.watcherId);
case DELETE_WATCHER:
case CANCEL_NEXT_WATCHER_TICK:
return state.delete(action.groupId);
default:
return state;
}
};
| Add reducer to respond to API_LIMIT_EXCEEDED. | Add reducer to respond to API_LIMIT_EXCEEDED.
| TypeScript | mit | Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine | ---
+++
@@ -7,14 +7,20 @@
import {
SET_WATCHER_TIMER,
CANCEL_NEXT_WATCHER_TICK,
- DELETE_WATCHER
+ DELETE_WATCHER,
+ API_LIMIT_EXCEEDED
} from '../constants';
import { Map } from 'immutable';
import { calculateTimeFromDelay } from '../utils/dates';
+import { ApiRateLimitExceeded } from 'actions/api';
const initial: WatcherTimerMap = Map<GroupId, WatcherTimer>();
-type WatcherTimerAction = CancelWatcherTick | SetWatcherTimer | DeleteWatcher;
+type WatcherTimerAction =
+ | CancelWatcherTick
+ | SetWatcherTimer
+ | DeleteWatcher
+ | ApiRateLimitExceeded;
export default (state = initial, action: WatcherTimerAction) => {
switch (action.type) {
@@ -23,6 +29,8 @@
date: calculateTimeFromDelay(action.delayInSeconds),
origin: action.origin
});
+ case API_LIMIT_EXCEEDED:
+ return state.delete(action.watcherId);
case DELETE_WATCHER:
case CANCEL_NEXT_WATCHER_TICK:
return state.delete(action.groupId); |
245211f968345e0d8ffe4eeca03ed6574c2646f1 | addons/toolbars/src/components/MenuToolbar.tsx | addons/toolbars/src/components/MenuToolbar.tsx | import React, { FC } from 'react';
import { useGlobals } from '@storybook/api';
import { Icons, IconButton, WithTooltip, TooltipLinkList, TabButton } from '@storybook/components';
import { NormalizedToolbarArgType } from '../types';
export type MenuToolbarProps = NormalizedToolbarArgType & { id: string };
export const MenuToolbar: FC<MenuToolbarProps> = ({
id,
name,
description,
toolbar: { icon, items },
}) => {
const [globals, updateGlobals] = useGlobals();
const selectedValue = globals[id];
const active = selectedValue != null;
const selectedItem = active && items.find((item) => item.value === selectedValue);
const selectedIcon = (selectedItem && selectedItem.icon) || icon;
return (
<WithTooltip
placement="top"
trigger="click"
tooltip={({ onHide }) => {
const links = items.map((item) => {
const { value, left, title, right } = item;
return {
id: value,
left,
title,
right,
active: selectedValue === value,
onClick: () => {
updateGlobals({ [id]: value });
onHide();
},
};
});
return <TooltipLinkList links={links} />;
}}
closeOnClick
>
{selectedIcon ? (
<IconButton key={name} active={active} title={description}>
<Icons icon={selectedIcon} />
</IconButton>
) : (
<TabButton active={active}>{name}</TabButton>
)}
</WithTooltip>
);
};
| import React, { FC } from 'react';
import { useGlobals } from '@storybook/api';
import { Icons, IconButton, WithTooltip, TooltipLinkList, TabButton } from '@storybook/components';
import { NormalizedToolbarArgType } from '../types';
export type MenuToolbarProps = NormalizedToolbarArgType & { id: string };
export const MenuToolbar: FC<MenuToolbarProps> = ({
id,
name,
description,
toolbar: { icon, items },
showName,
}) => {
const [globals, updateGlobals] = useGlobals();
const selectedValue = globals[id];
const active = selectedValue != null;
const selectedItem = active && items.find((item) => item.value === selectedValue);
const selectedIcon = (selectedItem && selectedItem.icon) || icon;
return (
<WithTooltip
placement="top"
trigger="click"
tooltip={({ onHide }) => {
const links = items.map((item) => {
const { value, left, title, right } = item;
return {
id: value,
left,
title,
right,
active: selectedValue === value,
onClick: () => {
updateGlobals({ [id]: value });
onHide();
},
};
});
return <TooltipLinkList links={links} />;
}}
closeOnClick
>
{selectedIcon ? (
<IconButton key={name} active={active} title={description}>
<Icons icon={selectedIcon} />
{showName ? `\xa0${name}` : ``}
</IconButton>
) : (
<TabButton active={active}>{name}</TabButton>
)}
</WithTooltip>
);
};
| Add optional toolbar item label | Add optional toolbar item label
| TypeScript | mit | storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook,storybooks/storybook | ---
+++
@@ -10,6 +10,7 @@
name,
description,
toolbar: { icon, items },
+ showName,
}) => {
const [globals, updateGlobals] = useGlobals();
const selectedValue = globals[id];
@@ -43,6 +44,7 @@
{selectedIcon ? (
<IconButton key={name} active={active} title={description}>
<Icons icon={selectedIcon} />
+ {showName ? `\xa0${name}` : ``}
</IconButton>
) : (
<TabButton active={active}>{name}</TabButton> |
226d9e8344761a081b2c88ccb4b90d7ad9b7a198 | highlightjs/highlightjs-tests.ts | highlightjs/highlightjs-tests.ts | /*
highlight.js definition by Niklas Mollenhauer
Last Update: 10.09.2013
Source Code: https://github.com/isagalaev/highlight.js
Project Page: http://softwaremaniacs.org/soft/highlight/en/
*/
/// <reference path="highlightjs.d.ts" />
import hljs = require("highlight.js");
var code = "using System;\npublic class Test\n{\npublic static void Main()\n{\n// your code goes here\n}\n}";
var lang = "cs";
hljs.configure({ tabReplace: " " }) // 4 spaces
var hl = hljs.highlight(lang, code).value;
hl = hljs.highlightAuto(code).value;
| /*
highlight.js definition by Niklas Mollenhauer
Last Update: 10.09.2013
Source Code: https://github.com/isagalaev/highlight.js
Project Page: http://softwaremaniacs.org/soft/highlight/en/
*/
/// <reference path="highlightjs.d.ts" />
import hljs = require("highlight.js");
var code = "using System;\npublic class Test\n{\npublic static void Main()\n{\n// your code goes here\n}\n}";
var lang = "cs";
hljs.configure({ tabReplace: " " }); // 4 spaces
var hl = hljs.highlight(lang, code).value;
hl = hljs.highlightAuto(code).value;
| Add missing semicolon in test | Add missing semicolon in test
| TypeScript | mit | emanuelhp/DefinitelyTyped,tarruda/DefinitelyTyped,scsouthw/DefinitelyTyped,Penryn/DefinitelyTyped,HereSinceres/DefinitelyTyped,drinchev/DefinitelyTyped,musicist288/DefinitelyTyped,raijinsetsu/DefinitelyTyped,florentpoujol/DefinitelyTyped,shovon/DefinitelyTyped,Zorgatone/DefinitelyTyped,xStrom/DefinitelyTyped,MugeSo/DefinitelyTyped,danfma/DefinitelyTyped,MarlonFan/DefinitelyTyped,OpenMaths/DefinitelyTyped,hor-crux/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,alvarorahul/DefinitelyTyped,mweststrate/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,abner/DefinitelyTyped,flyfishMT/DefinitelyTyped,rolandzwaga/DefinitelyTyped,chrootsu/DefinitelyTyped,schmuli/DefinitelyTyped,greglo/DefinitelyTyped,Zzzen/DefinitelyTyped,modifyink/DefinitelyTyped,M-Zuber/DefinitelyTyped,shlomiassaf/DefinitelyTyped,newclear/DefinitelyTyped,tgfjt/DefinitelyTyped,nitintutlani/DefinitelyTyped,dariajung/DefinitelyTyped,johan-gorter/DefinitelyTyped,shiwano/DefinitelyTyped,isman-usoh/DefinitelyTyped,superduper/DefinitelyTyped,bluong/DefinitelyTyped,applesaucers/lodash-invokeMap,nseckinoral/DefinitelyTyped,giggio/DefinitelyTyped,nakakura/DefinitelyTyped,lukehoban/DefinitelyTyped,rcchen/DefinitelyTyped,trystanclarke/DefinitelyTyped,vsavkin/DefinitelyTyped,damianog/DefinitelyTyped,Carreau/DefinitelyTyped,basp/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,pocesar/DefinitelyTyped,progre/DefinitelyTyped,hx0day/DefinitelyTyped,NelsonLamprecht/DefinitelyTyped,ecramer89/DefinitelyTyped,omidkrad/DefinitelyTyped,bruennijs/DefinitelyTyped,zuzusik/DefinitelyTyped,algorithme/DefinitelyTyped,aciccarello/DefinitelyTyped,frogcjn/DefinitelyTyped,quantumman/DefinitelyTyped,rerezz/DefinitelyTyped,laball/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,dumbmatter/DefinitelyTyped,paulmorphy/DefinitelyTyped,MidnightDesign/DefinitelyTyped,vpineda1996/DefinitelyTyped,paxibay/DefinitelyTyped,bjfletcher/DefinitelyTyped,digitalpixies/DefinitelyTyped,dydek/DefinitelyTyped,jpevarnek/DefinitelyTyped,jasonswearingen/DefinitelyTyped,theyelllowdart/DefinitelyTyped,donnut/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,Seltzer/DefinitelyTyped,opichals/DefinitelyTyped,mszczepaniak/DefinitelyTyped,abbasmhd/DefinitelyTyped,Jwsonic/DefinitelyTyped,florentpoujol/DefinitelyTyped,haskellcamargo/DefinitelyTyped,hypno2000/typings,moonpyk/DefinitelyTyped,subash-a/DefinitelyTyped,scriby/DefinitelyTyped,philippsimon/DefinitelyTyped,vagarenko/DefinitelyTyped,drillbits/DefinitelyTyped,borisyankov/DefinitelyTyped,abner/DefinitelyTyped,emanuelhp/DefinitelyTyped,johan-gorter/DefinitelyTyped,Ptival/DefinitelyTyped,laco0416/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,tan9/DefinitelyTyped,acepoblete/DefinitelyTyped,jbrantly/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,isman-usoh/DefinitelyTyped,AyaMorisawa/DefinitelyTyped,jsaelhof/DefinitelyTyped,QuatroCode/DefinitelyTyped,TanakaYutaro/DefinitelyTyped,adamcarr/DefinitelyTyped,teddyward/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,stephenjelfs/DefinitelyTyped,alextkachman/DefinitelyTyped,TheBay0r/DefinitelyTyped,lekaha/DefinitelyTyped,benishouga/DefinitelyTyped,davidpricedev/DefinitelyTyped,fredgalvao/DefinitelyTyped,jimthedev/DefinitelyTyped,forumone/DefinitelyTyped,donnut/DefinitelyTyped,georgemarshall/DefinitelyTyped,mattblang/DefinitelyTyped,arma-gast/DefinitelyTyped,billccn/DefinitelyTyped,Bobjoy/DefinitelyTyped,newclear/DefinitelyTyped,rschmukler/DefinitelyTyped,mhegazy/DefinitelyTyped,cvrajeesh/DefinitelyTyped,scriby/DefinitelyTyped,takenet/DefinitelyTyped,vote539/DefinitelyTyped,igorsechyn/DefinitelyTyped,rfranco/DefinitelyTyped,yuit/DefinitelyTyped,hesselink/DefinitelyTyped,pocke/DefinitelyTyped,ryan10132/DefinitelyTyped,robl499/DefinitelyTyped,almstrand/DefinitelyTyped,evandrewry/DefinitelyTyped,benishouga/DefinitelyTyped,Zorgatone/DefinitelyTyped,hiraash/DefinitelyTyped,jeremyhayes/DefinitelyTyped,chadoliver/DefinitelyTyped,RedSeal-co/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,georgemarshall/DefinitelyTyped,DeluxZ/DefinitelyTyped,RX14/DefinitelyTyped,vincentw56/DefinitelyTyped,jacqt/DefinitelyTyped,grahammendick/DefinitelyTyped,eekboom/DefinitelyTyped,nitintutlani/DefinitelyTyped,tan9/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,AgentME/DefinitelyTyped,pafflique/DefinitelyTyped,reppners/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,vote539/DefinitelyTyped,lucyhe/DefinitelyTyped,dpsthree/DefinitelyTyped,HPFOD/DefinitelyTyped,jimthedev/DefinitelyTyped,Trapulo/DefinitelyTyped,Chris380/DefinitelyTyped,behzad888/DefinitelyTyped,rschmukler/DefinitelyTyped,scatcher/DefinitelyTyped,GregOnNet/DefinitelyTyped,kanreisa/DefinitelyTyped,dwango-js/DefinitelyTyped,musakarakas/DefinitelyTyped,HPFOD/DefinitelyTyped,zensh/DefinitelyTyped,ciriarte/DefinitelyTyped,sandersky/DefinitelyTyped,dflor003/DefinitelyTyped,subash-a/DefinitelyTyped,brettle/DefinitelyTyped,bennett000/DefinitelyTyped,magny/DefinitelyTyped,danfma/DefinitelyTyped,magny/DefinitelyTyped,Zenorbi/DefinitelyTyped,michalczukm/DefinitelyTyped,aciccarello/DefinitelyTyped,arueckle/DefinitelyTyped,raijinsetsu/DefinitelyTyped,spearhead-ea/DefinitelyTyped,mrozhin/DefinitelyTyped,samwgoldman/DefinitelyTyped,timramone/DefinitelyTyped,miguelmq/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,Shiak1/DefinitelyTyped,jtlan/DefinitelyTyped,ayanoin/DefinitelyTyped,awerlang/DefinitelyTyped,masonkmeyer/DefinitelyTyped,jesseschalken/DefinitelyTyped,mattanja/DefinitelyTyped,Bunkerbewohner/DefinitelyTyped,egeland/DefinitelyTyped,mhegazy/DefinitelyTyped,bardt/DefinitelyTyped,gregoryagu/DefinitelyTyped,richardTowers/DefinitelyTyped,musically-ut/DefinitelyTyped,miguelmq/DefinitelyTyped,sledorze/DefinitelyTyped,aroder/DefinitelyTyped,optical/DefinitelyTyped,nojaf/DefinitelyTyped,Almouro/DefinitelyTyped,egeland/DefinitelyTyped,dsebastien/DefinitelyTyped,YousefED/DefinitelyTyped,jraymakers/DefinitelyTyped,samdark/DefinitelyTyped,IAPark/DefinitelyTyped,nodeframe/DefinitelyTyped,mareek/DefinitelyTyped,georgemarshall/DefinitelyTyped,CSharpFan/DefinitelyTyped,syntax42/DefinitelyTyped,chbrown/DefinitelyTyped,xswordsx/DefinitelyTyped,drinchev/DefinitelyTyped,chrismbarr/DefinitelyTyped,one-pieces/DefinitelyTyped,flyfishMT/DefinitelyTyped,elisee/DefinitelyTyped,psnider/DefinitelyTyped,uestcNaldo/DefinitelyTyped,alextkachman/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,Fraegle/DefinitelyTyped,wilfrem/DefinitelyTyped,Karabur/DefinitelyTyped,nobuoka/DefinitelyTyped,pocesar/DefinitelyTyped,igorraush/DefinitelyTyped,OpenMaths/DefinitelyTyped,AgentME/DefinitelyTyped,paulmorphy/DefinitelyTyped,reppners/DefinitelyTyped,ducin/DefinitelyTyped,axelcostaspena/DefinitelyTyped,munxar/DefinitelyTyped,mshmelev/DefinitelyTyped,manekovskiy/DefinitelyTyped,zuzusik/DefinitelyTyped,Dominator008/DefinitelyTyped,mendix/DefinitelyTyped,gcastre/DefinitelyTyped,martinduparc/DefinitelyTyped,jaysoo/DefinitelyTyped,Litee/DefinitelyTyped,Seikho/DefinitelyTyped,behzad88/DefinitelyTyped,fearthecowboy/DefinitelyTyped,furny/DefinitelyTyped,DenEwout/DefinitelyTyped,stephenjelfs/DefinitelyTyped,mvarblow/DefinitelyTyped,evansolomon/DefinitelyTyped,Dashlane/DefinitelyTyped,sergey-buturlakin/DefinitelyTyped,sledorze/DefinitelyTyped,ml-workshare/DefinitelyTyped,mwain/DefinitelyTyped,abmohan/DefinitelyTyped,nycdotnet/DefinitelyTyped,philippstucki/DefinitelyTyped,bilou84/DefinitelyTyped,unknownloner/DefinitelyTyped,jraymakers/DefinitelyTyped,mshmelev/DefinitelyTyped,NCARalph/DefinitelyTyped,darkl/DefinitelyTyped,pocesar/DefinitelyTyped,arcticwaters/DefinitelyTyped,lbesson/DefinitelyTyped,zhiyiting/DefinitelyTyped,tscho/DefinitelyTyped,shlomiassaf/DefinitelyTyped,stacktracejs/DefinitelyTyped,daptiv/DefinitelyTyped,bennett000/DefinitelyTyped,yuit/DefinitelyTyped,pwelter34/DefinitelyTyped,deeleman/DefinitelyTyped,MugeSo/DefinitelyTyped,GodsBreath/DefinitelyTyped,dydek/DefinitelyTyped,LordJZ/DefinitelyTyped,tigerxy/DefinitelyTyped,DeadAlready/DefinitelyTyped,Ptival/DefinitelyTyped,erosb/DefinitelyTyped,markogresak/DefinitelyTyped,alainsahli/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,dsebastien/DefinitelyTyped,angelobelchior8/DefinitelyTyped,chrismbarr/DefinitelyTyped,hatz48/DefinitelyTyped,GlennQuirynen/DefinitelyTyped,stanislavHamara/DefinitelyTyped,smrq/DefinitelyTyped,applesaucers/lodash-invokeMap,jeffbcross/DefinitelyTyped,philippsimon/DefinitelyTyped,ErykB2000/DefinitelyTyped,bobslaede/DefinitelyTyped,adammartin1981/DefinitelyTyped,Litee/DefinitelyTyped,tdmckinn/DefinitelyTyped,optical/DefinitelyTyped,bdoss/DefinitelyTyped,Dashlane/DefinitelyTyped,jimthedev/DefinitelyTyped,sclausen/DefinitelyTyped,RX14/DefinitelyTyped,Minishlink/DefinitelyTyped,lightswitch05/DefinitelyTyped,Pro/DefinitelyTyped,frogcjn/DefinitelyTyped,gdi2290/DefinitelyTyped,AgentME/DefinitelyTyped,mrk21/DefinitelyTyped,Kuniwak/DefinitelyTyped,DustinWehr/DefinitelyTyped,WritingPanda/DefinitelyTyped,leoromanovsky/DefinitelyTyped,aldo-roman/DefinitelyTyped,zuzusik/DefinitelyTyped,sixinli/DefinitelyTyped,cherrydev/DefinitelyTyped,innerverse/DefinitelyTyped,nmalaguti/DefinitelyTyped,duongphuhiep/DefinitelyTyped,jsaelhof/DefinitelyTyped,gyohk/DefinitelyTyped,tinganho/DefinitelyTyped,tomtarrot/DefinitelyTyped,martinduparc/DefinitelyTyped,mjjames/DefinitelyTyped,blink1073/DefinitelyTyped,Lorisu/DefinitelyTyped,gyohk/DefinitelyTyped,ashwinr/DefinitelyTyped,Gmulti/DefinitelyTyped,tboyce/DefinitelyTyped,minodisk/DefinitelyTyped,bobslaede/DefinitelyTyped,PascalSenn/DefinitelyTyped,Dominator008/DefinitelyTyped,kabogo/DefinitelyTyped,jccarvalhosa/DefinitelyTyped,Garciat/DefinitelyTyped,zuohaocheng/DefinitelyTyped,abbasmhd/DefinitelyTyped,maglar0/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,EnableSoftware/DefinitelyTyped,greglockwood/DefinitelyTyped,arcticwaters/DefinitelyTyped,nakakura/DefinitelyTyped,nainslie/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,shiwano/DefinitelyTyped,SebastianCoetzee/DefinitelyTyped,BrandonCKrueger/DefinitelyTyped,UzEE/DefinitelyTyped,QuatroCode/DefinitelyTyped,arusakov/DefinitelyTyped,icereed/DefinitelyTyped,eugenpodaru/DefinitelyTyped,behzad888/DefinitelyTyped,bdoss/DefinitelyTyped,damianog/DefinitelyTyped,Syati/DefinitelyTyped,arusakov/DefinitelyTyped,nfriend/DefinitelyTyped,alexdresko/DefinitelyTyped,stacktracejs/DefinitelyTyped,kmeurer/DefinitelyTyped,felipe3dfx/DefinitelyTyped,mcrawshaw/DefinitelyTyped,elisee/DefinitelyTyped,Pro/DefinitelyTyped,Penryn/DefinitelyTyped,glenndierckx/DefinitelyTyped,robert-voica/DefinitelyTyped,gedaiu/DefinitelyTyped,alvarorahul/DefinitelyTyped,rolandzwaga/DefinitelyTyped,amanmahajan7/DefinitelyTyped,bpowers/DefinitelyTyped,ajtowf/DefinitelyTyped,jasonswearingen/DefinitelyTyped,OfficeDev/DefinitelyTyped,EnableSoftware/DefinitelyTyped,AGBrown/DefinitelyTyped-ABContrib,robertbaker/DefinitelyTyped,subjectix/DefinitelyTyped,schmuli/DefinitelyTyped,hellopao/DefinitelyTyped,philippstucki/DefinitelyTyped,jiaz/DefinitelyTyped,gandjustas/DefinitelyTyped,aindlq/DefinitelyTyped,hafenr/DefinitelyTyped,Riron/DefinitelyTyped,JaminFarr/DefinitelyTyped,takenet/DefinitelyTyped,nmalaguti/DefinitelyTyped,whoeverest/DefinitelyTyped,smrq/DefinitelyTyped,progre/DefinitelyTyped,aciccarello/DefinitelyTyped,chrootsu/DefinitelyTyped,hellopao/DefinitelyTyped,PopSugar/DefinitelyTyped,use-strict/DefinitelyTyped,benliddicott/DefinitelyTyped,esperco/DefinitelyTyped,esperco/DefinitelyTyped,AgentME/DefinitelyTyped,tgfjt/DefinitelyTyped,pwelter34/DefinitelyTyped,borisyankov/DefinitelyTyped,Syati/DefinitelyTyped,mcrawshaw/DefinitelyTyped,Ridermansb/DefinitelyTyped,mattanja/DefinitelyTyped,gandjustas/DefinitelyTyped,wilfrem/DefinitelyTyped,UzEE/DefinitelyTyped,olemp/DefinitelyTyped,mcliment/DefinitelyTyped,bkristensen/DefinitelyTyped,lbguilherme/DefinitelyTyped,benishouga/DefinitelyTyped,ahmedalsudani/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,ryan-codingintrigue/DefinitelyTyped,georgemarshall/DefinitelyTyped,maxlang/DefinitelyTyped,cesarmarinhorj/DefinitelyTyped,olemp/DefinitelyTyped,tjoskar/DefinitelyTyped,mareek/DefinitelyTyped,xica/DefinitelyTyped,timjk/DefinitelyTyped,iCoreSolutions/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,goaty92/DefinitelyTyped,biomassives/DefinitelyTyped,gildorwang/DefinitelyTyped,arusakov/DefinitelyTyped,corps/DefinitelyTyped,nobuoka/DefinitelyTyped,TildaLabs/DefinitelyTyped,wbuchwalter/DefinitelyTyped,nabeix/DefinitelyTyped,davidsidlinger/DefinitelyTyped,YousefED/DefinitelyTyped,vasek17/DefinitelyTyped,mjjames/DefinitelyTyped,dragouf/DefinitelyTyped,Deathspike/DefinitelyTyped,schmuli/DefinitelyTyped,pkhayundi/DefinitelyTyped,zalamtech/DefinitelyTyped,mattblang/DefinitelyTyped,onecentlin/DefinitelyTyped,brentonhouse/DefinitelyTyped,takfjt/DefinitelyTyped,ashwinr/DefinitelyTyped,trystanclarke/DefinitelyTyped,Nemo157/DefinitelyTyped,Mek7/DefinitelyTyped,alexdresko/DefinitelyTyped,Karabur/DefinitelyTyped,muenchdo/DefinitelyTyped,ajtowf/DefinitelyTyped,vagarenko/DefinitelyTyped,gorcz/DefinitelyTyped,arma-gast/DefinitelyTyped,brainded/DefinitelyTyped,hatz48/DefinitelyTyped,dreampulse/DefinitelyTyped,bridge-ufsc/DefinitelyTyped,chrilith/DefinitelyTyped,fnipo/DefinitelyTyped,chocolatechipui/DefinitelyTyped,aqua89/DefinitelyTyped,xStrom/DefinitelyTyped,fredgalvao/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,olivierlemasle/DefinitelyTyped,fishgoh0nk/DefinitelyTyped,tomtheisen/DefinitelyTyped,teves-castro/DefinitelyTyped,modifyink/DefinitelyTyped,davidpricedev/DefinitelyTyped,psnider/DefinitelyTyped,nainslie/DefinitelyTyped,amanmahajan7/DefinitelyTyped,hellopao/DefinitelyTyped,gcastre/DefinitelyTyped,KonaTeam/DefinitelyTyped,nelsonmorais/DefinitelyTyped,amir-arad/DefinitelyTyped,use-strict/DefinitelyTyped,Saneyan/DefinitelyTyped,sclausen/DefinitelyTyped,syuilo/DefinitelyTyped,syuilo/DefinitelyTyped,dmoonfire/DefinitelyTyped,glenndierckx/DefinitelyTyped,teves-castro/DefinitelyTyped,lseguin42/DefinitelyTyped,rcchen/DefinitelyTyped,herrmanno/DefinitelyTyped,wkrueger/DefinitelyTyped,wcomartin/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,Zzzen/DefinitelyTyped,kuon/DefinitelyTyped,minodisk/DefinitelyTyped,martinduparc/DefinitelyTyped,greglo/DefinitelyTyped,micurs/DefinitelyTyped,psnider/DefinitelyTyped,shahata/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,bencoveney/DefinitelyTyped,rushi216/DefinitelyTyped,stylelab-io/DefinitelyTyped,TrabacchinLuigi/DefinitelyTyped,dmoonfire/DefinitelyTyped,Pipe-shen/DefinitelyTyped,duncanmak/DefinitelyTyped,kalloc/DefinitelyTyped,onecentlin/DefinitelyTyped,nycdotnet/DefinitelyTyped,rockclimber90/DefinitelyTyped,the41/DefinitelyTyped | ---
+++
@@ -12,7 +12,7 @@
var code = "using System;\npublic class Test\n{\npublic static void Main()\n{\n// your code goes here\n}\n}";
var lang = "cs";
-hljs.configure({ tabReplace: " " }) // 4 spaces
+hljs.configure({ tabReplace: " " }); // 4 spaces
var hl = hljs.highlight(lang, code).value;
hl = hljs.highlightAuto(code).value; |
488f8e6404d3306ccd249275cf2124bf175b2bdf | src/models/codeSnippetClientPickItem.ts | src/models/codeSnippetClientPickItem.ts | "use strict";
import { QuickPickItem } from 'vscode';
import { CodeSnippetClient } from './codeSnippetClient';
export class CodeSnippetClientQuickPickItem implements QuickPickItem {
public label: string;
public description: string;
public detail: string;
public rawClient: CodeSnippetClient;
} | "use strict";
import { QuickPickItem } from 'vscode';
import { CodeSnippetClient } from './codeSnippetClient';
export class CodeSnippetClientQuickPickItem implements QuickPickItem {
public label: string;
public description: string;
public detail: string;
public rawClient: CodeSnippetClient;
} | Increase to 4 spaces indent | Increase to 4 spaces indent
| TypeScript | mit | Huachao/vscode-restclient,Huachao/vscode-restclient | ---
+++
@@ -4,8 +4,8 @@
import { CodeSnippetClient } from './codeSnippetClient';
export class CodeSnippetClientQuickPickItem implements QuickPickItem {
- public label: string;
- public description: string;
- public detail: string;
- public rawClient: CodeSnippetClient;
+ public label: string;
+ public description: string;
+ public detail: string;
+ public rawClient: CodeSnippetClient;
} |
a97c20c792ed39baca40887ec88ba4c9d3b509af | src/handlers/Start.ts | src/handlers/Start.ts | import {Frame, ResponseContext, ResponseModel} from "../definitions/Handler";
import {Context} from "../definitions/SkillContext";
let Frames = require("../definitions/FrameDirectory");
let entry = (ctx: Context) => {
let r = new ResponseContext();
let model = new ResponseModel();
r.model = model;
model.speech = "hello";
model.reprompt = "hello again";
return r;
};
let actionMap = {
"LaunchRequest": function () {
return Frames["Start"];
}
};
let Start = new Frame("Start", entry, actionMap);
| import {Frame, ResponseContext, ResponseModel} from "../definitions/Handler";
import {Context} from "../definitions/SkillContext";
let Frames = require("../definitions/FrameDirectory");
let entry = (ctx: Context) => {
let model = new ResponseModel();
model.speech = "hello";
model.reprompt = "hello again";
let r = new ResponseContext(model);
return r;
};
let actionMap = {
"LaunchRequest": function () {
return Frames["Start"];
}
};
let Start = new Frame("Start", entry, actionMap);
| Use constructor for building response context. | Use constructor for building response context.
| TypeScript | agpl-3.0 | deegles/cookietime,deegles/cookietime | ---
+++
@@ -5,14 +5,12 @@
let entry = (ctx: Context) => {
- let r = new ResponseContext();
-
let model = new ResponseModel();
-
- r.model = model;
model.speech = "hello";
model.reprompt = "hello again";
+
+ let r = new ResponseContext(model);
return r;
}; |
8febe236110ca51185a14a5918477ddf1496994d | src/app/components/chat/user-list/user-list.ts | src/app/components/chat/user-list/user-list.ts | import Vue from 'vue';
import { Component, Prop } from 'vue-property-decorator';
import View from '!view!./user-list.html';
import { ChatRoom } from '../room';
import { ChatUser } from '../user';
import { AppChatUserListItem } from './item/item';
import { fuzzysearch } from '../../../../lib/gj-lib-client/utils/string';
@View
@Component({
components: {
AppChatUserListItem,
},
})
export class AppChatUserList extends Vue {
@Prop(Array) users: ChatUser[];
@Prop(ChatRoom) room?: ChatRoom;
@Prop(Boolean) showPm?: boolean;
@Prop(Boolean) showModTools?: boolean;
filterQuery = '';
// inviewUsers: { [k: string]: boolean } = {};
get filteredUsers() {
if (!this.filterQuery) {
return this.users;
}
const filter = this.filterQuery.toLowerCase();
return this.users.filter(
i =>
fuzzysearch(filter, i.displayName.toLowerCase()) ||
fuzzysearch(filter, i.username.toLowerCase())
);
}
}
| import Vue from 'vue';
import { Component, Prop, Watch } from 'vue-property-decorator';
import View from '!view!./user-list.html';
import { ChatRoom } from '../room';
import { ChatUser } from '../user';
import { AppChatUserListItem } from './item/item';
import { fuzzysearch } from '../../../../lib/gj-lib-client/utils/string';
import { findVueParent } from '../../../../lib/gj-lib-client/utils/vue';
import { AppScrollInviewParent } from '../../../../lib/gj-lib-client/components/scroll/inview/parent';
@View
@Component({
components: {
AppChatUserListItem,
},
})
export class AppChatUserList extends Vue {
@Prop(Array) users: ChatUser[];
@Prop(ChatRoom) room?: ChatRoom;
@Prop(Boolean) showPm?: boolean;
@Prop(Boolean) showModTools?: boolean;
filterQuery = '';
get filteredUsers() {
if (!this.filterQuery) {
return this.users;
}
const filter = this.filterQuery.toLowerCase();
return this.users.filter(
i =>
fuzzysearch(filter, i.displayName.toLowerCase()) ||
fuzzysearch(filter, i.username.toLowerCase())
);
}
/**
* When our list changes, make sure to recheck items in view since things shifted.
*/
@Watch('filteredUsers')
onUsersChange() {
const inviewParent = findVueParent(this, AppScrollInviewParent);
if (inviewParent) {
inviewParent.container.queueCheck();
}
}
}
| Fix up chat user list to tell its scroll-inview-parent when things change. | Fix up chat user list to tell its scroll-inview-parent when things change.
| TypeScript | mit | gamejolt/gamejolt,gamejolt/gamejolt,gamejolt/gamejolt,gamejolt/gamejolt | ---
+++
@@ -1,11 +1,13 @@
import Vue from 'vue';
-import { Component, Prop } from 'vue-property-decorator';
+import { Component, Prop, Watch } from 'vue-property-decorator';
import View from '!view!./user-list.html';
import { ChatRoom } from '../room';
import { ChatUser } from '../user';
import { AppChatUserListItem } from './item/item';
import { fuzzysearch } from '../../../../lib/gj-lib-client/utils/string';
+import { findVueParent } from '../../../../lib/gj-lib-client/utils/vue';
+import { AppScrollInviewParent } from '../../../../lib/gj-lib-client/components/scroll/inview/parent';
@View
@Component({
@@ -20,7 +22,6 @@
@Prop(Boolean) showModTools?: boolean;
filterQuery = '';
- // inviewUsers: { [k: string]: boolean } = {};
get filteredUsers() {
if (!this.filterQuery) {
@@ -34,4 +35,15 @@
fuzzysearch(filter, i.username.toLowerCase())
);
}
+
+ /**
+ * When our list changes, make sure to recheck items in view since things shifted.
+ */
+ @Watch('filteredUsers')
+ onUsersChange() {
+ const inviewParent = findVueParent(this, AppScrollInviewParent);
+ if (inviewParent) {
+ inviewParent.container.queueCheck();
+ }
+ }
} |
bf315fd4df74199afa42af50f7042415fcbc80fe | packages/userscript/source/index.ts | packages/userscript/source/index.ts | import devSavegame from "./fixtures/savegame";
import devSettings from "./fixtures/settings";
import { Options } from "./options/Options";
import { SettingsStorage } from "./options/SettingsStorage";
import { cinfo } from "./tools/Log";
import { isNil } from "./tools/Maybe";
import { SavegameLoader } from "./tools/SavegameLoader";
import { UserScript } from "./UserScript";
(async () => {
const kittenGame = await UserScript.waitForGame();
// For development convenience, load a lategame save to give us more test options.
if (!isNil(devSavegame)) {
await new SavegameLoader(kittenGame).load(devSavegame);
}
const userScript = await UserScript.getDefaultInstance();
// @ts-expect-error Manipulating global containers is naughty, be we want to expose the script host.
window.kittenScientists = userScript;
cinfo("Looking for legacy settings...");
const legacySettings = SettingsStorage.getLegacySettings();
if (legacySettings === null) {
cinfo("No legacy settings found. Default settings will be used.");
}
if (!isNil(devSettings)) {
const options = Options.parseLegacyOptions(devSettings);
userScript.injectOptions(options);
} else if (!isNil(legacySettings)) {
const options = Options.parseLegacyOptions(legacySettings);
userScript.injectOptions(options);
}
userScript.run();
})();
| import devSavegame from "./fixtures/savegame";
import devSettings from "./fixtures/settings";
import { Options } from "./options/Options";
import { SettingsStorage } from "./options/SettingsStorage";
import { cinfo } from "./tools/Log";
import { isNil } from "./tools/Maybe";
import { SavegameLoader } from "./tools/SavegameLoader";
import { UserScript } from "./UserScript";
(async () => {
const kittenGame = await UserScript.waitForGame();
// For development convenience, load a lategame save to give us more test options.
if (!isNil(devSavegame)) {
await new SavegameLoader(kittenGame).load(devSavegame);
}
const userScript = await UserScript.getDefaultInstance();
// @ts-expect-error Manipulating global containers is naughty, be we want to expose the script host.
window.kittenScientists = userScript;
cinfo("Looking for legacy settings...");
const legacySettings = SettingsStorage.getLegacySettings();
if (!isNil(devSettings)) {
cinfo("Using development settings snapshot.");
const options = Options.parseLegacyOptions(devSettings);
userScript.injectOptions(options);
} else if (!isNil(legacySettings)) {
cinfo("Using restored legacy settings.");
const options = Options.parseLegacyOptions(legacySettings);
userScript.injectOptions(options);
} else {
cinfo("No legacy settings found. Default settings will be used.");
}
userScript.run();
})();
| Clarify which settings are used | fix: Clarify which settings are used
| TypeScript | mit | oliversalzburg/cbc-kitten-scientists,oliversalzburg/cbc-kitten-scientists,oliversalzburg/cbc-kitten-scientists | ---
+++
@@ -22,16 +22,17 @@
cinfo("Looking for legacy settings...");
const legacySettings = SettingsStorage.getLegacySettings();
- if (legacySettings === null) {
- cinfo("No legacy settings found. Default settings will be used.");
- }
if (!isNil(devSettings)) {
+ cinfo("Using development settings snapshot.");
const options = Options.parseLegacyOptions(devSettings);
userScript.injectOptions(options);
} else if (!isNil(legacySettings)) {
+ cinfo("Using restored legacy settings.");
const options = Options.parseLegacyOptions(legacySettings);
userScript.injectOptions(options);
+ } else {
+ cinfo("No legacy settings found. Default settings will be used.");
}
userScript.run(); |
220b00b0ac3b1787ff933818ad5d3026f11471c4 | src/app/shared/line-splitting.pipe.spec.ts | src/app/shared/line-splitting.pipe.spec.ts | import { AlbumDescriptionPipe } from './album-description.pipe';
describe('AlbumDescriptionPipe', () => {
it('create an instance', () => {
const pipe = new LineSplittingPipe();
expect(pipe).toBeTruthy();
});
});
| import { AlbumDescriptionPipe } from './album-description.pipe';
describe('LineSplittingPipe', () => {
it('create an instance', () => {
const pipe = new LineSplittingPipe();
expect(pipe).toBeTruthy();
});
it('Splits lines with new line characters into an array', () => {
const input = 'I like\nnew lines\nthere should be three';
const pipe = new LineSplittingPipe();
const output = pipe.transform(input, null);
expect(output.length).toBe(3);
expect(output[0]).toBe('I like');
expect(output[1]).toBe('new lines');
expect(output[2]).toBe('there should be three');
});
});
| Add tests for line splitting pipe | Add tests for line splitting pipe
| TypeScript | apache-2.0 | jbrowneuk/jblog,jbrowneuk/jblog,jbrowneuk/jblog,jbrowneuk/jblog | ---
+++
@@ -1,8 +1,19 @@
import { AlbumDescriptionPipe } from './album-description.pipe';
-describe('AlbumDescriptionPipe', () => {
+describe('LineSplittingPipe', () => {
it('create an instance', () => {
const pipe = new LineSplittingPipe();
expect(pipe).toBeTruthy();
});
+
+ it('Splits lines with new line characters into an array', () => {
+ const input = 'I like\nnew lines\nthere should be three';
+ const pipe = new LineSplittingPipe();
+ const output = pipe.transform(input, null);
+
+ expect(output.length).toBe(3);
+ expect(output[0]).toBe('I like');
+ expect(output[1]).toBe('new lines');
+ expect(output[2]).toBe('there should be three');
+ });
}); |
a9c70a35568d2be5b1cc5589c4d430d24dfa5d0c | src/SyntaxNodes/InlineSyntaxNode.ts | src/SyntaxNodes/InlineSyntaxNode.ts | import { SyntaxNode } from './SyntaxNode'
export interface InlineSyntaxNode extends SyntaxNode {
// Represents the text of the syntax node as it should appear inline. Some inline conventions
// don't have any e.g. (footnotes, images).
textAppearingInline(): string
// Represents the searchable text of the syntax node. In contrast to `inlineText`, footnotes
// and images should have searchable text (footnotes have content, and images have descriptions).
searchableText(): string
}
| import { SyntaxNode } from './SyntaxNode'
export interface InlineSyntaxNode extends SyntaxNode {
// Represents the text of the syntax node as it should appear inline. Some inline conventions
// don't have any e.g. (footnotes, images).
textAppearingInline(): string
// Represents the searchable text of the syntax node. In contrast to `textAppearingInline`,
// footnotes and images should have searchable text (footnotes have content, and images have
// descriptions).
searchableText(): string
}
| Update method name in comment | Update method name in comment
| TypeScript | mit | start/up,start/up | ---
+++
@@ -6,7 +6,8 @@
// don't have any e.g. (footnotes, images).
textAppearingInline(): string
- // Represents the searchable text of the syntax node. In contrast to `inlineText`, footnotes
- // and images should have searchable text (footnotes have content, and images have descriptions).
+ // Represents the searchable text of the syntax node. In contrast to `textAppearingInline`,
+ // footnotes and images should have searchable text (footnotes have content, and images have
+ // descriptions).
searchableText(): string
} |
e84a9a8b188f5f434ef10ab5f6ca622bf570c379 | src/navigation/sidebar/MenuItem.tsx | src/navigation/sidebar/MenuItem.tsx | import * as classNames from 'classnames';
import * as React from 'react';
import * as Label from 'react-bootstrap/lib/Label';
import { translate } from '@waldur/i18n';
import { MenuItemType } from './types';
interface MenuItemProps {
item: MenuItemType;
onClick(item: MenuItemType): void;
counter?: number;
}
export const MenuItem: React.FC<MenuItemProps> = ({
item,
onClick,
counter,
}) => (
<a onClick={() => onClick(item)}>
<i className={classNames('fa', item.icon, 'fixed-width-icon')}></i>
<span className="nav-label">{translate(item.label)}</span>
{Number.isInteger(counter) ? (
<Label className="pull-right">{counter}</Label>
) : null}
{Array.isArray(item.children) && <span className="fa arrow"></span>}
</a>
);
| import * as classNames from 'classnames';
import * as React from 'react';
import * as Label from 'react-bootstrap/lib/Label';
import { wrapTooltip } from '@waldur/table/ActionButton';
import { MenuItemType } from './types';
interface MenuItemProps {
item: MenuItemType;
onClick(item: MenuItemType): void;
counter?: number;
}
export const MenuItem: React.FC<MenuItemProps> = ({
item,
onClick,
counter,
}) => (
<a onClick={() => onClick(item)}>
<i className={classNames('fa', item.icon, 'fixed-width-icon')}></i>
{wrapTooltip(
item.label.length > 20 ? item.label : null,
<span className="nav-label">{item.label}</span>,
)}
{Number.isInteger(counter) ? (
<Label className="pull-right">{counter}</Label>
) : null}
{Array.isArray(item.children) && <span className="fa arrow"></span>}
</a>
);
| Add a tooltip to display name of categories under resource view if they are shortened | [WAL-3286] Add a tooltip to display name of categories under resource view if they are shortened
| TypeScript | mit | opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport,opennode/waldur-homeport | ---
+++
@@ -2,7 +2,7 @@
import * as React from 'react';
import * as Label from 'react-bootstrap/lib/Label';
-import { translate } from '@waldur/i18n';
+import { wrapTooltip } from '@waldur/table/ActionButton';
import { MenuItemType } from './types';
@@ -19,7 +19,10 @@
}) => (
<a onClick={() => onClick(item)}>
<i className={classNames('fa', item.icon, 'fixed-width-icon')}></i>
- <span className="nav-label">{translate(item.label)}</span>
+ {wrapTooltip(
+ item.label.length > 20 ? item.label : null,
+ <span className="nav-label">{item.label}</span>,
+ )}
{Number.isInteger(counter) ? (
<Label className="pull-right">{counter}</Label>
) : null} |
d9aed8b1f193e2b51308745778af5b5c619e4c51 | src/components/PVLink/PVLink.tsx | src/components/PVLink/PVLink.tsx | import classnames from 'classnames'
import Link from 'next/link'
type Props = {
children: any
className?: string
href: string
onClick?: any
}
export const PVLink = ({ children, className, href, onClick }: Props) => {
const linkClassName = classnames(className ? className : '')
return (
<Link href={href}>
<a className={linkClassName} onClick={onClick}>
{children}
</a>
</Link>
)
}
| import classnames from 'classnames'
import Link from 'next/link'
import { useRouter } from 'next/router'
type Props = {
children: any
className?: string
href: string
onClick?: any
}
export const PVLink = ({ children, className, href, onClick }: Props) => {
const router = useRouter()
const linkClassName = classnames(className ? className : '')
/* If already on the same page, force the page to reload with onClick + router.replace */
let isCurrentPage = href === router.pathname
let finalOnClick = isCurrentPage
? () => {
router.replace(href)
}
: onClick
return (
<Link href={href}>
<a className={linkClassName} onClick={finalOnClick}>
{children}
</a>
</Link>
)
}
| Refresh page if clicking a link that directs to the current page | Refresh page if clicking a link that directs to the current page
| TypeScript | agpl-3.0 | podverse/podverse-web,podverse/podverse-web,podverse/podverse-web,podverse/podverse-web | ---
+++
@@ -1,5 +1,6 @@
import classnames from 'classnames'
import Link from 'next/link'
+import { useRouter } from 'next/router'
type Props = {
children: any
@@ -9,10 +10,20 @@
}
export const PVLink = ({ children, className, href, onClick }: Props) => {
+ const router = useRouter()
const linkClassName = classnames(className ? className : '')
+
+ /* If already on the same page, force the page to reload with onClick + router.replace */
+ let isCurrentPage = href === router.pathname
+ let finalOnClick = isCurrentPage
+ ? () => {
+ router.replace(href)
+ }
+ : onClick
+
return (
<Link href={href}>
- <a className={linkClassName} onClick={onClick}>
+ <a className={linkClassName} onClick={finalOnClick}>
{children}
</a>
</Link> |
166a9214ec669402f84aaee9ff72545760f8c6b8 | src/v2/Apps/Consign/Routes/MarketingLanding/Components/PromoSpace.tsx | src/v2/Apps/Consign/Routes/MarketingLanding/Components/PromoSpace.tsx | import React from "react"
import { Text, Box, color } from "@artsy/palette"
import { SectionContainer } from "./SectionContainer"
export const PromoSpace: React.FC = () => {
return (
<SectionContainer>
<Box borderBottom={`1px solid ${color("black60")}`} width="100%">
<Text
width="60%"
textAlign={"center"}
pb={3}
variant="largeTitle"
margin="0 auto"
>
We connect the world's most innovative art collectors and sellers in
one place.
</Text>
</Box>
</SectionContainer>
)
}
| import React from "react"
import { Text, Box } from "@artsy/palette"
import { SectionContainer } from "./SectionContainer"
export const PromoSpace: React.FC = () => {
return (
<SectionContainer>
<Box borderBottom="1px solid" borderColor="black60" width="100%">
<Text
width="60%"
textAlign={"center"}
pb={3}
variant="largeTitle"
margin="0 auto"
>
We connect the world's most innovative art collectors and sellers in
one place.
</Text>
</Box>
</SectionContainer>
)
}
| Remove deprecated attributes from border | Remove deprecated attributes from border
| TypeScript | mit | artsy/force,artsy/force-public,artsy/force,artsy/force,artsy/force-public,artsy/force | ---
+++
@@ -1,11 +1,11 @@
import React from "react"
-import { Text, Box, color } from "@artsy/palette"
+import { Text, Box } from "@artsy/palette"
import { SectionContainer } from "./SectionContainer"
export const PromoSpace: React.FC = () => {
return (
<SectionContainer>
- <Box borderBottom={`1px solid ${color("black60")}`} width="100%">
+ <Box borderBottom="1px solid" borderColor="black60" width="100%">
<Text
width="60%"
textAlign={"center"} |
ced6fcdd0563c0c867174a1c302f3a354ec8715b | game/hud/src/widgets/HUDFullScreen/graphql/fragments/strings/AlloyStatsFragment.ts | game/hud/src/widgets/HUDFullScreen/graphql/fragments/strings/AlloyStatsFragment.ts | /*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*/
export const AlloyStatsFragment = `
hardness
impactToughness
fractureChance
malleability
massPCF
density
meltingPoint
thermConductivity
slashingResistance
piercingResistance
crushingResistance
acidResistance
poisonResistance
diseaseResistance
earthResistance
waterResistance
fireResistance
airResistance
lightningResistance
frostResistance
lifeResistance
mindResistance
spiritResistance
radiantResistance
deathResistance
shadowResistance
chaosResistance
voidResistance
arcaneResistance
magicalResistance
hardnessFactor
strengthFactor
fractureFactor
massFactor
damageResistance
`;
| /*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*/
export const AlloyStatsFragment = `
unitHealth
unitMass
massBonus
encumbranceBonus
maxRepairPointsBonus
maxHealthBonus
healthLossPerUseBonus
weightBonus
strengthRequirementBonus
dexterityRequirementBonus
vitalityRequirementBonus
enduranceRequirementBonus
attunementRequirementBonus
willRequirementBonus
faithRequirementBonus
resonanceRequirementBonus
fractureThresholdBonus
fractureChanceBonus
densityBonus
malleabilityBonus
meltingPointBonus
hardnessBonus
fractureBonus
armorClassBonus
resistSlashingBonus
resistPiercingBonus
resistCrushingBonus
resistAcidBonus
resistPoisonBonus
resistDiseaseBonus
resistEarthBonus
resistWaterBonus
resistFireBonus
resistAirBonus
resistLightningBonus
resistFrostBonus
resistLifeBonus
resistMindBonus
resistSpiritBonus
resistRadiantBonus
resistDeathBonus
resistShadowBonus
resistChaosBonus
resistVoidBonus
resistArcaneBonus
mitigateBonus
piercingDamageBonus
piercingArmorPenetrationBonus
falloffMinDistanceBonus
falloffReductionBonus
slashingDamageBonus
slashingBleedBonus
slashingArmorPenetrationBonus
crushingDamageBonus
fallbackCrushingDamageBonus
distruptionBonus
stabilityBonus
deflectionAmountBonus
deflectionRecoveryBonus
knockbackAmountBonus
staminaCostBonus
physicalPreparationTimeBonus
physicalRecoveryTimeBonus
`;
| Update alloy stats fragment for TradeWindow items | Update alloy stats fragment for TradeWindow items
| TypeScript | mpl-2.0 | CUModSquad/Camelot-Unchained,CUModSquad/Camelot-Unchained,Ajackster/Camelot-Unchained,csegames/Camelot-Unchained,Mehuge/Camelot-Unchained,saddieeiddas/Camelot-Unchained,CUModSquad/Camelot-Unchained,csegames/Camelot-Unchained,Ajackster/Camelot-Unchained,saddieeiddas/Camelot-Unchained,Mehuge/Camelot-Unchained,Mehuge/Camelot-Unchained,saddieeiddas/Camelot-Unchained,Ajackster/Camelot-Unchained,csegames/Camelot-Unchained | ---
+++
@@ -6,39 +6,67 @@
*/
export const AlloyStatsFragment = `
- hardness
- impactToughness
- fractureChance
- malleability
- massPCF
- density
- meltingPoint
- thermConductivity
- slashingResistance
- piercingResistance
- crushingResistance
- acidResistance
- poisonResistance
- diseaseResistance
- earthResistance
- waterResistance
- fireResistance
- airResistance
- lightningResistance
- frostResistance
- lifeResistance
- mindResistance
- spiritResistance
- radiantResistance
- deathResistance
- shadowResistance
- chaosResistance
- voidResistance
- arcaneResistance
- magicalResistance
- hardnessFactor
- strengthFactor
- fractureFactor
- massFactor
- damageResistance
+ unitHealth
+ unitMass
+ massBonus
+ encumbranceBonus
+ maxRepairPointsBonus
+ maxHealthBonus
+ healthLossPerUseBonus
+ weightBonus
+ strengthRequirementBonus
+ dexterityRequirementBonus
+ vitalityRequirementBonus
+ enduranceRequirementBonus
+ attunementRequirementBonus
+ willRequirementBonus
+ faithRequirementBonus
+ resonanceRequirementBonus
+ fractureThresholdBonus
+ fractureChanceBonus
+ densityBonus
+ malleabilityBonus
+ meltingPointBonus
+ hardnessBonus
+ fractureBonus
+ armorClassBonus
+ resistSlashingBonus
+ resistPiercingBonus
+ resistCrushingBonus
+ resistAcidBonus
+ resistPoisonBonus
+ resistDiseaseBonus
+ resistEarthBonus
+ resistWaterBonus
+ resistFireBonus
+ resistAirBonus
+ resistLightningBonus
+ resistFrostBonus
+ resistLifeBonus
+ resistMindBonus
+ resistSpiritBonus
+ resistRadiantBonus
+ resistDeathBonus
+ resistShadowBonus
+ resistChaosBonus
+ resistVoidBonus
+ resistArcaneBonus
+ mitigateBonus
+ piercingDamageBonus
+ piercingArmorPenetrationBonus
+ falloffMinDistanceBonus
+ falloffReductionBonus
+ slashingDamageBonus
+ slashingBleedBonus
+ slashingArmorPenetrationBonus
+ crushingDamageBonus
+ fallbackCrushingDamageBonus
+ distruptionBonus
+ stabilityBonus
+ deflectionAmountBonus
+ deflectionRecoveryBonus
+ knockbackAmountBonus
+ staminaCostBonus
+ physicalPreparationTimeBonus
+ physicalRecoveryTimeBonus
`; |
d1cf25e057236651c9ed828d4d767084a6431e72 | packages/w3c-webdriver/test-env/setup.ts | packages/w3c-webdriver/test-env/setup.ts | import { newSession, status } from '../src';
import { log } from '../src/logger';
import { browser } from './browser';
import { session, setSession } from './session';
log.enabled = true;
const webDriverUrl = browser.hub || `http://localhost:${process.env.WEB_DRIVER_PORT}`;
const testAppPort = process.env.TEST_APP_PORT;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
beforeAll(async () => {
if (browser.id === 'safari') {
let serverStatus;
do {
if (serverStatus) {
await new Promise(resolve => setTimeout(() => { resolve(); }, 100));
}
log(`Awaiting ready status on ${webDriverUrl} ...`);
serverStatus = await status(webDriverUrl);
} while(!serverStatus.ready)
}
log(`Creating session on ${webDriverUrl}.`);
try {
setSession(
await newSession({
url: webDriverUrl,
capabilities: browser.capabilities,
desiredCapabilities: browser.desiredCapabilities,
headers: browser.headers
})
);
log(`Session created.`);
} catch (error) {
log(error);
throw error;
}
});
beforeEach(async () => {
await session.go(`http://localhost:${testAppPort}`);
});
afterAll(async () => {
log(`Deleting session on ${webDriverUrl}.`);
await session.close();
log(`Session deleted.`);
});
| import { newSession, status } from '../src';
import { log } from '../src/logger';
import { browser } from './browser';
import { session, setSession } from './session';
log.enabled = true;
const webDriverUrl = browser.hub || `http://localhost:${process.env.WEB_DRIVER_PORT}`;
const testAppPort = process.env.TEST_APP_PORT;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000;
beforeAll(async () => {
if (browser.id === 'safari') {
log(`Creating session on ${webDriverUrl}.`);
try {
setSession(
await newSession({
url: webDriverUrl,
capabilities: browser.capabilities,
desiredCapabilities: browser.desiredCapabilities,
headers: browser.headers
})
);
log(`Session created.`);
} catch (error) {
log(error);
throw error;
}
});
beforeEach(async () => {
await session.go(`http://localhost:${testAppPort}`);
});
afterAll(async () => {
log(`Deleting session on ${webDriverUrl}.`);
await session.close();
log(`Session deleted.`);
if (browser.id === 'safari') {
log(`Wait for 2 seconds...`);
await new Promise(resolve => setTimeout(() => { resolve() }, 2000));
}
});
| Add wait after session deletion in case of Safari | Add wait after session deletion in case of Safari
| TypeScript | mit | mucsi96/w3c-webdriver,mucsi96/w3c-webdriver,mucsi96/w3c-webdriver | ---
+++
@@ -12,16 +12,6 @@
beforeAll(async () => {
if (browser.id === 'safari') {
- let serverStatus;
- do {
- if (serverStatus) {
- await new Promise(resolve => setTimeout(() => { resolve(); }, 100));
- }
- log(`Awaiting ready status on ${webDriverUrl} ...`);
- serverStatus = await status(webDriverUrl);
- } while(!serverStatus.ready)
- }
-
log(`Creating session on ${webDriverUrl}.`);
try {
setSession(
@@ -47,4 +37,8 @@
log(`Deleting session on ${webDriverUrl}.`);
await session.close();
log(`Session deleted.`);
+ if (browser.id === 'safari') {
+ log(`Wait for 2 seconds...`);
+ await new Promise(resolve => setTimeout(() => { resolve() }, 2000));
+ }
}); |
ef75ec6b2658b2e400dc03286949aa1e9e6f9c62 | e2e/connections/detail/detail.po.ts | e2e/connections/detail/detail.po.ts | import { element, by, ElementFinder } from 'protractor';
import { P } from '../../common/world';
/**
* Created by jludvice on 13.3.17.
*/
export class ConnectionDetailPage {
connectionDetailElem(): ElementFinder {
return element(by.css('syndesis-connection-view'));
}
connectionName(): P<string> {
return this.connectionDetailElem().element(by.css('div.name > h2')).getText();
}
}
| import { element, by, ElementFinder } from 'protractor';
import { P } from '../../common/world';
/**
* Created by jludvice on 13.3.17.
*/
export class ConnectionDetailPage {
connectionDetailElem(): ElementFinder {
return element(by.css('syndesis-connection-detail-info'));
}
connectionName(): P<string> {
return this.connectionDetailElem().$('syndesis-editable-text').getText();
}
}
| Fix elements on Connection Detail page | fix: Fix elements on Connection Detail page
| TypeScript | apache-2.0 | lvydra/syndesis-e2e-tests,mcada/syndesis-qe,lvydra/syndesis-e2e-tests,lvydra/syndesis-e2e-tests,mcada/syndesis-qe,mcada/syndesis-qe,lvydra/syndesis-e2e-tests | ---
+++
@@ -6,10 +6,10 @@
*/
export class ConnectionDetailPage {
connectionDetailElem(): ElementFinder {
- return element(by.css('syndesis-connection-view'));
+ return element(by.css('syndesis-connection-detail-info'));
}
connectionName(): P<string> {
- return this.connectionDetailElem().element(by.css('div.name > h2')).getText();
+ return this.connectionDetailElem().$('syndesis-editable-text').getText();
}
} |
714c9f25d4444072f1517b0ad188fb955e397514 | src/name-input-list/drag-handle.tsx | src/name-input-list/drag-handle.tsx | import * as React from 'react'
import {SortableHandle} from 'react-sortable-hoc'
import EditorDragHandle from '@material-ui/icons/DragHandle'
import style from './name-input-list.css'
export const DragHandle = SortableHandle(() => <EditorDragHandle className={style.handle} />)
| import * as React from 'react'
import {SortableHandle} from 'react-sortable-hoc'
import EditorDragHandle from '@material-ui/icons/DragHandle'
import style from './name-input-list.css'
export const DragHandle = SortableHandle(() => <EditorDragHandle color="action" className={style.handle} />)
| Fix color of drag handle | Fix color of drag handle
| TypeScript | mit | Holi0317/bridge-calc,Holi0317/bridge-calc,Holi0317/bridge-calc | ---
+++
@@ -3,4 +3,4 @@
import EditorDragHandle from '@material-ui/icons/DragHandle'
import style from './name-input-list.css'
-export const DragHandle = SortableHandle(() => <EditorDragHandle className={style.handle} />)
+export const DragHandle = SortableHandle(() => <EditorDragHandle color="action" className={style.handle} />) |
3d1a89ef771497e45f74cec1e93efb2ee67da7ec | packages/utils/src/loader/loaders.ts | packages/utils/src/loader/loaders.ts | import type { Awaitable } from '@antfu/utils';
import { existsSync, promises as fs } from 'fs';
import type { CustomIconLoader } from './types';
import { camelize, pascalize } from '../misc/strings';
export function FileSystemIconLoader(
dir: string,
transform?: (svg: string) => Awaitable<string>
): CustomIconLoader {
return async (name) => {
const paths = [
`${dir}/${name}.svg`,
`${dir}/${camelize(name)}.svg`,
`${dir}/${pascalize(name)}.svg`,
];
for (const path of paths) {
if (existsSync(path)) {
const svg = await fs.readFile(path, 'utf-8');
return typeof transform === 'function'
? await transform(svg)
: svg;
}
}
};
}
| import type { Awaitable } from '@antfu/utils';
import { promises as fs, Stats } from 'fs';
import type { CustomIconLoader } from './types';
import { camelize, pascalize } from '../misc/strings';
/**
* Returns CustomIconLoader for loading icons from a directory
*/
export function FileSystemIconLoader(
dir: string,
transform?: (svg: string) => Awaitable<string>
): CustomIconLoader {
return async (name) => {
const paths = [
`${dir}/${name}.svg`,
`${dir}/${camelize(name)}.svg`,
`${dir}/${pascalize(name)}.svg`,
];
for (const path of paths) {
let stat: Stats;
try {
stat = await fs.lstat(path);
} catch (err) {
continue;
}
if (stat.isFile()) {
const svg = await fs.readFile(path, 'utf-8');
return typeof transform === 'function'
? await transform(svg)
: svg;
}
}
};
}
| Check if file exists asynchronously in FileSystemIconLoader | Check if file exists asynchronously in FileSystemIconLoader
| TypeScript | mit | simplesvg/simple-svg,simplesvg/simple-svg,simplesvg/simple-svg | ---
+++
@@ -1,8 +1,11 @@
import type { Awaitable } from '@antfu/utils';
-import { existsSync, promises as fs } from 'fs';
+import { promises as fs, Stats } from 'fs';
import type { CustomIconLoader } from './types';
import { camelize, pascalize } from '../misc/strings';
+/**
+ * Returns CustomIconLoader for loading icons from a directory
+ */
export function FileSystemIconLoader(
dir: string,
transform?: (svg: string) => Awaitable<string>
@@ -14,7 +17,13 @@
`${dir}/${pascalize(name)}.svg`,
];
for (const path of paths) {
- if (existsSync(path)) {
+ let stat: Stats;
+ try {
+ stat = await fs.lstat(path);
+ } catch (err) {
+ continue;
+ }
+ if (stat.isFile()) {
const svg = await fs.readFile(path, 'utf-8');
return typeof transform === 'function'
? await transform(svg) |
416627095cc0904ca95cefb1e744b027fa59b80b | translations/lxqt-openssh-askpass.ts | translations/lxqt-openssh-askpass.ts | <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en_US">
<context>
<name>MainWindow</name>
<message>
<location filename="../src/mainwindow.ui" line="14"/>
<source>OpenSSH Authentication Passphrase request</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/mainwindow.ui" line="20"/>
<source>Enter your SSH passphrase for request:</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<location filename="../src/main.cpp" line="39"/>
<source>unknown request</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
| <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>MainWindow</name>
<message>
<location filename="../src/mainwindow.ui" line="14"/>
<source>OpenSSH Authentication Passphrase request</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/mainwindow.ui" line="20"/>
<source>Enter your SSH passphrase for request:</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<location filename="../src/main.cpp" line="39"/>
<source>unknown request</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
| Fix target language in translation file template | Fix target language in translation file template
The translation file template was configured for a target language. This
prevented Linguist from showing the selection dialog when the file was
opened after copying it to a language-specific version. Not explicitly
querying the language then could have led translators to not setting a
target language and just keep the default which would have been wrong.
| TypeScript | lgpl-2.1 | lxde/lxqt-l10n | ---
+++
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
-<TS version="2.1" language="en_US">
+<TS version="2.1">
<context>
<name>MainWindow</name>
<message> |
4b8de73c3055b114f1195e12326cd9b6fef89a88 | tessera-frontend/src/ts/app/handlers/check-dirty.ts | tessera-frontend/src/ts/app/handlers/check-dirty.ts | declare var ts
window.onbeforeunload = (e) => {
if (ts.manager.current.dashboard.dirty) {
let msg = 'Dashboard has unsaved changes. Are you sure you want to leave?'
e.returnValue = msg
return msg
}
return null
}
| declare var ts
window.onbeforeunload = (e) => {
if (ts.manager.current && ts.manager.current.dashboard.dirty) {
let msg = 'Dashboard has unsaved changes. Are you sure you want to leave?'
e.returnValue = msg
return msg
}
return null
}
| Check that the dashboard is set in window.onbeforeunload | Check that the dashboard is set in window.onbeforeunload
| TypeScript | apache-2.0 | tessera-metrics/tessera,urbanairship/tessera,tessera-metrics/tessera,urbanairship/tessera,urbanairship/tessera,aalpern/tessera,aalpern/tessera,tessera-metrics/tessera,aalpern/tessera,urbanairship/tessera,tessera-metrics/tessera,tessera-metrics/tessera,urbanairship/tessera,aalpern/tessera,aalpern/tessera | ---
+++
@@ -1,7 +1,7 @@
declare var ts
window.onbeforeunload = (e) => {
- if (ts.manager.current.dashboard.dirty) {
+ if (ts.manager.current && ts.manager.current.dashboard.dirty) {
let msg = 'Dashboard has unsaved changes. Are you sure you want to leave?'
e.returnValue = msg
return msg |
a5be4a42afdea27ca3eccc9e1c7aa4c6859345e0 | test/server/webhookSpec.ts | test/server/webhookSpec.ts | /*
* Copyright (c) 2014-2021 Bjoern Kimminich.
* SPDX-License-Identifier: MIT
*/
import chai = require('chai')
const expect = chai.expect
const chaiAsPromised = require('chai-as-promised')
chai.use(chaiAsPromised)
describe('webhook', () => {
const webhook = require('../../lib/webhook')
const challenge = {
key: 'key',
name: 'name',
difficulty: 1
}
describe('notify', () => {
it('fails when no webhook URL is provided via environment variable', () => {
return expect(webhook.notify(challenge)).to.eventually.throw('options.uri is a required argument')
})
it('fails when supplied webhook is not a valid URL', () => {
return expect(webhook.notify(challenge, 0, 'localhorst')).to.eventually.throw('Invalid URI "localhorst"')
})
it('submits POST with payload to existing URL', () => {
return expect(webhook.notify(challenge, 0, 'https://enlm7zwniuyah.x.pipedream.net/')).to.eventually.not.throw()
})
})
})
| /*
* Copyright (c) 2014-2021 Bjoern Kimminich.
* SPDX-License-Identifier: MIT
*/
import chai = require('chai')
const expect = chai.expect
const chaiAsPromised = require('chai-as-promised')
chai.use(chaiAsPromised)
describe('webhook', () => {
const webhook = require('../../lib/webhook')
const challenge = {
key: 'key',
name: 'name',
difficulty: 1
}
describe('notify', () => {
it('fails when no webhook URL is provided via environment variable', () => {
void expect(webhook.notify(challenge)).to.eventually.throw('options.uri is a required argument')
})
it('fails when supplied webhook is not a valid URL', () => {
void expect(webhook.notify(challenge, 0, 'localhorst')).to.eventually.throw('Invalid URI "localhorst"')
})
it('submits POST with payload to existing URL', () => {
void expect(webhook.notify(challenge, 0, 'https://enlm7zwniuyah.x.pipedream.net/')).to.eventually.not.throw()
})
})
})
| Fix async issues in webhook tests | Fix async issues in webhook tests | TypeScript | mit | bkimminich/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop,bkimminich/juice-shop | ---
+++
@@ -19,15 +19,15 @@
describe('notify', () => {
it('fails when no webhook URL is provided via environment variable', () => {
- return expect(webhook.notify(challenge)).to.eventually.throw('options.uri is a required argument')
+ void expect(webhook.notify(challenge)).to.eventually.throw('options.uri is a required argument')
})
it('fails when supplied webhook is not a valid URL', () => {
- return expect(webhook.notify(challenge, 0, 'localhorst')).to.eventually.throw('Invalid URI "localhorst"')
+ void expect(webhook.notify(challenge, 0, 'localhorst')).to.eventually.throw('Invalid URI "localhorst"')
})
it('submits POST with payload to existing URL', () => {
- return expect(webhook.notify(challenge, 0, 'https://enlm7zwniuyah.x.pipedream.net/')).to.eventually.not.throw()
+ void expect(webhook.notify(challenge, 0, 'https://enlm7zwniuyah.x.pipedream.net/')).to.eventually.not.throw()
})
})
}) |
6c8f8cbe89e16d9570c67c8492d3c17c547e9fec | frontend/src/app/app.routing.ts | frontend/src/app/app.routing.ts | import {ModuleWithProviders} from '@angular/core';
import {Routes, RouterModule} from '@angular/router';
import {LoginComponent} from './components/login.component';
import {RegisterComponent} from './components/register.component';
import {DefaultComponent} from './components/default.component';
import {UserEditComponent} from './components/user.edit.component';
import {TaskNewComponent} from './components/task.new.component';
import {TaskDetailComponent} from './components/task.detail.component';
import {TaskEditComponent} from './components/task.edit.component';
const appRoutes: Routes = [
{path: '', component: DefaultComponent},
{path: 'index', component: DefaultComponent},
{path: 'index/:page', component: DefaultComponent},
{path: 'login', component: LoginComponent},
{path: 'login/:id', component: LoginComponent},
{path: 'register', component: RegisterComponent},
{path: 'user-edit', component: UserEditComponent},
{path: 'task-new', component: TaskNewComponent},
{path: 'task/:id', component: TaskDetailComponent},
{path: 'task-edit/:id', component: TaskEditComponent},
{path: '**', component: LoginComponent}
];
export const appRoutingProviders: any[] = [];
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
| import {ModuleWithProviders} from '@angular/core';
import {Routes, RouterModule} from '@angular/router';
import {LoginComponent} from './components/login.component';
import {RegisterComponent} from './components/register.component';
import {DefaultComponent} from './components/default.component';
import {UserEditComponent} from './components/user.edit.component';
import {TaskNewComponent} from './components/task.new.component';
import {TaskDetailComponent} from './components/task.detail.component';
import {TaskEditComponent} from './components/task.edit.component';
const appRoutes: Routes = [
{path: '', component: DefaultComponent},
{path: 'index', component: DefaultComponent},
{path: 'index/:page', component: DefaultComponent},
{path: 'login', component: LoginComponent},
{path: 'login/:id', component: LoginComponent},
{path: 'register', component: RegisterComponent},
{path: 'user-edit', component: UserEditComponent},
{path: 'task-new', component: TaskNewComponent},
{path: 'task/:id', component: TaskDetailComponent},
{path: 'index/:page/task/:id', component: TaskDetailComponent},
{path: 'task-edit/:id', component: TaskEditComponent},
{path: 'index/:page/task-edit/:id', component: TaskEditComponent},
{path: '**', component: LoginComponent}
];
export const appRoutingProviders: any[] = [];
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
| Fix al listar y editar tareas que estan paginadas. | Fix al listar y editar tareas que estan paginadas.
| TypeScript | mit | maurobonfietti/webapp,maurobonfietti/webapp | ---
+++
@@ -19,7 +19,9 @@
{path: 'user-edit', component: UserEditComponent},
{path: 'task-new', component: TaskNewComponent},
{path: 'task/:id', component: TaskDetailComponent},
+ {path: 'index/:page/task/:id', component: TaskDetailComponent},
{path: 'task-edit/:id', component: TaskEditComponent},
+ {path: 'index/:page/task-edit/:id', component: TaskEditComponent},
{path: '**', component: LoginComponent}
];
|
c20db514f40bed31ac67734a23baa45abc24203d | src/components/modal-footer.ts | src/components/modal-footer.ts | import { Component, Input, Output, EventEmitter, Type } from 'angular2/core';
import { ModalComponent } from './modal';
@Component({
selector: 'modal-footer',
template: `
<div class="modal-footer">
<ng-content></ng-content>
<button type="button" class="btn btn-default" data-dismiss="modal" (click)="modal.dismiss()" [hidden]="!showDefaultButtons">Close</button>
<button type="button" class="btn btn-primary" (click)="modal.close()" [hidden]="!showDefaultButtons">Save</button>
</div>
`
})
export class ModalFooterComponent {
@Input('show-default-buttons') showDefaultButtons: boolean = false;
constructor(private modal: ModalComponent) { }
} | import { Component, Input, Output, EventEmitter, Type } from 'angular2/core';
import { ModalComponent } from './modal';
@Component({
selector: 'modal-footer',
styles: [`
.btn[hidden] { display: none; }
`],
template: `
<div class="modal-footer">
<ng-content></ng-content>
<button type="button" class="btn btn-default" data-dismiss="modal" (click)="modal.dismiss()" [hidden]="!showDefaultButtons">Close</button>
<button type="button" class="btn btn-primary" (click)="modal.close()" [hidden]="!showDefaultButtons">Save</button>
</div>
`
})
export class ModalFooterComponent {
@Input('show-default-buttons') showDefaultButtons: boolean = false;
constructor(private modal: ModalComponent) { }
}
| Add style to fix but where btn overrides hidden. | Add style to fix but where btn overrides hidden. | TypeScript | isc | dougludlow/ng2-bs3-modal,dougludlow/ng2-bs3-modal,dougludlow/ng2-bs3-modal | ---
+++
@@ -3,6 +3,9 @@
@Component({
selector: 'modal-footer',
+ styles: [`
+ .btn[hidden] { display: none; }
+ `],
template: `
<div class="modal-footer">
<ng-content></ng-content> |
e4b6897d5a8f10584b1efebe12bd848895fb5a03 | haoshiyou/src/services/flag.service.ts | haoshiyou/src/services/flag.service.ts | import {Injectable} from "@angular/core";
declare let JSON;
@Injectable()
export class FlagService {
private flags = {
'debug': false,
'realCreate': false
};
getAllFlags() {
return this.flags;
}
setFlag(flagName:string, value:boolean) {
this.flags[flagName] = value;
}
getFlag(flagName:string):boolean {
return this.flags[flagName];
}
}
| import {Injectable} from "@angular/core";
declare let JSON;
@Injectable()
export class FlagService {
private flagMap:Object = {};
constructor(){
let url_string = window.location.href;
var url = new URL(url_string);
var flagJsonStr = url['searchParams'].get("flags");
this.flagMap = JSON.parse(flagJsonStr);
}
private flags = {
'debug': false,
'realCreate': false
};
getAllFlags() {
return this.flags;
}
setFlag(flagName:string, value:boolean) {
this.flags[flagName] = value;
}
getFlag(flagName:string):boolean {
if (this.flagMap && flagName in this.flagMap) {
return this.flagMap[flagName];
}
return this.flags[flagName];
}
}
| Add feature for flag url override | Add feature for flag url override
| TypeScript | mit | xinbenlv/rent.zzn.im,xinbenlv/rent.zzn.im,xinbenlv/rent.zzn.im,xinbenlv/rent.zzn.im,xinbenlv/rent.zzn.im | ---
+++
@@ -3,6 +3,13 @@
@Injectable()
export class FlagService {
+ private flagMap:Object = {};
+ constructor(){
+ let url_string = window.location.href;
+ var url = new URL(url_string);
+ var flagJsonStr = url['searchParams'].get("flags");
+ this.flagMap = JSON.parse(flagJsonStr);
+ }
private flags = {
'debug': false,
'realCreate': false
@@ -17,6 +24,9 @@
}
getFlag(flagName:string):boolean {
+ if (this.flagMap && flagName in this.flagMap) {
+ return this.flagMap[flagName];
+ }
return this.flags[flagName];
}
} |
291115d6e203a6ba8832e15e9b4c1f03e7b4fece | test/e2e/grid-pager-info.e2e-spec.ts | test/e2e/grid-pager-info.e2e-spec.ts | import { browser, element, by } from '../../node_modules/protractor/built';
describe('grid pager info', () => {
let paginator = element(by.tagName('ngb-pagination')).$$('nav').$$('ul').$$('li'),
gridPagerInfo = element(by.tagName('grid-pager-info')).$$('div'),
pageSizeSelector = element(by.tagName('page-size-selector')).$('form').$('div').$('select');
gridSearchInput = element(by.tagName('grid-search')).$$('div').$$('div').$$('input');
beforeEach(() => {
browser.get('/');
pageSizeSelector.$('[value="10"]').click();
});
it('should show text in accordance to numbered of filter rows and current results-page',() => {
expect(gridPagerInfo.first().getText()).toEqual('Showing 1 to 10 of 53 records');
paginator.get(7).$$('a').click();
pageSizeSelector.$('[value="20"]').click();
expect(gridPagerInfo.first().getText()).toEqual('Showing 21 to 40 of 53 records');
paginator.get(5).$$('a').click();
expect(gridPagerInfo.first().getText()).toEqual('Showing 41 to 60 of 53 records');
});
it('should show count in footer', () => {
gridSearchInput.sendKeys('a');
expect(gridPagerInfo.first().getText()).toContain('(Filtered from 53 total records)');
});
}); | import { browser, element, by } from '../../node_modules/protractor/built';
describe('grid pager info', () => {
let paginator = element(by.tagName('ngb-pagination')).$$('nav').$$('ul').$$('li'),
gridPagerInfo = element(by.tagName('grid-pager-info')).$$('div'),
pageSizeSelector = element(by.tagName('page-size-selector')).$('form').$('div').$('select');
gridSearchInput = element(by.tagName('grid-search')).$('div').$('div').$('input');
beforeEach(() => {
browser.get('/');
pageSizeSelector.$('[value="10"]').click();
});
it('should show text in accordance to numbered of filter rows and current results-page',() => {
expect(gridPagerInfo.first().getText()).toEqual('Showing 1 to 10 of 53 records');
paginator.get(7).$$('a').click();
pageSizeSelector.$('[value="20"]').click();
expect(gridPagerInfo.first().getText()).toEqual('Showing 21 to 40 of 53 records');
paginator.get(5).$$('a').click();
expect(gridPagerInfo.first().getText()).toEqual('Showing 41 to 60 of 53 records');
});
it('should show count in footer', () => {
gridSearchInput.sendKeys('a');
expect(gridPagerInfo.first().getText()).toContain('(Filtered from 53 total records)');
});
}); | Fix issues with e2e testing | Fix issues with e2e testing
| TypeScript | mit | unosquare/tubular2,unosquare/tubular2,unosquare/tubular2,unosquare/tubular2 | ---
+++
@@ -5,7 +5,7 @@
let paginator = element(by.tagName('ngb-pagination')).$$('nav').$$('ul').$$('li'),
gridPagerInfo = element(by.tagName('grid-pager-info')).$$('div'),
pageSizeSelector = element(by.tagName('page-size-selector')).$('form').$('div').$('select');
- gridSearchInput = element(by.tagName('grid-search')).$$('div').$$('div').$$('input');
+ gridSearchInput = element(by.tagName('grid-search')).$('div').$('div').$('input');
beforeEach(() => {
browser.get('/'); |
99e83e2ddd1163a5e4e01ebd0672ede0f2ed03e6 | app/src/renderer/components/styles.ts | app/src/renderer/components/styles.ts | // Copyright (c) 2016 Vadim Macagon
// MIT License, see LICENSE file for full terms.
/**
* Style mixins for flex-box layouts based on https://github.com/PolymerElements/iron-flex-layout/
* The naming should remain consistent with Polymer's implementation, but cross-browser support is
* irrelevant, these just need to work in Electron.
*/
export var IronFlexLayout = {
/** Flex container with a horizontal main-axis. */
horizontal: {
display: 'flex',
'flex-direction': 'row'
},
/** Flex container with a vertical main-axis. */
vertical: {
display: 'flex',
'flex-direction': 'column'
},
/**
* Shorthand for specifying how a flex item should alter its dimensions to fill available space
* in a flex container.
*/
flex: {
/** flex: 1 1 auto */
auto: {
flex: '1 1 auto'
},
/** flex: none */
none: {
flex: 'none'
}
},
fit: {
position: 'absolute',
top: 0,
right: 0,
bottom: 0,
left: 0
}
};
| // Copyright (c) 2016 Vadim Macagon
// MIT License, see LICENSE file for full terms.
/**
* Style mixins for flex-box layouts based on https://github.com/PolymerElements/iron-flex-layout/
* The naming should remain consistent with Polymer's implementation, but cross-browser support is
* irrelevant, these just need to work in Electron.
*/
export var IronFlexLayout = {
/** Flex container with a horizontal main-axis. */
horizontal: {
display: 'flex',
'flex-direction': 'row'
},
/** Flex container with a vertical main-axis. */
vertical: {
display: 'flex',
'flex-direction': 'column'
},
/**
* Shorthand for specifying how a flex item should alter its dimensions to fill available space
* in a flex container.
*/
flex: {
/** flex: 1 1 auto */
auto: {
flex: '1 1 auto'
},
/** flex: none */
none: {
flex: 'none'
}
},
/* alignment in cross axis */
start: {
'align-items': 'flex-start'
},
center: {
'align-items': 'center'
},
end: {
'align-items': 'flex-end'
},
fit: {
position: 'absolute',
top: 0,
right: 0,
bottom: 0,
left: 0
}
};
/**
* Style mixins based on https://github.com/PolymerElements/paper-styles/
*/
export var PaperStyles = {
/* Typography */
PaperFont: {
/* Shared styles */
Common: {
Base: {
'font-family': "'Roboto', 'Noto', sans-serif",
'-webkit-font-smoothing': 'antialiased'
}
}
}
};
| Add some additional flex-box, and paper-font style mixins | Add some additional flex-box, and paper-font style mixins
| TypeScript | mit | debugworkbench/hydragon,debugworkbench/hydragon,debugworkbench/hydragon | ---
+++
@@ -31,6 +31,19 @@
flex: 'none'
}
},
+
+ /* alignment in cross axis */
+
+ start: {
+ 'align-items': 'flex-start'
+ },
+ center: {
+ 'align-items': 'center'
+ },
+ end: {
+ 'align-items': 'flex-end'
+ },
+
fit: {
position: 'absolute',
top: 0,
@@ -39,3 +52,19 @@
left: 0
}
};
+
+/**
+ * Style mixins based on https://github.com/PolymerElements/paper-styles/
+ */
+export var PaperStyles = {
+ /* Typography */
+ PaperFont: {
+ /* Shared styles */
+ Common: {
+ Base: {
+ 'font-family': "'Roboto', 'Noto', sans-serif",
+ '-webkit-font-smoothing': 'antialiased'
+ }
+ }
+ }
+}; |
76bbfb6502ab5b353e13b64756e9b013752f91d3 | js/type-service/src/type-tags.spec.ts | js/type-service/src/type-tags.spec.ts |
import {Tags, TypeTags} from './type-tags';
import { expect } from 'chai';
import {LocalFileTypeService} from "./local-file-type-service";
import fs = require('fs');
import * as _ from "lodash";
describe('Test pValue and fold change tagging', () => {
let pvalueAndFCHeader = ["pppvalue", "FaaC", "logFC", "happy", "times", "p.test"];
let noPvalueHeader = ["logFC", "summer"];
it('return true for header with pValue and fold change columns', () => {
expect(TypeTags.pValueAndFoldChangeCompatible(pvalueAndFCHeader)).to.equal(true);
});
it('return false for header with no pValue column', () => {
expect(TypeTags.pValueAndFoldChangeCompatible(noPvalueHeader)).to.equal(false);
});
});
describe('Test fast tags', () => {
it('return PNG for .png files', () => {
expect(TypeTags.getFastTypeTags('image.png')).to.have.keys(Tags.PNG.id);
})
});
describe('Test tagging for all test files', () => {
it('return tags', () => {
fs.readdirSync('./test-files').forEach(filename => {
let tags = LocalFileTypeService.getTypeTags('./test-files/' + filename);
console.log("\t", filename, _.keys(tags).reduce((s, current) => current), "");
expect(tags).not.to.be.empty;
});
})
});
|
import {Tags, TypeTags} from './type-tags';
import { expect } from 'chai';
import {LocalFileTypeService} from "./local-file-type-service";
import fs = require('fs');
import * as _ from "lodash";
describe('Test pValue and fold change tagging', () => {
let pvalueAndFCHeader = ["pppvalue", "FaaC", "logFC", "happy", "times", "p.test"];
let noPvalueHeader = ["logFC", "summer"];
it('return true for header with pValue and fold change columns', () => {
expect(TypeTags.pValueAndFoldChangeCompatible(pvalueAndFCHeader)).to.equal(true);
});
it('return false for header with no pValue column', () => {
expect(TypeTags.pValueAndFoldChangeCompatible(noPvalueHeader)).to.equal(false);
});
});
describe('Test fast tags', () => {
it('return PNG for .png files', () => {
expect(TypeTags.getFastTypeTags('image.png')).to.have.keys(Tags.PNG.id);
})
});
describe('Test tagging for all test files', () => {
it('return tags', () => {
fs.readdirSync('./test-files').forEach(filename => {
let tags = LocalFileTypeService.getTypeTags('./test-files/' + filename);
console.log("\t", filename, _.keys(tags).reduce((all, current) => (all += " " + current)), "");
expect(tags).not.to.be.empty;
});
})
});
| Fix type tag test output | Fix type tag test output
| TypeScript | mit | chipster/chipster-web-server,chipster/chipster-web-server,chipster/chipster-web-server,chipster/chipster-web-server,chipster/chipster-web-server | ---
+++
@@ -26,7 +26,7 @@
it('return tags', () => {
fs.readdirSync('./test-files').forEach(filename => {
let tags = LocalFileTypeService.getTypeTags('./test-files/' + filename);
- console.log("\t", filename, _.keys(tags).reduce((s, current) => current), "");
+ console.log("\t", filename, _.keys(tags).reduce((all, current) => (all += " " + current)), "");
expect(tags).not.to.be.empty;
});
}) |
e49412c448c61c3b1259b916f41aa5a3a4a15d5c | lib/components/src/html.tsx | lib/components/src/html.tsx | import React from 'react';
import * as rawComponents from './typography/DocumentFormatting';
export * from './typography/DocumentFormatting';
export const components = Object.entries(rawComponents).reduce(
(acc, [k, V]) => ({
...acc,
[k.toLowerCase()]: (props: object) => <V {...props} className={`sbdocs-${k.toLowerCase()}`} />,
}),
{}
);
| import React from 'react';
import * as rawComponents from './typography/DocumentFormatting';
export * from './typography/DocumentFormatting';
export const components = Object.entries(rawComponents).reduce(
(acc, [k, V]) => ({
...acc,
[k.toLowerCase()]: (props: object) => (
<V {...props} className={`sbdocs sbdocs-${k.toLowerCase()}`} />
),
}),
{}
);
| Add idiomatic sbdocs classname to all docs components | Add idiomatic sbdocs classname to all docs components
| TypeScript | mit | storybooks/storybook,storybooks/storybook,storybooks/react-storybook,storybooks/storybook,kadirahq/react-storybook,storybooks/react-storybook,storybooks/storybook,storybooks/react-storybook,storybooks/storybook,storybooks/storybook,kadirahq/react-storybook,storybooks/storybook,storybooks/react-storybook | ---
+++
@@ -6,7 +6,9 @@
export const components = Object.entries(rawComponents).reduce(
(acc, [k, V]) => ({
...acc,
- [k.toLowerCase()]: (props: object) => <V {...props} className={`sbdocs-${k.toLowerCase()}`} />,
+ [k.toLowerCase()]: (props: object) => (
+ <V {...props} className={`sbdocs sbdocs-${k.toLowerCase()}`} />
+ ),
}),
{}
); |
a7a5ae3fe124c5771b313475a2556acdc1bb0f4b | addons/backgrounds/src/index.ts | addons/backgrounds/src/index.ts | import { addons, makeDecorator, StoryContext, StoryGetter, WrapperSettings } from '@storybook/addons';
import deprecate from 'util-deprecate';
import { REGISTER_SUBSCRIPTION } from '@storybook/core-events';
import { EVENTS } from './constants';
import { BackgroundConfig } from './models';
let prevBackgrounds: BackgroundConfig[];
const subscription = () => () => {
prevBackgrounds = null;
addons.getChannel().emit(EVENTS.UNSET);
};
export const withBackgrounds = makeDecorator({
name: 'withBackgrounds',
parameterName: 'backgrounds',
skipIfNoParametersOrOptions: true,
allowDeprecatedUsage: true,
wrapper: (getStory: StoryGetter, context: StoryContext, { options, parameters }: WrapperSettings) => {
const data = parameters || options || [];
const backgrounds = Array.isArray(data) ? data : Object.values(data);
if (backgrounds.length === 0) {
return getStory(context);
}
if (prevBackgrounds !== backgrounds) {
addons.getChannel().emit(EVENTS.SET, backgrounds);
prevBackgrounds = backgrounds;
}
addons.getChannel().emit(REGISTER_SUBSCRIPTION, subscription);
return getStory(context);
},
});
export default deprecate(
withBackgrounds,
'The default export of @storybook/addon-backgrounds is deprecated, please `import { withBackgrounds }` instead'
);
if (module && module.hot && module.hot.decline) {
module.hot.decline();
}
| import { addons, makeDecorator, StoryContext, StoryGetter, WrapperSettings } from '@storybook/addons';
import deprecate from 'util-deprecate';
import { REGISTER_SUBSCRIPTION } from '@storybook/core-events';
import { EVENTS } from './constants';
import { BackgroundConfig } from './models';
let prevBackgrounds: BackgroundConfig[];
const subscription = () => () => {
prevBackgrounds = null;
addons.getChannel().emit(EVENTS.UNSET);
};
export const withBackgrounds = makeDecorator({
name: 'withBackgrounds',
parameterName: 'backgrounds',
skipIfNoParametersOrOptions: true,
allowDeprecatedUsage: true,
wrapper: (getStory: StoryGetter, context: StoryContext, { options, parameters }: WrapperSettings) => {
const data = parameters || options || [];
const backgrounds = Array.isArray(data) ? data : Object.values(data);
if (backgrounds.length === 0) {
return getStory(context);
}
if (prevBackgrounds !== backgrounds) {
addons.getChannel().emit(EVENTS.SET, backgrounds);
prevBackgrounds = backgrounds;
}
addons.getChannel().emit(REGISTER_SUBSCRIPTION, subscription);
return getStory(context);
},
});
if (module && module.hot && module.hot.decline) {
module.hot.decline();
}
| REMOVE previously deprecated default export from backgrounds | REMOVE previously deprecated default export from backgrounds
| TypeScript | mit | storybooks/storybook,storybooks/react-storybook,storybooks/storybook,storybooks/storybook,storybooks/react-storybook,storybooks/react-storybook,storybooks/storybook,storybooks/react-storybook,kadirahq/react-storybook,storybooks/storybook,kadirahq/react-storybook,storybooks/storybook,storybooks/storybook | ---
+++
@@ -35,11 +35,6 @@
},
});
-export default deprecate(
- withBackgrounds,
- 'The default export of @storybook/addon-backgrounds is deprecated, please `import { withBackgrounds }` instead'
-);
-
if (module && module.hot && module.hot.decline) {
module.hot.decline();
} |
bf1ddb3d8ddeaae54bd8289a48e6d6c0987a6e27 | src/api/post-photoset-bulk-reorder.ts | src/api/post-photoset-bulk-reorder.ts | import * as request from 'superagent'
import { getLogger } from '../services/log'
import * as API from './types/api'
const debugPostPhotosetBulkReorder = getLogger('/api/post-photoset-bulk-reorder.ts').debug
export function postPhotosetBulkReorder(
nsid: string,
setIds: string[],
orderBy: API.IOrderByOption,
isDesc: boolean,
token: string,
secret: string,
): request.SuperAgentRequest {
debugPostPhotosetBulkReorder(`Bulk reorder photosets: ${setIds}`)
return request.post('/api/photosets/bulk_reorder')
.set({ 'X-Accel-Buffering': 'no' })
.accept('application/octet-stream')
.send({ nsid, setIds, orderBy, isDesc, token, secret })
}
| import * as request from 'superagent'
import { getLogger } from '../services/log'
import * as API from './types/api'
const debugPostPhotosetBulkReorder = getLogger('/api/post-photoset-bulk-reorder.ts').debug
export function postPhotosetBulkReorder(
nsid: string,
setIds: string[],
orderBy: API.IOrderByOption,
isDesc: boolean,
token: string,
secret: string,
): request.SuperAgentRequest {
debugPostPhotosetBulkReorder(`Bulk reorder photosets: ${setIds}`)
return request.post('/api/photosets/bulk_reorder')
.send({ nsid, setIds, orderBy, isDesc, token, secret })
}
| Revert "Set HTTP header to disable nginx proxy buffer" | Revert "Set HTTP header to disable nginx proxy buffer"
This reverts commit 6414d8619e1f8889aea4c094717c3d3454a0ef4a.
| TypeScript | apache-2.0 | whitetrefoil/flickr-simple-reorder,whitetrefoil/flickr-simple-reorder,whitetrefoil/flickr-simple-reorder | ---
+++
@@ -16,7 +16,5 @@
debugPostPhotosetBulkReorder(`Bulk reorder photosets: ${setIds}`)
return request.post('/api/photosets/bulk_reorder')
- .set({ 'X-Accel-Buffering': 'no' })
- .accept('application/octet-stream')
.send({ nsid, setIds, orderBy, isDesc, token, secret })
} |
2f9f6d1354c447c6d263cef8b9c18db66ccdcf74 | src/app/score/score.component.spec.ts | src/app/score/score.component.spec.ts | /* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { ScoreComponent } from './score.component';
describe('ScoreComponent', () => {
let component: ScoreComponent;
let fixture: ComponentFixture<ScoreComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ScoreComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ScoreComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
| /* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { ScoreComponent } from './score.component';
describe('ScoreComponent', () => {
let component: ScoreComponent;
let fixture: ComponentFixture<ScoreComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ScoreComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ScoreComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component instanceof ScoreComponent).toBeTruthy();
});
});
| Revert "Not messing with the unit tests yet" | Revert "Not messing with the unit tests yet"
This reverts commit bf0d8f7954eb7e00331a25802fd578dc90d897fe.
| TypeScript | mit | thielCole/crossfit-leaderboard,thielCole/crossfit-leaderboard,thielCole/crossfit-leaderboard | ---
+++
@@ -23,6 +23,6 @@
});
it('should create', () => {
- expect(component).toBeTruthy();
+ expect(component instanceof ScoreComponent).toBeTruthy();
});
}); |
f806b7d0a542ea79e2507986d39809244524df3f | lib/button/src/share-button.module.ts | lib/button/src/share-button.module.ts | import { NgModule, InjectionToken } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ShareModule, ShareButtons, ShareButtonsConfig, CONFIG } from '@ngx-share/core';
import { ShareButtonComponent } from './share-button.component';
export function ShareButtonsFactory(config: ShareButtonsConfig) {
return new ShareButtons(config);
}
@NgModule({
declarations: [
ShareButtonComponent
],
imports: [
ShareModule,
CommonModule
],
exports: [
ShareModule,
ShareButtonComponent
]
})
export class ShareButtonModule {
static forRoot(config?: ShareButtonsConfig) {
return {
ngModule: ShareButtonModule,
providers: [
{provide: CONFIG, useValue: config},
{
provide: ShareButtons,
useFactory: ShareButtonsFactory,
deps: [CONFIG]
}
]
};
}
}
| import { NgModule, InjectionToken } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ShareModule, ShareButtons, ShareButtonsConfig, CONFIG } from '@ngx-share/core';
import { ShareButtonComponent } from './share-button.component';
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
export function ShareButtonsFactory(config: ShareButtonsConfig) {
return new ShareButtons(config);
}
@NgModule({
declarations: [
ShareButtonComponent
],
imports: [
ShareModule,
FontAwesomeModule,
CommonModule
],
exports: [
ShareModule,
FontAwesomeModule,
ShareButtonComponent
]
})
export class ShareButtonModule {
static forRoot(config?: ShareButtonsConfig) {
return {
ngModule: ShareButtonModule,
providers: [
{provide: CONFIG, useValue: config},
{
provide: ShareButtons,
useFactory: ShareButtonsFactory,
deps: [CONFIG]
}
]
};
}
}
| Use FontAwesomeModule for share icons | feat(ShareButtonModule): Use FontAwesomeModule for share icons
| TypeScript | mit | MurhafSousli/ng2-sharebuttons,MurhafSousli/ng2-sharebuttons,MurhafSousli/ng2-sharebuttons | ---
+++
@@ -3,6 +3,7 @@
import { ShareModule, ShareButtons, ShareButtonsConfig, CONFIG } from '@ngx-share/core';
import { ShareButtonComponent } from './share-button.component';
+import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
export function ShareButtonsFactory(config: ShareButtonsConfig) {
return new ShareButtons(config);
@@ -14,10 +15,12 @@
],
imports: [
ShareModule,
+ FontAwesomeModule,
CommonModule
],
exports: [
ShareModule,
+ FontAwesomeModule,
ShareButtonComponent
]
}) |
16a8f828e29a3ba793c267f6656725e80a02eb79 | src/js/server/apply/applicant-info.ts | src/js/server/apply/applicant-info.ts | import { Hacker } from 'js/server/models';
import * as statuses from 'js/shared/status-constants';
import { getApplicationStatus, getTeamApplicationStatus } from 'js/server/models/Hacker';
export const unfinishedApplicationKind = { INDIVIDUAL: 'individual', TEAM_ONLY: 'team-only' };
export function getHackersWithUnfinishedApplications(kind) {
return Hacker.findAll().then(hackers =>
Promise.all(hackers.map(hacker =>
hacker.getHackerApplication().then(hackerApplication =>
Promise.all([
getApplicationStatus(hackerApplication),
getTeamApplicationStatus(hackerApplication)
]).then(([applicationStatus, teamApplicationStatus]) => {
if (kind == unfinishedApplicationKind.INDIVIDUAL) {
return applicationStatus == statuses.application.INCOMPLETE ? hacker : null;
} else if (kind == unfinishedApplicationKind.TEAM_ONLY) {
// The value of teamApplicationStatus is null if the individual application hasn't been finished,
// so ensure we only return the hacker when teamApplicationStatus is INCOMPLETE.
return teamApplicationStatus == statuses.teamApplication.INCOMPLETE ? hacker : null;
} else {
throw Error('Unknown unfinished application kind');
}
})
)
)).then(hackerResults => hackerResults.filter(result => result !== null))
);
}
| import { Hacker } from 'js/server/models';
import * as statuses from 'js/shared/status-constants';
import { getApplicationStatus, getTeamApplicationStatus } from 'js/server/models/Hacker';
export const unfinishedApplicationKind = { INDIVIDUAL: 'individual', TEAM_ONLY: 'team-only' };
export function getHackersWithUnfinishedApplications(kind) {
return Hacker.findAll().then(hackers =>
Promise.all(hackers.map(hacker =>
hacker.getHackerApplication().then(hackerApplication =>
Promise.all([getApplicationStatus(),getTeamApplicationStatus()])
.then(([applicationStatus, teamApplicationStatus]) => {
if (kind == unfinishedApplicationKind.INDIVIDUAL) {
return applicationStatus == statuses.application.INCOMPLETE ? hacker : null;
} else if (kind == unfinishedApplicationKind.TEAM_ONLY) {
// The value of teamApplicationStatus is null if the individual application hasn't been finished,
// so ensure we only return the hacker when teamApplicationStatus is INCOMPLETE.
return teamApplicationStatus == statuses.teamApplication.INCOMPLETE ? hacker : null;
} else {
throw Error('Unknown unfinished application kind');
}
})
)
)).then(hackerResults => hackerResults.filter(result => result !== null))
);
}
| Update to match new functions | Update to match new functions
| TypeScript | mit | hackcambridge/hack-cambridge-website,hackcambridge/hack-cambridge-website,hackcambridge/hack-cambridge-website,hackcambridge/hack-cambridge-website | ---
+++
@@ -8,21 +8,19 @@
return Hacker.findAll().then(hackers =>
Promise.all(hackers.map(hacker =>
hacker.getHackerApplication().then(hackerApplication =>
- Promise.all([
- getApplicationStatus(hackerApplication),
- getTeamApplicationStatus(hackerApplication)
- ]).then(([applicationStatus, teamApplicationStatus]) => {
- if (kind == unfinishedApplicationKind.INDIVIDUAL) {
- return applicationStatus == statuses.application.INCOMPLETE ? hacker : null;
- } else if (kind == unfinishedApplicationKind.TEAM_ONLY) {
- // The value of teamApplicationStatus is null if the individual application hasn't been finished,
- // so ensure we only return the hacker when teamApplicationStatus is INCOMPLETE.
- return teamApplicationStatus == statuses.teamApplication.INCOMPLETE ? hacker : null;
- } else {
- throw Error('Unknown unfinished application kind');
- }
- })
- )
- )).then(hackerResults => hackerResults.filter(result => result !== null))
+ Promise.all([getApplicationStatus(),getTeamApplicationStatus()])
+ .then(([applicationStatus, teamApplicationStatus]) => {
+ if (kind == unfinishedApplicationKind.INDIVIDUAL) {
+ return applicationStatus == statuses.application.INCOMPLETE ? hacker : null;
+ } else if (kind == unfinishedApplicationKind.TEAM_ONLY) {
+ // The value of teamApplicationStatus is null if the individual application hasn't been finished,
+ // so ensure we only return the hacker when teamApplicationStatus is INCOMPLETE.
+ return teamApplicationStatus == statuses.teamApplication.INCOMPLETE ? hacker : null;
+ } else {
+ throw Error('Unknown unfinished application kind');
+ }
+ })
+ )
+ )).then(hackerResults => hackerResults.filter(result => result !== null))
);
} |
2aa6cac8640d0595304d185ceb7f254b7085c8cc | src/statusBar/controller.ts | src/statusBar/controller.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Alessandro Fragnani. All rights reserved.
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Disposable, window, workspace } from "vscode";
import { FileAccess } from "./../constants";
import { Container } from "./../container";
import { StatusBar } from "./statusBar";
export class Controller {
private statusBar: StatusBar;
private disposable: Disposable;
constructor() {
this.statusBar = new StatusBar();
this.statusBar.update();
Container.context.subscriptions.push(this.statusBar);
window.onDidChangeActiveTextEditor(_editor => {
this.statusBar.update();
}, null, Container.context.subscriptions);
workspace.onDidChangeConfiguration(cfg => {
if (cfg.affectsConfiguration("fileAccess.position")) {
this.statusBar.dispose();
this.statusBar = undefined;
this.statusBar = new StatusBar();
}
if (cfg.affectsConfiguration("fileAccess")) {
this.updateStatusBar();
}
}, null, Container.context.subscriptions);
}
public dispose() {
this.disposable.dispose();
}
public updateStatusBar(fileAccess?: FileAccess) {
this.statusBar.update(fileAccess);
}
}
| /*---------------------------------------------------------------------------------------------
* Copyright (c) Alessandro Fragnani. All rights reserved.
* Licensed under the MIT License. See License.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Disposable, window, workspace } from "vscode";
import { FileAccess } from "./../constants";
import { Container } from "./../container";
import { StatusBar } from "./statusBar";
export class Controller {
private statusBar: StatusBar;
private disposable: Disposable;
private timeout: NodeJS.Timeout | null;
constructor() {
this.statusBar = new StatusBar();
this.statusBar.update();
Container.context.subscriptions.push(this.statusBar);
window.onDidChangeActiveTextEditor(_editor => {
this.statusBar.update();
}, null, Container.context.subscriptions);
workspace.onDidChangeConfiguration(cfg => {
if (cfg.affectsConfiguration("fileAccess.position")) {
this.statusBar.dispose();
this.statusBar = undefined;
this.statusBar = new StatusBar();
}
if (cfg.affectsConfiguration("fileAccess")) {
this.updateStatusBar();
}
}, null, Container.context.subscriptions);
workspace.onWillSaveTextDocument(e => {
const local = this.timeout;
if (local) {
clearTimeout(local);
}
this.timeout = setTimeout(() => {
this.statusBar.update();
}, 50);
});
}
public dispose() {
this.disposable.dispose();
}
public updateStatusBar(fileAccess?: FileAccess) {
this.statusBar.update(fileAccess);
}
}
| Update the status bar after saving. | Update the status bar after saving.
| TypeScript | mit | alefragnani/vscode-read-only-indicator,alefragnani/vscode-read-only-indicator | ---
+++
@@ -11,6 +11,8 @@
export class Controller {
private statusBar: StatusBar;
private disposable: Disposable;
+
+ private timeout: NodeJS.Timeout | null;
constructor() {
this.statusBar = new StatusBar();
@@ -33,6 +35,16 @@
this.updateStatusBar();
}
}, null, Container.context.subscriptions);
+
+ workspace.onWillSaveTextDocument(e => {
+ const local = this.timeout;
+ if (local) {
+ clearTimeout(local);
+ }
+ this.timeout = setTimeout(() => {
+ this.statusBar.update();
+ }, 50);
+ });
}
public dispose() { |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.