diff --git a/src/app/devices/pnp/components/deviceProperties/__snapshots__/devicePropertiesPerInterface.spec.tsx.snap b/src/app/devices/pnp/components/deviceProperties/__snapshots__/devicePropertiesPerInterface.spec.tsx.snap index 958840bc..2d72ec61 100644 --- a/src/app/devices/pnp/components/deviceProperties/__snapshots__/devicePropertiesPerInterface.spec.tsx.snap +++ b/src/app/devices/pnp/components/deviceProperties/__snapshots__/devicePropertiesPerInterface.spec.tsx.snap @@ -8,6 +8,7 @@ exports[`devicePropertiesPerInterface matches snapshot 1`] = ` className="list-detail pnp-properties" > = items={props.twinAndSchema} columns={getColumns()} layoutMode={DetailsListLayoutMode.justified} + ariaLabel={t(ResourceKeys.deviceProperties.propertiesTableAriaLabel)} /> {showOverlay && } {createReportedValuePanel()} diff --git a/src/app/devices/pnp/components/deviceSettings/__snapshots__/deviceSettingsPerInterface.spec.tsx.snap b/src/app/devices/pnp/components/deviceSettings/__snapshots__/deviceSettingsPerInterface.spec.tsx.snap index 70b1c173..b9e84626 100644 --- a/src/app/devices/pnp/components/deviceSettings/__snapshots__/deviceSettingsPerInterface.spec.tsx.snap +++ b/src/app/devices/pnp/components/deviceSettings/__snapshots__/deviceSettingsPerInterface.spec.tsx.snap @@ -5,6 +5,7 @@ exports[`components/devices/deviceSettingsPerInterface matches snapshot 1`] = ` className="pnp-detail-list pnp-properties scrollable-lg" > {createReportedValuePanel()} {showOverlay && } diff --git a/src/app/devices/shared/components/simpleReportedSection.tsx b/src/app/devices/shared/components/simpleReportedSection.tsx index a740731d..8f1440f3 100644 --- a/src/app/devices/shared/components/simpleReportedSection.tsx +++ b/src/app/devices/shared/components/simpleReportedSection.tsx @@ -3,7 +3,7 @@ * Licensed under the MIT License **********************************************************/ import * as React from 'react'; -import { Validator, ValidationError } from 'jsonschema'; +import { Validator, ValidationError, ValidatorResult } from 'jsonschema'; import { Label } from '@fluentui/react'; import { useTranslation } from 'react-i18next'; import { ParsedJsonSchema } from '../../../api/models/interfaceJsonParserOutput'; @@ -13,7 +13,10 @@ import { ResourceKeys } from '../../../../localization/resourceKeys'; // tslint:disable-next-line: cyclomatic-complexity export const RenderSimplyTypeValue = (twin: any, schema: ParsedJsonSchema, displayValue: any, desired: boolean=false) => { // tslint:disable-line:no-any const validator = new Validator(); - const result = validator.validate(twin, schema); + let result: ValidatorResult | undefined; + if((schema as any)['$id'] || (schema as any)['id']){ + result = validator.validate(twin, schema); + } const getDisplayValue = () => { if (typeof(twin) === 'object') { const twinCopy = { diff --git a/src/app/shared/resizeDetailsList/__snapshots__/resizableDetailsList.spec.tsx.snap b/src/app/shared/resizeDetailsList/__snapshots__/resizableDetailsList.spec.tsx.snap index 6c9209bc..4d8a0411 100644 --- a/src/app/shared/resizeDetailsList/__snapshots__/resizableDetailsList.spec.tsx.snap +++ b/src/app/shared/resizeDetailsList/__snapshots__/resizableDetailsList.spec.tsx.snap @@ -3,6 +3,7 @@ exports[`ResizableDetailsList matches snapshot 1`] = ` = props => { +export interface ResizableDetailsListProps extends IDetailsListProps { + ariaLabel?: string; +} + +export const ResizableDetailsList: React.FC = props => { const { t } = useTranslation(); const { ariaLabelForSelectionColumn, ariaLabelForSelectAllCheckbox, checkButtonAriaLabel, - items, columns, selection, selectionMode, layoutMode, checkboxVisibility, className, onRenderItemColumn } = props; + items, columns, selection, selectionMode, layoutMode, checkboxVisibility, className, onRenderItemColumn, ariaLabel, ...restProps } = props; const [ isDialogHidden, setIsDialogHidden] = React.useState(true); const [ contextualMenuProps, setContextualMenuProps] = React.useState(undefined); @@ -60,6 +64,8 @@ export const ResizableDetailsList: React.FC = props => { selection={selection} selectionMode={selectionMode} onRenderItemColumn={onRenderItemColumn} + ariaLabelForGrid={ariaLabel || t(ResourceKeys.resizableDetailsList.defaultAriaLabel)} + {...restProps} /> {contextualMenuProps && } => { const serialized = JSON.stringify(value); - const credentialsApi = getCredentialsInterface(); try { + const credentialsApi = getCredentialsInterface(); const isAvailable = await credentialsApi.isEncryptionAvailable(); if (isAvailable) { await credentialsApi.store(CONN_STRINGS_KEY, serialized); @@ -38,9 +38,8 @@ export const storeConnectionStrings = async (value: ConnectionStringWithExpiry[] * with automatic migration from localStorage if needed. */ export const getConnectionStrings = async (): Promise => { - const credentialsApi = getCredentialsInterface(); - try { + const credentialsApi = getCredentialsInterface(); const isAvailable = await credentialsApi.isEncryptionAvailable(); if (isAvailable) { const encrypted = await credentialsApi.get(CONN_STRINGS_KEY); @@ -74,9 +73,8 @@ export const getConnectionStrings = async (): Promise => { - const credentialsApi = getCredentialsInterface(); - try { + const credentialsApi = getCredentialsInterface(); await credentialsApi.delete(CONN_STRINGS_KEY); } catch (error) { // tslint:disable-next-line: no-console diff --git a/src/localization/locales/en.json b/src/localization/locales/en.json index 4bf2e951..7a3bd510 100644 --- a/src/localization/locales/en.json +++ b/src/localization/locales/en.json @@ -50,7 +50,8 @@ "buttons": { "resize": "Resize", "cancel": "Cancel" - } + }, + "defaultAriaLabel": "Data table" }, "header": { "applicationName": "Azure IoT Explorer", @@ -481,6 +482,7 @@ }, "headerText": "Read-only properties", "noProperties": "ComponentName {{componentName}} contains no read-only property definitions", + "propertiesTableAriaLabel": "Device properties table with name, value, schema, and unit columns", "columns": { "name": "Name (Display Name / Description)", "value": "Value", @@ -525,7 +527,8 @@ }, "panel": { "title": "Reported value" - } + }, + "writablePropertiesTableAriaLabel": "Writable properties table with name, schema, unit, desired value, and reported value columns" }, "deviceCommands": { "command" : { diff --git a/src/localization/resourceKeys.ts b/src/localization/resourceKeys.ts index aad7ace9..187baf9b 100644 --- a/src/localization/resourceKeys.ts +++ b/src/localization/resourceKeys.ts @@ -676,6 +676,7 @@ export class ResourceKeys { }, headerText : "deviceProperties.headerText", noProperties : "deviceProperties.noProperties", + propertiesTableAriaLabel : "deviceProperties.propertiesTableAriaLabel", }; public static deviceSettings = { ackStatus : { @@ -711,6 +712,7 @@ export class ResourceKeys { panel : { title : "deviceSettings.panel.title", }, + writablePropertiesTableAriaLabel : "deviceSettings.writablePropertiesTableAriaLabel", }; public static deviceTwin = { command : { @@ -1008,6 +1010,7 @@ export class ResourceKeys { subText : "resizableDetailsList.content.subText", title : "resizableDetailsList.content.title", }, + defaultAriaLabel : "resizableDetailsList.defaultAriaLabel", }; public static settings = { close : "settings.close",