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

[Feature] DRC-1001 Hiden diff actions when signel env mode #564

Merged
Show file tree
Hide file tree
Changes from all 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
20 changes: 17 additions & 3 deletions js/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import { tooltipTheme } from "@theme/components/Tooltip";
import { trackInit } from "@/lib/api/track";
import { Filename } from "@/components/app/Filename";
import { StateSynchronizer } from "@/components/app/StateSynchronizer";
import { useRecceServerFlag } from "@/lib/hooks/useRecceServerFlag";

const RouteAlwaysMount = ({
children,
Expand Down Expand Up @@ -206,6 +207,7 @@ interface TabProps {
name: string;
href: string;
badge?: ReactNode;
disable?: boolean;
}

function TabBadge<T, R extends number>({
Expand Down Expand Up @@ -251,6 +253,7 @@ function NavBar() {
const { isDemoSite, reviewMode, fileMode, cloudMode, isLoading } =
useLineageGraphContext();
const [location, setLocation] = useLocation();
const { data: flag, isLoading: isFlagLoading } = useRecceServerFlag();

const checklistBadge = (
<TabBadge<Check[], number>
Expand All @@ -264,8 +267,17 @@ function NavBar() {

const tabs: TabProps[] = [
{ name: "Lineage", href: "/lineage" },
{ name: "Query", href: "/query" },
{ name: "Checklist", href: "/checks", badge: checklistBadge },
{
name: "Query",
href: "/query",
disable: flag?.single_env_onboarding === true,
},
{
name: "Checklist",
href: "/checks",
badge: checklistBadge,
disable: flag?.single_env_onboarding === true,
},
];

const tabIndex = _.findIndex(tabs, ({ href }) => location.startsWith(href));
Expand All @@ -274,13 +286,15 @@ function NavBar() {
<Tabs index={tabIndex}>
<TabList>
<Box flex="1" display="flex">
{tabs.map(({ name, href, badge }) => {
{tabs.map(({ name, href, badge, disable }) => {
return (
<Tab
key={name}
onClick={() => {
setLocation(href);
}}
isDisabled={isLoading || isFlagLoading || disable}
hidden={disable}
>
{name}
{badge}
Expand Down
163 changes: 85 additions & 78 deletions js/src/components/lineage/LineageViewTopBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ export const LineageViewTopBar = () => {
const selectNodes = useMemo(() => {
return nodes.filter((node) => node.data.isSelected);
}, [nodes]);
const { data: flags } = useRecceServerFlag();
const isSingleEnvOnboarding = flags?.single_env_onboarding;

const isSingleSelect = selectMode === "single" && selectNodes.length === 1;
const isMultiSelect = selectMode === "multi" && selectNodes.length >= 1;
Expand Down Expand Up @@ -405,95 +407,100 @@ export const LineageViewTopBar = () => {
</ControlItem>
</>
)}
<ControlItem label="Explore">
<ButtonGroup isAttached variant="outline">
<Menu placement="bottom-end">
<MenuButton
as={Button}
size={"xs"}
rightIcon={<ChevronDownIcon />}
>
Actions
</MenuButton>

<MenuList>
<MenuGroup title="Diff" m="0" p="4px 12px">
<MenuItem
as={Text}
size="sm"
fontSize="10pt"
isDisabled={
!(isNoSelect || isSingleSelect || isMultiSelect)
}
icon={<Icon as={findByRunType("row_count_diff")?.icon} />}
onClick={() => {
lineageViewContext.runRowCountDiff();
}}
>
Row Count Diff
</MenuItem>
<Tooltip
label={
!isActionAvailable("value_diff")
? DisableTooltipMessages.audit_helper
: null
}
placement="left"
>
{!isSingleEnvOnboarding && (
<ControlItem label="Explore">
<ButtonGroup isAttached variant="outline">
<Menu placement="bottom-end">
<MenuButton
as={Button}
size={"xs"}
rightIcon={<ChevronDownIcon />}
>
Actions
</MenuButton>

<MenuList>
<MenuGroup title="Diff" m="0" p="4px 12px">
<MenuItem
as={Text}
size="sm"
fontSize="10pt"
isDisabled={
!(isNoSelect || isSingleSelect || isMultiSelect) ||
!(isNoSelect || isSingleSelect || isMultiSelect)
}
icon={<Icon as={findByRunType("row_count_diff")?.icon} />}
onClick={() => {
lineageViewContext.runRowCountDiff();
}}
>
Row Count Diff
</MenuItem>
<Tooltip
label={
!isActionAvailable("value_diff")
? DisableTooltipMessages.audit_helper
: null
}
placement="left"
>
<MenuItem
as={Text}
size="sm"
fontSize="10pt"
isDisabled={
!(isNoSelect || isSingleSelect || isMultiSelect) ||
!isActionAvailable("value_diff")
}
icon={<Icon as={findByRunType("value_diff")?.icon} />}
onClick={() => {
lineageViewContext.runValueDiff();
}}
>
Value Diff
</MenuItem>
</Tooltip>
</MenuGroup>
<MenuDivider />
<MenuGroup title="Add to Checklist" m="0" px="12px">
<MenuItem
as={Text}
size="sm"
fontSize="10pt"
isDisabled={
!(
isNoSelect ||
(isMultiSelect && selectNodes.length > 1)
)
}
icon={<Icon as={findByRunType("value_diff")?.icon} />}
icon={<Icon as={findByRunType("lineage_diff")?.icon} />}
onClick={() => {
lineageViewContext.runValueDiff();
lineageViewContext.addLineageDiffCheck(
lineageViewContext.viewOptions.view_mode
);
}}
>
Value Diff
Lineage Diff
</MenuItem>
</Tooltip>
</MenuGroup>
<MenuDivider />
<MenuGroup title="Add to Checklist" m="0" px="12px">
<MenuItem
as={Text}
size="sm"
fontSize="10pt"
isDisabled={
!(isNoSelect || (isMultiSelect && selectNodes.length > 1))
}
icon={<Icon as={findByRunType("lineage_diff")?.icon} />}
onClick={() => {
lineageViewContext.addLineageDiffCheck(
lineageViewContext.viewOptions.view_mode
);
}}
>
Lineage Diff
</MenuItem>
<MenuItem
as={Text}
size="sm"
fontSize="10pt"
isDisabled={
!(isNoSelect || isSingleSelect || isMultiSelect)
}
icon={<Icon as={findByRunType("schema_diff")?.icon} />}
onClick={() => {
lineageViewContext.addSchemaDiffCheck();
}}
>
Schema Diff
</MenuItem>
</MenuGroup>
</MenuList>
</Menu>
</ButtonGroup>
</ControlItem>
<MenuItem
as={Text}
size="sm"
fontSize="10pt"
isDisabled={
!(isNoSelect || isSingleSelect || isMultiSelect)
}
icon={<Icon as={findByRunType("schema_diff")?.icon} />}
onClick={() => {
lineageViewContext.addSchemaDiffCheck();
}}
>
Schema Diff
</MenuItem>
</MenuGroup>
</MenuList>
</Menu>
</ButtonGroup>
</ControlItem>
)}
</HStack>
</HStack>
);
Expand Down
Loading
Loading