Skip to content

Commit

Permalink
Merge branch 'datahub-project:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
anshbansal authored Mar 5, 2024
2 parents 5f74d4f + 782d33d commit d64cbce
Show file tree
Hide file tree
Showing 104 changed files with 9,817 additions and 265 deletions.
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ buildscript {
ext.hazelcastVersion = '5.3.6'
ext.ebeanVersion = '12.16.1'
ext.googleJavaFormatVersion = '1.18.1'
ext.openLineageVersion = '1.5.0'
ext.logbackClassicJava8 = '1.2.12'

ext.docker_registry = 'linkedin'

Expand Down Expand Up @@ -176,6 +178,7 @@ project.ext.externalDependency = [
'kafkaClients': "org.apache.kafka:kafka-clients:$kafkaVersion",
'snappy': 'org.xerial.snappy:snappy-java:1.1.10.4',
'logbackClassic': "ch.qos.logback:logback-classic:$logbackClassic",
'logbackClassicJava8' : "ch.qos.logback:logback-classic:$logbackClassicJava8",
'slf4jApi': "org.slf4j:slf4j-api:$slf4jVersion",
'log4jCore': "org.apache.logging.log4j:log4j-core:$log4jVersion",
'log4jApi': "org.apache.logging.log4j:log4j-api:$log4jVersion",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.datahub.authorization.DisjunctivePrivilegeGroup;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.linkedin.common.url.Url;
import com.linkedin.common.urn.Urn;
import com.linkedin.common.urn.UrnUtils;
import com.linkedin.data.template.RecordTemplate;
Expand Down Expand Up @@ -231,6 +232,9 @@ private RecordTemplate mapCorpGroupEditableInfo(
if (input.getEmail() != null) {
result.setEmail(input.getEmail());
}
if (input.getPictureLink() != null) {
result.setPictureLink(new Url(input.getPictureLink()));
}
return result;
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.linkedin.datahub.graphql.types.corpgroup.mappers;

import com.linkedin.data.template.GetMode;
import com.linkedin.data.template.RecordTemplate;
import com.linkedin.datahub.graphql.generated.CorpGroupEditableProperties;
import com.linkedin.datahub.graphql.types.mappers.ModelMapper;
import javax.annotation.Nonnull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Maps Pegasus {@link RecordTemplate} objects to objects conforming to the GQL schema.
Expand All @@ -14,6 +17,9 @@ public class CorpGroupEditablePropertiesMapper
implements ModelMapper<
com.linkedin.identity.CorpGroupEditableInfo, CorpGroupEditableProperties> {

private final Logger _logger =
LoggerFactory.getLogger(CorpGroupEditablePropertiesMapper.class.getName());

public static final CorpGroupEditablePropertiesMapper INSTANCE =
new CorpGroupEditablePropertiesMapper();

Expand All @@ -29,6 +35,13 @@ public CorpGroupEditableProperties apply(
result.setDescription(corpGroupEditableInfo.getDescription(GetMode.DEFAULT));
result.setSlack(corpGroupEditableInfo.getSlack(GetMode.DEFAULT));
result.setEmail(corpGroupEditableInfo.getEmail(GetMode.DEFAULT));
com.linkedin.common.url.Url pictureLinkObject =
corpGroupEditableInfo.getPictureLink(GetMode.NULL);
String pictureLink = null;
if (pictureLinkObject != null) {
pictureLink = pictureLinkObject.toString();
}
result.setPictureLink(pictureLink);
return result;
}
}
10 changes: 10 additions & 0 deletions datahub-graphql-core/src/main/resources/entity.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -4077,6 +4077,11 @@ type CorpGroupEditableProperties {
Email address for the group
"""
email: String

"""
A URL which points to a picture which user wants to set as a profile photo
"""
pictureLink: String
}

"""
Expand All @@ -4097,6 +4102,11 @@ input CorpGroupUpdateInput {
Email address for the group
"""
email: String

"""
A URL which points to a picture which user wants to set as a profile photo
"""
pictureLink: String
}

"""
Expand Down
17 changes: 17 additions & 0 deletions datahub-web-react/src/app/entity/group/GroupEditModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type PropsData = {
email: string | undefined;
slack: string | undefined;
urn: string | undefined;
photoUrl: string | undefined;
};

type Props = {
Expand All @@ -27,6 +28,7 @@ export default function GroupEditModal({ visible, onClose, onSave, editModalData
slack: editModalData.slack,
email: editModalData.email,
urn: editModalData.urn,
photoUrl: editModalData.photoUrl,
});

useEffect(() => {
Expand All @@ -41,6 +43,7 @@ export default function GroupEditModal({ visible, onClose, onSave, editModalData
input: {
email: data.email,
slack: data.slack,
pictureLink: data.photoUrl,
},
},
})
Expand All @@ -55,6 +58,7 @@ export default function GroupEditModal({ visible, onClose, onSave, editModalData
email: '',
slack: '',
urn: '',
photoUrl: '',
});
})
.catch((e) => {
Expand Down Expand Up @@ -125,6 +129,19 @@ export default function GroupEditModal({ visible, onClose, onSave, editModalData
onChange={(event) => setData({ ...data, slack: event.target.value })}
/>
</Form.Item>

<Form.Item
name="photoUrl"
label={<Typography.Text strong>Image URL</Typography.Text>}
rules={[{ whitespace: true }, { type: 'url', message: 'not valid url' }]}
hasFeedback
>
<Input
placeholder="https://www.example.com/photo.png"
value={data.photoUrl}
onChange={(event) => setData({ ...data, photoUrl: event.target.value })}
/>
</Form.Item>
</Form>
</Modal>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ export default function GroupInfoSidebar({ sideBarData, refetch }: Props) {
urn,
email,
slack,
photoUrl
};

// About Text save
Expand Down
2 changes: 1 addition & 1 deletion datahub-web-react/src/app/entity/group/GroupProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default function GroupProfile() {

// Side bar data
const sideBarData = {
photoUrl: undefined,
photoUrl: data?.corpGroup?.editableProperties?.pictureLink || undefined,
avatarName:
data?.corpGroup?.properties?.displayName ||
data?.corpGroup?.name ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ type Props = {
export default function UpdateDescriptionModal({ title, description, original, onClose, onSubmit, isAddDesc }: Props) {
const [updatedDesc, setDesc] = useState(description || original || '');

const handleEditorKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
if (
event.key === 'ArrowDown' ||
event.key === 'ArrowUp' ||
event.key === 'ArrowRight' ||
event.key === 'ArrowLeft'
) {
event.stopPropagation();
}
};

return (
<Modal
title={title}
Expand All @@ -53,7 +64,12 @@ export default function UpdateDescriptionModal({ title, description, original, o
>
<Form layout="vertical">
<Form.Item>
<StyledEditor content={updatedDesc} onChange={setDesc} dataTestId="description-editor" />
<StyledEditor
content={updatedDesc}
onChange={setDesc}
dataTestId="description-editor"
onKeyDown={handleEditorKeyDown}
/>
</Form.Item>
{!isAddDesc && description && original && (
<Form.Item label={<FormLabel>Original:</FormLabel>}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ type EditorProps = {
className?: string;
doNotFocus?: boolean;
dataTestId?: string;
onKeyDown?: (event: React.KeyboardEvent<HTMLDivElement>) => void;
};

export const Editor = forwardRef((props: EditorProps, ref) => {
const { content, readOnly, onChange, className, dataTestId } = props;
const { content, readOnly, onChange, className, dataTestId, onKeyDown } = props;
const { manager, state, getContext } = useRemirror({
extensions: () => [
new BlockquoteExtension(),
Expand Down Expand Up @@ -99,7 +100,7 @@ export const Editor = forwardRef((props: EditorProps, ref) => {
}, [readOnly, content]);

return (
<EditorContainer className={className} data-testid={dataTestId}>
<EditorContainer className={className} onKeyDown={onKeyDown} data-testid={dataTestId}>
<ThemeProvider theme={EditorTheme}>
<Remirror classNames={['ant-typography']} editable={!readOnly} manager={manager} initialContent={state}>
{!readOnly && (
Expand Down
2 changes: 1 addition & 1 deletion datahub-web-react/src/app/identity/group/GroupListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default function GroupListItem({ group, onDelete, selectRoleOptions, refe
<GroupItemContainer>
<Link to={`${entityRegistry.getEntityUrl(EntityType.CorpGroup, group.urn)}`}>
<GroupHeaderContainer>
<CustomAvatar size={32} name={displayName} />
<CustomAvatar size={32} name={displayName} photoUrl={group?.editableProperties?.pictureLink || undefined}/>
<div style={{ marginLeft: 16, marginRight: 16 }}>
<div>
<Typography.Text>{displayName}</Typography.Text>
Expand Down
3 changes: 3 additions & 0 deletions datahub-web-react/src/app/identity/group/cacheUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ const createFullGroup = (baseGroup) => {
},
memberCount: null,
roles: null,
editableProperties: {
pictureLink: null,
},
};
};

Expand Down
Loading

0 comments on commit d64cbce

Please sign in to comment.