Skip to content

Commit 4991daa

Browse files
fix(ui) Fix changing color and icon for domains in UI (#12792)
1 parent 6097820 commit 4991daa

File tree

10 files changed

+33
-46
lines changed

10 files changed

+33
-46
lines changed

datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/domain/DomainType.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ public class DomainType
4040
Constants.OWNERSHIP_ASPECT_NAME,
4141
Constants.INSTITUTIONAL_MEMORY_ASPECT_NAME,
4242
Constants.STRUCTURED_PROPERTIES_ASPECT_NAME,
43-
Constants.FORMS_ASPECT_NAME);
43+
Constants.FORMS_ASPECT_NAME,
44+
Constants.DISPLAY_PROPERTIES_ASPECT_NAME);
4445
private final EntityClient _entityClient;
4546

4647
public DomainType(final EntityClient entityClient) {

datahub-web-react/src/app/domain/DomainsList.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ export const DomainsList = () => {
196196
},
197197
ownership: null,
198198
entities: null,
199+
displayProperties: null,
199200
},
200201
pageSize,
201202
);

datahub-web-react/src/app/domain/utils.ts

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export const updateListDomainsCache = (
7272
children: null,
7373
dataProducts: null,
7474
parentDomains: null,
75+
displayProperties: null,
7576
},
7677
1000,
7778
parentDomain,

datahub-web-react/src/app/entityV2/shared/containers/profile/header/IconPicker/IconColorPicker.tsx

+3-45
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Input, Modal } from 'antd';
2-
import { debounce } from 'lodash';
32
import React from 'react';
43
import styled from 'styled-components';
54

@@ -53,13 +52,6 @@ const IconColorPicker: React.FC<IconColorPickerProps> = ({
5352
const [stagedColor, setStagedColor] = React.useState<string>(color || '#000000');
5453
const [stagedIcon, setStagedIcon] = React.useState<string>(icon || 'account_circle');
5554

56-
// a debounced version of updateDisplayProperties that takes in the same arguments
57-
// eslint-disable-next-line react-hooks/exhaustive-deps
58-
const debouncedUpdateDisplayProperties = React.useCallback(
59-
debounce((...args) => updateDisplayProperties(...args).then(() => setTimeout(() => refetch(), 1000)), 500),
60-
[],
61-
);
62-
6355
return (
6456
<Modal
6557
open={open}
@@ -77,7 +69,7 @@ const IconColorPicker: React.FC<IconColorPickerProps> = ({
7769
},
7870
},
7971
},
80-
});
72+
}).then(() => refetch());
8173
onChangeColor?.(stagedColor);
8274
onChangeIcon?.(stagedIcon);
8375
onClose();
@@ -93,44 +85,10 @@ const IconColorPicker: React.FC<IconColorPickerProps> = ({
9385
marginBottom: 30,
9486
marginTop: 15,
9587
}}
96-
onChange={(e) => {
97-
setStagedColor(e.target.value);
98-
debouncedUpdateDisplayProperties?.({
99-
variables: {
100-
urn,
101-
input: {
102-
colorHex: e.target.value,
103-
icon: {
104-
iconLibrary: IconLibrary.Material,
105-
name: stagedIcon,
106-
style: 'Outlined',
107-
},
108-
},
109-
},
110-
});
111-
}}
88+
onChange={(e) => setStagedColor(e.target.value)}
11289
/>
11390
<Title>Choose an icon for {name || 'Domain'}</Title>
114-
<ChatIconPicker
115-
color={stagedColor}
116-
onIconPick={(i) => {
117-
console.log('picking icon', i);
118-
debouncedUpdateDisplayProperties?.({
119-
variables: {
120-
urn,
121-
input: {
122-
colorHex: stagedColor,
123-
icon: {
124-
iconLibrary: IconLibrary.Material,
125-
name: capitalize(snakeToCamel(i)),
126-
style: 'Outlined',
127-
},
128-
},
129-
},
130-
});
131-
setStagedIcon(i);
132-
}}
133-
/>
91+
<ChatIconPicker color={stagedColor} onIconPick={(i) => setStagedIcon(i)} />
13492
</Modal>
13593
);
13694
};

datahub-web-react/src/graphql/domain.graphql

+6
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ query getDomain($urn: String!) {
4040
forms {
4141
...formsFields
4242
}
43+
displayProperties {
44+
...displayPropertiesFields
45+
}
4346
...domainEntitiesFields
4447
...notes
4548
}
@@ -64,6 +67,9 @@ query listDomains($input: ListDomainsInput!) {
6467
ownership {
6568
...ownershipFields
6669
}
70+
displayProperties {
71+
...displayPropertiesFields
72+
}
6773
...domainEntitiesFields
6874
}
6975
}

datahub-web-react/src/graphql/fragments.graphql

+9
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ fragment parentNodesFields on ParentNodesResult {
229229
properties {
230230
name
231231
}
232+
displayProperties {
233+
...displayPropertiesFields
234+
}
232235
}
233236
}
234237

@@ -238,6 +241,9 @@ fragment parentDomainsFields on ParentDomainsResult {
238241
urn
239242
type
240243
... on Domain {
244+
displayProperties {
245+
...displayPropertiesFields
246+
}
241247
properties {
242248
name
243249
description
@@ -1259,6 +1265,9 @@ fragment entityDomain on DomainAssociation {
12591265
...parentDomainsFields
12601266
}
12611267
...domainEntitiesFields
1268+
displayProperties {
1269+
...displayPropertiesFields
1270+
}
12621271
}
12631272
associatedUrn
12641273
}

datahub-web-react/src/graphql/glossaryNode.graphql

+3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ query getGlossaryNode($urn: String!) {
5454
}
5555
}
5656
}
57+
displayProperties {
58+
...displayPropertiesFields
59+
}
5760
...notes
5861
}
5962
}

datahub-web-react/src/graphql/preview.graphql

+3
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,9 @@ fragment entityPreview on Entity {
341341
parentDomains {
342342
...parentDomainsFields
343343
}
344+
displayProperties {
345+
...displayPropertiesFields
346+
}
344347
...domainEntitiesFields
345348
}
346349
... on Container {

datahub-web-react/src/graphql/search.graphql

+3
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,9 @@ fragment searchResultsWithoutSchemaField on Entity {
845845
parentDomains {
846846
...parentDomainsFields
847847
}
848+
displayProperties {
849+
...displayPropertiesFields
850+
}
848851
...domainEntitiesFields
849852
structuredProperties {
850853
properties {

metadata-models/src/main/resources/entity-registry.yml

+2
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ entities:
236236
- structuredProperties
237237
- forms
238238
- testResults
239+
- displayProperties
239240
- name: container
240241
doc: A container of related data assets.
241242
category: core
@@ -295,6 +296,7 @@ entities:
295296
- structuredProperties
296297
- forms
297298
- testResults
299+
- displayProperties
298300
- name: dataHubIngestionSource
299301
category: internal
300302
keyAspect: dataHubIngestionSourceKey

0 commit comments

Comments
 (0)