Skip to content

fix(ui): added context device model and model_id #18224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ type Props = {
const deviceKnownDataValues = [
DeviceKnownDataType.NAME,
DeviceKnownDataType.FAMILY,
DeviceKnownDataType.RENDERED_MODEL,
DeviceKnownDataType.CPU_DESCRIPTION,
DeviceKnownDataType.ARCH,
DeviceKnownDataType.BATTERY_LEVEL,
Expand All @@ -38,6 +37,7 @@ const deviceKnownDataValues = [
DeviceKnownDataType.SCREEN_HEIGHT_PIXELS,
DeviceKnownDataType.SCREEN_RESOLUTION,
DeviceKnownDataType.SCREEN_WIDTH_PIXELS,
DeviceKnownDataType.MODEL,
];

const Device = ({data}: Props) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ function getDeviceKnownDataDetails(data: DeviceData, type: DeviceKnownDataType):
subject: t('Family'),
value: data.family,
};
case DeviceKnownDataType.RENDERED_MODEL:
case DeviceKnownDataType.MODEL:
return {
subject: t('Model'),
value:
typeof data.model === 'string' ? (
<DeviceName
value={`${data.model} ${data.model_id ? `(${data.model_id})` : ''}`}
value={`${data.model} ${data?.model_id ? `(${data.model_id})` : ''}`}
/>
) : (
undefined
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ export enum DeviceKnownDataType {
NAME = 'name',
FAMILY = 'family',
RENDERED_MODEL = 'renderedModel',
MODEL = 'model',
MODEL_ID = 'model_id',
CPU_DESCRIPTION = 'cpu_description',
ARCH = 'arch',
BATTERY_LEVEL = 'battery_level',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ const KeyValueList = ({
{getData().map(
({key, subject, value = null, meta, subjectIcon, subjectDataTestId}) => {
const dataValue =
typeof value === 'object' ? JSON.stringify(value, null, 2) : value;
typeof value === 'object' && !React.isValidElement(value)
? JSON.stringify(value, null, 2)
: value;
return (
<tr key={key}>
<TableSubject className="key" wide={longKeys}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const AnnotatedText = ({value, chunks, errors, remarks, ...props}) => (
);

AnnotatedText.propTypes = {
value: PropTypes.string,
value: PropTypes.node,
chunks: PropTypes.array,
errors: PropTypes.array,
remarks: PropTypes.array,
Expand Down