forked from datahub-project/datahub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Allow specifying Data Product URN via UI (datahub-project#9386)
Co-authored-by: Aseem Bansal <[email protected]>
- Loading branch information
1 parent
d1ea901
commit 718ee59
Showing
9 changed files
with
137 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
datahub-web-react/src/app/entity/domain/DataProductsTab/DataProductAdvancedOption.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import React from "react"; | ||
import { Collapse, Form, Input, Typography } from "antd"; | ||
import styled from "styled-components"; | ||
import { validateCustomUrnId } from '../../../shared/textUtil'; | ||
import { DataProductBuilderFormProps } from "./types"; | ||
|
||
|
||
const FormItem = styled(Form.Item)` | ||
.ant-form-item-label { | ||
padding-bottom: 2px; | ||
} | ||
`; | ||
|
||
const FormItemWithMargin = styled(FormItem)` | ||
margin-bottom: 16px; | ||
`; | ||
|
||
const FormItemNoMargin = styled(FormItem)` | ||
margin-bottom: 0; | ||
`; | ||
|
||
const AdvancedLabel = styled(Typography.Text)` | ||
color: #373d44; | ||
`; | ||
|
||
export function DataProductAdvancedOption({builderState, updateBuilderState }: DataProductBuilderFormProps){ | ||
|
||
function updateDataProductId(id: string) { | ||
updateBuilderState({ | ||
...builderState, | ||
id, | ||
}); | ||
} | ||
|
||
return ( | ||
<Collapse ghost> | ||
<Collapse.Panel header={<AdvancedLabel>Advanced Options</AdvancedLabel>} key="1"> | ||
<FormItemWithMargin | ||
label={<Typography.Text strong>Data Product Id</Typography.Text>} | ||
help="By default, a random UUID will be generated to uniquely identify this data product. If | ||
you'd like to provide a custom id instead to more easily keep track of this data product, | ||
you may provide it here. Be careful, you cannot easily change the data product id after | ||
creation." | ||
> | ||
<FormItemNoMargin | ||
rules={[ | ||
() => ({ | ||
validator(_, value) { | ||
if (value && validateCustomUrnId(value)) { | ||
return Promise.resolve(); | ||
} | ||
return Promise.reject(new Error('Please enter a valid Data product id')); | ||
}, | ||
}), | ||
]} | ||
> | ||
<Input | ||
data-testid="data-product-id" | ||
placeholder="engineering" | ||
value={builderState.id} | ||
onChange={(e) => updateDataProductId(e.target.value)} | ||
/> | ||
</FormItemNoMargin> | ||
</FormItemWithMargin> | ||
</Collapse.Panel> | ||
</Collapse> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
datahub-web-react/src/app/entity/domain/DataProductsTab/types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
export type DataProductBuilderState = { | ||
name: string; | ||
id?: string; | ||
description?: string; | ||
}; | ||
|
||
export type DataProductBuilderFormProps = { | ||
builderState: DataProductBuilderState; | ||
updateBuilderState: (newState: DataProductBuilderState) => void; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters