Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrczarnas committed Oct 2, 2024
2 parents 42a9f00 + d73f772 commit cb7cd94
Show file tree
Hide file tree
Showing 7 changed files with 260 additions and 107 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import SvgIcon from '../SvgIcon';
export default function AdvancedProperties({
properties,
handleChange,
sharedCredentials
sharedCredentials,
title
}: {
properties: any;
handleChange: any;
sharedCredentials: any;
title?: string;
}) {
const isExpanded = Object.keys(properties ?? {}).length > 0;
const [advancedPropertiesOpen, setAdvancedPropertiesOpen] =
Expand All @@ -24,7 +26,7 @@ export default function AdvancedProperties({
<div>
{advancedPropertiesOpen ? (
<SectionWrapper
title="Advanced properties"
title={title ?? 'Advanced properties'}
className="ml-4 !pb-1 !pt-1 !mt-4 !mb-4"
svgIcon
onClick={() => setAdvancedPropertiesOpen(!advancedPropertiesOpen)}
Expand All @@ -39,13 +41,13 @@ export default function AdvancedProperties({
/>
</SectionWrapper>
) : (
<div className="flex items-center ml-4 mb-2 text-sm font-bold">
<div className="flex items-center ml-4 mb-2 text-sm font-bold cursor-pointer">
<SvgIcon
name="chevron-right"
className="w-5 h-5"
onClick={() => setAdvancedPropertiesOpen(!advancedPropertiesOpen)}
/>
Advanced properties
{title ?? 'Advanced properties'}
</div>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ import SnowflakeConnection from '../../Dashboard/DatabaseConnection/SnowflakeCon
import SparkConnection from '../../Dashboard/DatabaseConnection/SparkConnection';
import SqlServerConnection from '../../Dashboard/DatabaseConnection/SqlServerConnection';
import TrinoConnection from '../../Dashboard/DatabaseConnection/TrinoConnection';
import SectionWrapper from '../../Dashboard/SectionWrapper';
import Input from '../../Input';
import Loader from '../../Loader';
import SvgIcon from '../../SvgIcon';
import ConnectionActionGroup from './ConnectionActionGroup';

const ConnectionDetail = () => {
Expand Down Expand Up @@ -71,6 +73,7 @@ const ConnectionDetail = () => {
const [showError, setShowError] = useState(false);
const [showConfirm, setShowConfirm] = useState(false);
const [message, setMessage] = useState<string>();
const [showAdvancedProperties, setShowAdvancedProperties] = useState(false);
const [sharedCredentials, setSharedCredentials] = useState<
SharedCredentialListModel[]
>([]);
Expand Down Expand Up @@ -166,21 +169,21 @@ const ConnectionDetail = () => {
isUpdating={isUpdating}
isUpdated={isUpdatedConnectionBasic}
/>
<table className="mb-1">
<tbody>
<tr>
<td className="px-4 py-2">
<div>Connection name</div>
</td>
<td className="px-4 py-2">
<div>{connectionBasic?.connection_name}</div>
</td>
</tr>
<tr>
<td className="px-4 py-2">
<div>Parallel jobs limit</div>
</td>
<td className="px-4 py-2">
<div className="mb-1">
<div className="flex px-4 py-2 pb-4">
<div>Connection name</div>
<div className="ml-4">{connectionBasic?.connection_name}</div>
</div>

{showAdvancedProperties ? (
<SectionWrapper
title="Advanced properties"
svgIcon
onClick={() => setShowAdvancedProperties(false)}
className="ml-4 !pb-1 !pt-1 !mt-4 !mb-4"
>
<div className="flex px-4 py-2 mt-4 items-center">
<div className="!w-60">Parallel jobs limit</div>
<div>
<Input
value={connectionBasic?.parallel_jobs_limit}
Expand All @@ -197,33 +200,41 @@ const ConnectionDetail = () => {
}}
/>
</div>
</td>
</tr>
<tr>
<td className="px-4 py-2">
<div>Schedule only on DQOps instance</div>
</td>
<td className="px-4 py-2">
</div>

<div className="flex px-4 py-2 items-center">
<div className="!w-60">Schedule only on DQOps instance</div>
<div>
<Input
value={connectionBasic?.schedule_on_instance}
placeholder="Enter the name of a DQOps named instance which will run data scheduled data quality checks"
placeholder="Enter the name of a DQOps named instance which will run scheduled data quality checks"
onChange={(e) => {
onChange({
...connectionBasic,
schedule_on_instance: String(e.target.value)
});
}}
className="!min-w-145"
/>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</SectionWrapper>
) : (
<div
className="flex items-center ml-4 mb-4 text-sm font-bold cursor-pointer"
onClick={() => setShowAdvancedProperties(true)}
>
<SvgIcon name="chevron-right" className="w-5 h-5" />
Advanced properties
</div>
)}
</div>

<AdvancedProperties
properties={connectionBasic?.advanced_properties}
handleChange={onChange}
sharedCredentials={sharedCredentials}
title="Data source connection properties"
/>

<div className="px-4 !mt-6">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,14 @@ export default function SourceTablesTable({
source?.table ?? ''
).then(() => {
const newTables = tables.filter(
(t) =>
(table) =>
!(
t.source_connection === source?.connection &&
t.source_schema === source?.schema &&
t.source_table === source?.table
(isTarget ? table.target_connection : table.source_connection) ===
source?.connection &&
(isTarget ? table.target_schema : table.source_schema) ===
source?.schema &&
(isTarget ? table.target_table : table.source_table) ===
source?.table
)
);
setTables(newTables);
Expand All @@ -151,56 +154,76 @@ export default function SourceTablesTable({
const history = useHistory();

const goTable = (dataLineage: TableLineageSourceListModel) => {
const connection = isTarget
? dataLineage.target_connection
: dataLineage.source_connection;
const schema = isTarget
? dataLineage.target_schema
: dataLineage.source_schema;
const table = isTarget
? dataLineage.target_table
: dataLineage.source_table;

const url = ROUTES.TABLE_LEVEL_PAGE(
CheckTypes.SOURCES,
dataLineage.source_connection ?? '',
dataLineage.source_schema ?? '',
dataLineage.source_table ?? '',
connection ?? '',
schema ?? '',
table ?? '',
'detail'
);

const value = ROUTES.TABLE_LEVEL_VALUE(
CheckTypes.SOURCES,
dataLineage.source_connection ?? '',
dataLineage.source_schema ?? '',
dataLineage.source_table ?? ''
connection ?? '',
schema ?? '',
table ?? ''
);

dispatch(
addFirstLevelTab(CheckTypes.SOURCES, {
url,
value,
label: dataLineage.source_table ?? '',
label: table ?? '',
state: {}
})
);
history.push(url);
};

const onChangeExpandedLineage = (lineage: TableLineageSourceListModel) => {
const connection = isTarget
? lineage.target_connection
: lineage.source_connection;
const schema = isTarget ? lineage.target_schema : lineage.source_schema;
const table = isTarget ? lineage.target_table : lineage.source_table;

const newExpandedLineage = [...(expandedLineage ?? [])];

if (
newExpandedLineage.find(
(expandedLiceage) =>
expandedLiceage.connection === lineage.source_connection &&
expandedLiceage.schema === lineage.source_schema &&
expandedLiceage.table === lineage.source_table
expandedLiceage.connection === connection &&
expandedLiceage.schema === schema &&
expandedLiceage.table === table
)
) {
newExpandedLineage.splice(
newExpandedLineage.findIndex(
(expandedLiceage) =>
expandedLiceage.connection === lineage.source_connection &&
expandedLiceage.schema === lineage.source_schema &&
expandedLiceage.table === lineage.source_table
expandedLiceage.connection === connection &&
expandedLiceage.schema === schema &&
expandedLiceage.table === table
),
1
);
} else {
newExpandedLineage.push({
connection: lineage.source_connection ?? '',
schema: lineage.source_schema ?? '',
table: lineage.source_table ?? ''
connection: connection ?? '',
schema: schema ?? '',
table: table ?? ''
});
}

setExpandedLineage(newExpandedLineage);
};

Expand Down Expand Up @@ -280,9 +303,16 @@ export default function SourceTablesTable({
<div className="pl-2">
{expandedLineage?.find(
(lineage) =>
lineage.connection === table.source_connection &&
lineage.schema === table.source_schema &&
lineage.table === table.source_table
lineage.connection ===
(isTarget
? table.target_connection
: table.source_connection) &&
lineage.schema ===
(isTarget
? table.target_schema
: table.source_schema) &&
lineage.table ===
(isTarget ? table.target_table : table.source_table)
) ? (
<SvgIcon name="chevron-down" className="w-4" />
) : (
Expand Down Expand Up @@ -372,9 +402,18 @@ export default function SourceTablesTable({
<IconButton
onClick={() =>
setSorceTableToDelete({
connection: table.source_connection ?? '',
schema: table.source_schema ?? '',
table: table.source_table ?? ''
connection:
(isTarget
? table.target_connection
: table.source_connection) ?? '',
schema:
(isTarget
? table.target_schema
: table.source_schema) ?? '',
table:
(isTarget
? table.target_table
: table.source_table) ?? ''
})
}
size="sm"
Expand All @@ -399,17 +438,28 @@ export default function SourceTablesTable({
</tr>
{expandedLineage?.find(
(lineage) =>
lineage.connection === table.source_connection &&
lineage.schema === table.source_schema &&
lineage.table === table.source_table &&
lineage.connection ===
(isTarget
? table.target_connection
: table.source_connection) &&
lineage.schema ===
(isTarget ? table.target_schema : table.source_schema) &&
lineage.table ===
(isTarget ? table.target_table : table.source_table) &&
table.source_table_data_quality_status?.table_exist
) && (
<tr>
<td colSpan={5} className="pl-4 py-1">
<SourceTablesTable
connection={table.source_connection}
schema={table.source_schema}
table={table.source_table}
connection={
isTarget
? table.target_connection
: table.source_connection
}
schema={
isTarget ? table.target_schema : table.source_schema
}
table={isTarget ? table.target_table : table.source_table}
showHeader={false}
isTarget={isTarget}
/>
Expand Down
Loading

0 comments on commit cb7cd94

Please sign in to comment.