Components/Cockpit: add a not ready component
Add a component to display when the osbuild-composer socket is not running. We could potentially try start the socket in the future when clicking the button, rather than re-directing to the cockpit services plugin.
This commit is contained in:
parent
9e4cd302b5
commit
abca3ac760
1 changed files with 47 additions and 0 deletions
47
src/Components/Cockpit/NotReady.tsx
Normal file
47
src/Components/Cockpit/NotReady.tsx
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
import React from 'react';
|
||||
|
||||
import {
|
||||
Button,
|
||||
EmptyState,
|
||||
EmptyStateActions,
|
||||
EmptyStateBody,
|
||||
EmptyStateFooter,
|
||||
EmptyStateIcon,
|
||||
EmptyStateVariant,
|
||||
Title,
|
||||
} from '@patternfly/react-core';
|
||||
import { CubesIcon } from '@patternfly/react-icons';
|
||||
import cockpit from 'cockpit';
|
||||
|
||||
export const NotReady = ({ enabled }: { enabled: boolean }) => {
|
||||
return (
|
||||
<EmptyState variant={EmptyStateVariant.xl}>
|
||||
<EmptyStateIcon icon={CubesIcon} />
|
||||
<Title headingLevel="h4" size="lg">
|
||||
OSBuild Composer is not {enabled ? 'started' : 'enabled'}
|
||||
</Title>
|
||||
<EmptyStateBody />
|
||||
<EmptyStateFooter>
|
||||
<EmptyStateActions>
|
||||
<Button
|
||||
variant="primary"
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
cockpit
|
||||
.spawn(
|
||||
['systemctl', 'enable', '--now', 'osbuild-composer.socket'],
|
||||
{
|
||||
superuser: 'require',
|
||||
err: 'message',
|
||||
}
|
||||
)
|
||||
.then(() => window.location.reload());
|
||||
}}
|
||||
>
|
||||
Start socket
|
||||
</Button>
|
||||
</EmptyStateActions>
|
||||
</EmptyStateFooter>
|
||||
</EmptyState>
|
||||
);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue