mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-16 22:50:10 +03:00
parent
4c9df57a68
commit
3e0fa19c40
@ -49,6 +49,8 @@ const Content = ({
|
||||
renderContent: RenderContent,
|
||||
hidden,
|
||||
addBorder = false,
|
||||
setTab,
|
||||
logTabId,
|
||||
}) => (
|
||||
<TabContent
|
||||
key={`tab-${id ?? name}`}
|
||||
@ -59,7 +61,7 @@ const Content = ({
|
||||
<Fade in timeout={400}>
|
||||
<TabContent sx={{ p: '1em .5em' }}>
|
||||
{typeof RenderContent === 'function' ? (
|
||||
<RenderContent />
|
||||
<RenderContent setTab={setTab} logTabId={logTabId} />
|
||||
) : (
|
||||
RenderContent
|
||||
)}
|
||||
@ -129,6 +131,12 @@ const Tabs = ({
|
||||
[tabSelected]
|
||||
)
|
||||
|
||||
const logTabId = tabs
|
||||
.map(function (tabProps) {
|
||||
return tabProps.name
|
||||
})
|
||||
.indexOf('log')
|
||||
|
||||
return (
|
||||
<Stack height={1} overflow="auto">
|
||||
<Fade in timeout={300}>
|
||||
@ -139,7 +147,9 @@ const Tabs = ({
|
||||
) : (
|
||||
<Content
|
||||
addBorder={addBorder}
|
||||
setTab={setTab}
|
||||
{...tabs.find(({ value }, idx) => (value ?? idx) === tabSelected)}
|
||||
logTabId={logTabId}
|
||||
/>
|
||||
)}
|
||||
</Stack>
|
||||
@ -162,6 +172,8 @@ Content.propTypes = {
|
||||
renderContent: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
|
||||
hidden: PropTypes.bool,
|
||||
addBorder: PropTypes.bool,
|
||||
setTab: PropTypes.func,
|
||||
logTabId: PropTypes.number,
|
||||
}
|
||||
|
||||
export default Tabs
|
||||
|
@ -38,7 +38,7 @@ import { SubmitButton } from 'client/components/FormControl'
|
||||
import { Translate } from 'client/components/HOC'
|
||||
import { T } from 'client/constants'
|
||||
|
||||
const Hosts = memo(({ id }) => {
|
||||
const Hosts = memo(({ id, setTab, logTabId }) => {
|
||||
const [amount, setAmount] = useState(() => 1)
|
||||
const { enqueueInfo } = useGeneralApi()
|
||||
|
||||
@ -113,6 +113,7 @@ const Hosts = memo(({ id }) => {
|
||||
onClick={async () => {
|
||||
configureHost({ provision: id, id: host.ID })
|
||||
enqueueInfo(`Configuring host - ID: ${host.ID}`)
|
||||
setTab(logTabId)
|
||||
}}
|
||||
/>
|
||||
<SubmitButton
|
||||
@ -137,7 +138,11 @@ const Hosts = memo(({ id }) => {
|
||||
)
|
||||
})
|
||||
|
||||
Hosts.propTypes = { id: PropTypes.string.isRequired }
|
||||
Hosts.propTypes = {
|
||||
id: PropTypes.string.isRequired,
|
||||
setTab: PropTypes.func,
|
||||
logTabId: PropTypes.number,
|
||||
}
|
||||
Hosts.displayName = 'Hosts'
|
||||
|
||||
export default Hosts
|
||||
|
@ -63,7 +63,9 @@ const DialogInfo = ({ id }) => {
|
||||
name: 'hosts',
|
||||
label: T.Hosts,
|
||||
icon: HostIcon,
|
||||
renderContent: () => <HostsTab id={id} />,
|
||||
renderContent: ({ setTab, logTabId }) => (
|
||||
<HostsTab id={id} setTab={setTab} logTabId={logTabId} />
|
||||
),
|
||||
},
|
||||
{
|
||||
name: 'log',
|
||||
|
Loading…
x
Reference in New Issue
Block a user