@@ -680,246 +309,24 @@ const GrpcQueryUrl = ({ item, collection, handleRun }) => {
item={item}
/>
- {grpcMethods && grpcMethods.length > 0 && (
-
-
-
}
- placement="bottom-end"
- visible={showProtoDropdown}
- onClickOutside={() => setShowProtoDropdown(false)}
- >
-
-
-
{isReflectionMode ? "Using Reflection" : "Select Proto File"}
-
-
- {/* Mode Toggle */}
-
-
-
Mode
-
-
- Proto File
-
- {
- e.stopPropagation();
- e.preventDefault();
- setIsReflectionMode(!isReflectionMode);
- if (!isReflectionMode) {
- // Switching to reflection mode
- setProtoFilePath('');
- dispatch(updateRequestProtoPath({
- protoPath: '',
- itemUid: item.uid,
- collectionUid: collection.uid
- }));
- if (url) {
- handleReflection(url);
- }
- } else {
- // Switching to proto file mode
- setGrpcMethods([]);
- setSelectedGrpcMethod(null);
- onMethodSelect({ path: '', type: '' });
- }
- }}
- size="2xs"
- />
-
- Reflection
-
-
-
-
-
- {!isReflectionMode && (
- <>
- {collectionProtoFiles && collectionProtoFiles.length > 0 && (
-
-
-
From Collection Settings
-
-
-
- {invalidProtoFiles.length > 0 && (
-
-
-
- Some proto files could not be found.
-
-
- )}
-
-
- {collectionProtoFilesExistence.map((protoFile, index) => {
- const isSelected = protoFilePath === protoFile.absolutePath;
- const isInvalid = !protoFile.exists;
-
- return (
-
{
- if (!isInvalid) {
- setShowProtoDropdown(false);
- handleSelectCollectionProtoFile(protoFile);
- }
- }}
- >
-
-
-
-
-
- {getBasename(protoFile.absolutePath)}
- {isInvalid && (
-
-
-
- )}
-
-
{protoFile.path}
-
-
-
-
- );
- })}
-
-
- )}
-
- {collectionProtoFiles && collectionProtoFiles.length > 0 && (
-
- )}
-
- {protoFilePath && !collectionProtoFilesExistence.some(pf =>
- pf.absolutePath === protoFilePath
- ) && (
-
-
Current Proto File
- {!currentProtoFileExists && (
-
-
-
- Selected proto file not found. Please select a valid proto file from collection settings or browse for a new one.
-
-
- )}
-
-
-
-
-
-
- {getBasename(protoFilePath)}
- {!currentProtoFileExists && (
-
-
-
- )}
-
-
{protoFilePath}
-
-
-
-
-
-
-
-
-
- )}
-
-
-
-
- >
- )}
-
- {isReflectionMode && (
-
-
- Using server reflection to discover gRPC methods.
-
-
- )}
-
-
-
+
{
if (isReflectionMode) {
handleReflection(url, true);
} else if (protoFilePath) {
- loadMethodsFromProtoFile(protoFilePath, true);
+ handleProtoFileLoad(protoFilePath, true);
} else {
toast.error('No proto file selected');
}
@@ -938,7 +345,7 @@ const GrpcQueryUrl = ({ item, collection, handleRun }) => {
color={theme.requestTabs.icon.color}
strokeWidth={1.5}
size={22}
- className={`${isLoadingMethods ? 'animate-spin' : 'cursor-pointer'}`}
+ className={`${(isReflectionMode ? reflectionManagement.isLoadingMethods : protoFileManagement.isLoadingMethods) ? 'animate-spin' : 'cursor-pointer'}`}
/>
{isReflectionMode ? 'Refresh server reflection' : 'Refresh proto file methods'}
diff --git a/packages/bruno-app/src/components/ToggleSwitch/StyledWrapper.js b/packages/bruno-app/src/components/ToggleSwitch/StyledWrapper.js
index d4216860a..cf6bb9e92 100644
--- a/packages/bruno-app/src/components/ToggleSwitch/StyledWrapper.js
+++ b/packages/bruno-app/src/components/ToggleSwitch/StyledWrapper.js
@@ -26,7 +26,7 @@ export const Checkbox = styled.input`
height: 0;
&:checked + label div {
- background-color: ${(props) => props.theme.textLink};
+ background-color: ${(props) => props.activeColor || props.theme.textLink};
}
&:checked + label div:before {
diff --git a/packages/bruno-app/src/components/ToggleSwitch/index.js b/packages/bruno-app/src/components/ToggleSwitch/index.js
index bb3679038..299d77582 100644
--- a/packages/bruno-app/src/components/ToggleSwitch/index.js
+++ b/packages/bruno-app/src/components/ToggleSwitch/index.js
@@ -1,9 +1,9 @@
import { Checkbox, Inner, Label, Switch, SwitchButton } from './StyledWrapper';
-const ToggleSwitch = ({ isOn, handleToggle, size = 'm', ...props }) => {
+const ToggleSwitch = ({ isOn, handleToggle, size = 'm', activeColor, ...props }) => {
return (
- {}} />
+ {}} />