Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added readonly status for the cluster. #1364

Merged
merged 5 commits into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ exports[`Connectors ListItem matches snapshot 1`] = `
},
"tagStyles": Object {
"backgroundColor": Object {
"blue": "#e3f2fd",
"gray": "#F1F2F3",
"green": "#D6F5E0",
"red": "#FAD1D1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,10 @@ const ClustersWidget: React.FC<Props> = ({
<tbody>
{chunkItem.data.map((cluster) => (
<tr key={cluster.name}>
<td>{cluster.name}</td>
<td>
{cluster.readOnly && <Tag color="blue">readonly</Tag>}{' '}
{cluster.name}
</td>
<td>{cluster.version}</td>
<td>{cluster.brokerCount}</td>
<td>{cluster.onlinePartitionCount}</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,8 @@ describe('ClustersWidget', () => {
userEvent.click(screen.getByRole('checkbox'));
expect(screen.getAllByRole('row').length).toBe(2);
});

it('when cluster is read-only', () => {
expect(screen.getByText('readonly')).toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const onlineCluster: Cluster = {
topicCount: 3,
bytesInPerSec: 0.000030618196853764715,
bytesOutPerSec: 5.737800890036267075817,
readOnly: false,
};

export const offlineCluster: Cluster = {
Expand All @@ -20,6 +21,7 @@ export const offlineCluster: Cluster = {
topicCount: 2,
bytesInPerSec: 8000.0000067376808542600021,
bytesOutPerSec: 0.8153063567297119490871,
readOnly: true,
};

export const clusters: Cluster[] = [onlineCluster, offlineCluster];
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ exports[`Details when it has readonly flag does not render the Action button a T
},
"tagStyles": Object {
"backgroundColor": Object {
"blue": "#e3f2fd",
"gray": "#F1F2F3",
"green": "#D6F5E0",
"red": "#FAD1D1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import styled from 'styled-components';

interface Props {
color: 'green' | 'gray' | 'yellow' | 'red' | 'white';
className?: string;
color: 'green' | 'gray' | 'yellow' | 'red' | 'white' | 'blue';
}

export const Tag = styled.p<Props>`
Expand Down
7 changes: 7 additions & 0 deletions kafka-ui-react-app/src/theme/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export const Colors = {
yellow: {
'10': '#FFEECC',
},
blue: {
'10': '#e3f2fd',
'20': '#bbdefb',
'30': '#90caf9',
'40': '#64b5f6',
},
};

const theme = {
Expand Down Expand Up @@ -177,6 +183,7 @@ const theme = {
yellow: Colors.yellow[10],
white: Colors.neutral[10],
red: Colors.red[10],
blue: Colors.blue[10],
},
color: Colors.neutral[90],
},
Expand Down