-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #294 from Azure-Samples/montgomp/dtdlV3stopgap
Montgomp/dtdl v3stopgap
- Loading branch information
Showing
16 changed files
with
952 additions
and
227 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,4 +88,4 @@ | |
pre { | ||
user-select: text; | ||
} | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
client/src/components/ErrorMessageComponent/ErrorMessageBar.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
import { MessageBar, MessageBarType } from "office-ui-fabric-react"; | ||
import React, { Component } from "react"; | ||
import { withTranslation } from "react-i18next"; | ||
import { eventService } from "../../services/EventService"; | ||
|
||
import "./ErrorMessage.scss"; | ||
import { isDtdlVersion3 } from "./ErrorMessageHelper"; | ||
|
||
class ErrorMessageBar extends Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
incomatibleLangauageVersion: false, | ||
showBar: true | ||
}; | ||
} | ||
|
||
componentDidMount() { | ||
eventService.subscribeError(exc => { | ||
if (isDtdlVersion3(exc)) { | ||
this.setState({ | ||
incomatibleLangauageVersion: true | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
close = () => { | ||
eventService.publishHideWarningMessage(); | ||
this.setState({ | ||
showBar: false | ||
}); | ||
} | ||
|
||
render() { | ||
const { incomatibleLangauageVersion, showBar } = this.state; | ||
if (incomatibleLangauageVersion && showBar) { | ||
// Just show a warning that v3 isn't fully supported at this time. | ||
return ( | ||
<MessageBar | ||
messageBarType={MessageBarType.warning} | ||
isMultiline={false} | ||
onDismiss={this.close} | ||
dismissButtonAriaLabel={this.props.t("errorMessages.closeButton")}> | ||
{this.props.t("errorMessages.incompatibleLanguageVersion")} | ||
</MessageBar> | ||
); | ||
} | ||
return (<div />); | ||
} | ||
|
||
} | ||
|
||
export default withTranslation("translation", { withRef: true })(ErrorMessageBar); |
6 changes: 6 additions & 0 deletions
6
client/src/components/ErrorMessageComponent/ErrorMessageHelper.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
export const isDtdlVersion3 = exc => | ||
(exc?.name === "DocumentParseError" && exc?.innerError?.details?.url === "dtmi:dtdl:context;3") | ||
|| exc?.message === "Invalid context. context is undefined"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.