Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

Add graphql editor #3

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions formwidgets/GraphQLSchemaEditor.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ public function prepareVars()
$this->vars['name'] = $this->formField->getName();
$this->vars['value'] = $this->getLoadValue();
$this->vars['model'] = $this->model;
$this->vars['webpackAssetsUrl'] = asset('plugins/thefehr/lighthouse/formwidgets/graphqlschemaeditor/assets/');
$this->vars['webpackUrl'] = asset(
'plugins/thefehr/lighthouse/formwidgets/graphqlschemaeditor/assets/graphqlschemaeditor.js'
);
$this->vars['webpackAssetsUrl'] = asset('/plugins/thefehr/lighthouse/formwidgets/graphqlschemaeditor/assets/');
$this->vars['webpackUrl'] = asset('/plugins/thefehr/lighthouse/formwidgets/graphqlschemaeditor/assets/graphqlschemaeditor.js');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line exceeds 120 characters; contains 135 characters

}

/**
Expand Down
64 changes: 48 additions & 16 deletions formwidgets/graphqlschemaeditor/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions formwidgets/graphqlschemaeditor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"dependencies": {
"babel-cli": "^6.26.0",
"babel-preset-react-app": "^3.1.2",
"graphql-editor": "^3.3.3",
"graphql-editor": "^3.3.4",
"monaco-editor": "^0.20.0",
"react": "^16.12.0",
"react-dom": "^16.12.0"
Expand All @@ -15,25 +15,25 @@
"@babel/core": "^7.8.4",
"@babel/preset-env": "^7.8.4",
"@babel/preset-react": "^7.8.3",
"@types/react": "^16.9.19",
"@types/react": "^16.9.22",
"@types/react-dom": "^16.9.5",
"babel-loader": "^8.0.6",
"css-loader": "^3.4.2",
"file-loader": "^5.0.2",
"file-loader": "^5.1.0",
"html-loader": "^0.5.5",
"html-webpack-plugin": "^3.2.0",
"monaco-editor-webpack-plugin": "^1.9.0",
"source-map-loader": "^0.2.4",
"style-loader": "^1.1.3",
"ts-loader": "^6.2.1",
"ttf-loader": "^1.0.2",
"typescript": "^3.7.5",
"typescript": "^3.8.2",
"webpack": "^4.41.6",
"webpack-cli": "^3.3.11",
"worker-loader": "^2.0.0"
},
"scripts": {
"start": "webpack --watch --mode development",
"start": "webpack --mode development",
"build": "webpack"
},
"author": "",
Expand Down
31 changes: 28 additions & 3 deletions formwidgets/graphqlschemaeditor/partials/_graphqlschemaeditor.htm
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@
<h2>My graphql schema editor</h2>
<div id="graphqleditor" style="height: 70vh"></div>
<textarea name="<?= $name ?>" id="<?= $this->getId('input') ?>"><?= $value ?></textarea>
<textarea style="height: 100%; width: 100%; display: block"
name="<?= $name ?>"
id="<?= $this->getId('input') ?>"><?= $value ?></textarea>
<script>
var graphqlEditorValueId = "<?= $this->getId('input') ?>";
var myRuntimePublicPath = "<?= $webpackAssetsUrl ?>"
var lighthouseLibrary = `
directive @all(
"""
Specify the class name of the model to use.
This is only needed when the default model detection does not work.
"""
model: String

"""
Apply scopes to the underlying query.
"""
scopes: [String!]
) on FIELD_DEFINITION
`;
</script>
<script src="<?= $webpackUrl ?>"></script>
<script src="<?= $webpackUrl ?>"></script>
<style>
#graphqleditor > * {
height: 100%;
width: 100%;
margin: 0;
overflow: hidden;

box-sizing: border-box;
}
</style>
106 changes: 0 additions & 106 deletions http/Controllers/GraphQLController.php

This file was deleted.