Skip to content

Commit

Permalink
Merge branch 'master' into security-fixes-12-02
Browse files Browse the repository at this point in the history
  • Loading branch information
david-leifker committed Dec 5, 2022
2 parents 79329d5 + 155a683 commit af26f97
Show file tree
Hide file tree
Showing 69 changed files with 1,986 additions and 277 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,11 @@ Here are the companies that have officially adopted DataHub. Please feel free to
- [Adevinta](https://www.adevinta.com/)
- [Banksalad](https://www.banksalad.com)
- [Cabify](https://cabify.tech/)
- [ClassDojo](https://www.classdojo.com/)
- [Coursera](https://www.coursera.org/)
- [DefinedCrowd](http://www.definedcrowd.com)
- [DFDS](https://www.dfds.com/)
- [Digital Turbine](https://www.digitalturbine.com/)
- [Expedia Group](http://expedia.com)
- [Experius](https://www.experius.nl)
- [Geotab](https://www.geotab.com)
Expand All @@ -122,15 +125,21 @@ Here are the companies that have officially adopted DataHub. Please feel free to
- [Klarna](https://www.klarna.com)
- [LinkedIn](http://linkedin.com)
- [Moloco](https://www.moloco.com/en)
- [N26](https://n26brasil.com/)
- [Optum](https://www.optum.com/)
- [Peloton](https://www.onepeloton.com)
- [Razer](https://www.razer.com)
- [Saxo Bank](https://www.home.saxo)
- [Showroomprive](https://www.showroomprive.com/)
- [SpotHero](https://spothero.com)
- [Stash](https://www.stash.com)
- [Shanghai HuaRui Bank](https://www.shrbank.com)
- [ThoughtWorks](https://www.thoughtworks.com)
- [TypeForm](http://typeform.com)
- [Udemy](https://www.udemy.com/)
- [Uphold](https://uphold.com)
- [Viasat](https://viasat.com)
- [Wikimedia](https://www.wikimedia.org)
- [Wolt](https://wolt.com)
- [Zynga](https://www.zynga.com)

Expand Down
3 changes: 2 additions & 1 deletion datahub-frontend/test/app/ApplicationOidcTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ protected TestBrowser provideBrowser(int port) {
private String _wellKnownUrl;

@BeforeAll
public void init() throws IOException {
public void init() throws IOException, InterruptedException {
_oauthServer = new MockOAuth2Server();
_oauthServer.start(InetAddress.getByName("localhost"), 51152);
_oauthServer.enqueueCallback(
Expand All @@ -70,6 +70,7 @@ public void init() throws IOException {

createBrowser();
startServer();
Thread.sleep(2000);
}

@AfterAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Message } from '../../shared/Message';
import { useListDomainsQuery } from '../../../graphql/domain.generated';
import filterSearchQuery from '../../search/utils/filterSearchQuery';
import { ANTD_GRAY } from '../../entity/shared/constants';
import { useGetAuthenticatedUser } from '../../useGetAuthenticatedUser';

const HighlightGroup = styled.div`
display: flex;
Expand Down Expand Up @@ -46,13 +47,16 @@ const StyledSearchBar = styled(Input)`
`;

export const AnalyticsPage = () => {
const me = useGetAuthenticatedUser();
const canManageDomains = me?.platformPrivileges?.createDomains;
const { data: chartData, loading: chartLoading, error: chartError } = useGetAnalyticsChartsQuery();
const { data: highlightData, loading: highlightLoading, error: highlightError } = useGetHighlightsQuery();
const {
loading: domainLoading,
error: domainError,
data: domainData,
} = useListDomainsQuery({
skip: !canManageDomains,
variables: {
input: {
start: 0,
Expand Down Expand Up @@ -82,12 +86,11 @@ export const AnalyticsPage = () => {
skip: domain === '' && query === '',
});

const isLoading = highlightLoading || chartLoading || domainLoading || metadataAnalyticsLoading;
return (
<>
{isLoading && <Message type="loading" content="Loading..." style={{ marginTop: '10%' }} />}
<HighlightGroup>
{highlightLoading && (
<Message type="loading" content="Loading Highlights..." style={{ marginTop: '10%' }} />
)}
{highlightError && (
<Alert type="error" message={highlightError?.message || 'Highlights failed to load'} />
)}
Expand All @@ -96,7 +99,6 @@ export const AnalyticsPage = () => {
))}
</HighlightGroup>
<>
{chartLoading && <Message type="loading" content="Loading Charts..." style={{ marginTop: '10%' }} />}
{chartError && (
<Alert type="error" message={metadataAnalyticsError?.message || 'Charts failed to load'} />
)}
Expand All @@ -107,7 +109,6 @@ export const AnalyticsPage = () => {
))}
</>
<>
{domainLoading && <Message type="loading" content="Loading Domains..." style={{ marginTop: '10%' }} />}
{domainError && (
<Alert type="error" message={metadataAnalyticsError?.message || 'Domains failed to load'} />
)}
Expand Down Expand Up @@ -148,9 +149,6 @@ export const AnalyticsPage = () => {
)}
</>
<>
{metadataAnalyticsLoading && (
<Message type="loading" content="Loading Charts..." style={{ marginTop: '10%' }} />
)}
{metadataAnalyticsError && (
<Alert type="error" message={metadataAnalyticsError?.message || 'Charts failed to load'} />
)}
Expand All @@ -165,7 +163,6 @@ export const AnalyticsPage = () => {
))}
</>
<>
{chartLoading && <Message type="loading" content="Loading Charts..." style={{ marginTop: '10%' }} />}
{chartError && <Alert type="error" message={chartError?.message || 'Charts failed to load'} />}
{!chartLoading &&
chartData?.getAnalyticsCharts
Expand Down
Original file line number Diff line number Diff line change
@@ -1,163 +1,23 @@
import React, { useState } from 'react';
import { Table, Typography } from 'antd';
import { CheckSquareOutlined } from '@ant-design/icons';
import { AlignType } from 'rc-table/lib/interface';
import styled from 'styled-components';
import { Link } from 'react-router-dom';
import React from 'react';

import MlFeatureDataTypeIcon from './MlFeatureDataTypeIcon';
import { MlFeatureDataType, MlPrimaryKey, MlFeature } from '../../../../../types.generated';
import { MlPrimaryKey, MlFeature } from '../../../../../types.generated';
import { GetMlFeatureTableQuery } from '../../../../../graphql/mlFeatureTable.generated';
import { useBaseEntity, useRefetch } from '../../../shared/EntityContext';
import { useBaseEntity } from '../../../shared/EntityContext';
import { notEmpty } from '../../../shared/utils';
import TagTermGroup from '../../../../shared/tags/TagTermGroup';
import SchemaDescriptionField from '../../../dataset/profile/schema/components/SchemaDescriptionField';
import { useUpdateDescriptionMutation } from '../../../../../graphql/mutations.generated';
import { useEntityRegistry } from '../../../../useEntityRegistry';

const FeaturesContainer = styled.div`
margin-bottom: 100px;
`;

const defaultColumns = [
{
title: 'Type',
dataIndex: 'dataType',
key: 'dataType',
width: 100,
align: 'left' as AlignType,
render: (dataType: MlFeatureDataType) => {
return <MlFeatureDataTypeIcon dataType={dataType} />;
},
},
];
import TableOfMlFeatures from './TableOfMlFeatures';

export default function MlFeatureTableFeatures() {
const baseEntity = useBaseEntity<GetMlFeatureTableQuery>();
const refetch = useRefetch();
const featureTable = baseEntity?.mlFeatureTable;
const [updateDescription] = useUpdateDescriptionMutation();
const entityRegistry = useEntityRegistry();

const [tagHoveredIndex, setTagHoveredIndex] = useState<string | undefined>(undefined);

const features =
const features = (
featureTable?.properties && (featureTable?.properties?.mlFeatures || featureTable?.properties?.mlPrimaryKeys)
? [
...(featureTable?.properties?.mlPrimaryKeys || []),
...(featureTable?.properties?.mlFeatures || []),
].filter(notEmpty)
: [];

const onTagTermCell = (record: any, rowIndex: number | undefined) => ({
onMouseEnter: () => {
setTagHoveredIndex(`${record.urn}-${rowIndex}`);
},
onMouseLeave: () => {
setTagHoveredIndex(undefined);
},
});

const nameColumn = {
title: 'Name',
dataIndex: 'name',
key: 'name',
width: 100,
render: (name: string, feature: MlFeature | MlPrimaryKey) => (
<Link to={entityRegistry.getEntityUrl(feature.type, feature.urn)}>
<Typography.Text strong>{name}</Typography.Text>
</Link>
),
};

const descriptionColumn = {
title: 'Description',
dataIndex: 'description',
key: 'description',
render: (_, feature: MlFeature | MlPrimaryKey) => (
<SchemaDescriptionField
description={feature?.editableProperties?.description || feature?.properties?.description || ''}
original={feature?.properties?.description}
isEdited={!!feature?.editableProperties?.description}
onUpdate={(updatedDescription) =>
updateDescription({
variables: {
input: {
description: updatedDescription,
resourceUrn: feature.urn,
},
},
}).then(refetch)
}
/>
),
width: 300,
};

const tagColumn = {
width: 125,
title: 'Tags',
dataIndex: 'tags',
key: 'tags',
render: (_, feature: MlFeature | MlPrimaryKey, rowIndex: number) => (
<TagTermGroup
editableTags={feature.tags}
canRemove
buttonProps={{ size: 'small' }}
canAddTag={tagHoveredIndex === `${feature.urn}-${rowIndex}`}
onOpenModal={() => setTagHoveredIndex(undefined)}
entityUrn={feature.urn}
entityType={feature.type}
refetch={refetch}
/>
),
onCell: onTagTermCell,
};

const termColumn = {
width: 125,
title: 'Terms',
dataIndex: 'glossaryTerms',
key: 'glossarTerms',
render: (_, feature: MlFeature | MlPrimaryKey, rowIndex: number) => (
<TagTermGroup
editableGlossaryTerms={feature.glossaryTerms}
canRemove
buttonProps={{ size: 'small' }}
canAddTerm={tagHoveredIndex === `${feature.urn}-${rowIndex}`}
onOpenModal={() => setTagHoveredIndex(undefined)}
entityUrn={feature.urn}
entityType={feature.type}
refetch={refetch}
/>
),
onCell: onTagTermCell,
};

const primaryKeyColumn = {
title: 'Primary Key',
dataIndex: 'primaryKey',
key: 'primaryKey',
render: (_: any, record: MlFeature | MlPrimaryKey) =>
record.__typename === 'MLPrimaryKey' ? <CheckSquareOutlined /> : null,
width: 50,
};

const allColumns = [...defaultColumns, nameColumn, descriptionColumn, tagColumn, termColumn, primaryKeyColumn];
: []
) as Array<MlFeature | MlPrimaryKey>;

return (
<FeaturesContainer>
{features && features.length > 0 && (
<Table
columns={allColumns}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
dataSource={features}
rowKey={(record) => `${record.dataType}-${record.name}`}
expandable={{ defaultExpandAllRows: true, expandRowByClick: true }}
pagination={false}
/>
)}
</FeaturesContainer>
);
return <TableOfMlFeatures features={features} />;
}
Loading

0 comments on commit af26f97

Please sign in to comment.