Skip to content

Commit

Permalink
UI: Display feature key column in feature table (#569)
Browse files Browse the repository at this point in the history
* Add key column in feature list page

* Fix lint issues

* Change Key to Entity Key
  • Loading branch information
blrchen committed Aug 11, 2022
1 parent 3f41393 commit ee90093
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 39 deletions.
16 changes: 3 additions & 13 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ Hey! Thank you for the contribution! Please go through https://github.com/linked
Describe
- What changes to make and why you are making these changes.
- How are you going to achieve your goal Describe what testings you have done, for example, performance testing etc.
- How are you going to achieve your goal. Describe what testings you have done, for example, performance testing etc.
If this PR resolves an issue be sure to include "Resolves #XXX" to correctly link and close the issue upon merge.
-->

Resolves #XXX

## How was this patch tested?
## How was this PR tested?
<!--
If you're unsure about what to test, where to add tests, or how to run tests, please feel free to ask. We'd be happy to help.
-->
Expand All @@ -22,14 +22,4 @@ If yes, please clarify the previous behavior and the change this PR proposes - p
If no, choose 'No'.
-->
- [ ] No. You can skip the rest of this section.
- [ ] Yes. Make sure to clarify your proposed changes.

## Dependencies
<!--
Please list the new dependencies in the PR description with
- What's their license
- Are they compatible with our license
-->
- [ ] No. You can skip the rest of this section.
- [ ] Yes. Make sure to list all the dependencies and licenses.
- [ ] Yes. Make sure to clarify your proposed changes.
1 change: 1 addition & 0 deletions ui/src/components/dataSourceList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ const DataSourceList: React.FC = () => {
value={project}
optionFilterProp="label"
notFoundContent={<div>No projects found from server</div>}
showSearch={true}
onChange={onProjectChange}
></Select>
</Form.Item>
Expand Down
44 changes: 31 additions & 13 deletions ui/src/components/featureList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const FeatureList: React.FC = () => {
{
title: <div>Type</div>,
key: "type",
width: 120,
width: 80,
render: (name: string, row: Feature) => {
return (
<div>{row.typeName.replace("feathr_", "").replace("_v1", "")}</div>
Expand All @@ -63,11 +63,9 @@ const FeatureList: React.FC = () => {
key: "transformation",
width: 190,
render: (name: string, row: Feature) => {
const transformation = row.attributes.transformation;
return (
<div>
{row.attributes.transformation.transformExpr ??
row.attributes.transformation.defExpr}
</div>
<div>{transformation.transformExpr ?? transformation.defExpr}</div>
);
},
onCell: () => {
Expand All @@ -78,24 +76,44 @@ const FeatureList: React.FC = () => {
};
},
},
{
title: <div>Entity Key</div>,
key: "aggregation",
width: 80,
render: (name: string, row: Feature) => {
const key = row.attributes.key && row.attributes.key[0];
if ("NOT_NEEDED" !== key.keyColumn) {
return (
<div>
{key.keyColumn && `${key.keyColumn}`}{" "}
{key.keyColumnType && `(${key.keyColumnType})`}
</div>
);
} else {
return <div>N/A</div>;
}
},
onCell: () => {
return {
style: {
maxWidth: 120,
},
};
},
},
{
title: <div>Aggregation</div>,
key: "aggregation",
width: 150,
render: (name: string, row: Feature) => {
const transformation = row.attributes.transformation;
return (
<>
<div>
{row.attributes.transformation.aggFunc &&
`Type: ${row.attributes.transformation.aggFunc}`}
</div>
<div>
{row.attributes.transformation.aggFunc &&
`Window: ${row.attributes.transformation.window}`}
{transformation.aggFunc && `Type: ${transformation.aggFunc}`}
</div>
<div>
{row.attributes.transformation.aggFunc &&
`Key: ${row.attributes.key[0].keyColumn}`}
{transformation.aggFunc && `Window: ${transformation.window}`}
</div>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/graph/graphNodeDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const GraphNodeDetails: React.FC = () => {
)}
{feature?.attributes.key && feature.attributes.key.length > 0 && (
<Card>
<Title level={4}>Key</Title>
<Title level={4}>Entity Key</Title>
<p>Full name: {feature.attributes.key[0].fullName}</p>
<p>Description: {feature.attributes.key[0].description}</p>
<p>Key column: {feature.attributes.key[0].keyColumn}</p>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/roleManagementForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const RoleManagementForm: React.FC<RoleManagementFormProps> = ({
label="User Name"
rules={[{ required: true }]}
>
<Input disabled={!editMode} placeholder="Email Account or App Id"/>
<Input disabled={!editMode} placeholder="Email Account or App Id" />
</Form.Item>
<Form.Item
name="roleName"
Expand Down
1 change: 0 additions & 1 deletion ui/src/components/userRoles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
Button,
Menu,
message,
PageHeader,
Popconfirm,
Row,
Space,
Expand Down
19 changes: 9 additions & 10 deletions ui/src/pages/feature/featureDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@ import { getElements } from "../../components/graph/utils";

const { Title } = Typography;

function FeatureKey(props: { feature: Feature }) {
const FeatureKey = (props: { feature: Feature }) => {
const keys = props.feature.attributes.key;
console.log(props.feature.attributes);
return (
<>
{keys && keys.length > 0 && (
<Col span={24}>
<Card className="card">
<Title level={4}>Key</Title>
<Title level={4}>Entity Key</Title>
<div className="feature-container">
<p>Full Name: {keys[0].fullName}</p>
<p>Key Column: {keys[0].keyColumn}</p>
Expand All @@ -35,9 +34,9 @@ function FeatureKey(props: { feature: Feature }) {
)}
</>
);
}
};

function FeatureType(props: { feature: Feature }) {
const FeatureType = (props: { feature: Feature }) => {
const type = props.feature.attributes.type;
return (
<>
Expand All @@ -56,9 +55,9 @@ function FeatureType(props: { feature: Feature }) {
)}
</>
);
}
};

function FeatureTransformation(props: { feature: Feature }) {
const FeatureTransformation = (props: { feature: Feature }) => {
const transformation = props.feature.attributes.transformation;
return (
<>
Expand Down Expand Up @@ -88,9 +87,9 @@ function FeatureTransformation(props: { feature: Feature }) {
)}
</>
);
}
};

function InputAnchorFeatures(props: { project: string; feature: Feature }) {
const InputAnchorFeatures = (props: { project: string; feature: Feature }) => {
const navigate = useNavigate();
const inputAnchorFeatures = props.feature.attributes.inputAnchorFeatures;
return (
Expand Down Expand Up @@ -124,7 +123,7 @@ function InputAnchorFeatures(props: { project: string; feature: Feature }) {
)}
</>
);
}
};

function InputDerivedFeatures(props: { project: string; feature: Feature }) {
const navigate = useNavigate();
Expand Down

0 comments on commit ee90093

Please sign in to comment.