diff --git a/src/app/api/models/deviceQuery.ts b/src/app/api/models/deviceQuery.ts index 270d99c34..fffb1471f 100644 --- a/src/app/api/models/deviceQuery.ts +++ b/src/app/api/models/deviceQuery.ts @@ -17,12 +17,8 @@ export interface QueryClause { } export enum ParameterType { - // non pnp edge = 'capabilities.iotEdge', status = 'status', - // pnp - capabilityModelId = 'dcm', - interfaceId = 'interface', } export enum OperationType { diff --git a/src/app/api/parameters/repoParameters.ts b/src/app/api/parameters/repoParameters.ts index 060ea0f73..a826f3c37 100644 --- a/src/app/api/parameters/repoParameters.ts +++ b/src/app/api/parameters/repoParameters.ts @@ -5,6 +5,5 @@ export interface FetchModelParameters { id: string; expand?: boolean; - repoServiceHostName: string; token?: string; } diff --git a/src/app/api/services/publicDigitalTwinsModelRepoService.spec.ts b/src/app/api/services/publicDigitalTwinsModelRepoService.spec.ts index 35e7e76ce..1397dc539 100644 --- a/src/app/api/services/publicDigitalTwinsModelRepoService.spec.ts +++ b/src/app/api/services/publicDigitalTwinsModelRepoService.spec.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License **********************************************************/ import * as DigitalTwinsModelService from './publicDigitalTwinsModelRepoService'; -import { API_VERSION, MODEL_REPO_API_VERSION, HTTP_OPERATION_TYPES, PUBLIC_REPO_HOSTNAME_TEST } from '../../constants/apiConstants'; +import { API_VERSION, MODEL_REPO_API_VERSION, HTTP_OPERATION_TYPES, PUBLIC_REPO_HOSTNAME_TEST, PUBLIC_REPO_HOSTNAME } from '../../constants/apiConstants'; describe('digitalTwinsModelService', () => { @@ -11,7 +11,6 @@ describe('digitalTwinsModelService', () => { const parameters = { expand: undefined, id: 'urn:azureiot:ModelDiscovery:ModelInformation:1', - repoServiceHostName: 'canary-repo.azureiotrepository.com', token: 'SharedAccessSignature sr=canary-repo.azureiotrepository.com&sig=123&rid=repositoryId' }; @@ -60,7 +59,7 @@ describe('digitalTwinsModelService', () => { const apiVersionQuerySTring = `?${API_VERSION}${MODEL_REPO_API_VERSION}`; const queryString = `${apiVersionQuerySTring}${expandQueryString}`; const modelIdentifier = encodeURIComponent(parameters.id); - const resourceUrl = `https://${parameters.repoServiceHostName}/models/${modelIdentifier}${queryString}`; + const resourceUrl = `https://${PUBLIC_REPO_HOSTNAME}/models/${modelIdentifier}${queryString}`; const controllerRequest = { headers: { diff --git a/src/app/api/services/publicDigitalTwinsModelRepoService.ts b/src/app/api/services/publicDigitalTwinsModelRepoService.ts index 8e471703c..c8dde730a 100644 --- a/src/app/api/services/publicDigitalTwinsModelRepoService.ts +++ b/src/app/api/services/publicDigitalTwinsModelRepoService.ts @@ -10,6 +10,7 @@ import { HEADERS, MODELREPO, MODEL_REPO_API_VERSION, + PUBLIC_REPO_HOSTNAME, PUBLIC_REPO_HOSTNAME_TEST, HTTP_OPERATION_TYPES } from '../../constants/apiConstants'; import { PnPModel } from '../models/metamodelMetadata'; @@ -20,7 +21,7 @@ export const fetchModel = async (parameters: FetchModelParameters): Promise { it('builds query string', () => { - expect(utils.buildQueryString( - { - clauses: [ - { - operation: OperationType.equals, - parameterType: ParameterType.capabilityModelId, - value: 'enabled' - } - ], - continuationTokens: [], - currentPageIndex: 1, - deviceId: '', - } - )).toEqual(`${LIST_PLUG_AND_PLAY_DEVICES} WHERE (HAS_CAPABILITYMODEL('enabled'))`); expect(utils.buildQueryString( { clauses: [], @@ -31,6 +17,7 @@ describe('utils', () => { deviceId: 'device1', } )).toEqual(`${LIST_PLUG_AND_PLAY_DEVICES} WHERE STARTSWITH(devices.deviceId, 'device1')`); + expect(utils.buildQueryString( { clauses: [], @@ -39,9 +26,11 @@ describe('utils', () => { deviceId: '', } )).toEqual(LIST_PLUG_AND_PLAY_DEVICES + ' '); + expect(utils.buildQueryString( null )).toEqual(LIST_PLUG_AND_PLAY_DEVICES); + expect(utils.buildQueryString( { clauses: [ @@ -56,6 +45,7 @@ describe('utils', () => { deviceId: '', } )).toEqual(`${LIST_PLUG_AND_PLAY_DEVICES} WHERE (${ParameterType.edge}=true)`); + expect(utils.buildQueryString( { clauses: [ @@ -73,22 +63,6 @@ describe('utils', () => { }); it('converts query object to string', () => { - expect(utils.queryToString( - { - clauses: [ - { - operation: OperationType.equals, - parameterType: ParameterType.capabilityModelId, - value: 'enabled' - }, - { - } - ], - continuationTokens: [], - currentPageIndex: 1, - deviceId: '', - } - )).toEqual(`WHERE (HAS_CAPABILITYMODEL('enabled'))`); expect(utils.queryToString( { clauses: [], @@ -97,6 +71,7 @@ describe('utils', () => { deviceId: 'device1', } )).toEqual(`WHERE STARTSWITH(devices.deviceId, 'device1')`); + expect(utils.queryToString( { clauses: [], @@ -121,22 +96,6 @@ describe('utils', () => { value: 'disabled' } ])).toEqual(`status='enabled' AND status='disabled'`); - - expect(utils.clauseListToString([ - { - operation: OperationType.equals, - parameterType: ParameterType.capabilityModelId, - value: 'enabled' - } - ])).toEqual(`HAS_CAPABILITYMODEL('enabled')`); - - expect(utils.clauseListToString([ - { - operation: OperationType.equals, - parameterType: ParameterType.interfaceId, - value: 'enabled' - } - ])).toEqual(`HAS_INTERFACE('enabled')`); }); it('creates clause item as string', () => { diff --git a/src/app/api/shared/utils.ts b/src/app/api/shared/utils.ts index 20395b328..e503adeb2 100644 --- a/src/app/api/shared/utils.ts +++ b/src/app/api/shared/utils.ts @@ -99,10 +99,6 @@ export const clauseListToString = (clauses: QueryClause[]) => { export const clauseToString = (clause: QueryClause) => { switch (clause.parameterType) { - case ParameterType.capabilityModelId: - return toPnPClause(PnPQueryPrefix.HAS_CAPABILITY_MODEL, clause.value); - case ParameterType.interfaceId: - return toPnPClause(PnPQueryPrefix.HAS_INTERFACE, clause.value); case ParameterType.edge: return toEdgeClause(clause.parameterType, clause.value); case ParameterType.status: diff --git a/src/app/constants/modelDefinitionConstants.ts b/src/app/constants/modelDefinitionConstants.ts deleted file mode 100644 index 2106fcfda..000000000 --- a/src/app/constants/modelDefinitionConstants.ts +++ /dev/null @@ -1,6 +0,0 @@ -/*********************************************************** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License - **********************************************************/ -export const modelDefinitionInterfaceId = 'urn:azureiot:ModelDiscovery:ModelDefinition:1'; -export const modelDefinitionCommandName = 'getModelDefinition'; diff --git a/src/app/constants/repositoryLocationTypes.ts b/src/app/constants/repositoryLocationTypes.ts index b0621de9d..797fdd3fd 100644 --- a/src/app/constants/repositoryLocationTypes.ts +++ b/src/app/constants/repositoryLocationTypes.ts @@ -4,6 +4,5 @@ **********************************************************/ export enum REPOSITORY_LOCATION_TYPE { Public = 'PUBLIC', - Device = 'DEVICE', Local = 'LOCAL' } diff --git a/src/app/devices/deviceContent/components/digitalTwin/digitalTwinInterfaces.spec.tsx b/src/app/devices/deviceContent/components/digitalTwin/digitalTwinInterfaces.spec.tsx index d55d1b972..1866e107b 100644 --- a/src/app/devices/deviceContent/components/digitalTwin/digitalTwinInterfaces.spec.tsx +++ b/src/app/devices/deviceContent/components/digitalTwin/digitalTwinInterfaces.spec.tsx @@ -160,7 +160,7 @@ describe('login/components/connectivityPane', () => { modelDefinitionWithSource: { isModelValid: true, modelDefinition, - source: REPOSITORY_LOCATION_TYPE.Device, + source: REPOSITORY_LOCATION_TYPE.Local, }, modelId: 'dtmi:__azureiot:sampleModel;1' }), @@ -171,7 +171,7 @@ describe('login/components/connectivityPane', () => { const labels = digitalTwinInterfaces.find(Label); expect(labels).toHaveLength(5); // tslint:disable-line:no-magic-numbers - expect(labels.at(1).props().children).toEqual([ResourceKeys.deviceInterfaces.columns.source, ': ', ResourceKeys.settings.modelDefinitions.repositoryTypes.device.label]); + expect(labels.at(1).props().children).toEqual([ResourceKeys.deviceInterfaces.columns.source, ': ', ResourceKeys.settings.modelDefinitions.repositoryTypes.local.label]); expect(labels.at(2).props().children).toEqual('dtmi:__DeviceManagement:DeviceInformation;1'); // tslint:disable-line:no-magic-numbers expect(labels.at(3).props().children).toEqual('dtmi:__Client:SDKInformation;1'); // tslint:disable-line:no-magic-numbers expect(labels.at(4).props().children).toEqual('dtmi:__Contoso:EnvironmentalSensor;1'); // tslint:disable-line:no-magic-numbers diff --git a/src/app/devices/deviceContent/sagas/modelDefinitionSaga.spec.ts b/src/app/devices/deviceContent/sagas/modelDefinitionSaga.spec.ts index c9a9a3373..80769406e 100644 --- a/src/app/devices/deviceContent/sagas/modelDefinitionSaga.spec.ts +++ b/src/app/devices/deviceContent/sagas/modelDefinitionSaga.spec.ts @@ -5,18 +5,13 @@ import 'jest'; import { select, call, put } from 'redux-saga/effects'; import { SagaIteratorClone, cloneableGenerator } from 'redux-saga/utils'; -import { getModelDefinitionSaga, getModelDefinition, getModelDefinitionFromPublicRepo, getModelDefinitionFromDevice, getModelDefinitionFromLocalFile, validateModelDefinitionHelper } from './modelDefinitionSaga'; -import * as DigitalTwinService from '../../../api/services/digitalTwinService'; +import { getModelDefinitionSaga, getModelDefinition, getModelDefinitionFromPublicRepo, getModelDefinitionFromLocalFile, validateModelDefinitionHelper } from './modelDefinitionSaga'; import { addNotificationAction } from '../../../notifications/actions'; import { NotificationType } from '../../../api/models/notification'; import { ResourceKeys } from '../../../../localization/resourceKeys'; import { getModelDefinitionAction } from '../actions'; -import { getRepositoryLocationSettingsSelector, getPublicRepositoryHostName, getLocalFolderPath } from '../../../settings/selectors'; +import { getRepositoryLocationSettingsSelector, getLocalFolderPath } from '../../../settings/selectors'; import { REPOSITORY_LOCATION_TYPE } from '../../../constants/repositoryLocationTypes'; -import { getComponentNameAndInterfaceIdArraySelector } from '../selectors'; -import { getActiveAzureResourceConnectionStringSaga } from '../../../azureResource/sagas/getActiveAzureResourceConnectionStringSaga'; -import { modelDefinitionCommandName, modelDefinitionInterfaceId } from '../../../constants/modelDefinitionConstants'; -import { PUBLIC_REPO_HOSTNAME } from '../../../constants/apiConstants'; import { fetchLocalFile } from '../../../api/services/localRepoService'; import { fetchModelDefinition } from '../../../api/services/publicDigitalTwinsModelRepoService'; @@ -82,7 +77,6 @@ describe('modelDefinitionSaga', () => { expect(getModelDefinitionSagaGenerator.next([{ repositoryLocationType: REPOSITORY_LOCATION_TYPE.Public, - }]).value).toEqual( call(getModelDefinition, action, { repositoryLocationType: REPOSITORY_LOCATION_TYPE.Public }) ); @@ -141,15 +135,9 @@ describe('modelDefinitionSaga', () => { (action, {repositoryLocationType: REPOSITORY_LOCATION_TYPE.Public}); expect(getModelDefinitionFromPublicRepoGenerator.next()).toEqual({ - done: false, - value: select(getPublicRepositoryHostName) - }); - - expect(getModelDefinitionFromPublicRepoGenerator.next(PUBLIC_REPO_HOSTNAME)).toEqual({ done: false, value: call(fetchModelDefinition, { id: params.interfaceId, - repoServiceHostName: PUBLIC_REPO_HOSTNAME, token: '' }) }); @@ -157,36 +145,6 @@ describe('modelDefinitionSaga', () => { expect(getModelDefinitionFromPublicRepoGenerator.next().done).toEqual(true); }); - describe('getModelDefinitionFromDevice ', () => { - const getModelDefinitionFromDeviceGenerator = cloneableGenerator(getModelDefinitionFromDevice)(action); - expect(getModelDefinitionFromDeviceGenerator.next()).toEqual({ - done: false, - value: select(getComponentNameAndInterfaceIdArraySelector) - }); - - const nameAndId = [{ - componentName: 'model_discovery', - interfaceId: modelDefinitionInterfaceId - }]; - expect(getModelDefinitionFromDeviceGenerator.next(nameAndId)).toEqual({ - done: false, - value: call(getActiveAzureResourceConnectionStringSaga) - }); - - expect(getModelDefinitionFromDeviceGenerator.next('connection_string')).toEqual({ - done: false, - value: call(DigitalTwinService.invokeDigitalTwinInterfaceCommand, { - commandName: modelDefinitionCommandName, - componentName: 'model_discovery', - connectionString: 'connection_string', - digitalTwinId, - payload: interfaceId - }) - }); - - expect(getModelDefinitionFromDeviceGenerator.next().done).toEqual(true); - }); - describe('getModelDefinitionFromLocalFile ', () => { const getModelDefinitionFromLocalFolderGenerator = cloneableGenerator(getModelDefinitionFromLocalFile) (action); @@ -214,15 +172,6 @@ describe('modelDefinitionSaga', () => { expect(getModelDefinitionFromPublicRepoGenerator.next().done).toEqual(true); }); - it('getModelDefinition from device', () => { - const getModelDefinitionFromDeviceGenerator = cloneableGenerator(getModelDefinition)(action, {repositoryLocationType: REPOSITORY_LOCATION_TYPE.Device}); - expect(getModelDefinitionFromDeviceGenerator.next()).toEqual({ - done: false, - value: call(getModelDefinitionFromDevice, action) - }); - expect(getModelDefinitionFromDeviceGenerator.next().done).toEqual(true); - }); - it('getModelDefinition from local', () => { const getModelDefinitionFromDeviceGenerator = cloneableGenerator(getModelDefinition)(action, {repositoryLocationType: REPOSITORY_LOCATION_TYPE.Local}); expect(getModelDefinitionFromDeviceGenerator.next()).toEqual({ diff --git a/src/app/devices/deviceContent/sagas/modelDefinitionSaga.ts b/src/app/devices/deviceContent/sagas/modelDefinitionSaga.ts index e67437a98..b35806bd1 100644 --- a/src/app/devices/deviceContent/sagas/modelDefinitionSaga.ts +++ b/src/app/devices/deviceContent/sagas/modelDefinitionSaga.ts @@ -10,14 +10,9 @@ import { NotificationType } from '../../../api/models/notification'; import { ResourceKeys } from '../../../../localization/resourceKeys'; import { getModelDefinitionAction, GetModelDefinitionActionParameters } from '../actions'; import { FetchModelParameters } from '../../../api/parameters/repoParameters'; -import { getRepositoryLocationSettingsSelector, getPublicRepositoryHostName, getLocalFolderPath } from '../../../settings/selectors'; +import { getRepositoryLocationSettingsSelector, getLocalFolderPath } from '../../../settings/selectors'; import { RepositoryLocationSettings } from '../../../settings/state'; import { REPOSITORY_LOCATION_TYPE } from './../../../constants/repositoryLocationTypes'; -import { invokeDigitalTwinInterfaceCommand } from '../../../api/services/digitalTwinService'; -import { getActiveAzureResourceConnectionStringSaga } from '../../../azureResource/sagas/getActiveAzureResourceConnectionStringSaga'; -import { getComponentNameAndInterfaceIdArraySelector, ComponentAndInterfaceId } from '../selectors'; -import { InterfaceNotImplementedException } from './../../../shared/utils/exceptions/interfaceNotImplementedException'; -import { modelDefinitionInterfaceId, modelDefinitionCommandName } from '../../../constants/modelDefinitionConstants'; import { fetchLocalFile } from './../../../api/services/localRepoService'; import { ModelDefinition } from './../../../api/models/modelDefinition'; import { ModelDefinitionNotValidJsonError } from '../../../api/models/modelDefinitionNotValidJsonError'; @@ -81,7 +76,6 @@ export function* validateModelDefinitionHelper(modelDefinition: ModelDefinition, export function* getModelDefinitionFromPublicRepo(action: Action, location: RepositoryLocationSettings) { const parameters: FetchModelParameters = { id: action.payload.interfaceId, - repoServiceHostName: yield select(getPublicRepositoryHostName), token: '' }; return yield call(fetchModelDefinition, parameters); @@ -92,29 +86,8 @@ export function* getModelDefinitionFromLocalFile(action: Action) { - // check if device has implemented ${modelDefinitionInterfaceId} interface. - const componentAndIs: ComponentAndInterfaceId[] = yield select(getComponentNameAndInterfaceIdArraySelector); - const filtered = componentAndIs.filter(componentAndId => componentAndId.interfaceId === modelDefinitionInterfaceId); - if (filtered.length === 0) { - throw new InterfaceNotImplementedException(); - } - const componentName = filtered[0].componentName; - - // if interface is implemented, invoke command on device - return yield call(invokeDigitalTwinInterfaceCommand, { - commandName: modelDefinitionCommandName, - componentName, - connectionString: yield call(getActiveAzureResourceConnectionStringSaga), - digitalTwinId: action.payload.digitalTwinId, - payload: action.payload.interfaceId - }); -} - export function* getModelDefinition(action: Action, location: RepositoryLocationSettings) { switch (location.repositoryLocationType) { - case REPOSITORY_LOCATION_TYPE.Device: - return yield call(getModelDefinitionFromDevice, action); case REPOSITORY_LOCATION_TYPE.Local: return yield call(getModelDefinitionFromLocalFile, action); default: diff --git a/src/app/devices/deviceList/components/__snapshots__/deviceQueryClause.spec.tsx.snap b/src/app/devices/deviceList/components/__snapshots__/deviceQueryClause.spec.tsx.snap index 6a8d60f52..36207334f 100644 --- a/src/app/devices/deviceList/components/__snapshots__/deviceQueryClause.spec.tsx.snap +++ b/src/app/devices/deviceList/components/__snapshots__/deviceQueryClause.spec.tsx.snap @@ -24,14 +24,6 @@ exports[`components/devices/DeviceQueryClause matches snapshot 1`] = ` "key": "status", "text": "deviceLists.query.searchPills.clause.parameterType.items.status", }, - Object { - "key": "dcm", - "text": "deviceLists.query.searchPills.clause.parameterType.items.capabilityModelId", - }, - Object { - "key": "interface", - "text": "deviceLists.query.searchPills.clause.parameterType.items.interfaceId", - }, ] } title="deviceLists.query.searchPills.clause.parameterType.title" @@ -95,74 +87,6 @@ exports[`components/devices/DeviceQueryClause matches snapshot without operation "key": "status", "text": "deviceLists.query.searchPills.clause.parameterType.items.status", }, - Object { - "key": "dcm", - "text": "deviceLists.query.searchPills.clause.parameterType.items.capabilityModelId", - }, - Object { - "key": "interface", - "text": "deviceLists.query.searchPills.clause.parameterType.items.interfaceId", - }, - ] - } - title="deviceLists.query.searchPills.clause.parameterType.title" - /> - - - -`; - -exports[`components/devices/DeviceQueryClause matches snapshot without operation 2`] = ` -
- { expect(wrapper).toMatchSnapshot(); }); - it('matches snapshot without operation', () => { - const wrapper = testWithLocalizationContext( - - ); - - expect(wrapper).toMatchSnapshot(); - }); - it('matches snapshot without operation', () => { const wrapper = testWithLocalizationContext( { const removeClause = jest.fn(); const wrapper = testWithLocalizationContext( , value: string) => { - this.props.setClause( - this.props.index, { - isError: this.isError({ - operation: this.props.operation, - parameterType: this.props.parameterType, - value - }), - operation: this.props.operation, - parameterType: this.props.parameterType, - value - } - ); - } - private readonly onValueDropdownChange = (event: React.FormEvent, option?: IDropdownOption) => { this.props.setClause( this.props.index, { @@ -77,22 +61,6 @@ export default class DeviceQueryClause extends React.PureComponent, option?: IDropdownOption) => { - const operation = option.key as OperationType; - this.props.setClause( - this.props.index, { - isError: this.isError({ - operation, - parameterType: this.props.parameterType, - value: this.props.value - }), - operation, - parameterType: this.props.parameterType, - value: this.props.value - } - ); - } - public componentDidMount() { // set focus to parameter type dropdown const node = this.parameterTypeRef.current; @@ -111,7 +79,6 @@ export default class DeviceQueryClause extends React.PureComponent {this.renderParameterDropdown(context)} - {/* {this.renderOperationDropdown(context)} */} {this.renderValueInput(context)} { - return ( - ({ - ariaLabel: context.t((ResourceKeys.deviceLists.query.searchPills.clause.operationType.options as any)[operationType]), // tslint:disable-line: no-any - key: (OperationType as any)[operationType], // tslint:disable-line: no-any - text: (OperationType as any)[operationType] // tslint:disable-line: no-any - }))} - onChange={this.onOperationChange} - defaultSelectedKey={this.props.operation} - title={context.t(ResourceKeys.deviceLists.query.searchPills.clause.operationType.title)} - ariaLabel={context.t(ResourceKeys.deviceLists.query.searchPills.clause.operationType.ariaLabel)} - /> - ); - } - private readonly renderEdgeDropdownOptions = (context: LocalizationContextInterface) => { return Object.keys(DeviceCapability).map (deviceCapability => ({ @@ -180,21 +129,8 @@ export default class DeviceQueryClause extends React.PureComponent { switch (this.props.parameterType) { - case ParameterType.capabilityModelId: - case ParameterType.interfaceId: - return ( - - ); case ParameterType.edge: return ( - +
- - settings.modelDefinitions.repositoryTypes.device.label - -
+ /> this.onAddRepositoryType(REPOSITORY_LOCATION_TYPE.Public), text: context.t(ResourceKeys.settings.modelDefinitions.repositoryTypes.public.label) }, - { - disabled: !items || items.some(item => item.repositoryLocationType === REPOSITORY_LOCATION_TYPE.Device), - key: REPOSITORY_LOCATION_TYPE.Device, - onClick: () => this.onAddRepositoryType(REPOSITORY_LOCATION_TYPE.Device), - text: context.t(ResourceKeys.settings.modelDefinitions.repositoryTypes.device.label), - }, this.getLocalMenuItem(context) ]; } @@ -94,7 +88,6 @@ export default class RepositoryLocationList extends React.Component !item.disabled)} /> ); diff --git a/src/app/settings/components/repositoryLocationListItem.tsx b/src/app/settings/components/repositoryLocationListItem.tsx index bdf53504e..05fa1e7be 100644 --- a/src/app/settings/components/repositoryLocationListItem.tsx +++ b/src/app/settings/components/repositoryLocationListItem.tsx @@ -10,7 +10,6 @@ import { TextField } from 'office-ui-fabric-react/lib/TextField'; import { REPOSITORY_LOCATION_TYPE } from '../../constants/repositoryLocationTypes'; import { LocalizationContextInterface, LocalizationContextConsumer } from '../../shared/contexts/localizationContext'; import { ResourceKeys } from '../../../localization/resourceKeys'; -import MaskedCopyableTextFieldContainer from '../../shared/components/maskedCopyableTextFieldContainer'; import { CANCEL, NAVIGATE_BACK, FOLDER } from '../../constants/iconNames'; import { RepositoryLocationSettings } from '../state'; import { fetchDirectories } from '../../api/services/localRepoService'; @@ -59,8 +58,6 @@ export default class RepositoryLocationListItem extends React.Component {item.repositoryLocationType === REPOSITORY_LOCATION_TYPE.Public && } - {item.repositoryLocationType === REPOSITORY_LOCATION_TYPE.Device - && } {item.repositoryLocationType === REPOSITORY_LOCATION_TYPE.Local && this.renderLocalFolderItem(context) } diff --git a/src/app/settings/selectors.spec.ts b/src/app/settings/selectors.spec.ts index 64b9056ed..ff9e7ec5f 100644 --- a/src/app/settings/selectors.spec.ts +++ b/src/app/settings/selectors.spec.ts @@ -7,7 +7,6 @@ import { Record } from 'immutable'; import { getSettingsVisibleSelector, getRepositoryLocationSettingsSelector, - getPublicRepositoryHostName, getLocalFolderPath } from './selectors'; import { getInitialState } from '../api/shared/testHelper'; @@ -20,9 +19,6 @@ describe('applicationStateSelector', () => { localFolderSettings: { path: 'f:/mist/pnp-docs' }, - publicRepositorySettings: { - publicRepoHostName: 'repo.azureiotrepository.com' - }, repositoryLocations: [ REPOSITORY_LOCATION_TYPE.Public, REPOSITORY_LOCATION_TYPE.Local @@ -47,10 +43,6 @@ describe('applicationStateSelector', () => { ]); }); - it('returns public repo hostname', () => { - expect(getPublicRepositoryHostName(state)).toEqual('repo.azureiotrepository.com'); - }); - it('returns local folder path', () => { expect(getLocalFolderPath(state)).toEqual('f:/mist/pnp-docs'); }); diff --git a/src/app/settings/selectors.ts b/src/app/settings/selectors.ts index 3d58ca026..9d305deb9 100644 --- a/src/app/settings/selectors.ts +++ b/src/app/settings/selectors.ts @@ -21,10 +21,6 @@ export const getRepositoryLocationSettingsSelector = (state: StateInterface) => }); }; -export const getPublicRepositoryHostName = (state: StateInterface) => { - return state && state.applicationState && state.applicationState.publicRepositorySettings && state.applicationState.publicRepositorySettings.publicRepoHostName; -}; - export const getLocalFolderPath = (state: StateInterface) => { return state && state.applicationState && state.applicationState.localFolderSettings && state.applicationState.localFolderSettings.path; }; diff --git a/src/app/settings/state.ts b/src/app/settings/state.ts index 3ecae3174..395ef4969 100644 --- a/src/app/settings/state.ts +++ b/src/app/settings/state.ts @@ -7,7 +7,6 @@ import { IM } from '../shared/types/types'; import { REPOSITORY_LOCATION_TYPE } from '../constants/repositoryLocationTypes'; import { REPO_LOCATIONS, LOCAL_FILE_EXPLORER_PATH_NAME } from '../constants/browserStorage'; import { appConfig, HostMode } from '../../appConfig/appConfig'; -import { PUBLIC_REPO_HOSTNAME } from '../constants/apiConstants'; export interface RepositoryLocationSettings { repositoryLocationType: REPOSITORY_LOCATION_TYPE; @@ -17,43 +16,34 @@ export interface RepositoryLocationSettings { export interface ApplicationStateInterface { showSettings: boolean; repositoryLocations: REPOSITORY_LOCATION_TYPE[]; - publicRepositorySettings: PublicRepositorySettings; localFolderSettings: LocalFolderSettings; } -export interface PublicRepositorySettings { - publicRepoHostName: string; -} - export interface LocalFolderSettings { path: string; } -export const applicationStateInitial = appConfig.hostMode === HostMode.Electron ? - Record({ - localFolderSettings: { - path: localStorage.getItem(LOCAL_FILE_EXPLORER_PATH_NAME) || '', - }, - publicRepositorySettings: { - publicRepoHostName: PUBLIC_REPO_HOSTNAME - }, - repositoryLocations: localStorage.getItem(REPO_LOCATIONS) ? - localStorage.getItem(REPO_LOCATIONS).split(',') - .filter(location => Object.values(REPOSITORY_LOCATION_TYPE).indexOf(location.toUpperCase() as REPOSITORY_LOCATION_TYPE) > -1) - .map(location => location.toUpperCase() as REPOSITORY_LOCATION_TYPE) : - [REPOSITORY_LOCATION_TYPE.Public, REPOSITORY_LOCATION_TYPE.Device], - showSettings: false - }) : +const getRepositoryLocations = () => { + if (localStorage.getItem(REPO_LOCATIONS)) { + let locations = localStorage.getItem(REPO_LOCATIONS).split(',') + .filter(location => Object.values(REPOSITORY_LOCATION_TYPE).indexOf(location.toUpperCase() as REPOSITORY_LOCATION_TYPE) > -1) + .map(location => location.toUpperCase() as REPOSITORY_LOCATION_TYPE); + + if (appConfig.hostMode !== HostMode.Electron) { // do now show local folder option in browser version + locations = locations.filter(location => location !== REPOSITORY_LOCATION_TYPE.Local); + } + return locations; + } + return [REPOSITORY_LOCATION_TYPE.Public]; +}; + +export const applicationStateInitial = Record({ - localFolderSettings: null, - publicRepositorySettings: { - publicRepoHostName: PUBLIC_REPO_HOSTNAME - }, - repositoryLocations: localStorage.getItem(REPO_LOCATIONS) ? - localStorage.getItem(REPO_LOCATIONS).split(',') - .filter(location => Object.values(REPOSITORY_LOCATION_TYPE).indexOf(location.toUpperCase() as REPOSITORY_LOCATION_TYPE) > -1) - .map(location => location.toUpperCase() as REPOSITORY_LOCATION_TYPE).filter(location => location !== REPOSITORY_LOCATION_TYPE.Local) : - [REPOSITORY_LOCATION_TYPE.Public, REPOSITORY_LOCATION_TYPE.Device], + localFolderSettings: appConfig.hostMode === HostMode.Electron ? + { + path: localStorage.getItem(LOCAL_FILE_EXPLORER_PATH_NAME) || '', + } : null, + repositoryLocations: getRepositoryLocations(), showSettings: false }); diff --git a/src/app/shared/utils/exceptions/interfaceNotImplementedException.ts b/src/app/shared/utils/exceptions/interfaceNotImplementedException.ts deleted file mode 100644 index 4d1e08f97..000000000 --- a/src/app/shared/utils/exceptions/interfaceNotImplementedException.ts +++ /dev/null @@ -1,12 +0,0 @@ -/*********************************************************** - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License - **********************************************************/ -import { Exception } from './exception'; - -export class InterfaceNotImplementedException extends Exception { - - protected setTypeName() { - this.type = 'interfaceNotImplementedException'; - } -} diff --git a/src/localization/locales/en.json b/src/localization/locales/en.json index 88e32e3ad..6d09e1d6a 100644 --- a/src/localization/locales/en.json +++ b/src/localization/locales/en.json @@ -66,19 +66,9 @@ "label":"Public repository", "infoText": "" }, - "private": { - "label":"Company repository", - "infoText": "", - "textBoxLabel": "Company model repository connection string", - "placeholder": "" - }, - "device": { - "label":"On the connected device", - "infoText": "" - }, "local": { "label":"Local folder", - "labelInBrowser":"Local folder (This is only enabled in the desktop version from: https://github.com/Azure/azure-iot-explorer/releases)", + "labelInBrowser":"Local folder (Only available in the desktop version from: https://github.com/Azure/azure-iot-explorer/releases)", "infoText": "Use your local folder as a model repository. The model definition files you wish to use should have a json extension. The first JSON file with an '@id' property matching the digital twin model identifier (DTMI) will be retrieved.", "textBoxLabel": "Selected folder", "folderPicker": { @@ -414,8 +404,6 @@ "title":"Parameter type", "ariaLabel": "Type of query clause", "items": { - "capabilityModelId":"Model ID", - "interfaceId": "Interface ID", "propertyValue": "Property value", "status": "Status", "lastActivityTime": "Last activity time", diff --git a/src/localization/resourceKeys.ts b/src/localization/resourceKeys.ts index 10dd95ed0..5d1554884 100644 --- a/src/localization/resourceKeys.ts +++ b/src/localization/resourceKeys.ts @@ -489,9 +489,7 @@ export class ResourceKeys { parameterType : { ariaLabel : "deviceLists.query.searchPills.clause.parameterType.ariaLabel", items : { - capabilityModelId : "deviceLists.query.searchPills.clause.parameterType.items.capabilityModelId", edge : "deviceLists.query.searchPills.clause.parameterType.items.edge", - interfaceId : "deviceLists.query.searchPills.clause.parameterType.items.interfaceId", lastActivityTime : "deviceLists.query.searchPills.clause.parameterType.items.lastActivityTime", propertyValue : "deviceLists.query.searchPills.clause.parameterType.items.propertyValue", status : "deviceLists.query.searchPills.clause.parameterType.items.status", @@ -766,10 +764,6 @@ export class ResourceKeys { headerText : "settings.modelDefinitions.headerText", helpText : "settings.modelDefinitions.helpText", repositoryTypes : { - device : { - infoText : "settings.modelDefinitions.repositoryTypes.device.infoText", - label : "settings.modelDefinitions.repositoryTypes.device.label", - }, local : { folderPicker : { command : { @@ -791,12 +785,6 @@ export class ResourceKeys { textBoxLabel : "settings.modelDefinitions.repositoryTypes.local.textBoxLabel", }, notAvailable : "settings.modelDefinitions.repositoryTypes.notAvailable", - private : { - infoText : "settings.modelDefinitions.repositoryTypes.private.infoText", - label : "settings.modelDefinitions.repositoryTypes.private.label", - placeholder : "settings.modelDefinitions.repositoryTypes.private.placeholder", - textBoxLabel : "settings.modelDefinitions.repositoryTypes.private.textBoxLabel", - }, public : { infoText : "settings.modelDefinitions.repositoryTypes.public.infoText", label : "settings.modelDefinitions.repositoryTypes.public.label",