Skip to content
Snippets Groups Projects
Unverified Commit 2fdb2c33 authored by Mahatthana (Kelvin) Nomsawadi's avatar Mahatthana (Kelvin) Nomsawadi Committed by GitHub
Browse files

Fix various issue when handling null user names (#23376)

* Remove unused file

* Fix user name not showing in admin audit

* Fix receiving wrong prop name

* Fix collection UI broken when showing editor's long email
parent fbea1e21
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ import {
SortingIcon,
SortingControlContainer,
TBody,
LastEditedByCol,
} from "./BaseItemsTable.styled";
const sortingOptsShape = PropTypes.shape({
......@@ -127,7 +128,7 @@ function BaseItemsTable({
<colgroup>
<col style={{ width: "70px" }} />
<col />
<col style={{ width: "140px" }} />
<LastEditedByCol />
<col style={{ width: "140px" }} />
<col style={{ width: "100px" }} />
</colgroup>
......
import styled from "@emotion/styled";
import { color } from "metabase/lib/colors";
import { breakpointMaxMedium } from "metabase/styled-components/theme/media-queries";
import {
breakpointMaxMedium,
breakpointMinLarge,
} from "metabase/styled-components/theme/media-queries";
import EntityItem from "metabase/components/EntityItem";
import Icon from "metabase/components/Icon";
......@@ -34,6 +37,14 @@ export const ColumnHeader = styled.th`
color: ${color("text-medium")};
`;
export const LastEditedByCol = styled.col`
width: 140px;
${breakpointMinLarge} {
width: 240px;
}
`;
export const ItemCell = styled.td`
padding: 0.25em 0 0.25em 1em !important;
`;
......
......@@ -6,6 +6,7 @@ import { PLUGIN_MODERATION } from "metabase/plugins";
import ItemDragSource from "metabase/containers/dnd/ItemDragSource";
import Ellipsified from "metabase/core/components/Ellipsified";
import EntityItem from "metabase/components/EntityItem";
import DateTime from "metabase/components/DateTime";
import Tooltip from "metabase/components/Tooltip";
......@@ -120,7 +121,7 @@ export function BaseTableItem({
</ItemLink>
</ItemCell>
<ItemCell data-testid={`${testId}-last-edited-by`}>
<TableItemSecondaryField>{lastEditedBy}</TableItemSecondaryField>
<Ellipsified>{lastEditedBy}</Ellipsified>
</ItemCell>
<ItemCell data-testid={`${testId}-last-edited-at`}>
{lastEditInfo && (
......
/* eslint-disable react/prop-types */
import React from "react";
import Collection from "metabase/entities/collections";
import Search from "metabase/entities/search";
const PINNED_DASHBOARDS_LOAD_LIMIT = 500;
const CollectionItemsLoader = ({ collectionId, children, ...props }) => (
<Collection.Loader {...props} id={collectionId}>
{({ object }) => (
<Search.ListLoader
{...props}
query={{
collection: collectionId,
pinned_state: "is_pinned",
sort_column: "name",
sort_direction: "asc",
models: "dashboard",
limit: PINNED_DASHBOARDS_LOAD_LIMIT,
}}
wrapped
>
{({ list }) =>
object &&
list &&
children({
collection: object,
items: list,
})
}
</Search.ListLoader>
)}
</Collection.Loader>
);
export default CollectionItemsLoader;
......@@ -3,11 +3,11 @@ import React from "react";
import EntityObjectLoader from "./EntityObjectLoader";
const EntityName = ({ entityType, entityId, name = "name" }) => (
const EntityName = ({ entityType, entityId, property = "name" }) => (
<EntityObjectLoader
entityType={entityType}
entityId={entityId}
properties={[name]}
properties={[property]}
loadingAndErrorWrapper={false}
wrapped
>
......
......@@ -29,6 +29,10 @@ const Users = createEntity({
path: "/api/user",
objectSelectors: {
getName: user => user.common_name,
},
actionTypes: {
DEACTIVATE,
REACTIVATE,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment