Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Small changes on the API to be more consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
machaval committed Sep 28, 2020
1 parent a1cc615 commit 6bb3166
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 82 deletions.
27 changes: 2 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
<<<<<<< HEAD
# data-weave-playground-ui
# Data Weave Playground UI

The UI of the playground
=======
# DataWeave playground

An independent web-based development environment for the DataWeave language.

## Running the playground

`./gradlew backend:run`

## Running the UI locally

*All these steps must be done inside the `frontend` directory.*
Expand All @@ -31,20 +25,3 @@ Run tests: `npm run test`

Build a static deployable artifact: `npm run build:static`


## How to build the Docker image

```
./gradlew backend:distDocker
```

## Usage
```
docker pull machaval/dw-playground:2.3.0-SNAPSHOT
docker run -it --rm -p8080:8080 machaval/dw-playground:2.3.0-SNAPSHOT
```

By default the playground starts in port 8080 and you can hit [http://localhost:8080/](http://localhost:8080/)

Check [https://hub.docker.com/r/machaval/dw-playground/tags](https://hub.docker.com/r/machaval/dw-playground/tags) for other available versions.
>>>>>>> Initial Commit
2 changes: 1 addition & 1 deletion api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

apply plugin: 'java'
task api(dependsOn: jar, type: Zip) {
from('src/main/resources/')
classifier = "api"
Expand Down
19 changes: 12 additions & 7 deletions api/src/main/resources/playground/api/dwplayground.raml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ types:
type: object
properties:
main: string
resources:
fs:
type: object
properties:
//: string
inputs: TransformInput[]
inputs:
properties:
//: TransformInput
examples:
simple:
!include examples/transform-request.json
Expand All @@ -25,9 +27,12 @@ types:
TransformInput:
type: object
properties:
name: string
content: string
contentType: string
value: string
kind:
type: string
enum:
- binary
mimeType: string
properties?:
type: object

Expand All @@ -44,8 +49,8 @@ types:
result?:
type: object
properties:
content: string
contentType: string
value: string
mimeType: string
encoding?: string
logs: Log[]
examples:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"main": "/main.dwl",
"inputs": [
{
"name": "payload",
"content": "ewogICAgIm1lc3NhZ2UiOiAiSGVsbG8gd29ybGQhIgp9",
"contentType": "application/json",
"inputs": {
"payload": {
"value": "ewogICAgIm1lc3NhZ2UiOiAiSGVsbG8gd29ybGQhIgp9",
"kind": "binary",
"mimeType": "application/json",
"properties": {
"separator": ""
}
}
],
"resources": {
"/main.dwl": "%dw 2.0\noutput application/json\n---\npayload."
},
"fs": {
"/main.dwl": "%dw 2.0\noutput application/json\n---\npayload"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

{
"main": "/main.dwl",
"inputs": [
{
"name": "payload",
"content": "ewogICAgIm1lc3NhZ2UiOiAiSGVsbG8gd29ybGQhIgp9",
"contentType": "application/json"
"inputs": {
"payload": {
"value": "ewogICAgIm1lc3NhZ2UiOiAiSGVsbG8gd29ybGQhIgp9",
"kind": "binary",
"properties": {},
"mimeType": "application/json"
}
],
"resources": {
"/main.dwl": "%dw 2.0\noutput application/json\n---\npayload."
},
"fs": {
"/main.dwl": "%dw 2.0\noutput application/json\n---\npayload"
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"success": true,
"result": {
"content": "{\n \"message\": \"Hello world!\"\n}",
"contentType": "application/json",
"value": "{\n \"message\": \"Hello world!\"\n}",
"mimeType": "application/json",
"encoding": "UTF-8",
"logs": [

Expand Down
24 changes: 0 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,4 @@ subprojects {

group = "org.mule.weave"
version = uiVersion

repositories {
//mavenLocal()
mavenCentral()
//Mule repositories
maven {
name "mule-releases"
url "http://repository.mulesoft.org/nexus/content/repositories/releases/"
}
maven {
name "mule-snapshots"
url "http://repository.mulesoft.org/nexus/content/repositories/snapshots/"
}
}
}


buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
}
5 changes: 5 additions & 0 deletions frontend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ task runFastTest(type: NpmTask) {
args = ['run','test']
}

task runClean(type: NpmTask) {
args = ['run', 'clean']
}

task staticWebpage(type: NpmTask) {
args = ['run','build:static']
}
Expand All @@ -14,6 +18,7 @@ task startStatic(type: NpmTask) {
args = ['start']
}

clean.dependsOn(runClean)
staticWebpage.dependsOn(npmInstall)
build.dependsOn(staticWebpage)

Expand Down
3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
},
"scripts": {
"start": "npm run clear:build && node webpack/dev-server.js",
"clear:build": "rm -rf build && rm -rf dist && mkdir build && mkdir dist",
"clean": "rm -rf build && rm -rf dist ",
"clear:build": "npm run clean && mkdir build && mkdir dist",
"test": "jest --verbose",
"build:aliases": "node scripts/aliasesGenerator.js webpack/aliases.js -j package.json -t tsconfig.json",
"build:static": "npm run clear:build && webpack --config webpack/config.production.js",
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/app/dataweave/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const fetchPreviewSuccess = (response: IExecutorResponse) => (dispatch, g
dispatch({
type: DataweaveAction.PREVIEW_REQUEST_SUCCESS,
payload: {
content: response.result.content,
content: response.result.value,
}
});
dispatch(updateLogs(response.logs));
Expand Down Expand Up @@ -114,7 +114,7 @@ export const fetchWeaveTypes = () =>
});

if (!response.success) throw new Error(response.error.message);
const wtype = await DWLanguageClient.getInstance().inferType(response.result.content)
const wtype = await DWLanguageClient.getInstance().inferType(response.result.value)
dispatch(fetchWeaveTypesSuccess(wtype.toString(), input.path));
} catch (e) {
dispatch(
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/app/dataweave/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ export interface IExecutorResponse {
success: boolean;
logs?: ILogEntry[];
result?: {
contentType: MediaType;
content: string;
mimeType: MediaType;
value: string;
encoding: string;
};
error?: {
Expand Down

0 comments on commit 6bb3166

Please sign in to comment.