Sfoglia il codice sorgente

HUE-8888 [docs] Move the parser component section to its own page

Romain 5 anni fa
parent
commit
030bebae78

+ 2 - 2
docs/docs-site/content/administrator/administration/operations.md

@@ -254,7 +254,7 @@ Instrumentation not enabled:
 
     [23/Apr/2018 10:59:01 -0700] INFO     127.0.0.1 admin - "POST /jobbrowser/jobs/ HTTP/1.1" returned in 88ms
 
-### How to change or reset a forgotten password
+### Change or reset a forgotten password
 
 Via the Hue commands, to change the password of the currently logged in Unix user:
 
@@ -264,7 +264,7 @@ If you don’t remember the admin username, create a new Hue admin (you will the
 
     build/env/bin/hue createsuperuser
 
-### How to make a certain user a Hue admin
+### Make a certain user a Hue admin
 
 It is recommended to just do it as an admin via the [Admin UI](https://gethue.com/password-management-in-hue/).
 

+ 2 - 2
docs/docs-site/content/developer/api/_index.md

@@ -280,7 +280,7 @@ Here is some overview about using the Python commands an shell and some examples
 * [Hue API: Execute some builtin or shell commands](http://gethue.com/hue-api-execute-some-builtin-commands/).
 * [How to manage the Hue database with the shell](http://gethue.com/how-to-manage-the-hue-database-with-the-shell/).
 
-### How to make a certain user a Hue admin
+### Make a user a Hue admin
 
 Via the Hue shell:
 
@@ -296,7 +296,7 @@ Then type something similar to:
     a.set_password('my_secret')
     a.save()
 
-### Change the password for a user
+### Change the password of a user
 
 In the Hue shell:
 

+ 4 - 3
docs/docs-site/content/developer/components/_index.md

@@ -1,5 +1,5 @@
 ---
-title: "UI Components"
+title: "Components"
 draft: false
 weight: 4
 ---
@@ -10,8 +10,9 @@ Some of the UI elements in Hue are available as generic [Web Components](https:/
 
 Following are the generic components in Hue. Doc for each component must give you a sound idea on the attributes/props that the components accept, and events they generate.
 
-* [er-diagram](/developer/components/er-diagram)
-* [Scratchpad](/developer/components/scratchpad)
+* [SQL Parsers](/developer/components/parsers)
+* [ER-diagram](/developer/components/er-diagram)
+* [SQL Scratchpad](/developer/components/scratchpad)
 
 ## Using UI components in your project
 

+ 3 - 80
docs/docs-site/content/developer/parsers/_index.md

@@ -339,83 +339,6 @@ And cf. above [prerequisites](#prerequisites), any interpreter snippet with `ksq
 
 Note: after [HUE-8758](https://issues.cloudera.org/browse/HUE-8758) we will be able to have multiple interpreters on the same dialect (e.g. pointing to two different databases of the same type).
 
-## Using parsers in your project
-
-Parsers generated by Hue are JavaScript modules. This makes it easy to import a parser into your own apps (e.g. Webapp, Node.Js...). Importing the Parser can be simply done as a npm package.
-
-Here is an example on how to use the Hive parser:
-
-    npm install --save gethue
-
-Will install the latest from https://www.npmjs.com/package/gethue. Then import the parser you need with something like below and run it on an SQL statement:
-
-    import sqlAutocompleteParser from 'gethue/parse/sql/hive/hiveAutocompleteParser';
-
-    const beforeCursor = 'SELECT col1, col2, tbl2.col3 FROM tbl; '; // Note extra space at end
-    const afterCursor = '';
-    const dialect = 'hive';
-    const debug = false;
-
-    console.log(
-      JSON.stringify(
-        sqlAutocompleteParser.parseSql(beforeCursor, afterCursor, dialect, debug),
-        null,
-        2
-      )
-    );
-
-Which then will output keywords suggestions and all the known locations:
-
-    { locations:
-      [ { type: 'statement', location: [Object] },
-        { type: 'statementType',
-          location: [Object],
-          identifier: 'SELECT' },
-        { type: 'selectList', missing: false, location: [Object] },
-        { type: 'column',
-          location: [Object],
-          identifierChain: [Array],
-          qualified: false,
-          tables: [Array] },
-        { type: 'column',
-          location: [Object],
-          identifierChain: [Array],
-          qualified: false,
-          tables: [Array] },
-        { type: 'column',
-          location: [Object],
-          identifierChain: [Array],
-          qualified: false,
-          tables: [Array] },
-        { type: 'table', location: [Object], identifierChain: [Array] },
-        { type: 'whereClause', missing: true, location: [Object] },
-        { type: 'limitClause', missing: true, location: [Object] } ],
-      lowerCase: false,
-      suggestKeywords:
-      [ { value: 'ABORT', weight: -1 },
-        { value: 'ALTER', weight: -1 },
-        { value: 'ANALYZE TABLE', weight: -1 },
-        { value: 'CREATE', weight: -1 },
-        { value: 'DELETE', weight: -1 },
-        { value: 'DESCRIBE', weight: -1 },
-        { value: 'DROP', weight: -1 },
-        { value: 'EXPLAIN', weight: -1 },
-        { value: 'EXPORT', weight: -1 },
-        { value: 'FROM', weight: -1 },
-        { value: 'GRANT', weight: -1 },
-        { value: 'IMPORT', weight: -1 },
-        { value: 'INSERT', weight: -1 },
-        { value: 'LOAD', weight: -1 },
-        { value: 'MERGE', weight: -1 },
-        { value: 'MSCK', weight: -1 },
-        { value: 'RELOAD FUNCTION', weight: -1 },
-        { value: 'RESET', weight: -1 },
-        { value: 'REVOKE', weight: -1 },
-        { value: 'SELECT', weight: -1 },
-        { value: 'SET', weight: -1 },
-        { value: 'SHOW', weight: -1 },
-        { value: 'TRUNCATE', weight: -1 },
-        { value: 'UPDATE', weight: -1 },
-        { value: 'USE', weight: -1 },
-        { value: 'WITH', weight: -1 } ],
-      definitions: [] }
+## Reusing a parser in your project
+
+The parsers ship as a pluggable [component](/developer/components/parsers).

+ 3 - 3
tools/examples/api/hue_dep/README.md

@@ -24,12 +24,12 @@ You need not have a dependency on the complete Hue project, the parsers are avai
 
        npm install --save gethue
 
-2. In `hue_dep/package.json`, remove `"hue": "file:../../../.."` without touching the newly added gethue dependency.
-3. In `hue_dep/src/app.js`, change the import line to.
+2. In [hue_dep/package.json](package.json), remove `"hue": "file:../../../.."` without touching the newly added gethue dependency.
+3. In [hue_dep/src/app.js(src/app.js), change the import line to.
 
        import sqlAutocompleteParser from 'gethue/parse/sql/hive/hiveAutocompleteParser';
 
-4. In `hue_dep/webpack.config.js`:
+4. In [hue_dep/webpack.config.js](webpack.config.js):
    - Change `'js'` to `'node_modules/gethue'` under `resolve.modules`.
    - Remove `exclude: /node_modules/,` from `babel-loader`.