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

DEVPROD-13581 bump @leafygreen-ui/tabs from 11.2.0 to 13.1.1 and refactor tab logic #521

Merged
merged 60 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
e7dcfde
CHORE(NPM) - bump @leafygreen-ui/tabs from 11.2.0 to 13.1.1
dependabot[bot] Nov 25, 2024
280f945
Remove ts-expect-error
khelif96 Nov 27, 2024
c2fbd85
Split out types for patchtab and versiontabs
khelif96 Nov 27, 2024
7fe5575
Remove unused legacy status
khelif96 Nov 27, 2024
ab93392
Revert "Remove unused legacy status"
khelif96 Nov 27, 2024
741833e
Update tests to use new enums
khelif96 Nov 27, 2024
3dcdd14
Remove ts-expect-errors
khelif96 Nov 27, 2024
f1155f0
Fix typing
khelif96 Dec 6, 2024
c13ed40
Ts-expect-error
khelif96 Dec 6, 2024
b00ba6e
Merge branch 'main' into dependabot/npm_and_yarn/leafygreen-ui/tabs-1…
khelif96 Dec 6, 2024
3c564e5
Fix styling
khelif96 Dec 12, 2024
ab5a7d6
Bump snapshots
khelif96 Dec 12, 2024
7e28fa6
Fix slug usage on configure patch routes
khelif96 Dec 16, 2024
e73ff8d
Remove unused util methods
khelif96 Dec 16, 2024
9227cbe
Fix logic in configurePatch hook
khelif96 Dec 16, 2024
cf751dc
Begin adding selectedTabName field
khelif96 Dec 16, 2024
2619c2e
Begin extracting state logic to seperate file
khelif96 Dec 16, 2024
445d7f7
Refactor tab logic to use named tab params
khelif96 Dec 16, 2024
64d7d17
Fix ts errors
khelif96 Dec 16, 2024
0d7fcb0
Remove unused params
khelif96 Dec 16, 2024
dd8a85c
Merge branch 'main' into dependabot/npm_and_yarn/leafygreen-ui/tabs-1…
khelif96 Dec 16, 2024
073c6db
Bump snapshots
khelif96 Dec 16, 2024
e12b0e2
Move tabs over to nested folder
khelif96 Dec 16, 2024
296d1fb
Merge branch 'main' into dependabot/npm_and_yarn/leafygreen-ui/tabs-1…
khelif96 Dec 17, 2024
1720dfe
Move files into VersionTabs and nest according to function
khelif96 Dec 17, 2024
22ca523
Bump types
khelif96 Dec 17, 2024
339a9c8
Remove confusing imports
khelif96 Dec 17, 2024
1f5d45a
Simplify version tab redirection logic
khelif96 Dec 17, 2024
1118a14
snapshots
khelif96 Dec 17, 2024
d0ff343
Rename tasks to Tasks
khelif96 Dec 18, 2024
13d66ac
Delete constants folder
khelif96 Dec 18, 2024
41f41df
Rename downstreamTasks to DownstreamTasks
khelif96 Dec 18, 2024
70d478d
Types
khelif96 Dec 18, 2024
ce8c105
Rename VersionTabs folder to Tabs
khelif96 Dec 18, 2024
ac98355
Code review
khelif96 Dec 18, 2024
d192dbd
handle redirecting to correct tab for configure patch
khelif96 Dec 18, 2024
4633136
Fix eslint error in tabs
khelif96 Dec 18, 2024
54b6ecb
Skip configure query if it won't return anything
khelif96 Dec 18, 2024
d56fce4
snapshots
khelif96 Dec 18, 2024
99cf169
Rename tasks folder to Tasks
khelif96 Dec 18, 2024
56d5cb0
snapshots
khelif96 Dec 18, 2024
4ad1749
Bump snapshots
khelif96 Dec 19, 2024
c103e0c
Bump types
khelif96 Dec 19, 2024
415dfb0
Refactor patch ID validation for improved readability
khelif96 Dec 19, 2024
a01405f
Add ESLint disable comment for exhaustive-deps rule in useConfigurePa…
khelif96 Dec 19, 2024
8d4cb4e
consolidate useEffects
khelif96 Dec 19, 2024
444b3e8
Update handleTabChange to include a second argument
khelif96 Dec 19, 2024
1343c30
snapshots
khelif96 Dec 19, 2024
865ebc5
Move useQueryVariables closer to usage
khelif96 Dec 23, 2024
55673fe
fix import
khelif96 Dec 23, 2024
7f8043b
Rely on versionId prop
khelif96 Dec 23, 2024
087668f
Ensure selected tab is defined
khelif96 Dec 23, 2024
438a40b
Remove default param
khelif96 Dec 23, 2024
41e5cc9
Merge branch 'main' into dependabot/npm_and_yarn/leafygreen-ui/tabs-1…
khelif96 Dec 26, 2024
a59ee2b
Ensure tab is updated when its changed
khelif96 Dec 26, 2024
b5eb04f
Preserve query params when navigating
khelif96 Dec 26, 2024
3907a1f
Bump snapshots
khelif96 Dec 26, 2024
64ab444
snapshots
khelif96 Dec 26, 2024
221bfd1
Disable inconsistent storyshots
khelif96 Dec 27, 2024
cc85600
please work this time
khelif96 Dec 27, 2024
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
2 changes: 1 addition & 1 deletion apps/parsley/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"@leafygreen-ui/segmented-control": "^8.2.13",
"@leafygreen-ui/select": "^12.0.0",
"@leafygreen-ui/side-nav": "^14.1.3",
"@leafygreen-ui/tabs": "^11.1.13",
"@leafygreen-ui/tabs": "^13.1.1",
"@leafygreen-ui/text-input": "^13.0.2",
"@leafygreen-ui/toast": "^6.1.27",
"@leafygreen-ui/toggle": "^10.0.4",
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
data-lgid="lg-select"
>
<button
aria-controls="select-243-menu"
aria-describedby="select-243-description"
aria-controls="select-205-menu"
aria-describedby="select-205-description"
aria-disabled="false"
aria-expanded="false"
aria-invalid="false"
Expand All @@ -17,7 +17,7 @@
data-cy="searchbar-select"
data-lgid="lg-button"
data-testid="leafygreen-ui-select-menubutton"
id="select-244"
id="select-206"
type="button"
value="filter"
>
Expand Down Expand Up @@ -133,14 +133,14 @@
class="leafygreen-ui-1ago99h"
>
<input
aria-describedby="lg-form_field-feedback-247"
aria-describedby="lg-form_field-feedback-209"
aria-disabled="false"
aria-invalid="true"
aria-labelledby="searchbar-input"
autocomplete="on"
class="lg-ui-form-field-input-0000 leafygreen-ui-1ago99h"
data-cy="searchbar-input"
id="lg-form_field-input-248"
id="lg-form_field-input-210"
placeholder="optional, regexp to search"
required=""
spellcheck="false"
Expand All @@ -155,7 +155,7 @@
class="leafygreen-ui-wsgs9n"
data-lgid="lg-form_field-feedback"
data-testid="lg-form_field-feedback"
id="lg-form_field-feedback-247"
id="lg-form_field-feedback-209"
>
<div
class="leafygreen-ui-1nmw6il"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
data-lgid="lg-select"
>
<button
aria-controls="select-250-menu"
aria-describedby="select-250-description"
aria-controls="select-212-menu"
aria-describedby="select-212-description"
aria-disabled="false"
aria-expanded="false"
aria-invalid="false"
Expand All @@ -17,7 +17,7 @@
data-cy="searchbar-select"
data-lgid="lg-button"
data-testid="leafygreen-ui-select-menubutton"
id="select-251"
id="select-213"
type="button"
value="filter"
>
Expand Down Expand Up @@ -140,7 +140,7 @@
autocomplete="on"
class="lg-ui-form-field-input-0000 leafygreen-ui-1ago99h"
data-cy="searchbar-input"
id="lg-form_field-input-255"
id="lg-form_field-input-217"
placeholder="optional, regexp to search"
required=""
spellcheck="false"
Expand All @@ -155,7 +155,7 @@
class="leafygreen-ui-11ydt2g"
data-lgid="lg-form_field-feedback"
data-testid="lg-form_field-feedback"
id="lg-form_field-feedback-254"
id="lg-form_field-feedback-216"
/>
</div>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@
Case
</div>
<div
aria-label="segmented-control-258"
aria-owns="segmented-control-258-0 segmented-control-258-1"
aria-label="segmented-control-220"
aria-owns="segmented-control-220-0 segmented-control-220-1"
class="leafygreen-ui-18en4yf"
role="tablist"
>
Expand All @@ -159,7 +159,7 @@
aria-controls="Toggle case sensitivity"
aria-selected="false"
class="leafygreen-ui-ypz97o"
id="segmented-control-258-0"
id="segmented-control-220-0"
role="tab"
tabindex="-1"
type="button"
Expand Down Expand Up @@ -188,7 +188,7 @@
aria-controls="Toggle case sensitivity"
aria-selected="true"
class="leafygreen-ui-ypz97o"
id="segmented-control-258-1"
id="segmented-control-220-1"
role="tab"
tabindex="0"
type="button"
Expand Down Expand Up @@ -222,8 +222,8 @@
Match
</div>
<div
aria-label="segmented-control-259"
aria-owns="segmented-control-259-0 segmented-control-259-1"
aria-label="segmented-control-221"
aria-owns="segmented-control-221-0 segmented-control-221-1"
class="leafygreen-ui-18en4yf"
role="tablist"
>
Expand All @@ -239,7 +239,7 @@
aria-controls="Toggle match type"
aria-selected="true"
class="leafygreen-ui-ypz97o"
id="segmented-control-259-0"
id="segmented-control-221-0"
role="tab"
tabindex="0"
type="button"
Expand Down Expand Up @@ -268,7 +268,7 @@
aria-controls="Toggle match type"
aria-selected="false"
class="leafygreen-ui-ypz97o"
id="segmented-control-259-1"
id="segmented-control-221-1"
role="tab"
tabindex="-1"
type="button"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<nav
aria-label="Side panel"
class="leafygreen-ui-fw8ayd"
id="side-nav-266"
id="side-nav-228"
>
<div
class="leafygreen-ui-1nmawjt"
Expand All @@ -29,7 +29,7 @@
<div
class="leafygreen-ui-g6ml2m"
data-testid="side-nav-group-header-label"
id="menu-group-label-id-262"
id="menu-group-label-id-224"
>
<div
class="leafygreen-ui-1rnl6t5"
Expand Down Expand Up @@ -86,7 +86,7 @@
</div>
</div>
<ul
aria-labelledby="menu-group-label-id-262"
aria-labelledby="menu-group-label-id-224"
class="leafygreen-ui-bdnco"
>
<div
Expand Down Expand Up @@ -236,8 +236,8 @@
Case
</div>
<div
aria-label="segmented-control-267"
aria-owns="segmented-control-267-0 segmented-control-267-1"
aria-label="segmented-control-229"
aria-owns="segmented-control-229-0 segmented-control-229-1"
class="leafygreen-ui-18en4yf"
role="tablist"
>
Expand All @@ -253,7 +253,7 @@
aria-controls="Toggle case sensitivity"
aria-selected="true"
class="leafygreen-ui-ypz97o"
id="segmented-control-267-0"
id="segmented-control-229-0"
role="tab"
tabindex="0"
type="button"
Expand Down Expand Up @@ -282,7 +282,7 @@
aria-controls="Toggle case sensitivity"
aria-selected="false"
class="leafygreen-ui-ypz97o"
id="segmented-control-267-1"
id="segmented-control-229-1"
role="tab"
tabindex="-1"
type="button"
Expand Down Expand Up @@ -316,8 +316,8 @@
Match
</div>
<div
aria-label="segmented-control-268"
aria-owns="segmented-control-268-0 segmented-control-268-1"
aria-label="segmented-control-230"
aria-owns="segmented-control-230-0 segmented-control-230-1"
class="leafygreen-ui-18en4yf"
role="tablist"
>
Expand All @@ -333,7 +333,7 @@
aria-controls="Toggle match type"
aria-selected="true"
class="leafygreen-ui-ypz97o"
id="segmented-control-268-0"
id="segmented-control-230-0"
role="tab"
tabindex="0"
type="button"
Expand Down Expand Up @@ -362,7 +362,7 @@
aria-controls="Toggle match type"
aria-selected="false"
class="leafygreen-ui-ypz97o"
id="segmented-control-268-1"
id="segmented-control-230-1"
role="tab"
tabindex="-1"
type="button"
Expand Down Expand Up @@ -400,7 +400,7 @@
<div
class="leafygreen-ui-g6ml2m"
data-testid="side-nav-group-header-label"
id="menu-group-label-id-263"
id="menu-group-label-id-225"
>
<div
class="leafygreen-ui-1rnl6t5"
Expand Down Expand Up @@ -455,7 +455,7 @@
</div>
</div>
<ul
aria-labelledby="menu-group-label-id-263"
aria-labelledby="menu-group-label-id-225"
class="leafygreen-ui-bdnco"
>
<div
Expand Down Expand Up @@ -507,7 +507,7 @@
<div
class="leafygreen-ui-g6ml2m"
data-testid="side-nav-group-header-label"
id="menu-group-label-id-264"
id="menu-group-label-id-226"
>
<div
class="leafygreen-ui-1rnl6t5"
Expand Down Expand Up @@ -555,7 +555,7 @@
</div>
</div>
<ul
aria-labelledby="menu-group-label-id-264"
aria-labelledby="menu-group-label-id-226"
class="leafygreen-ui-bdnco"
>
<div
Expand Down Expand Up @@ -726,7 +726,7 @@
</div>
</nav>
<button
aria-controls="side-nav-266"
aria-controls="side-nav-228"
aria-expanded="true"
aria-label="Collapse navigation"
class="leafygreen-ui-v87gj9"
Expand Down
7 changes: 7 additions & 0 deletions apps/parsley/src/gql/generated/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,7 @@ export enum HostEventType {
HostTaskFinished = "HOST_TASK_FINISHED",
HostTemporaryExemptionExpirationWarningSent = "HOST_TEMPORARY_EXEMPTION_EXPIRATION_WARNING_SENT",
HostTerminatedExternally = "HOST_TERMINATED_EXTERNALLY",
SpawnHostCreatedError = "SPAWN_HOST_CREATED_ERROR",
VolumeExpirationWarningSent = "VOLUME_EXPIRATION_WARNING_SENT",
VolumeMigrationFailed = "VOLUME_MIGRATION_FAILED",
}
Expand Down Expand Up @@ -2805,6 +2806,7 @@ export type Task = {
dispatchTime?: Maybe<Scalars["Time"]["output"]>;
displayName: Scalars["String"]["output"];
displayOnly?: Maybe<Scalars["Boolean"]["output"]>;
displayStatus: Scalars["String"]["output"];
displayTask?: Maybe<Task>;
distroId: Scalars["String"]["output"];
estimatedStart?: Maybe<Scalars["Duration"]["output"]>;
Expand Down Expand Up @@ -2841,6 +2843,11 @@ export type Task = {
scheduledTime?: Maybe<Scalars["Time"]["output"]>;
spawnHostLink?: Maybe<Scalars["String"]["output"]>;
startTime?: Maybe<Scalars["Time"]["output"]>;
/**
* This is a task's display status and is what is commonly used on the UI.
* In future releases this will be migrated to represent the original status of the task
* @deprecated use displayStatus instead. Status will be migrated to reflect the original status
*/
status: Scalars["String"]["output"];
stepbackInfo?: Maybe<StepbackInfo>;
tags: Array<Scalars["String"]["output"]>;
Expand Down
2 changes: 1 addition & 1 deletion apps/spruce/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"@leafygreen-ui/side-nav": "^14.1.3",
"@leafygreen-ui/skeleton-loader": "^1.2.0",
"@leafygreen-ui/table": "^12.7.0",
"@leafygreen-ui/tabs": "^11.0.4",
"@leafygreen-ui/tabs": "^13.1.1",
"@leafygreen-ui/text-area": "^9.1.2",
"@leafygreen-ui/text-input": "^13.0.2",
"@leafygreen-ui/toast": "^6.1.27",
Expand Down
8 changes: 4 additions & 4 deletions apps/spruce/src/components/styles/StyledTabs.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ComponentType } from "react";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed styling of tabs so that the new dom order looks correct.

import styled from "@emotion/styled";
import { Tabs, TabsProps } from "@leafygreen-ui/tabs";
import { size } from "@evg-ui/lib/constants/tokens";

// @ts-expect-error
export const StyledTabs = styled(Tabs)<TabsProps>`
> div > [role="tablist"] {
margin-bottom: ${size.s};
[role="tabpanel"] {
margin-top: ${size.s};
}
`;
` as ComponentType<TabsProps>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the as ComponentType<TabsProps> necessary?

I think we may also want to respond on LG-4696. I think the typing of setSelected seems to be funky, not sure why they prescribe using Dispatch<SetStateAction<number>> and not a more flexible implementation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is to get it to work well with Emotion. I left a comment on the slack thread irt the weird Dispatch<SetState... typing but I also followed up on the ticket

21 changes: 15 additions & 6 deletions apps/spruce/src/constants/routes.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PatchTab } from "types/patch";
import { ConfigurePatchPageTabs, VersionPageTabs } from "types/patch";
import { TaskTab } from "types/task";
import {
getTaskRoute,
Expand Down Expand Up @@ -56,7 +56,7 @@ describe("getVersionRoute", () => {
expect(getVersionRoute("SomeId")).toBe("/version/SomeId/tasks");
});
it("generates a version route with only an id and a tab", () => {
expect(getVersionRoute("SomeId", { tab: "tasks" as PatchTab })).toBe(
expect(getVersionRoute("SomeId", { tab: "tasks" as VersionPageTabs })).toBe(
"/version/SomeId/tasks",
);
});
Expand All @@ -67,7 +67,10 @@ describe("getVersionRoute", () => {
});
it("generates a version route with only an id, tab and some params", () => {
expect(
getVersionRoute("SomeId", { tab: "tasks" as PatchTab, variant: "b" }),
getVersionRoute("SomeId", {
tab: "tasks" as VersionPageTabs,
variant: "b",
}),
).toBe("/version/SomeId/tasks?variant=b");
});
});
Expand Down Expand Up @@ -105,11 +108,17 @@ describe("getPatchRoute", () => {
});
it("generates a link with a provided tab", () => {
expect(
getPatchRoute("somePatchId", { configure: true, tab: "parameters" }),
getPatchRoute("somePatchId", {
configure: true,
tab: ConfigurePatchPageTabs.Parameters,
}),
).toBe("/patch/somePatchId/configure/parameters");
expect(
getPatchRoute("somePatchId", { configure: true, tab: "someTab" }),
).toBe("/patch/somePatchId/configure/someTab");
getPatchRoute("somePatchId", {
configure: true,
tab: ConfigurePatchPageTabs.Changes,
}),
).toBe("/patch/somePatchId/configure/changes");
});
});

Expand Down
Loading
Loading