Explorar el Código

[docs] Refresh of SQL Scratchpad component

Romain Rigaux hace 4 años
padre
commit
9af402e95f
Se han modificado 1 ficheros con 25 adiciones y 19 borrados
  1. 25 19
      docs/docs-site/content/developer/components/scratchpad/_index.md

+ 25 - 19
docs/docs-site/content/developer/components/scratchpad/_index.md

@@ -3,31 +3,37 @@ title: "SQL Scratchpad"
 draft: false
 ---
 
-The lightweight SQL Editor also called "Quick Query" comes as its own `<SqlScratchpad />` Web component.
+The lightweight SQL Editor also called "SQL Scratchpad Query" comes as its own `<sql-scratchpad />` Web component.
 
-e.g.
+It is in **beta** and now is a great time to give it a try and [send feedback](https://github.com/cloudera/hue/issues)!
 
-    import { SqlScratchpad } from "./components/SqlScratchpad";
+Concept:
 
-    function App() {
-      return (
-        <div className="app">
-          <header className="app-header">
-            <p>
-              SQL Scratchpad Example
-            </p>
-          </header>
-          <SqlScratchpad />
-        </div>
-      );
-    }
+We have the `gethue` dependency in `packages.json` or run `npm install gethue`. Then just load it similarly to:
 
+    import sqlScratchpadComp from 'gethue/lib/components/SqlScratchpadWebComponent';
 
-Check the [demo app](https://github.com/cloudera/hue/tree/master/tools/examples/components/sql-scratchpad) about how to integrate it in your own Vue.js, React, JavaScript... project.
+    window.onload = async function (){
+      sqlScratchpadComp.setBaseUrl('http://locahost:9000');
+      await sqlScratchpadComp.login('hue', 'hue');
+    |
 
-Notes
+In HTML:
 
-- Currently expects a running Hue on [http://localhost:8888](https://github.com/cloudera/hue/blob/master/tools/examples/components/sql-scratchpad/src/components/SqlScratchpad.tsx#L14)
-- The `SqlScratchpad` in itself composed of other [smaller components](https://github.com/cloudera/hue/tree/master/tools/examples/components/sql-scratchpad/src/components), e.g. QueryEditor, ExecuteButton...
+    <sql-scratchpad dialect="mysql" />
+
+API:
+
+Currently expects a running Hue on http://locahost:9000 with a hue/hue user and this ini setting:
+
+    [desktop]
+    cors_enabled=true
 
 !["SQL Scratchpad component"](https://cdn.gethue.com/uploads/2020/02/quick-query-component.jpg)
+
+
+Notes:
+
+Check the [demo app](https://github.com/cloudera/hue/tree/master/tools/examples/components/sql-scratchpad) about how to integrate it in your own Vue.js, React, JavaScript... projects.
+
+The `SqlScratchpad` in itself composed of other [smaller components](https://github.com/cloudera/hue/tree/master/tools/examples/components/sql-scratchpad/src/components), e.g. QueryEditor, ExecuteButton...