Skip to content

Commit a5d9300

Browse files
committed
Revert "fix: prevent environment creation in readonly collections"
This reverts commit c697bbf.
1 parent c697bbf commit a5d9300

2 files changed

Lines changed: 24 additions & 39 deletions

File tree

  • packages/bruno-app/src/components/Environments/EnvironmentSettings

packages/bruno-app/src/components/Environments/EnvironmentSettings/EnvironmentList/index.js

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const EnvironmentList = ({ selectedEnvironment, setSelectedEnvironment, collecti
1616
const [openCreateModal, setOpenCreateModal] = useState(false);
1717
const [openImportModal, setOpenImportModal] = useState(false);
1818
const [openManageSecretsModal, setOpenManageSecretsModal] = useState(false);
19-
const isReadOnly = collection.brunoConfig?.readOnly || collection.readOnly;
2019

2120
const [switchEnvConfirmClose, setSwitchEnvConfirmClose] = useState(false);
2221
const [originalEnvironmentVariables, setOriginalEnvironmentVariables] = useState([]);
@@ -121,20 +120,16 @@ const EnvironmentList = ({ selectedEnvironment, setSelectedEnvironment, collecti
121120
</div>
122121
</ToolHint>
123122
))}
124-
{!isReadOnly && (
125-
<div className="btn-create-environment" onClick={() => handleCreateEnvClick()}>
126-
+ <span>Create</span>
127-
</div>
128-
)}
123+
<div className="btn-create-environment" onClick={() => handleCreateEnvClick()}>
124+
+ <span>Create</span>
125+
</div>
129126

130127
<div className="mt-auto btn-import-environment">
131-
{!isReadOnly && (
132-
<div className="flex items-center" onClick={() => handleImportClick()}>
133-
<IconDownload size={12} strokeWidth={2} />
134-
<span className="label ml-1 text-xs">Import</span>
135-
</div>
136-
)}
137-
<div className={`flex items-center ${!isReadOnly ? 'mt-2' : ''}`} onClick={() => handleSecretsClick()}>
128+
<div className="flex items-center" onClick={() => handleImportClick()}>
129+
<IconDownload size={12} strokeWidth={2} />
130+
<span className="label ml-1 text-xs">Import</span>
131+
</div>
132+
<div className="flex items-center mt-2" onClick={() => handleSecretsClick()}>
138133
<IconShieldLock size={12} strokeWidth={2} />
139134
<span className="label ml-1 text-xs">Managing Secrets</span>
140135
</div>

packages/bruno-app/src/components/Environments/EnvironmentSettings/index.js

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,25 @@ export const SharedButton = ({ children, className, onClick }) => {
1919
);
2020
};
2121

22-
const DefaultTab = ({ setTab, isReadOnly }) => {
22+
const DefaultTab = ({ setTab }) => {
2323
return (
2424
<div className="text-center items-center flex flex-col">
2525
<IconFileAlert size={64} strokeWidth={1} />
2626
<span className="font-semibold mt-2">No environments found</span>
27-
{isReadOnly ? (
28-
<span className="font-extralight mt-2 text-zinc-500 dark:text-zinc-400">
29-
This collection is read-only. Environments cannot be created or modified.
30-
</span>
31-
) : (
32-
<>
33-
<span className="font-extralight mt-2 text-zinc-500 dark:text-zinc-400">
34-
Get started by using the following buttons :
35-
</span>
36-
<div className="flex items-center justify-center mt-6">
37-
<SharedButton onClick={() => setTab('create')}>
38-
<span>Create Environment</span>
39-
</SharedButton>
27+
<span className="font-extralight mt-2 text-zinc-500 dark:text-zinc-400">
28+
Get started by using the following buttons :
29+
</span>
30+
<div className="flex items-center justify-center mt-6">
31+
<SharedButton onClick={() => setTab('create')}>
32+
<span>Create Environment</span>
33+
</SharedButton>
4034

41-
<span className="mx-4">Or</span>
35+
<span className="mx-4">Or</span>
4236

43-
<SharedButton onClick={() => setTab('import')}>
44-
<span>Import Environment</span>
45-
</SharedButton>
46-
</div>
47-
</>
48-
)}
37+
<SharedButton onClick={() => setTab('import')}>
38+
<span>Import Environment</span>
39+
</SharedButton>
40+
</div>
4941
</div>
5042
);
5143
};
@@ -55,18 +47,16 @@ const EnvironmentSettings = ({ collection, onClose }) => {
5547
const { environments } = collection;
5648
const [selectedEnvironment, setSelectedEnvironment] = useState(null);
5749
const [tab, setTab] = useState('default');
58-
const isReadOnly = collection.brunoConfig?.readOnly || collection.readOnly;
59-
6050
if (!environments || !environments.length) {
6151
return (
6252
<StyledWrapper>
6353
<Modal size="md" title="Environments" handleCancel={onClose} hideCancel={true} hideFooter={true}>
64-
{tab === 'create' && !isReadOnly ? (
54+
{tab === 'create' ? (
6555
<CreateEnvironment collection={collection} onClose={() => setTab('default')} />
66-
) : tab === 'import' && !isReadOnly ? (
56+
) : tab === 'import' ? (
6757
<ImportEnvironment collection={collection} onClose={() => setTab('default')} />
6858
) : (
69-
<DefaultTab setTab={setTab} isReadOnly={isReadOnly} />
59+
<DefaultTab setTab={setTab} />
7060
)}
7161
</Modal>
7262
</StyledWrapper>

0 commit comments

Comments
 (0)