-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
111 additions
and
115 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
...in/kotlin/com/mussonindustrial/embr/perspective/common/component/ComponentSchemaLoader.kt
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,35 @@ | ||
package com.mussonindustrial.embr.perspective.common.component | ||
|
||
import com.inductiveautomation.ignition.common.jsonschema.JsonSchema | ||
import com.inductiveautomation.perspective.common.api.ComponentEventDescriptor | ||
|
||
class ComponentSchemaLoader( | ||
private val clazz: Class<*>, | ||
private val componentId: String, | ||
) { | ||
fun getSchema(): JsonSchema { | ||
return getJsonSchema("/schemas/components/${componentId}/props.json") | ||
} | ||
|
||
fun getEventDescriptor(name: String, description: String): ComponentEventDescriptor { | ||
return ComponentEventDescriptor( | ||
name, | ||
description, | ||
getJsonSchema("/schemas/components/${componentId}/events/$name.props.json") | ||
) | ||
} | ||
|
||
fun getPaletteEntry(variantId: String, label: String, tooltip: String): PaletteEntry { | ||
return PaletteEntry( | ||
ComponentSchemaLoader::class.java, | ||
componentId, | ||
variantId, | ||
label, | ||
tooltip | ||
) | ||
} | ||
|
||
private fun getJsonSchema(path: String): JsonSchema { | ||
return JsonSchema.parse(ComponentSchemaLoader::class.java.getResourceAsStream(path)) | ||
} | ||
} |
31 changes: 8 additions & 23 deletions
31
...rc/main/kotlin/com/mussonindustrial/ignition/embr/charts/component/chart/SmoothieChart.kt
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
9 changes: 0 additions & 9 deletions
9
.../src/main/resources/schemas/components/embr.chart.smoothie-chart/events/getChartData.json
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
...in/resources/schemas/components/embr.chart.smoothie-chart/events/onChartUpdate.props.json
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,19 @@ | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"chart": { | ||
"type": "object", | ||
"description": "Chart JavaScript Proxy Object", | ||
"properties": { | ||
"runAsync": { | ||
"type": "object", | ||
"description": "Run JavaScript code asynchronously." | ||
}, | ||
"runBlocking": { | ||
"type": "object", | ||
"description": "Run blocking JavaScript code." | ||
} | ||
} | ||
} | ||
} | ||
} |
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