mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-08 06:28:33 +00:00
45 lines
1.4 KiB
JavaScript
45 lines
1.4 KiB
JavaScript
import Modal from 'components/Modal/index';
|
|
import React, { useState } from 'react';
|
|
import CreateEnvironment from './CreateEnvironment';
|
|
import EnvironmentList from './EnvironmentList';
|
|
import StyledWrapper from './StyledWrapper';
|
|
|
|
const EnvironmentSettings = ({ collection, onClose }) => {
|
|
const { environments } = collection;
|
|
const [openCreateModal, setOpenCreateModal] = useState(false);
|
|
|
|
if (!environments || !environments.length) {
|
|
return (
|
|
<StyledWrapper>
|
|
<Modal
|
|
size="md"
|
|
title="Environments"
|
|
confirmText={'Close'}
|
|
handleConfirm={onClose}
|
|
handleCancel={onClose}
|
|
hideCancel={true}
|
|
>
|
|
{openCreateModal && <CreateEnvironment collection={collection} onClose={() => setOpenCreateModal(false)} />}
|
|
<div className="text-center">
|
|
<p>No environments found!</p>
|
|
<button
|
|
className="btn-create-environment text-link pr-2 py-3 mt-2 select-none"
|
|
onClick={() => setOpenCreateModal(true)}
|
|
>
|
|
+ <span>Create Environment</span>
|
|
</button>
|
|
</div>
|
|
</Modal>
|
|
</StyledWrapper>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Modal size="lg" title="Environments" handleCancel={onClose} hideFooter={true}>
|
|
<EnvironmentList collection={collection} />
|
|
</Modal>
|
|
);
|
|
};
|
|
|
|
export default EnvironmentSettings;
|