Revert "Fleet UI: New manage query automations modal (#12747)"
This reverts commit e13644d664.
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
import { Meta, StoryObj } from "@storybook/react";
|
||||
|
||||
import QueryFrequencyIndicator from "./QueryFrequencyIndicator";
|
||||
|
||||
const meta: Meta<typeof QueryFrequencyIndicator> = {
|
||||
title: "Components/QueryFrequencyIndicator",
|
||||
component: QueryFrequencyIndicator,
|
||||
args: {
|
||||
frequency: 300,
|
||||
checked: true,
|
||||
},
|
||||
};
|
||||
|
||||
export default meta;
|
||||
|
||||
type Story = StoryObj<typeof QueryFrequencyIndicator>;
|
||||
|
||||
export const Basic: Story = {};
|
||||
@@ -1,73 +0,0 @@
|
||||
import React from "react";
|
||||
import classnames from "classnames";
|
||||
import Icon from "components/Icon/Icon";
|
||||
import { DEFAULT_EMPTY_CELL_VALUE } from "utilities/constants";
|
||||
|
||||
interface IStatusIndicatorProps {
|
||||
frequency: number;
|
||||
checked: boolean;
|
||||
}
|
||||
|
||||
const generateClassTag = (rawValue: string): string => {
|
||||
if (rawValue === DEFAULT_EMPTY_CELL_VALUE) {
|
||||
return "indeterminate";
|
||||
}
|
||||
return rawValue.replace(" ", "-").toLowerCase();
|
||||
};
|
||||
|
||||
const QueryFrequencyIndicator = ({
|
||||
frequency,
|
||||
checked,
|
||||
}: IStatusIndicatorProps): JSX.Element => {
|
||||
const classTag = generateClassTag(frequency.toString());
|
||||
const frequencyClassName = classnames(
|
||||
"query-frequency-indicator",
|
||||
`query-frequency-indicator--${classTag}`,
|
||||
`frequency--${classTag}`
|
||||
);
|
||||
const readableQueryFrequency = () => {
|
||||
switch (frequency) {
|
||||
case 0:
|
||||
return "Never";
|
||||
case 300:
|
||||
case 600:
|
||||
case 900:
|
||||
case 1800: // 5, 10, 15, 30 minutes
|
||||
return `${(frequency / 60).toString()} minutes`;
|
||||
case 3600:
|
||||
return "Hourly";
|
||||
case 21600:
|
||||
case 43200: // 6, 12 hours
|
||||
return `${(frequency / 3600).toString()} hours`;
|
||||
case 86400:
|
||||
return "Daily";
|
||||
case 604800:
|
||||
return "Weekly";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
};
|
||||
|
||||
const frequencyIcon = () => {
|
||||
if (frequency === 0) {
|
||||
return checked ? (
|
||||
<Icon size="small" name="warning" />
|
||||
) : (
|
||||
<Icon size="small" name="clock" color="ui-fleet-black-33" />
|
||||
);
|
||||
}
|
||||
return <Icon size="small" name="clock" />;
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`${frequencyClassName}
|
||||
${frequency === 0 && !checked && "grey"}`}
|
||||
>
|
||||
{frequencyIcon()}
|
||||
{readableQueryFrequency()}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default QueryFrequencyIndicator;
|
||||
@@ -1,14 +0,0 @@
|
||||
.query-frequency-indicator {
|
||||
width: 100px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 8px 12px;
|
||||
|
||||
.icon {
|
||||
padding-right: $pad-small;
|
||||
}
|
||||
}
|
||||
|
||||
.grey {
|
||||
color: $ui-fleet-black-33;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export { default } from "./QueryFrequencyIndicator";
|
||||
Reference in New Issue
Block a user