mirror of
https://github.com/Kong/insomnia.git
synced 2026-10-27 09:09:14 -04:00
chore: single letter variables (#4848)
This commit is contained in:
1 parent
325abe1d00
commit
c6a17d8a3e
132 files changed
+605
-627
No files matched your search
@@ -14,7 +14,7 @@ function isPromise(obj: unknown) {
|
||||
}
|
||||
|
||||
export interface AsyncButtonProps<T> extends ButtonProps {
|
||||
onClick: (e: React.MouseEvent<HTMLButtonElement>) => Promise<T> | undefined;
|
||||
onClick: (event: React.MouseEvent<HTMLButtonElement>) => Promise<T> | undefined;
|
||||
loadingNode?: ReactNode;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ export interface CardProps {
|
||||
docVersion?: ReactNode;
|
||||
tagLabel: ReactNode;
|
||||
docFormat?: ReactNode;
|
||||
onChange?: (e: React.SyntheticEvent<HTMLInputElement>) => any;
|
||||
onClick?: (e: React.SyntheticEvent<HTMLDivElement>) => any;
|
||||
onChange?: (event: React.SyntheticEvent<HTMLInputElement>) => any;
|
||||
onClick?: (event: React.SyntheticEvent<HTMLDivElement>) => any;
|
||||
selectable?: boolean;
|
||||
}
|
||||
|
||||
@@ -234,13 +234,13 @@ export class Card extends PureComponent<CardProps, State> {
|
||||
selectable: false,
|
||||
};
|
||||
|
||||
_handleOnChange(e: React.SyntheticEvent<HTMLInputElement>) {
|
||||
_handleOnChange(event: React.SyntheticEvent<HTMLInputElement>) {
|
||||
this.setState({
|
||||
selected: !this.state.selected,
|
||||
});
|
||||
|
||||
if (this.props.onChange) {
|
||||
this.props.onChange(e);
|
||||
this.props.onChange(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -200,8 +200,8 @@ export class Dropdown extends PureComponent<DropdownProps, State> {
|
||||
}
|
||||
}
|
||||
|
||||
_handleCheckFilterSubmit(e: React.KeyboardEvent<HTMLInputElement>) {
|
||||
if (e.key === 'Enter') {
|
||||
_handleCheckFilterSubmit(event: React.KeyboardEvent<HTMLInputElement>) {
|
||||
if (event.key === 'Enter') {
|
||||
// Listen for the Enter key and "click" on the active list item
|
||||
const selector = `li[data-filter-index="${this.state.filterActiveIndex}"] button`;
|
||||
this._dropdownList?.querySelector<HTMLButtonElement>(selector)?.click();
|
||||
|
||||
@@ -53,12 +53,12 @@ export const RadioButtonGroup: FunctionComponent<RadioButtonGroupProps> = ({
|
||||
className,
|
||||
selectedValue,
|
||||
}) => {
|
||||
const handleChange = useCallback(e => {
|
||||
const handleChange = useCallback(event => {
|
||||
if (typeof onChange !== 'function') {
|
||||
return;
|
||||
}
|
||||
|
||||
onChange(e.currentTarget.value);
|
||||
onChange(event.currentTarget.value);
|
||||
}, [onChange]);
|
||||
|
||||
return (
|
||||
|
||||
@@ -65,8 +65,8 @@ export const SidebarHeader: FunctionComponent<SidebarHeaderProps> = ({
|
||||
}) => {
|
||||
const handleFilterClick: React.MouseEventHandler<HTMLSpanElement> | undefined =
|
||||
sectionVisible && toggleFilter // only handle a click if the section is open
|
||||
? e => {
|
||||
e.stopPropagation(); // Prevent a parent from also handling the click
|
||||
? event => {
|
||||
event.stopPropagation(); // Prevent a parent from also handling the click
|
||||
|
||||
toggleFilter();
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ export interface SwitchItem {
|
||||
|
||||
export interface SwitchProps {
|
||||
className?: string;
|
||||
onClick?: (e: React.SyntheticEvent<HTMLInputElement>) => any;
|
||||
onClick?: (event: React.SyntheticEvent<HTMLInputElement>) => any;
|
||||
optionItems?: SwitchItem[];
|
||||
}
|
||||
|
||||
|
||||
@@ -71,8 +71,8 @@ export class Tooltip extends PureComponent<TooltipProps, State> {
|
||||
movedToBody: false,
|
||||
};
|
||||
|
||||
_handleStopClick(e: MouseEvent) {
|
||||
e.stopPropagation();
|
||||
_handleStopClick(event: MouseEvent) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
_handleMouseEnter() {
|
||||
|
||||
@@ -28,8 +28,8 @@ export const jarFromCookies = (cookies: Cookie[]) => {
|
||||
// Create a copy first just to be sure.
|
||||
const copy = JSON.stringify({ cookies });
|
||||
jar = CookieJar.fromJSON(copy);
|
||||
} catch (e) {
|
||||
console.log('[cookies] Failed to initialize cookie jar', e);
|
||||
} catch (error) {
|
||||
console.log('[cookies] Failed to initialize cookie jar', error);
|
||||
jar = new CookieJar() as CookieJar;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ export const convert: Converter = rawData => {
|
||||
|
||||
try {
|
||||
data = JSON.parse(rawData) as Insomnia2Data;
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ export const convert: Converter = rawData => {
|
||||
|
||||
try {
|
||||
data = JSON.parse(rawData) as Insomnia3Data;
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ export const convert: Converter = rawData => {
|
||||
|
||||
try {
|
||||
data = YAML.parse(rawData);
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ export const convert: Converter<Data> = rawData => {
|
||||
}, {}),
|
||||
},
|
||||
];
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ export const convert: Converter = async rawData => {
|
||||
const postmanJson = JSON.stringify(postmanData);
|
||||
return postman.convert(postmanJson);
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
// Nothing
|
||||
}
|
||||
|
||||
|
||||
@@ -88,8 +88,8 @@ export const generateConfig = async (
|
||||
logger.trace(`Generating config from file \`${fileName}\``);
|
||||
result = await generate(fileName, conversionType, generationTags);
|
||||
}
|
||||
} catch (e) {
|
||||
throw new InsoError('There was an error while generating configuration', e);
|
||||
} catch (error) {
|
||||
throw new InsoError('There was an error while generating configuration', error);
|
||||
}
|
||||
|
||||
if (!result?.documents || !Array.isArray(result.documents)) {
|
||||
|
||||
@@ -38,15 +38,15 @@ export async function lintSpecification(
|
||||
|
||||
try {
|
||||
specContent = (await fs.promises.readFile(fileName)).toString();
|
||||
} catch (e) {
|
||||
throw new InsoError(`Failed to read "${fileName}"`, e);
|
||||
} catch (error) {
|
||||
throw new InsoError(`Failed to read "${fileName}"`, error);
|
||||
}
|
||||
} else {
|
||||
logger.fatal('Specification not found.');
|
||||
return false;
|
||||
}
|
||||
} catch (e) {
|
||||
logger.fatal(e.message);
|
||||
} catch (error) {
|
||||
logger.fatal(error.message);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -85,8 +85,8 @@ const insomniaAdapter: DbAdapter = async (filePath, filterTypes) => {
|
||||
} | undefined;
|
||||
try {
|
||||
parsed = YAML.parse(content);
|
||||
} catch (e) {
|
||||
throw new InsoError(`Failed to parse ${fileName}.`, e);
|
||||
} catch (error) {
|
||||
throw new InsoError(`Failed to parse ${fileName}.`, error);
|
||||
}
|
||||
|
||||
// We are supporting only v4 files
|
||||
|
||||
@@ -11,7 +11,7 @@ const loadBaseEnvironmentForWorkspace = (db: Database, workspaceId: string): Env
|
||||
'Load base environment for the workspace `%s` from data store',
|
||||
workspaceId,
|
||||
);
|
||||
const items = db.Environment.filter(e => e.parentId === workspaceId);
|
||||
const items = db.Environment.filter(environment => environment.parentId === workspaceId);
|
||||
logger.trace('Found %d.', items.length);
|
||||
return ensureSingle(items, 'base environment');
|
||||
};
|
||||
@@ -59,11 +59,11 @@ export const promptEnvironment = async (
|
||||
|
||||
// Get the sub environments
|
||||
const baseWorkspaceEnv = loadBaseEnvironmentForWorkspace(db, workspaceId);
|
||||
const subEnvs = db.Environment.filter(
|
||||
e => e.parentId === baseWorkspaceEnv._id,
|
||||
const subEnvironments = db.Environment.filter(
|
||||
subEnv => subEnv.parentId === baseWorkspaceEnv._id,
|
||||
);
|
||||
|
||||
if (!subEnvs.length) {
|
||||
if (!subEnvironments.length) {
|
||||
logger.trace('No sub environments found, using base environment');
|
||||
return baseWorkspaceEnv;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ export const promptEnvironment = async (
|
||||
const prompt = new AutoComplete({
|
||||
name: 'environment',
|
||||
message: 'Select an environment',
|
||||
choices: subEnvs.map(e => getDbChoice(generateIdIsh(e, 14), e.name)),
|
||||
choices: subEnvironments.map(subEnv => getDbChoice(generateIdIsh(subEnv, 14), subEnv.name)),
|
||||
});
|
||||
logger.trace('Prompt for environment');
|
||||
const [idIsh] = (await prompt.run()).split(' - ').reverse();
|
||||
|
||||
@@ -52,11 +52,11 @@ export const loadCosmiConfig = (configFile?: string): Partial<ConfigFileOptions>
|
||||
},
|
||||
};
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
// Report fatal error when loading from explicitly defined config file
|
||||
if (configFile) {
|
||||
console.log(`Could not find config file at ${configFile}.`);
|
||||
console.error(e);
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ export async function writeFileWithCliOptions(
|
||||
await mkdirp.sync(path.dirname(outputPath));
|
||||
await fs.promises.writeFile(outputPath, contents);
|
||||
return outputPath;
|
||||
} catch (e) {
|
||||
throw new InsoError(`Failed to write to "${outputPath}"`, e);
|
||||
} catch (error) {
|
||||
throw new InsoError(`Failed to write to "${outputPath}"`, error);
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ const generateSuiteLines = (
|
||||
return lines;
|
||||
};
|
||||
|
||||
const generateTestLines = (n: number, test?: Test | null) => {
|
||||
const generateTestLines = (num: number, test?: Test | null) => {
|
||||
if (!test) {
|
||||
return [];
|
||||
}
|
||||
@@ -91,22 +91,22 @@ const generateTestLines = (n: number, test?: Test | null) => {
|
||||
const lines: string[] = [];
|
||||
|
||||
// Define test it() block (all test cases are async by default)
|
||||
lines.push(indent(n, `it('${escapeJsStr(test.name)}', async () => {`));
|
||||
lines.push(indent(num, `it('${escapeJsStr(test.name)}', async () => {`));
|
||||
|
||||
// Add helper variables that are necessary
|
||||
const { defaultRequestId } = test;
|
||||
|
||||
if (typeof defaultRequestId === 'string') {
|
||||
lines.push(indent(n, '// Set active request on global insomnia object'));
|
||||
lines.push(indent(num, '// Set active request on global insomnia object'));
|
||||
lines.push(
|
||||
indent(n, `insomnia.setActiveRequestId('${defaultRequestId}');`),
|
||||
indent(num, `insomnia.setActiveRequestId('${defaultRequestId}');`),
|
||||
);
|
||||
}
|
||||
|
||||
// Add user-defined test source
|
||||
test.code && lines.push(indent(n + 1, test.code));
|
||||
test.code && lines.push(indent(num + 1, test.code));
|
||||
|
||||
// Close the it() block
|
||||
lines.push(indent(n, '});'));
|
||||
lines.push(indent(num, '});'));
|
||||
return lines;
|
||||
};
|
||||
@@ -143,7 +143,7 @@ export const deconstructQueryStringToParams = (
|
||||
let name = '';
|
||||
try {
|
||||
name = decodeURIComponent(encodedName || '');
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
// Just leave it
|
||||
name = encodedName;
|
||||
}
|
||||
@@ -151,7 +151,7 @@ export const deconstructQueryStringToParams = (
|
||||
let value = '';
|
||||
try {
|
||||
value = decodeURIComponent(encodedValue || '');
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
// Just leave it
|
||||
value = encodedValue;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ export class MockCodeEditor extends PureComponent<any> {
|
||||
return <textarea
|
||||
ref={this.ref}
|
||||
id={id}
|
||||
onChange={e => onChange(e.currentTarget.value)}
|
||||
onChange={event => onChange(event.currentTarget.value)}
|
||||
placeholder={placeholder}
|
||||
defaultValue={defaultValue}
|
||||
/>;
|
||||
|
||||
@@ -32,10 +32,10 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
random: {
|
||||
getBytesSync(n: number) {
|
||||
getBytesSync(num: number) {
|
||||
let s = '';
|
||||
|
||||
for (let i = 0; i < n; i++) {
|
||||
for (let i = 0; i < num; i++) {
|
||||
s += 'a';
|
||||
}
|
||||
|
||||
|
||||
@@ -225,10 +225,10 @@ export function isLoggedIn() {
|
||||
export async function logout() {
|
||||
try {
|
||||
await fetch.post('/auth/logout', null, getCurrentSessionId());
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
// Not a huge deal if this fails, but we don't want it to prevent the
|
||||
// user from signing out.
|
||||
console.warn('Failed to logout', e);
|
||||
console.warn('Failed to logout', error);
|
||||
}
|
||||
|
||||
_unsetSessionData();
|
||||
|
||||
@@ -526,8 +526,8 @@ function getRequestPostData(renderedRequest: RenderedRequest): HarPostData | und
|
||||
if (renderedRequest.body.fileName) {
|
||||
try {
|
||||
body = newBodyRaw(fs.readFileSync(renderedRequest.body.fileName, 'base64'));
|
||||
} catch (e) {
|
||||
console.warn('[code gen] Failed to read file', e);
|
||||
} catch (error) {
|
||||
console.warn('[code gen] Failed to read file', error);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -119,8 +119,8 @@ if (defaultProtocolSuccessful) {
|
||||
}
|
||||
}
|
||||
|
||||
function _addUrlToOpen(e: Electron.Event, url: string) {
|
||||
e.preventDefault();
|
||||
function _addUrlToOpen(event: Electron.Event, url: string) {
|
||||
event.preventDefault();
|
||||
commandLineArgs.push(url);
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ app.on('activate', (_error, hasVisibleWindows) => {
|
||||
if (!hasVisibleWindows) {
|
||||
try {
|
||||
windowUtils.createWindow();
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
// This might happen if 'ready' hasn't fired yet. So we're just going
|
||||
// to silence these errors.
|
||||
console.log('[main] App not ready to "activate" yet');
|
||||
|
||||
@@ -6,12 +6,12 @@ import { GrpcIpcRequestParams } from '../network/grpc/prepare';
|
||||
import { ResponseCallbacks } from '../network/grpc/response-callbacks';
|
||||
|
||||
export function init() {
|
||||
ipcMain.on(GrpcRequestEventEnum.start, (e, params: GrpcIpcRequestParams) =>
|
||||
grpc.start(params, new ResponseCallbacks(e)),
|
||||
ipcMain.on(GrpcRequestEventEnum.start, (event, params: GrpcIpcRequestParams) =>
|
||||
grpc.start(params, new ResponseCallbacks(event)),
|
||||
);
|
||||
ipcMain.on(GrpcRequestEventEnum.sendMessage, (e, params: GrpcIpcRequestParams) =>
|
||||
ipcMain.on(GrpcRequestEventEnum.sendMessage, (event, params: GrpcIpcRequestParams) =>
|
||||
// @ts-expect-error -- TSCONVERSION
|
||||
grpc.sendMessage(params, new ResponseCallbacks(e)),
|
||||
grpc.sendMessage(params, new ResponseCallbacks(event)),
|
||||
);
|
||||
ipcMain.on(GrpcRequestEventEnum.commit, (_, requestId) => grpc.commit(requestId));
|
||||
ipcMain.on(GrpcRequestEventEnum.cancel, (_, requestId) => grpc.cancel(requestId));
|
||||
|
||||
@@ -30,16 +30,16 @@ class LocalStorage {
|
||||
|
||||
try {
|
||||
contents = String(fs.readFileSync(path));
|
||||
} catch (e) {
|
||||
if (e.code === 'ENOENT') {
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
this.setItem(key, defaultObj);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
return JSON.parse(contents);
|
||||
} catch (e) {
|
||||
console.error(`[localstorage] Failed to parse item from LocalStorage: ${e}`);
|
||||
} catch (error) {
|
||||
console.error(`[localstorage] Failed to parse item from LocalStorage: ${error}`);
|
||||
return defaultObj;
|
||||
}
|
||||
}
|
||||
@@ -60,8 +60,8 @@ class LocalStorage {
|
||||
|
||||
try {
|
||||
fs.writeFileSync(path, contents);
|
||||
} catch (e) {
|
||||
console.error(`[localstorage] Failed to save to LocalStorage: ${e}`);
|
||||
} catch (error) {
|
||||
console.error(`[localstorage] Failed to save to LocalStorage: ${error}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,8 +84,8 @@ function _sendUpdateComplete(success: boolean, msg: string) {
|
||||
|
||||
let hasPromptedForUpdates = false;
|
||||
export async function init() {
|
||||
autoUpdater.on('error', e => {
|
||||
console.warn(`[updater] Error: ${e.message}`);
|
||||
autoUpdater.on('error', error => {
|
||||
console.warn(`[updater] Error: ${error.message}`);
|
||||
});
|
||||
autoUpdater.on('update-not-available', () => {
|
||||
console.log('[updater] Not Available');
|
||||
|
||||
@@ -103,18 +103,18 @@ export function createWindow() {
|
||||
});
|
||||
|
||||
// Open generic links (<a .../>) in default browser
|
||||
mainWindow?.webContents.on('will-navigate', (e, url) => {
|
||||
mainWindow?.webContents.on('will-navigate', (event, url) => {
|
||||
if (url === appUrl) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('[app] Navigate to ' + url);
|
||||
e.preventDefault();
|
||||
event.preventDefault();
|
||||
clickLink(url);
|
||||
});
|
||||
|
||||
mainWindow?.webContents.on('new-window', e => {
|
||||
e.preventDefault();
|
||||
mainWindow?.webContents.on('new-window', event => {
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
// Load the html of the app.
|
||||
@@ -549,9 +549,9 @@ function getBounds() {
|
||||
bounds = localStorage?.getItem('bounds', {});
|
||||
fullscreen = localStorage?.getItem('fullscreen', false);
|
||||
maximize = localStorage?.getItem('maximize', false);
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
// This should never happen, but if it does...!
|
||||
console.error('Failed to parse window bounds', e);
|
||||
console.error('Failed to parse window bounds', error);
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -568,9 +568,9 @@ const ZOOM_MIN = 0.05;
|
||||
const getZoomFactor = () => {
|
||||
try {
|
||||
return localStorage?.getItem('zoomFactor', ZOOM_DEFAULT);
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
// This should never happen, but if it does...!
|
||||
console.error('Failed to parse zoomFactor', e);
|
||||
console.error('Failed to parse zoomFactor', error);
|
||||
}
|
||||
|
||||
return ZOOM_DEFAULT;
|
||||
|
||||
@@ -233,14 +233,14 @@ export function newBodyGraphQL(rawBody: string): RequestBody {
|
||||
mimeType: CONTENT_TYPE_GRAPHQL,
|
||||
text: rawBody.replace(/\\\\n/g, ''),
|
||||
};
|
||||
} catch (e) {
|
||||
if (e instanceof SyntaxError) {
|
||||
} catch (error) {
|
||||
if (error instanceof SyntaxError) {
|
||||
return {
|
||||
mimeType: CONTENT_TYPE_GRAPHQL,
|
||||
text: rawBody,
|
||||
};
|
||||
} else {
|
||||
throw e;
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,10 +306,10 @@ const _parseMessage = (
|
||||
): Record<string, any> | undefined => {
|
||||
try {
|
||||
return JSON.parse(bodyText);
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
// TODO: How do we want to handle this case, where the message cannot be parsed?
|
||||
// Currently an error will be shown, but the stream will not be cancelled.
|
||||
respond.sendError(requestId, e);
|
||||
respond.sendError(requestId, error);
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -93,21 +93,19 @@ export async function addDirectory(workspaceId: string) {
|
||||
for (const file of loadedFiles) {
|
||||
try {
|
||||
await protoLoader.loadMethods(file);
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
showError({
|
||||
title: 'Invalid Proto File',
|
||||
message: `The file ${file.name} could not be parsed`,
|
||||
error: e,
|
||||
error,
|
||||
});
|
||||
rollback = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
rollback = true;
|
||||
showError({
|
||||
error: e,
|
||||
});
|
||||
showError({ error });
|
||||
} finally {
|
||||
// Fake flushing changes (or, rollback) only prevents change notifications being sent to the UI
|
||||
// It does NOT revert changes written to the database, as is typical of a db transaction rollback
|
||||
@@ -139,11 +137,11 @@ async function _readFile() {
|
||||
// Try parse proto file to make sure the file is valid
|
||||
try {
|
||||
await protoLoader.loadMethodsFromPath(filePath);
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
showError({
|
||||
title: 'Invalid Proto File',
|
||||
message: `The file ${filePath} and could not be parsed`,
|
||||
error: e,
|
||||
error,
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -155,10 +153,8 @@ async function _readFile() {
|
||||
fileName: name,
|
||||
fileContents: contents,
|
||||
};
|
||||
} catch (e) {
|
||||
showError({
|
||||
error: e,
|
||||
});
|
||||
} catch (error) {
|
||||
showError({ error });
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ interface IResponseCallbacks {
|
||||
export class ResponseCallbacks implements IResponseCallbacks {
|
||||
_event: IpcMainEvent;
|
||||
|
||||
constructor(e: IpcMainEvent) {
|
||||
this._event = e;
|
||||
constructor(event: IpcMainEvent) {
|
||||
this._event = event;
|
||||
}
|
||||
|
||||
sendData(requestId, val) {
|
||||
|
||||
@@ -337,11 +337,11 @@ export const curlRequest = (options: CurlRequestOptions) => new Promise<CurlRequ
|
||||
resolve({ patch, debugTimeline, headerResults: [{ version: '', code: 0, reason: '', headers: [] }] });
|
||||
});
|
||||
curl.perform();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
const patch = {
|
||||
statusMessage: 'Error',
|
||||
error: e.message || 'Something went wrong',
|
||||
error: error.message || 'Something went wrong',
|
||||
elapsedTime: 0,
|
||||
};
|
||||
resolve({ patch, debugTimeline: [], headerResults: [{ version: '', code: 0, reason: '', headers: [] }] });
|
||||
|
||||
@@ -492,8 +492,8 @@ function storeTimeline(timeline: ResponseTimelineEntry[]) {
|
||||
}
|
||||
|
||||
if (global.document) {
|
||||
document.addEventListener('keydown', (e: KeyboardEvent) => {
|
||||
if (e.ctrlKey || e.metaKey || e.altKey) {
|
||||
document.addEventListener('keydown', (event: KeyboardEvent) => {
|
||||
if (event.ctrlKey || event.metaKey || event.altKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -143,9 +143,9 @@ export function authorizeUserInWindow({
|
||||
|
||||
try {
|
||||
await child.loadURL(url);
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
// Reject with error to show result in OAuth2 tab
|
||||
reject(e);
|
||||
reject(error);
|
||||
// Need to close child window here since an exception in loadURL precludes normal call in
|
||||
// _parseUrl
|
||||
child.close();
|
||||
|
||||
@@ -218,11 +218,11 @@ async function _installPluginToTmpDir(lookupName: string) {
|
||||
|
||||
export function containsOnlyDeprecationWarnings(stderr) {
|
||||
// Split on line breaks and remove falsy values (null, undefined, 0, -0, NaN, "", false)
|
||||
const arr = stderr.split(/\r?\n/).filter(e => e);
|
||||
const arr = stderr.split(/\r?\n/).filter(error => error);
|
||||
// Retrieve all matching deprecated dependency warning
|
||||
const warnings = arr.filter(e => isDeprecatedDependencies(e));
|
||||
const warnings = arr.filter(error => isDeprecatedDependencies(error));
|
||||
// Print each deprecation warnings to the console, so we don't hide them.
|
||||
warnings.forEach(e => console.warn('[plugins] deprecation warning during installation: ', e));
|
||||
warnings.forEach(warning => console.warn('[plugins] deprecation warning during installation: ', warning));
|
||||
// If they mismatch, it means there are warnings and errors
|
||||
return warnings.length === arr.length;
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ export class MemClient {
|
||||
const nextPath = path.join(currentPath, pathSegment);
|
||||
|
||||
// Create dir if it doesn't exist yet
|
||||
if (!dirEntry.children.find(e => e.name === pathSegment)) {
|
||||
if (!dirEntry.children.find(child => child.name === pathSegment)) {
|
||||
dirEntry.children.push({
|
||||
type: 'dir',
|
||||
ino: this.__ino++,
|
||||
|
||||
@@ -47,9 +47,8 @@ const onAuthFailure =
|
||||
},
|
||||
};
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('[git-event] Failed to refresh token', e);
|
||||
|
||||
} catch (error) {
|
||||
console.warn('[git-event] Failed to refresh token', error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ export interface ButtonProps<T> {
|
||||
children: ReactNode;
|
||||
value?: T;
|
||||
className?: string;
|
||||
onDisabledClick?: React.MouseEventHandler<HTMLButtonElement> | ((value: T | undefined, e: React.MouseEvent<HTMLButtonElement>) => void);
|
||||
onClick?: React.MouseEventHandler<HTMLButtonElement> | ((value: T | undefined, e: React.MouseEvent<HTMLButtonElement>) => void);
|
||||
onDisabledClick?: React.MouseEventHandler<HTMLButtonElement> | ((value: T | undefined, event: React.MouseEvent<HTMLButtonElement>) => void);
|
||||
onClick?: React.MouseEventHandler<HTMLButtonElement> | ((value: T | undefined, event: React.MouseEvent<HTMLButtonElement>) => void);
|
||||
disabled?: boolean;
|
||||
tabIndex?: number;
|
||||
type?: ButtonHTMLAttributes<HTMLButtonElement>['type'];
|
||||
@@ -19,16 +19,16 @@ export interface ButtonProps<T> {
|
||||
|
||||
@autoBindMethodsForReact(AUTOBIND_CFG)
|
||||
export class Button<T> extends PureComponent<ButtonProps<T>> {
|
||||
_handleClick(e: React.MouseEvent<HTMLButtonElement>) {
|
||||
_handleClick(event: React.MouseEvent<HTMLButtonElement>) {
|
||||
const { onClick, onDisabledClick, disabled, value } = this.props;
|
||||
const fn = disabled ? onDisabledClick : onClick;
|
||||
|
||||
if (this.props.hasOwnProperty('value')) {
|
||||
// @ts-expect-error -- TSCONVERSION we really need to make the `value` argument come second
|
||||
fn?.(value, e);
|
||||
fn?.(value, event);
|
||||
} else {
|
||||
// @ts-expect-error -- TSCONVERSION we really need to make the `value` argument come second
|
||||
fn?.(e);
|
||||
fn?.(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ export class CopyButton extends PureComponent<Props, State> {
|
||||
|
||||
_triggerTimeout: NodeJS.Timeout | null = null;
|
||||
|
||||
async _handleClick(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
async _handleClick(event) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
const content =
|
||||
typeof this.props.content === 'string' ? this.props.content : await this.props.content();
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ import { debounce } from '../../../common/misc';
|
||||
|
||||
interface Props {
|
||||
onChange: (value: string) => void;
|
||||
onFocus?: (e: React.FocusEvent<HTMLTextAreaElement | HTMLInputElement>) => void;
|
||||
onBlur?: (e: React.FocusEvent<HTMLTextAreaElement | HTMLInputElement>) => void;
|
||||
onFocus?: (event: React.FocusEvent<HTMLTextAreaElement | HTMLInputElement>) => void;
|
||||
onBlur?: (event: React.FocusEvent<HTMLTextAreaElement | HTMLInputElement>) => void;
|
||||
textarea?: boolean;
|
||||
delay?: number;
|
||||
placeholder?: string;
|
||||
@@ -36,22 +36,22 @@ export class DebouncedInput extends PureComponent<Props> {
|
||||
}
|
||||
}
|
||||
|
||||
_handleChange(e: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>) {
|
||||
this._handleValueChange?.(e.target.value);
|
||||
_handleChange(event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>) {
|
||||
this._handleValueChange?.(event.target.value);
|
||||
}
|
||||
|
||||
_handleFocus(e: React.FocusEvent<HTMLTextAreaElement | HTMLInputElement>) {
|
||||
_handleFocus(event: React.FocusEvent<HTMLTextAreaElement | HTMLInputElement>) {
|
||||
this._hasFocus = true;
|
||||
this.props.onFocus?.(e);
|
||||
this.props.onFocus?.(event);
|
||||
}
|
||||
|
||||
_handleBlur(e: React.FocusEvent<HTMLTextAreaElement | HTMLInputElement>) {
|
||||
_handleBlur(event: React.FocusEvent<HTMLTextAreaElement | HTMLInputElement>) {
|
||||
this._hasFocus = false;
|
||||
this.props.onBlur?.(e);
|
||||
this.props.onBlur?.(event);
|
||||
}
|
||||
|
||||
_setRef(n: HTMLTextAreaElement | HTMLInputElement) {
|
||||
this._input = n;
|
||||
_setRef(input: HTMLTextAreaElement | HTMLInputElement) {
|
||||
this._input = input;
|
||||
}
|
||||
|
||||
setAttribute(name: string, value: string) {
|
||||
|
||||
@@ -19,11 +19,11 @@ interface Props {
|
||||
|
||||
@autoBindMethodsForReact(AUTOBIND_CFG)
|
||||
export class DropdownItem extends PureComponent<Props> {
|
||||
_handleClick(e: React.MouseEvent) {
|
||||
_handleClick(event: React.MouseEvent) {
|
||||
const { stayOpenAfterClick, onClick, disabled } = this.props;
|
||||
|
||||
if (stayOpenAfterClick) {
|
||||
e.stopPropagation();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
if (!onClick || disabled) {
|
||||
@@ -31,9 +31,9 @@ export class DropdownItem extends PureComponent<Props> {
|
||||
}
|
||||
|
||||
if (this.props.hasOwnProperty('value')) {
|
||||
onClick(this.props.value, e);
|
||||
onClick(this.props.value, event);
|
||||
} else {
|
||||
onClick(e);
|
||||
onClick(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ interface State {
|
||||
filterVisible: boolean;
|
||||
filterItems?: number[] | null;
|
||||
filterActiveIndex: number;
|
||||
forcedPosition?: {x: number; y: number} | null;
|
||||
forcedPosition?: { x: number; y: number } | null;
|
||||
uniquenessKey: number;
|
||||
}
|
||||
|
||||
@@ -56,12 +56,12 @@ export class Dropdown extends PureComponent<DropdownProps, State> {
|
||||
uniquenessKey: 0,
|
||||
};
|
||||
|
||||
_setRef(n: HTMLDivElement) {
|
||||
this._node = n;
|
||||
_setRef(node: HTMLDivElement) {
|
||||
this._node = node;
|
||||
}
|
||||
|
||||
_handleCheckFilterSubmit(e: React.KeyboardEvent<HTMLInputElement>) {
|
||||
if (e.key === 'Enter') {
|
||||
_handleCheckFilterSubmit(event: React.KeyboardEvent<HTMLInputElement>) {
|
||||
if (event.key === 'Enter') {
|
||||
// Listen for the Enter key and "click" on the active list item
|
||||
const selector = `li[data-filter-index="${this.state.filterActiveIndex}"] button`;
|
||||
|
||||
@@ -232,9 +232,9 @@ export class Dropdown extends PureComponent<DropdownProps, State> {
|
||||
}
|
||||
}
|
||||
|
||||
_handleClick(e: React.MouseEvent<HTMLDivElement>) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
_handleClick(event: React.MouseEvent<HTMLDivElement>) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
this.toggle();
|
||||
}
|
||||
|
||||
@@ -243,12 +243,12 @@ export class Dropdown extends PureComponent<DropdownProps, State> {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
_addDropdownListRef(n: HTMLDivElement) {
|
||||
this._dropdownList = n;
|
||||
_addDropdownListRef(dropdownList: HTMLDivElement) {
|
||||
this._dropdownList = dropdownList;
|
||||
}
|
||||
|
||||
_addFilterRef(n: HTMLInputElement) {
|
||||
this._filter = n;
|
||||
_addFilterRef(filter: HTMLInputElement) {
|
||||
this._filter = filter;
|
||||
|
||||
// Automatically focus the filter element when mounted so we can start typing
|
||||
if (this._filter) {
|
||||
|
||||
@@ -43,8 +43,8 @@ export class Editable extends PureComponent<Props, State> {
|
||||
|
||||
_input: HTMLInputElement | null = null;
|
||||
|
||||
_handleSetInputRef(n: HTMLInputElement) {
|
||||
this._input = n;
|
||||
_handleSetInputRef(input: HTMLInputElement) {
|
||||
this._input = input;
|
||||
}
|
||||
|
||||
_handleSingleClickEditStart() {
|
||||
|
||||
@@ -12,8 +12,8 @@ interface Props extends HTMLAttributes<HTMLInputElement> {
|
||||
export class IndeterminateCheckbox extends PureComponent<Props> {
|
||||
input: HTMLInputElement | null = null;
|
||||
|
||||
_setRef(n: HTMLInputElement) {
|
||||
this.input = n;
|
||||
_setRef(input: HTMLInputElement) {
|
||||
this.input = input;
|
||||
}
|
||||
|
||||
_update() {
|
||||
|
||||
@@ -22,9 +22,9 @@ export const Link: FC<Props> = ({
|
||||
noTheme,
|
||||
...other
|
||||
}) => {
|
||||
const handleClick = useCallback((e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {
|
||||
e?.preventDefault();
|
||||
onClick?.(e); // Also call onClick that was passed to us if there was one
|
||||
const handleClick = useCallback((event: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {
|
||||
event?.preventDefault();
|
||||
onClick?.(event); // Also call onClick that was passed to us if there was one
|
||||
clickLink(href);
|
||||
}, [onClick, href]);
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ export class Modal extends PureComponent<ModalProps, State> {
|
||||
}
|
||||
}
|
||||
|
||||
_handleClick(e) {
|
||||
_handleClick(event) {
|
||||
// Don't check for close keys if we don't want them
|
||||
if (this.props.noEscape) {
|
||||
return;
|
||||
@@ -77,7 +77,7 @@ export class Modal extends PureComponent<ModalProps, State> {
|
||||
// Did we click a close button. Let's check a few parent nodes up as well
|
||||
// because some buttons might have nested elements. Maybe there is a better
|
||||
// way to check this?
|
||||
let target = e.target;
|
||||
let target = event.target;
|
||||
let shouldHide = false;
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
@@ -95,8 +95,8 @@ export class Modal extends PureComponent<ModalProps, State> {
|
||||
}
|
||||
}
|
||||
|
||||
_setModalRef(n: HTMLDivElement) {
|
||||
this._node = n;
|
||||
_setModalRef(node: HTMLDivElement) {
|
||||
this._node = node;
|
||||
}
|
||||
|
||||
show(options?: ModalProps) {
|
||||
|
||||
@@ -65,10 +65,10 @@ export class PromptButton extends PureComponent<Props> {
|
||||
}
|
||||
|
||||
_ask(...args) {
|
||||
const e = args[args.length - 1];
|
||||
const event = args[args.length - 1];
|
||||
// Prevent events (ex. won't close dropdown if it's in one)
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
// Toggle the confirmation notice
|
||||
this.setState({
|
||||
state: STATE_ASK,
|
||||
|
||||
@@ -94,13 +94,13 @@ export type CodeEditorOnChange = (value: string) => void;
|
||||
interface RawProps {
|
||||
onChange?: CodeEditorOnChange;
|
||||
onCursorActivity?: (cm: CodeMirror.EditorFromTextArea) => void;
|
||||
onFocus?: (e: FocusEvent) => void;
|
||||
onBlur?: (e: FocusEvent) => void;
|
||||
onFocus?: (event: FocusEvent) => void;
|
||||
onBlur?: (event: FocusEvent) => void;
|
||||
onClickLink?: CodeMirrorLinkClickCallback;
|
||||
onKeyDown?: (e: KeyboardEvent, value: string) => void;
|
||||
onKeyDown?: (event: KeyboardEvent, value: string) => void;
|
||||
onMouseLeave?: React.MouseEventHandler<HTMLDivElement>;
|
||||
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
||||
onPaste?: (e: ClipboardEvent) => void;
|
||||
onPaste?: (event: ClipboardEvent) => void;
|
||||
onCodeMirrorInit?: (editor: CodeMirror.EditorFromTextArea) => void;
|
||||
getAutocompleteConstants?: () => string[] | PromiseLike<string[]>;
|
||||
getAutocompleteSnippets?: () => CodeMirror.Snippet[];
|
||||
@@ -516,8 +516,8 @@ export class UnconnectedCodeEditor extends Component<CodeEditorProps, State> {
|
||||
}
|
||||
}
|
||||
|
||||
_setFilterInputRef(n: HTMLInputElement) {
|
||||
this._filterInput = n;
|
||||
_setFilterInputRef(filterInput: HTMLInputElement) {
|
||||
this._filterInput = filterInput;
|
||||
}
|
||||
|
||||
_handleInitTextarea(textarea: HTMLTextAreaElement) {
|
||||
@@ -559,7 +559,7 @@ export class UnconnectedCodeEditor extends Component<CodeEditorProps, State> {
|
||||
try {
|
||||
const parsed = JSON.parse(toParse);
|
||||
count = Object.keys(parsed).length;
|
||||
} catch (e) { }
|
||||
} catch (error) { }
|
||||
|
||||
return count ? `\u21A4 ${count} \u21A6` : '\u2194';
|
||||
},
|
||||
@@ -714,7 +714,7 @@ export class UnconnectedCodeEditor extends Component<CodeEditorProps, State> {
|
||||
}
|
||||
|
||||
return jsonPrettify(jsonString, this._indentChars(), this.props.autoPrettify);
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
// That's Ok, just leave it
|
||||
return code;
|
||||
}
|
||||
@@ -733,7 +733,7 @@ export class UnconnectedCodeEditor extends Component<CodeEditorProps, State> {
|
||||
|
||||
try {
|
||||
return vkBeautify.xml(code, this._indentChars());
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
// Failed to parse so just return original
|
||||
return code;
|
||||
}
|
||||
@@ -973,14 +973,14 @@ export class UnconnectedCodeEditor extends Component<CodeEditorProps, State> {
|
||||
}
|
||||
}
|
||||
|
||||
async _codemirrorKeyDown(doc: CodeMirror.EditorFromTextArea, e: KeyboardEvent & {codemirrorIgnore: boolean}) {
|
||||
async _codemirrorKeyDown(doc: CodeMirror.EditorFromTextArea, event: KeyboardEvent & {codemirrorIgnore: boolean}) {
|
||||
// Use default tab behaviour if we're told
|
||||
if (this.props.defaultTabBehavior && e.code === 'Tab') {
|
||||
e.codemirrorIgnore = true;
|
||||
if (this.props.defaultTabBehavior && event.code === 'Tab') {
|
||||
event.codemirrorIgnore = true;
|
||||
}
|
||||
|
||||
if (this.props.onKeyDown && !doc.isHintDropdownActive()) {
|
||||
this.props.onKeyDown(e, doc.getValue());
|
||||
this.props.onKeyDown(event, doc.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -990,12 +990,12 @@ export class UnconnectedCodeEditor extends Component<CodeEditorProps, State> {
|
||||
}
|
||||
}
|
||||
|
||||
_codemirrorTriggerCompletionKeyUp(doc: CodeMirror.EditorFromTextArea, e: KeyboardEvent) {
|
||||
_codemirrorTriggerCompletionKeyUp(doc: CodeMirror.EditorFromTextArea, event: KeyboardEvent) {
|
||||
// Enable graphql completion if we're in that mode
|
||||
if (doc.getOption('mode') === 'graphql') {
|
||||
// Only operate on one-letter keys. This will filter out
|
||||
// any special keys (Backspace, Enter, etc)
|
||||
if (e.metaKey || e.ctrlKey || e.altKey || e.key.length > 1) {
|
||||
if (event.metaKey || event.ctrlKey || event.altKey || event.key.length > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1015,18 +1015,14 @@ export class UnconnectedCodeEditor extends Component<CodeEditorProps, State> {
|
||||
}
|
||||
}
|
||||
|
||||
_codemirrorFocus(_doc: CodeMirror.EditorFromTextArea, e: FocusEvent) {
|
||||
if (this.props.onFocus) {
|
||||
this.props.onFocus(e);
|
||||
}
|
||||
_codemirrorFocus(_doc: CodeMirror.EditorFromTextArea, event: FocusEvent) {
|
||||
this.props.onFocus?.(event);
|
||||
}
|
||||
|
||||
_codemirrorBlur(_doc: CodeMirror.EditorFromTextArea, e: FocusEvent) {
|
||||
_codemirrorBlur(_doc: CodeMirror.EditorFromTextArea, event: FocusEvent) {
|
||||
this._persistState();
|
||||
|
||||
if (this.props.onBlur) {
|
||||
this.props.onBlur(e);
|
||||
}
|
||||
this.props.onBlur?.(event);
|
||||
}
|
||||
|
||||
_codemirrorScroll() {
|
||||
@@ -1075,17 +1071,15 @@ export class UnconnectedCodeEditor extends Component<CodeEditorProps, State> {
|
||||
}
|
||||
}
|
||||
|
||||
_codemirrorPaste(_cm: CodeMirror.EditorFromTextArea, e: ClipboardEvent) {
|
||||
if (this.props.onPaste) {
|
||||
this.props.onPaste(e);
|
||||
}
|
||||
_codemirrorPaste(_cm: CodeMirror.EditorFromTextArea, event: ClipboardEvent) {
|
||||
this.props.onPaste?.(event);
|
||||
}
|
||||
|
||||
_codemirrorPreventWhenTypePassword(_cm: CodeMirror.EditorFromTextArea, e: Event) {
|
||||
_codemirrorPreventWhenTypePassword(_cm: CodeMirror.EditorFromTextArea, event: Event) {
|
||||
const { type } = this.props;
|
||||
|
||||
if (type && type.toLowerCase() === 'password') {
|
||||
e.preventDefault();
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1152,8 +1146,8 @@ export class UnconnectedCodeEditor extends Component<CodeEditorProps, State> {
|
||||
this._setFilter(filter);
|
||||
}
|
||||
|
||||
_handleFilterChange(e) {
|
||||
this._setFilter(e.target.value);
|
||||
_handleFilterChange(event) {
|
||||
this._setFilter(event.target.value);
|
||||
}
|
||||
|
||||
_setFilter(filter = '') {
|
||||
|
||||
@@ -187,21 +187,21 @@ CodeMirror.defineOption('environmentAutocomplete', null, (cm: CodeMirror.EditorF
|
||||
}
|
||||
|
||||
let keydownTimeoutHandle: NodeJS.Timeout | null = null;
|
||||
cm.on('keydown', (cm: CodeMirror.EditorFromTextArea, e) => {
|
||||
cm.on('keydown', (cm: CodeMirror.EditorFromTextArea, event) => {
|
||||
// Close autocomplete on Escape if it's open
|
||||
if (cm.isHintDropdownActive() && e.key === 'Escape') {
|
||||
if (cm.isHintDropdownActive() && event.key === 'Escape') {
|
||||
if (!cm.state.completionActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
cm.state.completionActive.close();
|
||||
}
|
||||
|
||||
// Only operate on one-letter keys. This will filter out
|
||||
// any special keys (Backspace, Enter, etc)
|
||||
if (e.metaKey || e.ctrlKey || e.altKey || e.key.length > 1) {
|
||||
if (event.metaKey || event.ctrlKey || event.altKey || event.key.length > 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,15 +32,15 @@ CodeMirror.defineExtension('makeLinksClickable', function(handleClick: CodeMirro
|
||||
el.addEventListener('mousedown', () => {
|
||||
movedDuringClick = false;
|
||||
});
|
||||
el.addEventListener('mouseup', e => {
|
||||
el.addEventListener('mouseup', event => {
|
||||
if (movedDuringClick) {
|
||||
return;
|
||||
}
|
||||
|
||||
const cls = e.target.className;
|
||||
const cls = event.target.className;
|
||||
|
||||
if (cls.indexOf('cm-clickable') >= 0) {
|
||||
handleClick(entities.decode(e.target.innerHTML));
|
||||
handleClick(entities.decode(event.target.innerHTML));
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -214,8 +214,8 @@ async function _highlightNunjucksTags(render, renderContext, showVariableSourceA
|
||||
this.off('drop', dropCb);
|
||||
});
|
||||
// Don't allow dropping on itself
|
||||
el.addEventListener('drop', e => {
|
||||
e.stopPropagation();
|
||||
el.addEventListener('drop', event => {
|
||||
event.stopPropagation();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,11 +16,11 @@ interface Props {
|
||||
id?: string;
|
||||
type?: string;
|
||||
mode?: string;
|
||||
onBlur?: (e: FocusEvent | React.FocusEvent) => void;
|
||||
onKeyDown?: (e: KeyboardEvent | React.KeyboardEvent, value?: any) => void;
|
||||
onFocus?: (e: FocusEvent | React.FocusEvent) => void;
|
||||
onBlur?: (event: FocusEvent | React.FocusEvent) => void;
|
||||
onKeyDown?: (event: KeyboardEvent | React.KeyboardEvent, value?: any) => void;
|
||||
onFocus?: (event: FocusEvent | React.FocusEvent) => void;
|
||||
onChange?: CodeEditorOnChange;
|
||||
onPaste?: (e: ClipboardEvent) => void;
|
||||
onPaste?: (event: ClipboardEvent) => void;
|
||||
getAutocompleteConstants?: () => string[] | PromiseLike<string[]>;
|
||||
placeholder?: string;
|
||||
className?: string;
|
||||
@@ -161,9 +161,9 @@ export class OneLineEditor extends PureComponent<Props, State> {
|
||||
this._convertToInputIfNotFocused();
|
||||
}
|
||||
|
||||
_handleEditorFocus(e: FocusEvent) {
|
||||
_handleEditorFocus(event: FocusEvent) {
|
||||
// TODO: unclear why this is missing in TypeScript DOM.
|
||||
const focusedFromTabEvent = !!(e as any).sourceCapabilities;
|
||||
const focusedFromTabEvent = !!(event as any).sourceCapabilities;
|
||||
|
||||
if (focusedFromTabEvent) {
|
||||
this._editor?.focusEnd();
|
||||
@@ -177,17 +177,17 @@ export class OneLineEditor extends PureComponent<Props, State> {
|
||||
// Set focused state
|
||||
this._editor?.setAttribute('data-focused', 'on');
|
||||
|
||||
this.props.onFocus?.(e);
|
||||
this.props.onFocus?.(event);
|
||||
}
|
||||
|
||||
_handleInputFocus(e: React.FocusEvent<HTMLInputElement>) {
|
||||
_handleInputFocus(event: React.FocusEvent<HTMLInputElement>) {
|
||||
// If we're focusing the whole thing, blur the input. This happens when
|
||||
// the user tabs to the field.
|
||||
const start = this._input?.getSelectionStart();
|
||||
|
||||
const end = this._input?.getSelectionEnd();
|
||||
|
||||
const focusedFromTabEvent = start === 0 && end === e.target.value.length;
|
||||
const focusedFromTabEvent = start === 0 && end === event.target.value.length;
|
||||
|
||||
if (focusedFromTabEvent) {
|
||||
this._input?.focusEnd();
|
||||
@@ -201,7 +201,7 @@ export class OneLineEditor extends PureComponent<Props, State> {
|
||||
this._input?.setAttribute('data-focused', 'on');
|
||||
|
||||
// Also call the regular callback
|
||||
this.props.onFocus?.(e);
|
||||
this.props.onFocus?.(event);
|
||||
}
|
||||
|
||||
_handleInputChange(value: string) {
|
||||
@@ -216,14 +216,14 @@ export class OneLineEditor extends PureComponent<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
_handleInputBlur(e: React.FocusEvent<HTMLTextAreaElement | HTMLInputElement>) {
|
||||
_handleInputBlur(event: React.FocusEvent<HTMLTextAreaElement | HTMLInputElement>) {
|
||||
// Set focused state
|
||||
this._input?.removeAttribute('data-focused');
|
||||
|
||||
this.props.onBlur?.(e);
|
||||
this.props.onBlur?.(event);
|
||||
}
|
||||
|
||||
_handleEditorBlur(e: FocusEvent) {
|
||||
_handleEditorBlur(event: FocusEvent) {
|
||||
// Editor was already removed from the DOM, so do nothing
|
||||
if (!this._editor) {
|
||||
return;
|
||||
@@ -242,7 +242,7 @@ export class OneLineEditor extends PureComponent<Props, State> {
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
this.props.onBlur?.(e);
|
||||
this.props.onBlur?.(event);
|
||||
}
|
||||
|
||||
// @TODO Refactor this event handler. The way we search for a parent form node is not stable.
|
||||
@@ -322,12 +322,12 @@ export class OneLineEditor extends PureComponent<Props, State> {
|
||||
});
|
||||
}
|
||||
|
||||
_setEditorRef(n: UnconnectedCodeEditor) {
|
||||
this._editor = n;
|
||||
_setEditorRef(editor: UnconnectedCodeEditor) {
|
||||
this._editor = editor;
|
||||
}
|
||||
|
||||
_setInputRef(n: DebouncedInput) {
|
||||
this._input = n;
|
||||
_setInputRef(input: DebouncedInput) {
|
||||
this._input = input;
|
||||
}
|
||||
|
||||
_mayContainNunjucks(text: string) {
|
||||
|
||||
@@ -39,8 +39,8 @@ export class EnvironmentsDropdown extends PureComponent<Props> {
|
||||
showModal(WorkspaceEnvironmentsEditModal, this.props.workspace);
|
||||
}
|
||||
|
||||
_setDropdownRef(n: Dropdown) {
|
||||
this._dropdown = n;
|
||||
_setDropdownRef(dropdown: Dropdown) {
|
||||
this._dropdown = dropdown;
|
||||
}
|
||||
|
||||
renderEnvironmentItem(environment: Environment) {
|
||||
@@ -79,9 +79,9 @@ export class EnvironmentsDropdown extends PureComponent<Props> {
|
||||
...other
|
||||
} = this.props;
|
||||
// NOTE: Base environment might not exist if the users hasn't managed environments yet.
|
||||
const baseEnvironment = environments.find(e => e.parentId === workspace._id);
|
||||
const baseEnvironment = environments.find(environment => environment.parentId === workspace._id);
|
||||
const subEnvironments = environments
|
||||
.filter(e => e.parentId === (baseEnvironment && baseEnvironment._id))
|
||||
.filter(environment => environment.parentId === (baseEnvironment && baseEnvironment._id))
|
||||
.sort((e1, e2) => e1.metaSortKey - e2.metaSortKey);
|
||||
let description;
|
||||
|
||||
|
||||
@@ -66,8 +66,8 @@ class GitSyncDropdown extends PureComponent<Props, State> {
|
||||
branches: [],
|
||||
};
|
||||
|
||||
_setDropdownRef(n: Dropdown) {
|
||||
this._dropdown = n;
|
||||
_setDropdownRef(dropdown: Dropdown) {
|
||||
this._dropdown = dropdown;
|
||||
}
|
||||
|
||||
async _refreshState(otherState?: Record<string, any>) {
|
||||
|
||||
@@ -23,8 +23,8 @@ interface Props {
|
||||
export class MethodDropdown extends PureComponent<Props> {
|
||||
_dropdown: Dropdown | null = null;
|
||||
|
||||
_setDropdownRef(n: Dropdown) {
|
||||
this._dropdown = n;
|
||||
_setDropdownRef(dropdown: Dropdown) {
|
||||
this._dropdown = dropdown;
|
||||
}
|
||||
|
||||
_handleSetCustomMethod() {
|
||||
|
||||
@@ -55,8 +55,8 @@ export class RequestActionsDropdown extends PureComponent<Props, State> {
|
||||
loadingActions: {},
|
||||
};
|
||||
|
||||
_setDropdownRef(n: Dropdown) {
|
||||
this._dropdown = n;
|
||||
_setDropdownRef(dropdown: Dropdown) {
|
||||
this._dropdown = dropdown;
|
||||
}
|
||||
|
||||
_handleDuplicate() {
|
||||
|
||||
@@ -52,8 +52,8 @@ export class UnconnectedRequestGroupActionsDropdown extends PureComponent<Props,
|
||||
loadingActions: {},
|
||||
};
|
||||
|
||||
_setDropdownRef(n: Dropdown) {
|
||||
this._dropdown = n;
|
||||
_setDropdownRef(dropdown: Dropdown) {
|
||||
this._dropdown = dropdown;
|
||||
}
|
||||
|
||||
async _handleRequestCreate() {
|
||||
|
||||
@@ -97,8 +97,8 @@ export class UnconnectedWorkspaceDropdown extends PureComponent<Props, State> {
|
||||
});
|
||||
}
|
||||
|
||||
_setDropdownRef(n: Dropdown) {
|
||||
this._dropdown = n;
|
||||
_setDropdownRef(dropdown: Dropdown) {
|
||||
this._dropdown = dropdown;
|
||||
}
|
||||
|
||||
static _handleShowExport() {
|
||||
|
||||
@@ -27,7 +27,7 @@ export const FileEditor: FC<Props> = ({ onChange, path }) => {
|
||||
try {
|
||||
const bytes = fs.statSync(path).size;
|
||||
sizeDescription = misc.describeByteSize(bytes);
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
sizeDescription = '';
|
||||
}
|
||||
|
||||
|
||||
@@ -496,7 +496,7 @@ export class GraphQLEditor extends PureComponent<Props, State> {
|
||||
_setDocumentAST(query: string) {
|
||||
try {
|
||||
this._documentAST = parse(query);
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
this._documentAST = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,8 +110,8 @@ export class EnvironmentEditor extends PureComponent<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
_setEditorRef(n: UnconnectedCodeEditor) {
|
||||
this._editor = n;
|
||||
_setEditorRef(editor: UnconnectedCodeEditor) {
|
||||
this._editor = editor;
|
||||
}
|
||||
|
||||
getValue(): EnvironmentInfo | null {
|
||||
|
||||
@@ -28,8 +28,8 @@ export class RequestGroupRow extends PureComponent<Props> {
|
||||
handleSetRequestGroupCollapsed(requestGroup._id, !isCollapsed);
|
||||
}
|
||||
|
||||
handleSelect(e: React.SyntheticEvent<HTMLInputElement>) {
|
||||
const el = e.currentTarget;
|
||||
handleSelect(event: React.SyntheticEvent<HTMLInputElement>) {
|
||||
const el = event.currentTarget;
|
||||
const value = el.checked;
|
||||
const { handleSetItemSelected, requestGroup } = this.props;
|
||||
return handleSetItemSelected(requestGroup._id, value);
|
||||
|
||||
@@ -184,8 +184,8 @@ export class GraphQLExplorer extends PureComponent<Props, State> {
|
||||
<a
|
||||
href="#"
|
||||
className="graphql-explorer__header__back-btn"
|
||||
onClick={e => {
|
||||
e.preventDefault();
|
||||
onClick={event => {
|
||||
event.preventDefault();
|
||||
|
||||
this._handlePopHistory();
|
||||
}}
|
||||
@@ -216,8 +216,8 @@ export class GraphQLExplorer extends PureComponent<Props, State> {
|
||||
<a
|
||||
href="#"
|
||||
className="graphql-explorer__header__back-btn"
|
||||
onClick={e => {
|
||||
e.preventDefault();
|
||||
onClick={event => {
|
||||
event.preventDefault();
|
||||
|
||||
this._handlePopHistory();
|
||||
}}
|
||||
|
||||
@@ -14,14 +14,14 @@ interface Props {
|
||||
*/
|
||||
@autoBindMethodsForReact(AUTOBIND_CFG)
|
||||
export class HtmlElementWrapper extends Component<Props> {
|
||||
_setRef(n: HTMLDivElement | null | undefined) {
|
||||
if (!n) {
|
||||
_setRef(element: HTMLDivElement | null | undefined) {
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add the element directly to the React ref
|
||||
n.innerHTML = '';
|
||||
n.appendChild(this.props.el);
|
||||
element.innerHTML = '';
|
||||
element.appendChild(this.props.el);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
|
||||
@@ -186,28 +186,28 @@ export class KeyValueEditor extends PureComponent<Props, State> {
|
||||
this._addPair();
|
||||
}
|
||||
|
||||
_handleKeyDown(_pair: Pair, e: KeyboardEvent, value?: any) {
|
||||
if (e.metaKey || e.ctrlKey) {
|
||||
_handleKeyDown(_pair: Pair, event: KeyboardEvent, value?: any) {
|
||||
if (event.metaKey || event.ctrlKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.keyCode === ENTER) {
|
||||
if (event.keyCode === ENTER) {
|
||||
this._focusNext(true);
|
||||
} else if (e.keyCode === BACKSPACE) {
|
||||
} else if (event.keyCode === BACKSPACE) {
|
||||
if (!value) {
|
||||
this._focusPrevious(true);
|
||||
}
|
||||
} else if (e.keyCode === DOWN) {
|
||||
e.preventDefault();
|
||||
} else if (event.keyCode === DOWN) {
|
||||
event.preventDefault();
|
||||
|
||||
this._focusNextPair();
|
||||
} else if (e.keyCode === UP) {
|
||||
e.preventDefault();
|
||||
} else if (event.keyCode === UP) {
|
||||
event.preventDefault();
|
||||
|
||||
this._focusPreviousPair();
|
||||
} else if (e.keyCode === LEFT) {
|
||||
} else if (event.keyCode === LEFT) {
|
||||
// TODO: Implement this
|
||||
} else if (e.keyCode === RIGHT) {
|
||||
} else if (event.keyCode === RIGHT) {
|
||||
// TODO: Implement this
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,18 +36,18 @@ type DragDirection = 0 | 1 | -1;
|
||||
interface Props {
|
||||
onChange: (pair: Pair) => void;
|
||||
onDelete: (pair: Pair) => void;
|
||||
onFocusName: (pair: Pair, e: FocusEvent) => void;
|
||||
onFocusValue: (pair: Pair, e: FocusEvent) => void;
|
||||
onFocusDescription: (pair: Pair, e: FocusEvent) => void;
|
||||
onFocusName: (pair: Pair, event: FocusEvent) => void;
|
||||
onFocusValue: (pair: Pair, event: FocusEvent) => void;
|
||||
onFocusDescription: (pair: Pair, event: FocusEvent) => void;
|
||||
displayDescription: boolean;
|
||||
index: number;
|
||||
pair: Pair;
|
||||
readOnly?: boolean;
|
||||
onMove?: (pairToMove: Pair, pairToTarget: Pair, targetOffset: 1 | -1) => void;
|
||||
onKeyDown?: (pair: Pair, e: KeyboardEvent, value?: any) => void;
|
||||
onBlurName?: (pair: Pair, e: FocusEvent) => void;
|
||||
onBlurValue?: (pair: Pair, e: FocusEvent) => void;
|
||||
onBlurDescription?: (pair: Pair, e: FocusEvent) => void;
|
||||
onKeyDown?: (pair: Pair, event: KeyboardEvent, value?: any) => void;
|
||||
onBlurName?: (pair: Pair, event: FocusEvent) => void;
|
||||
onBlurValue?: (pair: Pair, event: FocusEvent) => void;
|
||||
onBlurDescription?: (pair: Pair, event: FocusEvent) => void;
|
||||
enableNunjucks?: boolean;
|
||||
handleGetAutocompleteNameConstants?: AutocompleteHandler;
|
||||
handleGetAutocompleteValueConstants?: AutocompleteHandler;
|
||||
@@ -109,8 +109,8 @@ class KeyValueEditorRowInternal extends PureComponent<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
_setDescriptionInputRef(n: OneLineEditor) {
|
||||
this._descriptionInput = n;
|
||||
_setDescriptionInputRef(descriptionInput: OneLineEditor) {
|
||||
this._descriptionInput = descriptionInput;
|
||||
}
|
||||
|
||||
_sendChange(patch: Partial<Pair>) {
|
||||
@@ -124,15 +124,15 @@ class KeyValueEditorRowInternal extends PureComponent<Props, State> {
|
||||
});
|
||||
}
|
||||
|
||||
_handleValuePaste(e: ClipboardEvent) {
|
||||
_handleValuePaste(event: ClipboardEvent) {
|
||||
if (!this.props.allowMultiline) {
|
||||
return;
|
||||
}
|
||||
|
||||
const value = e.clipboardData?.getData('text/plain');
|
||||
const value = event.clipboardData?.getData('text/plain');
|
||||
|
||||
if (value?.includes('\n')) {
|
||||
e.preventDefault();
|
||||
event.preventDefault();
|
||||
|
||||
// Insert the pasted text into the current selection.
|
||||
// Unfortunately, this is the easiest way to do this.
|
||||
@@ -194,46 +194,36 @@ class KeyValueEditorRowInternal extends PureComponent<Props, State> {
|
||||
});
|
||||
}
|
||||
|
||||
_handleFocusName(e: FocusEvent) {
|
||||
this.props.onFocusName(this.props.pair, e);
|
||||
_handleFocusName(event: FocusEvent) {
|
||||
this.props.onFocusName(this.props.pair, event);
|
||||
}
|
||||
|
||||
_handleFocusValue(e: FocusEvent) {
|
||||
this.props.onFocusValue(this.props.pair, e);
|
||||
_handleFocusValue(event: FocusEvent) {
|
||||
this.props.onFocusValue(this.props.pair, event);
|
||||
}
|
||||
|
||||
_handleFocusDescription(e: FocusEvent) {
|
||||
this.props.onFocusDescription(this.props.pair, e);
|
||||
_handleFocusDescription(event: FocusEvent) {
|
||||
this.props.onFocusDescription(this.props.pair, event);
|
||||
}
|
||||
|
||||
_handleBlurName(e: FocusEvent) {
|
||||
if (this.props.onBlurName) {
|
||||
this.props.onBlurName(this.props.pair, e);
|
||||
}
|
||||
_handleBlurName(event: FocusEvent) {
|
||||
this.props.onBlurName?.(this.props.pair, event);
|
||||
}
|
||||
|
||||
_handleBlurValue(e: FocusEvent) {
|
||||
if (this.props.onBlurName) {
|
||||
this.props.onBlurValue?.(this.props.pair, e);
|
||||
}
|
||||
_handleBlurValue(event: FocusEvent) {
|
||||
this.props.onBlurValue?.(this.props.pair, event);
|
||||
}
|
||||
|
||||
_handleBlurDescription(e: FocusEvent) {
|
||||
if (this.props.onBlurDescription) {
|
||||
this.props.onBlurDescription(this.props.pair, e);
|
||||
}
|
||||
_handleBlurDescription(event: FocusEvent) {
|
||||
this.props.onBlurDescription?.(this.props.pair, event);
|
||||
}
|
||||
|
||||
_handleDelete() {
|
||||
if (this.props.onDelete) {
|
||||
this.props.onDelete(this.props.pair);
|
||||
}
|
||||
this.props.onDelete?.(this.props.pair);
|
||||
}
|
||||
|
||||
_handleKeyDown(e: KeyboardEvent, value?: any) {
|
||||
if (this.props.onKeyDown) {
|
||||
this.props.onKeyDown(this.props.pair, e, value);
|
||||
}
|
||||
_handleKeyDown(event: KeyboardEvent, value?: any) {
|
||||
this.props.onKeyDown?.(this.props.pair, event, value);
|
||||
}
|
||||
|
||||
_handleAutocompleteNames() {
|
||||
|
||||
@@ -15,39 +15,39 @@ interface Props {
|
||||
|
||||
@autoBindMethodsForReact(AUTOBIND_CFG)
|
||||
export class KeydownBinder extends PureComponent<Props> {
|
||||
_handleKeydown(e: KeyboardEvent) {
|
||||
_handleKeydown(event: KeyboardEvent) {
|
||||
const { stopMetaPropagation, onKeydown, disabled } = this.props;
|
||||
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
const isMeta = isMac() ? e.metaKey : e.ctrlKey;
|
||||
const isMeta = isMac() ? event.metaKey : event.ctrlKey;
|
||||
|
||||
if (stopMetaPropagation && isMeta) {
|
||||
e.stopPropagation();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
if (onKeydown) {
|
||||
onKeydown(e);
|
||||
onKeydown(event);
|
||||
}
|
||||
}
|
||||
|
||||
_handleKeyup(e: KeyboardEvent) {
|
||||
_handleKeyup(event: KeyboardEvent) {
|
||||
const { stopMetaPropagation, onKeyup, disabled } = this.props;
|
||||
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
const isMeta = isMac() ? e.metaKey : e.ctrlKey;
|
||||
const isMeta = isMac() ? event.metaKey : event.ctrlKey;
|
||||
|
||||
if (stopMetaPropagation && isMeta) {
|
||||
e.stopPropagation();
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
if (onKeyup) {
|
||||
onKeyup(e);
|
||||
onKeyup(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ export class MarkdownEditor extends PureComponent<Props, State> {
|
||||
});
|
||||
}
|
||||
|
||||
_setEditorRef(n: UnconnectedCodeEditor) {
|
||||
this._editor = n;
|
||||
_setEditorRef(editor: UnconnectedCodeEditor) {
|
||||
this._editor = editor;
|
||||
}
|
||||
|
||||
focusEnd() {
|
||||
|
||||
@@ -61,13 +61,13 @@ class MarkdownPreviewInternal extends PureComponent<Props, State> {
|
||||
);
|
||||
}
|
||||
|
||||
_setPreviewRef(n: HTMLDivElement) {
|
||||
this._preview = n;
|
||||
_setPreviewRef(preview: HTMLDivElement) {
|
||||
this._preview = preview;
|
||||
}
|
||||
|
||||
_handleClickLink(e) {
|
||||
e.preventDefault();
|
||||
clickLink(e.target.getAttribute('href'));
|
||||
_handleClickLink(event) {
|
||||
event.preventDefault();
|
||||
clickLink(event.target.getAttribute('href'));
|
||||
}
|
||||
|
||||
_highlightCodeBlocks() {
|
||||
|
||||
@@ -33,20 +33,20 @@ export class AddKeyCombinationModal extends PureComponent<{}, State> {
|
||||
this._modal = modal;
|
||||
}
|
||||
|
||||
_handleKeyDown(e: KeyboardEvent) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
_handleKeyDown(event: KeyboardEvent) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
|
||||
// Handle keypress without modifiers.
|
||||
if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey) {
|
||||
if (!event.ctrlKey && !event.altKey && !event.shiftKey && !event.metaKey) {
|
||||
// esc key is for closing dialog, don't record it.
|
||||
if (e.keyCode === keyboardKeys.esc.keyCode) {
|
||||
if (event.keyCode === keyboardKeys.esc.keyCode) {
|
||||
// Hiding modal is already handled by underlying modal.
|
||||
return;
|
||||
}
|
||||
|
||||
// enter key is for saving previously entered key combination, don't record it.
|
||||
if (e.keyCode === keyboardKeys.enter.keyCode) {
|
||||
if (event.keyCode === keyboardKeys.enter.keyCode) {
|
||||
const {
|
||||
hotKeyRefId,
|
||||
checkKeyCombinationDuplicate,
|
||||
@@ -79,11 +79,11 @@ export class AddKeyCombinationModal extends PureComponent<{}, State> {
|
||||
}
|
||||
|
||||
const pressed: KeyCombination = {
|
||||
ctrl: e.ctrlKey,
|
||||
alt: e.altKey,
|
||||
shift: e.shiftKey,
|
||||
meta: e.metaKey,
|
||||
keyCode: e.keyCode,
|
||||
ctrl: event.ctrlKey,
|
||||
alt: event.altKey,
|
||||
shift: event.shiftKey,
|
||||
meta: event.metaKey,
|
||||
keyCode: event.keyCode,
|
||||
};
|
||||
this.setState({
|
||||
pressedKeyCombination: pressed,
|
||||
|
||||
@@ -33,8 +33,8 @@ export class AlertModal extends PureComponent<{}, State> {
|
||||
_okCallback: (value: void | PromiseLike<void>) => void;
|
||||
_okCallback2: AlertModalOptions['onConfirm'];
|
||||
|
||||
_setModalRef(m: Modal) {
|
||||
this.modal = m;
|
||||
_setModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
_handleOk() {
|
||||
@@ -51,12 +51,12 @@ export class AlertModal extends PureComponent<{}, State> {
|
||||
this.modal?.hide();
|
||||
}
|
||||
|
||||
setCancelRef(n: HTMLButtonElement) {
|
||||
this._cancel = n;
|
||||
setCancelRef(cancel: HTMLButtonElement) {
|
||||
this._cancel = cancel;
|
||||
}
|
||||
|
||||
setOkRef(n: HTMLButtonElement) {
|
||||
this._ok = n;
|
||||
setOkRef(ok: HTMLButtonElement) {
|
||||
this._ok = ok;
|
||||
}
|
||||
|
||||
show({ title, message, addCancel, onConfirm, okLabel }: AlertModalOptions) {
|
||||
|
||||
@@ -39,12 +39,12 @@ export class AskModal extends PureComponent<{}, State> {
|
||||
_doneCallback: AskModalOptions['onDone'];
|
||||
_promiseCallback: (value: boolean | PromiseLike<boolean>) => void = () => {};
|
||||
|
||||
_setModalRef(m: Modal) {
|
||||
this.modal = m;
|
||||
_setModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
_setYesButtonRef(n: HTMLButtonElement) {
|
||||
this.yesButton = n;
|
||||
_setYesButtonRef(yesButton: HTMLButtonElement) {
|
||||
this.yesButton = yesButton;
|
||||
}
|
||||
|
||||
async _handleYes() {
|
||||
|
||||
@@ -54,8 +54,8 @@ export class CodePromptModal extends PureComponent<{}, State> {
|
||||
_onModeChange: Function = () => {};
|
||||
_onChange: Function = () => {};
|
||||
|
||||
_setModalRef(n: Modal) {
|
||||
this.modal = n;
|
||||
_setModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
_handleChange(value) {
|
||||
|
||||
@@ -39,8 +39,8 @@ export class UnconnectedCookieModifyModal extends PureComponent<Props, State> {
|
||||
rawValue: '',
|
||||
};
|
||||
|
||||
_setModalRef(n: Modal) {
|
||||
this.modal = n;
|
||||
_setModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
async show(cookie: Cookie) {
|
||||
|
||||
@@ -38,12 +38,12 @@ class CookiesModal extends PureComponent<Props, State> {
|
||||
visibleCookieIndexes: null,
|
||||
};
|
||||
|
||||
_setModalRef(n: Modal) {
|
||||
this.modal = n;
|
||||
_setModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
_setFilterInputRef(n: HTMLInputElement) {
|
||||
this.filterInput = n;
|
||||
_setFilterInputRef(filterInput: HTMLInputElement) {
|
||||
this.filterInput = filterInput;
|
||||
}
|
||||
|
||||
async _saveChanges() {
|
||||
@@ -84,8 +84,8 @@ class CookiesModal extends PureComponent<Props, State> {
|
||||
await this._saveChanges();
|
||||
}
|
||||
|
||||
async _handleFilterChange(e: ChangeEvent<HTMLInputElement>) {
|
||||
if (!(e.target instanceof HTMLInputElement)) {
|
||||
async _handleFilterChange(event: ChangeEvent<HTMLInputElement>) {
|
||||
if (!(event.target instanceof HTMLInputElement)) {
|
||||
return;
|
||||
}
|
||||
const { activeCookieJar } = this.props;
|
||||
@@ -93,7 +93,7 @@ class CookiesModal extends PureComponent<Props, State> {
|
||||
return;
|
||||
}
|
||||
|
||||
const filter = e.target.value;
|
||||
const filter = event.target.value;
|
||||
|
||||
this._applyFilter(filter, activeCookieJar.cookies);
|
||||
}
|
||||
|
||||
@@ -28,12 +28,12 @@ export class EnvironmentEditModal extends PureComponent<Props, State> {
|
||||
modal: Modal | null = null;
|
||||
_envEditor: EnvironmentEditor | null = null;
|
||||
|
||||
_setModalRef(n: Modal) {
|
||||
this.modal = n;
|
||||
_setModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
_setEditorRef(n: EnvironmentEditor) {
|
||||
this._envEditor = n;
|
||||
_setEditorRef(envEditor: EnvironmentEditor) {
|
||||
this._envEditor = envEditor;
|
||||
}
|
||||
|
||||
_saveChanges() {
|
||||
|
||||
@@ -26,8 +26,8 @@ export class ErrorModal extends PureComponent<{}, ErrorModalOptions> {
|
||||
addCancel: false,
|
||||
};
|
||||
|
||||
_setModalRef(m: Modal) {
|
||||
this.modal = m;
|
||||
_setModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
_handleOk() {
|
||||
|
||||
@@ -74,8 +74,8 @@ export class FilterHelpModal extends PureComponent<{}, State> {
|
||||
|
||||
modal: Modal | null = null;
|
||||
|
||||
_setModalRef(n: Modal) {
|
||||
this.modal = n;
|
||||
_setModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
show(isJSON: boolean) {
|
||||
|
||||
@@ -51,11 +51,11 @@ export class GenerateCodeModal extends PureComponent<Props, State> {
|
||||
// Load preferences from localStorage
|
||||
try {
|
||||
target = JSON.parse(window.localStorage.getItem('insomnia::generateCode::target') || '') as HTTPSnippetTarget;
|
||||
} catch (e) {}
|
||||
} catch (error) {}
|
||||
|
||||
try {
|
||||
client = JSON.parse(window.localStorage.getItem('insomnia::generateCode::client') || '') as HTTPSnippetClient;
|
||||
} catch (e) {}
|
||||
} catch (error) {}
|
||||
|
||||
this.state = {
|
||||
cmd: '',
|
||||
@@ -68,12 +68,12 @@ export class GenerateCodeModal extends PureComponent<Props, State> {
|
||||
modal: Modal | null = null;
|
||||
_editor: UnconnectedCodeEditor | null = null;
|
||||
|
||||
_setModalRef(n: Modal) {
|
||||
this.modal = n;
|
||||
_setModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
_setEditorRef(n: UnconnectedCodeEditor) {
|
||||
this._editor = n;
|
||||
_setEditorRef(editor: UnconnectedCodeEditor) {
|
||||
this._editor = editor;
|
||||
}
|
||||
|
||||
hide() {
|
||||
|
||||
@@ -45,8 +45,8 @@ export class GenerateConfigModal extends PureComponent<{}, State> {
|
||||
activeTab: 0,
|
||||
};
|
||||
|
||||
_setModalRef(n: Modal) {
|
||||
this.modal = n;
|
||||
_setModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
async _generate(generatePlugin: ConfigGenerator, apiSpec: ApiSpec) {
|
||||
|
||||
@@ -109,8 +109,8 @@ export class GitBranchesModal extends PureComponent<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
async _handleCreate(e: React.SyntheticEvent<HTMLFormElement>) {
|
||||
e.preventDefault();
|
||||
async _handleCreate(event: React.SyntheticEvent<HTMLFormElement>) {
|
||||
event.preventDefault();
|
||||
await this._errorHandler(async () => {
|
||||
const { vcs, gitRepository } = this.props;
|
||||
const { newBranchName } = this.state;
|
||||
@@ -166,9 +166,9 @@ export class GitBranchesModal extends PureComponent<Props, State> {
|
||||
});
|
||||
}
|
||||
|
||||
_updateNewBranchName(e: React.SyntheticEvent<HTMLInputElement>) {
|
||||
_updateNewBranchName(event: React.SyntheticEvent<HTMLInputElement>) {
|
||||
this.setState({
|
||||
newBranchName: e.currentTarget.value,
|
||||
newBranchName: event.currentTarget.value,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -25,9 +25,9 @@ export const CustomRepositorySettingsFormGroup: FunctionComponent<Props> = ({
|
||||
<form
|
||||
id="custom"
|
||||
className='form-group'
|
||||
onSubmit={e => {
|
||||
e.preventDefault();
|
||||
const formData = new FormData(e.currentTarget);
|
||||
onSubmit={event => {
|
||||
event.preventDefault();
|
||||
const formData = new FormData(event.currentTarget);
|
||||
onSubmit({
|
||||
uri: formData.get('uri') as string || '',
|
||||
credentials: {
|
||||
|
||||
+2
-2
@@ -30,8 +30,8 @@ export class GitRepositorySettingsModal extends PureComponent<{}, State> {
|
||||
gitRepository: null,
|
||||
};
|
||||
|
||||
_setModalRef(n: Modal) {
|
||||
this.modal = n;
|
||||
_setModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
show(options: {
|
||||
|
||||
+12
-12
@@ -218,8 +218,8 @@ const GitHubRepositoryForm = ({
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((e: unknown) => {
|
||||
if (e instanceof Error) {
|
||||
.catch((error: unknown) => {
|
||||
if (error instanceof Error) {
|
||||
setError(
|
||||
'Something went wrong when trying to fetch info from GitHub.'
|
||||
);
|
||||
@@ -237,9 +237,9 @@ const GitHubRepositoryForm = ({
|
||||
id="github"
|
||||
className="form-group"
|
||||
style={{ height: '100%' }}
|
||||
onSubmit={e =>
|
||||
onSubmit={event =>
|
||||
onSubmit({
|
||||
uri: (new FormData(e.currentTarget).get('uri') as string) ?? '',
|
||||
uri: (new FormData(event.currentTarget).get('uri') as string) ?? '',
|
||||
author: {
|
||||
name: user?.login ?? '',
|
||||
email: user?.email ?? '',
|
||||
@@ -289,9 +289,9 @@ const GitHubRepositoryForm = ({
|
||||
</Details>
|
||||
</AccountDetails>
|
||||
<Button
|
||||
onClick={e => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
onClick={event => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
showAlert({
|
||||
title: 'Sign out of GitHub',
|
||||
message:
|
||||
@@ -352,16 +352,16 @@ const GitHubSignInForm = ({ token }: GitHubSignInFormProps) => {
|
||||
|
||||
{isAuthenticating && (
|
||||
<form
|
||||
onSubmit={e => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const formData = new FormData(e.currentTarget);
|
||||
onSubmit={event => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
const formData = new FormData(event.currentTarget);
|
||||
const link = formData.get('link');
|
||||
if (typeof link === 'string') {
|
||||
let parsedURL: URL;
|
||||
try {
|
||||
parsedURL = new URL(link);
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
setError('Invalid URL');
|
||||
return;
|
||||
}
|
||||
|
||||
+13
-13
@@ -172,13 +172,13 @@ const GitLabRepositoryForm = ({
|
||||
}).then(({ data }) => {
|
||||
setUser(data);
|
||||
})
|
||||
.catch((e: unknown) => {
|
||||
if (axios.isAxiosError(e) && e.response?.status === 401) {
|
||||
.catch((error: unknown) => {
|
||||
if (axios.isAxiosError(error) && error.response?.status === 401) {
|
||||
refreshToken();
|
||||
} else {
|
||||
const errorMessage = (e instanceof Error) ? e.message : 'Something went wrong when trying to fetch info from GitLab.';
|
||||
const errorMessage = (error instanceof Error) ? error.message : 'Something went wrong when trying to fetch info from GitLab.';
|
||||
setError(errorMessage);
|
||||
console.log(`[gitlab oauth]: ${e}`);
|
||||
console.log(`[gitlab oauth]: ${error}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -189,9 +189,9 @@ const GitLabRepositoryForm = ({
|
||||
id="gitlab"
|
||||
className="form-group"
|
||||
style={{ height: '100%' }}
|
||||
onSubmit={e =>
|
||||
onSubmit={event =>
|
||||
onSubmit({
|
||||
uri: (new FormData(e.currentTarget).get('uri') as string) ?? '',
|
||||
uri: (new FormData(event.currentTarget).get('uri') as string) ?? '',
|
||||
author: {
|
||||
name: (user?.username || user?.name) ?? '',
|
||||
email: user?.commit_email ?? user?.public_email ?? user?.email ?? '',
|
||||
@@ -241,9 +241,9 @@ const GitLabRepositoryForm = ({
|
||||
</Details>
|
||||
</AccountDetails>
|
||||
<Button
|
||||
onClick={e => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
onClick={event => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
showAlert({
|
||||
title: 'Sign out of GitLab',
|
||||
message:
|
||||
@@ -310,10 +310,10 @@ const GitLabSignInForm = ({ token }: GitLabSignInFormProps) => {
|
||||
|
||||
{isAuthenticating && (
|
||||
<form
|
||||
onSubmit={e => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const formData = new FormData(e.currentTarget);
|
||||
onSubmit={event => {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
const formData = new FormData(event.currentTarget);
|
||||
const link = formData.get('link');
|
||||
if (typeof link === 'string') {
|
||||
const parsedURL = new URL(link);
|
||||
|
||||
@@ -74,9 +74,9 @@ export class GitStagingModal extends PureComponent<Props, State> {
|
||||
this.textarea = ref;
|
||||
}
|
||||
|
||||
async _handleMessageChange(e: React.SyntheticEvent<HTMLTextAreaElement>) {
|
||||
async _handleMessageChange(event: React.SyntheticEvent<HTMLTextAreaElement>) {
|
||||
this.setState({
|
||||
message: e.currentTarget.value,
|
||||
message: event.currentTarget.value,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -133,9 +133,9 @@ export class GitStagingModal extends PureComponent<Props, State> {
|
||||
});
|
||||
}
|
||||
|
||||
async _handleToggleOne(e: React.SyntheticEvent<HTMLInputElement>) {
|
||||
async _handleToggleOne(event: React.SyntheticEvent<HTMLInputElement>) {
|
||||
const newItems = { ...this.state.items };
|
||||
const gitPath = e.currentTarget.name;
|
||||
const gitPath = event.currentTarget.name;
|
||||
|
||||
if (!newItems[gitPath] || !newItems[gitPath].editable) {
|
||||
return;
|
||||
|
||||
@@ -30,20 +30,20 @@ export class LoginModal extends PureComponent<{}, State> {
|
||||
_passwordInput: HTMLInputElement | null = null;
|
||||
_emailInput: HTMLInputElement | null = null;
|
||||
|
||||
_setModalRef(n: Modal) {
|
||||
this.modal = n;
|
||||
_setModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
_setPasswordInputRef(n: HTMLInputElement) {
|
||||
this._passwordInput = n;
|
||||
_setPasswordInputRef(passwordInput: HTMLInputElement) {
|
||||
this._passwordInput = passwordInput;
|
||||
}
|
||||
|
||||
_setEmailInputRef(n: HTMLInputElement) {
|
||||
this._emailInput = n;
|
||||
_setEmailInputRef(emailInput: HTMLInputElement) {
|
||||
this._emailInput = emailInput;
|
||||
}
|
||||
|
||||
async _handleLogin(e) {
|
||||
e.preventDefault();
|
||||
async _handleLogin(event) {
|
||||
event.preventDefault();
|
||||
this.setState({
|
||||
error: '',
|
||||
loading: true,
|
||||
@@ -55,9 +55,9 @@ export class LoginModal extends PureComponent<{}, State> {
|
||||
// @ts-expect-error -- TSCONVERSION this needs to explicitly handle the case where email or password is undefined
|
||||
await session.login(email, password);
|
||||
this.hide();
|
||||
} catch (e) {
|
||||
} catch (error) {
|
||||
this.setState({
|
||||
error: e.message,
|
||||
error: error.message,
|
||||
loading: false,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -29,16 +29,16 @@ export class NunjucksModal extends PureComponent<Props, State> {
|
||||
_currentTemplate: string | null = null;
|
||||
modal: Modal | null = null;
|
||||
|
||||
_setModalRef(n: Modal) {
|
||||
this.modal = n;
|
||||
_setModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
_handleTemplateChange(template: string | null) {
|
||||
this._currentTemplate = template;
|
||||
}
|
||||
|
||||
_handleSubmit(e) {
|
||||
e.preventDefault();
|
||||
_handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
this.hide();
|
||||
}
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ type Props = ReduxProps;
|
||||
class ProjectSettingsModal extends PureComponent<Props> {
|
||||
modal: Modal | null = null;
|
||||
|
||||
_handleSetModalRef(n: Modal) {
|
||||
this.modal = n;
|
||||
_handleSetModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
_handleRemoveProject() {
|
||||
|
||||
@@ -92,12 +92,12 @@ export class PromptModal extends PureComponent<{}, State> {
|
||||
onCancel?.();
|
||||
}
|
||||
|
||||
_setInputRef(n: HTMLInputElement) {
|
||||
this._input = n;
|
||||
_setInputRef(input: HTMLInputElement) {
|
||||
this._input = input;
|
||||
}
|
||||
|
||||
_setModalRef(n: Modal) {
|
||||
this.modal = n;
|
||||
_setModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
_handleSelectHint(hint: string) {
|
||||
@@ -113,7 +113,7 @@ export class PromptModal extends PureComponent<{}, State> {
|
||||
});
|
||||
}
|
||||
|
||||
async _handleSubmit(e: React.SyntheticEvent<HTMLFormElement | HTMLButtonElement>) {
|
||||
async _handleSubmit(event: React.SyntheticEvent<HTMLFormElement | HTMLButtonElement>) {
|
||||
if (this.state.loading) {
|
||||
return;
|
||||
}
|
||||
@@ -122,7 +122,7 @@ export class PromptModal extends PureComponent<{}, State> {
|
||||
loading: true,
|
||||
});
|
||||
|
||||
e.preventDefault();
|
||||
event.preventDefault();
|
||||
|
||||
if (this._input) {
|
||||
const result =
|
||||
@@ -136,12 +136,12 @@ export class PromptModal extends PureComponent<{}, State> {
|
||||
});
|
||||
}
|
||||
|
||||
_handleChange(e: React.SyntheticEvent<HTMLInputElement>) {
|
||||
_handleChange(event: React.SyntheticEvent<HTMLInputElement>) {
|
||||
const { validate } = this.state;
|
||||
|
||||
if (validate) {
|
||||
const errorMessage = validate(e.currentTarget.value);
|
||||
e.currentTarget.setCustomValidity(errorMessage);
|
||||
const errorMessage = validate(event.currentTarget.value);
|
||||
event.currentTarget.setCustomValidity(errorMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,8 +63,8 @@ class ProtoFilesModal extends PureComponent<Props, State> {
|
||||
this.modal?.show();
|
||||
}
|
||||
|
||||
async _handleSave(e: React.SyntheticEvent<HTMLButtonElement>) {
|
||||
e.preventDefault();
|
||||
async _handleSave(event: React.SyntheticEvent<HTMLButtonElement>) {
|
||||
event.preventDefault();
|
||||
this.hide();
|
||||
|
||||
if (typeof this.onSave === 'function' && this.state.selectedProtoFileId) {
|
||||
|
||||
@@ -53,12 +53,12 @@ export class UnconnectedRequestGroupSettingsModal extends React.PureComponent<Pr
|
||||
justMoved: false,
|
||||
};
|
||||
|
||||
_setModalRef(n: Modal) {
|
||||
this.modal = n;
|
||||
_setModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
_setEditorRef(n: MarkdownEditor) {
|
||||
this._editor = n;
|
||||
_setEditorRef(ediotr: MarkdownEditor) {
|
||||
this._editor = ediotr;
|
||||
}
|
||||
|
||||
async _handleNameChange(name: string) {
|
||||
@@ -93,8 +93,8 @@ export class UnconnectedRequestGroupSettingsModal extends React.PureComponent<Pr
|
||||
this.setState({ showDescription: true });
|
||||
}
|
||||
|
||||
_handleUpdateMoveCopyWorkspace(e: React.SyntheticEvent<HTMLSelectElement>) {
|
||||
const { value } = e.currentTarget;
|
||||
_handleUpdateMoveCopyWorkspace(event: React.SyntheticEvent<HTMLSelectElement>) {
|
||||
const { value } = event.currentTarget;
|
||||
const workspaceId = value === '__NULL__' ? null : value;
|
||||
this.setState({ activeWorkspaceIdToCopyTo: workspaceId });
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@ export class RequestRenderErrorModal extends PureComponent<{}, State> {
|
||||
|
||||
modal: Modal | null = null;
|
||||
|
||||
_setModalRef(n: Modal) {
|
||||
this.modal = n;
|
||||
_setModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
_handleShowRequestSettings() {
|
||||
|
||||
@@ -55,22 +55,22 @@ export class UnconnectedRequestSettingsModal extends PureComponent<Props, State>
|
||||
justMoved: false,
|
||||
};
|
||||
|
||||
_setModalRef(n: Modal) {
|
||||
this.modal = n;
|
||||
_setModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
_setEditorRef(n: MarkdownEditor) {
|
||||
this._editor = n;
|
||||
_setEditorRef(editor: MarkdownEditor) {
|
||||
this._editor = editor;
|
||||
}
|
||||
|
||||
async _updateRequestSettingBoolean(e: React.SyntheticEvent<HTMLInputElement>) {
|
||||
async _updateRequestSettingBoolean(event: React.SyntheticEvent<HTMLInputElement>) {
|
||||
if (!this.state.request) {
|
||||
// Should never happen
|
||||
return;
|
||||
}
|
||||
|
||||
const value = e.currentTarget.checked;
|
||||
const setting = e.currentTarget.name;
|
||||
const value = event.currentTarget.checked;
|
||||
const setting = event.currentTarget.name;
|
||||
// @ts-expect-error -- TSCONVERSION request settings only exist for regular requests, the types should filter down and exit if grpc
|
||||
const request = await models.request.update(this.state.request, {
|
||||
[setting]: value,
|
||||
@@ -78,14 +78,14 @@ export class UnconnectedRequestSettingsModal extends PureComponent<Props, State>
|
||||
this.setState({ request });
|
||||
}
|
||||
|
||||
async _updateRequestSettingString(e: React.SyntheticEvent<HTMLInputElement | HTMLSelectElement>) {
|
||||
async _updateRequestSettingString(event: React.SyntheticEvent<HTMLInputElement | HTMLSelectElement>) {
|
||||
if (!this.state.request) {
|
||||
// Should never happen
|
||||
return;
|
||||
}
|
||||
|
||||
const value = e.currentTarget.value;
|
||||
const setting = e.currentTarget.name;
|
||||
const value = event.currentTarget.value;
|
||||
const setting = event.currentTarget.name;
|
||||
// @ts-expect-error -- TSCONVERSION request settings only exist for regular requests, the types should filter down and exit if grpc
|
||||
const request = await models.request.update(this.state.request, {
|
||||
[setting]: value,
|
||||
@@ -128,8 +128,8 @@ export class UnconnectedRequestSettingsModal extends PureComponent<Props, State>
|
||||
this.setState({ showDescription: true });
|
||||
}
|
||||
|
||||
_handleUpdateMoveCopyWorkspace(e: React.SyntheticEvent<HTMLSelectElement>) {
|
||||
const { value } = e.currentTarget;
|
||||
_handleUpdateMoveCopyWorkspace(event: React.SyntheticEvent<HTMLSelectElement>) {
|
||||
const { value } = event.currentTarget;
|
||||
const workspaceId = value === '__NULL__' ? null : value;
|
||||
this.setState({ activeWorkspaceIdToCopyTo: workspaceId });
|
||||
}
|
||||
|
||||
@@ -101,12 +101,12 @@ class RequestSwitcherModal extends PureComponent<Props, State> {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
_setModalRef(n: Modal) {
|
||||
this.modal = n;
|
||||
_setModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
_setInputRef(n: HTMLInputElement) {
|
||||
this._input = n;
|
||||
_setInputRef(input: HTMLInputElement) {
|
||||
this._input = input;
|
||||
}
|
||||
|
||||
_setActiveIndex(activeIndex: number) {
|
||||
@@ -174,8 +174,8 @@ class RequestSwitcherModal extends PureComponent<Props, State> {
|
||||
this.modal?.hide();
|
||||
}
|
||||
|
||||
_handleChange(e: React.SyntheticEvent<HTMLInputElement>) {
|
||||
this._handleChangeValue(e.currentTarget.value);
|
||||
_handleChange(event: React.SyntheticEvent<HTMLInputElement>) {
|
||||
this._handleChangeValue(event.currentTarget.value);
|
||||
}
|
||||
|
||||
/** Return array of path segments for given request or folder */
|
||||
@@ -377,12 +377,12 @@ class RequestSwitcherModal extends PureComponent<Props, State> {
|
||||
});
|
||||
}
|
||||
|
||||
async _handleKeyup(e: KeyboardEvent) {
|
||||
async _handleKeyup(event: KeyboardEvent) {
|
||||
const { selectOnKeyup } = this.state;
|
||||
// Handle selection if unpresses all modifier keys. Ideally this would trigger once
|
||||
// the user unpresses the hotkey that triggered this modal but we currently do not
|
||||
// have the facilities to do that.
|
||||
const isMetaKeyDown = e.ctrlKey || e.shiftKey || e.metaKey || e.altKey;
|
||||
const isMetaKeyDown = event.ctrlKey || event.shiftKey || event.metaKey || event.altKey;
|
||||
const isActive = this.modal?.isOpen();
|
||||
|
||||
if (selectOnKeyup && isActive && !isMetaKeyDown) {
|
||||
|
||||
@@ -25,8 +25,8 @@ export class ResponseDebugModal extends PureComponent<{}, State> {
|
||||
title: '',
|
||||
};
|
||||
|
||||
_setModalRef(n: Modal) {
|
||||
this.modal = n;
|
||||
_setModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
hide() {
|
||||
|
||||
@@ -43,8 +43,8 @@ export class UnconnectedSettingsModal extends PureComponent<Props, State> {
|
||||
|
||||
modal: Modal | null = null;
|
||||
|
||||
_setModalRef(n: Modal) {
|
||||
this.modal = n;
|
||||
_setModalRef(modal: Modal) {
|
||||
this.modal = modal;
|
||||
}
|
||||
|
||||
async _handleUpdateKeyBindings(hotKeyRegistry: HotKeyRegistry) {
|
||||
|
||||
Loaded 100 of 132 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user