Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: request/folder names should be independent of the actual file/directory name #3094

Open
wants to merge 47 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
4904098
Update package.json
lohxt1 Aug 22, 2024
97a2baa
Update package.json
lohxt1 Aug 22, 2024
b1ca2ed
Update package.json
lohxt1 Aug 22, 2024
9d66d22
Update package.json
lohxt1 Aug 22, 2024
c60b428
Merge branch 'usebruno:main' into main
lohxt1 Aug 23, 2024
b5166bd
Merge branch 'usebruno:main' into main
lohxt1 Aug 23, 2024
96ed098
Merge branch 'usebruno:main' into main
lohxt1 Aug 24, 2024
e17fdcb
Merge branch 'usebruno:main' into main
lohxt1 Aug 26, 2024
defa05e
Merge branch 'usebruno:main' into main
lohxt1 Aug 26, 2024
00b1447
Merge branch 'usebruno:main' into main
lohxt1 Aug 27, 2024
f670920
Merge branch 'usebruno:main' into main
lohxt1 Aug 28, 2024
92529a1
Merge branch 'usebruno:main' into main
lohxt1 Aug 29, 2024
07a2bd9
Merge branch 'usebruno:main' into main
lohxt1 Sep 2, 2024
f9686a9
revert jest command
lohxt1 Sep 3, 2024
873f106
Merge branch 'usebruno:main' into main
lohxt1 Sep 4, 2024
cddfeac
Merge branch 'usebruno:main' into main
lohxt1 Sep 10, 2024
51f98c7
draft: request/folder name seperate from file/directory name
lohxt1 Sep 13, 2024
caf8ff5
feat: updates
lohxt1 Sep 13, 2024
7c19633
feat: updates
lohxt1 Sep 18, 2024
5d197b1
feat: updates
lohxt1 Sep 20, 2024
b95cc16
feat: added tests
lohxt1 Sep 20, 2024
1473f5e
feat: added comment for regex
lohxt1 Sep 20, 2024
f2bc753
feat: tests update
lohxt1 Sep 26, 2024
7e16d0e
Merge branch 'main' into feat/file-name--request-name--2
lohxt1 Nov 11, 2024
89b1114
fix: updates
lohxt1 Nov 14, 2024
34ea352
add: document save button
pooja-bruno Dec 17, 2024
96766b6
add: save btn in file and folder docs
pooja-bruno Dec 24, 2024
d3fd0eb
adding save button for folder and collection
pooja-bruno Dec 31, 2024
f3a49cb
adding: collection draft
pooja-bruno Jan 3, 2025
10757ac
add: collection closing modal
pooja-bruno Jan 3, 2025
872223f
add: folder draft
pooja-bruno Jan 3, 2025
22f5c5a
Merge branch 'usebruno:main' into add/document-save-button
pooja-bruno Jan 3, 2025
ee08fca
add folder condition in collectionChangeFileEvent and some fixes
pooja-bruno Jan 6, 2025
5cf12ae
fixes
pooja-bruno Jan 6, 2025
84b565f
rm: document button changes
pooja-bruno Jan 7, 2025
2dfc7e9
fix
pooja-bruno Jan 7, 2025
bdf9b15
small fixes
pooja-bruno Jan 7, 2025
94f155a
rm
pooja-bruno Jan 7, 2025
347c087
Merge branch 'main' of lohxt1:lohxt1/bruno into feat/file-name--reque…
lohxt1 Jan 19, 2025
f385cd2
file explorer and bru file linter
lohxt1 Jan 19, 2025
48c2c58
updated ui for file explorer to show all files in a collection
lohxt1 Jan 19, 2025
57ae4ee
Merge branch 'main' into add/draft-for-collection-and-folder-2
pooja-bruno Jan 20, 2025
41acf1e
rm: console
pooja-bruno Jan 23, 2025
4871c31
remove character limit for names
lohxt1 Jan 24, 2025
5507c14
merging parts of the pr 3740 that add draft feature for folders/colle…
lohxt1 Jan 25, 2025
8a7f3f7
updated the logic for folders/requests/misc files render order
lohxt1 Jan 25, 2025
cd337ef
removed file tab from the request pane
lohxt1 Jan 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion package-lock.json

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

1 change: 1 addition & 0 deletions packages/bruno-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"react-dnd": "^16.0.1",
"react-dnd-html5-backend": "^16.0.1",
"react-dom": "19.0.0",
"react-file-icon": "^1.5.0",
"react-hot-toast": "^2.4.0",
"react-i18next": "^15.0.1",
"react-inspector": "^6.0.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/bruno-app/src/components/Bruno/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';

const Bruno = ({ width }) => {
const Bruno = ({ width, className }) => {
return (
<svg id="emoji" width={width} viewBox="0 0 72 72" xmlns="http://www.w3.org/2000/svg">
<svg id="emoji" width={width} className={className} viewBox="0 0 72 72" xmlns="http://www.w3.org/2000/svg">
<g id="color">
<path
fill="#F4AA41"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const ApiKeyAuth = ({ collection }) => {
const dropdownTippyRef = useRef();
const onDropdownCreate = (ref) => (dropdownTippyRef.current = ref);

const apikeyAuth = get(collection, 'root.request.auth.apikey', {});
const apikeyAuth = collection.draft ? get(collection, 'draft.request.auth.apikey', {}) : get(collection, 'root.request.auth.apikey', {});

const handleSave = () => dispatch(saveCollectionRoot(collection.uid));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const AuthMode = ({ collection }) => {
const dispatch = useDispatch();
const dropdownTippyRef = useRef();
const onDropdownCreate = (ref) => (dropdownTippyRef.current = ref);
const authMode = get(collection, 'root.request.auth.mode');
const authMode = collection.draft ? get(collection, 'draft.request.auth.mode') : get(collection, 'root.request.auth.mode');

const Icon = forwardRef((props, ref) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const AwsV4Auth = ({ collection }) => {
const dispatch = useDispatch();
const { storedTheme } = useTheme();

const awsv4Auth = get(collection, 'root.request.auth.awsv4', {});
const awsv4Auth = collection.draft ? get(collection, 'draft.request.auth.awsv4', {}) : get(collection, 'root.request.auth.awsv4', {});

const handleSave = () => dispatch(saveCollectionRoot(collection.uid));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const BasicAuth = ({ collection }) => {
const dispatch = useDispatch();
const { storedTheme } = useTheme();

const basicAuth = get(collection, 'root.request.auth.basic', {});
const basicAuth = collection.draft ? get(collection, 'draft.request.auth.basic', {}) : get(collection, 'root.request.auth.basic', {});

const handleSave = () => dispatch(saveCollectionRoot(collection.uid));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const BearerAuth = ({ collection }) => {
const dispatch = useDispatch();
const { storedTheme } = useTheme();

const bearerToken = get(collection, 'root.request.auth.bearer.token', '');
const bearerToken = collection.draft ? get(collection, 'draft.request.auth.bearer.token', '') : get(collection, 'root.request.auth.bearer.token', '');

const handleSave = () => dispatch(saveCollectionRoot(collection.uid));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const DigestAuth = ({ collection }) => {
const dispatch = useDispatch();
const { storedTheme } = useTheme();

const digestAuth = get(collection, 'root.request.auth.digest', {});
const digestAuth = collection.draft ? get(collection, 'draft.request.auth.digest', {}) : get(collection, 'root.request.auth.digest', {});

const handleSave = () => dispatch(saveCollectionRoot(collection.uid));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const OAuth2AuthorizationCode = ({ collection }) => {
const dispatch = useDispatch();
const { storedTheme } = useTheme();

const oAuth = get(collection, 'root.request.auth.oauth2', {});
const oAuth = collection.draft ? get(collection, 'draft.request.auth.oauth2', {}) : get(collection, 'root.request.auth.oauth2', {});

const handleRun = async () => {
dispatch(sendCollectionOauth2Request(collection.uid));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const OAuth2ClientCredentials = ({ collection }) => {
const dispatch = useDispatch();
const { storedTheme } = useTheme();

const oAuth = get(collection, 'root.request.auth.oauth2', {});
const oAuth = collection.draft ? get(collection, 'draft.request.auth.oauth2', {}) : get(collection, 'root.request.auth.oauth2', {});

const handleRun = async () => {
dispatch(sendCollectionOauth2Request(collection.uid));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const GrantTypeSelector = ({ collection }) => {
const dropdownTippyRef = useRef();
const onDropdownCreate = (ref) => (dropdownTippyRef.current = ref);

const oAuth = get(collection, 'root.request.auth.oauth2', {});
const oAuth = collection.draft ? get(collection, "draft.request.auth.oauth2", {}) : get(collection, 'root.request.auth.oauth2', {});

const Icon = forwardRef((props, ref) => {
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const OAuth2AuthorizationCode = ({ item, collection }) => {
const dispatch = useDispatch();
const { storedTheme } = useTheme();

const oAuth = get(collection, 'root.request.auth.oauth2', {});
const oAuth = collection.draft ? get(collection, 'draft.request.auth.oauth2', {}) : get(collection, 'root.request.auth.oauth2', {});

const handleRun = async () => {
dispatch(sendCollectionOauth2Request(collection.uid));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const grantTypeComponentMap = (grantType, collection) => {
};

const OAuth2 = ({ collection }) => {
const oAuth = get(collection, 'root.request.auth.oauth2', {});
const oAuth = collection.draft ? get(collection, 'draft.request.auth.oauth2', {}) : get(collection, 'root.request.auth.oauth2', {});

return (
<StyledWrapper className="mt-2 w-full">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const WsseAuth = ({ collection }) => {
const dispatch = useDispatch();
const { storedTheme } = useTheme();

const wsseAuth = get(collection, 'root.request.auth.wsse', {});
const wsseAuth = collection.draft ? get(collection, 'draft.request.auth.wsse', {}) : get(collection, 'root.request.auth.wsse', {});

const handleSave = () => dispatch(saveCollectionRoot(collection.uid));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import NTLMAuth from './NTLMAuth';


const Auth = ({ collection }) => {
const authMode = get(collection, 'root.request.auth.mode');
const authMode = collection.draft ? get(collection, 'draft.request.auth.mode') : get(collection, 'root.request.auth.mode');
const dispatch = useDispatch();

const handleSave = () => dispatch(saveCollectionRoot(collection.uid));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ const Docs = ({ collection }) => {
const dispatch = useDispatch();
const { displayedTheme } = useTheme();
const [isEditing, setIsEditing] = useState(false);
const docs = get(collection, 'root.docs', '');
const docs = collection.draft ? get(collection, 'draft.docs', '') : get(collection, 'root.docs', '');
const preferences = useSelector((state) => state.app.preferences);
const { theme, storedTheme } = useTheme();

const toggleViewMode = () => {
setIsEditing((prev) => !prev);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const headerAutoCompleteList = StandardHTTPHeaders.map((e) => e.header);
const Headers = ({ collection }) => {
const dispatch = useDispatch();
const { storedTheme } = useTheme();
const headers = get(collection, 'root.request.headers', []);
const headers = collection.draft ? get(collection, 'draft.request.headers', []) : get(collection, 'root.request.headers', []);

const addHeader = () => {
dispatch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import StyledWrapper from './StyledWrapper';

const Script = ({ collection }) => {
const dispatch = useDispatch();
const requestScript = get(collection, 'root.request.script.req', '');
const responseScript = get(collection, 'root.request.script.res', '');
const requestScript = collection.draft ? get(collection, 'draft.request.script.req', '') : get(collection, 'root.request.script.req', '');
const responseScript = collection.draft ? get(collection, 'draft.request.script.res', '') : get(collection, 'root.request.script.res', '');

const { displayedTheme } = useTheme();
const preferences = useSelector((state) => state.app.preferences);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import StyledWrapper from './StyledWrapper';

const Tests = ({ collection }) => {
const dispatch = useDispatch();
const tests = get(collection, 'root.request.tests', '');
const tests = collection.draft ? get(collection, 'draft.request.tests', '') : get(collection, 'root.request.tests', '');

const { displayedTheme } = useTheme();
const preferences = useSelector((state) => state.app.preferences);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { useDispatch } from 'react-redux';

const Vars = ({ collection }) => {
const dispatch = useDispatch();
const requestVars = get(collection, 'root.request.vars.req', []);
const responseVars = get(collection, 'root.request.vars.res', []);
const requestVars = collection.draft ? get(collection, 'draft.request.vars.req', []) : get(collection, 'root.request.vars.req', []);
const responseVars = collection.draft ? get(collection, 'draft.request.vars.res', []) : get(collection, 'root.request.vars.res', []);
const handleSave = () => dispatch(saveCollectionRoot(collection.uid));
return (
<StyledWrapper className="w-full flex flex-col">
Expand Down
10 changes: 5 additions & 5 deletions packages/bruno-app/src/components/CollectionSettings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ const CollectionSettings = ({ collection }) => {
const hasTests = root?.request?.tests;
const hasDocs = root?.docs;

const headers = get(collection, 'root.request.headers', []);
const headers = collection.draft ? get(collection, 'draft.request.headers', []) : get(collection, 'root.request.headers', []);
const activeHeadersCount = headers.filter((header) => header.enabled).length;

const requestVars = get(collection, 'root.request.vars.req', []);
const responseVars = get(collection, 'root.request.vars.res', []);
const requestVars = collection.draft ? get(collection, 'draft.request.vars.req', []) : get(collection, 'root.request.vars.req', []);
const responseVars = collection.draft ? get(collection, 'draft.request.vars.res', []) : get(collection, 'root.request.vars.res', []);
const activeVarsCount = requestVars.filter((v) => v.enabled).length + responseVars.filter((v) => v.enabled).length;
const auth = get(collection, 'root.request.auth', {}).mode;
const auth = collection.draft ? get(collection, 'draft.request.auth', {}).mode : get(collection, 'root.request.auth', {}).mode;

const proxyConfig = get(collection, 'brunoConfig.proxy', {});
const clientCertConfig = get(collection, 'brunoConfig.clientCertificates.certs', []);
Expand Down Expand Up @@ -142,7 +142,7 @@ const CollectionSettings = ({ collection }) => {
active: tabName === tab
});
};

return (
<StyledWrapper className="flex flex-col h-full relative px-4 py-4">
<div className="flex flex-wrap items-center tabs" role="tablist">
Expand Down
2 changes: 1 addition & 1 deletion packages/bruno-app/src/components/Documentation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Documentation = ({ item, collection }) => {

return (
<StyledWrapper className="flex flex-col gap-y-1 h-full w-full relative">
<div className="editing-mode" role="tab" onClick={toggleViewMode}>
<div className="editing-mode mb-2 flex justify-between items-center" role="tab" onClick={toggleViewMode}>
{isEditing ? 'Preview' : 'Edit'}
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const CopyEnvironment = ({ collection, environment, onClose }) => {
validationSchema: Yup.object({
name: Yup.string()
.min(1, 'must be at least 1 character')
.max(50, 'must be 50 characters or less')
.required('name is required')
}),
onSubmit: (values) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ const CreateEnvironment = ({ collection, onClose }) => {
validationSchema: Yup.object({
name: Yup.string()
.min(1, 'Must be at least 1 character')
.max(50, 'Must be 50 characters or less')
.required('Name is required')
.test('duplicate-name', 'Environment already exists', validateEnvironmentName)
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const RenameEnvironment = ({ onClose, environment, collection }) => {
validationSchema: Yup.object({
name: Yup.string()
.min(1, 'must be at least 1 character')
.max(50, 'must be 50 characters or less')
.required('name is required')
}),
onSubmit: (values) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import styled from 'styled-components';

const StyledWrapper = styled.div`
div.CodeMirror {
height: 100%;
background: ${(props) => props.theme.codemirror.bg};
border: solid 1px ${(props) => props.theme.codemirror.border};
font-family: ${(props) => (props.font ? props.font : 'default')};
font-size: ${(props) => (props.fontSize ? `${props.fontSize}px` : 'inherit')};
line-break: anywhere;
flex: 1 1 0;
}

/* Removes the glow outline around the folded json */
.CodeMirror-foldmarker {
text-shadow: none;
color: ${(props) => props.theme.textLink};
background: none;
padding: 0;
margin: 0;
}

.CodeMirror-overlayscroll-horizontal div,
.CodeMirror-overlayscroll-vertical div {
background: #d2d7db;
}

.CodeMirror-dialog {
overflow: visible;
input {
background: transparent;
border: 1px solid #d3d6db;
outline: none;
border-radius: 0px;
}
}

#search-results-count {
display: inline-block;
position: absolute;
top: calc(100% + 1px);
right: 0;
border-width: 0 0 1px 1px;
border-style: solid;
border-color: ${(props) => props.theme.codemirror.border};
padding: 0.1em 0.8em;
background-color: ${(props) => props.theme.codemirror.bg};
color: rgb(102, 102, 102);
white-space: nowrap;
}

textarea.cm-editor {
position: relative;
}

// Todo: dark mode temporary fix
// Clean this
.CodeMirror.cm-s-monokai {
.CodeMirror-overlayscroll-horizontal div,
.CodeMirror-overlayscroll-vertical div {
background: #444444;
}
}

.cm-s-monokai span.cm-property,
.cm-s-monokai span.cm-attribute {
color: #9cdcfe !important;
}

.cm-s-monokai span.cm-string {
color: #ce9178 !important;
}

.cm-s-monokai span.cm-number {
color: #b5cea8 !important;
}

.cm-s-monokai span.cm-atom {
color: #569cd6 !important;
}

.cm-variable-valid {
color: green;
}
.cm-variable-invalid {
color: red;
}

.CodeMirror-search-hint {
display: inline;
}

.cm-s-default span.cm-property {
color: #1f61a0 !important;
}

.cm-s-default span.cm-variable {
color: #397d13 !important;
}
`;

export default StyledWrapper;
Loading