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

🪟 🧹 Implement ColumnSortButton component #17798

Merged
merged 32 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9d275e0
Implement ColumnSortButton component
YatsukBogdan1 Oct 10, 2022
f4500d9
Merge branch 'master' into byatsuk/feature-create-sort-column-button
YatsukBogdan1 Oct 11, 2022
26349f5
Merge branch 'master' into byatsuk/feature-create-sort-column-button
YatsukBogdan1 Oct 17, 2022
4d75f65
Updates component name; Moves component to ui/Table folder; Refactors…
YatsukBogdan1 Oct 17, 2022
52e3b52
Update airbyte-webapp/src/App.tsx
YatsukBogdan1 Oct 18, 2022
e1a66f4
Updates next properties: wasActive -> isActive, lowToLarge -> isAscen…
YatsukBogdan1 Oct 18, 2022
2de965d
Skip psql stop in acceptance test for gke (#18023)
terencecho Oct 17, 2022
862e71b
Checks for iterator hasNext element (#18041)
ryankfu Oct 17, 2022
ba6d2fa
Add Message Migration to Destination Connection Checks (#17954)
gosusnp Oct 17, 2022
73a96db
Update helm release workflow (#18048)
xpuska513 Oct 17, 2022
3b86dcb
Remove unused `airbyte-cli` (#18009)
evantahler Oct 17, 2022
01bcb8c
🐛 [low-code] $options shouldn't overwrite values that are already de…
girarda Oct 17, 2022
3e6fb5a
Update helm chart comments (#18072)
xpuska513 Oct 17, 2022
12d9476
Update helm charts (#18073)
xpuska513 Oct 17, 2022
72375ba
16250 Destination Redis: Add SSH support (#17951)
suhomud Oct 17, 2022
16b5340
Bump helm chart version reference to 0.40.20 (#18074)
github-actions[bot] Oct 17, 2022
29d95bf
Helm Chart: Create service annotations for airbyte-server (#17932)
sfc-gh-pkommini Oct 17, 2022
4d881a5
Bmoric/remove dep server worker (#17894)
benmoriceau Oct 17, 2022
2373171
Updated connector catalog page (#18076)
Amruta-Ranade Oct 17, 2022
9af92ce
Move the port forward outside of the main docker-compose (#17864)
benmoriceau Oct 17, 2022
060efaa
Bump Airbyte version from 0.40.14 to 0.40.15 (#17970)
octavia-squidington-iii Oct 17, 2022
63cd5e6
🎉 Source Shopify: Add metafield streams (#17962)
artem1205 Oct 17, 2022
52ce959
fix check for streams that do not use a stream slicer (#18080)
brianjlai Oct 17, 2022
d29c4a6
tolerate database nulls in webhook operation configs (#18084)
mfsiega-airbyte Oct 17, 2022
c0e8da3
Implement webhook operation in the sync workflow (#18022)
mfsiega-airbyte Oct 18, 2022
d876c8c
Bump helm chart version reference to 0.40.22 (#18077)
github-actions[bot] Oct 18, 2022
6805c4c
Added new "filters" python file, along with a "hash" filter. This can…
alexander-marquardt Oct 18, 2022
00789a3
Bump helm chart version reference to 0.40.24 (#18081)
github-actions[bot] Oct 18, 2022
64b990e
SATs: allow new records in a sequential read for full refresh test (#…
davydov-d Oct 18, 2022
d9d4c3f
Source facebook-marketing: remove `pixel` from custom conversions str…
davydov-d Oct 18, 2022
a8137fa
#17506 fix klaviyo & marketo expected_records (#18101)
davydov-d Oct 18, 2022
19f3925
Merge branch 'master' into byatsuk/feature-create-sort-column-button
YatsukBogdan1 Oct 18, 2022
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
54 changes: 29 additions & 25 deletions airbyte-webapp/src/components/EntityTable/ConnectionTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FormattedMessage } from "react-intl";
import { useNavigate } from "react-router-dom";
import { CellProps } from "react-table";

import { Table } from "components/ui/Table";
import { Table, SortableTableHeader } from "components/ui/Table";

import { ConnectionScheduleType } from "core/request/AirbyteClient";
import { FeatureItem, useFeature } from "hooks/services/Feature";
Expand All @@ -15,9 +15,7 @@ import ConnectorCell from "./components/ConnectorCell";
import FrequencyCell from "./components/FrequencyCell";
import LastSyncCell from "./components/LastSyncCell";
import NameCell from "./components/NameCell";
import SortIcon from "./components/SortIcon";
import StatusCell from "./components/StatusCell";
import styles from "./ConnectionTable.module.scss";
import { ITableDataItem, SortOrderEnum } from "./types";

interface IProps {
Expand Down Expand Up @@ -76,10 +74,13 @@ const ConnectionTable: React.FC<IProps> = ({ data, entity, onClickRow, onSync })
() => [
{
Header: (
<button className={styles.tableHeaderButton} onClick={() => onSortClick("name")}>
<SortableTableHeader
onClick={() => onSortClick("name")}
isActive={sortBy === "name"}
isAscending={sortOrder === SortOrderEnum.ASC}
>
<FormattedMessage id="tables.name" />
<SortIcon wasActive={sortBy === "name"} lowToLarge={sortOrder === SortOrderEnum.ASC} />
</button>
</SortableTableHeader>
),
headerHighlighted: true,
accessor: "name",
Expand All @@ -90,14 +91,15 @@ const ConnectionTable: React.FC<IProps> = ({ data, entity, onClickRow, onSync })
},
{
Header: (
<button className={styles.tableHeaderButton} onClick={() => onSortClick("entityName")}>
{entity === "connection" ? (
<FormattedMessage id="tables.destinationConnectionToName" />
) : (
<FormattedMessage id={`tables.${entity}ConnectionToName`} />
)}
<SortIcon wasActive={sortBy === "entityName"} lowToLarge={sortOrder === SortOrderEnum.ASC} />
</button>
<SortableTableHeader
onClick={() => onSortClick("entityName")}
isActive={sortBy === "entityName"}
isAscending={sortOrder === SortOrderEnum.ASC}
>
<FormattedMessage
id={entity === "connection" ? "tables.destinationConnectionToName" : `tables.${entity}ConnectionToName`}
/>
</SortableTableHeader>
),
headerHighlighted: true,
accessor: "entityName",
Expand All @@ -112,14 +114,13 @@ const ConnectionTable: React.FC<IProps> = ({ data, entity, onClickRow, onSync })
},
{
Header: (
<button className={styles.tableHeaderButton} onClick={() => onSortClick("connectorName")}>
{entity === "connection" ? (
<FormattedMessage id="tables.sourceConnectionToName" />
) : (
<FormattedMessage id="tables.connector" />
)}
<SortIcon wasActive={sortBy === "connectorName"} lowToLarge={sortOrder === SortOrderEnum.ASC} />
</button>
<SortableTableHeader
onClick={() => onSortClick("connectorName")}
isActive={sortBy === "connectorName"}
isAscending={sortOrder === SortOrderEnum.ASC}
>
<FormattedMessage id={entity === "connection" ? "tables.sourceConnectionToName" : "tables.connector"} />
</SortableTableHeader>
),
accessor: "connectorName",
Cell: ({ cell, row }: CellProps<ITableDataItem>) => (
Expand All @@ -136,10 +137,13 @@ const ConnectionTable: React.FC<IProps> = ({ data, entity, onClickRow, onSync })
},
{
Header: (
<button className={styles.tableHeaderButton} onClick={() => onSortClick("lastSync")}>
<SortableTableHeader
onClick={() => onSortClick("lastSync")}
isActive={sortBy === "lastSync"}
isAscending={sortOrder === SortOrderEnum.ASC}
>
<FormattedMessage id="tables.lastSync" />
<SortIcon wasActive={sortBy === "lastSync"} lowToLarge={sortOrder === SortOrderEnum.ASC} />
</button>
</SortableTableHeader>
),
accessor: "lastSync",
Cell: ({ cell, row }: CellProps<ITableDataItem>) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,3 @@
padding-left: 32px !important;
}
}

.tableHeaderButton {
display: inline-flex;
font-size: inherit;
text-transform: inherit;
color: inherit;
background-color: inherit;
border: none;
font-weight: inherit;
cursor: pointer;
}
30 changes: 19 additions & 11 deletions airbyte-webapp/src/components/EntityTable/ImplementationTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { FormattedMessage } from "react-intl";
import { useNavigate } from "react-router-dom";
import { CellProps } from "react-table";

import { Table } from "components/ui/Table";
import { Table, SortableTableHeader } from "components/ui/Table";

import { useQuery } from "hooks/useQuery";

Expand All @@ -13,7 +13,6 @@ import ConnectEntitiesCell from "./components/ConnectEntitiesCell";
import ConnectorCell from "./components/ConnectorCell";
import LastSyncCell from "./components/LastSyncCell";
import NameCell from "./components/NameCell";
import SortIcon from "./components/SortIcon";
import styles from "./ImplementationTable.module.scss";
import { EntityTableDataItem, SortOrderEnum } from "./types";

Expand Down Expand Up @@ -69,10 +68,13 @@ const ImplementationTable: React.FC<IProps> = ({ data, entity, onClickRow }) =>
() => [
{
Header: (
<button className={styles.tableHeaderButton} onClick={() => onSortClick("entity")}>
<SortableTableHeader
onClick={() => onSortClick("entity")}
isActive={sortBy === "entity"}
isAscending={sortOrder === SortOrderEnum.ASC}
>
<FormattedMessage id="tables.name" />
<SortIcon wasActive={sortBy === "entity"} lowToLarge={sortOrder === SortOrderEnum.ASC} />
</button>
</SortableTableHeader>
),
headerHighlighted: true,
accessor: "entityName",
Expand All @@ -83,10 +85,13 @@ const ImplementationTable: React.FC<IProps> = ({ data, entity, onClickRow }) =>
},
{
Header: (
<button className={styles.tableHeaderButton} onClick={() => onSortClick("connector")}>
<SortableTableHeader
onClick={() => onSortClick("connector")}
isActive={sortBy === "connector"}
isAscending={sortOrder === SortOrderEnum.ASC}
>
<FormattedMessage id="tables.connector" />
<SortIcon wasActive={sortBy === "connector"} lowToLarge={sortOrder === SortOrderEnum.ASC} />
</button>
</SortableTableHeader>
),
accessor: "connectorName",
Cell: ({ cell, row }: CellProps<EntityTableDataItem>) => (
Expand All @@ -102,10 +107,13 @@ const ImplementationTable: React.FC<IProps> = ({ data, entity, onClickRow }) =>
},
{
Header: (
<button className={styles.tableHeaderButton} onClick={() => onSortClick("lastSync")}>
<SortableTableHeader
onClick={() => onSortClick("lastSync")}
isActive={sortBy === "lastSync"}
isAscending={sortOrder === SortOrderEnum.ASC}
>
<FormattedMessage id="tables.lastSync" />
<SortIcon wasActive={sortBy === "lastSync"} lowToLarge={sortOrder === SortOrderEnum.ASC} />
</button>
</SortableTableHeader>
),
accessor: "lastSync",
Cell: ({ cell, row }: CellProps<EntityTableDataItem>) => (
Expand Down

This file was deleted.

16 changes: 0 additions & 16 deletions airbyte-webapp/src/components/EntityTable/components/SortIcon.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.sortButton {
background-color: inherit;
border: none;
color: inherit;
cursor: pointer;
font-size: inherit;
font-weight: inherit;
text-transform: inherit;
white-space: nowrap;
}

.sortIcon {
margin-left: 10px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { faCaretDown, faCaretUp } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import React, { PropsWithChildren } from "react";

import styles from "./SortableTableHeader.module.scss";

interface SortableTableHeaderProps {
onClick: () => void;
isActive: boolean;
isAscending: boolean;
}

export const SortableTableHeader: React.FC<PropsWithChildren<SortableTableHeaderProps>> = ({
onClick,
isActive,
isAscending,
children,
}) => (
<button className={styles.sortButton} onClick={onClick}>
{children}
<FontAwesomeIcon className={styles.sortIcon} icon={isAscending || !isActive ? faCaretUp : faCaretDown} />
</button>
);
1 change: 1 addition & 0 deletions airbyte-webapp/src/components/ui/Table/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from "./Table";
export { SortableTableHeader } from "./SortableTableHeader";

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import { useNavigate } from "react-router-dom";
import { CellProps } from "react-table";
import styled from "styled-components";

import SortIcon from "components/EntityTable/components/SortIcon";
import { SortOrderEnum } from "components/EntityTable/types";
import { Table } from "components/ui/Table";
import { Table, SortableTableHeader } from "components/ui/Table";

import { useQuery } from "hooks/useQuery";
import { CreditConsumptionByConnector } from "packages/cloud/lib/domain/cloudWorkspaces/types";
Expand All @@ -16,7 +15,6 @@ import { useSourceDefinitionList } from "services/connector/SourceDefinitionServ

import ConnectionCell from "./ConnectionCell";
import UsageCell from "./UsageCell";
import styles from "./UsagePerConnectionTable.module.scss";

const Content = styled.div`
padding: 0 60px 0 15px;
Expand Down Expand Up @@ -112,10 +110,13 @@ const UsagePerConnectionTable: React.FC<UsagePerConnectionTableProps> = ({ credi
() => [
{
Header: (
<button className={styles.tableHeaderButton} onClick={() => onSortClick("connection")}>
<SortableTableHeader
onClick={() => onSortClick("connection")}
isActive={sortBy === "connection"}
isAscending={sortOrder === SortOrderEnum.ASC}
>
<FormattedMessage id="credits.connection" />
<SortIcon wasActive={sortBy === "connection"} lowToLarge={sortOrder === SortOrderEnum.ASC} />
</button>
</SortableTableHeader>
),
customWidth: 30,
accessor: "sourceDefinitionName",
Expand All @@ -130,10 +131,13 @@ const UsagePerConnectionTable: React.FC<UsagePerConnectionTableProps> = ({ credi
},
{
Header: (
<button className={styles.tableHeaderButton} onClick={() => onSortClick("usage")}>
<SortableTableHeader
onClick={() => onSortClick("usage")}
isActive={sortBy === "usage"}
isAscending={sortOrder === SortOrderEnum.ASC}
>
<FormattedMessage id="credits.usage" />
<SortIcon wasActive={sortBy === "usage"} lowToLarge={sortOrder === SortOrderEnum.ASC} />
</button>
</SortableTableHeader>
),
accessor: "creditsConsumed",
collapse: true,
Expand Down