-
Notifications
You must be signed in to change notification settings - Fork 19
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
AAS error handling #514
AAS error handling #514
Changes from 4 commits
6c8ae58
2224de1
3fc9287
a3e60cf
073b8d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
|
||
import { openApiTab, openApiJsonBtn, openApiYamlBtn, openApiView } from './open-api' | ||
import { asyncApiTab, asyncApiJsonBtn, asyncApiYamlBtn, asyncApiView } from './async-api' | ||
import { AASView } from './aas' | ||
import { AASTab, AASView } from './aas' | ||
import { defaultsView, defaultsJsonBtn, defaultsYamlBtn, defaultsAddBtn } from './defaults' | ||
import { visualize } from './visualize' | ||
import { validationView } from './validation' | ||
|
@@ -117,8 +117,8 @@ visualizationOptions.forEach(option => { | |
break; | ||
|
||
case "aas-tab": | ||
AASView.classList.remove("hidden") | ||
generateAAS(fileType, editorInstance) | ||
|
||
enableAPIConversionWithProtocol(editorInstance) | ||
|
||
break; | ||
|
||
|
@@ -172,10 +172,8 @@ visualizationOptions.forEach(option => { | |
* @param {object} editor - currently active monaco editor | ||
*/ | ||
function enableAPIConversionWithProtocol(editorInstance) { | ||
let td = editorInstance.getValue() | ||
if (editorInstance["_domElement"].dataset.modeId === "yaml") { | ||
td = convertTDYamlToJson(td) | ||
} | ||
|
||
let td = editorInstance["_domElement"].dataset.modeId === "yaml" ? convertTDYamlToJson(editorInstance.getValue()) : editorInstance.getValue() | ||
|
||
const protocolSchemes = detectProtocolSchemes(td) | ||
|
||
|
@@ -198,6 +196,15 @@ function enableAPIConversionWithProtocol(editorInstance) { | |
showConsoleError("Please insert a TD which uses MQTT!") | ||
} | ||
} | ||
|
||
if (AASTab.checked === true) { | ||
if (["mqtt", "mqtts", "http", "https", "coap", "modbus"].some(p => protocolSchemes.includes(p))) { | ||
generateAAS(editorInstance["_domElement"].dataset.modeId, editorInstance) | ||
AASView.classList.remove("hidden") | ||
} else { | ||
showConsoleError("Please insert a TD which uses HTTP, MQTT, CoAP or Modbus!") | ||
danielpeintner marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this should be changed since all protocols technically work. @SergioCasCeb could you remove the error and only display `Protocols other than HTTP, MQTT and Modbus are not officially supported by AID, do not use the resulting AID in production" on the bottom of the JSON button? |
||
} | ||
} | ||
} | ||
} | ||
|
||
|
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this check there, we should not limit it to protocols we are aware of... makes it also difficult to maintain in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is to align them like other tabs (asyncapi, openapi). Ideally, all thr modules should have the same programming api to report back but it's not the case atm