Skip to content

Commit

Permalink
Merge branch 'main' into feat/collection-resequencing
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjaikumar-bruno committed Jan 9, 2025
2 parents b0964f4 + 3cb15fc commit 91557e5
Show file tree
Hide file tree
Showing 12 changed files with 165 additions and 31 deletions.
108 changes: 95 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ const ClientCertSettings = ({ root, clientCertConfig, onUpdate, onRemove }) => {
});

const getFile = (e) => {
if (e.files?.[0]?.path) {
const filePath = window?.ipcRenderer?.getFilePath(e?.files?.[0]);
if (filePath) {
let relativePath;
if (isWindowsOS()) {
relativePath = slash(path.win32.relative(root, e.files[0].path));
relativePath = slash(path.win32.relative(root, filePath));
} else {
relativePath = path.posix.relative(root, e.files[0].path);
relativePath = path.posix.relative(root, filePath);
}
formik.setFieldValue(e.name, relativePath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ const General = ({ close }) => {
};

const addCaCertificate = (e) => {
formik.setFieldValue('customCaCertificate.filePath', e.target.files[0]?.path);
const filePath = window?.ipcRenderer?.getFilePath(e?.target?.files?.[0]);
if (filePath) {
formik.setFieldValue('customCaCertificate.filePath', filePath);
}
};

const deleteCaCertificate = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,21 @@ const GenerateCodeItem = ({ collection, item, onClose }) => {
tabIndex={0}
onClick={() => setSelectedLanguage(language)}
onKeyDown={(e) => {
if (e.key === 'Tab') {
if (e.key === 'Tab' || (e.shiftKey && e.key === 'Tab')) {
e.preventDefault();
const currentIndex = languages.findIndex((lang) => lang.name === selectedLanguage.name);
const nextIndex = e.shiftKey
? (currentIndex - 1 + languages.length) % languages.length
: (currentIndex + 1) % languages.length;
setSelectedLanguage(languages[nextIndex]);
}

if (e.shiftKey && e.key === 'Tab') {
e.preventDefault();
const currentIndex = languages.findIndex((lang) => lang.name === selectedLanguage.name);
const nextIndex = (currentIndex - 1 + languages.length) % languages.length;
setSelectedLanguage(languages[nextIndex]);
// Explicitly focus on the new active element
const nextElement = document.querySelector(`[data-language="${languages[nextIndex].name}"]`);
nextElement?.focus();
}

}}
data-language={language.name}
aria-pressed={language.name === selectedLanguage.name}
>
<span className="capitalize">{language.name}</span>
Expand All @@ -89,6 +88,7 @@ const GenerateCodeItem = ({ collection, item, onClose }) => {
<div className="flex-grow p-4">
{isValidUrl(finalUrl) ? (
<CodeView
tabIndex={-1}
language={selectedLanguage}
item={{
...item,
Expand Down
3 changes: 3 additions & 0 deletions packages/bruno-app/src/utils/importers/postman-collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ const importPostmanV2CollectionItem = (brunoParent, item, parentAuth, options) =
type: 'folder',
items: [],
root: {
docs: i.description || '',
meta: {
name: folderName
},
Expand Down Expand Up @@ -226,6 +227,7 @@ const importPostmanV2CollectionItem = (brunoParent, item, parentAuth, options) =

brunoParent.items.push(brunoFolderItem);
folderMap[folderName] = brunoFolderItem;

} else {
if (i.request) {
const baseRequestName = i.name;
Expand Down Expand Up @@ -483,6 +485,7 @@ const importPostmanV2Collection = (collection, options) => {
items: [],
environments: [],
root: {
docs: collection.info.description || '',
meta: {
name: collection.info.name
},
Expand Down
22 changes: 22 additions & 0 deletions packages/bruno-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,28 @@
"type": "git",
"url": "git+https://github.com/usebruno/bruno.git"
},
"keywords": [
"API",
"testing",
"automation",
"cli",
"command-line",
"bruno",
"HTTP requests",
"rest-api",
"api-client",
"api-automation",
"request-handling",
"mock-api",
"http-client",
"async",
"promise",
"javascript",
"nodejs",
"automation-tool",
"postman-alternative",
"api-scripting"
],
"scripts": {
"test": "node --experimental-vm-modules $(npx which jest)"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/bruno-cli/src/commands/run.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const fs = require('fs');
const chalk = require('chalk');
const path = require('path');
const { forOwn } = require('lodash');
const { forOwn, cloneDeep } = require('lodash');
const { exists, isFile, isDirectory } = require('../utils/filesystem');
const { runSingleRequest } = require('../runner/run-single-request');
const { bruToEnvJson, getEnvVars } = require('../utils/bru');
Expand Down Expand Up @@ -637,7 +637,7 @@ const handler = async function (argv) {
let currentRequestIndex = 0;
let nJumps = 0; // count the number of jumps to avoid infinite loops
while (currentRequestIndex < bruJsons.length) {
const iter = bruJsons[currentRequestIndex];
const iter = cloneDeep(bruJsons[currentRequestIndex]);
const { bruFilepath, bruJson } = iter;

const start = process.hrtime();
Expand Down
2 changes: 1 addition & 1 deletion packages/bruno-cli/src/utils/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const parseDataFromResponse = (response, disableParsingResponseJson = false) =>
data = JSON.parse(data);
}
} catch {
console.log('Failed to parse response data as JSON');

}

return { data, dataBuffer };
Expand Down
3 changes: 2 additions & 1 deletion packages/bruno-electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
},
"devDependencies": {
"electron": "33.2.1",
"electron-builder": "25.1.8"
"electron-builder": "25.1.8",
"electron-devtools-installer": "^4.0.0"
}
}
Loading

0 comments on commit 91557e5

Please sign in to comment.