From 45f5f6276d731084b3873cb1885f684ab1449e68 Mon Sep 17 00:00:00 2001 From: Tinkoff DWH Date: Fri, 14 Apr 2017 12:44:29 +0500 Subject: [PATCH 01/17] ZEPPELIN-2403 added interpreter property types --- .../main/resources/interpreter-setting.json | 6 +- .../main/resources/interpreter-setting.json | 6 +- .../main/resources/interpreter-setting.json | 9 +- .../main/resources/interpreter-setting.json | 93 +++++++++----- .../development/writingzeppelininterpreter.md | 6 +- docs/install/upgrade.md | 35 ++++++ docs/rest-api/rest-interpreter.md | 80 ++++++++++-- .../main/resources/interpreter-setting.json | 18 ++- .../main/resources/interpreter-setting.json | 9 +- .../main/resources/interpreter-setting.json | 6 +- .../main/resources/interpreter-setting.json | 9 +- .../main/resources/interpreter-setting.json | 3 +- .../main/resources/interpreter-setting.json | 9 +- .../main/resources/interpreter-setting.json | 3 +- .../main/resources/interpreter-setting.json | 15 ++- .../main/resources/interpreter-setting.json | 33 +++-- .../main/resources/interpreter-setting.json | 21 ++-- .../main/resources/interpreter-setting.json | 21 ++-- .../main/resources/interpreter-setting.json | 60 ++++++--- .../main/resources/interpreter-setting.json | 3 +- .../main/resources/interpreter-setting.json | 12 +- .../main/resources/interpreter-setting.json | 6 +- r/src/main/resources/interpreter-setting.json | 24 ++-- .../main/resources/interpreter-setting.json | 6 +- .../main/resources/interpreter-setting.json | 12 +- .../zeppelin/spark/SparkInterpreter.java | 41 +++++-- .../main/resources/interpreter-setting.json | 49 +++++--- .../sparkr-resources/interpreter-setting.json | 61 ++++++---- .../DefaultInterpreterProperty.java | 115 ++++++++++++++++++ .../zeppelin/interpreter/Interpreter.java | 15 +-- .../interpreter/InterpreterProperty.java | 87 +++---------- .../InterpreterPropertyBuilder.java | 10 +- .../interpreter/InterpreterPropertyType.java | 26 ++++ .../zeppelin/rest/InterpreterRestApi.java | 16 ++- .../message/NewInterpreterSettingRequest.java | 5 +- .../UpdateInterpreterSettingRequest.java | 9 +- .../zeppelin/integration/InterpreterIT.java | 2 +- .../zeppelin/rest/AbstractTestRestApi.java | 34 ++++-- .../interpreter-create.html | 30 ++++- .../app/interpreter/interpreter.controller.js | 28 ++++- .../src/app/interpreter/interpreter.html | 27 +++- .../interpreter/InterpreterFactory.java | 2 +- .../interpreter/InterpreterSetting.java | 24 +++- .../InterpreterSettingManager.java | 75 +++++++----- .../helium/HeliumApplicationFactoryTest.java | 9 +- .../interpreter/InterpreterFactoryTest.java | 73 ++++++----- .../notebook/NoteInterpreterLoaderTest.java | 12 +- .../zeppelin/notebook/NotebookTest.java | 8 +- .../notebook/repo/VFSNotebookRepoTest.java | 5 +- 49 files changed, 872 insertions(+), 396 deletions(-) create mode 100644 zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/DefaultInterpreterProperty.java create mode 100644 zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java diff --git a/alluxio/src/main/resources/interpreter-setting.json b/alluxio/src/main/resources/interpreter-setting.json index 8b082abde4b..f73aae4b9c5 100644 --- a/alluxio/src/main/resources/interpreter-setting.json +++ b/alluxio/src/main/resources/interpreter-setting.json @@ -8,13 +8,15 @@ "envName": "ALLUXIO_MASTER_HOSTNAME", "propertyName": "alluxio.master.hostname", "defaultValue": "localhost", - "description": "Alluxio master hostname" + "description": "Alluxio master hostname", + "type": "text" }, "alluxio.master.port": { "envName": "ALLUXIO_MASTER_PORT", "propertyName": "alluxio.master.port", "defaultValue": "19998", - "description": "Alluxio master port" + "description": "Alluxio master port", + "type": "text" } }, "editor": { diff --git a/beam/src/main/resources/interpreter-setting.json b/beam/src/main/resources/interpreter-setting.json index 428b76ddd48..b6d5559fd6a 100644 --- a/beam/src/main/resources/interpreter-setting.json +++ b/beam/src/main/resources/interpreter-setting.json @@ -19,13 +19,15 @@ "envName": "ZEPPELIN_SCIO_ARGZ", "propertyName": "zeppelin.scio.argz", "defaultValue": "--runner=InProcessPipelineRunner", - "description": "Scio interpreter wide arguments" + "description": "Scio interpreter wide arguments", + "type": "text" }, "zeppelin.scio.maxResult": { "envName": "ZEPPELIN_SCIO_MAXRESULT", "propertyName": "zeppelin.scio.maxResult", "defaultValue": "1000", - "description": "Max number of SCollection results to display." + "description": "Max number of SCollection results to display.", + "type": "text" } }, "editor": { diff --git a/bigquery/src/main/resources/interpreter-setting.json b/bigquery/src/main/resources/interpreter-setting.json index b99a7639631..fbe0874de20 100644 --- a/bigquery/src/main/resources/interpreter-setting.json +++ b/bigquery/src/main/resources/interpreter-setting.json @@ -8,19 +8,22 @@ "envName": null, "propertyName": "zeppelin.bigquery.project_id", "defaultValue": " ", - "description": "Google Project ID" + "description": "Google Project ID", + "type": "text" }, "zeppelin.bigquery.wait_time": { "envName": null, "propertyName": "zeppelin.bigquery.wait_time", "defaultValue": "5000", - "description": "Query timeout in Milliseconds" + "description": "Query timeout in Milliseconds", + "type": "text" }, "zeppelin.bigquery.max_no_of_rows": { "envName": null, "propertyName": "zeppelin.bigquery.max_no_of_rows", "defaultValue": "100000", - "description": "Maximum number of rows to fetch from BigQuery" + "description": "Maximum number of rows to fetch from BigQuery", + "type": "text" } }, "editor": { diff --git a/cassandra/src/main/resources/interpreter-setting.json b/cassandra/src/main/resources/interpreter-setting.json index 3df120d985c..a94e555428d 100644 --- a/cassandra/src/main/resources/interpreter-setting.json +++ b/cassandra/src/main/resources/interpreter-setting.json @@ -8,187 +8,218 @@ "envName": null, "propertyName": "cassandra.hosts", "defaultValue": "localhost", - "description": "Comma separated Cassandra hosts (DNS name or IP address). Default = localhost. Ex: '192.168.0.12,node2,node3'" + "description": "Comma separated Cassandra hosts (DNS name or IP address). Default = localhost. Ex: '192.168.0.12,node2,node3'", + "type": "text" }, "cassandra.native.port": { "envName": null, "propertyName": "cassandra.native.port", "defaultValue": "9042", - "description": "Cassandra native port. Default = 9042" + "description": "Cassandra native port. Default = 9042", + "type": "text" }, "cassandra.protocol.version": { "envName": null, "propertyName": "cassandra.protocol.version", "defaultValue": "4", - "description": "Cassandra protocol version. Default = 4" + "description": "Cassandra protocol version. Default = 4", + "type": "text" }, "cassandra.cluster": { "envName": null, "propertyName": "cassandra.cluster", "defaultValue": "Test Cluster", - "description": "Cassandra cluster name. Default = 'Test Cluster'" + "description": "Cassandra cluster name. Default = 'Test Cluster'", + "type": "text" }, "cassandra.keyspace": { "envName": null, "propertyName": "cassandra.keyspace", "defaultValue": "system", - "description": "Cassandra keyspace name. Default = 'system'" + "description": "Cassandra keyspace name. Default = 'system'", + "type": "text" }, "cassandra.compression.protocol": { "envName": null, "propertyName": "cassandra.compression.protocol", "defaultValue": "NONE", - "description": "Cassandra compression protocol. Available values: NONE, SNAPPY, LZ4. Default = NONE" + "description": "Cassandra compression protocol. Available values: NONE, SNAPPY, LZ4. Default = NONE", + "type": "text" }, "cassandra.credentials.username": { "envName": null, "propertyName": "cassandra.credentials.username", "defaultValue": "none", - "description": "Cassandra credentials username. Default = 'none'" + "description": "Cassandra credentials username. Default = 'none'", + "type": "text" }, "cassandra.credentials.password": { "envName": null, "propertyName": "cassandra.credentials.password", "defaultValue": "none", - "description": "Cassandra credentials password. Default = 'none'" + "description": "Cassandra credentials password. Default = 'none'", + "type": "password" }, "cassandra.load.balancing.policy": { "envName": null, "propertyName": "cassandra.load.balancing.policy", "defaultValue": "DEFAULT", - "description": "Cassandra Load Balancing Policy. Default = new TokenAwarePolicy(new DCAwareRoundRobinPolicy())" + "description": "Cassandra Load Balancing Policy. Default = new TokenAwarePolicy(new DCAwareRoundRobinPolicy())", + "type": "text" }, "cassandra.retry.policy": { "envName": null, "propertyName": "cassandra.retry.policy", "defaultValue": "DEFAULT", - "description": "Cassandra Retry Policy. Default = DefaultRetryPolicy.INSTANCE" + "description": "Cassandra Retry Policy. Default = DefaultRetryPolicy.INSTANCE", + "type": "text" }, "cassandra.reconnection.policy": { "envName": null, "propertyName": "cassandra.reconnection.policy", "defaultValue": "DEFAULT", - "description": "Cassandra Reconnection Policy. Default = new ExponentialReconnectionPolicy(1000, 10 * 60 * 1000)" + "description": "Cassandra Reconnection Policy. Default = new ExponentialReconnectionPolicy(1000, 10 * 60 * 1000)", + "type": "text" }, "cassandra.speculative.execution.policy": { "envName": null, "propertyName": "cassandra.speculative.execution.policy", "defaultValue": "DEFAULT", - "description": "Cassandra Speculative Execution Policy. Default = NoSpeculativeExecutionPolicy.INSTANCE" + "description": "Cassandra Speculative Execution Policy. Default = NoSpeculativeExecutionPolicy.INSTANCE", + "type": "text" }, "cassandra.interpreter.parallelism": { "envName": null, "propertyName": "cassandra.interpreter.parallelism", "defaultValue": "10", - "description": "Cassandra interpreter parallelism.Default = 10" + "description": "Cassandra interpreter parallelism.Default = 10", + "type": "text" }, "cassandra.max.schema.agreement.wait.second": { "envName": null, "propertyName": "cassandra.max.schema.agreement.wait.second", "defaultValue": "10", - "description": "Cassandra max schema agreement wait in second.Default = ProtocolOptions.DEFAULT_MAX_SCHEMA_AGREEMENT_WAIT_SECONDS" + "description": "Cassandra max schema agreement wait in second.Default = ProtocolOptions.DEFAULT_MAX_SCHEMA_AGREEMENT_WAIT_SECONDS", + "type": "text" }, "cassandra.pooling.new.connection.threshold.local": { "envName": null, "propertyName": "cassandra.pooling.new.connection.threshold.local", "defaultValue": "100", - "description": "Cassandra new connection threshold local. Protocol V2 and below default = 100 Protocol V3 and above default = 800" + "description": "Cassandra new connection threshold local. Protocol V2 and below default = 100 Protocol V3 and above default = 800", + "type": "text" }, "cassandra.pooling.new.connection.threshold.remote": { "envName": null, "propertyName": "cassandra.pooling.new.connection.threshold.remote", "defaultValue": "100", - "description": "Cassandra new connection threshold remove. Protocol V2 and below default = 100 Protocol V3 and above default = 200" + "description": "Cassandra new connection threshold remove. Protocol V2 and below default = 100 Protocol V3 and above default = 200", + "type": "text" }, "cassandra.pooling.core.connection.per.host.local": { "envName": null, "propertyName": "cassandra.pooling.core.connection.per.host.local", "defaultValue": "2", - "description": "Cassandra core connection per host local. Protocol V2 and below default = 2 Protocol V3 and above default = 1" + "description": "Cassandra core connection per host local. Protocol V2 and below default = 2 Protocol V3 and above default = 1", + "type": "text" }, "cassandra.pooling.core.connection.per.host.remote": { "envName": null, "propertyName": "cassandra.pooling.core.connection.per.host.remote", "defaultValue": "1", - "description": "Cassandra core connection per host remove. Protocol V2 and below default = 1 Protocol V3 and above default = 1" + "description": "Cassandra core connection per host remove. Protocol V2 and below default = 1 Protocol V3 and above default = 1", + "type": "text" }, "cassandra.pooling.max.connection.per.host.local": { "envName": null, "propertyName": "cassandra.pooling.max.connection.per.host.local", "defaultValue": "8", - "description": "Cassandra max connection per host local. Protocol V2 and below default = 8 Protocol V3 and above default = 1" + "description": "Cassandra max connection per host local. Protocol V2 and below default = 8 Protocol V3 and above default = 1", + "type": "text" }, "cassandra.pooling.max.connection.per.host.remote": { "envName": null, "propertyName": "cassandra.pooling.max.connection.per.host.remote", "defaultValue": "2", - "description": "Cassandra max connection per host remote. Protocol V2 and below default = 2 Protocol V3 and above default = 1" + "description": "Cassandra max connection per host remote. Protocol V2 and below default = 2 Protocol V3 and above default = 1", + "type": "text" }, "cassandra.pooling.max.request.per.connection.local": { "envName": null, "propertyName": "cassandra.pooling.max.request.per.connection.local", "defaultValue": "1024", - "description": "Cassandra max request per connection local. Protocol V2 and below default = 128 Protocol V3 and above default = 1024" + "description": "Cassandra max request per connection local. Protocol V2 and below default = 128 Protocol V3 and above default = 1024", + "type": "text" }, "cassandra.pooling.max.request.per.connection.remote": { "envName": null, "propertyName": "cassandra.pooling.max.request.per.connection.remote", "defaultValue": "256", - "description": "Cassandra max request per connection remote. Protocol V2 and below default = 128 Protocol V3 and above default = 256" + "description": "Cassandra max request per connection remote. Protocol V2 and below default = 128 Protocol V3 and above default = 256", + "type": "text" }, "cassandra.pooling.idle.timeout.seconds": { "envName": null, "propertyName": "cassandra.pooling.idle.timeout.seconds", "defaultValue": "120", - "description": "Cassandra idle time out in seconds. Default = 120" + "description": "Cassandra idle time out in seconds. Default = 120", + "type": "text" }, "cassandra.pooling.pool.timeout.millisecs": { "envName": null, "propertyName": "cassandra.pooling.pool.timeout.millisecs", "defaultValue": "5000", - "description": "Cassandra pool time out in millisecs. Default = 5000" + "description": "Cassandra pool time out in millisecs. Default = 5000", + "type": "text" }, "cassandra.pooling.heartbeat.interval.seconds": { "envName": null, "propertyName": "cassandra.pooling.heartbeat.interval.seconds", "defaultValue": "30", - "description": "Cassandra pool heartbeat interval in secs. Default = 30" + "description": "Cassandra pool heartbeat interval in secs. Default = 30", + "type": "text" }, "cassandra.query.default.consistency": { "envName": null, "propertyName": "cassandra.query.default.consistency", "defaultValue": "ONE", - "description": "Cassandra query default consistency level. Default = ONE" + "description": "Cassandra query default consistency level. Default = ONE", + "type": "text" }, "cassandra.query.default.serial.consistency": { "envName": null, "propertyName": "cassandra.query.default.serial.consistency", "defaultValue": "SERIAL", - "description": "Cassandra query default serial consistency level. Default = SERIAL" + "description": "Cassandra query default serial consistency level. Default = SERIAL", + "type": "text" }, "cassandra.query.default.fetchSize": { "envName": null, "propertyName": "cassandra.query.default.fetchSize", "defaultValue": "5000", - "description": "Cassandra query default fetch size. Default = 5000" + "description": "Cassandra query default fetch size. Default = 5000", + "type": "text" }, "cassandra.socket.connection.timeout.millisecs": { "envName": null, "propertyName": "cassandra.socket.connection.timeout.millisecs", "defaultValue": "5000", - "description": "Cassandra socket default connection timeout in millisecs. Default = 5000" + "description": "Cassandra socket default connection timeout in millisecs. Default = 5000", + "type": "text" }, "cassandra.socket.read.timeout.millisecs": { "envName": null, "propertyName": "cassandra.socket.read.timeout.millisecs", "defaultValue": "12000", - "description": "Cassandra socket read timeout in millisecs. Default = 12000" + "description": "Cassandra socket read timeout in millisecs. Default = 12000", + "type": "text" }, "cassandra.socket.tcp.no_delay": { "envName": null, "propertyName": "cassandra.socket.tcp.no_delay", "defaultValue": "true", - "description": "Cassandra socket TCP no delay. Default = true" + "description": "Cassandra socket TCP no delay. Default = true", + "type": "text" } }, "editor": { diff --git a/docs/development/writingzeppelininterpreter.md b/docs/development/writingzeppelininterpreter.md index c5fb23ccad0..e106461a30c 100644 --- a/docs/development/writingzeppelininterpreter.md +++ b/docs/development/writingzeppelininterpreter.md @@ -61,13 +61,15 @@ Here is an example of `interpreter-setting.json` on your own interpreter. "envName": null, "propertyName": "property.1.name", "defaultValue": "propertyDefaultValue", - "description": "Property description" + "description": "Property description", + "type": "text" }, "properties2": { "envName": PROPERTIES_2, "propertyName": null, "defaultValue": "property2DefaultValue", - "description": "Property 2 description" + "description": "Property 2 description", + "type": "text" }, ... }, "editor": { diff --git a/docs/install/upgrade.md b/docs/install/upgrade.md index 44e38a3ae64..1575d181a61 100644 --- a/docs/install/upgrade.md +++ b/docs/install/upgrade.md @@ -60,4 +60,39 @@ So, copying `notebook` and `conf` directory should be enough. ### Upgrading from Zeppelin 0.7 to 0.8 - From 0.8, we recommend to use `PYSPARK_PYTHON` and `PYSPARK_DRIVER_PYTHON` instead of `zeppelin.pyspark.python` as `zeppelin.pyspark.python` only effects driver. You can use `PYSPARK_PYTHON` and `PYSPARK_DRIVER_PYTHON` as using them in spark. + - From 0.8, changed the format settings for interpreters (`interpreter.json`) + + old format: + ``` + "interpreterSettings": { + "2CD8TH1XV": { + "id": "2CD8TH1XV", + "name": "spark", + "group": "spark", + "properties": { + "spark.executor.memory": "", + "zeppelin.spark.concurrentSQL": "false", + ... + } + ``` + new format: + ``` + "interpreterSettings": { + "2CD8TH1XV": { + "id": "2CD8TH1XV", + "name": "spark", + "group": "spark", + "properties": { + "spark.executor.memory": { + "name": "spark.executor.memory", + "value": "", + "type": "text" + }, + "zeppelin.spark.concurrentSQL": { + "name": "zeppelin.spark.concurrentSQL", + "value": "false", + "type": "text" + ... + } + ``` \ No newline at end of file diff --git a/docs/rest-api/rest-interpreter.md b/docs/rest-api/rest-interpreter.md index d7dc6dd14a1..a38f8fbcafb 100644 --- a/docs/rest-api/rest-interpreter.md +++ b/docs/rest-api/rest-interpreter.md @@ -76,11 +76,13 @@ The role of registered interpreters, settings and interpreters group are describ "properties": { "spark.executor.memory": { "defaultValue": "1g", - "description": "Executor memory per worker instance. ex) 512m, 32g" + "description": "Executor memory per worker instance. ex) 512m, 32g", + "type": "text }, "spark.cores.max": { "defaultValue": "", - "description": "Total number of cores to use. Empty value uses all available core." + "description": "Total number of cores to use. Empty value uses all available core.", + "type": "text" }, }, "path": "/zeppelin/interpreter/spark" @@ -92,7 +94,8 @@ The role of registered interpreters, settings and interpreters group are describ "properties": { "zeppelin.spark.maxResult": { "defaultValue": "1000", - "description": "Max number of Spark SQL result to display." + "description": "Max number of Spark SQL result to display.", + "type": "text" } }, "path": "/zeppelin/interpreter/spark" @@ -153,8 +156,16 @@ The role of registered interpreters, settings and interpreters group are describ "name": "spark", "group": "spark", "properties": { - "spark.cores.max": "", - "spark.executor.memory": "1g", + "spark.cores.max": { + name: "", + value: "spark.cores.max", + type: "text" + }, + "spark.executor.memory": { + "name": "", + "value": "1g", + "type": "text" + } }, "interpreterGroup": [ { @@ -215,7 +226,11 @@ The role of registered interpreters, settings and interpreters group are describ "name": "Markdown setting name", "group": "md", "properties": { - "propname": "propvalue" + "propname": { + "name": "propname", + "value": "propvalue", + "type": "text" + } }, "interpreterGroup": [ { @@ -270,7 +285,10 @@ The role of registered interpreters, settings and interpreters group are describ "name": "Markdown setting name", "group": "md", "properties": { - "propname": "propvalue" + "propname": { + "name": "propname", + "value": "propvalue", + "type": "text" }, "interpreterGroup": [ { @@ -302,7 +320,10 @@ The role of registered interpreters, settings and interpreters group are describ "name": "Markdown setting name", "group": "md", "properties": { - "propname": "propvalue" + "propname": { + "name": "propname", + "value": "propvalue", + "type": "text" }, "interpreterGroup": [ { @@ -353,7 +374,10 @@ The role of registered interpreters, settings and interpreters group are describ "name": "Markdown setting name", "group": "md", "properties": { - "propname": "Otherpropvalue" + "propname": { + "name": "propname", + "value": "Otherpropvalue", + "type": "text" }, "interpreterGroup": [ { @@ -385,7 +409,10 @@ The role of registered interpreters, settings and interpreters group are describ "name": "Markdown setting name", "group": "md", "properties": { - "propname": "Otherpropvalue" + "propname": { + "name": "propname", + "value": "Otherpropvalue", + "type": "text" }, "interpreterGroup": [ { @@ -541,3 +568,36 @@ The role of registered interpreters, settings and interpreters group are describ +
+### Get available types for property + + + + + + + + + + + + + + + + + + + + + + +
DescriptionThis ```GET``` method returns available types for interpreter property.
URL```http://[zeppelin-server]:[zeppelin-port]/api/interpreter/property/types```
Success code200
Fail code 500
Sample JSON response +
+{
+  "status": "OK",
+  "body": ["text", "password"]
+}            
+          
+
+ diff --git a/elasticsearch/src/main/resources/interpreter-setting.json b/elasticsearch/src/main/resources/interpreter-setting.json index 18200ae82f9..af471d9f3d7 100644 --- a/elasticsearch/src/main/resources/interpreter-setting.json +++ b/elasticsearch/src/main/resources/interpreter-setting.json @@ -8,31 +8,36 @@ "envName": "ELASTICSEARCH_HOST", "propertyName": "elasticsearch.host", "defaultValue": "localhost", - "description": "The host for Elasticsearch" + "description": "The host for Elasticsearch", + "type": "text" }, "elasticsearch.port": { "envName": "ELASTICSEARCH_PORT", "propertyName": "elasticsearch.port", "defaultValue": "9300", - "description": "The port for Elasticsearch" + "description": "The port for Elasticsearch", + "type": "text" }, "elasticsearch.client.type": { "envName": "ELASTICSEARCH_CLIENT_TYPE", "propertyName": "elasticsearch.client.type", "defaultValue": "transport", - "description": "The type of client for Elasticsearch (transport or http)" + "description": "The type of client for Elasticsearch (transport or http)", + "type": "text" }, "elasticsearch.cluster.name": { "envName": "ELASTICSEARCH_CLUSTER_NAME", "propertyName": "elasticsearch.cluster.name", "defaultValue": "elasticsearch", - "description": "The cluster name for Elasticsearch" + "description": "The cluster name for Elasticsearch", + "type": "text" }, "elasticsearch.result.size": { "envName": "ELASTICSEARCH_RESULT_SIZE", "propertyName": "elasticsearch.result.size", "defaultValue": "10", - "description": "The size of the result set of a search query" + "description": "The size of the result set of a search query", + "type": "text" }, "elasticsearch.basicauth.username": { "envName": "ELASTICSEARCH_BASIC_AUTH_USERNAME", @@ -44,7 +49,8 @@ "envName": "ELASTICSEARCH_BASIC_AUTH_PASSWORD", "propertyName": "elasticsearch.basicauth.password", "defaultValue": "", - "description": "Password for a basic authentication" + "description": "Password for a basic authentication", + "type": "password" } }, "editor": { diff --git a/file/src/main/resources/interpreter-setting.json b/file/src/main/resources/interpreter-setting.json index b4f9199c8d7..0560e749d83 100644 --- a/file/src/main/resources/interpreter-setting.json +++ b/file/src/main/resources/interpreter-setting.json @@ -8,19 +8,22 @@ "envName": null, "propertyName": "hdfs.url", "defaultValue": "http://localhost:50070/webhdfs/v1/", - "description": "The URL for WebHDFS" + "description": "The URL for WebHDFS", + "type": "text" }, "hdfs.user": { "envName": null, "propertyName": "hdfs.user", "defaultValue": "hdfs", - "description": "The WebHDFS user" + "description": "The WebHDFS user", + "type": "text" }, "hdfs.maxlength": { "envName": null, "propertyName": "hdfs.maxlength", "defaultValue": "1000", - "description": "Maximum number of lines of results fetched" + "description": "Maximum number of lines of results fetched", + "type": "text" } }, "editor": { diff --git a/flink/src/main/resources/interpreter-setting.json b/flink/src/main/resources/interpreter-setting.json index 0d4cf6bee5d..395ef7f8286 100644 --- a/flink/src/main/resources/interpreter-setting.json +++ b/flink/src/main/resources/interpreter-setting.json @@ -8,13 +8,15 @@ "envName": "host", "propertyName": null, "defaultValue": "local", - "description": "host name of running JobManager. 'local' runs flink in local mode." + "description": "host name of running JobManager. 'local' runs flink in local mode.", + "type": "text" }, "port": { "envName": "port", "propertyName": null, "defaultValue": "6123", - "description": "port of running JobManager." + "description": "port of running JobManager.", + "type": "text" } }, "editor": { diff --git a/geode/src/main/resources/interpreter-setting.json b/geode/src/main/resources/interpreter-setting.json index f67cfef86f5..5f0e79c63bd 100644 --- a/geode/src/main/resources/interpreter-setting.json +++ b/geode/src/main/resources/interpreter-setting.json @@ -8,19 +8,22 @@ "envName": null, "propertyName": "geode.locator.host", "defaultValue": "localhost", - "description": "The Geode Locator Host." + "description": "The Geode Locator Host.", + "type": "text" }, "geode.locator.port": { "envName": null, "propertyName": "geode.locator.port", "defaultValue": "10334", - "description": "The Geode Locator Port." + "description": "The Geode Locator Port.", + "type": "text" }, "geode.max.result": { "envName": null, "propertyName": "geode.max.result", "defaultValue": "1000", - "description": "Max number of OQL result to display." + "description": "Max number of OQL result to display.", + "type": "text" } }, "editor": { diff --git a/groovy/src/main/resources/interpreter-setting.json b/groovy/src/main/resources/interpreter-setting.json index 552f6005861..92e94c9487f 100644 --- a/groovy/src/main/resources/interpreter-setting.json +++ b/groovy/src/main/resources/interpreter-setting.json @@ -8,7 +8,8 @@ "envName": null, "propertyName": "GROOVY_CLASSES", "defaultValue": "", - "description": "The path for custom groovy classes location. If empty `./interpreter/groovy/classes`" + "description": "The path for custom groovy classes location. If empty `./interpreter/groovy/classes`", + "type": "text" } } } diff --git a/hbase/src/main/resources/interpreter-setting.json b/hbase/src/main/resources/interpreter-setting.json index aa442953a34..afe6dddd8c5 100644 --- a/hbase/src/main/resources/interpreter-setting.json +++ b/hbase/src/main/resources/interpreter-setting.json @@ -8,17 +8,20 @@ "envName": "HBASE_HOME", "propertyName": "hbase.home", "defaultValue": "/usr/lib/hbase/", - "description": "Installation directory of HBase" + "description": "Installation directory of HBase", + "type": "text" }, "hbase.ruby.sources": { "propertyName": "hbase.ruby.sources", "defaultValue": "lib/ruby", - "description": "Path to Ruby scripts relative to 'hbase.home'" + "description": "Path to Ruby scripts relative to 'hbase.home'", + "type": "text" }, "zeppelin.hbase.test.mode": { "propertyName": "zeppelin.hbase.test.mode", "defaultValue": "false", - "description": "Disable checks for unit and manual tests" + "description": "Disable checks for unit and manual tests", + "type": "text" } }, "editor": { diff --git a/helium-dev/src/main/resources/interpreter-setting.json b/helium-dev/src/main/resources/interpreter-setting.json index b3a70100cd2..9383f27a6f9 100644 --- a/helium-dev/src/main/resources/interpreter-setting.json +++ b/helium-dev/src/main/resources/interpreter-setting.json @@ -8,7 +8,8 @@ "envName": "PORT", "propertyName": "port", "defaultValue": "jdbc:postgresql://localhost:5432/", - "description": "The URL for JDBC." + "description": "The URL for JDBC.", + "type": "text" } }, "editor": { diff --git a/ignite/src/main/resources/interpreter-setting.json b/ignite/src/main/resources/interpreter-setting.json index 92cf75b4223..a8e62d7a3b9 100644 --- a/ignite/src/main/resources/interpreter-setting.json +++ b/ignite/src/main/resources/interpreter-setting.json @@ -8,25 +8,29 @@ "envName": null, "propertyName": "ignite.addresses", "defaultValue": "127.0.0.1:47500..47509", - "description": "Comma separated list of addresses (e.g. 127.0.0.1:47500 or 127.0.0.1:47500..47509)" + "description": "Comma separated list of addresses (e.g. 127.0.0.1:47500 or 127.0.0.1:47500..47509)", + "type": "text" }, "ignite.clientMode": { "envName": null, "propertyName": "ignite.clientMode", "defaultValue": "true", - "description": "Client mode. true or false" + "description": "Client mode. true or false", + "type": "text" }, "ignite.config.url": { "envName": null, "propertyName": "ignite.config.url", "defaultValue": "", - "description": "Configuration URL. Overrides all other settings." + "description": "Configuration URL. Overrides all other settings.", + "type": "text" }, "ignite.peerClassLoadingEnabled": { "envName": null, "propertyName": "ignite.peerClassLoadingEnabled", "defaultValue": "true", - "description": "Peer class loading enabled. True or false" + "description": "Peer class loading enabled. True or false", + "type": "text" } } }, @@ -39,7 +43,8 @@ "envName": null, "propertyName": "ignite.jdbc.url", "defaultValue": "jdbc:ignite:cfg://default-ignite-jdbc.xml", - "description": "Ignite JDBC connection URL." + "description": "Ignite JDBC connection URL.", + "type": "text" } } } diff --git a/jdbc/src/main/resources/interpreter-setting.json b/jdbc/src/main/resources/interpreter-setting.json index 322ea5ac791..a744ab4ddbd 100644 --- a/jdbc/src/main/resources/interpreter-setting.json +++ b/jdbc/src/main/resources/interpreter-setting.json @@ -8,67 +8,78 @@ "envName": null, "propertyName": "default.url", "defaultValue": "jdbc:postgresql://localhost:5432/", - "description": "The URL for JDBC." + "description": "The URL for JDBC.", + "type": "text" }, "default.user": { "envName": null, "propertyName": "default.user", "defaultValue": "gpadmin", - "description": "The JDBC user name" + "description": "The JDBC user name", + "type": "text" }, "default.password": { "envName": null, "propertyName": "default.password", "defaultValue": "", - "description": "The JDBC user password" + "description": "The JDBC user password", + "type": "password" }, "default.driver": { "envName": null, "propertyName": "default.driver", "defaultValue": "org.postgresql.Driver", - "description": "JDBC Driver Name" + "description": "JDBC Driver Name", + "type": "text" }, "default.precode": { "envName": null, "propertyName": "zeppelin.jdbc.precode", "defaultValue": "", - "description": "SQL which executes while opening connection" + "description": "SQL which executes while opening connection", + "type": "text" }, "common.max_count": { "envName": null, "propertyName": "common.max_count", "defaultValue": "1000", - "description": "Max number of SQL result to display." + "description": "Max number of SQL result to display.", + "type": "text" }, "zeppelin.jdbc.auth.type": { "envName": null, "propertyName": "zeppelin.jdbc.auth.type", "defaultValue": "", - "description": "If auth type is needed, Example: KERBEROS" + "description": "If auth type is needed, Example: KERBEROS", + "type": "text" }, "zeppelin.jdbc.concurrent.use": { "envName": null, "propertyName": "zeppelin.jdbc.concurrent.use", "defaultValue": "true", - "description": "Use parallel scheduler" + "description": "Use parallel scheduler", + "type": "text" }, "zeppelin.jdbc.concurrent.max_connection": { "envName": null, "propertyName": "zeppelin.jdbc.concurrent.max_connection", "defaultValue": "10", - "description": "Number of concurrent execution" + "description": "Number of concurrent execution", + "type": "text" }, "zeppelin.jdbc.keytab.location": { "envName": null, "propertyName": "zeppelin.jdbc.keytab.location", "defaultValue": "", - "description": "Kerberos keytab location" + "description": "Kerberos keytab location", + "type": "text" }, "zeppelin.jdbc.principal": { "envName": null, "propertyName": "zeppelin.jdbc.principal", "defaultValue": "", - "description": "Kerberos principal" + "description": "Kerberos principal", + "type": "text" } }, "editor": { diff --git a/kylin/src/main/resources/interpreter-setting.json b/kylin/src/main/resources/interpreter-setting.json index a8c0d32ef65..271294f46c4 100644 --- a/kylin/src/main/resources/interpreter-setting.json +++ b/kylin/src/main/resources/interpreter-setting.json @@ -8,43 +8,50 @@ "envName": null, "propertyName": "kylin.api.url", "defaultValue": "http://localhost:7070/kylin/api/query", - "description": "Kylin API" + "description": "Kylin API", + "type": "text" }, "kylin.api.user": { "envName": null, "propertyName": "kylin.api.user", "defaultValue": "ADMIN", - "description": "Kylin username" + "description": "Kylin username", + "type": "text" }, "kylin.api.password": { "envName": null, "propertyName": "kylin.api.password", "defaultValue": "KYLIN", - "description": "Kylin password" + "description": "Kylin password", + "type": "password" }, "kylin.query.project": { "envName": null, "propertyName": "kylin.query.project", "defaultValue": "learn_kylin", - "description": "Default Kylin project name" + "description": "Default Kylin project name", + "type": "text" }, "kylin.query.offset": { "envName": null, "propertyName": "kylin.query.offset", "defaultValue": "0", - "description": "Kylin query offset" + "description": "Kylin query offset", + "type": "text" }, "kylin.query.limit": { "envName": null, "propertyName": "kylin.query.limit", "defaultValue": "5000", - "description": "Kylin query limit" + "description": "Kylin query limit", + "type": "text" }, "kylin.query.ispartial": { "envName": null, "propertyName": "kylin.query.ispartial", "defaultValue": "true", - "description": "Kylin query partial flag, deprecated" + "description": "Kylin query partial flag, deprecated", + "type": "text" } }, "editor": { diff --git a/lens/src/main/resources/interpreter-setting.json b/lens/src/main/resources/interpreter-setting.json index 427b01f4650..1524dcd6208 100644 --- a/lens/src/main/resources/interpreter-setting.json +++ b/lens/src/main/resources/interpreter-setting.json @@ -8,43 +8,50 @@ "envName": null, "propertyName": "zeppelin.lens.run.concurrent", "defaultValue": "true", - "description": "Run concurrent Lens Sessions" + "description": "Run concurrent Lens Sessions", + "type": "text" }, "zeppelin.lens.maxThreads": { "envName": null, "propertyName": "zeppelin.lens.maxThreads", "defaultValue": "10", - "description": "If concurrency is true then how many threads?" + "description": "If concurrency is true then how many threads?", + "type": "text" }, "zeppelin.lens.maxResults": { "envName": null, "propertyName": "zeppelin.lens.maxResults", "defaultValue": "1000", - "description": "max number of rows to display" + "description": "max number of rows to display", + "type": "text" }, "lens.server.base.url": { "envName": null, "propertyName": "lens.server.base.url", "defaultValue": "http://:/lensapi", - "description": "The URL for Lens Server" + "description": "The URL for Lens Server", + "type": "text" }, "lens.client.dbname": { "envName": null, "propertyName": "lens.client.dbname", "defaultValue": "default", - "description": "The database schema name" + "description": "The database schema name", + "type": "text" }, "lens.query.enable.persistent.resultset": { "envName": null, "propertyName": "lens.query.enable.persistent.resultset", "defaultValue": "false", - "description": "Apache Lens to persist result in HDFS?" + "description": "Apache Lens to persist result in HDFS?", + "type": "text" }, "lens.session.cluster.user": { "envName": null, "propertyName": "lens.session.cluster.user", "defaultValue": "default", - "description": "Hadoop cluster username" + "description": "Hadoop cluster username", + "type": "text" } } } diff --git a/livy/src/main/resources/interpreter-setting.json b/livy/src/main/resources/interpreter-setting.json index 8d3dea0f395..bf73fddbfa6 100644 --- a/livy/src/main/resources/interpreter-setting.json +++ b/livy/src/main/resources/interpreter-setting.json @@ -9,88 +9,105 @@ "envName": "ZEPPELIN_LIVY_HOST_URL", "propertyName": "zeppelin.livy.url", "defaultValue": "http://localhost:8998", - "description": "The URL for Livy Server." + "description": "The URL for Livy Server.", + "type": "text" }, "zeppelin.livy.session.create_timeout": { "envName": "ZEPPELIN_LIVY_SESSION_CREATE_TIMEOUT", "propertyName": "zeppelin.livy.session.create_timeout", "defaultValue": "120", - "description": "Livy Server create session timeout (seconds)." + "description": "Livy Server create session timeout (seconds).", + "type": "text" }, "livy.spark.driver.cores": { "propertyName": "livy.spark.driver.cores", "defaultValue": "", - "description": "Driver cores. ex) 1, 2" + "description": "Driver cores. ex) 1, 2", + "type": "text" }, "livy.spark.driver.memory": { "propertyName": "livy.spark.driver.memory", "defaultValue": "", - "description": "Driver memory. ex) 512m, 32g" + "description": "Driver memory. ex) 512m, 32g", + "type": "text" }, "livy.spark.executor.instances": { "propertyName": "livy.spark.executor.instances", "defaultValue": "", - "description": "Executor instances. ex) 1, 4" + "description": "Executor instances. ex) 1, 4", + "type": "text" }, "livy.spark.executor.cores": { "propertyName": "livy.spark.executor.cores", "defaultValue": "", - "description": "Num cores per executor. ex) 1, 4" + "description": "Num cores per executor. ex) 1, 4", + "type": "text" }, "livy.spark.executor.memory": { "propertyName": "livy.spark.executor.memory", "defaultValue": "", - "description": "Executor memory per worker instance. ex) 512m, 32g" + "description": "Executor memory per worker instance. ex) 512m, 32g", + "type": "text" }, "livy.spark.dynamicAllocation.enabled": { "propertyName": "livy.spark.dynamicAllocation.enabled", "defaultValue": "", - "description": "Use dynamic resource allocation" + "description": "Use dynamic resource allocation", + "type": "text" }, "livy.spark.dynamicAllocation.cachedExecutorIdleTimeout": { "propertyName": "livy.spark.dynamicAllocation.cachedExecutorIdleTimeout", "defaultValue": "", - "description": "Remove an executor which has cached data blocks" + "description": "Remove an executor which has cached data blocks", + "type": "text" }, "livy.spark.dynamicAllocation.minExecutors": { "propertyName": "livy.spark.dynamicAllocation.minExecutors", "defaultValue": "", - "description": "Lower bound for the number of executors if dynamic allocation is enabled." + "description": "Lower bound for the number of executors if dynamic allocation is enabled.", + "type": "text" }, "livy.spark.dynamicAllocation.initialExecutors": { "propertyName": "livy.spark.dynamicAllocation.initialExecutors", "defaultValue": "", - "description": "Initial number of executors to run if dynamic allocation is enabled." + "description": "Initial number of executors to run if dynamic allocation is enabled.", + "type": "text" }, "livy.spark.dynamicAllocation.maxExecutors": { "propertyName": "livy.spark.dynamicAllocation.maxExecutors", "defaultValue": "", - "description": "Upper bound for the number of executors if dynamic allocation is enabled." + "description": "Upper bound for the number of executors if dynamic allocation is enabled.", + "type": "text" }, "zeppelin.livy.principal": { "propertyName": "zeppelin.livy.principal", "defaultValue": "", - "description": "Kerberos principal to authenticate livy" + "description": "Kerberos principal to authenticate livy", + "type": "text" }, "zeppelin.livy.keytab": { "propertyName": "zeppelin.livy.keytab", "defaultValue": "", - "description": "Kerberos keytab to authenticate livy" + "description": "Kerberos keytab to authenticate livy", + "type": "text" }, "zeppelin.livy.pull_status.interval.millis": { "propertyName": "zeppelin.livy.pull_status.interval.millis", "defaultValue": "1000", - "description": "The interval for checking paragraph execution status" + "description": "The interval for checking paragraph execution status", + "type": "text" }, "livy.spark.jars.packages": { "propertyName": "livy.spark.jars.packages", "defaultValue": "", - "description": "Adding extra libraries to livy interpreter" + "description": "Adding extra libraries to livy interpreter", + "type": "text" }, "zeppelin.livy.displayAppInfo": { "propertyName": "zeppelin.livy.displayAppInfo", "defaultValue": "false", - "description": "Whether display app info" + "description": "Whether display app info", + "type": "text" } }, "option": { @@ -116,17 +133,20 @@ "envName": "ZEPPELIN_LIVY_MAXRESULT", "propertyName": "zeppelin.livy.spark.sql.maxResult", "defaultValue": "1000", - "description": "Max number of Spark SQL result to display." + "description": "Max number of Spark SQL result to display.", + "type": "text" }, "zeppelin.livy.spark.sql.field.truncate": { "propertyName": "zeppelin.livy.spark.sql.field.truncate", "defaultValue": "true", - "description": "If true, truncate field values longer than 20 characters." + "description": "If true, truncate field values longer than 20 characters.", + "type": "text" }, "zeppelin.livy.concurrentSQL": { "propertyName": "zeppelin.livy.concurrentSQL", "defaultValue": "false", - "description": "Execute multiple SQL concurrently if set true." + "description": "Execute multiple SQL concurrently if set true.", + "type": "text" } }, "option": { diff --git a/markdown/src/main/resources/interpreter-setting.json b/markdown/src/main/resources/interpreter-setting.json index 9e670da54d1..6724657a890 100644 --- a/markdown/src/main/resources/interpreter-setting.json +++ b/markdown/src/main/resources/interpreter-setting.json @@ -8,7 +8,8 @@ "envName": "MARKDOWN_PARSER_TYPE", "propertyName": "markdown.parser.type", "defaultValue": "pegdown", - "description": "Markdown Parser Type. Available values: pegdown, markdown4j. Default = pegdown" + "description": "Markdown Parser Type. Available values: pegdown, markdown4j. Default = pegdown", + "type": "text" } }, "editor": { diff --git a/pig/src/main/resources/interpreter-setting.json b/pig/src/main/resources/interpreter-setting.json index 583a1268aee..540404d0cb9 100644 --- a/pig/src/main/resources/interpreter-setting.json +++ b/pig/src/main/resources/interpreter-setting.json @@ -8,13 +8,15 @@ "envName": null, "propertyName": "zeppelin.pig.execType", "defaultValue": "mapreduce", - "description": "local | mapreduce | tez" + "description": "local | mapreduce | tez", + "type": "text" }, "zeppelin.pig.includeJobStats": { "envName": null, "propertyName": "zeppelin.pig.includeJobStats", "defaultValue": "false", - "description": "flag to include job stats in output" + "description": "flag to include job stats in output", + "type": "text" } }, "editor": { @@ -31,13 +33,15 @@ "envName": null, "propertyName": "zeppelin.pig.execType", "defaultValue": "mapreduce", - "description": "local | mapreduce | tez" + "description": "local | mapreduce | tez", + "type": "text" }, "zeppelin.pig.maxResult": { "envName": null, "propertyName": "zeppelin.pig.maxResult", "defaultValue": "1000", - "description": "max row number for %pig.query" + "description": "max row number for %pig.query", + "type": "text" } }, "editor": { diff --git a/python/src/main/resources/interpreter-setting.json b/python/src/main/resources/interpreter-setting.json index bc4d4ec5280..65d26e3c880 100644 --- a/python/src/main/resources/interpreter-setting.json +++ b/python/src/main/resources/interpreter-setting.json @@ -8,13 +8,15 @@ "envName": null, "propertyName": "zeppelin.python", "defaultValue": "python", - "description": "Python directory. It is set to python by default.(assume python is in your $PATH)" + "description": "Python directory. It is set to python by default.(assume python is in your $PATH)", + "type": "text" }, "zeppelin.python.maxResult": { "envName": null, "propertyName": "zeppelin.python.maxResult", "defaultValue": "1000", - "description": "Max number of dataframe rows to display." + "description": "Max number of dataframe rows to display.", + "type": "text" } }, "editor": { diff --git a/r/src/main/resources/interpreter-setting.json b/r/src/main/resources/interpreter-setting.json index 3a751eb0358..94d8e449fcf 100644 --- a/r/src/main/resources/interpreter-setting.json +++ b/r/src/main/resources/interpreter-setting.json @@ -6,19 +6,23 @@ "properties": { "rhadoop.cmd": { "envName": "HADOOP_CMD", - "defaultValue": "" + "defaultValue": "", + "type": "text" }, "rhadooop.streamingjar": { "envName": "HADOOP_STREAMING", - "defaultValue": "" + "defaultValue": "", + "type": "text" }, "rscala.debug": { "envName": "RSCALA_DEBUG", - "defaultValue": "false" + "defaultValue": "false", + "type": "text" }, "rscala.timeout": { "envName": "RSCALA_TIMEOUT", - "defaultValue": "60" + "defaultValue": "60", + "type": "text" } } }, @@ -29,19 +33,23 @@ "properties": { "rhadoop.cmd": { "envName": "HADOOP_CMD", - "defaultValue": "" + "defaultValue": "", + "type": "text" }, "rhadooop.streamingjar": { "envName": "HADOOP_STREAMING", - "defaultValue": "" + "defaultValue": "", + "type": "text" }, "rscala.debug": { "envName": "RSCALA_DEBUG", - "defaultValue": "false" + "defaultValue": "false", + "type": "text" }, "rscala.timeout": { "envName": "RSCALA_TIMEOUT", - "defaultValue": "60" + "defaultValue": "60", + "type": "text" } } } diff --git a/scalding/src/main/resources/interpreter-setting.json b/scalding/src/main/resources/interpreter-setting.json index a2efa4d1ca3..4fdb0a22614 100644 --- a/scalding/src/main/resources/interpreter-setting.json +++ b/scalding/src/main/resources/interpreter-setting.json @@ -7,12 +7,14 @@ "args.string": { "envName": null, "defaultValue": "--local --repl", - "description": "Arguments for scalding REPL" + "description": "Arguments for scalding REPL", + "type": "text" }, "max.open.instances": { "envName": null, "defaultValue": "50", - "description": "Maximum number of open interpreter instances" + "description": "Maximum number of open interpreter instances", + "type": "text" } } } diff --git a/shell/src/main/resources/interpreter-setting.json b/shell/src/main/resources/interpreter-setting.json index c12b5455a45..811b58a27f0 100644 --- a/shell/src/main/resources/interpreter-setting.json +++ b/shell/src/main/resources/interpreter-setting.json @@ -8,25 +8,29 @@ "envName": "SHELL_COMMAND_TIMEOUT", "propertyName": "shell.command.timeout.millisecs", "defaultValue": "60000", - "description": "Shell command time out in millisecs. Default = 60000" + "description": "Shell command time out in millisecs. Default = 60000", + "type": "text" }, "zeppelin.shell.auth.type": { "envName": null, "propertyName": "zeppelin.shell.auth.type", "defaultValue": "", - "description": "If auth type is needed, Example: KERBEROS" + "description": "If auth type is needed, Example: KERBEROS", + "type": "text" }, "zeppelin.shell.keytab.location": { "envName": null, "propertyName": "zeppelin.shell.keytab.location", "defaultValue": "", - "description": "Kerberos keytab location" + "description": "Kerberos keytab location", + "type": "text" }, "zeppelin.shell.principal": { "envName": null, "propertyName": "zeppelin.shell.principal", "defaultValue": "", - "description": "Kerberos principal" + "description": "Kerberos principal", + "type": "text" } }, "editor": { diff --git a/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java b/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java index af97d87d926..1a36a327229 100644 --- a/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java +++ b/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java @@ -26,18 +26,21 @@ import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader; -import java.util.*; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Properties; +import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; -import com.google.common.base.Joiner; - import org.apache.commons.lang3.StringUtils; import org.apache.hadoop.security.UserGroupInformation; +import org.apache.spark.SecurityManager; import org.apache.spark.SparkConf; import org.apache.spark.SparkContext; import org.apache.spark.SparkEnv; - -import org.apache.spark.SecurityManager; import org.apache.spark.api.java.JavaSparkContext; import org.apache.spark.repl.SparkILoop; import org.apache.spark.scheduler.ActiveJob; @@ -47,20 +50,21 @@ import org.apache.spark.sql.SQLContext; import org.apache.spark.ui.SparkUI; import org.apache.spark.ui.jobs.JobProgressListener; +import org.apache.zeppelin.interpreter.DefaultInterpreterProperty; import org.apache.zeppelin.interpreter.Interpreter; import org.apache.zeppelin.interpreter.InterpreterContext; import org.apache.zeppelin.interpreter.InterpreterException; import org.apache.zeppelin.interpreter.InterpreterHookRegistry; -import org.apache.zeppelin.interpreter.InterpreterProperty; +import org.apache.zeppelin.interpreter.InterpreterPropertyType; import org.apache.zeppelin.interpreter.InterpreterResult; import org.apache.zeppelin.interpreter.InterpreterResult.Code; import org.apache.zeppelin.interpreter.InterpreterUtils; import org.apache.zeppelin.interpreter.WrappedInterpreter; +import org.apache.zeppelin.interpreter.remote.RemoteEventClientWrapper; +import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion; import org.apache.zeppelin.interpreter.util.InterpreterOutputStream; import org.apache.zeppelin.resource.ResourcePool; import org.apache.zeppelin.resource.WellKnownResourceName; -import org.apache.zeppelin.interpreter.remote.RemoteEventClientWrapper; -import org.apache.zeppelin.interpreter.thrift.InterpreterCompletion; import org.apache.zeppelin.scheduler.Scheduler; import org.apache.zeppelin.scheduler.SchedulerFactory; import org.apache.zeppelin.spark.dep.SparkDependencyContext; @@ -68,8 +72,13 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import scala.*; +import com.google.common.base.Joiner; +import scala.Console; import scala.Enumeration.Value; +import scala.None; +import scala.Option; +import scala.Some; +import scala.Tuple2; import scala.collection.Iterator; import scala.collection.JavaConversions; import scala.collection.JavaConverters; @@ -517,11 +526,14 @@ public SparkContext createSparkContext_1() { } private void setupConfForPySpark(SparkConf conf) { - String pysparkBasePath = new InterpreterProperty("SPARK_HOME", null, null, null).getValue(); + String pysparkBasePath = + new DefaultInterpreterProperty("SPARK_HOME", null, null, null, InterpreterPropertyType.text) + .getValue(); File pysparkPath; if (null == pysparkBasePath) { pysparkBasePath = - new InterpreterProperty("ZEPPELIN_HOME", "zeppelin.home", "../", null).getValue(); + new DefaultInterpreterProperty("ZEPPELIN_HOME", "zeppelin.home", "../", null, + InterpreterPropertyType.text).getValue(); pysparkPath = new File(pysparkBasePath, "interpreter" + File.separator + "spark" + File.separator + "pyspark"); } else { @@ -566,11 +578,14 @@ private void setupConfForPySpark(SparkConf conf) { } private void setupConfForSparkR(SparkConf conf) { - String sparkRBasePath = new InterpreterProperty("SPARK_HOME", null, null, null).getValue(); + String sparkRBasePath = + new DefaultInterpreterProperty("SPARK_HOME", null, null, null, + InterpreterPropertyType.text).getValue(); File sparkRPath; if (null == sparkRBasePath) { sparkRBasePath = - new InterpreterProperty("ZEPPELIN_HOME", "zeppelin.home", "../", null).getValue(); + new DefaultInterpreterProperty("ZEPPELIN_HOME", "zeppelin.home", "../", null, + InterpreterPropertyType.text).getValue(); sparkRPath = new File(sparkRBasePath, "interpreter" + File.separator + "spark" + File.separator + "R"); } else { diff --git a/spark/src/main/resources/interpreter-setting.json b/spark/src/main/resources/interpreter-setting.json index c8acc2fbf92..83671df452a 100644 --- a/spark/src/main/resources/interpreter-setting.json +++ b/spark/src/main/resources/interpreter-setting.json @@ -9,56 +9,64 @@ "envName": null, "propertyName": "spark.executor.memory", "defaultValue": "", - "description": "Executor memory per worker instance. ex) 512m, 32g" + "description": "Executor memory per worker instance. ex) 512m, 32g", + "type": "text" }, "args": { "envName": null, "propertyName": null, "defaultValue": "", - "description": "spark commandline args" + "description": "spark commandline args", + "type": "text" }, "zeppelin.spark.useHiveContext": { "envName": "ZEPPELIN_SPARK_USEHIVECONTEXT", "propertyName": "zeppelin.spark.useHiveContext", "defaultValue": "true", - "description": "Use HiveContext instead of SQLContext if it is true." + "description": "Use HiveContext instead of SQLContext if it is true.", + "type": "text" }, "spark.app.name": { "envName": "SPARK_APP_NAME", - "propertyName": "spark.app.name", "defaultValue": "Zeppelin", - "description": "The name of spark application." + "description": "The name of spark application.", + "type": "text" }, "zeppelin.spark.printREPLOutput": { "envName": null, "propertyName": null, "defaultValue": "true", - "description": "Print REPL output" + "description": "Print REPL output", + "type": "text" }, "spark.cores.max": { "envName": null, "propertyName": "spark.cores.max", "defaultValue": "", - "description": "Total number of cores to use. Empty value uses all available core." + "description": "Total number of cores to use. Empty value uses all available core.", + "type": "text" }, "zeppelin.spark.maxResult": { "envName": "ZEPPELIN_SPARK_MAXRESULT", "propertyName": "zeppelin.spark.maxResult", "defaultValue": "1000", - "description": "Max number of Spark SQL result to display." + "description": "Max number of Spark SQL result to display.", + "type": "text" }, "master": { "envName": "MASTER", "propertyName": "spark.master", "defaultValue": "local[*]", - "description": "Spark master uri. ex) spark://masterhost:7077" + "description": "Spark master uri. ex) spark://masterhost:7077", + "type": "text" }, "zeppelin.spark.unSupportedVersionCheck": { "envName": null, "propertyName": "zeppelin.spark.enableSupportedVersionCheck", "defaultValue": "true", - "description": "Do not change - developer only setting, not for production use" + "description": "Do not change - developer only setting, not for production use", + "type": "text" } }, "editor": { @@ -75,25 +83,29 @@ "envName": "ZEPPELIN_SPARK_CONCURRENTSQL", "propertyName": "zeppelin.spark.concurrentSQL", "defaultValue": "false", - "description": "Execute multiple SQL concurrently if set true." + "description": "Execute multiple SQL concurrently if set true.", + "type": "text" }, "zeppelin.spark.sql.stacktrace": { "envName": "ZEPPELIN_SPARK_SQL_STACKTRACE", "propertyName": "zeppelin.spark.sql.stacktrace", "defaultValue": "false", - "description": "Show full exception stacktrace for SQL queries if set to true." + "description": "Show full exception stacktrace for SQL queries if set to true.", + "type": "text" }, "zeppelin.spark.maxResult": { "envName": "ZEPPELIN_SPARK_MAXRESULT", "propertyName": "zeppelin.spark.maxResult", "defaultValue": "1000", - "description": "Max number of Spark SQL result to display." + "description": "Max number of Spark SQL result to display.", + "type": "text" }, "zeppelin.spark.importImplicit": { "envName": "ZEPPELIN_SPARK_IMPORTIMPLICIT", "propertyName": "zeppelin.spark.importImplicit", "defaultValue": "true", - "description": "Import implicits, UDF collection, and sql if set true. true by default." + "description": "Import implicits, UDF collection, and sql if set true. true by default.", + "type": "text" } }, "editor": { @@ -110,13 +122,15 @@ "envName": "ZEPPELIN_DEP_LOCALREPO", "propertyName": null, "defaultValue": "local-repo", - "description": "local repository for dependency loader" + "description": "local repository for dependency loader", + "type": "text" }, "zeppelin.dep.additionalRemoteRepository": { "envName": null, "propertyName": null, "defaultValue": "spark-packages,http://dl.bintray.com/spark-packages/maven,false;", - "description": "A list of 'id,remote-repository-URL,is-snapshot;' for each remote repository." + "description": "A list of 'id,remote-repository-URL,is-snapshot;' for each remote repository.", + "type": "text" } }, "editor": { @@ -133,7 +147,8 @@ "envName": "PYSPARK_PYTHON", "propertyName": null, "defaultValue": "python", - "description": "Python command to run pyspark with" + "description": "Python command to run pyspark with", + "type": "text" } }, "editor": { diff --git a/spark/src/main/sparkr-resources/interpreter-setting.json b/spark/src/main/sparkr-resources/interpreter-setting.json index 6953b2052d0..bb2a64e3093 100644 --- a/spark/src/main/sparkr-resources/interpreter-setting.json +++ b/spark/src/main/sparkr-resources/interpreter-setting.json @@ -9,56 +9,64 @@ "envName": null, "propertyName": "spark.executor.memory", "defaultValue": "", - "description": "Executor memory per worker instance. ex) 512m, 32g" + "description": "Executor memory per worker instance. ex) 512m, 32g", + "type": "text" }, "args": { "envName": null, "propertyName": null, "defaultValue": "", - "description": "spark commandline args" + "description": "spark commandline args", + "type": "text" }, "zeppelin.spark.useHiveContext": { "envName": "ZEPPELIN_SPARK_USEHIVECONTEXT", "propertyName": "zeppelin.spark.useHiveContext", "defaultValue": "true", - "description": "Use HiveContext instead of SQLContext if it is true." + "description": "Use HiveContext instead of SQLContext if it is true.", + "type": "text" }, "spark.app.name": { "envName": "SPARK_APP_NAME", - "propertyName": "spark.app.name", "defaultValue": "Zeppelin", - "description": "The name of spark application." + "description": "The name of spark application.", + "type": "text" }, "zeppelin.spark.printREPLOutput": { "envName": null, "propertyName": null, "defaultValue": "true", - "description": "Print REPL output" + "description": "Print REPL output", + "type": "text" }, "spark.cores.max": { "envName": null, "propertyName": "spark.cores.max", "defaultValue": "", - "description": "Total number of cores to use. Empty value uses all available core." + "description": "Total number of cores to use. Empty value uses all available core.", + "type": "text" }, "zeppelin.spark.maxResult": { "envName": "ZEPPELIN_SPARK_MAXRESULT", "propertyName": "zeppelin.spark.maxResult", "defaultValue": "1000", - "description": "Max number of Spark SQL result to display." + "description": "Max number of Spark SQL result to display.", + "type": "text" }, "master": { "envName": "MASTER", "propertyName": "spark.master", "defaultValue": "local[*]", - "description": "Spark master uri. ex) spark://masterhost:7077" + "description": "Spark master uri. ex) spark://masterhost:7077", + "type": "text" }, "zeppelin.spark.unSupportedVersionCheck": { "envName": null, "propertyName": "zeppelin.spark.enableSupportedVersionCheck", "defaultValue": "true", - "description": "Do not change - developer only setting, not for production use" + "description": "Do not change - developer only setting, not for production use", + "type": "text" } }, "editor": { @@ -74,25 +82,29 @@ "envName": "ZEPPELIN_SPARK_CONCURRENTSQL", "propertyName": "zeppelin.spark.concurrentSQL", "defaultValue": "false", - "description": "Execute multiple SQL concurrently if set true." + "description": "Execute multiple SQL concurrently if set true.", + "type": "text" }, "zeppelin.spark.sql.stacktrace": { "envName": "ZEPPELIN_SPARK_SQL_STACKTRACE", "propertyName": "zeppelin.spark.sql.stacktrace", "defaultValue": "false", - "description": "Show full exception stacktrace for SQL queries if set to true." + "description": "Show full exception stacktrace for SQL queries if set to true.", + "type": "text" }, "zeppelin.spark.maxResult": { "envName": "ZEPPELIN_SPARK_MAXRESULT", "propertyName": "zeppelin.spark.maxResult", "defaultValue": "1000", - "description": "Max number of Spark SQL result to display." + "description": "Max number of Spark SQL result to display.", + "type": "text" }, "zeppelin.spark.importImplicit": { "envName": "ZEPPELIN_SPARK_IMPORTIMPLICIT", "propertyName": "zeppelin.spark.importImplicit", "defaultValue": "true", - "description": "Import implicits, UDF collection, and sql if set true. true by default." + "description": "Import implicits, UDF collection, and sql if set true. true by default.", + "type": "text" } }, "editor": { @@ -108,13 +120,15 @@ "envName": "ZEPPELIN_DEP_LOCALREPO", "propertyName": null, "defaultValue": "local-repo", - "description": "local repository for dependency loader" + "description": "local repository for dependency loader", + "type": "text" }, "zeppelin.dep.additionalRemoteRepository": { "envName": null, "propertyName": null, "defaultValue": "spark-packages,http://dl.bintray.com/spark-packages/maven,false;", - "description": "A list of 'id,remote-repository-URL,is-snapshot;' for each remote repository." + "description": "A list of 'id,remote-repository-URL,is-snapshot;' for each remote repository.", + "type": "text" } }, "editor": { @@ -130,7 +144,8 @@ "envName": "PYSPARK_PYTHON", "propertyName": null, "defaultValue": "python", - "description": "Python command to run pyspark with" + "description": "Python command to run pyspark with", + "type": "text" } }, "editor": { @@ -146,25 +161,29 @@ "envName": "ZEPPELIN_R_KNITR", "propertyName": "zeppelin.R.knitr", "defaultValue": "true", - "description": "whether use knitr or not" + "description": "whether use knitr or not", + "type": "text" }, "zeppelin.R.cmd": { "envName": "ZEPPELIN_R_CMD", "propertyName": "zeppelin.R.cmd", "defaultValue": "R", - "description": "R repl path" + "description": "R repl path", + "type": "text" }, "zeppelin.R.image.width": { "envName": "ZEPPELIN_R_IMAGE_WIDTH", "propertyName": "zeppelin.R.image.width", "defaultValue": "100%", - "description": "" + "description": "", + "type": "text" }, "zeppelin.R.render.options": { "envName": "ZEPPELIN_R_RENDER_OPTIONS", "propertyName": "zeppelin.R.render.options", "defaultValue": "out.format = 'html', comment = NA, echo = FALSE, results = 'asis', message = F, warning = F", - "description": "" + "description": "", + "type": "text" } }, "editor": { diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/DefaultInterpreterProperty.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/DefaultInterpreterProperty.java new file mode 100644 index 00000000000..4230322b256 --- /dev/null +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/DefaultInterpreterProperty.java @@ -0,0 +1,115 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.zeppelin.interpreter; + +/** + * Property for registered interpreter + */ +public class DefaultInterpreterProperty { + String envName; + String propertyName; + String defaultValue; + String description; + InterpreterPropertyType type; + + public DefaultInterpreterProperty(String envName, String propertyName, String defaultValue, + String description, InterpreterPropertyType type) { + this.envName = envName; + this.propertyName = propertyName; + this.defaultValue = defaultValue; + this.description = description; + this.type = type; + } + + public DefaultInterpreterProperty(String defaultValue, String description, + InterpreterPropertyType type) { + this(null, null, defaultValue, description, type); + } + + public String getEnvName() { + return envName; + } + + public void setEnvName(String envName) { + this.envName = envName; + } + + public String getPropertyName() { + return propertyName; + } + + public void setPropertyName(String propertyName) { + this.propertyName = propertyName; + } + + public String getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public InterpreterPropertyType getType() { + return type; + } + + public void setType(InterpreterPropertyType type) { + this.type = type; + } + + public int hashCode() { + return this.toString().hashCode(); + } + + public boolean equals(Object o) { + if (o == null) return false; + return this.toString().equals(o.toString()); + } + + public String getValue() { + if (envName != null && !envName.isEmpty()) { + String envValue = System.getenv().get(envName); + if (envValue != null) { + return envValue; + } + } + + if (propertyName != null && !propertyName.isEmpty()) { + String propValue = System.getProperty(propertyName); + if (propValue != null) { + return propValue; + } + } + return defaultValue; + } + + @Override + public String toString() { + return String.format("{envName=%s, propertyName=%s, defaultValue=%s, description=%20s, " + + "type=%s}", envName, propertyName, defaultValue, description, type); + } +} diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java index b64530a1af8..1b04b011281 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java @@ -150,7 +150,8 @@ public Properties getProperty() { RegisteredInterpreter registeredInterpreter = Interpreter.findRegisteredInterpreterByClassName( getClassName()); if (null != registeredInterpreter) { - Map defaultProperties = registeredInterpreter.getProperties(); + Map defaultProperties = + registeredInterpreter.getProperties(); for (String k : defaultProperties.keySet()) { if (!p.containsKey(k)) { String value = defaultProperties.get(k).getValue(); @@ -354,19 +355,19 @@ public static class RegisteredInterpreter { private String name; private String className; private boolean defaultInterpreter; - private Map properties; + private Map properties; private Map editor; private String path; private InterpreterOption option; private InterpreterRunner runner; public RegisteredInterpreter(String name, String group, String className, - Map properties) { + Map properties) { this(name, group, className, false, properties); } public RegisteredInterpreter(String name, String group, String className, - boolean defaultInterpreter, Map properties) { + boolean defaultInterpreter, Map properties) { super(); this.name = name; this.group = group; @@ -396,7 +397,7 @@ public void setDefaultInterpreter(boolean defaultInterpreter) { this.defaultInterpreter = defaultInterpreter; } - public Map getProperties() { + public Map getProperties() { return properties; } @@ -437,13 +438,13 @@ public static enum SchedulingMode { @Deprecated public static void register(String name, String group, String className, - Map properties) { + Map properties) { register(name, group, className, false, properties); } @Deprecated public static void register(String name, String group, String className, - boolean defaultInterpreter, Map properties) { + boolean defaultInterpreter, Map properties) { logger.warn("Static initialization is deprecated for interpreter {}, You should change it " + "to use interpreter-setting.json in your jar or " + "interpreter/{interpreter}/interpreter-setting.json", name); diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java index 92a23d6054f..0be0cbe5171 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java @@ -18,87 +18,40 @@ package org.apache.zeppelin.interpreter; /** - * Represent property of interpreter + * Property for instance of interpreter */ public class InterpreterProperty { - String envName; - String propertyName; - String defaultValue; - String description; + private String name; + private String value; + private InterpreterPropertyType type; - public InterpreterProperty(String envName, String propertyName, String defaultValue, - String description) { - this.envName = envName; - this.propertyName = propertyName; - this.defaultValue = defaultValue; - this.description = description; + public InterpreterProperty(String name, String value, InterpreterPropertyType type) { + this.name = name; + this.value = value; + this.type = type; } - public InterpreterProperty(String defaultValue, String description) { - this(null, null, defaultValue, description); + public String getName() { + return name; } - public String getEnvName() { - return envName; + public void setName(String name) { + this.name = name; } - public void setEnvName(String envName) { - this.envName = envName; - } - - public String getPropertyName() { - return propertyName; - } - - public void setPropertyName(String propertyName) { - this.propertyName = propertyName; - } - - public String getDefaultValue() { - return defaultValue; - } - - public void setDefaultValue(String defaultValue) { - this.defaultValue = defaultValue; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public int hashCode() { - return this.toString().hashCode(); + public String getValue() { + return value; } - public boolean equals(Object o) { - if (o == null) return false; - return this.toString().equals(o.toString()); + public void setValue(String value) { + this.value = value; } - public String getValue() { - if (envName != null && !envName.isEmpty()) { - String envValue = System.getenv().get(envName); - if (envValue != null) { - return envValue; - } - } - - if (propertyName != null && !propertyName.isEmpty()) { - String propValue = System.getProperty(propertyName); - if (propValue != null) { - return propValue; - } - } - return defaultValue; + public InterpreterPropertyType getType() { + return type; } - @Override - public String toString() { - return String.format("{envName=%s, propertyName=%s, defaultValue=%s, description=%20s}", - envName, propertyName, defaultValue, description); + public void setType(InterpreterPropertyType type) { + this.type = type; } } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java index d375a32c003..3f9e2ca6a58 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java @@ -24,21 +24,23 @@ * InterpreterPropertyBuilder */ public class InterpreterPropertyBuilder { - Map properties = new HashMap<>(); + Map properties = new HashMap<>(); public InterpreterPropertyBuilder add(String name, String defaultValue, String description){ - properties.put(name, new InterpreterProperty(defaultValue, description)); + properties.put(name, + new DefaultInterpreterProperty(defaultValue, description, InterpreterPropertyType.text)); return this; } public InterpreterPropertyBuilder add(String name, String envName, String propertyName, String defaultValue, String description){ properties.put(name, - new InterpreterProperty(envName, propertyName, defaultValue, description)); + new DefaultInterpreterProperty(envName, propertyName, defaultValue, description, + InterpreterPropertyType.text)); return this; } - public Map build(){ + public Map build(){ return properties; } } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java new file mode 100644 index 00000000000..27763d3865f --- /dev/null +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.zeppelin.interpreter; + +/** + * Types of interpreter properties + */ +public enum InterpreterPropertyType { + text, + password +} diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java index a324e57f671..46c363e0eb4 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java @@ -37,6 +37,7 @@ import com.google.gson.Gson; import org.apache.commons.lang.exception.ExceptionUtils; +import org.apache.zeppelin.interpreter.InterpreterPropertyType; import org.apache.zeppelin.interpreter.InterpreterSettingManager; import org.apache.zeppelin.rest.message.RestartInterpreterRequest; import org.apache.zeppelin.utils.SecurityUtils; @@ -47,7 +48,6 @@ import org.apache.zeppelin.annotation.ZeppelinApi; import org.apache.zeppelin.dep.Repository; import org.apache.zeppelin.interpreter.InterpreterException; -import org.apache.zeppelin.interpreter.InterpreterFactory; import org.apache.zeppelin.interpreter.InterpreterSetting; import org.apache.zeppelin.rest.message.NewInterpreterSettingRequest; import org.apache.zeppelin.rest.message.UpdateInterpreterSettingRequest; @@ -122,11 +122,10 @@ public Response newSettings(String message) { if (request == null) { return new JsonResponse<>(Status.BAD_REQUEST).build(); } - Properties p = new Properties(); - p.putAll(request.getProperties()); + InterpreterSetting interpreterSetting = interpreterSettingManager .createNewSetting(request.getName(), request.getGroup(), request.getDependencies(), - request.getOption(), p); + request.getOption(), request.getProperties()); logger.info("new setting created with {}", interpreterSetting.getId()); return new JsonResponse<>(Status.OK, "", interpreterSetting).build(); } catch (InterpreterException | IOException e) { @@ -295,4 +294,13 @@ public Response removeRepository(@PathParam("repoId") String repoId) { } return new JsonResponse(Status.OK).build(); } + + /** + * Get available types for property + */ + @GET + @Path("property/types") + public Response listInterpreterPropertyTypes() { + return new JsonResponse<>(Status.OK, InterpreterPropertyType.values()).build(); + } } diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/NewInterpreterSettingRequest.java b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/NewInterpreterSettingRequest.java index 7e3a4147233..addd61f25ff 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/NewInterpreterSettingRequest.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/NewInterpreterSettingRequest.java @@ -22,6 +22,7 @@ import org.apache.zeppelin.dep.Dependency; import org.apache.zeppelin.interpreter.InterpreterOption; +import org.apache.zeppelin.interpreter.InterpreterProperty; /** * NewInterpreterSetting rest api request message @@ -30,7 +31,7 @@ public class NewInterpreterSettingRequest { private String name; private String group; - private Map properties; + private Map properties; private List dependencies; private InterpreterOption option; @@ -46,7 +47,7 @@ public String getGroup() { return group; } - public Map getProperties() { + public Map getProperties() { return properties; } diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/UpdateInterpreterSettingRequest.java b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/UpdateInterpreterSettingRequest.java index c2deeff602f..8f4f7aace94 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/UpdateInterpreterSettingRequest.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/message/UpdateInterpreterSettingRequest.java @@ -18,27 +18,28 @@ package org.apache.zeppelin.rest.message; import java.util.List; -import java.util.Properties; +import java.util.Map; import org.apache.zeppelin.dep.Dependency; import org.apache.zeppelin.interpreter.InterpreterOption; +import org.apache.zeppelin.interpreter.InterpreterProperty; /** * UpdateInterpreterSetting rest api request message */ public class UpdateInterpreterSettingRequest { - Properties properties; + Map properties; List dependencies; InterpreterOption option; - public UpdateInterpreterSettingRequest(Properties properties, + public UpdateInterpreterSettingRequest(Map properties, List dependencies, InterpreterOption option) { this.properties = properties; this.dependencies = dependencies; this.option = option; } - public Properties getProperties() { + public Map getProperties() { return properties; } diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/InterpreterIT.java b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/InterpreterIT.java index 9587cd689d0..6adc1f73a25 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/integration/InterpreterIT.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/integration/InterpreterIT.java @@ -72,7 +72,7 @@ public void testShowDescriptionOnInterpreterCreate() throws Exception { select.selectByVisibleText("spark"); collector.checkThat("description of interpreter property is displayed", - driver.findElement(By.xpath("//tr/td[contains(text(), 'spark.app.name')]/following-sibling::td[2]")).getText(), + driver.findElement(By.xpath("//tr/td[contains(text(), 'spark.app.name')]/following-sibling::td[3]")).getText(), CoreMatchers.equalTo("The name of spark application.")); } catch (Exception e) { diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java index 7ea2774c9d7..acdb8610d62 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java @@ -23,7 +23,7 @@ import java.net.InetAddress; import java.net.UnknownHostException; import java.util.List; -import java.util.Properties; +import java.util.Map; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.regex.Pattern; @@ -44,6 +44,8 @@ import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; import org.apache.zeppelin.conf.ZeppelinConfiguration; +import org.apache.zeppelin.interpreter.InterpreterProperty; +import org.apache.zeppelin.interpreter.InterpreterPropertyType; import org.apache.zeppelin.interpreter.InterpreterSetting; import org.apache.zeppelin.server.ZeppelinServer; import org.hamcrest.Description; @@ -196,16 +198,21 @@ private static void start(boolean withAuth) throws Exception { } } - Properties sparkProperties = (Properties) sparkIntpSetting.getProperties(); + Map sparkProperties = + (Map) sparkIntpSetting.getProperties(); // ci environment runs spark cluster for testing // so configure zeppelin use spark cluster if ("true".equals(System.getenv("CI"))) { // set spark master and other properties - sparkProperties.setProperty("master", "local[2]"); - sparkProperties.setProperty("spark.cores.max", "2"); - sparkProperties.setProperty("zeppelin.spark.useHiveContext", "false"); + sparkProperties.put("master", + new InterpreterProperty("master", "local[2]", InterpreterPropertyType.text)); + sparkProperties.put("spark.cores.max", + new InterpreterProperty("spark.cores.max", "2", InterpreterPropertyType.text)); + sparkProperties.put("zeppelin.spark.useHiveContext", + new InterpreterProperty("zeppelin.spark.useHiveContext", "false", InterpreterPropertyType.text)); // set spark home for pyspark - sparkProperties.setProperty("spark.home", getSparkHome()); + sparkProperties.put("spark.home", + new InterpreterProperty("spark.home", getSparkHome(), InterpreterPropertyType.text)); sparkIntpSetting.setProperties(sparkProperties); pySpark = true; @@ -215,14 +222,19 @@ private static void start(boolean withAuth) throws Exception { String sparkHome = getSparkHome(); if (sparkHome != null) { if (System.getenv("SPARK_MASTER") != null) { - sparkProperties.setProperty("master", System.getenv("SPARK_MASTER")); + sparkProperties.put("master", + new InterpreterProperty("master", System.getenv("SPARK_MASTER"), InterpreterPropertyType.text)); } else { - sparkProperties.setProperty("master", "local[2]"); + sparkProperties.put("master", + new InterpreterProperty("master", "local[2]", InterpreterPropertyType.text)); } - sparkProperties.setProperty("spark.cores.max", "2"); + sparkProperties.put("spark.cores.max", + new InterpreterProperty("spark.cores.max", "2", InterpreterPropertyType.text)); // set spark home for pyspark - sparkProperties.setProperty("spark.home", sparkHome); - sparkProperties.setProperty("zeppelin.spark.useHiveContext", "false"); + sparkProperties.put("spark.home", + new InterpreterProperty("spark.home", sparkHome, InterpreterPropertyType.text)); + sparkProperties.put("zeppelin.spark.useHiveContext", + new InterpreterProperty("zeppelin.spark.useHiveContext", "false", InterpreterPropertyType.text)); pySpark = true; sparkR = true; } diff --git a/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html b/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html index 7e62d8f1011..4fd49729c82 100644 --- a/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html +++ b/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html @@ -272,27 +272,45 @@
Properties
name value + type description action {{key}} - - {{newInterpreterSetting.properties[key].description}} - + + + + + + + + + {{newInterpreterSetting.properties[key].description}} + + - + - + + + + + + + - + diff --git a/zeppelin-web/src/app/interpreter/interpreter.controller.js b/zeppelin-web/src/app/interpreter/interpreter.controller.js index 648a47882f2..99fe88823a5 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.controller.js +++ b/zeppelin-web/src/app/interpreter/interpreter.controller.js @@ -26,6 +26,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou $scope.showRepositoryInfo = false; $scope.searchInterpreter = ''; $scope._ = _; + $scope.interpreterPropertyTypes = []; ngToast.dismiss(); $scope.openPermissions = function() { @@ -140,8 +141,17 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou }); }; + var getAvailableInterpreterPropertyTypes = function () { + $http.get(baseUrlSrv.getRestApiBase() + '/interpreter/property/types') + .success(function (data, status, headers, config) { + $scope.interpreterPropertyTypes = data.body; + }).error(function (data, status, headers, config) { + console.log('Error %o %o', status, data.message); + }); + }; + var emptyNewProperty = function(object) { - angular.extend(object, {propertyValue: '', propertyKey: ''}); + angular.extend(object, {propertyValue: '', propertyKey: '', propertyType: $scope.interpreterPropertyTypes[0]}); }; var emptyNewDependency = function(object) { @@ -408,7 +418,8 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou for (var key in intpInfo) { properties[key] = { value: intpInfo[key].defaultValue, - description: intpInfo[key].description + description: intpInfo[key].description, + type: intpInfo[key].type }; } } @@ -483,9 +494,11 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou // Change properties to proper request format var newProperties = {}; + for (var p in newSetting.properties) { - newProperties[p] = newSetting.properties[p].value; + newProperties[p] = {value: newSetting.properties[p].value, type: newSetting.properties[p].type, name: p}; } + request.properties = newProperties; $http.post(baseUrlSrv.getRestApiBase() + '/interpreter/setting', request) @@ -555,7 +568,8 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou } $scope.newInterpreterSetting.properties[$scope.newInterpreterSetting.propertyKey] = { - value: $scope.newInterpreterSetting.propertyValue + value: $scope.newInterpreterSetting.propertyValue, + type: $scope.newInterpreterSetting.propertyType }; emptyNewProperty($scope.newInterpreterSetting); } else { @@ -566,7 +580,9 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou if (!setting.propertyKey || setting.propertyKey === '') { return; } - setting.properties[setting.propertyKey] = setting.propertyValue; + + setting.properties[setting.propertyKey] = {value: setting.propertyValue, type: setting.propertyType}; + emptyNewProperty(setting); } }; @@ -694,6 +710,8 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou }; var init = function() { + getAvailableInterpreterPropertyTypes(); + $scope.resetNewInterpreterSetting(); $scope.resetNewRepositorySetting(); diff --git a/zeppelin-web/src/app/interpreter/interpreter.html b/zeppelin-web/src/app/interpreter/interpreter.html index 90dc0f8bb5a..bdf62dc2e2f 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.html +++ b/zeppelin-web/src/app/interpreter/interpreter.html @@ -395,16 +395,24 @@
Properties
name value - action + type + action {{key}} - - - {{setting.properties[key] | breakFilter}} + + + {{setting.properties[key].value | breakFilter}} + + + {{setting.properties[key].value ? '***' : ''}} + + + diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java index 0df8f679a19..d18d9b6c52d 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterFactory.java @@ -164,7 +164,7 @@ public void createInterpretersForNote(InterpreterSetting interpreterSetting, Str String noteId, String interpreterSessionKey) { InterpreterGroup interpreterGroup = interpreterSetting.getInterpreterGroup(user, noteId); InterpreterOption option = interpreterSetting.getOption(); - Properties properties = (Properties) interpreterSetting.getProperties(); + Properties properties = interpreterSetting.getFlatProperties(); // if interpreters are already there, wait until they're being removed synchronized (interpreterGroup) { long interpreterRemovalWaitStart = System.nanoTime(); diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java index 2efba48bfec..3211b1f659d 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java @@ -54,14 +54,14 @@ public class InterpreterSetting { private transient Map> runtimeInfosToBeCleared; /** - * properties can be either Properties or Map + * properties can be either Map or + * Map * properties should be: - * - Properties when Interpreter instances are saved to `conf/interpreter.json` file - * - Map when Interpreters are registered + * - Map when Interpreter instances are saved to + * `conf/interpreter.json` file + * - Map when Interpreters are registered * : this is needed after https://github.com/apache/zeppelin/pull/1145 * which changed the way of getting default interpreter setting AKA interpreterSettingsRef - * Note(mina): In order to simplify the implementation, I chose to change properties - * from Properties to Object instead of creating new classes. */ private Object properties; private Status status; @@ -274,6 +274,18 @@ public Object getProperties() { return properties; } + public Properties getFlatProperties() { + Properties p = new Properties(); + if (properties != null) { + Map propertyMap = (Map) properties; + for (String key : propertyMap.keySet()) { + InterpreterProperty tmp = propertyMap.get(key); + p.put(tmp.getName() != null ? tmp.getName() : key, tmp.getValue()); + } + } + return p; + } + public List getDependencies() { if (dependencies == null) { return new LinkedList<>(); @@ -325,7 +337,7 @@ void setInterpreterOption(InterpreterOption interpreterOption) { this.option = interpreterOption; } - public void setProperties(Properties p) { + public void setProperties(Map p) { this.properties = p; } diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java index bebbf353e2a..be65c8c6c5b 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java @@ -17,16 +17,6 @@ package org.apache.zeppelin.interpreter; -import static java.nio.file.attribute.PosixFilePermission.OWNER_READ; -import static java.nio.file.attribute.PosixFilePermission.OWNER_WRITE; - -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.internal.StringMap; -import com.google.gson.reflect.TypeToken; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -45,7 +35,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; - import java.nio.file.attribute.PosixFilePermission; import java.util.ArrayList; import java.util.Collection; @@ -58,11 +47,12 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; -import java.util.Properties; import java.util.Set; + import org.apache.commons.io.FileUtils; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; +import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars; import org.apache.zeppelin.dep.Dependency; import org.apache.zeppelin.dep.DependencyResolver; @@ -71,13 +61,22 @@ import org.apache.zeppelin.scheduler.Job.Status; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - -import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.sonatype.aether.RepositoryException; import org.sonatype.aether.repository.Authentication; import org.sonatype.aether.repository.Proxy; import org.sonatype.aether.repository.RemoteRepository; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Maps; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.internal.StringMap; +import com.google.gson.reflect.TypeToken; + +import static java.nio.file.attribute.PosixFilePermission.OWNER_READ; +import static java.nio.file.attribute.PosixFilePermission.OWNER_WRITE; + /** * TBD */ @@ -169,13 +168,21 @@ private void loadFromFile() { List infos = setting.getInterpreterInfos(); // Convert json StringMap to Properties - StringMap p = (StringMap) setting.getProperties(); - Properties properties = new Properties(); + StringMap p = (StringMap) setting.getProperties(); + Map properties = new HashMap(); for (String key : p.keySet()) { - properties.put(key, p.get(key)); + StringMap fields = (StringMap) p.get(key); + // default 'text' + InterpreterPropertyType type = InterpreterPropertyType.text; + try { + type = InterpreterPropertyType.valueOf(fields.get("type")); + } catch (Exception e) { + logger.warn("Incorrect type of property {} in settings {}", key, setting.getId()); + } + properties.put(key, new InterpreterProperty(key, fields.get("value"), type)); } setting.setProperties(properties); - + // Always use separate interpreter process // While we decided to turn this feature on always (without providing // enable/disable option on GUI). @@ -476,8 +483,8 @@ private InterpreterSetting createFromInterpreterSettingRef(InterpreterSetting o) new ArrayList() : new ArrayList<>(o.getInterpreterInfos()); List deps = (null == o.getDependencies()) ? new ArrayList() : new ArrayList<>(o.getDependencies()); - Properties props = - convertInterpreterProperties((Map) o.getProperties()); + Map props = + convertInterpreterProperties((Map) o.getProperties()); InterpreterOption option = InterpreterOption.fromInterpreterOption(o.getOption()); InterpreterSetting setting = new InterpreterSetting(o.getName(), o.getName(), @@ -486,10 +493,14 @@ private InterpreterSetting createFromInterpreterSettingRef(InterpreterSetting o) return setting; } - private Properties convertInterpreterProperties(Map p) { - Properties properties = new Properties(); - for (String key : p.keySet()) { - properties.put(key, p.get(key).getValue()); + private Map convertInterpreterProperties( + Map defaultProperties) { + Map properties = new HashMap<>(); + + for (String key : defaultProperties.keySet()) { + DefaultInterpreterProperty defaultInterpreterProperty = defaultProperties.get(key); + properties.put(key, new InterpreterProperty(key, defaultInterpreterProperty.getValue(), + defaultInterpreterProperty.getType())); } return properties; } @@ -675,7 +686,8 @@ private boolean findDefaultInterpreter(List infos) { } public InterpreterSetting createNewSetting(String name, String group, - List dependencies, InterpreterOption option, Properties p) throws IOException { + List dependencies, InterpreterOption option, Map p) + throws IOException { if (name.indexOf(".") >= 0) { throw new IOException("'.' is invalid for InterpreterSetting name."); } @@ -693,8 +705,8 @@ public InterpreterSetting createNewSetting(String name, String group, } private InterpreterSetting add(String group, InterpreterInfo interpreterInfo, - Map interpreterProperties, InterpreterOption option, String path, - InterpreterRunner runner) + Map interpreterProperties, InterpreterOption option, + String path, InterpreterRunner runner) throws InterpreterException, IOException, RepositoryException { ArrayList infos = new ArrayList<>(); infos.add(interpreterInfo); @@ -707,7 +719,7 @@ private InterpreterSetting add(String group, InterpreterInfo interpreterInfo, */ public InterpreterSetting add(String group, ArrayList interpreterInfos, List dependencies, InterpreterOption option, - Map interpreterProperties, String path, + Map interpreterProperties, String path, InterpreterRunner runner) { Preconditions.checkNotNull(group, "name should not be null"); Preconditions.checkNotNull(interpreterInfos, "interpreterInfos should not be null"); @@ -744,8 +756,8 @@ public InterpreterSetting add(String group, ArrayList interpret } // Append properties - Map properties = - (Map) interpreterSetting.getProperties(); + Map properties = + (Map) interpreterSetting.getProperties(); for (String key : interpreterProperties.keySet()) { if (!properties.containsKey(key)) { properties.put(key, interpreterProperties.get(key)); @@ -901,7 +913,8 @@ public void removeNoteInterpreterSettingBinding(String user, String noteId) { /** * Change interpreter property and restart */ - public void setPropertyAndRestart(String id, InterpreterOption option, Properties properties, + public void setPropertyAndRestart(String id, InterpreterOption option, + Map properties, List dependencies) throws IOException { synchronized (interpreterSettings) { InterpreterSetting intpSetting = interpreterSettings.get(id); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumApplicationFactoryTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumApplicationFactoryTest.java index f91126fbe97..39e0b1e50c5 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumApplicationFactoryTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumApplicationFactoryTest.java @@ -41,7 +41,6 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; -import java.util.Properties; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; @@ -93,14 +92,14 @@ public void setUp() throws Exception { ArrayList interpreterInfos = new ArrayList<>(); interpreterInfos.add(new InterpreterInfo(MockInterpreter1.class.getName(), "mock1", true, new HashMap())); interpreterSettingManager.add("mock1", interpreterInfos, new ArrayList(), new InterpreterOption(), - Maps.newHashMap(), "mock1", null); - interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList(), new InterpreterOption(true), new Properties()); + Maps.newHashMap(), "mock1", null); + interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList(), new InterpreterOption(true), new HashMap()); ArrayList interpreterInfos2 = new ArrayList<>(); interpreterInfos2.add(new InterpreterInfo(MockInterpreter2.class.getName(), "mock2", true, new HashMap())); interpreterSettingManager.add("mock2", interpreterInfos2, new ArrayList(), new InterpreterOption(), - Maps.newHashMap(), "mock2", null); - interpreterSettingManager.createNewSetting("mock2", "mock2", new ArrayList(), new InterpreterOption(), new Properties()); + Maps.newHashMap(), "mock2", null); + interpreterSettingManager.createNewSetting("mock2", "mock2", new ArrayList(), new InterpreterOption(), new HashMap()); SearchService search = mock(SearchService.class); notebookRepo = new VFSNotebookRepo(conf); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java index 3d0fe1ad817..14eb60ae1fd 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java @@ -30,7 +30,6 @@ import java.util.HashMap; import java.util.Properties; -import com.google.common.collect.Maps; import com.google.gson.Gson; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.NullArgumentException; @@ -101,17 +100,19 @@ public void setUp() throws Exception { ArrayList interpreterInfos = new ArrayList<>(); interpreterInfos.add(new InterpreterInfo(MockInterpreter1.class.getName(), "mock1", true, new HashMap())); interpreterSettingManager.add("mock1", interpreterInfos, new ArrayList(), new InterpreterOption(), - Maps.newHashMap(), "mock1", null); - Properties intp1Properties = new Properties(); - intp1Properties.put("PROPERTY_1", "VALUE_1"); - intp1Properties.put("property_2", "value_2"); + Maps.newHashMap(), "mock1", null); + Map intp1Properties = new HashMap(); + intp1Properties.put("PROPERTY_1", + new InterpreterProperty("PROPERTY_1", "VALUE_1", InterpreterPropertyType.text)); + intp1Properties.put("property_2", + new InterpreterProperty("property_2", "value_2", InterpreterPropertyType.text)); interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList(), new InterpreterOption(true), intp1Properties); ArrayList interpreterInfos2 = new ArrayList<>(); interpreterInfos2.add(new InterpreterInfo(MockInterpreter2.class.getName(), "mock2", true, new HashMap())); interpreterSettingManager.add("mock2", interpreterInfos2, new ArrayList(), new InterpreterOption(), - Maps.newHashMap(), "mock2", null); - interpreterSettingManager.createNewSetting("mock2", "mock2", new ArrayList(), new InterpreterOption(), new Properties()); + Maps.newHashMap(), "mock2", null); + interpreterSettingManager.createNewSetting("mock2", "mock2", new ArrayList(), new InterpreterOption(), new HashMap()); SearchService search = mock(SearchService.class); notebookRepo = new VFSNotebookRepo(conf); @@ -158,10 +159,12 @@ public void testRemoteRepl() throws Exception { ArrayList interpreterInfos = new ArrayList<>(); interpreterInfos.add(new InterpreterInfo(MockInterpreter1.class.getName(), "mock1", true, new HashMap())); interpreterSettingManager.add("mock1", interpreterInfos, new ArrayList(), new InterpreterOption(), - Maps.newHashMap(), "mock1", null); - Properties intp1Properties = new Properties(); - intp1Properties.put("PROPERTY_1", "VALUE_1"); - intp1Properties.put("property_2", "value_2"); + Maps.newHashMap(), "mock1", null); + Map intp1Properties = new HashMap(); + intp1Properties.put("PROPERTY_1", + new InterpreterProperty("PROPERTY_1", "VALUE_1", InterpreterPropertyType.text)); + intp1Properties.put("property_2", new InterpreterProperty("property_2", "value_2", + InterpreterPropertyType.text)); interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList(), new InterpreterOption(true), intp1Properties); factory = new InterpreterFactory(conf, null, null, null, depResolver, false, interpreterSettingManager); List all = interpreterSettingManager.get(); @@ -195,10 +198,12 @@ public void testRestartInterpreterInScopedMode() throws Exception { ArrayList interpreterInfos = new ArrayList<>(); interpreterInfos.add(new InterpreterInfo(MockInterpreter1.class.getName(), "mock1", true, new HashMap())); interpreterSettingManager.add("mock1", interpreterInfos, new ArrayList(), new InterpreterOption(), - Maps.newHashMap(), "mock1", null); - Properties intp1Properties = new Properties(); - intp1Properties.put("PROPERTY_1", "VALUE_1"); - intp1Properties.put("property_2", "value_2"); + Maps.newHashMap(), "mock1", null); + Map intp1Properties = new HashMap(); + intp1Properties.put("PROPERTY_1", + new InterpreterProperty("PROPERTY_1", "VALUE_1", InterpreterPropertyType.text)); + intp1Properties.put("property_2", + new InterpreterProperty("property_2", "value_2", InterpreterPropertyType.text)); interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList(), new InterpreterOption(true), intp1Properties); factory = new InterpreterFactory(conf, null, null, null, depResolver, false, interpreterSettingManager); List all = interpreterSettingManager.get(); @@ -240,10 +245,12 @@ public void testRestartInterpreterInIsolatedMode() throws Exception { ArrayList interpreterInfos = new ArrayList<>(); interpreterInfos.add(new InterpreterInfo(MockInterpreter1.class.getName(), "mock1", true, new HashMap())); interpreterSettingManager.add("mock1", interpreterInfos, new ArrayList(), new InterpreterOption(), - Maps.newHashMap(), "mock1", null); - Properties intp1Properties = new Properties(); - intp1Properties.put("PROPERTY_1", "VALUE_1"); - intp1Properties.put("property_2", "value_2"); + Maps.newHashMap(), "mock1", null); + Map intp1Properties = new HashMap(); + intp1Properties.put("PROPERTY_1", + new InterpreterProperty("PROPERTY_1", "VALUE_1", InterpreterPropertyType.text)); + intp1Properties.put("property_2", + new InterpreterProperty("property_2", "value_2", InterpreterPropertyType.text)); interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList(), new InterpreterOption(true), intp1Properties); factory = new InterpreterFactory(conf, null, null, null, depResolver, false, interpreterSettingManager); List all = interpreterSettingManager.get(); @@ -307,7 +314,7 @@ public void testSaveLoad() throws IOException, RepositoryException { // check if file saved assertTrue(new File(conf.getInterpreterSettingPath()).exists()); - interpreterSettingManager.createNewSetting("new-mock1", "mock1", new LinkedList(), new InterpreterOption(false), new Properties()); + interpreterSettingManager.createNewSetting("new-mock1", "mock1", new LinkedList(), new InterpreterOption(false), new HashMap()); assertEquals(numInterpreters + 1, interpreterSettingManager.get().size()); interpreterSettingManager = new InterpreterSettingManager(conf, depResolver, new InterpreterOption(true)); @@ -326,14 +333,14 @@ public void testInterpreterSettingPropertyClass() throws IOException, Repository // check if default interpreter reference's property type is map Map interpreterSettingRefs = interpreterSettingManager.getAvailableInterpreterSettings(); InterpreterSetting intpSetting = interpreterSettingRefs.get("mock1"); - Map intpProperties = - (Map) intpSetting.getProperties(); + Map intpProperties = + (Map) intpSetting.getProperties(); assertTrue(intpProperties instanceof Map); // check if interpreter instance is saved as Properties in conf/interpreter.json file - Properties properties = new Properties(); - properties.put("key1", "value1"); - properties.put("key2", "value2"); + Map properties = new HashMap(); + properties.put("key1", new InterpreterProperty("key1", "value1", InterpreterPropertyType.text)); + properties.put("key2", new InterpreterProperty("key2", "value2", InterpreterPropertyType.text)); interpreterSettingManager.createNewSetting("newMock", "mock1", new LinkedList(), new InterpreterOption(false), properties); @@ -365,8 +372,8 @@ public void testInterpreterAliases() throws IOException, RepositoryException { add(info2); }}, new ArrayList(), new InterpreterOption(true), Collections.EMPTY_MAP, "/path2", null); - final InterpreterSetting setting1 = interpreterSettingManager.createNewSetting("test-group1", "group1", new ArrayList(), new InterpreterOption(true), new Properties()); - final InterpreterSetting setting2 = interpreterSettingManager.createNewSetting("test-group2", "group1", new ArrayList(), new InterpreterOption(true), new Properties()); + final InterpreterSetting setting1 = interpreterSettingManager.createNewSetting("test-group1", "group1", new ArrayList(), new InterpreterOption(true), new HashMap()); + final InterpreterSetting setting2 = interpreterSettingManager.createNewSetting("test-group2", "group1", new ArrayList(), new InterpreterOption(true), new HashMap()); interpreterSettingManager.setInterpreters("user", "note", new ArrayList() {{ add(setting1.getId()); @@ -387,7 +394,7 @@ public void testMultiUser() throws IOException, RepositoryException { }}, new ArrayList(), new InterpreterOption(true), Collections.EMPTY_MAP, "/path1", null); InterpreterOption perUserInterpreterOption = new InterpreterOption(true, InterpreterOption.ISOLATED, InterpreterOption.SHARED); - final InterpreterSetting setting1 = interpreterSettingManager.createNewSetting("test-group1", "group1", new ArrayList(), perUserInterpreterOption, new Properties()); + final InterpreterSetting setting1 = interpreterSettingManager.createNewSetting("test-group1", "group1", new ArrayList(), perUserInterpreterOption, new HashMap()); interpreterSettingManager.setInterpreters("user1", "note", new ArrayList() {{ add(setting1.getId()); @@ -404,7 +411,7 @@ public void testMultiUser() throws IOException, RepositoryException { @Test public void testInvalidInterpreterSettingName() { try { - interpreterSettingManager.createNewSetting("new.mock1", "mock1", new LinkedList(), new InterpreterOption(false), new Properties()); + interpreterSettingManager.createNewSetting("new.mock1", "mock1", new LinkedList(), new InterpreterOption(false), new HashMap()); fail("expect fail because of invalid InterpreterSetting Name"); } catch (IOException e) { assertEquals("'.' is invalid for InterpreterSetting name.", e.getMessage()); @@ -446,9 +453,9 @@ public void registerCustomInterpreterRunner() throws IOException { ArrayList interpreterInfos1 = new ArrayList<>(); interpreterInfos1.add(new InterpreterInfo("name1.class", "name1", true, Maps.newHashMap())); - spyInterpreterSettingManager.add("normalGroup1", interpreterInfos1, Lists.newArrayList(), new InterpreterOption(true), Maps.newHashMap(), "/normalGroup1", null); + spyInterpreterSettingManager.add("normalGroup1", interpreterInfos1, Lists.newArrayList(), new InterpreterOption(true), Maps.newHashMap(), "/normalGroup1", null); - spyInterpreterSettingManager.createNewSetting("normalGroup1", "normalGroup1", Lists.newArrayList(), new InterpreterOption(true), new Properties()); + spyInterpreterSettingManager.createNewSetting("normalGroup1", "normalGroup1", Lists.newArrayList(), new InterpreterOption(true), new HashMap()); ArrayList interpreterInfos2 = new ArrayList<>(); interpreterInfos2.add(new InterpreterInfo("name1.class", "name1", true, Maps.newHashMap())); @@ -457,9 +464,9 @@ public void registerCustomInterpreterRunner() throws IOException { when(mockInterpreterRunner.getPath()).thenReturn("custom-linux-path.sh"); - spyInterpreterSettingManager.add("customGroup1", interpreterInfos2, Lists.newArrayList(), new InterpreterOption(true), Maps.newHashMap(), "/customGroup1", mockInterpreterRunner); + spyInterpreterSettingManager.add("customGroup1", interpreterInfos2, Lists.newArrayList(), new InterpreterOption(true), Maps.newHashMap(), "/customGroup1", mockInterpreterRunner); - spyInterpreterSettingManager.createNewSetting("customGroup1", "customGroup1", Lists.newArrayList(), new InterpreterOption(true), new Properties()); + spyInterpreterSettingManager.createNewSetting("customGroup1", "customGroup1", Lists.newArrayList(), new InterpreterOption(true), new HashMap()); spyInterpreterSettingManager.setInterpreters("anonymous", "noteCustome", spyInterpreterSettingManager.getDefaultInterpreterSettingList()); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteInterpreterLoaderTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteInterpreterLoaderTest.java index 9c1096dcfc4..56325136309 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteInterpreterLoaderTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NoteInterpreterLoaderTest.java @@ -19,7 +19,7 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; -import java.util.Properties; +import java.util.HashMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; @@ -31,8 +31,8 @@ import org.apache.zeppelin.interpreter.InterpreterFactory; import org.apache.zeppelin.interpreter.InterpreterInfo; import org.apache.zeppelin.interpreter.InterpreterOption; +import org.apache.zeppelin.interpreter.DefaultInterpreterProperty; import org.apache.zeppelin.interpreter.InterpreterProperty; -import org.apache.zeppelin.interpreter.InterpreterSetting; import org.apache.zeppelin.interpreter.InterpreterSettingManager; import org.apache.zeppelin.interpreter.LazyOpenInterpreter; import org.apache.zeppelin.interpreter.mock.MockInterpreter1; @@ -72,11 +72,11 @@ public void setUp() throws Exception { ArrayList interpreterInfos2 = new ArrayList<>(); interpreterInfos2.add(new InterpreterInfo(MockInterpreter2.class.getName(), "mock2", true, Maps.newHashMap())); - interpreterSettingManager.add("group1", interpreterInfos, Lists.newArrayList(), new InterpreterOption(), Maps.newHashMap(), "mock", null); - interpreterSettingManager.add("group2", interpreterInfos2, Lists.newArrayList(), new InterpreterOption(), Maps.newHashMap(), "mock", null); + interpreterSettingManager.add("group1", interpreterInfos, Lists.newArrayList(), new InterpreterOption(), Maps.newHashMap(), "mock", null); + interpreterSettingManager.add("group2", interpreterInfos2, Lists.newArrayList(), new InterpreterOption(), Maps.newHashMap(), "mock", null); - interpreterSettingManager.createNewSetting("group1", "group1", Lists.newArrayList(), new InterpreterOption(), new Properties()); - interpreterSettingManager.createNewSetting("group2", "group2", Lists.newArrayList(), new InterpreterOption(), new Properties()); + interpreterSettingManager.createNewSetting("group1", "group1", Lists.newArrayList(), new InterpreterOption(), new HashMap()); + interpreterSettingManager.createNewSetting("group2", "group2", Lists.newArrayList(), new InterpreterOption(), new HashMap()); } diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java index f6d5708767d..e93dd4eabb4 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/NotebookTest.java @@ -97,14 +97,14 @@ public void setUp() throws Exception { ArrayList interpreterInfos = new ArrayList<>(); interpreterInfos.add(new InterpreterInfo(MockInterpreter1.class.getName(), "mock1", true, new HashMap())); interpreterSettingManager.add("mock1", interpreterInfos, new ArrayList(), new InterpreterOption(), - Maps.newHashMap(), "mock1", null); - interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList(), new InterpreterOption(), new Properties()); + Maps.newHashMap(), "mock1", null); + interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList(), new InterpreterOption(), new HashMap()); ArrayList interpreterInfos2 = new ArrayList<>(); interpreterInfos2.add(new InterpreterInfo(MockInterpreter2.class.getName(), "mock2", true, new HashMap())); interpreterSettingManager.add("mock2", interpreterInfos2, new ArrayList(), new InterpreterOption(), - Maps.newHashMap(), "mock2", null); - interpreterSettingManager.createNewSetting("mock2", "mock2", new ArrayList(), new InterpreterOption(), new Properties()); + Maps.newHashMap(), "mock2", null); + interpreterSettingManager.createNewSetting("mock2", "mock2", new ArrayList(), new InterpreterOption(), new HashMap()); SearchService search = mock(SearchService.class); diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java index 18f5fe9651e..9106befcf6a 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/VFSNotebookRepoTest.java @@ -37,6 +37,7 @@ import org.apache.zeppelin.interpreter.InterpreterFactory; import org.apache.zeppelin.interpreter.InterpreterInfo; import org.apache.zeppelin.interpreter.InterpreterOption; +import org.apache.zeppelin.interpreter.DefaultInterpreterProperty; import org.apache.zeppelin.interpreter.InterpreterProperty; import org.apache.zeppelin.interpreter.InterpreterSettingManager; import org.apache.zeppelin.interpreter.mock.MockInterpreter1; @@ -96,8 +97,8 @@ public void setUp() throws Exception { ArrayList interpreterInfos = new ArrayList<>(); interpreterInfos.add(new InterpreterInfo(MockInterpreter1.class.getName(), "mock1", true, new HashMap())); interpreterSettingManager.add("mock1", interpreterInfos, new ArrayList(), new InterpreterOption(), - Maps.newHashMap(), "mock1", null); - interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList(), new InterpreterOption(), new Properties()); + Maps.newHashMap(), "mock1", null); + interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList(), new InterpreterOption(), new HashMap()); SearchService search = mock(SearchService.class); notebookRepo = new VFSNotebookRepo(conf); From dd5d6c809aeb2bdb72357a072954cf4a9c882487 Mon Sep 17 00:00:00 2001 From: Tinkoff DWH Date: Mon, 17 Apr 2017 13:38:59 +0500 Subject: [PATCH 02/17] ZEPPELIN-2403 did properties immutable, added new type 'checkbox' --- .../main/resources/interpreter-setting.json | 4 +-- .../main/resources/interpreter-setting.json | 4 +-- .../main/resources/interpreter-setting.json | 8 ++--- .../main/resources/interpreter-setting.json | 4 +-- .../main/resources/interpreter-setting.json | 4 +-- .../main/resources/interpreter-setting.json | 8 ++--- .../main/resources/interpreter-setting.json | 12 ++++---- .../main/resources/interpreter-setting.json | 4 +-- r/src/main/resources/interpreter-setting.json | 8 ++--- .../zeppelin/spark/SparkInterpreter.java | 10 ++++--- .../main/resources/interpreter-setting.json | 26 ++++++++-------- .../sparkr-resources/interpreter-setting.json | 30 +++++++++---------- .../DefaultInterpreterProperty.java | 12 ++++---- .../zeppelin/interpreter/Interpreter.java | 4 +-- .../interpreter/InterpreterProperty.java | 8 ++--- .../interpreter/InterpreterPropertyType.java | 3 +- .../zeppelin/rest/AbstractTestRestApi.java | 4 +-- .../interpreter-create.html | 21 +++++-------- .../app/interpreter/interpreter.controller.js | 9 ++++++ .../src/app/interpreter/interpreter.html | 15 ++++------ .../interpreter/InterpreterSetting.java | 3 +- 21 files changed, 103 insertions(+), 98 deletions(-) diff --git a/cassandra/src/main/resources/interpreter-setting.json b/cassandra/src/main/resources/interpreter-setting.json index a94e555428d..71ad4e4e5e0 100644 --- a/cassandra/src/main/resources/interpreter-setting.json +++ b/cassandra/src/main/resources/interpreter-setting.json @@ -217,9 +217,9 @@ "cassandra.socket.tcp.no_delay": { "envName": null, "propertyName": "cassandra.socket.tcp.no_delay", - "defaultValue": "true", + "defaultValue": true, "description": "Cassandra socket TCP no delay. Default = true", - "type": "text" + "type": "checkbox" } }, "editor": { diff --git a/hbase/src/main/resources/interpreter-setting.json b/hbase/src/main/resources/interpreter-setting.json index afe6dddd8c5..5f48cf6cb7f 100644 --- a/hbase/src/main/resources/interpreter-setting.json +++ b/hbase/src/main/resources/interpreter-setting.json @@ -19,9 +19,9 @@ }, "zeppelin.hbase.test.mode": { "propertyName": "zeppelin.hbase.test.mode", - "defaultValue": "false", + "defaultValue": false, "description": "Disable checks for unit and manual tests", - "type": "text" + "type": "checkbox" } }, "editor": { diff --git a/ignite/src/main/resources/interpreter-setting.json b/ignite/src/main/resources/interpreter-setting.json index a8e62d7a3b9..2419bee40a3 100644 --- a/ignite/src/main/resources/interpreter-setting.json +++ b/ignite/src/main/resources/interpreter-setting.json @@ -14,9 +14,9 @@ "ignite.clientMode": { "envName": null, "propertyName": "ignite.clientMode", - "defaultValue": "true", + "defaultValue": true, "description": "Client mode. true or false", - "type": "text" + "type": "checkbox" }, "ignite.config.url": { "envName": null, @@ -28,9 +28,9 @@ "ignite.peerClassLoadingEnabled": { "envName": null, "propertyName": "ignite.peerClassLoadingEnabled", - "defaultValue": "true", + "defaultValue": true, "description": "Peer class loading enabled. True or false", - "type": "text" + "type": "checkbox" } } }, diff --git a/jdbc/src/main/resources/interpreter-setting.json b/jdbc/src/main/resources/interpreter-setting.json index ce8c880e932..4868d32ba3a 100644 --- a/jdbc/src/main/resources/interpreter-setting.json +++ b/jdbc/src/main/resources/interpreter-setting.json @@ -62,9 +62,9 @@ "zeppelin.jdbc.concurrent.use": { "envName": null, "propertyName": "zeppelin.jdbc.concurrent.use", - "defaultValue": "true", + "defaultValue": true, "description": "Use parallel scheduler", - "type": "text" + "type": "checkbox" }, "zeppelin.jdbc.concurrent.max_connection": { "envName": null, diff --git a/kylin/src/main/resources/interpreter-setting.json b/kylin/src/main/resources/interpreter-setting.json index 271294f46c4..dc2ac70f4d2 100644 --- a/kylin/src/main/resources/interpreter-setting.json +++ b/kylin/src/main/resources/interpreter-setting.json @@ -49,9 +49,9 @@ "kylin.query.ispartial": { "envName": null, "propertyName": "kylin.query.ispartial", - "defaultValue": "true", + "defaultValue": true, "description": "Kylin query partial flag, deprecated", - "type": "text" + "type": "checkbox" } }, "editor": { diff --git a/lens/src/main/resources/interpreter-setting.json b/lens/src/main/resources/interpreter-setting.json index 1524dcd6208..017bbdec92a 100644 --- a/lens/src/main/resources/interpreter-setting.json +++ b/lens/src/main/resources/interpreter-setting.json @@ -7,9 +7,9 @@ "zeppelin.lens.run.concurrent": { "envName": null, "propertyName": "zeppelin.lens.run.concurrent", - "defaultValue": "true", + "defaultValue": true, "description": "Run concurrent Lens Sessions", - "type": "text" + "type": "checkbox" }, "zeppelin.lens.maxThreads": { "envName": null, @@ -42,9 +42,9 @@ "lens.query.enable.persistent.resultset": { "envName": null, "propertyName": "lens.query.enable.persistent.resultset", - "defaultValue": "false", + "defaultValue": false, "description": "Apache Lens to persist result in HDFS?", - "type": "text" + "type": "checkbox" }, "lens.session.cluster.user": { "envName": null, diff --git a/livy/src/main/resources/interpreter-setting.json b/livy/src/main/resources/interpreter-setting.json index bf73fddbfa6..e9ec185ed98 100644 --- a/livy/src/main/resources/interpreter-setting.json +++ b/livy/src/main/resources/interpreter-setting.json @@ -105,9 +105,9 @@ }, "zeppelin.livy.displayAppInfo": { "propertyName": "zeppelin.livy.displayAppInfo", - "defaultValue": "false", + "defaultValue": false, "description": "Whether display app info", - "type": "text" + "type": "checkbox" } }, "option": { @@ -138,15 +138,15 @@ }, "zeppelin.livy.spark.sql.field.truncate": { "propertyName": "zeppelin.livy.spark.sql.field.truncate", - "defaultValue": "true", + "defaultValue": true, "description": "If true, truncate field values longer than 20 characters.", - "type": "text" + "type": "checkbox" }, "zeppelin.livy.concurrentSQL": { "propertyName": "zeppelin.livy.concurrentSQL", - "defaultValue": "false", + "defaultValue": false, "description": "Execute multiple SQL concurrently if set true.", - "type": "text" + "type": "checkbox" } }, "option": { diff --git a/pig/src/main/resources/interpreter-setting.json b/pig/src/main/resources/interpreter-setting.json index 540404d0cb9..f2ef00bcfc4 100644 --- a/pig/src/main/resources/interpreter-setting.json +++ b/pig/src/main/resources/interpreter-setting.json @@ -14,9 +14,9 @@ "zeppelin.pig.includeJobStats": { "envName": null, "propertyName": "zeppelin.pig.includeJobStats", - "defaultValue": "false", + "defaultValue": false, "description": "flag to include job stats in output", - "type": "text" + "type": "checkbox" } }, "editor": { diff --git a/r/src/main/resources/interpreter-setting.json b/r/src/main/resources/interpreter-setting.json index 94d8e449fcf..2df4a367a25 100644 --- a/r/src/main/resources/interpreter-setting.json +++ b/r/src/main/resources/interpreter-setting.json @@ -16,8 +16,8 @@ }, "rscala.debug": { "envName": "RSCALA_DEBUG", - "defaultValue": "false", - "type": "text" + "defaultValue": false, + "type": "checkbox" }, "rscala.timeout": { "envName": "RSCALA_TIMEOUT", @@ -43,8 +43,8 @@ }, "rscala.debug": { "envName": "RSCALA_DEBUG", - "defaultValue": "false", - "type": "text" + "defaultValue": false, + "type": "checkbox" }, "rscala.timeout": { "envName": "RSCALA_TIMEOUT", diff --git a/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java b/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java index 5a2d241753b..cb233bc0200 100644 --- a/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java +++ b/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java @@ -526,14 +526,15 @@ public SparkContext createSparkContext_1() { } private void setupConfForPySpark(SparkConf conf) { - String pysparkBasePath = + Object pysparkBaseProperty = new DefaultInterpreterProperty("SPARK_HOME", null, null, null, InterpreterPropertyType.text) .getValue(); + String pysparkBasePath = pysparkBaseProperty != null ? pysparkBaseProperty.toString() : null; File pysparkPath; if (null == pysparkBasePath) { pysparkBasePath = new DefaultInterpreterProperty("ZEPPELIN_HOME", "zeppelin.home", "../", null, - InterpreterPropertyType.text).getValue(); + InterpreterPropertyType.text).getValue().toString(); pysparkPath = new File(pysparkBasePath, "interpreter" + File.separator + "spark" + File.separator + "pyspark"); } else { @@ -578,14 +579,15 @@ private void setupConfForPySpark(SparkConf conf) { } private void setupConfForSparkR(SparkConf conf) { - String sparkRBasePath = + Object sparkRBaseProperty = new DefaultInterpreterProperty("SPARK_HOME", null, null, null, InterpreterPropertyType.text).getValue(); + String sparkRBasePath = sparkRBaseProperty != null ? sparkRBaseProperty.toString() : null; File sparkRPath; if (null == sparkRBasePath) { sparkRBasePath = new DefaultInterpreterProperty("ZEPPELIN_HOME", "zeppelin.home", "../", null, - InterpreterPropertyType.text).getValue(); + InterpreterPropertyType.text).getValue().toString(); sparkRPath = new File(sparkRBasePath, "interpreter" + File.separator + "spark" + File.separator + "R"); } else { diff --git a/spark/src/main/resources/interpreter-setting.json b/spark/src/main/resources/interpreter-setting.json index 83671df452a..0201e6b689f 100644 --- a/spark/src/main/resources/interpreter-setting.json +++ b/spark/src/main/resources/interpreter-setting.json @@ -22,9 +22,9 @@ "zeppelin.spark.useHiveContext": { "envName": "ZEPPELIN_SPARK_USEHIVECONTEXT", "propertyName": "zeppelin.spark.useHiveContext", - "defaultValue": "true", + "defaultValue": true, "description": "Use HiveContext instead of SQLContext if it is true.", - "type": "text" + "type": "checkbox" }, "spark.app.name": { "envName": "SPARK_APP_NAME", @@ -35,10 +35,10 @@ }, "zeppelin.spark.printREPLOutput": { "envName": null, - "propertyName": null, - "defaultValue": "true", + "propertyName": "zeppelin.spark.printREPLOutput", + "defaultValue": true, "description": "Print REPL output", - "type": "text" + "type": "checkbox" }, "spark.cores.max": { "envName": null, @@ -64,9 +64,9 @@ "zeppelin.spark.unSupportedVersionCheck": { "envName": null, "propertyName": "zeppelin.spark.enableSupportedVersionCheck", - "defaultValue": "true", + "defaultValue": true, "description": "Do not change - developer only setting, not for production use", - "type": "text" + "type": "checkbox" } }, "editor": { @@ -82,16 +82,16 @@ "zeppelin.spark.concurrentSQL": { "envName": "ZEPPELIN_SPARK_CONCURRENTSQL", "propertyName": "zeppelin.spark.concurrentSQL", - "defaultValue": "false", + "defaultValue": false, "description": "Execute multiple SQL concurrently if set true.", - "type": "text" + "type": "checkbox" }, "zeppelin.spark.sql.stacktrace": { "envName": "ZEPPELIN_SPARK_SQL_STACKTRACE", "propertyName": "zeppelin.spark.sql.stacktrace", - "defaultValue": "false", + "defaultValue": false, "description": "Show full exception stacktrace for SQL queries if set to true.", - "type": "text" + "type": "checkbox" }, "zeppelin.spark.maxResult": { "envName": "ZEPPELIN_SPARK_MAXRESULT", @@ -103,9 +103,9 @@ "zeppelin.spark.importImplicit": { "envName": "ZEPPELIN_SPARK_IMPORTIMPLICIT", "propertyName": "zeppelin.spark.importImplicit", - "defaultValue": "true", + "defaultValue": true, "description": "Import implicits, UDF collection, and sql if set true. true by default.", - "type": "text" + "type": "checkbox" } }, "editor": { diff --git a/spark/src/main/sparkr-resources/interpreter-setting.json b/spark/src/main/sparkr-resources/interpreter-setting.json index bb2a64e3093..a341710e9a4 100644 --- a/spark/src/main/sparkr-resources/interpreter-setting.json +++ b/spark/src/main/sparkr-resources/interpreter-setting.json @@ -22,9 +22,9 @@ "zeppelin.spark.useHiveContext": { "envName": "ZEPPELIN_SPARK_USEHIVECONTEXT", "propertyName": "zeppelin.spark.useHiveContext", - "defaultValue": "true", + "defaultValue": true, "description": "Use HiveContext instead of SQLContext if it is true.", - "type": "text" + "type": "checkbox" }, "spark.app.name": { "envName": "SPARK_APP_NAME", @@ -35,10 +35,10 @@ }, "zeppelin.spark.printREPLOutput": { "envName": null, - "propertyName": null, - "defaultValue": "true", + "propertyName": "zeppelin.spark.printREPLOutput", + "defaultValue": true, "description": "Print REPL output", - "type": "text" + "type": "checkbox" }, "spark.cores.max": { "envName": null, @@ -64,9 +64,9 @@ "zeppelin.spark.unSupportedVersionCheck": { "envName": null, "propertyName": "zeppelin.spark.enableSupportedVersionCheck", - "defaultValue": "true", + "defaultValue": true, "description": "Do not change - developer only setting, not for production use", - "type": "text" + "type": "checkbox" } }, "editor": { @@ -81,16 +81,16 @@ "zeppelin.spark.concurrentSQL": { "envName": "ZEPPELIN_SPARK_CONCURRENTSQL", "propertyName": "zeppelin.spark.concurrentSQL", - "defaultValue": "false", + "defaultValue": false, "description": "Execute multiple SQL concurrently if set true.", - "type": "text" + "type": "checkbox" }, "zeppelin.spark.sql.stacktrace": { "envName": "ZEPPELIN_SPARK_SQL_STACKTRACE", "propertyName": "zeppelin.spark.sql.stacktrace", - "defaultValue": "false", + "defaultValue": false, "description": "Show full exception stacktrace for SQL queries if set to true.", - "type": "text" + "type": "checkbox" }, "zeppelin.spark.maxResult": { "envName": "ZEPPELIN_SPARK_MAXRESULT", @@ -102,9 +102,9 @@ "zeppelin.spark.importImplicit": { "envName": "ZEPPELIN_SPARK_IMPORTIMPLICIT", "propertyName": "zeppelin.spark.importImplicit", - "defaultValue": "true", + "defaultValue": true, "description": "Import implicits, UDF collection, and sql if set true. true by default.", - "type": "text" + "type": "checkbox" } }, "editor": { @@ -160,9 +160,9 @@ "zeppelin.R.knitr": { "envName": "ZEPPELIN_R_KNITR", "propertyName": "zeppelin.R.knitr", - "defaultValue": "true", + "defaultValue": true, "description": "whether use knitr or not", - "type": "text" + "type": "checkbox" }, "zeppelin.R.cmd": { "envName": "ZEPPELIN_R_CMD", diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/DefaultInterpreterProperty.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/DefaultInterpreterProperty.java index 4230322b256..f8631849432 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/DefaultInterpreterProperty.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/DefaultInterpreterProperty.java @@ -23,11 +23,11 @@ public class DefaultInterpreterProperty { String envName; String propertyName; - String defaultValue; + Object defaultValue; String description; InterpreterPropertyType type; - public DefaultInterpreterProperty(String envName, String propertyName, String defaultValue, + public DefaultInterpreterProperty(String envName, String propertyName, Object defaultValue, String description, InterpreterPropertyType type) { this.envName = envName; this.propertyName = propertyName; @@ -36,7 +36,7 @@ public DefaultInterpreterProperty(String envName, String propertyName, String de this.type = type; } - public DefaultInterpreterProperty(String defaultValue, String description, + public DefaultInterpreterProperty(Object defaultValue, String description, InterpreterPropertyType type) { this(null, null, defaultValue, description, type); } @@ -57,11 +57,11 @@ public void setPropertyName(String propertyName) { this.propertyName = propertyName; } - public String getDefaultValue() { + public Object getDefaultValue() { return defaultValue; } - public void setDefaultValue(String defaultValue) { + public void setDefaultValue(Object defaultValue) { this.defaultValue = defaultValue; } @@ -90,7 +90,7 @@ public boolean equals(Object o) { return this.toString().equals(o.toString()); } - public String getValue() { + public Object getValue() { if (envName != null && !envName.isEmpty()) { String envValue = System.getenv().get(envName); if (envValue != null) { diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java index c74d9b4cac1..232b9cdff70 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/Interpreter.java @@ -156,9 +156,9 @@ public Properties getProperty() { registeredInterpreter.getProperties(); for (String k : defaultProperties.keySet()) { if (!p.containsKey(k)) { - String value = defaultProperties.get(k).getValue(); + Object value = defaultProperties.get(k).getValue(); if (value != null) { - p.put(k, defaultProperties.get(k).getValue()); + p.put(k, defaultProperties.get(k).getValue().toString()); } } } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java index 0be0cbe5171..db11c5d1aa8 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java @@ -22,10 +22,10 @@ */ public class InterpreterProperty { private String name; - private String value; + private Object value; private InterpreterPropertyType type; - public InterpreterProperty(String name, String value, InterpreterPropertyType type) { + public InterpreterProperty(String name, Object value, InterpreterPropertyType type) { this.name = name; this.value = value; this.type = type; @@ -39,11 +39,11 @@ public void setName(String name) { this.name = name; } - public String getValue() { + public Object getValue() { return value; } - public void setValue(String value) { + public void setValue(Object value) { this.value = value; } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java index 27763d3865f..195f827f044 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java @@ -22,5 +22,6 @@ */ public enum InterpreterPropertyType { text, - password + password, + checkbox } diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java index acdb8610d62..3237808a1b8 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java @@ -209,7 +209,7 @@ private static void start(boolean withAuth) throws Exception { sparkProperties.put("spark.cores.max", new InterpreterProperty("spark.cores.max", "2", InterpreterPropertyType.text)); sparkProperties.put("zeppelin.spark.useHiveContext", - new InterpreterProperty("zeppelin.spark.useHiveContext", "false", InterpreterPropertyType.text)); + new InterpreterProperty("zeppelin.spark.useHiveContext", false, InterpreterPropertyType.checkbox)); // set spark home for pyspark sparkProperties.put("spark.home", new InterpreterProperty("spark.home", getSparkHome(), InterpreterPropertyType.text)); @@ -234,7 +234,7 @@ private static void start(boolean withAuth) throws Exception { sparkProperties.put("spark.home", new InterpreterProperty("spark.home", sparkHome, InterpreterPropertyType.text)); sparkProperties.put("zeppelin.spark.useHiveContext", - new InterpreterProperty("zeppelin.spark.useHiveContext", "false", InterpreterPropertyType.text)); + new InterpreterProperty("zeppelin.spark.useHiveContext", false, InterpreterPropertyType.checkbox)); pySpark = true; sparkR = true; } diff --git a/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html b/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html index 4fd49729c82..41b8e72f497 100644 --- a/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html +++ b/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html @@ -272,27 +272,23 @@
Properties
name value - type - description action + description {{key}} + - + {{newInterpreterSetting.properties[key].description}} - - - @@ -303,17 +299,16 @@
Properties
+ - - - - + diff --git a/zeppelin-web/src/app/interpreter/interpreter.controller.js b/zeppelin-web/src/app/interpreter/interpreter.controller.js index 99fe88823a5..f7dfba30f34 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.controller.js +++ b/zeppelin-web/src/app/interpreter/interpreter.controller.js @@ -192,6 +192,15 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou } }; + $scope.defaultValueByType = function(setting) { + if (setting.propertyType === 'checkbox') { + setting.propertyValue = false; + return; + } + + setting.propertyValue = ''; + }; + $scope.setPerUserOption = function(settingId, sessionOption) { var option; if (settingId === undefined) { diff --git a/zeppelin-web/src/app/interpreter/interpreter.html b/zeppelin-web/src/app/interpreter/interpreter.html index bdf62dc2e2f..74d8ded4cb6 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.html +++ b/zeppelin-web/src/app/interpreter/interpreter.html @@ -395,8 +395,7 @@
Properties
name value - type - action + action @@ -408,10 +407,9 @@
Properties
{{setting.properties[key].value ? '***' : ''}} - - - + + {{setting.properties[key].value}} + diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java index 3211b1f659d..d7c2f5ec0ba 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java @@ -280,7 +280,8 @@ public Properties getFlatProperties() { Map propertyMap = (Map) properties; for (String key : propertyMap.keySet()) { InterpreterProperty tmp = propertyMap.get(key); - p.put(tmp.getName() != null ? tmp.getName() : key, tmp.getValue()); + p.put(tmp.getName() != null ? tmp.getName() : key, + tmp.getValue() != null ? tmp.getValue().toString() : null); } } return p; From 4f271d9b03a1748d83fefdf290abbba68d3cd280 Mon Sep 17 00:00:00 2001 From: Tinkoff DWH Date: Tue, 18 Apr 2017 17:16:00 +0500 Subject: [PATCH 03/17] ZEPPELIN-2403 rename to widget added new widgets string, number, url --- .../main/resources/interpreter-setting.json | 4 +- .../main/resources/interpreter-setting.json | 4 +- .../main/resources/interpreter-setting.json | 6 +- .../main/resources/interpreter-setting.json | 62 +++++++++---------- .../development/writingzeppelininterpreter.md | 4 +- docs/install/upgrade.md | 4 +- docs/rest-api/rest-interpreter.md | 30 ++++----- .../main/resources/interpreter-setting.json | 15 ++--- .../main/resources/interpreter-setting.json | 6 +- .../main/resources/interpreter-setting.json | 4 +- .../main/resources/interpreter-setting.json | 6 +- .../main/resources/interpreter-setting.json | 2 +- .../main/resources/interpreter-setting.json | 6 +- .../main/resources/interpreter-setting.json | 2 +- .../main/resources/interpreter-setting.json | 10 +-- .../main/resources/interpreter-setting.json | 25 ++++---- .../main/resources/interpreter-setting.json | 14 ++--- .../main/resources/interpreter-setting.json | 14 ++--- .../main/resources/interpreter-setting.json | 42 ++++++------- .../main/resources/interpreter-setting.json | 2 +- .../main/resources/interpreter-setting.json | 8 +-- .../main/resources/interpreter-setting.json | 4 +- r/src/main/resources/interpreter-setting.json | 16 ++--- .../main/resources/interpreter-setting.json | 4 +- .../main/resources/interpreter-setting.json | 8 +-- .../zeppelin/spark/SparkInterpreter.java | 12 ++-- .../main/resources/interpreter-setting.json | 32 +++++----- .../sparkr-resources/interpreter-setting.json | 40 ++++++------ .../DefaultInterpreterProperty.java | 20 +++--- .../interpreter/InterpreterProperty.java | 14 ++--- .../InterpreterPropertyBuilder.java | 4 +- ...pe.java => InterpreterPropertyWidget.java} | 7 ++- .../zeppelin/rest/InterpreterRestApi.java | 11 ++-- .../zeppelin/rest/AbstractTestRestApi.java | 20 +++--- .../interpreter-create.html | 14 +++-- .../app/interpreter/interpreter.controller.js | 24 +++---- .../src/app/interpreter/interpreter.html | 18 ++++-- .../widget/widget.number.directive.js | 32 ++++++++++ zeppelin-web/src/index.js | 1 + .../InterpreterSettingManager.java | 8 +-- .../interpreter/InterpreterFactoryTest.java | 20 +++--- 41 files changed, 316 insertions(+), 263 deletions(-) rename zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/{InterpreterPropertyType.java => InterpreterPropertyWidget.java} (89%) create mode 100644 zeppelin-web/src/components/interpreter/widget/widget.number.directive.js diff --git a/alluxio/src/main/resources/interpreter-setting.json b/alluxio/src/main/resources/interpreter-setting.json index f73aae4b9c5..cf0101befb1 100644 --- a/alluxio/src/main/resources/interpreter-setting.json +++ b/alluxio/src/main/resources/interpreter-setting.json @@ -9,14 +9,14 @@ "propertyName": "alluxio.master.hostname", "defaultValue": "localhost", "description": "Alluxio master hostname", - "type": "text" + "widget": "string" }, "alluxio.master.port": { "envName": "ALLUXIO_MASTER_PORT", "propertyName": "alluxio.master.port", "defaultValue": "19998", "description": "Alluxio master port", - "type": "text" + "widget": "number" } }, "editor": { diff --git a/beam/src/main/resources/interpreter-setting.json b/beam/src/main/resources/interpreter-setting.json index b6d5559fd6a..b715a2114b9 100644 --- a/beam/src/main/resources/interpreter-setting.json +++ b/beam/src/main/resources/interpreter-setting.json @@ -20,14 +20,14 @@ "propertyName": "zeppelin.scio.argz", "defaultValue": "--runner=InProcessPipelineRunner", "description": "Scio interpreter wide arguments", - "type": "text" + "widget": "text" }, "zeppelin.scio.maxResult": { "envName": "ZEPPELIN_SCIO_MAXRESULT", "propertyName": "zeppelin.scio.maxResult", "defaultValue": "1000", "description": "Max number of SCollection results to display.", - "type": "text" + "widget": "number" } }, "editor": { diff --git a/bigquery/src/main/resources/interpreter-setting.json b/bigquery/src/main/resources/interpreter-setting.json index fbe0874de20..1d0c516f877 100644 --- a/bigquery/src/main/resources/interpreter-setting.json +++ b/bigquery/src/main/resources/interpreter-setting.json @@ -9,21 +9,21 @@ "propertyName": "zeppelin.bigquery.project_id", "defaultValue": " ", "description": "Google Project ID", - "type": "text" + "widget": "string" }, "zeppelin.bigquery.wait_time": { "envName": null, "propertyName": "zeppelin.bigquery.wait_time", "defaultValue": "5000", "description": "Query timeout in Milliseconds", - "type": "text" + "widget": "number" }, "zeppelin.bigquery.max_no_of_rows": { "envName": null, "propertyName": "zeppelin.bigquery.max_no_of_rows", "defaultValue": "100000", "description": "Maximum number of rows to fetch from BigQuery", - "type": "text" + "widget": "number" } }, "editor": { diff --git a/cassandra/src/main/resources/interpreter-setting.json b/cassandra/src/main/resources/interpreter-setting.json index 71ad4e4e5e0..cb901217936 100644 --- a/cassandra/src/main/resources/interpreter-setting.json +++ b/cassandra/src/main/resources/interpreter-setting.json @@ -9,217 +9,217 @@ "propertyName": "cassandra.hosts", "defaultValue": "localhost", "description": "Comma separated Cassandra hosts (DNS name or IP address). Default = localhost. Ex: '192.168.0.12,node2,node3'", - "type": "text" + "widget": "text" }, "cassandra.native.port": { "envName": null, "propertyName": "cassandra.native.port", "defaultValue": "9042", "description": "Cassandra native port. Default = 9042", - "type": "text" + "widget": "number" }, "cassandra.protocol.version": { "envName": null, "propertyName": "cassandra.protocol.version", "defaultValue": "4", "description": "Cassandra protocol version. Default = 4", - "type": "text" + "widget": "string" }, "cassandra.cluster": { "envName": null, "propertyName": "cassandra.cluster", "defaultValue": "Test Cluster", "description": "Cassandra cluster name. Default = 'Test Cluster'", - "type": "text" + "widget": "string" }, "cassandra.keyspace": { "envName": null, "propertyName": "cassandra.keyspace", "defaultValue": "system", "description": "Cassandra keyspace name. Default = 'system'", - "type": "text" + "widget": "string" }, "cassandra.compression.protocol": { "envName": null, "propertyName": "cassandra.compression.protocol", "defaultValue": "NONE", "description": "Cassandra compression protocol. Available values: NONE, SNAPPY, LZ4. Default = NONE", - "type": "text" + "widget": "string" }, "cassandra.credentials.username": { "envName": null, "propertyName": "cassandra.credentials.username", "defaultValue": "none", "description": "Cassandra credentials username. Default = 'none'", - "type": "text" + "widget": "string" }, "cassandra.credentials.password": { "envName": null, "propertyName": "cassandra.credentials.password", "defaultValue": "none", "description": "Cassandra credentials password. Default = 'none'", - "type": "password" + "widget": "password" }, "cassandra.load.balancing.policy": { "envName": null, "propertyName": "cassandra.load.balancing.policy", "defaultValue": "DEFAULT", "description": "Cassandra Load Balancing Policy. Default = new TokenAwarePolicy(new DCAwareRoundRobinPolicy())", - "type": "text" + "widget": "string" }, "cassandra.retry.policy": { "envName": null, "propertyName": "cassandra.retry.policy", "defaultValue": "DEFAULT", "description": "Cassandra Retry Policy. Default = DefaultRetryPolicy.INSTANCE", - "type": "text" + "widget": "string" }, "cassandra.reconnection.policy": { "envName": null, "propertyName": "cassandra.reconnection.policy", "defaultValue": "DEFAULT", "description": "Cassandra Reconnection Policy. Default = new ExponentialReconnectionPolicy(1000, 10 * 60 * 1000)", - "type": "text" + "widget": "string" }, "cassandra.speculative.execution.policy": { "envName": null, "propertyName": "cassandra.speculative.execution.policy", "defaultValue": "DEFAULT", "description": "Cassandra Speculative Execution Policy. Default = NoSpeculativeExecutionPolicy.INSTANCE", - "type": "text" + "widget": "string" }, "cassandra.interpreter.parallelism": { "envName": null, "propertyName": "cassandra.interpreter.parallelism", "defaultValue": "10", "description": "Cassandra interpreter parallelism.Default = 10", - "type": "text" + "widget": "number" }, "cassandra.max.schema.agreement.wait.second": { "envName": null, "propertyName": "cassandra.max.schema.agreement.wait.second", "defaultValue": "10", "description": "Cassandra max schema agreement wait in second.Default = ProtocolOptions.DEFAULT_MAX_SCHEMA_AGREEMENT_WAIT_SECONDS", - "type": "text" + "widget": "number" }, "cassandra.pooling.new.connection.threshold.local": { "envName": null, "propertyName": "cassandra.pooling.new.connection.threshold.local", "defaultValue": "100", "description": "Cassandra new connection threshold local. Protocol V2 and below default = 100 Protocol V3 and above default = 800", - "type": "text" + "widget": "number" }, "cassandra.pooling.new.connection.threshold.remote": { "envName": null, "propertyName": "cassandra.pooling.new.connection.threshold.remote", "defaultValue": "100", "description": "Cassandra new connection threshold remove. Protocol V2 and below default = 100 Protocol V3 and above default = 200", - "type": "text" + "widget": "number" }, "cassandra.pooling.core.connection.per.host.local": { "envName": null, "propertyName": "cassandra.pooling.core.connection.per.host.local", "defaultValue": "2", "description": "Cassandra core connection per host local. Protocol V2 and below default = 2 Protocol V3 and above default = 1", - "type": "text" + "widget": "number" }, "cassandra.pooling.core.connection.per.host.remote": { "envName": null, "propertyName": "cassandra.pooling.core.connection.per.host.remote", "defaultValue": "1", "description": "Cassandra core connection per host remove. Protocol V2 and below default = 1 Protocol V3 and above default = 1", - "type": "text" + "widget": "number" }, "cassandra.pooling.max.connection.per.host.local": { "envName": null, "propertyName": "cassandra.pooling.max.connection.per.host.local", "defaultValue": "8", "description": "Cassandra max connection per host local. Protocol V2 and below default = 8 Protocol V3 and above default = 1", - "type": "text" + "widget": "number" }, "cassandra.pooling.max.connection.per.host.remote": { "envName": null, "propertyName": "cassandra.pooling.max.connection.per.host.remote", "defaultValue": "2", "description": "Cassandra max connection per host remote. Protocol V2 and below default = 2 Protocol V3 and above default = 1", - "type": "text" + "widget": "number" }, "cassandra.pooling.max.request.per.connection.local": { "envName": null, "propertyName": "cassandra.pooling.max.request.per.connection.local", "defaultValue": "1024", "description": "Cassandra max request per connection local. Protocol V2 and below default = 128 Protocol V3 and above default = 1024", - "type": "text" + "widget": "number" }, "cassandra.pooling.max.request.per.connection.remote": { "envName": null, "propertyName": "cassandra.pooling.max.request.per.connection.remote", "defaultValue": "256", "description": "Cassandra max request per connection remote. Protocol V2 and below default = 128 Protocol V3 and above default = 256", - "type": "text" + "widget": "number" }, "cassandra.pooling.idle.timeout.seconds": { "envName": null, "propertyName": "cassandra.pooling.idle.timeout.seconds", "defaultValue": "120", "description": "Cassandra idle time out in seconds. Default = 120", - "type": "text" + "widget": "number" }, "cassandra.pooling.pool.timeout.millisecs": { "envName": null, "propertyName": "cassandra.pooling.pool.timeout.millisecs", "defaultValue": "5000", "description": "Cassandra pool time out in millisecs. Default = 5000", - "type": "text" + "widget": "number" }, "cassandra.pooling.heartbeat.interval.seconds": { "envName": null, "propertyName": "cassandra.pooling.heartbeat.interval.seconds", "defaultValue": "30", "description": "Cassandra pool heartbeat interval in secs. Default = 30", - "type": "text" + "widget": "number" }, "cassandra.query.default.consistency": { "envName": null, "propertyName": "cassandra.query.default.consistency", "defaultValue": "ONE", "description": "Cassandra query default consistency level. Default = ONE", - "type": "text" + "widget": "string" }, "cassandra.query.default.serial.consistency": { "envName": null, "propertyName": "cassandra.query.default.serial.consistency", "defaultValue": "SERIAL", "description": "Cassandra query default serial consistency level. Default = SERIAL", - "type": "text" + "widget": "string" }, "cassandra.query.default.fetchSize": { "envName": null, "propertyName": "cassandra.query.default.fetchSize", "defaultValue": "5000", "description": "Cassandra query default fetch size. Default = 5000", - "type": "text" + "widget": "number" }, "cassandra.socket.connection.timeout.millisecs": { "envName": null, "propertyName": "cassandra.socket.connection.timeout.millisecs", "defaultValue": "5000", "description": "Cassandra socket default connection timeout in millisecs. Default = 5000", - "type": "text" + "widget": "number" }, "cassandra.socket.read.timeout.millisecs": { "envName": null, "propertyName": "cassandra.socket.read.timeout.millisecs", "defaultValue": "12000", "description": "Cassandra socket read timeout in millisecs. Default = 12000", - "type": "text" + "widget": "number" }, "cassandra.socket.tcp.no_delay": { "envName": null, "propertyName": "cassandra.socket.tcp.no_delay", "defaultValue": true, "description": "Cassandra socket TCP no delay. Default = true", - "type": "checkbox" + "widget": "checkbox" } }, "editor": { diff --git a/docs/development/writingzeppelininterpreter.md b/docs/development/writingzeppelininterpreter.md index e106461a30c..87f2b84f3dd 100644 --- a/docs/development/writingzeppelininterpreter.md +++ b/docs/development/writingzeppelininterpreter.md @@ -62,14 +62,14 @@ Here is an example of `interpreter-setting.json` on your own interpreter. "propertyName": "property.1.name", "defaultValue": "propertyDefaultValue", "description": "Property description", - "type": "text" + "widget": "text" }, "properties2": { "envName": PROPERTIES_2, "propertyName": null, "defaultValue": "property2DefaultValue", "description": "Property 2 description", - "type": "text" + "widget": "text" }, ... }, "editor": { diff --git a/docs/install/upgrade.md b/docs/install/upgrade.md index 5022123091f..4ae047a2c0a 100644 --- a/docs/install/upgrade.md +++ b/docs/install/upgrade.md @@ -87,12 +87,12 @@ So, copying `notebook` and `conf` directory should be enough. "spark.executor.memory": { "name": "spark.executor.memory", "value": "", - "type": "text" + "widget": "text" }, "zeppelin.spark.concurrentSQL": { "name": "zeppelin.spark.concurrentSQL", "value": false, - "type": "checkbox" + "widget": "checkbox" ... } ``` \ No newline at end of file diff --git a/docs/rest-api/rest-interpreter.md b/docs/rest-api/rest-interpreter.md index a38f8fbcafb..3a64b8aecef 100644 --- a/docs/rest-api/rest-interpreter.md +++ b/docs/rest-api/rest-interpreter.md @@ -77,12 +77,12 @@ The role of registered interpreters, settings and interpreters group are describ "spark.executor.memory": { "defaultValue": "1g", "description": "Executor memory per worker instance. ex) 512m, 32g", - "type": "text + "widget": "text }, "spark.cores.max": { "defaultValue": "", "description": "Total number of cores to use. Empty value uses all available core.", - "type": "text" + "widget": "text" }, }, "path": "/zeppelin/interpreter/spark" @@ -95,7 +95,7 @@ The role of registered interpreters, settings and interpreters group are describ "zeppelin.spark.maxResult": { "defaultValue": "1000", "description": "Max number of Spark SQL result to display.", - "type": "text" + "widget": "text" } }, "path": "/zeppelin/interpreter/spark" @@ -157,14 +157,14 @@ The role of registered interpreters, settings and interpreters group are describ "group": "spark", "properties": { "spark.cores.max": { - name: "", - value: "spark.cores.max", - type: "text" + "name": "", + "value": "spark.cores.max", + "widget": "text" }, "spark.executor.memory": { "name": "", "value": "1g", - "type": "text" + "widget": "text" } }, "interpreterGroup": [ @@ -229,7 +229,7 @@ The role of registered interpreters, settings and interpreters group are describ "propname": { "name": "propname", "value": "propvalue", - "type": "text" + "widget": "text" } }, "interpreterGroup": [ @@ -288,7 +288,7 @@ The role of registered interpreters, settings and interpreters group are describ "propname": { "name": "propname", "value": "propvalue", - "type": "text" + "widget": "text" }, "interpreterGroup": [ { @@ -323,7 +323,7 @@ The role of registered interpreters, settings and interpreters group are describ "propname": { "name": "propname", "value": "propvalue", - "type": "text" + "widget": "text" }, "interpreterGroup": [ { @@ -377,7 +377,7 @@ The role of registered interpreters, settings and interpreters group are describ "propname": { "name": "propname", "value": "Otherpropvalue", - "type": "text" + "widget": "text" }, "interpreterGroup": [ { @@ -412,7 +412,7 @@ The role of registered interpreters, settings and interpreters group are describ "propname": { "name": "propname", "value": "Otherpropvalue", - "type": "text" + "widget": "text" }, "interpreterGroup": [ { @@ -569,16 +569,16 @@ The role of registered interpreters, settings and interpreters group are describ
-### Get available types for property +### Get available widgets for property - + - + diff --git a/elasticsearch/src/main/resources/interpreter-setting.json b/elasticsearch/src/main/resources/interpreter-setting.json index af471d9f3d7..a0530224365 100644 --- a/elasticsearch/src/main/resources/interpreter-setting.json +++ b/elasticsearch/src/main/resources/interpreter-setting.json @@ -9,48 +9,49 @@ "propertyName": "elasticsearch.host", "defaultValue": "localhost", "description": "The host for Elasticsearch", - "type": "text" + "widget": "string" }, "elasticsearch.port": { "envName": "ELASTICSEARCH_PORT", "propertyName": "elasticsearch.port", "defaultValue": "9300", "description": "The port for Elasticsearch", - "type": "text" + "widget": "number" }, "elasticsearch.client.type": { "envName": "ELASTICSEARCH_CLIENT_TYPE", "propertyName": "elasticsearch.client.type", "defaultValue": "transport", "description": "The type of client for Elasticsearch (transport or http)", - "type": "text" + "widget": "string" }, "elasticsearch.cluster.name": { "envName": "ELASTICSEARCH_CLUSTER_NAME", "propertyName": "elasticsearch.cluster.name", "defaultValue": "elasticsearch", "description": "The cluster name for Elasticsearch", - "type": "text" + "widget": "string" }, "elasticsearch.result.size": { "envName": "ELASTICSEARCH_RESULT_SIZE", "propertyName": "elasticsearch.result.size", "defaultValue": "10", "description": "The size of the result set of a search query", - "type": "text" + "widget": "number" }, "elasticsearch.basicauth.username": { "envName": "ELASTICSEARCH_BASIC_AUTH_USERNAME", "propertyName": "elasticsearch.basicauth.username", "defaultValue": "", - "description": "Username for a basic authentication" + "description": "Username for a basic authentication", + "widget": "string" }, "elasticsearch.basicauth.password": { "envName": "ELASTICSEARCH_BASIC_AUTH_PASSWORD", "propertyName": "elasticsearch.basicauth.password", "defaultValue": "", "description": "Password for a basic authentication", - "type": "password" + "widget": "password" } }, "editor": { diff --git a/file/src/main/resources/interpreter-setting.json b/file/src/main/resources/interpreter-setting.json index 0560e749d83..f30bdc6fbcd 100644 --- a/file/src/main/resources/interpreter-setting.json +++ b/file/src/main/resources/interpreter-setting.json @@ -9,21 +9,21 @@ "propertyName": "hdfs.url", "defaultValue": "http://localhost:50070/webhdfs/v1/", "description": "The URL for WebHDFS", - "type": "text" + "widget": "url" }, "hdfs.user": { "envName": null, "propertyName": "hdfs.user", "defaultValue": "hdfs", "description": "The WebHDFS user", - "type": "text" + "widget": "string" }, "hdfs.maxlength": { "envName": null, "propertyName": "hdfs.maxlength", "defaultValue": "1000", "description": "Maximum number of lines of results fetched", - "type": "text" + "widget": "number" } }, "editor": { diff --git a/flink/src/main/resources/interpreter-setting.json b/flink/src/main/resources/interpreter-setting.json index 395ef7f8286..ca98af826f0 100644 --- a/flink/src/main/resources/interpreter-setting.json +++ b/flink/src/main/resources/interpreter-setting.json @@ -9,14 +9,14 @@ "propertyName": null, "defaultValue": "local", "description": "host name of running JobManager. 'local' runs flink in local mode.", - "type": "text" + "widget": "string" }, "port": { "envName": "port", "propertyName": null, "defaultValue": "6123", "description": "port of running JobManager.", - "type": "text" + "widget": "number" } }, "editor": { diff --git a/geode/src/main/resources/interpreter-setting.json b/geode/src/main/resources/interpreter-setting.json index 5f0e79c63bd..94031bb56a3 100644 --- a/geode/src/main/resources/interpreter-setting.json +++ b/geode/src/main/resources/interpreter-setting.json @@ -9,21 +9,21 @@ "propertyName": "geode.locator.host", "defaultValue": "localhost", "description": "The Geode Locator Host.", - "type": "text" + "widget": "string" }, "geode.locator.port": { "envName": null, "propertyName": "geode.locator.port", "defaultValue": "10334", "description": "The Geode Locator Port.", - "type": "text" + "widget": "number" }, "geode.max.result": { "envName": null, "propertyName": "geode.max.result", "defaultValue": "1000", "description": "Max number of OQL result to display.", - "type": "text" + "widget": "number" } }, "editor": { diff --git a/groovy/src/main/resources/interpreter-setting.json b/groovy/src/main/resources/interpreter-setting.json index 92e94c9487f..e9d200e1424 100644 --- a/groovy/src/main/resources/interpreter-setting.json +++ b/groovy/src/main/resources/interpreter-setting.json @@ -9,7 +9,7 @@ "propertyName": "GROOVY_CLASSES", "defaultValue": "", "description": "The path for custom groovy classes location. If empty `./interpreter/groovy/classes`", - "type": "text" + "widget": "text" } } } diff --git a/hbase/src/main/resources/interpreter-setting.json b/hbase/src/main/resources/interpreter-setting.json index 5f48cf6cb7f..95aba64648d 100644 --- a/hbase/src/main/resources/interpreter-setting.json +++ b/hbase/src/main/resources/interpreter-setting.json @@ -9,19 +9,19 @@ "propertyName": "hbase.home", "defaultValue": "/usr/lib/hbase/", "description": "Installation directory of HBase", - "type": "text" + "widget": "string" }, "hbase.ruby.sources": { "propertyName": "hbase.ruby.sources", "defaultValue": "lib/ruby", "description": "Path to Ruby scripts relative to 'hbase.home'", - "type": "text" + "widget": "string" }, "zeppelin.hbase.test.mode": { "propertyName": "zeppelin.hbase.test.mode", "defaultValue": false, "description": "Disable checks for unit and manual tests", - "type": "checkbox" + "widget": "checkbox" } }, "editor": { diff --git a/helium-dev/src/main/resources/interpreter-setting.json b/helium-dev/src/main/resources/interpreter-setting.json index 9383f27a6f9..f50d66e6dfd 100644 --- a/helium-dev/src/main/resources/interpreter-setting.json +++ b/helium-dev/src/main/resources/interpreter-setting.json @@ -9,7 +9,7 @@ "propertyName": "port", "defaultValue": "jdbc:postgresql://localhost:5432/", "description": "The URL for JDBC.", - "type": "text" + "widget": "string" } }, "editor": { diff --git a/ignite/src/main/resources/interpreter-setting.json b/ignite/src/main/resources/interpreter-setting.json index 2419bee40a3..74b035f2a01 100644 --- a/ignite/src/main/resources/interpreter-setting.json +++ b/ignite/src/main/resources/interpreter-setting.json @@ -9,28 +9,28 @@ "propertyName": "ignite.addresses", "defaultValue": "127.0.0.1:47500..47509", "description": "Comma separated list of addresses (e.g. 127.0.0.1:47500 or 127.0.0.1:47500..47509)", - "type": "text" + "widget": "text" }, "ignite.clientMode": { "envName": null, "propertyName": "ignite.clientMode", "defaultValue": true, "description": "Client mode. true or false", - "type": "checkbox" + "widget": "checkbox" }, "ignite.config.url": { "envName": null, "propertyName": "ignite.config.url", "defaultValue": "", "description": "Configuration URL. Overrides all other settings.", - "type": "text" + "widget": "url" }, "ignite.peerClassLoadingEnabled": { "envName": null, "propertyName": "ignite.peerClassLoadingEnabled", "defaultValue": true, "description": "Peer class loading enabled. True or false", - "type": "checkbox" + "widget": "checkbox" } } }, @@ -44,7 +44,7 @@ "propertyName": "ignite.jdbc.url", "defaultValue": "jdbc:ignite:cfg://default-ignite-jdbc.xml", "description": "Ignite JDBC connection URL.", - "type": "text" + "widget": "string" } } } diff --git a/jdbc/src/main/resources/interpreter-setting.json b/jdbc/src/main/resources/interpreter-setting.json index 4868d32ba3a..5e70e535fe6 100644 --- a/jdbc/src/main/resources/interpreter-setting.json +++ b/jdbc/src/main/resources/interpreter-setting.json @@ -9,83 +9,84 @@ "propertyName": "default.url", "defaultValue": "jdbc:postgresql://localhost:5432/", "description": "The URL for JDBC.", - "type": "text" + "widget": "string" }, "default.user": { "envName": null, "propertyName": "default.user", "defaultValue": "gpadmin", "description": "The JDBC user name", - "type": "text" + "widget": "string" }, "default.password": { "envName": null, "propertyName": "default.password", "defaultValue": "", "description": "The JDBC user password", - "type": "password" + "widget": "password" }, "default.driver": { "envName": null, "propertyName": "default.driver", "defaultValue": "org.postgresql.Driver", "description": "JDBC Driver Name", - "type": "text" + "widget": "string" }, "default.completer.schemaFilters": { "envName": null, "propertyName": "default.completer.schemaFilters", "defaultValue": "", - "description": "Сomma separated schema (schema = catalog = database) filters to get metadata for completions. Supports '%' symbol is equivalent to any set of characters. (ex. prod_v_%,public%,info)" + "description": "Сomma separated schema (schema = catalog = database) filters to get metadata for completions. Supports '%' symbol is equivalent to any set of characters. (ex. prod_v_%,public%,info)", + "widget": "text" }, "default.precode": { "envName": null, "propertyName": "zeppelin.jdbc.precode", "defaultValue": "", "description": "SQL which executes while opening connection", - "type": "text" + "widget": "text" }, "common.max_count": { "envName": null, "propertyName": "common.max_count", "defaultValue": "1000", "description": "Max number of SQL result to display.", - "type": "text" + "widget": "number" }, "zeppelin.jdbc.auth.type": { "envName": null, "propertyName": "zeppelin.jdbc.auth.type", "defaultValue": "", "description": "If auth type is needed, Example: KERBEROS", - "type": "text" + "widget": "string" }, "zeppelin.jdbc.concurrent.use": { "envName": null, "propertyName": "zeppelin.jdbc.concurrent.use", "defaultValue": true, "description": "Use parallel scheduler", - "type": "checkbox" + "widget": "checkbox" }, "zeppelin.jdbc.concurrent.max_connection": { "envName": null, "propertyName": "zeppelin.jdbc.concurrent.max_connection", "defaultValue": "10", "description": "Number of concurrent execution", - "type": "text" + "widget": "number" }, "zeppelin.jdbc.keytab.location": { "envName": null, "propertyName": "zeppelin.jdbc.keytab.location", "defaultValue": "", "description": "Kerberos keytab location", - "type": "text" + "widget": "string" }, "zeppelin.jdbc.principal": { "envName": null, "propertyName": "zeppelin.jdbc.principal", "defaultValue": "", "description": "Kerberos principal", - "type": "text" + "widget": "string" } }, "editor": { diff --git a/kylin/src/main/resources/interpreter-setting.json b/kylin/src/main/resources/interpreter-setting.json index dc2ac70f4d2..7e87f08b142 100644 --- a/kylin/src/main/resources/interpreter-setting.json +++ b/kylin/src/main/resources/interpreter-setting.json @@ -9,49 +9,49 @@ "propertyName": "kylin.api.url", "defaultValue": "http://localhost:7070/kylin/api/query", "description": "Kylin API", - "type": "text" + "widget": "url" }, "kylin.api.user": { "envName": null, "propertyName": "kylin.api.user", "defaultValue": "ADMIN", "description": "Kylin username", - "type": "text" + "widget": "string" }, "kylin.api.password": { "envName": null, "propertyName": "kylin.api.password", "defaultValue": "KYLIN", "description": "Kylin password", - "type": "password" + "widget": "password" }, "kylin.query.project": { "envName": null, "propertyName": "kylin.query.project", "defaultValue": "learn_kylin", "description": "Default Kylin project name", - "type": "text" + "widget": "text" }, "kylin.query.offset": { "envName": null, "propertyName": "kylin.query.offset", "defaultValue": "0", "description": "Kylin query offset", - "type": "text" + "widget": "number" }, "kylin.query.limit": { "envName": null, "propertyName": "kylin.query.limit", "defaultValue": "5000", "description": "Kylin query limit", - "type": "text" + "widget": "number" }, "kylin.query.ispartial": { "envName": null, "propertyName": "kylin.query.ispartial", "defaultValue": true, "description": "Kylin query partial flag, deprecated", - "type": "checkbox" + "widget": "checkbox" } }, "editor": { diff --git a/lens/src/main/resources/interpreter-setting.json b/lens/src/main/resources/interpreter-setting.json index 017bbdec92a..32d52369192 100644 --- a/lens/src/main/resources/interpreter-setting.json +++ b/lens/src/main/resources/interpreter-setting.json @@ -9,49 +9,49 @@ "propertyName": "zeppelin.lens.run.concurrent", "defaultValue": true, "description": "Run concurrent Lens Sessions", - "type": "checkbox" + "widget": "checkbox" }, "zeppelin.lens.maxThreads": { "envName": null, "propertyName": "zeppelin.lens.maxThreads", "defaultValue": "10", "description": "If concurrency is true then how many threads?", - "type": "text" + "widget": "number" }, "zeppelin.lens.maxResults": { "envName": null, "propertyName": "zeppelin.lens.maxResults", "defaultValue": "1000", "description": "max number of rows to display", - "type": "text" + "widget": "number" }, "lens.server.base.url": { "envName": null, "propertyName": "lens.server.base.url", "defaultValue": "http://:/lensapi", "description": "The URL for Lens Server", - "type": "text" + "widget": "url" }, "lens.client.dbname": { "envName": null, "propertyName": "lens.client.dbname", "defaultValue": "default", "description": "The database schema name", - "type": "text" + "widget": "string" }, "lens.query.enable.persistent.resultset": { "envName": null, "propertyName": "lens.query.enable.persistent.resultset", "defaultValue": false, "description": "Apache Lens to persist result in HDFS?", - "type": "checkbox" + "widget": "checkbox" }, "lens.session.cluster.user": { "envName": null, "propertyName": "lens.session.cluster.user", "defaultValue": "default", "description": "Hadoop cluster username", - "type": "text" + "widget": "string" } } } diff --git a/livy/src/main/resources/interpreter-setting.json b/livy/src/main/resources/interpreter-setting.json index e9ec185ed98..5f1eb387224 100644 --- a/livy/src/main/resources/interpreter-setting.json +++ b/livy/src/main/resources/interpreter-setting.json @@ -10,104 +10,104 @@ "propertyName": "zeppelin.livy.url", "defaultValue": "http://localhost:8998", "description": "The URL for Livy Server.", - "type": "text" + "widget": "url" }, "zeppelin.livy.session.create_timeout": { "envName": "ZEPPELIN_LIVY_SESSION_CREATE_TIMEOUT", "propertyName": "zeppelin.livy.session.create_timeout", "defaultValue": "120", "description": "Livy Server create session timeout (seconds).", - "type": "text" + "widget": "number" }, "livy.spark.driver.cores": { "propertyName": "livy.spark.driver.cores", "defaultValue": "", "description": "Driver cores. ex) 1, 2", - "type": "text" + "widget": "number" }, "livy.spark.driver.memory": { "propertyName": "livy.spark.driver.memory", "defaultValue": "", "description": "Driver memory. ex) 512m, 32g", - "type": "text" + "widget": "string" }, "livy.spark.executor.instances": { "propertyName": "livy.spark.executor.instances", "defaultValue": "", "description": "Executor instances. ex) 1, 4", - "type": "text" + "widget": "number" }, "livy.spark.executor.cores": { "propertyName": "livy.spark.executor.cores", "defaultValue": "", "description": "Num cores per executor. ex) 1, 4", - "type": "text" + "widget": "number" }, "livy.spark.executor.memory": { "propertyName": "livy.spark.executor.memory", "defaultValue": "", "description": "Executor memory per worker instance. ex) 512m, 32g", - "type": "text" + "widget": "string" }, "livy.spark.dynamicAllocation.enabled": { "propertyName": "livy.spark.dynamicAllocation.enabled", - "defaultValue": "", + "defaultValue": false, "description": "Use dynamic resource allocation", - "type": "text" + "widget": "checkbox" }, "livy.spark.dynamicAllocation.cachedExecutorIdleTimeout": { "propertyName": "livy.spark.dynamicAllocation.cachedExecutorIdleTimeout", "defaultValue": "", "description": "Remove an executor which has cached data blocks", - "type": "text" + "widget": "string" }, "livy.spark.dynamicAllocation.minExecutors": { "propertyName": "livy.spark.dynamicAllocation.minExecutors", "defaultValue": "", "description": "Lower bound for the number of executors if dynamic allocation is enabled.", - "type": "text" + "widget": "number" }, "livy.spark.dynamicAllocation.initialExecutors": { "propertyName": "livy.spark.dynamicAllocation.initialExecutors", "defaultValue": "", "description": "Initial number of executors to run if dynamic allocation is enabled.", - "type": "text" + "widget": "number" }, "livy.spark.dynamicAllocation.maxExecutors": { "propertyName": "livy.spark.dynamicAllocation.maxExecutors", "defaultValue": "", "description": "Upper bound for the number of executors if dynamic allocation is enabled.", - "type": "text" + "widget": "number" }, "zeppelin.livy.principal": { "propertyName": "zeppelin.livy.principal", "defaultValue": "", "description": "Kerberos principal to authenticate livy", - "type": "text" + "widget": "string" }, "zeppelin.livy.keytab": { "propertyName": "zeppelin.livy.keytab", "defaultValue": "", "description": "Kerberos keytab to authenticate livy", - "type": "text" + "widget": "text" }, "zeppelin.livy.pull_status.interval.millis": { "propertyName": "zeppelin.livy.pull_status.interval.millis", "defaultValue": "1000", "description": "The interval for checking paragraph execution status", - "type": "text" + "widget": "number" }, "livy.spark.jars.packages": { "propertyName": "livy.spark.jars.packages", "defaultValue": "", "description": "Adding extra libraries to livy interpreter", - "type": "text" + "widget": "text" }, "zeppelin.livy.displayAppInfo": { "propertyName": "zeppelin.livy.displayAppInfo", "defaultValue": false, "description": "Whether display app info", - "type": "checkbox" + "widget": "checkbox" } }, "option": { @@ -134,19 +134,19 @@ "propertyName": "zeppelin.livy.spark.sql.maxResult", "defaultValue": "1000", "description": "Max number of Spark SQL result to display.", - "type": "text" + "widget": "number" }, "zeppelin.livy.spark.sql.field.truncate": { "propertyName": "zeppelin.livy.spark.sql.field.truncate", "defaultValue": true, "description": "If true, truncate field values longer than 20 characters.", - "type": "checkbox" + "widget": "checkbox" }, "zeppelin.livy.concurrentSQL": { "propertyName": "zeppelin.livy.concurrentSQL", "defaultValue": false, "description": "Execute multiple SQL concurrently if set true.", - "type": "checkbox" + "widget": "checkbox" } }, "option": { diff --git a/markdown/src/main/resources/interpreter-setting.json b/markdown/src/main/resources/interpreter-setting.json index 6724657a890..37ae98bff44 100644 --- a/markdown/src/main/resources/interpreter-setting.json +++ b/markdown/src/main/resources/interpreter-setting.json @@ -9,7 +9,7 @@ "propertyName": "markdown.parser.type", "defaultValue": "pegdown", "description": "Markdown Parser Type. Available values: pegdown, markdown4j. Default = pegdown", - "type": "text" + "widget": "string" } }, "editor": { diff --git a/pig/src/main/resources/interpreter-setting.json b/pig/src/main/resources/interpreter-setting.json index f2ef00bcfc4..96e13f54994 100644 --- a/pig/src/main/resources/interpreter-setting.json +++ b/pig/src/main/resources/interpreter-setting.json @@ -9,14 +9,14 @@ "propertyName": "zeppelin.pig.execType", "defaultValue": "mapreduce", "description": "local | mapreduce | tez", - "type": "text" + "widget": "string" }, "zeppelin.pig.includeJobStats": { "envName": null, "propertyName": "zeppelin.pig.includeJobStats", "defaultValue": false, "description": "flag to include job stats in output", - "type": "checkbox" + "widget": "checkbox" } }, "editor": { @@ -34,14 +34,14 @@ "propertyName": "zeppelin.pig.execType", "defaultValue": "mapreduce", "description": "local | mapreduce | tez", - "type": "text" + "widget": "string" }, "zeppelin.pig.maxResult": { "envName": null, "propertyName": "zeppelin.pig.maxResult", "defaultValue": "1000", "description": "max row number for %pig.query", - "type": "text" + "widget": "number" } }, "editor": { diff --git a/python/src/main/resources/interpreter-setting.json b/python/src/main/resources/interpreter-setting.json index 65d26e3c880..03f9b331791 100644 --- a/python/src/main/resources/interpreter-setting.json +++ b/python/src/main/resources/interpreter-setting.json @@ -9,14 +9,14 @@ "propertyName": "zeppelin.python", "defaultValue": "python", "description": "Python directory. It is set to python by default.(assume python is in your $PATH)", - "type": "text" + "widget": "string" }, "zeppelin.python.maxResult": { "envName": null, "propertyName": "zeppelin.python.maxResult", "defaultValue": "1000", "description": "Max number of dataframe rows to display.", - "type": "text" + "widget": "number" } }, "editor": { diff --git a/r/src/main/resources/interpreter-setting.json b/r/src/main/resources/interpreter-setting.json index 2df4a367a25..5fb8698acfd 100644 --- a/r/src/main/resources/interpreter-setting.json +++ b/r/src/main/resources/interpreter-setting.json @@ -7,22 +7,22 @@ "rhadoop.cmd": { "envName": "HADOOP_CMD", "defaultValue": "", - "type": "text" + "widget": "text" }, "rhadooop.streamingjar": { "envName": "HADOOP_STREAMING", "defaultValue": "", - "type": "text" + "widget": "text" }, "rscala.debug": { "envName": "RSCALA_DEBUG", "defaultValue": false, - "type": "checkbox" + "widget": "checkbox" }, "rscala.timeout": { "envName": "RSCALA_TIMEOUT", "defaultValue": "60", - "type": "text" + "widget": "number" } } }, @@ -34,22 +34,22 @@ "rhadoop.cmd": { "envName": "HADOOP_CMD", "defaultValue": "", - "type": "text" + "widget": "text" }, "rhadooop.streamingjar": { "envName": "HADOOP_STREAMING", "defaultValue": "", - "type": "text" + "widget": "text" }, "rscala.debug": { "envName": "RSCALA_DEBUG", "defaultValue": false, - "type": "checkbox" + "widget": "checkbox" }, "rscala.timeout": { "envName": "RSCALA_TIMEOUT", "defaultValue": "60", - "type": "text" + "widget": "number" } } } diff --git a/scalding/src/main/resources/interpreter-setting.json b/scalding/src/main/resources/interpreter-setting.json index 4fdb0a22614..33458448b0c 100644 --- a/scalding/src/main/resources/interpreter-setting.json +++ b/scalding/src/main/resources/interpreter-setting.json @@ -8,13 +8,13 @@ "envName": null, "defaultValue": "--local --repl", "description": "Arguments for scalding REPL", - "type": "text" + "widget": "text" }, "max.open.instances": { "envName": null, "defaultValue": "50", "description": "Maximum number of open interpreter instances", - "type": "text" + "widget": "number" } } } diff --git a/shell/src/main/resources/interpreter-setting.json b/shell/src/main/resources/interpreter-setting.json index 811b58a27f0..cae496b7415 100644 --- a/shell/src/main/resources/interpreter-setting.json +++ b/shell/src/main/resources/interpreter-setting.json @@ -9,28 +9,28 @@ "propertyName": "shell.command.timeout.millisecs", "defaultValue": "60000", "description": "Shell command time out in millisecs. Default = 60000", - "type": "text" + "widget": "number" }, "zeppelin.shell.auth.type": { "envName": null, "propertyName": "zeppelin.shell.auth.type", "defaultValue": "", "description": "If auth type is needed, Example: KERBEROS", - "type": "text" + "widget": "string" }, "zeppelin.shell.keytab.location": { "envName": null, "propertyName": "zeppelin.shell.keytab.location", "defaultValue": "", "description": "Kerberos keytab location", - "type": "text" + "widget": "string" }, "zeppelin.shell.principal": { "envName": null, "propertyName": "zeppelin.shell.principal", "defaultValue": "", "description": "Kerberos principal", - "type": "text" + "widget": "string" } }, "editor": { diff --git a/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java b/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java index cb233bc0200..d30647b60fa 100644 --- a/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java +++ b/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java @@ -55,7 +55,7 @@ import org.apache.zeppelin.interpreter.InterpreterContext; import org.apache.zeppelin.interpreter.InterpreterException; import org.apache.zeppelin.interpreter.InterpreterHookRegistry; -import org.apache.zeppelin.interpreter.InterpreterPropertyType; +import org.apache.zeppelin.interpreter.InterpreterPropertyWidget; import org.apache.zeppelin.interpreter.InterpreterResult; import org.apache.zeppelin.interpreter.InterpreterResult.Code; import org.apache.zeppelin.interpreter.InterpreterUtils; @@ -527,14 +527,14 @@ public SparkContext createSparkContext_1() { private void setupConfForPySpark(SparkConf conf) { Object pysparkBaseProperty = - new DefaultInterpreterProperty("SPARK_HOME", null, null, null, InterpreterPropertyType.text) - .getValue(); + new DefaultInterpreterProperty("SPARK_HOME", null, null, null, + InterpreterPropertyWidget.text).getValue(); String pysparkBasePath = pysparkBaseProperty != null ? pysparkBaseProperty.toString() : null; File pysparkPath; if (null == pysparkBasePath) { pysparkBasePath = new DefaultInterpreterProperty("ZEPPELIN_HOME", "zeppelin.home", "../", null, - InterpreterPropertyType.text).getValue().toString(); + InterpreterPropertyWidget.text).getValue().toString(); pysparkPath = new File(pysparkBasePath, "interpreter" + File.separator + "spark" + File.separator + "pyspark"); } else { @@ -581,13 +581,13 @@ private void setupConfForPySpark(SparkConf conf) { private void setupConfForSparkR(SparkConf conf) { Object sparkRBaseProperty = new DefaultInterpreterProperty("SPARK_HOME", null, null, null, - InterpreterPropertyType.text).getValue(); + InterpreterPropertyWidget.text).getValue(); String sparkRBasePath = sparkRBaseProperty != null ? sparkRBaseProperty.toString() : null; File sparkRPath; if (null == sparkRBasePath) { sparkRBasePath = new DefaultInterpreterProperty("ZEPPELIN_HOME", "zeppelin.home", "../", null, - InterpreterPropertyType.text).getValue().toString(); + InterpreterPropertyWidget.text).getValue().toString(); sparkRPath = new File(sparkRBasePath, "interpreter" + File.separator + "spark" + File.separator + "R"); } else { diff --git a/spark/src/main/resources/interpreter-setting.json b/spark/src/main/resources/interpreter-setting.json index 0201e6b689f..ab04e5729c1 100644 --- a/spark/src/main/resources/interpreter-setting.json +++ b/spark/src/main/resources/interpreter-setting.json @@ -10,63 +10,63 @@ "propertyName": "spark.executor.memory", "defaultValue": "", "description": "Executor memory per worker instance. ex) 512m, 32g", - "type": "text" + "widget": "string" }, "args": { "envName": null, "propertyName": null, "defaultValue": "", "description": "spark commandline args", - "type": "text" + "widget": "text" }, "zeppelin.spark.useHiveContext": { "envName": "ZEPPELIN_SPARK_USEHIVECONTEXT", "propertyName": "zeppelin.spark.useHiveContext", "defaultValue": true, "description": "Use HiveContext instead of SQLContext if it is true.", - "type": "checkbox" + "widget": "checkbox" }, "spark.app.name": { "envName": "SPARK_APP_NAME", "propertyName": "spark.app.name", "defaultValue": "Zeppelin", "description": "The name of spark application.", - "type": "text" + "widget": "string" }, "zeppelin.spark.printREPLOutput": { "envName": null, "propertyName": "zeppelin.spark.printREPLOutput", "defaultValue": true, "description": "Print REPL output", - "type": "checkbox" + "widget": "checkbox" }, "spark.cores.max": { "envName": null, "propertyName": "spark.cores.max", "defaultValue": "", "description": "Total number of cores to use. Empty value uses all available core.", - "type": "text" + "widget": "number" }, "zeppelin.spark.maxResult": { "envName": "ZEPPELIN_SPARK_MAXRESULT", "propertyName": "zeppelin.spark.maxResult", "defaultValue": "1000", "description": "Max number of Spark SQL result to display.", - "type": "text" + "widget": "number" }, "master": { "envName": "MASTER", "propertyName": "spark.master", "defaultValue": "local[*]", "description": "Spark master uri. ex) spark://masterhost:7077", - "type": "text" + "widget": "string" }, "zeppelin.spark.unSupportedVersionCheck": { "envName": null, "propertyName": "zeppelin.spark.enableSupportedVersionCheck", "defaultValue": true, "description": "Do not change - developer only setting, not for production use", - "type": "checkbox" + "widget": "checkbox" } }, "editor": { @@ -84,28 +84,28 @@ "propertyName": "zeppelin.spark.concurrentSQL", "defaultValue": false, "description": "Execute multiple SQL concurrently if set true.", - "type": "checkbox" + "widget": "checkbox" }, "zeppelin.spark.sql.stacktrace": { "envName": "ZEPPELIN_SPARK_SQL_STACKTRACE", "propertyName": "zeppelin.spark.sql.stacktrace", "defaultValue": false, "description": "Show full exception stacktrace for SQL queries if set to true.", - "type": "checkbox" + "widget": "checkbox" }, "zeppelin.spark.maxResult": { "envName": "ZEPPELIN_SPARK_MAXRESULT", "propertyName": "zeppelin.spark.maxResult", "defaultValue": "1000", "description": "Max number of Spark SQL result to display.", - "type": "text" + "widget": "number" }, "zeppelin.spark.importImplicit": { "envName": "ZEPPELIN_SPARK_IMPORTIMPLICIT", "propertyName": "zeppelin.spark.importImplicit", "defaultValue": true, "description": "Import implicits, UDF collection, and sql if set true. true by default.", - "type": "checkbox" + "widget": "checkbox" } }, "editor": { @@ -123,14 +123,14 @@ "propertyName": null, "defaultValue": "local-repo", "description": "local repository for dependency loader", - "type": "text" + "widget": "string" }, "zeppelin.dep.additionalRemoteRepository": { "envName": null, "propertyName": null, "defaultValue": "spark-packages,http://dl.bintray.com/spark-packages/maven,false;", "description": "A list of 'id,remote-repository-URL,is-snapshot;' for each remote repository.", - "type": "text" + "widget": "text" } }, "editor": { @@ -148,7 +148,7 @@ "propertyName": null, "defaultValue": "python", "description": "Python command to run pyspark with", - "type": "text" + "widget": "string" } }, "editor": { diff --git a/spark/src/main/sparkr-resources/interpreter-setting.json b/spark/src/main/sparkr-resources/interpreter-setting.json index a341710e9a4..d28f75c444f 100644 --- a/spark/src/main/sparkr-resources/interpreter-setting.json +++ b/spark/src/main/sparkr-resources/interpreter-setting.json @@ -10,63 +10,63 @@ "propertyName": "spark.executor.memory", "defaultValue": "", "description": "Executor memory per worker instance. ex) 512m, 32g", - "type": "text" + "widget": "string" }, "args": { "envName": null, "propertyName": null, "defaultValue": "", "description": "spark commandline args", - "type": "text" + "widget": "text" }, "zeppelin.spark.useHiveContext": { "envName": "ZEPPELIN_SPARK_USEHIVECONTEXT", "propertyName": "zeppelin.spark.useHiveContext", "defaultValue": true, "description": "Use HiveContext instead of SQLContext if it is true.", - "type": "checkbox" + "widget": "checkbox" }, "spark.app.name": { "envName": "SPARK_APP_NAME", "propertyName": "spark.app.name", "defaultValue": "Zeppelin", "description": "The name of spark application.", - "type": "text" + "widget": "string" }, "zeppelin.spark.printREPLOutput": { "envName": null, "propertyName": "zeppelin.spark.printREPLOutput", "defaultValue": true, "description": "Print REPL output", - "type": "checkbox" + "widget": "checkbox" }, "spark.cores.max": { "envName": null, "propertyName": "spark.cores.max", "defaultValue": "", "description": "Total number of cores to use. Empty value uses all available core.", - "type": "text" + "widget": "number" }, "zeppelin.spark.maxResult": { "envName": "ZEPPELIN_SPARK_MAXRESULT", "propertyName": "zeppelin.spark.maxResult", "defaultValue": "1000", "description": "Max number of Spark SQL result to display.", - "type": "text" + "widget": "number" }, "master": { "envName": "MASTER", "propertyName": "spark.master", "defaultValue": "local[*]", "description": "Spark master uri. ex) spark://masterhost:7077", - "type": "text" + "widget": "string" }, "zeppelin.spark.unSupportedVersionCheck": { "envName": null, "propertyName": "zeppelin.spark.enableSupportedVersionCheck", "defaultValue": true, "description": "Do not change - developer only setting, not for production use", - "type": "checkbox" + "widget": "checkbox" } }, "editor": { @@ -83,28 +83,28 @@ "propertyName": "zeppelin.spark.concurrentSQL", "defaultValue": false, "description": "Execute multiple SQL concurrently if set true.", - "type": "checkbox" + "widget": "checkbox" }, "zeppelin.spark.sql.stacktrace": { "envName": "ZEPPELIN_SPARK_SQL_STACKTRACE", "propertyName": "zeppelin.spark.sql.stacktrace", "defaultValue": false, "description": "Show full exception stacktrace for SQL queries if set to true.", - "type": "checkbox" + "widget": "checkbox" }, "zeppelin.spark.maxResult": { "envName": "ZEPPELIN_SPARK_MAXRESULT", "propertyName": "zeppelin.spark.maxResult", "defaultValue": "1000", "description": "Max number of Spark SQL result to display.", - "type": "text" + "widget": "number" }, "zeppelin.spark.importImplicit": { "envName": "ZEPPELIN_SPARK_IMPORTIMPLICIT", "propertyName": "zeppelin.spark.importImplicit", "defaultValue": true, "description": "Import implicits, UDF collection, and sql if set true. true by default.", - "type": "checkbox" + "widget": "checkbox" } }, "editor": { @@ -121,14 +121,14 @@ "propertyName": null, "defaultValue": "local-repo", "description": "local repository for dependency loader", - "type": "text" + "widget": "string" }, "zeppelin.dep.additionalRemoteRepository": { "envName": null, "propertyName": null, "defaultValue": "spark-packages,http://dl.bintray.com/spark-packages/maven,false;", "description": "A list of 'id,remote-repository-URL,is-snapshot;' for each remote repository.", - "type": "text" + "widget": "text" } }, "editor": { @@ -145,7 +145,7 @@ "propertyName": null, "defaultValue": "python", "description": "Python command to run pyspark with", - "type": "text" + "widget": "string" } }, "editor": { @@ -162,28 +162,28 @@ "propertyName": "zeppelin.R.knitr", "defaultValue": true, "description": "whether use knitr or not", - "type": "checkbox" + "widget": "checkbox" }, "zeppelin.R.cmd": { "envName": "ZEPPELIN_R_CMD", "propertyName": "zeppelin.R.cmd", "defaultValue": "R", "description": "R repl path", - "type": "text" + "widget": "string" }, "zeppelin.R.image.width": { "envName": "ZEPPELIN_R_IMAGE_WIDTH", "propertyName": "zeppelin.R.image.width", "defaultValue": "100%", "description": "", - "type": "text" + "widget": "number" }, "zeppelin.R.render.options": { "envName": "ZEPPELIN_R_RENDER_OPTIONS", "propertyName": "zeppelin.R.render.options", "defaultValue": "out.format = 'html', comment = NA, echo = FALSE, results = 'asis', message = F, warning = F", "description": "", - "type": "text" + "widget": "text" } }, "editor": { diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/DefaultInterpreterProperty.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/DefaultInterpreterProperty.java index f8631849432..89df8c0f82c 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/DefaultInterpreterProperty.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/DefaultInterpreterProperty.java @@ -25,20 +25,20 @@ public class DefaultInterpreterProperty { String propertyName; Object defaultValue; String description; - InterpreterPropertyType type; + InterpreterPropertyWidget widget; public DefaultInterpreterProperty(String envName, String propertyName, Object defaultValue, - String description, InterpreterPropertyType type) { + String description, InterpreterPropertyWidget widget) { this.envName = envName; this.propertyName = propertyName; this.defaultValue = defaultValue; this.description = description; - this.type = type; + this.widget = widget; } public DefaultInterpreterProperty(Object defaultValue, String description, - InterpreterPropertyType type) { - this(null, null, defaultValue, description, type); + InterpreterPropertyWidget widget) { + this(null, null, defaultValue, description, widget); } public String getEnvName() { @@ -73,12 +73,12 @@ public void setDescription(String description) { this.description = description; } - public InterpreterPropertyType getType() { - return type; + public InterpreterPropertyWidget getWidget() { + return widget; } - public void setType(InterpreterPropertyType type) { - this.type = type; + public void setWidget(InterpreterPropertyWidget widget) { + this.widget = widget; } public int hashCode() { @@ -110,6 +110,6 @@ public Object getValue() { @Override public String toString() { return String.format("{envName=%s, propertyName=%s, defaultValue=%s, description=%20s, " + - "type=%s}", envName, propertyName, defaultValue, description, type); + "type=%s}", envName, propertyName, defaultValue, description, widget); } } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java index db11c5d1aa8..2525d6bb2e6 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java @@ -23,12 +23,12 @@ public class InterpreterProperty { private String name; private Object value; - private InterpreterPropertyType type; + private InterpreterPropertyWidget widget; - public InterpreterProperty(String name, Object value, InterpreterPropertyType type) { + public InterpreterProperty(String name, Object value, InterpreterPropertyWidget widget) { this.name = name; this.value = value; - this.type = type; + this.widget = widget; } public String getName() { @@ -47,11 +47,11 @@ public void setValue(Object value) { this.value = value; } - public InterpreterPropertyType getType() { - return type; + public InterpreterPropertyWidget getWidget() { + return widget; } - public void setType(InterpreterPropertyType type) { - this.type = type; + public void setWidget(InterpreterPropertyWidget widget) { + this.widget = widget; } } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java index 3f9e2ca6a58..9baef948e54 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java @@ -28,7 +28,7 @@ public class InterpreterPropertyBuilder { public InterpreterPropertyBuilder add(String name, String defaultValue, String description){ properties.put(name, - new DefaultInterpreterProperty(defaultValue, description, InterpreterPropertyType.text)); + new DefaultInterpreterProperty(defaultValue, description, InterpreterPropertyWidget.text)); return this; } @@ -36,7 +36,7 @@ public InterpreterPropertyBuilder add(String name, String envName, String proper String defaultValue, String description){ properties.put(name, new DefaultInterpreterProperty(envName, propertyName, defaultValue, description, - InterpreterPropertyType.text)); + InterpreterPropertyWidget.text)); return this; } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyWidget.java similarity index 89% rename from zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java rename to zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyWidget.java index 195f827f044..9606fb191c2 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyWidget.java @@ -18,10 +18,13 @@ package org.apache.zeppelin.interpreter; /** - * Types of interpreter properties + * Widgets of interpreter properties */ -public enum InterpreterPropertyType { +public enum InterpreterPropertyWidget { text, + string, + number, + url, password, checkbox } diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java index 46c363e0eb4..25e85812455 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java @@ -21,7 +21,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Properties; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.DELETE; @@ -37,7 +36,7 @@ import com.google.gson.Gson; import org.apache.commons.lang.exception.ExceptionUtils; -import org.apache.zeppelin.interpreter.InterpreterPropertyType; +import org.apache.zeppelin.interpreter.InterpreterPropertyWidget; import org.apache.zeppelin.interpreter.InterpreterSettingManager; import org.apache.zeppelin.rest.message.RestartInterpreterRequest; import org.apache.zeppelin.utils.SecurityUtils; @@ -296,11 +295,11 @@ public Response removeRepository(@PathParam("repoId") String repoId) { } /** - * Get available types for property + * Get available widgets for property */ @GET - @Path("property/types") - public Response listInterpreterPropertyTypes() { - return new JsonResponse<>(Status.OK, InterpreterPropertyType.values()).build(); + @Path("property/widgets") + public Response listInterpreterPropertyWidgets() { + return new JsonResponse<>(Status.OK, InterpreterPropertyWidget.values()).build(); } } diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java index 3237808a1b8..0b0c0189055 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java @@ -45,7 +45,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.interpreter.InterpreterProperty; -import org.apache.zeppelin.interpreter.InterpreterPropertyType; +import org.apache.zeppelin.interpreter.InterpreterPropertyWidget; import org.apache.zeppelin.interpreter.InterpreterSetting; import org.apache.zeppelin.server.ZeppelinServer; import org.hamcrest.Description; @@ -205,14 +205,14 @@ private static void start(boolean withAuth) throws Exception { if ("true".equals(System.getenv("CI"))) { // set spark master and other properties sparkProperties.put("master", - new InterpreterProperty("master", "local[2]", InterpreterPropertyType.text)); + new InterpreterProperty("master", "local[2]", InterpreterPropertyWidget.text)); sparkProperties.put("spark.cores.max", - new InterpreterProperty("spark.cores.max", "2", InterpreterPropertyType.text)); + new InterpreterProperty("spark.cores.max", "2", InterpreterPropertyWidget.text)); sparkProperties.put("zeppelin.spark.useHiveContext", - new InterpreterProperty("zeppelin.spark.useHiveContext", false, InterpreterPropertyType.checkbox)); + new InterpreterProperty("zeppelin.spark.useHiveContext", false, InterpreterPropertyWidget.checkbox)); // set spark home for pyspark sparkProperties.put("spark.home", - new InterpreterProperty("spark.home", getSparkHome(), InterpreterPropertyType.text)); + new InterpreterProperty("spark.home", getSparkHome(), InterpreterPropertyWidget.text)); sparkIntpSetting.setProperties(sparkProperties); pySpark = true; @@ -223,18 +223,18 @@ private static void start(boolean withAuth) throws Exception { if (sparkHome != null) { if (System.getenv("SPARK_MASTER") != null) { sparkProperties.put("master", - new InterpreterProperty("master", System.getenv("SPARK_MASTER"), InterpreterPropertyType.text)); + new InterpreterProperty("master", System.getenv("SPARK_MASTER"), InterpreterPropertyWidget.text)); } else { sparkProperties.put("master", - new InterpreterProperty("master", "local[2]", InterpreterPropertyType.text)); + new InterpreterProperty("master", "local[2]", InterpreterPropertyWidget.text)); } sparkProperties.put("spark.cores.max", - new InterpreterProperty("spark.cores.max", "2", InterpreterPropertyType.text)); + new InterpreterProperty("spark.cores.max", "2", InterpreterPropertyWidget.text)); // set spark home for pyspark sparkProperties.put("spark.home", - new InterpreterProperty("spark.home", sparkHome, InterpreterPropertyType.text)); + new InterpreterProperty("spark.home", sparkHome, InterpreterPropertyWidget.text)); sparkProperties.put("zeppelin.spark.useHiveContext", - new InterpreterProperty("zeppelin.spark.useHiveContext", false, InterpreterPropertyType.checkbox)); + new InterpreterProperty("zeppelin.spark.useHiveContext", false, InterpreterPropertyWidget.checkbox)); pySpark = true; sparkR = true; } diff --git a/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html b/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html index 41b8e72f497..9ab9ca57173 100644 --- a/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html +++ b/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html @@ -277,8 +277,11 @@
Properties
- @@ -296,14 +299,17 @@
Properties
- - -
DescriptionThis ```GET``` method returns available types for interpreter property.This ```GET``` method returns available widgets for interpreter property.
URL```http://[zeppelin-server]:[zeppelin-port]/api/interpreter/property/types``````http://[zeppelin-server]:[zeppelin-port]/api/interpreter/property/widgets```
Success code
{{key}} + + + + + + + + - diff --git a/zeppelin-web/src/app/interpreter/interpreter.controller.js b/zeppelin-web/src/app/interpreter/interpreter.controller.js index f7dfba30f34..7140345ec22 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.controller.js +++ b/zeppelin-web/src/app/interpreter/interpreter.controller.js @@ -26,7 +26,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou $scope.showRepositoryInfo = false; $scope.searchInterpreter = ''; $scope._ = _; - $scope.interpreterPropertyTypes = []; + $scope.interpreterPropertyWidgets = []; ngToast.dismiss(); $scope.openPermissions = function() { @@ -141,17 +141,17 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou }); }; - var getAvailableInterpreterPropertyTypes = function () { - $http.get(baseUrlSrv.getRestApiBase() + '/interpreter/property/types') + var getAvailableInterpreterPropertyWidgets = function () { + $http.get(baseUrlSrv.getRestApiBase() + '/interpreter/property/widgets') .success(function (data, status, headers, config) { - $scope.interpreterPropertyTypes = data.body; + $scope.interpreterPropertyWidgets = data.body; }).error(function (data, status, headers, config) { console.log('Error %o %o', status, data.message); }); }; var emptyNewProperty = function(object) { - angular.extend(object, {propertyValue: '', propertyKey: '', propertyType: $scope.interpreterPropertyTypes[0]}); + angular.extend(object, {propertyValue: '', propertyKey: '', propertyWidget: $scope.interpreterPropertyWidgets[0]}); }; var emptyNewDependency = function(object) { @@ -192,8 +192,8 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou } }; - $scope.defaultValueByType = function(setting) { - if (setting.propertyType === 'checkbox') { + $scope.defaultValueByWidget = function(setting) { + if (setting.propertyWidget === 'checkbox') { setting.propertyValue = false; return; } @@ -428,7 +428,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou properties[key] = { value: intpInfo[key].defaultValue, description: intpInfo[key].description, - type: intpInfo[key].type + widget: intpInfo[key].widget }; } } @@ -505,7 +505,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou var newProperties = {}; for (var p in newSetting.properties) { - newProperties[p] = {value: newSetting.properties[p].value, type: newSetting.properties[p].type, name: p}; + newProperties[p] = {value: newSetting.properties[p].value, widget: newSetting.properties[p].widget, name: p}; } request.properties = newProperties; @@ -578,7 +578,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou $scope.newInterpreterSetting.properties[$scope.newInterpreterSetting.propertyKey] = { value: $scope.newInterpreterSetting.propertyValue, - type: $scope.newInterpreterSetting.propertyType + widget: $scope.newInterpreterSetting.propertyWidget }; emptyNewProperty($scope.newInterpreterSetting); } else { @@ -590,7 +590,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou return; } - setting.properties[setting.propertyKey] = {value: setting.propertyValue, type: setting.propertyType}; + setting.properties[setting.propertyKey] = {value: setting.propertyValue, widget: setting.propertyWidget}; emptyNewProperty(setting); } @@ -719,7 +719,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou }; var init = function() { - getAvailableInterpreterPropertyTypes(); + getAvailableInterpreterPropertyWidgets(); $scope.resetNewInterpreterSetting(); $scope.resetNewRepositorySetting(); diff --git a/zeppelin-web/src/app/interpreter/interpreter.html b/zeppelin-web/src/app/interpreter/interpreter.html index 74d8ded4cb6..54652a0e092 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.html +++ b/zeppelin-web/src/app/interpreter/interpreter.html @@ -400,10 +400,17 @@
Properties
{{key}} + {{setting.properties[key].value | breakFilter}} + + {{setting.properties[key].value}} + + + {{setting.properties[key].value}} + + {{setting.properties[key].value}} {{setting.properties[key].value ? '***' : ''}} @@ -423,14 +430,17 @@
Properties
pu-elastic-input pu-elastic-input-minwidth="180px" />
+ + + + -

-### Get available widgets for property +### Get available types for property - + - + diff --git a/elasticsearch/src/main/resources/interpreter-setting.json b/elasticsearch/src/main/resources/interpreter-setting.json index a0530224365..af471d9f3d7 100644 --- a/elasticsearch/src/main/resources/interpreter-setting.json +++ b/elasticsearch/src/main/resources/interpreter-setting.json @@ -9,49 +9,48 @@ "propertyName": "elasticsearch.host", "defaultValue": "localhost", "description": "The host for Elasticsearch", - "widget": "string" + "type": "text" }, "elasticsearch.port": { "envName": "ELASTICSEARCH_PORT", "propertyName": "elasticsearch.port", "defaultValue": "9300", "description": "The port for Elasticsearch", - "widget": "number" + "type": "text" }, "elasticsearch.client.type": { "envName": "ELASTICSEARCH_CLIENT_TYPE", "propertyName": "elasticsearch.client.type", "defaultValue": "transport", "description": "The type of client for Elasticsearch (transport or http)", - "widget": "string" + "type": "text" }, "elasticsearch.cluster.name": { "envName": "ELASTICSEARCH_CLUSTER_NAME", "propertyName": "elasticsearch.cluster.name", "defaultValue": "elasticsearch", "description": "The cluster name for Elasticsearch", - "widget": "string" + "type": "text" }, "elasticsearch.result.size": { "envName": "ELASTICSEARCH_RESULT_SIZE", "propertyName": "elasticsearch.result.size", "defaultValue": "10", "description": "The size of the result set of a search query", - "widget": "number" + "type": "text" }, "elasticsearch.basicauth.username": { "envName": "ELASTICSEARCH_BASIC_AUTH_USERNAME", "propertyName": "elasticsearch.basicauth.username", "defaultValue": "", - "description": "Username for a basic authentication", - "widget": "string" + "description": "Username for a basic authentication" }, "elasticsearch.basicauth.password": { "envName": "ELASTICSEARCH_BASIC_AUTH_PASSWORD", "propertyName": "elasticsearch.basicauth.password", "defaultValue": "", "description": "Password for a basic authentication", - "widget": "password" + "type": "password" } }, "editor": { diff --git a/file/src/main/resources/interpreter-setting.json b/file/src/main/resources/interpreter-setting.json index f30bdc6fbcd..0560e749d83 100644 --- a/file/src/main/resources/interpreter-setting.json +++ b/file/src/main/resources/interpreter-setting.json @@ -9,21 +9,21 @@ "propertyName": "hdfs.url", "defaultValue": "http://localhost:50070/webhdfs/v1/", "description": "The URL for WebHDFS", - "widget": "url" + "type": "text" }, "hdfs.user": { "envName": null, "propertyName": "hdfs.user", "defaultValue": "hdfs", "description": "The WebHDFS user", - "widget": "string" + "type": "text" }, "hdfs.maxlength": { "envName": null, "propertyName": "hdfs.maxlength", "defaultValue": "1000", "description": "Maximum number of lines of results fetched", - "widget": "number" + "type": "text" } }, "editor": { diff --git a/flink/src/main/resources/interpreter-setting.json b/flink/src/main/resources/interpreter-setting.json index ca98af826f0..395ef7f8286 100644 --- a/flink/src/main/resources/interpreter-setting.json +++ b/flink/src/main/resources/interpreter-setting.json @@ -9,14 +9,14 @@ "propertyName": null, "defaultValue": "local", "description": "host name of running JobManager. 'local' runs flink in local mode.", - "widget": "string" + "type": "text" }, "port": { "envName": "port", "propertyName": null, "defaultValue": "6123", "description": "port of running JobManager.", - "widget": "number" + "type": "text" } }, "editor": { diff --git a/geode/src/main/resources/interpreter-setting.json b/geode/src/main/resources/interpreter-setting.json index 94031bb56a3..5f0e79c63bd 100644 --- a/geode/src/main/resources/interpreter-setting.json +++ b/geode/src/main/resources/interpreter-setting.json @@ -9,21 +9,21 @@ "propertyName": "geode.locator.host", "defaultValue": "localhost", "description": "The Geode Locator Host.", - "widget": "string" + "type": "text" }, "geode.locator.port": { "envName": null, "propertyName": "geode.locator.port", "defaultValue": "10334", "description": "The Geode Locator Port.", - "widget": "number" + "type": "text" }, "geode.max.result": { "envName": null, "propertyName": "geode.max.result", "defaultValue": "1000", "description": "Max number of OQL result to display.", - "widget": "number" + "type": "text" } }, "editor": { diff --git a/groovy/src/main/resources/interpreter-setting.json b/groovy/src/main/resources/interpreter-setting.json index e9d200e1424..92e94c9487f 100644 --- a/groovy/src/main/resources/interpreter-setting.json +++ b/groovy/src/main/resources/interpreter-setting.json @@ -9,7 +9,7 @@ "propertyName": "GROOVY_CLASSES", "defaultValue": "", "description": "The path for custom groovy classes location. If empty `./interpreter/groovy/classes`", - "widget": "text" + "type": "text" } } } diff --git a/hbase/src/main/resources/interpreter-setting.json b/hbase/src/main/resources/interpreter-setting.json index 95aba64648d..afe6dddd8c5 100644 --- a/hbase/src/main/resources/interpreter-setting.json +++ b/hbase/src/main/resources/interpreter-setting.json @@ -9,19 +9,19 @@ "propertyName": "hbase.home", "defaultValue": "/usr/lib/hbase/", "description": "Installation directory of HBase", - "widget": "string" + "type": "text" }, "hbase.ruby.sources": { "propertyName": "hbase.ruby.sources", "defaultValue": "lib/ruby", "description": "Path to Ruby scripts relative to 'hbase.home'", - "widget": "string" + "type": "text" }, "zeppelin.hbase.test.mode": { "propertyName": "zeppelin.hbase.test.mode", - "defaultValue": false, + "defaultValue": "false", "description": "Disable checks for unit and manual tests", - "widget": "checkbox" + "type": "text" } }, "editor": { diff --git a/helium-dev/src/main/resources/interpreter-setting.json b/helium-dev/src/main/resources/interpreter-setting.json index f50d66e6dfd..9383f27a6f9 100644 --- a/helium-dev/src/main/resources/interpreter-setting.json +++ b/helium-dev/src/main/resources/interpreter-setting.json @@ -9,7 +9,7 @@ "propertyName": "port", "defaultValue": "jdbc:postgresql://localhost:5432/", "description": "The URL for JDBC.", - "widget": "string" + "type": "text" } }, "editor": { diff --git a/ignite/src/main/resources/interpreter-setting.json b/ignite/src/main/resources/interpreter-setting.json index 74b035f2a01..a8e62d7a3b9 100644 --- a/ignite/src/main/resources/interpreter-setting.json +++ b/ignite/src/main/resources/interpreter-setting.json @@ -9,28 +9,28 @@ "propertyName": "ignite.addresses", "defaultValue": "127.0.0.1:47500..47509", "description": "Comma separated list of addresses (e.g. 127.0.0.1:47500 or 127.0.0.1:47500..47509)", - "widget": "text" + "type": "text" }, "ignite.clientMode": { "envName": null, "propertyName": "ignite.clientMode", - "defaultValue": true, + "defaultValue": "true", "description": "Client mode. true or false", - "widget": "checkbox" + "type": "text" }, "ignite.config.url": { "envName": null, "propertyName": "ignite.config.url", "defaultValue": "", "description": "Configuration URL. Overrides all other settings.", - "widget": "url" + "type": "text" }, "ignite.peerClassLoadingEnabled": { "envName": null, "propertyName": "ignite.peerClassLoadingEnabled", - "defaultValue": true, + "defaultValue": "true", "description": "Peer class loading enabled. True or false", - "widget": "checkbox" + "type": "text" } } }, @@ -44,7 +44,7 @@ "propertyName": "ignite.jdbc.url", "defaultValue": "jdbc:ignite:cfg://default-ignite-jdbc.xml", "description": "Ignite JDBC connection URL.", - "widget": "string" + "type": "text" } } } diff --git a/jdbc/src/main/resources/interpreter-setting.json b/jdbc/src/main/resources/interpreter-setting.json index 5e70e535fe6..ce8c880e932 100644 --- a/jdbc/src/main/resources/interpreter-setting.json +++ b/jdbc/src/main/resources/interpreter-setting.json @@ -9,84 +9,83 @@ "propertyName": "default.url", "defaultValue": "jdbc:postgresql://localhost:5432/", "description": "The URL for JDBC.", - "widget": "string" + "type": "text" }, "default.user": { "envName": null, "propertyName": "default.user", "defaultValue": "gpadmin", "description": "The JDBC user name", - "widget": "string" + "type": "text" }, "default.password": { "envName": null, "propertyName": "default.password", "defaultValue": "", "description": "The JDBC user password", - "widget": "password" + "type": "password" }, "default.driver": { "envName": null, "propertyName": "default.driver", "defaultValue": "org.postgresql.Driver", "description": "JDBC Driver Name", - "widget": "string" + "type": "text" }, "default.completer.schemaFilters": { "envName": null, "propertyName": "default.completer.schemaFilters", "defaultValue": "", - "description": "Сomma separated schema (schema = catalog = database) filters to get metadata for completions. Supports '%' symbol is equivalent to any set of characters. (ex. prod_v_%,public%,info)", - "widget": "text" + "description": "Сomma separated schema (schema = catalog = database) filters to get metadata for completions. Supports '%' symbol is equivalent to any set of characters. (ex. prod_v_%,public%,info)" }, "default.precode": { "envName": null, "propertyName": "zeppelin.jdbc.precode", "defaultValue": "", "description": "SQL which executes while opening connection", - "widget": "text" + "type": "text" }, "common.max_count": { "envName": null, "propertyName": "common.max_count", "defaultValue": "1000", "description": "Max number of SQL result to display.", - "widget": "number" + "type": "text" }, "zeppelin.jdbc.auth.type": { "envName": null, "propertyName": "zeppelin.jdbc.auth.type", "defaultValue": "", "description": "If auth type is needed, Example: KERBEROS", - "widget": "string" + "type": "text" }, "zeppelin.jdbc.concurrent.use": { "envName": null, "propertyName": "zeppelin.jdbc.concurrent.use", - "defaultValue": true, + "defaultValue": "true", "description": "Use parallel scheduler", - "widget": "checkbox" + "type": "text" }, "zeppelin.jdbc.concurrent.max_connection": { "envName": null, "propertyName": "zeppelin.jdbc.concurrent.max_connection", "defaultValue": "10", "description": "Number of concurrent execution", - "widget": "number" + "type": "text" }, "zeppelin.jdbc.keytab.location": { "envName": null, "propertyName": "zeppelin.jdbc.keytab.location", "defaultValue": "", "description": "Kerberos keytab location", - "widget": "string" + "type": "text" }, "zeppelin.jdbc.principal": { "envName": null, "propertyName": "zeppelin.jdbc.principal", "defaultValue": "", "description": "Kerberos principal", - "widget": "string" + "type": "text" } }, "editor": { diff --git a/kylin/src/main/resources/interpreter-setting.json b/kylin/src/main/resources/interpreter-setting.json index 7e87f08b142..271294f46c4 100644 --- a/kylin/src/main/resources/interpreter-setting.json +++ b/kylin/src/main/resources/interpreter-setting.json @@ -9,49 +9,49 @@ "propertyName": "kylin.api.url", "defaultValue": "http://localhost:7070/kylin/api/query", "description": "Kylin API", - "widget": "url" + "type": "text" }, "kylin.api.user": { "envName": null, "propertyName": "kylin.api.user", "defaultValue": "ADMIN", "description": "Kylin username", - "widget": "string" + "type": "text" }, "kylin.api.password": { "envName": null, "propertyName": "kylin.api.password", "defaultValue": "KYLIN", "description": "Kylin password", - "widget": "password" + "type": "password" }, "kylin.query.project": { "envName": null, "propertyName": "kylin.query.project", "defaultValue": "learn_kylin", "description": "Default Kylin project name", - "widget": "text" + "type": "text" }, "kylin.query.offset": { "envName": null, "propertyName": "kylin.query.offset", "defaultValue": "0", "description": "Kylin query offset", - "widget": "number" + "type": "text" }, "kylin.query.limit": { "envName": null, "propertyName": "kylin.query.limit", "defaultValue": "5000", "description": "Kylin query limit", - "widget": "number" + "type": "text" }, "kylin.query.ispartial": { "envName": null, "propertyName": "kylin.query.ispartial", - "defaultValue": true, + "defaultValue": "true", "description": "Kylin query partial flag, deprecated", - "widget": "checkbox" + "type": "text" } }, "editor": { diff --git a/lens/src/main/resources/interpreter-setting.json b/lens/src/main/resources/interpreter-setting.json index 32d52369192..1524dcd6208 100644 --- a/lens/src/main/resources/interpreter-setting.json +++ b/lens/src/main/resources/interpreter-setting.json @@ -7,51 +7,51 @@ "zeppelin.lens.run.concurrent": { "envName": null, "propertyName": "zeppelin.lens.run.concurrent", - "defaultValue": true, + "defaultValue": "true", "description": "Run concurrent Lens Sessions", - "widget": "checkbox" + "type": "text" }, "zeppelin.lens.maxThreads": { "envName": null, "propertyName": "zeppelin.lens.maxThreads", "defaultValue": "10", "description": "If concurrency is true then how many threads?", - "widget": "number" + "type": "text" }, "zeppelin.lens.maxResults": { "envName": null, "propertyName": "zeppelin.lens.maxResults", "defaultValue": "1000", "description": "max number of rows to display", - "widget": "number" + "type": "text" }, "lens.server.base.url": { "envName": null, "propertyName": "lens.server.base.url", "defaultValue": "http://:/lensapi", "description": "The URL for Lens Server", - "widget": "url" + "type": "text" }, "lens.client.dbname": { "envName": null, "propertyName": "lens.client.dbname", "defaultValue": "default", "description": "The database schema name", - "widget": "string" + "type": "text" }, "lens.query.enable.persistent.resultset": { "envName": null, "propertyName": "lens.query.enable.persistent.resultset", - "defaultValue": false, + "defaultValue": "false", "description": "Apache Lens to persist result in HDFS?", - "widget": "checkbox" + "type": "text" }, "lens.session.cluster.user": { "envName": null, "propertyName": "lens.session.cluster.user", "defaultValue": "default", "description": "Hadoop cluster username", - "widget": "string" + "type": "text" } } } diff --git a/livy/src/main/resources/interpreter-setting.json b/livy/src/main/resources/interpreter-setting.json index 5f1eb387224..bf73fddbfa6 100644 --- a/livy/src/main/resources/interpreter-setting.json +++ b/livy/src/main/resources/interpreter-setting.json @@ -10,104 +10,104 @@ "propertyName": "zeppelin.livy.url", "defaultValue": "http://localhost:8998", "description": "The URL for Livy Server.", - "widget": "url" + "type": "text" }, "zeppelin.livy.session.create_timeout": { "envName": "ZEPPELIN_LIVY_SESSION_CREATE_TIMEOUT", "propertyName": "zeppelin.livy.session.create_timeout", "defaultValue": "120", "description": "Livy Server create session timeout (seconds).", - "widget": "number" + "type": "text" }, "livy.spark.driver.cores": { "propertyName": "livy.spark.driver.cores", "defaultValue": "", "description": "Driver cores. ex) 1, 2", - "widget": "number" + "type": "text" }, "livy.spark.driver.memory": { "propertyName": "livy.spark.driver.memory", "defaultValue": "", "description": "Driver memory. ex) 512m, 32g", - "widget": "string" + "type": "text" }, "livy.spark.executor.instances": { "propertyName": "livy.spark.executor.instances", "defaultValue": "", "description": "Executor instances. ex) 1, 4", - "widget": "number" + "type": "text" }, "livy.spark.executor.cores": { "propertyName": "livy.spark.executor.cores", "defaultValue": "", "description": "Num cores per executor. ex) 1, 4", - "widget": "number" + "type": "text" }, "livy.spark.executor.memory": { "propertyName": "livy.spark.executor.memory", "defaultValue": "", "description": "Executor memory per worker instance. ex) 512m, 32g", - "widget": "string" + "type": "text" }, "livy.spark.dynamicAllocation.enabled": { "propertyName": "livy.spark.dynamicAllocation.enabled", - "defaultValue": false, + "defaultValue": "", "description": "Use dynamic resource allocation", - "widget": "checkbox" + "type": "text" }, "livy.spark.dynamicAllocation.cachedExecutorIdleTimeout": { "propertyName": "livy.spark.dynamicAllocation.cachedExecutorIdleTimeout", "defaultValue": "", "description": "Remove an executor which has cached data blocks", - "widget": "string" + "type": "text" }, "livy.spark.dynamicAllocation.minExecutors": { "propertyName": "livy.spark.dynamicAllocation.minExecutors", "defaultValue": "", "description": "Lower bound for the number of executors if dynamic allocation is enabled.", - "widget": "number" + "type": "text" }, "livy.spark.dynamicAllocation.initialExecutors": { "propertyName": "livy.spark.dynamicAllocation.initialExecutors", "defaultValue": "", "description": "Initial number of executors to run if dynamic allocation is enabled.", - "widget": "number" + "type": "text" }, "livy.spark.dynamicAllocation.maxExecutors": { "propertyName": "livy.spark.dynamicAllocation.maxExecutors", "defaultValue": "", "description": "Upper bound for the number of executors if dynamic allocation is enabled.", - "widget": "number" + "type": "text" }, "zeppelin.livy.principal": { "propertyName": "zeppelin.livy.principal", "defaultValue": "", "description": "Kerberos principal to authenticate livy", - "widget": "string" + "type": "text" }, "zeppelin.livy.keytab": { "propertyName": "zeppelin.livy.keytab", "defaultValue": "", "description": "Kerberos keytab to authenticate livy", - "widget": "text" + "type": "text" }, "zeppelin.livy.pull_status.interval.millis": { "propertyName": "zeppelin.livy.pull_status.interval.millis", "defaultValue": "1000", "description": "The interval for checking paragraph execution status", - "widget": "number" + "type": "text" }, "livy.spark.jars.packages": { "propertyName": "livy.spark.jars.packages", "defaultValue": "", "description": "Adding extra libraries to livy interpreter", - "widget": "text" + "type": "text" }, "zeppelin.livy.displayAppInfo": { "propertyName": "zeppelin.livy.displayAppInfo", - "defaultValue": false, + "defaultValue": "false", "description": "Whether display app info", - "widget": "checkbox" + "type": "text" } }, "option": { @@ -134,19 +134,19 @@ "propertyName": "zeppelin.livy.spark.sql.maxResult", "defaultValue": "1000", "description": "Max number of Spark SQL result to display.", - "widget": "number" + "type": "text" }, "zeppelin.livy.spark.sql.field.truncate": { "propertyName": "zeppelin.livy.spark.sql.field.truncate", - "defaultValue": true, + "defaultValue": "true", "description": "If true, truncate field values longer than 20 characters.", - "widget": "checkbox" + "type": "text" }, "zeppelin.livy.concurrentSQL": { "propertyName": "zeppelin.livy.concurrentSQL", - "defaultValue": false, + "defaultValue": "false", "description": "Execute multiple SQL concurrently if set true.", - "widget": "checkbox" + "type": "text" } }, "option": { diff --git a/markdown/src/main/resources/interpreter-setting.json b/markdown/src/main/resources/interpreter-setting.json index 37ae98bff44..6724657a890 100644 --- a/markdown/src/main/resources/interpreter-setting.json +++ b/markdown/src/main/resources/interpreter-setting.json @@ -9,7 +9,7 @@ "propertyName": "markdown.parser.type", "defaultValue": "pegdown", "description": "Markdown Parser Type. Available values: pegdown, markdown4j. Default = pegdown", - "widget": "string" + "type": "text" } }, "editor": { diff --git a/pig/src/main/resources/interpreter-setting.json b/pig/src/main/resources/interpreter-setting.json index 96e13f54994..540404d0cb9 100644 --- a/pig/src/main/resources/interpreter-setting.json +++ b/pig/src/main/resources/interpreter-setting.json @@ -9,14 +9,14 @@ "propertyName": "zeppelin.pig.execType", "defaultValue": "mapreduce", "description": "local | mapreduce | tez", - "widget": "string" + "type": "text" }, "zeppelin.pig.includeJobStats": { "envName": null, "propertyName": "zeppelin.pig.includeJobStats", - "defaultValue": false, + "defaultValue": "false", "description": "flag to include job stats in output", - "widget": "checkbox" + "type": "text" } }, "editor": { @@ -34,14 +34,14 @@ "propertyName": "zeppelin.pig.execType", "defaultValue": "mapreduce", "description": "local | mapreduce | tez", - "widget": "string" + "type": "text" }, "zeppelin.pig.maxResult": { "envName": null, "propertyName": "zeppelin.pig.maxResult", "defaultValue": "1000", "description": "max row number for %pig.query", - "widget": "number" + "type": "text" } }, "editor": { diff --git a/python/src/main/resources/interpreter-setting.json b/python/src/main/resources/interpreter-setting.json index 03f9b331791..65d26e3c880 100644 --- a/python/src/main/resources/interpreter-setting.json +++ b/python/src/main/resources/interpreter-setting.json @@ -9,14 +9,14 @@ "propertyName": "zeppelin.python", "defaultValue": "python", "description": "Python directory. It is set to python by default.(assume python is in your $PATH)", - "widget": "string" + "type": "text" }, "zeppelin.python.maxResult": { "envName": null, "propertyName": "zeppelin.python.maxResult", "defaultValue": "1000", "description": "Max number of dataframe rows to display.", - "widget": "number" + "type": "text" } }, "editor": { diff --git a/r/src/main/resources/interpreter-setting.json b/r/src/main/resources/interpreter-setting.json index 5fb8698acfd..94d8e449fcf 100644 --- a/r/src/main/resources/interpreter-setting.json +++ b/r/src/main/resources/interpreter-setting.json @@ -7,22 +7,22 @@ "rhadoop.cmd": { "envName": "HADOOP_CMD", "defaultValue": "", - "widget": "text" + "type": "text" }, "rhadooop.streamingjar": { "envName": "HADOOP_STREAMING", "defaultValue": "", - "widget": "text" + "type": "text" }, "rscala.debug": { "envName": "RSCALA_DEBUG", - "defaultValue": false, - "widget": "checkbox" + "defaultValue": "false", + "type": "text" }, "rscala.timeout": { "envName": "RSCALA_TIMEOUT", "defaultValue": "60", - "widget": "number" + "type": "text" } } }, @@ -34,22 +34,22 @@ "rhadoop.cmd": { "envName": "HADOOP_CMD", "defaultValue": "", - "widget": "text" + "type": "text" }, "rhadooop.streamingjar": { "envName": "HADOOP_STREAMING", "defaultValue": "", - "widget": "text" + "type": "text" }, "rscala.debug": { "envName": "RSCALA_DEBUG", - "defaultValue": false, - "widget": "checkbox" + "defaultValue": "false", + "type": "text" }, "rscala.timeout": { "envName": "RSCALA_TIMEOUT", "defaultValue": "60", - "widget": "number" + "type": "text" } } } diff --git a/scalding/src/main/resources/interpreter-setting.json b/scalding/src/main/resources/interpreter-setting.json index 33458448b0c..4fdb0a22614 100644 --- a/scalding/src/main/resources/interpreter-setting.json +++ b/scalding/src/main/resources/interpreter-setting.json @@ -8,13 +8,13 @@ "envName": null, "defaultValue": "--local --repl", "description": "Arguments for scalding REPL", - "widget": "text" + "type": "text" }, "max.open.instances": { "envName": null, "defaultValue": "50", "description": "Maximum number of open interpreter instances", - "widget": "number" + "type": "text" } } } diff --git a/shell/src/main/resources/interpreter-setting.json b/shell/src/main/resources/interpreter-setting.json index cae496b7415..811b58a27f0 100644 --- a/shell/src/main/resources/interpreter-setting.json +++ b/shell/src/main/resources/interpreter-setting.json @@ -9,28 +9,28 @@ "propertyName": "shell.command.timeout.millisecs", "defaultValue": "60000", "description": "Shell command time out in millisecs. Default = 60000", - "widget": "number" + "type": "text" }, "zeppelin.shell.auth.type": { "envName": null, "propertyName": "zeppelin.shell.auth.type", "defaultValue": "", "description": "If auth type is needed, Example: KERBEROS", - "widget": "string" + "type": "text" }, "zeppelin.shell.keytab.location": { "envName": null, "propertyName": "zeppelin.shell.keytab.location", "defaultValue": "", "description": "Kerberos keytab location", - "widget": "string" + "type": "text" }, "zeppelin.shell.principal": { "envName": null, "propertyName": "zeppelin.shell.principal", "defaultValue": "", "description": "Kerberos principal", - "widget": "string" + "type": "text" } }, "editor": { diff --git a/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java b/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java index d30647b60fa..5a2d241753b 100644 --- a/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java +++ b/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java @@ -55,7 +55,7 @@ import org.apache.zeppelin.interpreter.InterpreterContext; import org.apache.zeppelin.interpreter.InterpreterException; import org.apache.zeppelin.interpreter.InterpreterHookRegistry; -import org.apache.zeppelin.interpreter.InterpreterPropertyWidget; +import org.apache.zeppelin.interpreter.InterpreterPropertyType; import org.apache.zeppelin.interpreter.InterpreterResult; import org.apache.zeppelin.interpreter.InterpreterResult.Code; import org.apache.zeppelin.interpreter.InterpreterUtils; @@ -526,15 +526,14 @@ public SparkContext createSparkContext_1() { } private void setupConfForPySpark(SparkConf conf) { - Object pysparkBaseProperty = - new DefaultInterpreterProperty("SPARK_HOME", null, null, null, - InterpreterPropertyWidget.text).getValue(); - String pysparkBasePath = pysparkBaseProperty != null ? pysparkBaseProperty.toString() : null; + String pysparkBasePath = + new DefaultInterpreterProperty("SPARK_HOME", null, null, null, InterpreterPropertyType.text) + .getValue(); File pysparkPath; if (null == pysparkBasePath) { pysparkBasePath = new DefaultInterpreterProperty("ZEPPELIN_HOME", "zeppelin.home", "../", null, - InterpreterPropertyWidget.text).getValue().toString(); + InterpreterPropertyType.text).getValue(); pysparkPath = new File(pysparkBasePath, "interpreter" + File.separator + "spark" + File.separator + "pyspark"); } else { @@ -579,15 +578,14 @@ private void setupConfForPySpark(SparkConf conf) { } private void setupConfForSparkR(SparkConf conf) { - Object sparkRBaseProperty = + String sparkRBasePath = new DefaultInterpreterProperty("SPARK_HOME", null, null, null, - InterpreterPropertyWidget.text).getValue(); - String sparkRBasePath = sparkRBaseProperty != null ? sparkRBaseProperty.toString() : null; + InterpreterPropertyType.text).getValue(); File sparkRPath; if (null == sparkRBasePath) { sparkRBasePath = new DefaultInterpreterProperty("ZEPPELIN_HOME", "zeppelin.home", "../", null, - InterpreterPropertyWidget.text).getValue().toString(); + InterpreterPropertyType.text).getValue(); sparkRPath = new File(sparkRBasePath, "interpreter" + File.separator + "spark" + File.separator + "R"); } else { diff --git a/spark/src/main/resources/interpreter-setting.json b/spark/src/main/resources/interpreter-setting.json index ab04e5729c1..83671df452a 100644 --- a/spark/src/main/resources/interpreter-setting.json +++ b/spark/src/main/resources/interpreter-setting.json @@ -10,63 +10,63 @@ "propertyName": "spark.executor.memory", "defaultValue": "", "description": "Executor memory per worker instance. ex) 512m, 32g", - "widget": "string" + "type": "text" }, "args": { "envName": null, "propertyName": null, "defaultValue": "", "description": "spark commandline args", - "widget": "text" + "type": "text" }, "zeppelin.spark.useHiveContext": { "envName": "ZEPPELIN_SPARK_USEHIVECONTEXT", "propertyName": "zeppelin.spark.useHiveContext", - "defaultValue": true, + "defaultValue": "true", "description": "Use HiveContext instead of SQLContext if it is true.", - "widget": "checkbox" + "type": "text" }, "spark.app.name": { "envName": "SPARK_APP_NAME", "propertyName": "spark.app.name", "defaultValue": "Zeppelin", "description": "The name of spark application.", - "widget": "string" + "type": "text" }, "zeppelin.spark.printREPLOutput": { "envName": null, - "propertyName": "zeppelin.spark.printREPLOutput", - "defaultValue": true, + "propertyName": null, + "defaultValue": "true", "description": "Print REPL output", - "widget": "checkbox" + "type": "text" }, "spark.cores.max": { "envName": null, "propertyName": "spark.cores.max", "defaultValue": "", "description": "Total number of cores to use. Empty value uses all available core.", - "widget": "number" + "type": "text" }, "zeppelin.spark.maxResult": { "envName": "ZEPPELIN_SPARK_MAXRESULT", "propertyName": "zeppelin.spark.maxResult", "defaultValue": "1000", "description": "Max number of Spark SQL result to display.", - "widget": "number" + "type": "text" }, "master": { "envName": "MASTER", "propertyName": "spark.master", "defaultValue": "local[*]", "description": "Spark master uri. ex) spark://masterhost:7077", - "widget": "string" + "type": "text" }, "zeppelin.spark.unSupportedVersionCheck": { "envName": null, "propertyName": "zeppelin.spark.enableSupportedVersionCheck", - "defaultValue": true, + "defaultValue": "true", "description": "Do not change - developer only setting, not for production use", - "widget": "checkbox" + "type": "text" } }, "editor": { @@ -82,30 +82,30 @@ "zeppelin.spark.concurrentSQL": { "envName": "ZEPPELIN_SPARK_CONCURRENTSQL", "propertyName": "zeppelin.spark.concurrentSQL", - "defaultValue": false, + "defaultValue": "false", "description": "Execute multiple SQL concurrently if set true.", - "widget": "checkbox" + "type": "text" }, "zeppelin.spark.sql.stacktrace": { "envName": "ZEPPELIN_SPARK_SQL_STACKTRACE", "propertyName": "zeppelin.spark.sql.stacktrace", - "defaultValue": false, + "defaultValue": "false", "description": "Show full exception stacktrace for SQL queries if set to true.", - "widget": "checkbox" + "type": "text" }, "zeppelin.spark.maxResult": { "envName": "ZEPPELIN_SPARK_MAXRESULT", "propertyName": "zeppelin.spark.maxResult", "defaultValue": "1000", "description": "Max number of Spark SQL result to display.", - "widget": "number" + "type": "text" }, "zeppelin.spark.importImplicit": { "envName": "ZEPPELIN_SPARK_IMPORTIMPLICIT", "propertyName": "zeppelin.spark.importImplicit", - "defaultValue": true, + "defaultValue": "true", "description": "Import implicits, UDF collection, and sql if set true. true by default.", - "widget": "checkbox" + "type": "text" } }, "editor": { @@ -123,14 +123,14 @@ "propertyName": null, "defaultValue": "local-repo", "description": "local repository for dependency loader", - "widget": "string" + "type": "text" }, "zeppelin.dep.additionalRemoteRepository": { "envName": null, "propertyName": null, "defaultValue": "spark-packages,http://dl.bintray.com/spark-packages/maven,false;", "description": "A list of 'id,remote-repository-URL,is-snapshot;' for each remote repository.", - "widget": "text" + "type": "text" } }, "editor": { @@ -148,7 +148,7 @@ "propertyName": null, "defaultValue": "python", "description": "Python command to run pyspark with", - "widget": "string" + "type": "text" } }, "editor": { diff --git a/spark/src/main/sparkr-resources/interpreter-setting.json b/spark/src/main/sparkr-resources/interpreter-setting.json index d28f75c444f..bb2a64e3093 100644 --- a/spark/src/main/sparkr-resources/interpreter-setting.json +++ b/spark/src/main/sparkr-resources/interpreter-setting.json @@ -10,63 +10,63 @@ "propertyName": "spark.executor.memory", "defaultValue": "", "description": "Executor memory per worker instance. ex) 512m, 32g", - "widget": "string" + "type": "text" }, "args": { "envName": null, "propertyName": null, "defaultValue": "", "description": "spark commandline args", - "widget": "text" + "type": "text" }, "zeppelin.spark.useHiveContext": { "envName": "ZEPPELIN_SPARK_USEHIVECONTEXT", "propertyName": "zeppelin.spark.useHiveContext", - "defaultValue": true, + "defaultValue": "true", "description": "Use HiveContext instead of SQLContext if it is true.", - "widget": "checkbox" + "type": "text" }, "spark.app.name": { "envName": "SPARK_APP_NAME", "propertyName": "spark.app.name", "defaultValue": "Zeppelin", "description": "The name of spark application.", - "widget": "string" + "type": "text" }, "zeppelin.spark.printREPLOutput": { "envName": null, - "propertyName": "zeppelin.spark.printREPLOutput", - "defaultValue": true, + "propertyName": null, + "defaultValue": "true", "description": "Print REPL output", - "widget": "checkbox" + "type": "text" }, "spark.cores.max": { "envName": null, "propertyName": "spark.cores.max", "defaultValue": "", "description": "Total number of cores to use. Empty value uses all available core.", - "widget": "number" + "type": "text" }, "zeppelin.spark.maxResult": { "envName": "ZEPPELIN_SPARK_MAXRESULT", "propertyName": "zeppelin.spark.maxResult", "defaultValue": "1000", "description": "Max number of Spark SQL result to display.", - "widget": "number" + "type": "text" }, "master": { "envName": "MASTER", "propertyName": "spark.master", "defaultValue": "local[*]", "description": "Spark master uri. ex) spark://masterhost:7077", - "widget": "string" + "type": "text" }, "zeppelin.spark.unSupportedVersionCheck": { "envName": null, "propertyName": "zeppelin.spark.enableSupportedVersionCheck", - "defaultValue": true, + "defaultValue": "true", "description": "Do not change - developer only setting, not for production use", - "widget": "checkbox" + "type": "text" } }, "editor": { @@ -81,30 +81,30 @@ "zeppelin.spark.concurrentSQL": { "envName": "ZEPPELIN_SPARK_CONCURRENTSQL", "propertyName": "zeppelin.spark.concurrentSQL", - "defaultValue": false, + "defaultValue": "false", "description": "Execute multiple SQL concurrently if set true.", - "widget": "checkbox" + "type": "text" }, "zeppelin.spark.sql.stacktrace": { "envName": "ZEPPELIN_SPARK_SQL_STACKTRACE", "propertyName": "zeppelin.spark.sql.stacktrace", - "defaultValue": false, + "defaultValue": "false", "description": "Show full exception stacktrace for SQL queries if set to true.", - "widget": "checkbox" + "type": "text" }, "zeppelin.spark.maxResult": { "envName": "ZEPPELIN_SPARK_MAXRESULT", "propertyName": "zeppelin.spark.maxResult", "defaultValue": "1000", "description": "Max number of Spark SQL result to display.", - "widget": "number" + "type": "text" }, "zeppelin.spark.importImplicit": { "envName": "ZEPPELIN_SPARK_IMPORTIMPLICIT", "propertyName": "zeppelin.spark.importImplicit", - "defaultValue": true, + "defaultValue": "true", "description": "Import implicits, UDF collection, and sql if set true. true by default.", - "widget": "checkbox" + "type": "text" } }, "editor": { @@ -121,14 +121,14 @@ "propertyName": null, "defaultValue": "local-repo", "description": "local repository for dependency loader", - "widget": "string" + "type": "text" }, "zeppelin.dep.additionalRemoteRepository": { "envName": null, "propertyName": null, "defaultValue": "spark-packages,http://dl.bintray.com/spark-packages/maven,false;", "description": "A list of 'id,remote-repository-URL,is-snapshot;' for each remote repository.", - "widget": "text" + "type": "text" } }, "editor": { @@ -145,7 +145,7 @@ "propertyName": null, "defaultValue": "python", "description": "Python command to run pyspark with", - "widget": "string" + "type": "text" } }, "editor": { @@ -160,30 +160,30 @@ "zeppelin.R.knitr": { "envName": "ZEPPELIN_R_KNITR", "propertyName": "zeppelin.R.knitr", - "defaultValue": true, + "defaultValue": "true", "description": "whether use knitr or not", - "widget": "checkbox" + "type": "text" }, "zeppelin.R.cmd": { "envName": "ZEPPELIN_R_CMD", "propertyName": "zeppelin.R.cmd", "defaultValue": "R", "description": "R repl path", - "widget": "string" + "type": "text" }, "zeppelin.R.image.width": { "envName": "ZEPPELIN_R_IMAGE_WIDTH", "propertyName": "zeppelin.R.image.width", "defaultValue": "100%", "description": "", - "widget": "number" + "type": "text" }, "zeppelin.R.render.options": { "envName": "ZEPPELIN_R_RENDER_OPTIONS", "propertyName": "zeppelin.R.render.options", "defaultValue": "out.format = 'html', comment = NA, echo = FALSE, results = 'asis', message = F, warning = F", "description": "", - "widget": "text" + "type": "text" } }, "editor": { diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/DefaultInterpreterProperty.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/DefaultInterpreterProperty.java index 89df8c0f82c..4230322b256 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/DefaultInterpreterProperty.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/DefaultInterpreterProperty.java @@ -23,22 +23,22 @@ public class DefaultInterpreterProperty { String envName; String propertyName; - Object defaultValue; + String defaultValue; String description; - InterpreterPropertyWidget widget; + InterpreterPropertyType type; - public DefaultInterpreterProperty(String envName, String propertyName, Object defaultValue, - String description, InterpreterPropertyWidget widget) { + public DefaultInterpreterProperty(String envName, String propertyName, String defaultValue, + String description, InterpreterPropertyType type) { this.envName = envName; this.propertyName = propertyName; this.defaultValue = defaultValue; this.description = description; - this.widget = widget; + this.type = type; } - public DefaultInterpreterProperty(Object defaultValue, String description, - InterpreterPropertyWidget widget) { - this(null, null, defaultValue, description, widget); + public DefaultInterpreterProperty(String defaultValue, String description, + InterpreterPropertyType type) { + this(null, null, defaultValue, description, type); } public String getEnvName() { @@ -57,11 +57,11 @@ public void setPropertyName(String propertyName) { this.propertyName = propertyName; } - public Object getDefaultValue() { + public String getDefaultValue() { return defaultValue; } - public void setDefaultValue(Object defaultValue) { + public void setDefaultValue(String defaultValue) { this.defaultValue = defaultValue; } @@ -73,12 +73,12 @@ public void setDescription(String description) { this.description = description; } - public InterpreterPropertyWidget getWidget() { - return widget; + public InterpreterPropertyType getType() { + return type; } - public void setWidget(InterpreterPropertyWidget widget) { - this.widget = widget; + public void setType(InterpreterPropertyType type) { + this.type = type; } public int hashCode() { @@ -90,7 +90,7 @@ public boolean equals(Object o) { return this.toString().equals(o.toString()); } - public Object getValue() { + public String getValue() { if (envName != null && !envName.isEmpty()) { String envValue = System.getenv().get(envName); if (envValue != null) { @@ -110,6 +110,6 @@ public Object getValue() { @Override public String toString() { return String.format("{envName=%s, propertyName=%s, defaultValue=%s, description=%20s, " + - "type=%s}", envName, propertyName, defaultValue, description, widget); + "type=%s}", envName, propertyName, defaultValue, description, type); } } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java index 2525d6bb2e6..0be0cbe5171 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java @@ -22,13 +22,13 @@ */ public class InterpreterProperty { private String name; - private Object value; - private InterpreterPropertyWidget widget; + private String value; + private InterpreterPropertyType type; - public InterpreterProperty(String name, Object value, InterpreterPropertyWidget widget) { + public InterpreterProperty(String name, String value, InterpreterPropertyType type) { this.name = name; this.value = value; - this.widget = widget; + this.type = type; } public String getName() { @@ -39,19 +39,19 @@ public void setName(String name) { this.name = name; } - public Object getValue() { + public String getValue() { return value; } - public void setValue(Object value) { + public void setValue(String value) { this.value = value; } - public InterpreterPropertyWidget getWidget() { - return widget; + public InterpreterPropertyType getType() { + return type; } - public void setWidget(InterpreterPropertyWidget widget) { - this.widget = widget; + public void setType(InterpreterPropertyType type) { + this.type = type; } } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java index 9baef948e54..3f9e2ca6a58 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java @@ -28,7 +28,7 @@ public class InterpreterPropertyBuilder { public InterpreterPropertyBuilder add(String name, String defaultValue, String description){ properties.put(name, - new DefaultInterpreterProperty(defaultValue, description, InterpreterPropertyWidget.text)); + new DefaultInterpreterProperty(defaultValue, description, InterpreterPropertyType.text)); return this; } @@ -36,7 +36,7 @@ public InterpreterPropertyBuilder add(String name, String envName, String proper String defaultValue, String description){ properties.put(name, new DefaultInterpreterProperty(envName, propertyName, defaultValue, description, - InterpreterPropertyWidget.text)); + InterpreterPropertyType.text)); return this; } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java new file mode 100644 index 00000000000..27763d3865f --- /dev/null +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.zeppelin.interpreter; + +/** + * Types of interpreter properties + */ +public enum InterpreterPropertyType { + text, + password +} diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java index 25e85812455..46c363e0eb4 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java @@ -21,6 +21,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Properties; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.DELETE; @@ -36,7 +37,7 @@ import com.google.gson.Gson; import org.apache.commons.lang.exception.ExceptionUtils; -import org.apache.zeppelin.interpreter.InterpreterPropertyWidget; +import org.apache.zeppelin.interpreter.InterpreterPropertyType; import org.apache.zeppelin.interpreter.InterpreterSettingManager; import org.apache.zeppelin.rest.message.RestartInterpreterRequest; import org.apache.zeppelin.utils.SecurityUtils; @@ -295,11 +296,11 @@ public Response removeRepository(@PathParam("repoId") String repoId) { } /** - * Get available widgets for property + * Get available types for property */ @GET - @Path("property/widgets") - public Response listInterpreterPropertyWidgets() { - return new JsonResponse<>(Status.OK, InterpreterPropertyWidget.values()).build(); + @Path("property/types") + public Response listInterpreterPropertyTypes() { + return new JsonResponse<>(Status.OK, InterpreterPropertyType.values()).build(); } } diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java index 0b0c0189055..acdb8610d62 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java @@ -45,7 +45,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.interpreter.InterpreterProperty; -import org.apache.zeppelin.interpreter.InterpreterPropertyWidget; +import org.apache.zeppelin.interpreter.InterpreterPropertyType; import org.apache.zeppelin.interpreter.InterpreterSetting; import org.apache.zeppelin.server.ZeppelinServer; import org.hamcrest.Description; @@ -205,14 +205,14 @@ private static void start(boolean withAuth) throws Exception { if ("true".equals(System.getenv("CI"))) { // set spark master and other properties sparkProperties.put("master", - new InterpreterProperty("master", "local[2]", InterpreterPropertyWidget.text)); + new InterpreterProperty("master", "local[2]", InterpreterPropertyType.text)); sparkProperties.put("spark.cores.max", - new InterpreterProperty("spark.cores.max", "2", InterpreterPropertyWidget.text)); + new InterpreterProperty("spark.cores.max", "2", InterpreterPropertyType.text)); sparkProperties.put("zeppelin.spark.useHiveContext", - new InterpreterProperty("zeppelin.spark.useHiveContext", false, InterpreterPropertyWidget.checkbox)); + new InterpreterProperty("zeppelin.spark.useHiveContext", "false", InterpreterPropertyType.text)); // set spark home for pyspark sparkProperties.put("spark.home", - new InterpreterProperty("spark.home", getSparkHome(), InterpreterPropertyWidget.text)); + new InterpreterProperty("spark.home", getSparkHome(), InterpreterPropertyType.text)); sparkIntpSetting.setProperties(sparkProperties); pySpark = true; @@ -223,18 +223,18 @@ private static void start(boolean withAuth) throws Exception { if (sparkHome != null) { if (System.getenv("SPARK_MASTER") != null) { sparkProperties.put("master", - new InterpreterProperty("master", System.getenv("SPARK_MASTER"), InterpreterPropertyWidget.text)); + new InterpreterProperty("master", System.getenv("SPARK_MASTER"), InterpreterPropertyType.text)); } else { sparkProperties.put("master", - new InterpreterProperty("master", "local[2]", InterpreterPropertyWidget.text)); + new InterpreterProperty("master", "local[2]", InterpreterPropertyType.text)); } sparkProperties.put("spark.cores.max", - new InterpreterProperty("spark.cores.max", "2", InterpreterPropertyWidget.text)); + new InterpreterProperty("spark.cores.max", "2", InterpreterPropertyType.text)); // set spark home for pyspark sparkProperties.put("spark.home", - new InterpreterProperty("spark.home", sparkHome, InterpreterPropertyWidget.text)); + new InterpreterProperty("spark.home", sparkHome, InterpreterPropertyType.text)); sparkProperties.put("zeppelin.spark.useHiveContext", - new InterpreterProperty("zeppelin.spark.useHiveContext", false, InterpreterPropertyWidget.checkbox)); + new InterpreterProperty("zeppelin.spark.useHiveContext", "false", InterpreterPropertyType.text)); pySpark = true; sparkR = true; } diff --git a/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html b/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html index 9ab9ca57173..4fd49729c82 100644 --- a/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html +++ b/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html @@ -272,26 +272,27 @@
Properties
- + + - + @@ -299,22 +300,20 @@
Properties
- + + -
DescriptionThis ```GET``` method returns available widgets for interpreter property.This ```GET``` method returns available types for interpreter property.
URL```http://[zeppelin-server]:[zeppelin-port]/api/interpreter/property/widgets``````http://[zeppelin-server]:[zeppelin-port]/api/interpreter/property/types```
Success code
name valueactiontype descriptionaction
{{key}} + - - - - - + {{newInterpreterSetting.properties[key].description}} + +
+ - - - - - +
diff --git a/zeppelin-web/src/app/interpreter/interpreter.controller.js b/zeppelin-web/src/app/interpreter/interpreter.controller.js index 330c2adadf0..99fe88823a5 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.controller.js +++ b/zeppelin-web/src/app/interpreter/interpreter.controller.js @@ -12,52 +12,53 @@ * limitations under the License. */ -import { ParagraphStatus, } from '../notebook/paragraph/paragraph.status' +import { ParagraphStatus, } from '../notebook/paragraph/paragraph.status'; -angular.module('zeppelinWebApp').controller('InterpreterCtrl', InterpreterCtrl) +angular.module('zeppelinWebApp').controller('InterpreterCtrl', InterpreterCtrl); -function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeout, $route) { - 'ngInject' +function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeout, $route) { + 'ngInject'; - let interpreterSettingsTmp = [] - $scope.interpreterSettings = [] - $scope.availableInterpreters = {} - $scope.showAddNewSetting = false - $scope.showRepositoryInfo = false - $scope.searchInterpreter = '' - $scope._ = _ - ngToast.dismiss() + var interpreterSettingsTmp = []; + $scope.interpreterSettings = []; + $scope.availableInterpreters = {}; + $scope.showAddNewSetting = false; + $scope.showRepositoryInfo = false; + $scope.searchInterpreter = ''; + $scope._ = _; + $scope.interpreterPropertyTypes = []; + ngToast.dismiss(); - $scope.openPermissions = function () { - $scope.showInterpreterAuth = true - } + $scope.openPermissions = function() { + $scope.showInterpreterAuth = true; + }; - $scope.closePermissions = function () { - $scope.showInterpreterAuth = false - } + $scope.closePermissions = function() { + $scope.showInterpreterAuth = false; + }; - let getSelectJson = function () { - let selectJson = { + var getSelectJson = function() { + var selectJson = { tags: false, multiple: true, tokenSeparators: [',', ' '], minimumInputLength: 2, ajax: { - url: function (params) { + url: function(params) { if (!params.term) { - return false + return false; } - return baseUrlSrv.getRestApiBase() + '/security/userlist/' + params.term + return baseUrlSrv.getRestApiBase() + '/security/userlist/' + params.term; }, delay: 250, - processResults: function (data, params) { - let users = [] + processResults: function(data, params) { + var users = []; if (data.body.users.length !== 0) { - for (let i = 0; i < data.body.users.length; i++) { + for (var i = 0; i < data.body.users.length; i++) { users.push({ 'id': data.body.users[i], 'text': data.body.users[i] - }) + }); } } return { @@ -65,389 +66,398 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo pagination: { more: false } - } + }; }, cache: false } - } - return selectJson - } + }; + return selectJson; + }; - $scope.togglePermissions = function (intpName) { - angular.element('#' + intpName + 'Users').select2(getSelectJson()) + $scope.togglePermissions = function(intpName) { + angular.element('#' + intpName + 'Users').select2(getSelectJson()); if ($scope.showInterpreterAuth) { - $scope.closePermissions() + $scope.closePermissions(); } else { - $scope.openPermissions() + $scope.openPermissions(); } - } + }; - $scope.$on('ngRenderFinished', function (event, data) { - for (let setting = 0; setting < $scope.interpreterSettings.length; setting++) { - angular.element('#' + $scope.interpreterSettings[setting].name + 'Users').select2(getSelectJson()) + $scope.$on('ngRenderFinished', function(event, data) { + for (var setting = 0; setting < $scope.interpreterSettings.length; setting++) { + angular.element('#' + $scope.interpreterSettings[setting].name + 'Users').select2(getSelectJson()); } - }) + }); - let getInterpreterSettings = function () { + var getInterpreterSettings = function() { $http.get(baseUrlSrv.getRestApiBase() + '/interpreter/setting') - .success(function (data, status, headers, config) { - $scope.interpreterSettings = data.body - checkDownloadingDependencies() - }).error(function (data, status, headers, config) { - if (status === 401) { - ngToast.danger({ - content: 'You don\'t have permission on this page', - verticalPosition: 'bottom', - timeout: '3000' - }) - setTimeout(function () { - window.location.replace('/') - }, 3000) - } - console.log('Error %o %o', status, data.message) - }) - } - - const checkDownloadingDependencies = function () { - let isDownloading = false - for (let index = 0; index < $scope.interpreterSettings.length; index++) { - let setting = $scope.interpreterSettings[index] + .success(function(data, status, headers, config) { + $scope.interpreterSettings = data.body; + checkDownloadingDependencies(); + }).error(function(data, status, headers, config) { + if (status === 401) { + ngToast.danger({ + content: 'You don\'t have permission on this page', + verticalPosition: 'bottom', + timeout: '3000' + }); + setTimeout(function() { + window.location.replace('/'); + }, 3000); + } + console.log('Error %o %o', status, data.message); + }); + }; + + var checkDownloadingDependencies = function() { + var isDownloading = false; + for (var index = 0; index < $scope.interpreterSettings.length; index++) { + var setting = $scope.interpreterSettings[index]; if (setting.status === 'DOWNLOADING_DEPENDENCIES') { - isDownloading = true + isDownloading = true; } if (setting.status === ParagraphStatus.ERROR || setting.errorReason) { ngToast.danger({content: 'Error setting properties for interpreter \'' + setting.group + '.' + setting.name + '\': ' + setting.errorReason, - verticalPosition: 'top', - dismissOnTimeout: false - }) + verticalPosition: 'top', dismissOnTimeout: false}); } } if (isDownloading) { - $timeout(function () { + $timeout(function() { if ($route.current.$$route.originalPath === '/interpreter') { - getInterpreterSettings() + getInterpreterSettings(); } - }, 2000) + }, 2000); } - } - - let getAvailableInterpreters = function () { - $http.get(baseUrlSrv.getRestApiBase() + '/interpreter').success(function (data, status, headers, config) { - $scope.availableInterpreters = data.body - }).error(function (data, status, headers, config) { - console.log('Error %o %o', status, data.message) - }) - } - - let emptyNewProperty = function (object) { - angular.extend(object, {propertyValue: '', propertyKey: ''}) - } - - let emptyNewDependency = function (object) { - angular.extend(object, {depArtifact: '', depExclude: ''}) - } - - let removeTMPSettings = function (index) { - interpreterSettingsTmp.splice(index, 1) - } - - $scope.copyOriginInterpreterSettingProperties = function (settingId) { - let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) - interpreterSettingsTmp[index] = angular.copy($scope.interpreterSettings[index]) - } - - $scope.setPerNoteOption = function (settingId, sessionOption) { - let option + }; + + var getAvailableInterpreters = function() { + $http.get(baseUrlSrv.getRestApiBase() + '/interpreter').success(function(data, status, headers, config) { + $scope.availableInterpreters = data.body; + }).error(function(data, status, headers, config) { + console.log('Error %o %o', status, data.message); + }); + }; + + var getAvailableInterpreterPropertyTypes = function () { + $http.get(baseUrlSrv.getRestApiBase() + '/interpreter/property/types') + .success(function (data, status, headers, config) { + $scope.interpreterPropertyTypes = data.body; + }).error(function (data, status, headers, config) { + console.log('Error %o %o', status, data.message); + }); + }; + + var emptyNewProperty = function(object) { + angular.extend(object, {propertyValue: '', propertyKey: '', propertyType: $scope.interpreterPropertyTypes[0]}); + }; + + var emptyNewDependency = function(object) { + angular.extend(object, {depArtifact: '', depExclude: ''}); + }; + + var removeTMPSettings = function(index) { + interpreterSettingsTmp.splice(index, 1); + }; + + $scope.copyOriginInterpreterSettingProperties = function(settingId) { + var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); + interpreterSettingsTmp[index] = angular.copy($scope.interpreterSettings[index]); + }; + + $scope.setPerNoteOption = function(settingId, sessionOption) { + var option; if (settingId === undefined) { - option = $scope.newInterpreterSetting.option + option = $scope.newInterpreterSetting.option; } else { - let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) - let setting = $scope.interpreterSettings[index] - option = setting.option + var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); + var setting = $scope.interpreterSettings[index]; + option = setting.option; } if (sessionOption === 'isolated') { - option.perNote = sessionOption - option.session = false - option.process = true + option.perNote = sessionOption; + option.session = false; + option.process = true; } else if (sessionOption === 'scoped') { - option.perNote = sessionOption - option.session = true - option.process = false + option.perNote = sessionOption; + option.session = true; + option.process = false; } else { - option.perNote = 'shared' - option.session = false - option.process = false + option.perNote = 'shared'; + option.session = false; + option.process = false; } - } + }; - $scope.setPerUserOption = function (settingId, sessionOption) { - let option + $scope.setPerUserOption = function(settingId, sessionOption) { + var option; if (settingId === undefined) { - option = $scope.newInterpreterSetting.option + option = $scope.newInterpreterSetting.option; } else { - let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) - let setting = $scope.interpreterSettings[index] - option = setting.option + var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); + var setting = $scope.interpreterSettings[index]; + option = setting.option; } if (sessionOption === 'isolated') { - option.perUser = sessionOption - option.session = false - option.process = true + option.perUser = sessionOption; + option.session = false; + option.process = true; } else if (sessionOption === 'scoped') { - option.perUser = sessionOption - option.session = true - option.process = false + option.perUser = sessionOption; + option.session = true; + option.process = false; } else { - option.perUser = 'shared' - option.session = false - option.process = false + option.perUser = 'shared'; + option.session = false; + option.process = false; } - } + }; - $scope.getPerNoteOption = function (settingId) { - let option + $scope.getPerNoteOption = function(settingId) { + var option; if (settingId === undefined) { - option = $scope.newInterpreterSetting.option + option = $scope.newInterpreterSetting.option; } else { - let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) - let setting = $scope.interpreterSettings[index] - option = setting.option + var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); + var setting = $scope.interpreterSettings[index]; + option = setting.option; } if (option.perNote === 'scoped') { - return 'scoped' + return 'scoped'; } else if (option.perNote === 'isolated') { - return 'isolated' + return 'isolated'; } else { - return 'shared' + return 'shared'; } - } + }; - $scope.getPerUserOption = function (settingId) { - let option + $scope.getPerUserOption = function(settingId) { + var option; if (settingId === undefined) { - option = $scope.newInterpreterSetting.option + option = $scope.newInterpreterSetting.option; } else { - let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) - let setting = $scope.interpreterSettings[index] - option = setting.option + var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); + var setting = $scope.interpreterSettings[index]; + option = setting.option; } if (option.perUser === 'scoped') { - return 'scoped' + return 'scoped'; } else if (option.perUser === 'isolated') { - return 'isolated' + return 'isolated'; } else { - return 'shared' + return 'shared'; } - } + }; - $scope.getInterpreterRunningOption = function (settingId) { - let sharedModeName = 'shared' + $scope.getInterpreterRunningOption = function(settingId) { + var sharedModeName = 'shared'; - let globallyModeName = 'Globally' - let perNoteModeName = 'Per Note' - let perUserModeName = 'Per User' + var globallyModeName = 'Globally'; + var perNoteModeName = 'Per Note'; + var perUserModeName = 'Per User'; - let option + var option; if (settingId === undefined) { - option = $scope.newInterpreterSetting.option + option = $scope.newInterpreterSetting.option; } else { - let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) - let setting = $scope.interpreterSettings[index] - option = setting.option + var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); + var setting = $scope.interpreterSettings[index]; + option = setting.option; } - let perNote = option.perNote - let perUser = option.perUser + var perNote = option.perNote; + var perUser = option.perUser; // Globally == shared_perNote + shared_perUser if (perNote === sharedModeName && perUser === sharedModeName) { - return globallyModeName + return globallyModeName; } if ($rootScope.ticket.ticket === 'anonymous' && $rootScope.ticket.roles === '[]') { if (perNote !== undefined && typeof perNote === 'string' && perNote !== '') { - return perNoteModeName + return perNoteModeName; } } else if ($rootScope.ticket.ticket !== 'anonymous') { if (perNote !== undefined && typeof perNote === 'string' && perNote !== '') { if (perUser !== undefined && typeof perUser === 'string' && perUser !== '') { - return perUserModeName + return perUserModeName; } - return perNoteModeName + return perNoteModeName; } } - option.perNote = sharedModeName - option.perUser = sharedModeName - return globallyModeName - } + option.perNote = sharedModeName; + option.perUser = sharedModeName; + return globallyModeName; + }; - $scope.setInterpreterRunningOption = function (settingId, isPerNoteMode, isPerUserMode) { - let option + $scope.setInterpreterRunningOption = function(settingId, isPerNoteMode, isPerUserMode) { + var option; if (settingId === undefined) { - option = $scope.newInterpreterSetting.option + option = $scope.newInterpreterSetting.option; } else { - let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) - let setting = $scope.interpreterSettings[index] - option = setting.option + var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); + var setting = $scope.interpreterSettings[index]; + option = setting.option; } - option.perNote = isPerNoteMode - option.perUser = isPerUserMode - } + option.perNote = isPerNoteMode; + option.perUser = isPerUserMode; + }; - $scope.updateInterpreterSetting = function (form, settingId) { - const thisConfirm = BootstrapDialog.confirm({ + $scope.updateInterpreterSetting = function(form, settingId) { + var thisConfirm = BootstrapDialog.confirm({ closable: false, closeByBackdrop: false, closeByKeyboard: false, title: '', message: 'Do you want to update this interpreter and restart with new settings?', - callback: function (result) { + callback: function(result) { if (result) { - let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) - let setting = $scope.interpreterSettings[index] + var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); + var setting = $scope.interpreterSettings[index]; if (setting.propertyKey !== '' || setting.propertyKey) { - $scope.addNewInterpreterProperty(settingId) + $scope.addNewInterpreterProperty(settingId); } if (setting.depArtifact !== '' || setting.depArtifact) { - $scope.addNewInterpreterDependency(settingId) + $scope.addNewInterpreterDependency(settingId); } // add missing field of option if (!setting.option) { - setting.option = {} + setting.option = {}; } if (setting.option.isExistingProcess === undefined) { - setting.option.isExistingProcess = false + setting.option.isExistingProcess = false; } if (setting.option.setPermission === undefined) { - setting.option.setPermission = false + setting.option.setPermission = false; } if (setting.option.isUserImpersonate === undefined) { - setting.option.isUserImpersonate = false + setting.option.isUserImpersonate = false; } if (!($scope.getInterpreterRunningOption(settingId) === 'Per User' && $scope.getPerUserOption(settingId) === 'isolated')) { - setting.option.isUserImpersonate = false + setting.option.isUserImpersonate = false; } if (setting.option.remote === undefined) { // remote always true for now - setting.option.remote = true + setting.option.remote = true; } - setting.option.users = angular.element('#' + setting.name + 'Users').val() + setting.option.users = angular.element('#' + setting.name + 'Users').val(); - let request = { + var request = { option: angular.copy(setting.option), properties: angular.copy(setting.properties), dependencies: angular.copy(setting.dependencies) - } + }; - thisConfirm.$modalFooter.find('button').addClass('disabled') + thisConfirm.$modalFooter.find('button').addClass('disabled'); thisConfirm.$modalFooter.find('button:contains("OK")') - .html(' Saving Setting') + .html(' Saving Setting'); $http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/' + settingId, request) - .success(function (data, status, headers, config) { - $scope.interpreterSettings[index] = data.body - removeTMPSettings(index) - checkDownloadingDependencies() - thisConfirm.close() - }) - .error(function (data, status, headers, config) { - console.log('Error %o %o', status, data.message) - ngToast.danger({content: data.message, verticalPosition: 'bottom'}) - form.$show() - thisConfirm.close() + .success(function(data, status, headers, config) { + $scope.interpreterSettings[index] = data.body; + removeTMPSettings(index); + checkDownloadingDependencies(); + thisConfirm.close(); }) - return false + .error(function(data, status, headers, config) { + console.log('Error %o %o', status, data.message); + ngToast.danger({content: data.message, verticalPosition: 'bottom'}); + form.$show(); + thisConfirm.close(); + }); + return false; } else { - form.$show() + form.$show(); } } - }) - } + }); + }; - $scope.resetInterpreterSetting = function (settingId) { - let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) + $scope.resetInterpreterSetting = function(settingId) { + var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); // Set the old settings back - $scope.interpreterSettings[index] = angular.copy(interpreterSettingsTmp[index]) - removeTMPSettings(index) - } + $scope.interpreterSettings[index] = angular.copy(interpreterSettingsTmp[index]); + removeTMPSettings(index); + }; - $scope.removeInterpreterSetting = function (settingId) { + $scope.removeInterpreterSetting = function(settingId) { BootstrapDialog.confirm({ closable: true, title: '', message: 'Do you want to delete this interpreter setting?', - callback: function (result) { + callback: function(result) { if (result) { $http.delete(baseUrlSrv.getRestApiBase() + '/interpreter/setting/' + settingId) - .success(function (data, status, headers, config) { - let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) - $scope.interpreterSettings.splice(index, 1) - }).error(function (data, status, headers, config) { - console.log('Error %o %o', status, data.message) - }) + .success(function(data, status, headers, config) { + + var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); + $scope.interpreterSettings.splice(index, 1); + }).error(function(data, status, headers, config) { + console.log('Error %o %o', status, data.message); + }); } } - }) - } - - $scope.newInterpreterGroupChange = function () { - let el = _.pluck(_.filter($scope.availableInterpreters, {'name': $scope.newInterpreterSetting.group}), - 'properties') - let properties = {} - for (let i = 0; i < el.length; i++) { - let intpInfo = el[i] - for (let key in intpInfo) { + }); + }; + + $scope.newInterpreterGroupChange = function() { + var el = _.pluck(_.filter($scope.availableInterpreters, {'name': $scope.newInterpreterSetting.group}), + 'properties'); + var properties = {}; + for (var i = 0; i < el.length; i++) { + var intpInfo = el[i]; + for (var key in intpInfo) { properties[key] = { value: intpInfo[key].defaultValue, - description: intpInfo[key].description - } + description: intpInfo[key].description, + type: intpInfo[key].type + }; } } - $scope.newInterpreterSetting.properties = properties - } + $scope.newInterpreterSetting.properties = properties; + }; - $scope.restartInterpreterSetting = function (settingId) { + $scope.restartInterpreterSetting = function(settingId) { BootstrapDialog.confirm({ closable: true, title: '', message: 'Do you want to restart this interpreter?', - callback: function (result) { + callback: function(result) { if (result) { $http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/restart/' + settingId) - .success(function (data, status, headers, config) { - let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) - $scope.interpreterSettings[index] = data.body - ngToast.info('Interpreter stopped. Will be lazily started on next run.') - }).error(function (data, status, headers, config) { - let errorMsg = (data !== null) ? data.message : 'Could not connect to server.' - console.log('Error %o %o', status, errorMsg) - ngToast.danger(errorMsg) - }) + .success(function(data, status, headers, config) { + var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); + $scope.interpreterSettings[index] = data.body; + ngToast.info('Interpreter stopped. Will be lazily started on next run.'); + }).error(function(data, status, headers, config) { + var errorMsg = (data !== null) ? data.message : 'Could not connect to server.'; + console.log('Error %o %o', status, errorMsg); + ngToast.danger(errorMsg); + }); } } - }) - } + }); + }; - $scope.addNewInterpreterSetting = function () { - // user input validation on interpreter creation + $scope.addNewInterpreterSetting = function() { + //user input validation on interpreter creation if (!$scope.newInterpreterSetting.name || !$scope.newInterpreterSetting.name.trim() || !$scope.newInterpreterSetting.group) { BootstrapDialog.alert({ closable: true, title: 'Add interpreter', message: 'Please fill in interpreter name and choose a group' - }) - return + }); + return; } if ($scope.newInterpreterSetting.name.indexOf('.') >= 0) { @@ -455,8 +465,8 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo closable: true, title: 'Add interpreter', message: '\'.\' is invalid for interpreter name' - }) - return + }); + return; } if (_.findIndex($scope.interpreterSettings, {'name': $scope.newInterpreterSetting.name}) >= 0) { @@ -464,49 +474,51 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo closable: true, title: 'Add interpreter', message: 'Name ' + $scope.newInterpreterSetting.name + ' already exists' - }) - return + }); + return; } - let newSetting = $scope.newInterpreterSetting + var newSetting = $scope.newInterpreterSetting; if (newSetting.propertyKey !== '' || newSetting.propertyKey) { - $scope.addNewInterpreterProperty() + $scope.addNewInterpreterProperty(); } if (newSetting.depArtifact !== '' || newSetting.depArtifact) { - $scope.addNewInterpreterDependency() + $scope.addNewInterpreterDependency(); } if (newSetting.option.setPermission === undefined) { - newSetting.option.setPermission = false + newSetting.option.setPermission = false; } - newSetting.option.users = angular.element('#newInterpreterUsers').val() + newSetting.option.users = angular.element('#newInterpreterUsers').val(); - let request = angular.copy($scope.newInterpreterSetting) + var request = angular.copy($scope.newInterpreterSetting); // Change properties to proper request format - let newProperties = {} - for (let p in newSetting.properties) { - newProperties[p] = newSetting.properties[p].value - } - request.properties = newProperties + var newProperties = {}; - $http.post(baseUrlSrv.getRestApiBase() + '/interpreter/setting', request) - .success(function (data, status, headers, config) { - $scope.resetNewInterpreterSetting() - getInterpreterSettings() - $scope.showAddNewSetting = false - checkDownloadingDependencies() - }).error(function (data, status, headers, config) { - console.log('Error %o %o', status, data.message) - ngToast.danger({content: data.message, verticalPosition: 'bottom'}) - }) - } + for (var p in newSetting.properties) { + newProperties[p] = {value: newSetting.properties[p].value, type: newSetting.properties[p].type, name: p}; + } - $scope.cancelInterpreterSetting = function () { - $scope.showAddNewSetting = false - $scope.resetNewInterpreterSetting() - } + request.properties = newProperties; - $scope.resetNewInterpreterSetting = function () { + $http.post(baseUrlSrv.getRestApiBase() + '/interpreter/setting', request) + .success(function(data, status, headers, config) { + $scope.resetNewInterpreterSetting(); + getInterpreterSettings(); + $scope.showAddNewSetting = false; + checkDownloadingDependencies(); + }).error(function(data, status, headers, config) { + console.log('Error %o %o', status, data.message); + ngToast.danger({content: data.message, verticalPosition: 'bottom'}); + }); + }; + + $scope.cancelInterpreterSetting = function() { + $scope.showAddNewSetting = false; + $scope.resetNewInterpreterSetting(); + }; + + $scope.resetNewInterpreterSetting = function() { $scope.newInterpreterSetting = { name: undefined, group: undefined, @@ -520,110 +532,113 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo process: false } - } - emptyNewProperty($scope.newInterpreterSetting) - } + }; + emptyNewProperty($scope.newInterpreterSetting); + }; - $scope.removeInterpreterProperty = function (key, settingId) { + $scope.removeInterpreterProperty = function(key, settingId) { if (settingId === undefined) { - delete $scope.newInterpreterSetting.properties[key] + delete $scope.newInterpreterSetting.properties[key]; } else { - let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) - delete $scope.interpreterSettings[index].properties[key] + var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); + delete $scope.interpreterSettings[index].properties[key]; } - } + }; - $scope.removeInterpreterDependency = function (artifact, settingId) { + $scope.removeInterpreterDependency = function(artifact, settingId) { if (settingId === undefined) { $scope.newInterpreterSetting.dependencies = _.reject($scope.newInterpreterSetting.dependencies, - function (el) { - return el.groupArtifactVersion === artifact - }) + function(el) { + return el.groupArtifactVersion === artifact; + }); } else { - let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) + var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); $scope.interpreterSettings[index].dependencies = _.reject($scope.interpreterSettings[index].dependencies, - function (el) { - return el.groupArtifactVersion === artifact - }) + function(el) { + return el.groupArtifactVersion === artifact; + }); } - } + }; - $scope.addNewInterpreterProperty = function (settingId) { + $scope.addNewInterpreterProperty = function(settingId) { if (settingId === undefined) { // Add new property from create form if (!$scope.newInterpreterSetting.propertyKey || $scope.newInterpreterSetting.propertyKey === '') { - return + return; } $scope.newInterpreterSetting.properties[$scope.newInterpreterSetting.propertyKey] = { - value: $scope.newInterpreterSetting.propertyValue - } - emptyNewProperty($scope.newInterpreterSetting) + value: $scope.newInterpreterSetting.propertyValue, + type: $scope.newInterpreterSetting.propertyType + }; + emptyNewProperty($scope.newInterpreterSetting); } else { // Add new property from edit form - let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) - let setting = $scope.interpreterSettings[index] + var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); + var setting = $scope.interpreterSettings[index]; if (!setting.propertyKey || setting.propertyKey === '') { - return + return; } - setting.properties[setting.propertyKey] = setting.propertyValue - emptyNewProperty(setting) + + setting.properties[setting.propertyKey] = {value: setting.propertyValue, type: setting.propertyType}; + + emptyNewProperty(setting); } - } + }; - $scope.addNewInterpreterDependency = function (settingId) { + $scope.addNewInterpreterDependency = function(settingId) { if (settingId === undefined) { // Add new dependency from create form if (!$scope.newInterpreterSetting.depArtifact || $scope.newInterpreterSetting.depArtifact === '') { - return + return; } // overwrite if artifact already exists - let newSetting = $scope.newInterpreterSetting - for (let d in newSetting.dependencies) { + var newSetting = $scope.newInterpreterSetting; + for (var d in newSetting.dependencies) { if (newSetting.dependencies[d].groupArtifactVersion === newSetting.depArtifact) { newSetting.dependencies[d] = { 'groupArtifactVersion': newSetting.depArtifact, 'exclusions': newSetting.depExclude - } - newSetting.dependencies.splice(d, 1) + }; + newSetting.dependencies.splice(d, 1); } } newSetting.dependencies.push({ 'groupArtifactVersion': newSetting.depArtifact, 'exclusions': (newSetting.depExclude === '') ? [] : newSetting.depExclude - }) - emptyNewDependency(newSetting) + }); + emptyNewDependency(newSetting); } else { // Add new dependency from edit form - let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) - let setting = $scope.interpreterSettings[index] + var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); + var setting = $scope.interpreterSettings[index]; if (!setting.depArtifact || setting.depArtifact === '') { - return + return; } // overwrite if artifact already exists - for (let dep in setting.dependencies) { + for (var dep in setting.dependencies) { if (setting.dependencies[dep].groupArtifactVersion === setting.depArtifact) { setting.dependencies[dep] = { 'groupArtifactVersion': setting.depArtifact, 'exclusions': setting.depExclude - } - setting.dependencies.splice(dep, 1) + }; + setting.dependencies.splice(dep, 1); } } setting.dependencies.push({ 'groupArtifactVersion': setting.depArtifact, 'exclusions': (setting.depExclude === '') ? [] : setting.depExclude - }) - emptyNewDependency(setting) + }); + emptyNewDependency(setting); } - } + }; - $scope.resetNewRepositorySetting = function () { + $scope.resetNewRepositorySetting = function() { $scope.newRepoSetting = { id: '', url: '', @@ -635,89 +650,92 @@ function InterpreterCtrl ($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeo proxyPort: null, proxyLogin: '', proxyPassword: '' - } - } + }; + }; - let getRepositories = function () { + var getRepositories = function() { $http.get(baseUrlSrv.getRestApiBase() + '/interpreter/repository') - .success(function (data, status, headers, config) { - $scope.repositories = data.body - }).error(function (data, status, headers, config) { - console.log('Error %o %o', status, data.message) - }) - } + .success(function(data, status, headers, config) { + $scope.repositories = data.body; + }).error(function(data, status, headers, config) { + console.log('Error %o %o', status, data.message); + }); + }; - $scope.addNewRepository = function () { - let request = angular.copy($scope.newRepoSetting) + $scope.addNewRepository = function() { + var request = angular.copy($scope.newRepoSetting); $http.post(baseUrlSrv.getRestApiBase() + '/interpreter/repository', request) - .success(function (data, status, headers, config) { - getRepositories() - $scope.resetNewRepositorySetting() - angular.element('#repoModal').modal('hide') - }).error(function (data, status, headers, config) { - console.log('Error %o %o', headers, config) - }) - } - - $scope.removeRepository = function (repoId) { + .success(function(data, status, headers, config) { + getRepositories(); + $scope.resetNewRepositorySetting(); + angular.element('#repoModal').modal('hide'); + }).error(function(data, status, headers, config) { + console.log('Error %o %o', headers, config); + }); + }; + + $scope.removeRepository = function(repoId) { BootstrapDialog.confirm({ closable: true, title: '', message: 'Do you want to delete this repository?', - callback: function (result) { + callback: function(result) { if (result) { $http.delete(baseUrlSrv.getRestApiBase() + '/interpreter/repository/' + repoId) - .success(function (data, status, headers, config) { - let index = _.findIndex($scope.repositories, {'id': repoId}) - $scope.repositories.splice(index, 1) - }).error(function (data, status, headers, config) { - console.log('Error %o %o', status, data.message) - }) + .success(function(data, status, headers, config) { + var index = _.findIndex($scope.repositories, {'id': repoId}); + $scope.repositories.splice(index, 1); + }).error(function(data, status, headers, config) { + console.log('Error %o %o', status, data.message); + }); } } - }) - } + }); + }; - $scope.isDefaultRepository = function (repoId) { + $scope.isDefaultRepository = function(repoId) { if (repoId === 'central' || repoId === 'local') { - return true + return true; } else { - return false + return false; } - } + }; - $scope.showErrorMessage = function (setting) { + $scope.showErrorMessage = function(setting) { BootstrapDialog.show({ title: 'Error downloading dependencies', message: setting.errorReason - }) - } + }); + }; + + var init = function() { + getAvailableInterpreterPropertyTypes(); - let init = function () { - $scope.resetNewInterpreterSetting() - $scope.resetNewRepositorySetting() + $scope.resetNewInterpreterSetting(); + $scope.resetNewRepositorySetting(); - getInterpreterSettings() - getAvailableInterpreters() - getRepositories() - } + getInterpreterSettings(); + getAvailableInterpreters(); + getRepositories(); + }; - $scope.showSparkUI = function (settingId) { + $scope.showSparkUI = function(settingId) { $http.get(baseUrlSrv.getRestApiBase() + '/interpreter/getmetainfos/' + settingId + '?propName=url') - .success(function (data, status, headers, config) { - let url = data.body.url + .success(function(data, status, headers, config) { + var url = data.body.url; if (!url) { BootstrapDialog.alert({ message: 'No spark application running' - }) - return + }); + return; } - window.open(url, '_blank') - }).error(function (data, status, headers, config) { - console.log('Error %o %o', status, data.message) - }) - } + window.open(url, '_blank'); + }).error(function(data, status, headers, config) { + console.log('Error %o %o', status, data.message); + }); + }; - init() + init(); } + diff --git a/zeppelin-web/src/app/interpreter/interpreter.html b/zeppelin-web/src/app/interpreter/interpreter.html index 54652a0e092..bdf62dc2e2f 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.html +++ b/zeppelin-web/src/app/interpreter/interpreter.html @@ -395,28 +395,23 @@
Properties
name value - action + type + action {{key}} - + {{setting.properties[key].value | breakFilter}} - - {{setting.properties[key].value}} - - - {{setting.properties[key].value}} - - {{setting.properties[key].value}} {{setting.properties[key].value ? '***' : ''}} - - {{setting.properties[key].value}} - + + + diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java index d7c2f5ec0ba..3211b1f659d 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java @@ -280,8 +280,7 @@ public Properties getFlatProperties() { Map propertyMap = (Map) properties; for (String key : propertyMap.keySet()) { InterpreterProperty tmp = propertyMap.get(key); - p.put(tmp.getName() != null ? tmp.getName() : key, - tmp.getValue() != null ? tmp.getValue().toString() : null); + p.put(tmp.getName() != null ? tmp.getName() : key, tmp.getValue()); } } return p; diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java index 3483931e687..be65c8c6c5b 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java @@ -173,13 +173,13 @@ private void loadFromFile() { for (String key : p.keySet()) { StringMap fields = (StringMap) p.get(key); // default 'text' - InterpreterPropertyWidget widget = InterpreterPropertyWidget.text; + InterpreterPropertyType type = InterpreterPropertyType.text; try { - widget = InterpreterPropertyWidget.valueOf(fields.get("widget")); + type = InterpreterPropertyType.valueOf(fields.get("type")); } catch (Exception e) { logger.warn("Incorrect type of property {} in settings {}", key, setting.getId()); } - properties.put(key, new InterpreterProperty(key, fields.get("value"), widget)); + properties.put(key, new InterpreterProperty(key, fields.get("value"), type)); } setting.setProperties(properties); @@ -500,7 +500,7 @@ private Map convertInterpreterProperties( for (String key : defaultProperties.keySet()) { DefaultInterpreterProperty defaultInterpreterProperty = defaultProperties.get(key); properties.put(key, new InterpreterProperty(key, defaultInterpreterProperty.getValue(), - defaultInterpreterProperty.getWidget())); + defaultInterpreterProperty.getType())); } return properties; } diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java index f625b464f7a..14eb60ae1fd 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java @@ -103,9 +103,9 @@ public void setUp() throws Exception { Maps.newHashMap(), "mock1", null); Map intp1Properties = new HashMap(); intp1Properties.put("PROPERTY_1", - new InterpreterProperty("PROPERTY_1", "VALUE_1", InterpreterPropertyWidget.text)); + new InterpreterProperty("PROPERTY_1", "VALUE_1", InterpreterPropertyType.text)); intp1Properties.put("property_2", - new InterpreterProperty("property_2", "value_2", InterpreterPropertyWidget.text)); + new InterpreterProperty("property_2", "value_2", InterpreterPropertyType.text)); interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList(), new InterpreterOption(true), intp1Properties); ArrayList interpreterInfos2 = new ArrayList<>(); @@ -162,9 +162,9 @@ public void testRemoteRepl() throws Exception { Maps.newHashMap(), "mock1", null); Map intp1Properties = new HashMap(); intp1Properties.put("PROPERTY_1", - new InterpreterProperty("PROPERTY_1", "VALUE_1", InterpreterPropertyWidget.text)); + new InterpreterProperty("PROPERTY_1", "VALUE_1", InterpreterPropertyType.text)); intp1Properties.put("property_2", new InterpreterProperty("property_2", "value_2", - InterpreterPropertyWidget.text)); + InterpreterPropertyType.text)); interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList(), new InterpreterOption(true), intp1Properties); factory = new InterpreterFactory(conf, null, null, null, depResolver, false, interpreterSettingManager); List all = interpreterSettingManager.get(); @@ -201,9 +201,9 @@ public void testRestartInterpreterInScopedMode() throws Exception { Maps.newHashMap(), "mock1", null); Map intp1Properties = new HashMap(); intp1Properties.put("PROPERTY_1", - new InterpreterProperty("PROPERTY_1", "VALUE_1", InterpreterPropertyWidget.text)); + new InterpreterProperty("PROPERTY_1", "VALUE_1", InterpreterPropertyType.text)); intp1Properties.put("property_2", - new InterpreterProperty("property_2", "value_2", InterpreterPropertyWidget.text)); + new InterpreterProperty("property_2", "value_2", InterpreterPropertyType.text)); interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList(), new InterpreterOption(true), intp1Properties); factory = new InterpreterFactory(conf, null, null, null, depResolver, false, interpreterSettingManager); List all = interpreterSettingManager.get(); @@ -248,9 +248,9 @@ public void testRestartInterpreterInIsolatedMode() throws Exception { Maps.newHashMap(), "mock1", null); Map intp1Properties = new HashMap(); intp1Properties.put("PROPERTY_1", - new InterpreterProperty("PROPERTY_1", "VALUE_1", InterpreterPropertyWidget.text)); + new InterpreterProperty("PROPERTY_1", "VALUE_1", InterpreterPropertyType.text)); intp1Properties.put("property_2", - new InterpreterProperty("property_2", "value_2", InterpreterPropertyWidget.text)); + new InterpreterProperty("property_2", "value_2", InterpreterPropertyType.text)); interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList(), new InterpreterOption(true), intp1Properties); factory = new InterpreterFactory(conf, null, null, null, depResolver, false, interpreterSettingManager); List all = interpreterSettingManager.get(); @@ -339,8 +339,8 @@ public void testInterpreterSettingPropertyClass() throws IOException, Repository // check if interpreter instance is saved as Properties in conf/interpreter.json file Map properties = new HashMap(); - properties.put("key1", new InterpreterProperty("key1", "value1", InterpreterPropertyWidget.text)); - properties.put("key2", new InterpreterProperty("key2", "value2", InterpreterPropertyWidget.text)); + properties.put("key1", new InterpreterProperty("key1", "value1", InterpreterPropertyType.text)); + properties.put("key2", new InterpreterProperty("key2", "value2", InterpreterPropertyType.text)); interpreterSettingManager.createNewSetting("newMock", "mock1", new LinkedList(), new InterpreterOption(false), properties); From 6e0d087fc2dd49958248d94a1328e05b3675beb7 Mon Sep 17 00:00:00 2001 From: Tinkoff DWH Date: Tue, 18 Apr 2017 17:16:00 +0500 Subject: [PATCH 16/17] ZEPPELIN-2403 rename to widget added new widgets string, number, url --- .../main/resources/interpreter-setting.json | 4 +- .../main/resources/interpreter-setting.json | 4 +- .../main/resources/interpreter-setting.json | 6 +- .../main/resources/interpreter-setting.json | 64 ++++----- .../development/writingzeppelininterpreter.md | 4 +- docs/install/upgrade.md | 32 ++--- docs/rest-api/rest-interpreter.md | 30 ++--- .../main/resources/interpreter-setting.json | 15 ++- .../main/resources/interpreter-setting.json | 6 +- .../main/resources/interpreter-setting.json | 4 +- .../main/resources/interpreter-setting.json | 6 +- .../main/resources/interpreter-setting.json | 2 +- .../main/resources/interpreter-setting.json | 8 +- .../main/resources/interpreter-setting.json | 2 +- .../main/resources/interpreter-setting.json | 14 +- .../main/resources/interpreter-setting.json | 27 ++-- .../main/resources/interpreter-setting.json | 16 +-- .../main/resources/interpreter-setting.json | 18 +-- .../main/resources/interpreter-setting.json | 48 +++---- .../main/resources/interpreter-setting.json | 2 +- .../main/resources/interpreter-setting.json | 10 +- .../main/resources/interpreter-setting.json | 4 +- r/src/main/resources/interpreter-setting.json | 20 +-- .../main/resources/interpreter-setting.json | 4 +- .../main/resources/interpreter-setting.json | 8 +- .../zeppelin/spark/SparkInterpreter.java | 18 +-- .../main/resources/interpreter-setting.json | 46 +++---- .../sparkr-resources/interpreter-setting.json | 56 ++++---- .../DefaultInterpreterProperty.java | 32 ++--- .../interpreter/InterpreterProperty.java | 20 +-- .../InterpreterPropertyBuilder.java | 4 +- .../interpreter/InterpreterPropertyType.java | 26 ---- .../zeppelin/rest/InterpreterRestApi.java | 11 +- .../zeppelin/rest/AbstractTestRestApi.java | 20 +-- .../interpreter-create.html | 31 ++--- .../app/interpreter/interpreter.controller.js | 29 +++-- .../src/app/interpreter/interpreter.html | 31 +++-- zeppelin-web/src/index.js | 121 +++++++++--------- .../InterpreterSettingManager.java | 8 +- .../interpreter/InterpreterFactoryTest.java | 20 +-- 40 files changed, 413 insertions(+), 418 deletions(-) delete mode 100644 zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java diff --git a/alluxio/src/main/resources/interpreter-setting.json b/alluxio/src/main/resources/interpreter-setting.json index f73aae4b9c5..cf0101befb1 100644 --- a/alluxio/src/main/resources/interpreter-setting.json +++ b/alluxio/src/main/resources/interpreter-setting.json @@ -9,14 +9,14 @@ "propertyName": "alluxio.master.hostname", "defaultValue": "localhost", "description": "Alluxio master hostname", - "type": "text" + "widget": "string" }, "alluxio.master.port": { "envName": "ALLUXIO_MASTER_PORT", "propertyName": "alluxio.master.port", "defaultValue": "19998", "description": "Alluxio master port", - "type": "text" + "widget": "number" } }, "editor": { diff --git a/beam/src/main/resources/interpreter-setting.json b/beam/src/main/resources/interpreter-setting.json index b6d5559fd6a..b715a2114b9 100644 --- a/beam/src/main/resources/interpreter-setting.json +++ b/beam/src/main/resources/interpreter-setting.json @@ -20,14 +20,14 @@ "propertyName": "zeppelin.scio.argz", "defaultValue": "--runner=InProcessPipelineRunner", "description": "Scio interpreter wide arguments", - "type": "text" + "widget": "text" }, "zeppelin.scio.maxResult": { "envName": "ZEPPELIN_SCIO_MAXRESULT", "propertyName": "zeppelin.scio.maxResult", "defaultValue": "1000", "description": "Max number of SCollection results to display.", - "type": "text" + "widget": "number" } }, "editor": { diff --git a/bigquery/src/main/resources/interpreter-setting.json b/bigquery/src/main/resources/interpreter-setting.json index fbe0874de20..1d0c516f877 100644 --- a/bigquery/src/main/resources/interpreter-setting.json +++ b/bigquery/src/main/resources/interpreter-setting.json @@ -9,21 +9,21 @@ "propertyName": "zeppelin.bigquery.project_id", "defaultValue": " ", "description": "Google Project ID", - "type": "text" + "widget": "string" }, "zeppelin.bigquery.wait_time": { "envName": null, "propertyName": "zeppelin.bigquery.wait_time", "defaultValue": "5000", "description": "Query timeout in Milliseconds", - "type": "text" + "widget": "number" }, "zeppelin.bigquery.max_no_of_rows": { "envName": null, "propertyName": "zeppelin.bigquery.max_no_of_rows", "defaultValue": "100000", "description": "Maximum number of rows to fetch from BigQuery", - "type": "text" + "widget": "number" } }, "editor": { diff --git a/cassandra/src/main/resources/interpreter-setting.json b/cassandra/src/main/resources/interpreter-setting.json index a94e555428d..cb901217936 100644 --- a/cassandra/src/main/resources/interpreter-setting.json +++ b/cassandra/src/main/resources/interpreter-setting.json @@ -9,217 +9,217 @@ "propertyName": "cassandra.hosts", "defaultValue": "localhost", "description": "Comma separated Cassandra hosts (DNS name or IP address). Default = localhost. Ex: '192.168.0.12,node2,node3'", - "type": "text" + "widget": "text" }, "cassandra.native.port": { "envName": null, "propertyName": "cassandra.native.port", "defaultValue": "9042", "description": "Cassandra native port. Default = 9042", - "type": "text" + "widget": "number" }, "cassandra.protocol.version": { "envName": null, "propertyName": "cassandra.protocol.version", "defaultValue": "4", "description": "Cassandra protocol version. Default = 4", - "type": "text" + "widget": "string" }, "cassandra.cluster": { "envName": null, "propertyName": "cassandra.cluster", "defaultValue": "Test Cluster", "description": "Cassandra cluster name. Default = 'Test Cluster'", - "type": "text" + "widget": "string" }, "cassandra.keyspace": { "envName": null, "propertyName": "cassandra.keyspace", "defaultValue": "system", "description": "Cassandra keyspace name. Default = 'system'", - "type": "text" + "widget": "string" }, "cassandra.compression.protocol": { "envName": null, "propertyName": "cassandra.compression.protocol", "defaultValue": "NONE", "description": "Cassandra compression protocol. Available values: NONE, SNAPPY, LZ4. Default = NONE", - "type": "text" + "widget": "string" }, "cassandra.credentials.username": { "envName": null, "propertyName": "cassandra.credentials.username", "defaultValue": "none", "description": "Cassandra credentials username. Default = 'none'", - "type": "text" + "widget": "string" }, "cassandra.credentials.password": { "envName": null, "propertyName": "cassandra.credentials.password", "defaultValue": "none", "description": "Cassandra credentials password. Default = 'none'", - "type": "password" + "widget": "password" }, "cassandra.load.balancing.policy": { "envName": null, "propertyName": "cassandra.load.balancing.policy", "defaultValue": "DEFAULT", "description": "Cassandra Load Balancing Policy. Default = new TokenAwarePolicy(new DCAwareRoundRobinPolicy())", - "type": "text" + "widget": "string" }, "cassandra.retry.policy": { "envName": null, "propertyName": "cassandra.retry.policy", "defaultValue": "DEFAULT", "description": "Cassandra Retry Policy. Default = DefaultRetryPolicy.INSTANCE", - "type": "text" + "widget": "string" }, "cassandra.reconnection.policy": { "envName": null, "propertyName": "cassandra.reconnection.policy", "defaultValue": "DEFAULT", "description": "Cassandra Reconnection Policy. Default = new ExponentialReconnectionPolicy(1000, 10 * 60 * 1000)", - "type": "text" + "widget": "string" }, "cassandra.speculative.execution.policy": { "envName": null, "propertyName": "cassandra.speculative.execution.policy", "defaultValue": "DEFAULT", "description": "Cassandra Speculative Execution Policy. Default = NoSpeculativeExecutionPolicy.INSTANCE", - "type": "text" + "widget": "string" }, "cassandra.interpreter.parallelism": { "envName": null, "propertyName": "cassandra.interpreter.parallelism", "defaultValue": "10", "description": "Cassandra interpreter parallelism.Default = 10", - "type": "text" + "widget": "number" }, "cassandra.max.schema.agreement.wait.second": { "envName": null, "propertyName": "cassandra.max.schema.agreement.wait.second", "defaultValue": "10", "description": "Cassandra max schema agreement wait in second.Default = ProtocolOptions.DEFAULT_MAX_SCHEMA_AGREEMENT_WAIT_SECONDS", - "type": "text" + "widget": "number" }, "cassandra.pooling.new.connection.threshold.local": { "envName": null, "propertyName": "cassandra.pooling.new.connection.threshold.local", "defaultValue": "100", "description": "Cassandra new connection threshold local. Protocol V2 and below default = 100 Protocol V3 and above default = 800", - "type": "text" + "widget": "number" }, "cassandra.pooling.new.connection.threshold.remote": { "envName": null, "propertyName": "cassandra.pooling.new.connection.threshold.remote", "defaultValue": "100", "description": "Cassandra new connection threshold remove. Protocol V2 and below default = 100 Protocol V3 and above default = 200", - "type": "text" + "widget": "number" }, "cassandra.pooling.core.connection.per.host.local": { "envName": null, "propertyName": "cassandra.pooling.core.connection.per.host.local", "defaultValue": "2", "description": "Cassandra core connection per host local. Protocol V2 and below default = 2 Protocol V3 and above default = 1", - "type": "text" + "widget": "number" }, "cassandra.pooling.core.connection.per.host.remote": { "envName": null, "propertyName": "cassandra.pooling.core.connection.per.host.remote", "defaultValue": "1", "description": "Cassandra core connection per host remove. Protocol V2 and below default = 1 Protocol V3 and above default = 1", - "type": "text" + "widget": "number" }, "cassandra.pooling.max.connection.per.host.local": { "envName": null, "propertyName": "cassandra.pooling.max.connection.per.host.local", "defaultValue": "8", "description": "Cassandra max connection per host local. Protocol V2 and below default = 8 Protocol V3 and above default = 1", - "type": "text" + "widget": "number" }, "cassandra.pooling.max.connection.per.host.remote": { "envName": null, "propertyName": "cassandra.pooling.max.connection.per.host.remote", "defaultValue": "2", "description": "Cassandra max connection per host remote. Protocol V2 and below default = 2 Protocol V3 and above default = 1", - "type": "text" + "widget": "number" }, "cassandra.pooling.max.request.per.connection.local": { "envName": null, "propertyName": "cassandra.pooling.max.request.per.connection.local", "defaultValue": "1024", "description": "Cassandra max request per connection local. Protocol V2 and below default = 128 Protocol V3 and above default = 1024", - "type": "text" + "widget": "number" }, "cassandra.pooling.max.request.per.connection.remote": { "envName": null, "propertyName": "cassandra.pooling.max.request.per.connection.remote", "defaultValue": "256", "description": "Cassandra max request per connection remote. Protocol V2 and below default = 128 Protocol V3 and above default = 256", - "type": "text" + "widget": "number" }, "cassandra.pooling.idle.timeout.seconds": { "envName": null, "propertyName": "cassandra.pooling.idle.timeout.seconds", "defaultValue": "120", "description": "Cassandra idle time out in seconds. Default = 120", - "type": "text" + "widget": "number" }, "cassandra.pooling.pool.timeout.millisecs": { "envName": null, "propertyName": "cassandra.pooling.pool.timeout.millisecs", "defaultValue": "5000", "description": "Cassandra pool time out in millisecs. Default = 5000", - "type": "text" + "widget": "number" }, "cassandra.pooling.heartbeat.interval.seconds": { "envName": null, "propertyName": "cassandra.pooling.heartbeat.interval.seconds", "defaultValue": "30", "description": "Cassandra pool heartbeat interval in secs. Default = 30", - "type": "text" + "widget": "number" }, "cassandra.query.default.consistency": { "envName": null, "propertyName": "cassandra.query.default.consistency", "defaultValue": "ONE", "description": "Cassandra query default consistency level. Default = ONE", - "type": "text" + "widget": "string" }, "cassandra.query.default.serial.consistency": { "envName": null, "propertyName": "cassandra.query.default.serial.consistency", "defaultValue": "SERIAL", "description": "Cassandra query default serial consistency level. Default = SERIAL", - "type": "text" + "widget": "string" }, "cassandra.query.default.fetchSize": { "envName": null, "propertyName": "cassandra.query.default.fetchSize", "defaultValue": "5000", "description": "Cassandra query default fetch size. Default = 5000", - "type": "text" + "widget": "number" }, "cassandra.socket.connection.timeout.millisecs": { "envName": null, "propertyName": "cassandra.socket.connection.timeout.millisecs", "defaultValue": "5000", "description": "Cassandra socket default connection timeout in millisecs. Default = 5000", - "type": "text" + "widget": "number" }, "cassandra.socket.read.timeout.millisecs": { "envName": null, "propertyName": "cassandra.socket.read.timeout.millisecs", "defaultValue": "12000", "description": "Cassandra socket read timeout in millisecs. Default = 12000", - "type": "text" + "widget": "number" }, "cassandra.socket.tcp.no_delay": { "envName": null, "propertyName": "cassandra.socket.tcp.no_delay", - "defaultValue": "true", + "defaultValue": true, "description": "Cassandra socket TCP no delay. Default = true", - "type": "text" + "widget": "checkbox" } }, "editor": { diff --git a/docs/development/writingzeppelininterpreter.md b/docs/development/writingzeppelininterpreter.md index e106461a30c..87f2b84f3dd 100644 --- a/docs/development/writingzeppelininterpreter.md +++ b/docs/development/writingzeppelininterpreter.md @@ -62,14 +62,14 @@ Here is an example of `interpreter-setting.json` on your own interpreter. "propertyName": "property.1.name", "defaultValue": "propertyDefaultValue", "description": "Property description", - "type": "text" + "widget": "text" }, "properties2": { "envName": PROPERTIES_2, "propertyName": null, "defaultValue": "property2DefaultValue", "description": "Property 2 description", - "type": "text" + "widget": "text" }, ... }, "editor": { diff --git a/docs/install/upgrade.md b/docs/install/upgrade.md index 2d97d3912e2..65b39594fde 100644 --- a/docs/install/upgrade.md +++ b/docs/install/upgrade.md @@ -79,21 +79,21 @@ So, copying `notebook` and `conf` directory should be enough. new format: ``` "interpreterSettings": { - "2CD8TH1XV": { - "id": "2CD8TH1XV", - "name": "spark", - "group": "spark", - "properties": { - "spark.executor.memory": { - "name": "spark.executor.memory", - "value": "", - "type": "text" - }, - "zeppelin.spark.concurrentSQL": { - "name": "zeppelin.spark.concurrentSQL", - "value": "false", - "type": "text" - ... - } + "2CD8TH1XV": { + "id": "2CD8TH1XV", + "name": "spark", + "group": "spark", + "properties": { + "spark.executor.memory": { + "name": "spark.executor.memory", + "value": "", + "widget": "text" + }, + "zeppelin.spark.concurrentSQL": { + "name": "zeppelin.spark.concurrentSQL", + "value": false, + "widget": "checkbox" + ... + } ``` \ No newline at end of file diff --git a/docs/rest-api/rest-interpreter.md b/docs/rest-api/rest-interpreter.md index a38f8fbcafb..3a64b8aecef 100644 --- a/docs/rest-api/rest-interpreter.md +++ b/docs/rest-api/rest-interpreter.md @@ -77,12 +77,12 @@ The role of registered interpreters, settings and interpreters group are describ "spark.executor.memory": { "defaultValue": "1g", "description": "Executor memory per worker instance. ex) 512m, 32g", - "type": "text + "widget": "text }, "spark.cores.max": { "defaultValue": "", "description": "Total number of cores to use. Empty value uses all available core.", - "type": "text" + "widget": "text" }, }, "path": "/zeppelin/interpreter/spark" @@ -95,7 +95,7 @@ The role of registered interpreters, settings and interpreters group are describ "zeppelin.spark.maxResult": { "defaultValue": "1000", "description": "Max number of Spark SQL result to display.", - "type": "text" + "widget": "text" } }, "path": "/zeppelin/interpreter/spark" @@ -157,14 +157,14 @@ The role of registered interpreters, settings and interpreters group are describ "group": "spark", "properties": { "spark.cores.max": { - name: "", - value: "spark.cores.max", - type: "text" + "name": "", + "value": "spark.cores.max", + "widget": "text" }, "spark.executor.memory": { "name": "", "value": "1g", - "type": "text" + "widget": "text" } }, "interpreterGroup": [ @@ -229,7 +229,7 @@ The role of registered interpreters, settings and interpreters group are describ "propname": { "name": "propname", "value": "propvalue", - "type": "text" + "widget": "text" } }, "interpreterGroup": [ @@ -288,7 +288,7 @@ The role of registered interpreters, settings and interpreters group are describ "propname": { "name": "propname", "value": "propvalue", - "type": "text" + "widget": "text" }, "interpreterGroup": [ { @@ -323,7 +323,7 @@ The role of registered interpreters, settings and interpreters group are describ "propname": { "name": "propname", "value": "propvalue", - "type": "text" + "widget": "text" }, "interpreterGroup": [ { @@ -377,7 +377,7 @@ The role of registered interpreters, settings and interpreters group are describ "propname": { "name": "propname", "value": "Otherpropvalue", - "type": "text" + "widget": "text" }, "interpreterGroup": [ { @@ -412,7 +412,7 @@ The role of registered interpreters, settings and interpreters group are describ "propname": { "name": "propname", "value": "Otherpropvalue", - "type": "text" + "widget": "text" }, "interpreterGroup": [ { @@ -569,16 +569,16 @@ The role of registered interpreters, settings and interpreters group are describ
-### Get available types for property +### Get available widgets for property - + - + diff --git a/elasticsearch/src/main/resources/interpreter-setting.json b/elasticsearch/src/main/resources/interpreter-setting.json index af471d9f3d7..a0530224365 100644 --- a/elasticsearch/src/main/resources/interpreter-setting.json +++ b/elasticsearch/src/main/resources/interpreter-setting.json @@ -9,48 +9,49 @@ "propertyName": "elasticsearch.host", "defaultValue": "localhost", "description": "The host for Elasticsearch", - "type": "text" + "widget": "string" }, "elasticsearch.port": { "envName": "ELASTICSEARCH_PORT", "propertyName": "elasticsearch.port", "defaultValue": "9300", "description": "The port for Elasticsearch", - "type": "text" + "widget": "number" }, "elasticsearch.client.type": { "envName": "ELASTICSEARCH_CLIENT_TYPE", "propertyName": "elasticsearch.client.type", "defaultValue": "transport", "description": "The type of client for Elasticsearch (transport or http)", - "type": "text" + "widget": "string" }, "elasticsearch.cluster.name": { "envName": "ELASTICSEARCH_CLUSTER_NAME", "propertyName": "elasticsearch.cluster.name", "defaultValue": "elasticsearch", "description": "The cluster name for Elasticsearch", - "type": "text" + "widget": "string" }, "elasticsearch.result.size": { "envName": "ELASTICSEARCH_RESULT_SIZE", "propertyName": "elasticsearch.result.size", "defaultValue": "10", "description": "The size of the result set of a search query", - "type": "text" + "widget": "number" }, "elasticsearch.basicauth.username": { "envName": "ELASTICSEARCH_BASIC_AUTH_USERNAME", "propertyName": "elasticsearch.basicauth.username", "defaultValue": "", - "description": "Username for a basic authentication" + "description": "Username for a basic authentication", + "widget": "string" }, "elasticsearch.basicauth.password": { "envName": "ELASTICSEARCH_BASIC_AUTH_PASSWORD", "propertyName": "elasticsearch.basicauth.password", "defaultValue": "", "description": "Password for a basic authentication", - "type": "password" + "widget": "password" } }, "editor": { diff --git a/file/src/main/resources/interpreter-setting.json b/file/src/main/resources/interpreter-setting.json index 0560e749d83..f30bdc6fbcd 100644 --- a/file/src/main/resources/interpreter-setting.json +++ b/file/src/main/resources/interpreter-setting.json @@ -9,21 +9,21 @@ "propertyName": "hdfs.url", "defaultValue": "http://localhost:50070/webhdfs/v1/", "description": "The URL for WebHDFS", - "type": "text" + "widget": "url" }, "hdfs.user": { "envName": null, "propertyName": "hdfs.user", "defaultValue": "hdfs", "description": "The WebHDFS user", - "type": "text" + "widget": "string" }, "hdfs.maxlength": { "envName": null, "propertyName": "hdfs.maxlength", "defaultValue": "1000", "description": "Maximum number of lines of results fetched", - "type": "text" + "widget": "number" } }, "editor": { diff --git a/flink/src/main/resources/interpreter-setting.json b/flink/src/main/resources/interpreter-setting.json index 395ef7f8286..ca98af826f0 100644 --- a/flink/src/main/resources/interpreter-setting.json +++ b/flink/src/main/resources/interpreter-setting.json @@ -9,14 +9,14 @@ "propertyName": null, "defaultValue": "local", "description": "host name of running JobManager. 'local' runs flink in local mode.", - "type": "text" + "widget": "string" }, "port": { "envName": "port", "propertyName": null, "defaultValue": "6123", "description": "port of running JobManager.", - "type": "text" + "widget": "number" } }, "editor": { diff --git a/geode/src/main/resources/interpreter-setting.json b/geode/src/main/resources/interpreter-setting.json index 5f0e79c63bd..94031bb56a3 100644 --- a/geode/src/main/resources/interpreter-setting.json +++ b/geode/src/main/resources/interpreter-setting.json @@ -9,21 +9,21 @@ "propertyName": "geode.locator.host", "defaultValue": "localhost", "description": "The Geode Locator Host.", - "type": "text" + "widget": "string" }, "geode.locator.port": { "envName": null, "propertyName": "geode.locator.port", "defaultValue": "10334", "description": "The Geode Locator Port.", - "type": "text" + "widget": "number" }, "geode.max.result": { "envName": null, "propertyName": "geode.max.result", "defaultValue": "1000", "description": "Max number of OQL result to display.", - "type": "text" + "widget": "number" } }, "editor": { diff --git a/groovy/src/main/resources/interpreter-setting.json b/groovy/src/main/resources/interpreter-setting.json index 92e94c9487f..e9d200e1424 100644 --- a/groovy/src/main/resources/interpreter-setting.json +++ b/groovy/src/main/resources/interpreter-setting.json @@ -9,7 +9,7 @@ "propertyName": "GROOVY_CLASSES", "defaultValue": "", "description": "The path for custom groovy classes location. If empty `./interpreter/groovy/classes`", - "type": "text" + "widget": "text" } } } diff --git a/hbase/src/main/resources/interpreter-setting.json b/hbase/src/main/resources/interpreter-setting.json index afe6dddd8c5..95aba64648d 100644 --- a/hbase/src/main/resources/interpreter-setting.json +++ b/hbase/src/main/resources/interpreter-setting.json @@ -9,19 +9,19 @@ "propertyName": "hbase.home", "defaultValue": "/usr/lib/hbase/", "description": "Installation directory of HBase", - "type": "text" + "widget": "string" }, "hbase.ruby.sources": { "propertyName": "hbase.ruby.sources", "defaultValue": "lib/ruby", "description": "Path to Ruby scripts relative to 'hbase.home'", - "type": "text" + "widget": "string" }, "zeppelin.hbase.test.mode": { "propertyName": "zeppelin.hbase.test.mode", - "defaultValue": "false", + "defaultValue": false, "description": "Disable checks for unit and manual tests", - "type": "text" + "widget": "checkbox" } }, "editor": { diff --git a/helium-dev/src/main/resources/interpreter-setting.json b/helium-dev/src/main/resources/interpreter-setting.json index 9383f27a6f9..f50d66e6dfd 100644 --- a/helium-dev/src/main/resources/interpreter-setting.json +++ b/helium-dev/src/main/resources/interpreter-setting.json @@ -9,7 +9,7 @@ "propertyName": "port", "defaultValue": "jdbc:postgresql://localhost:5432/", "description": "The URL for JDBC.", - "type": "text" + "widget": "string" } }, "editor": { diff --git a/ignite/src/main/resources/interpreter-setting.json b/ignite/src/main/resources/interpreter-setting.json index a8e62d7a3b9..74b035f2a01 100644 --- a/ignite/src/main/resources/interpreter-setting.json +++ b/ignite/src/main/resources/interpreter-setting.json @@ -9,28 +9,28 @@ "propertyName": "ignite.addresses", "defaultValue": "127.0.0.1:47500..47509", "description": "Comma separated list of addresses (e.g. 127.0.0.1:47500 or 127.0.0.1:47500..47509)", - "type": "text" + "widget": "text" }, "ignite.clientMode": { "envName": null, "propertyName": "ignite.clientMode", - "defaultValue": "true", + "defaultValue": true, "description": "Client mode. true or false", - "type": "text" + "widget": "checkbox" }, "ignite.config.url": { "envName": null, "propertyName": "ignite.config.url", "defaultValue": "", "description": "Configuration URL. Overrides all other settings.", - "type": "text" + "widget": "url" }, "ignite.peerClassLoadingEnabled": { "envName": null, "propertyName": "ignite.peerClassLoadingEnabled", - "defaultValue": "true", + "defaultValue": true, "description": "Peer class loading enabled. True or false", - "type": "text" + "widget": "checkbox" } } }, @@ -44,7 +44,7 @@ "propertyName": "ignite.jdbc.url", "defaultValue": "jdbc:ignite:cfg://default-ignite-jdbc.xml", "description": "Ignite JDBC connection URL.", - "type": "text" + "widget": "string" } } } diff --git a/jdbc/src/main/resources/interpreter-setting.json b/jdbc/src/main/resources/interpreter-setting.json index ce8c880e932..5e70e535fe6 100644 --- a/jdbc/src/main/resources/interpreter-setting.json +++ b/jdbc/src/main/resources/interpreter-setting.json @@ -9,83 +9,84 @@ "propertyName": "default.url", "defaultValue": "jdbc:postgresql://localhost:5432/", "description": "The URL for JDBC.", - "type": "text" + "widget": "string" }, "default.user": { "envName": null, "propertyName": "default.user", "defaultValue": "gpadmin", "description": "The JDBC user name", - "type": "text" + "widget": "string" }, "default.password": { "envName": null, "propertyName": "default.password", "defaultValue": "", "description": "The JDBC user password", - "type": "password" + "widget": "password" }, "default.driver": { "envName": null, "propertyName": "default.driver", "defaultValue": "org.postgresql.Driver", "description": "JDBC Driver Name", - "type": "text" + "widget": "string" }, "default.completer.schemaFilters": { "envName": null, "propertyName": "default.completer.schemaFilters", "defaultValue": "", - "description": "Сomma separated schema (schema = catalog = database) filters to get metadata for completions. Supports '%' symbol is equivalent to any set of characters. (ex. prod_v_%,public%,info)" + "description": "Сomma separated schema (schema = catalog = database) filters to get metadata for completions. Supports '%' symbol is equivalent to any set of characters. (ex. prod_v_%,public%,info)", + "widget": "text" }, "default.precode": { "envName": null, "propertyName": "zeppelin.jdbc.precode", "defaultValue": "", "description": "SQL which executes while opening connection", - "type": "text" + "widget": "text" }, "common.max_count": { "envName": null, "propertyName": "common.max_count", "defaultValue": "1000", "description": "Max number of SQL result to display.", - "type": "text" + "widget": "number" }, "zeppelin.jdbc.auth.type": { "envName": null, "propertyName": "zeppelin.jdbc.auth.type", "defaultValue": "", "description": "If auth type is needed, Example: KERBEROS", - "type": "text" + "widget": "string" }, "zeppelin.jdbc.concurrent.use": { "envName": null, "propertyName": "zeppelin.jdbc.concurrent.use", - "defaultValue": "true", + "defaultValue": true, "description": "Use parallel scheduler", - "type": "text" + "widget": "checkbox" }, "zeppelin.jdbc.concurrent.max_connection": { "envName": null, "propertyName": "zeppelin.jdbc.concurrent.max_connection", "defaultValue": "10", "description": "Number of concurrent execution", - "type": "text" + "widget": "number" }, "zeppelin.jdbc.keytab.location": { "envName": null, "propertyName": "zeppelin.jdbc.keytab.location", "defaultValue": "", "description": "Kerberos keytab location", - "type": "text" + "widget": "string" }, "zeppelin.jdbc.principal": { "envName": null, "propertyName": "zeppelin.jdbc.principal", "defaultValue": "", "description": "Kerberos principal", - "type": "text" + "widget": "string" } }, "editor": { diff --git a/kylin/src/main/resources/interpreter-setting.json b/kylin/src/main/resources/interpreter-setting.json index 271294f46c4..7e87f08b142 100644 --- a/kylin/src/main/resources/interpreter-setting.json +++ b/kylin/src/main/resources/interpreter-setting.json @@ -9,49 +9,49 @@ "propertyName": "kylin.api.url", "defaultValue": "http://localhost:7070/kylin/api/query", "description": "Kylin API", - "type": "text" + "widget": "url" }, "kylin.api.user": { "envName": null, "propertyName": "kylin.api.user", "defaultValue": "ADMIN", "description": "Kylin username", - "type": "text" + "widget": "string" }, "kylin.api.password": { "envName": null, "propertyName": "kylin.api.password", "defaultValue": "KYLIN", "description": "Kylin password", - "type": "password" + "widget": "password" }, "kylin.query.project": { "envName": null, "propertyName": "kylin.query.project", "defaultValue": "learn_kylin", "description": "Default Kylin project name", - "type": "text" + "widget": "text" }, "kylin.query.offset": { "envName": null, "propertyName": "kylin.query.offset", "defaultValue": "0", "description": "Kylin query offset", - "type": "text" + "widget": "number" }, "kylin.query.limit": { "envName": null, "propertyName": "kylin.query.limit", "defaultValue": "5000", "description": "Kylin query limit", - "type": "text" + "widget": "number" }, "kylin.query.ispartial": { "envName": null, "propertyName": "kylin.query.ispartial", - "defaultValue": "true", + "defaultValue": true, "description": "Kylin query partial flag, deprecated", - "type": "text" + "widget": "checkbox" } }, "editor": { diff --git a/lens/src/main/resources/interpreter-setting.json b/lens/src/main/resources/interpreter-setting.json index 1524dcd6208..32d52369192 100644 --- a/lens/src/main/resources/interpreter-setting.json +++ b/lens/src/main/resources/interpreter-setting.json @@ -7,51 +7,51 @@ "zeppelin.lens.run.concurrent": { "envName": null, "propertyName": "zeppelin.lens.run.concurrent", - "defaultValue": "true", + "defaultValue": true, "description": "Run concurrent Lens Sessions", - "type": "text" + "widget": "checkbox" }, "zeppelin.lens.maxThreads": { "envName": null, "propertyName": "zeppelin.lens.maxThreads", "defaultValue": "10", "description": "If concurrency is true then how many threads?", - "type": "text" + "widget": "number" }, "zeppelin.lens.maxResults": { "envName": null, "propertyName": "zeppelin.lens.maxResults", "defaultValue": "1000", "description": "max number of rows to display", - "type": "text" + "widget": "number" }, "lens.server.base.url": { "envName": null, "propertyName": "lens.server.base.url", "defaultValue": "http://:/lensapi", "description": "The URL for Lens Server", - "type": "text" + "widget": "url" }, "lens.client.dbname": { "envName": null, "propertyName": "lens.client.dbname", "defaultValue": "default", "description": "The database schema name", - "type": "text" + "widget": "string" }, "lens.query.enable.persistent.resultset": { "envName": null, "propertyName": "lens.query.enable.persistent.resultset", - "defaultValue": "false", + "defaultValue": false, "description": "Apache Lens to persist result in HDFS?", - "type": "text" + "widget": "checkbox" }, "lens.session.cluster.user": { "envName": null, "propertyName": "lens.session.cluster.user", "defaultValue": "default", "description": "Hadoop cluster username", - "type": "text" + "widget": "string" } } } diff --git a/livy/src/main/resources/interpreter-setting.json b/livy/src/main/resources/interpreter-setting.json index bf73fddbfa6..5f1eb387224 100644 --- a/livy/src/main/resources/interpreter-setting.json +++ b/livy/src/main/resources/interpreter-setting.json @@ -10,104 +10,104 @@ "propertyName": "zeppelin.livy.url", "defaultValue": "http://localhost:8998", "description": "The URL for Livy Server.", - "type": "text" + "widget": "url" }, "zeppelin.livy.session.create_timeout": { "envName": "ZEPPELIN_LIVY_SESSION_CREATE_TIMEOUT", "propertyName": "zeppelin.livy.session.create_timeout", "defaultValue": "120", "description": "Livy Server create session timeout (seconds).", - "type": "text" + "widget": "number" }, "livy.spark.driver.cores": { "propertyName": "livy.spark.driver.cores", "defaultValue": "", "description": "Driver cores. ex) 1, 2", - "type": "text" + "widget": "number" }, "livy.spark.driver.memory": { "propertyName": "livy.spark.driver.memory", "defaultValue": "", "description": "Driver memory. ex) 512m, 32g", - "type": "text" + "widget": "string" }, "livy.spark.executor.instances": { "propertyName": "livy.spark.executor.instances", "defaultValue": "", "description": "Executor instances. ex) 1, 4", - "type": "text" + "widget": "number" }, "livy.spark.executor.cores": { "propertyName": "livy.spark.executor.cores", "defaultValue": "", "description": "Num cores per executor. ex) 1, 4", - "type": "text" + "widget": "number" }, "livy.spark.executor.memory": { "propertyName": "livy.spark.executor.memory", "defaultValue": "", "description": "Executor memory per worker instance. ex) 512m, 32g", - "type": "text" + "widget": "string" }, "livy.spark.dynamicAllocation.enabled": { "propertyName": "livy.spark.dynamicAllocation.enabled", - "defaultValue": "", + "defaultValue": false, "description": "Use dynamic resource allocation", - "type": "text" + "widget": "checkbox" }, "livy.spark.dynamicAllocation.cachedExecutorIdleTimeout": { "propertyName": "livy.spark.dynamicAllocation.cachedExecutorIdleTimeout", "defaultValue": "", "description": "Remove an executor which has cached data blocks", - "type": "text" + "widget": "string" }, "livy.spark.dynamicAllocation.minExecutors": { "propertyName": "livy.spark.dynamicAllocation.minExecutors", "defaultValue": "", "description": "Lower bound for the number of executors if dynamic allocation is enabled.", - "type": "text" + "widget": "number" }, "livy.spark.dynamicAllocation.initialExecutors": { "propertyName": "livy.spark.dynamicAllocation.initialExecutors", "defaultValue": "", "description": "Initial number of executors to run if dynamic allocation is enabled.", - "type": "text" + "widget": "number" }, "livy.spark.dynamicAllocation.maxExecutors": { "propertyName": "livy.spark.dynamicAllocation.maxExecutors", "defaultValue": "", "description": "Upper bound for the number of executors if dynamic allocation is enabled.", - "type": "text" + "widget": "number" }, "zeppelin.livy.principal": { "propertyName": "zeppelin.livy.principal", "defaultValue": "", "description": "Kerberos principal to authenticate livy", - "type": "text" + "widget": "string" }, "zeppelin.livy.keytab": { "propertyName": "zeppelin.livy.keytab", "defaultValue": "", "description": "Kerberos keytab to authenticate livy", - "type": "text" + "widget": "text" }, "zeppelin.livy.pull_status.interval.millis": { "propertyName": "zeppelin.livy.pull_status.interval.millis", "defaultValue": "1000", "description": "The interval for checking paragraph execution status", - "type": "text" + "widget": "number" }, "livy.spark.jars.packages": { "propertyName": "livy.spark.jars.packages", "defaultValue": "", "description": "Adding extra libraries to livy interpreter", - "type": "text" + "widget": "text" }, "zeppelin.livy.displayAppInfo": { "propertyName": "zeppelin.livy.displayAppInfo", - "defaultValue": "false", + "defaultValue": false, "description": "Whether display app info", - "type": "text" + "widget": "checkbox" } }, "option": { @@ -134,19 +134,19 @@ "propertyName": "zeppelin.livy.spark.sql.maxResult", "defaultValue": "1000", "description": "Max number of Spark SQL result to display.", - "type": "text" + "widget": "number" }, "zeppelin.livy.spark.sql.field.truncate": { "propertyName": "zeppelin.livy.spark.sql.field.truncate", - "defaultValue": "true", + "defaultValue": true, "description": "If true, truncate field values longer than 20 characters.", - "type": "text" + "widget": "checkbox" }, "zeppelin.livy.concurrentSQL": { "propertyName": "zeppelin.livy.concurrentSQL", - "defaultValue": "false", + "defaultValue": false, "description": "Execute multiple SQL concurrently if set true.", - "type": "text" + "widget": "checkbox" } }, "option": { diff --git a/markdown/src/main/resources/interpreter-setting.json b/markdown/src/main/resources/interpreter-setting.json index 6724657a890..37ae98bff44 100644 --- a/markdown/src/main/resources/interpreter-setting.json +++ b/markdown/src/main/resources/interpreter-setting.json @@ -9,7 +9,7 @@ "propertyName": "markdown.parser.type", "defaultValue": "pegdown", "description": "Markdown Parser Type. Available values: pegdown, markdown4j. Default = pegdown", - "type": "text" + "widget": "string" } }, "editor": { diff --git a/pig/src/main/resources/interpreter-setting.json b/pig/src/main/resources/interpreter-setting.json index 540404d0cb9..96e13f54994 100644 --- a/pig/src/main/resources/interpreter-setting.json +++ b/pig/src/main/resources/interpreter-setting.json @@ -9,14 +9,14 @@ "propertyName": "zeppelin.pig.execType", "defaultValue": "mapreduce", "description": "local | mapreduce | tez", - "type": "text" + "widget": "string" }, "zeppelin.pig.includeJobStats": { "envName": null, "propertyName": "zeppelin.pig.includeJobStats", - "defaultValue": "false", + "defaultValue": false, "description": "flag to include job stats in output", - "type": "text" + "widget": "checkbox" } }, "editor": { @@ -34,14 +34,14 @@ "propertyName": "zeppelin.pig.execType", "defaultValue": "mapreduce", "description": "local | mapreduce | tez", - "type": "text" + "widget": "string" }, "zeppelin.pig.maxResult": { "envName": null, "propertyName": "zeppelin.pig.maxResult", "defaultValue": "1000", "description": "max row number for %pig.query", - "type": "text" + "widget": "number" } }, "editor": { diff --git a/python/src/main/resources/interpreter-setting.json b/python/src/main/resources/interpreter-setting.json index 65d26e3c880..03f9b331791 100644 --- a/python/src/main/resources/interpreter-setting.json +++ b/python/src/main/resources/interpreter-setting.json @@ -9,14 +9,14 @@ "propertyName": "zeppelin.python", "defaultValue": "python", "description": "Python directory. It is set to python by default.(assume python is in your $PATH)", - "type": "text" + "widget": "string" }, "zeppelin.python.maxResult": { "envName": null, "propertyName": "zeppelin.python.maxResult", "defaultValue": "1000", "description": "Max number of dataframe rows to display.", - "type": "text" + "widget": "number" } }, "editor": { diff --git a/r/src/main/resources/interpreter-setting.json b/r/src/main/resources/interpreter-setting.json index 94d8e449fcf..5fb8698acfd 100644 --- a/r/src/main/resources/interpreter-setting.json +++ b/r/src/main/resources/interpreter-setting.json @@ -7,22 +7,22 @@ "rhadoop.cmd": { "envName": "HADOOP_CMD", "defaultValue": "", - "type": "text" + "widget": "text" }, "rhadooop.streamingjar": { "envName": "HADOOP_STREAMING", "defaultValue": "", - "type": "text" + "widget": "text" }, "rscala.debug": { "envName": "RSCALA_DEBUG", - "defaultValue": "false", - "type": "text" + "defaultValue": false, + "widget": "checkbox" }, "rscala.timeout": { "envName": "RSCALA_TIMEOUT", "defaultValue": "60", - "type": "text" + "widget": "number" } } }, @@ -34,22 +34,22 @@ "rhadoop.cmd": { "envName": "HADOOP_CMD", "defaultValue": "", - "type": "text" + "widget": "text" }, "rhadooop.streamingjar": { "envName": "HADOOP_STREAMING", "defaultValue": "", - "type": "text" + "widget": "text" }, "rscala.debug": { "envName": "RSCALA_DEBUG", - "defaultValue": "false", - "type": "text" + "defaultValue": false, + "widget": "checkbox" }, "rscala.timeout": { "envName": "RSCALA_TIMEOUT", "defaultValue": "60", - "type": "text" + "widget": "number" } } } diff --git a/scalding/src/main/resources/interpreter-setting.json b/scalding/src/main/resources/interpreter-setting.json index 4fdb0a22614..33458448b0c 100644 --- a/scalding/src/main/resources/interpreter-setting.json +++ b/scalding/src/main/resources/interpreter-setting.json @@ -8,13 +8,13 @@ "envName": null, "defaultValue": "--local --repl", "description": "Arguments for scalding REPL", - "type": "text" + "widget": "text" }, "max.open.instances": { "envName": null, "defaultValue": "50", "description": "Maximum number of open interpreter instances", - "type": "text" + "widget": "number" } } } diff --git a/shell/src/main/resources/interpreter-setting.json b/shell/src/main/resources/interpreter-setting.json index 811b58a27f0..cae496b7415 100644 --- a/shell/src/main/resources/interpreter-setting.json +++ b/shell/src/main/resources/interpreter-setting.json @@ -9,28 +9,28 @@ "propertyName": "shell.command.timeout.millisecs", "defaultValue": "60000", "description": "Shell command time out in millisecs. Default = 60000", - "type": "text" + "widget": "number" }, "zeppelin.shell.auth.type": { "envName": null, "propertyName": "zeppelin.shell.auth.type", "defaultValue": "", "description": "If auth type is needed, Example: KERBEROS", - "type": "text" + "widget": "string" }, "zeppelin.shell.keytab.location": { "envName": null, "propertyName": "zeppelin.shell.keytab.location", "defaultValue": "", "description": "Kerberos keytab location", - "type": "text" + "widget": "string" }, "zeppelin.shell.principal": { "envName": null, "propertyName": "zeppelin.shell.principal", "defaultValue": "", "description": "Kerberos principal", - "type": "text" + "widget": "string" } }, "editor": { diff --git a/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java b/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java index 5a2d241753b..d30647b60fa 100644 --- a/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java +++ b/spark/src/main/java/org/apache/zeppelin/spark/SparkInterpreter.java @@ -55,7 +55,7 @@ import org.apache.zeppelin.interpreter.InterpreterContext; import org.apache.zeppelin.interpreter.InterpreterException; import org.apache.zeppelin.interpreter.InterpreterHookRegistry; -import org.apache.zeppelin.interpreter.InterpreterPropertyType; +import org.apache.zeppelin.interpreter.InterpreterPropertyWidget; import org.apache.zeppelin.interpreter.InterpreterResult; import org.apache.zeppelin.interpreter.InterpreterResult.Code; import org.apache.zeppelin.interpreter.InterpreterUtils; @@ -526,14 +526,15 @@ public SparkContext createSparkContext_1() { } private void setupConfForPySpark(SparkConf conf) { - String pysparkBasePath = - new DefaultInterpreterProperty("SPARK_HOME", null, null, null, InterpreterPropertyType.text) - .getValue(); + Object pysparkBaseProperty = + new DefaultInterpreterProperty("SPARK_HOME", null, null, null, + InterpreterPropertyWidget.text).getValue(); + String pysparkBasePath = pysparkBaseProperty != null ? pysparkBaseProperty.toString() : null; File pysparkPath; if (null == pysparkBasePath) { pysparkBasePath = new DefaultInterpreterProperty("ZEPPELIN_HOME", "zeppelin.home", "../", null, - InterpreterPropertyType.text).getValue(); + InterpreterPropertyWidget.text).getValue().toString(); pysparkPath = new File(pysparkBasePath, "interpreter" + File.separator + "spark" + File.separator + "pyspark"); } else { @@ -578,14 +579,15 @@ private void setupConfForPySpark(SparkConf conf) { } private void setupConfForSparkR(SparkConf conf) { - String sparkRBasePath = + Object sparkRBaseProperty = new DefaultInterpreterProperty("SPARK_HOME", null, null, null, - InterpreterPropertyType.text).getValue(); + InterpreterPropertyWidget.text).getValue(); + String sparkRBasePath = sparkRBaseProperty != null ? sparkRBaseProperty.toString() : null; File sparkRPath; if (null == sparkRBasePath) { sparkRBasePath = new DefaultInterpreterProperty("ZEPPELIN_HOME", "zeppelin.home", "../", null, - InterpreterPropertyType.text).getValue(); + InterpreterPropertyWidget.text).getValue().toString(); sparkRPath = new File(sparkRBasePath, "interpreter" + File.separator + "spark" + File.separator + "R"); } else { diff --git a/spark/src/main/resources/interpreter-setting.json b/spark/src/main/resources/interpreter-setting.json index 83671df452a..ab04e5729c1 100644 --- a/spark/src/main/resources/interpreter-setting.json +++ b/spark/src/main/resources/interpreter-setting.json @@ -10,63 +10,63 @@ "propertyName": "spark.executor.memory", "defaultValue": "", "description": "Executor memory per worker instance. ex) 512m, 32g", - "type": "text" + "widget": "string" }, "args": { "envName": null, "propertyName": null, "defaultValue": "", "description": "spark commandline args", - "type": "text" + "widget": "text" }, "zeppelin.spark.useHiveContext": { "envName": "ZEPPELIN_SPARK_USEHIVECONTEXT", "propertyName": "zeppelin.spark.useHiveContext", - "defaultValue": "true", + "defaultValue": true, "description": "Use HiveContext instead of SQLContext if it is true.", - "type": "text" + "widget": "checkbox" }, "spark.app.name": { "envName": "SPARK_APP_NAME", "propertyName": "spark.app.name", "defaultValue": "Zeppelin", "description": "The name of spark application.", - "type": "text" + "widget": "string" }, "zeppelin.spark.printREPLOutput": { "envName": null, - "propertyName": null, - "defaultValue": "true", + "propertyName": "zeppelin.spark.printREPLOutput", + "defaultValue": true, "description": "Print REPL output", - "type": "text" + "widget": "checkbox" }, "spark.cores.max": { "envName": null, "propertyName": "spark.cores.max", "defaultValue": "", "description": "Total number of cores to use. Empty value uses all available core.", - "type": "text" + "widget": "number" }, "zeppelin.spark.maxResult": { "envName": "ZEPPELIN_SPARK_MAXRESULT", "propertyName": "zeppelin.spark.maxResult", "defaultValue": "1000", "description": "Max number of Spark SQL result to display.", - "type": "text" + "widget": "number" }, "master": { "envName": "MASTER", "propertyName": "spark.master", "defaultValue": "local[*]", "description": "Spark master uri. ex) spark://masterhost:7077", - "type": "text" + "widget": "string" }, "zeppelin.spark.unSupportedVersionCheck": { "envName": null, "propertyName": "zeppelin.spark.enableSupportedVersionCheck", - "defaultValue": "true", + "defaultValue": true, "description": "Do not change - developer only setting, not for production use", - "type": "text" + "widget": "checkbox" } }, "editor": { @@ -82,30 +82,30 @@ "zeppelin.spark.concurrentSQL": { "envName": "ZEPPELIN_SPARK_CONCURRENTSQL", "propertyName": "zeppelin.spark.concurrentSQL", - "defaultValue": "false", + "defaultValue": false, "description": "Execute multiple SQL concurrently if set true.", - "type": "text" + "widget": "checkbox" }, "zeppelin.spark.sql.stacktrace": { "envName": "ZEPPELIN_SPARK_SQL_STACKTRACE", "propertyName": "zeppelin.spark.sql.stacktrace", - "defaultValue": "false", + "defaultValue": false, "description": "Show full exception stacktrace for SQL queries if set to true.", - "type": "text" + "widget": "checkbox" }, "zeppelin.spark.maxResult": { "envName": "ZEPPELIN_SPARK_MAXRESULT", "propertyName": "zeppelin.spark.maxResult", "defaultValue": "1000", "description": "Max number of Spark SQL result to display.", - "type": "text" + "widget": "number" }, "zeppelin.spark.importImplicit": { "envName": "ZEPPELIN_SPARK_IMPORTIMPLICIT", "propertyName": "zeppelin.spark.importImplicit", - "defaultValue": "true", + "defaultValue": true, "description": "Import implicits, UDF collection, and sql if set true. true by default.", - "type": "text" + "widget": "checkbox" } }, "editor": { @@ -123,14 +123,14 @@ "propertyName": null, "defaultValue": "local-repo", "description": "local repository for dependency loader", - "type": "text" + "widget": "string" }, "zeppelin.dep.additionalRemoteRepository": { "envName": null, "propertyName": null, "defaultValue": "spark-packages,http://dl.bintray.com/spark-packages/maven,false;", "description": "A list of 'id,remote-repository-URL,is-snapshot;' for each remote repository.", - "type": "text" + "widget": "text" } }, "editor": { @@ -148,7 +148,7 @@ "propertyName": null, "defaultValue": "python", "description": "Python command to run pyspark with", - "type": "text" + "widget": "string" } }, "editor": { diff --git a/spark/src/main/sparkr-resources/interpreter-setting.json b/spark/src/main/sparkr-resources/interpreter-setting.json index bb2a64e3093..d28f75c444f 100644 --- a/spark/src/main/sparkr-resources/interpreter-setting.json +++ b/spark/src/main/sparkr-resources/interpreter-setting.json @@ -10,63 +10,63 @@ "propertyName": "spark.executor.memory", "defaultValue": "", "description": "Executor memory per worker instance. ex) 512m, 32g", - "type": "text" + "widget": "string" }, "args": { "envName": null, "propertyName": null, "defaultValue": "", "description": "spark commandline args", - "type": "text" + "widget": "text" }, "zeppelin.spark.useHiveContext": { "envName": "ZEPPELIN_SPARK_USEHIVECONTEXT", "propertyName": "zeppelin.spark.useHiveContext", - "defaultValue": "true", + "defaultValue": true, "description": "Use HiveContext instead of SQLContext if it is true.", - "type": "text" + "widget": "checkbox" }, "spark.app.name": { "envName": "SPARK_APP_NAME", "propertyName": "spark.app.name", "defaultValue": "Zeppelin", "description": "The name of spark application.", - "type": "text" + "widget": "string" }, "zeppelin.spark.printREPLOutput": { "envName": null, - "propertyName": null, - "defaultValue": "true", + "propertyName": "zeppelin.spark.printREPLOutput", + "defaultValue": true, "description": "Print REPL output", - "type": "text" + "widget": "checkbox" }, "spark.cores.max": { "envName": null, "propertyName": "spark.cores.max", "defaultValue": "", "description": "Total number of cores to use. Empty value uses all available core.", - "type": "text" + "widget": "number" }, "zeppelin.spark.maxResult": { "envName": "ZEPPELIN_SPARK_MAXRESULT", "propertyName": "zeppelin.spark.maxResult", "defaultValue": "1000", "description": "Max number of Spark SQL result to display.", - "type": "text" + "widget": "number" }, "master": { "envName": "MASTER", "propertyName": "spark.master", "defaultValue": "local[*]", "description": "Spark master uri. ex) spark://masterhost:7077", - "type": "text" + "widget": "string" }, "zeppelin.spark.unSupportedVersionCheck": { "envName": null, "propertyName": "zeppelin.spark.enableSupportedVersionCheck", - "defaultValue": "true", + "defaultValue": true, "description": "Do not change - developer only setting, not for production use", - "type": "text" + "widget": "checkbox" } }, "editor": { @@ -81,30 +81,30 @@ "zeppelin.spark.concurrentSQL": { "envName": "ZEPPELIN_SPARK_CONCURRENTSQL", "propertyName": "zeppelin.spark.concurrentSQL", - "defaultValue": "false", + "defaultValue": false, "description": "Execute multiple SQL concurrently if set true.", - "type": "text" + "widget": "checkbox" }, "zeppelin.spark.sql.stacktrace": { "envName": "ZEPPELIN_SPARK_SQL_STACKTRACE", "propertyName": "zeppelin.spark.sql.stacktrace", - "defaultValue": "false", + "defaultValue": false, "description": "Show full exception stacktrace for SQL queries if set to true.", - "type": "text" + "widget": "checkbox" }, "zeppelin.spark.maxResult": { "envName": "ZEPPELIN_SPARK_MAXRESULT", "propertyName": "zeppelin.spark.maxResult", "defaultValue": "1000", "description": "Max number of Spark SQL result to display.", - "type": "text" + "widget": "number" }, "zeppelin.spark.importImplicit": { "envName": "ZEPPELIN_SPARK_IMPORTIMPLICIT", "propertyName": "zeppelin.spark.importImplicit", - "defaultValue": "true", + "defaultValue": true, "description": "Import implicits, UDF collection, and sql if set true. true by default.", - "type": "text" + "widget": "checkbox" } }, "editor": { @@ -121,14 +121,14 @@ "propertyName": null, "defaultValue": "local-repo", "description": "local repository for dependency loader", - "type": "text" + "widget": "string" }, "zeppelin.dep.additionalRemoteRepository": { "envName": null, "propertyName": null, "defaultValue": "spark-packages,http://dl.bintray.com/spark-packages/maven,false;", "description": "A list of 'id,remote-repository-URL,is-snapshot;' for each remote repository.", - "type": "text" + "widget": "text" } }, "editor": { @@ -145,7 +145,7 @@ "propertyName": null, "defaultValue": "python", "description": "Python command to run pyspark with", - "type": "text" + "widget": "string" } }, "editor": { @@ -160,30 +160,30 @@ "zeppelin.R.knitr": { "envName": "ZEPPELIN_R_KNITR", "propertyName": "zeppelin.R.knitr", - "defaultValue": "true", + "defaultValue": true, "description": "whether use knitr or not", - "type": "text" + "widget": "checkbox" }, "zeppelin.R.cmd": { "envName": "ZEPPELIN_R_CMD", "propertyName": "zeppelin.R.cmd", "defaultValue": "R", "description": "R repl path", - "type": "text" + "widget": "string" }, "zeppelin.R.image.width": { "envName": "ZEPPELIN_R_IMAGE_WIDTH", "propertyName": "zeppelin.R.image.width", "defaultValue": "100%", "description": "", - "type": "text" + "widget": "number" }, "zeppelin.R.render.options": { "envName": "ZEPPELIN_R_RENDER_OPTIONS", "propertyName": "zeppelin.R.render.options", "defaultValue": "out.format = 'html', comment = NA, echo = FALSE, results = 'asis', message = F, warning = F", "description": "", - "type": "text" + "widget": "text" } }, "editor": { diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/DefaultInterpreterProperty.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/DefaultInterpreterProperty.java index 4230322b256..89df8c0f82c 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/DefaultInterpreterProperty.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/DefaultInterpreterProperty.java @@ -23,22 +23,22 @@ public class DefaultInterpreterProperty { String envName; String propertyName; - String defaultValue; + Object defaultValue; String description; - InterpreterPropertyType type; + InterpreterPropertyWidget widget; - public DefaultInterpreterProperty(String envName, String propertyName, String defaultValue, - String description, InterpreterPropertyType type) { + public DefaultInterpreterProperty(String envName, String propertyName, Object defaultValue, + String description, InterpreterPropertyWidget widget) { this.envName = envName; this.propertyName = propertyName; this.defaultValue = defaultValue; this.description = description; - this.type = type; + this.widget = widget; } - public DefaultInterpreterProperty(String defaultValue, String description, - InterpreterPropertyType type) { - this(null, null, defaultValue, description, type); + public DefaultInterpreterProperty(Object defaultValue, String description, + InterpreterPropertyWidget widget) { + this(null, null, defaultValue, description, widget); } public String getEnvName() { @@ -57,11 +57,11 @@ public void setPropertyName(String propertyName) { this.propertyName = propertyName; } - public String getDefaultValue() { + public Object getDefaultValue() { return defaultValue; } - public void setDefaultValue(String defaultValue) { + public void setDefaultValue(Object defaultValue) { this.defaultValue = defaultValue; } @@ -73,12 +73,12 @@ public void setDescription(String description) { this.description = description; } - public InterpreterPropertyType getType() { - return type; + public InterpreterPropertyWidget getWidget() { + return widget; } - public void setType(InterpreterPropertyType type) { - this.type = type; + public void setWidget(InterpreterPropertyWidget widget) { + this.widget = widget; } public int hashCode() { @@ -90,7 +90,7 @@ public boolean equals(Object o) { return this.toString().equals(o.toString()); } - public String getValue() { + public Object getValue() { if (envName != null && !envName.isEmpty()) { String envValue = System.getenv().get(envName); if (envValue != null) { @@ -110,6 +110,6 @@ public String getValue() { @Override public String toString() { return String.format("{envName=%s, propertyName=%s, defaultValue=%s, description=%20s, " + - "type=%s}", envName, propertyName, defaultValue, description, type); + "type=%s}", envName, propertyName, defaultValue, description, widget); } } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java index 0be0cbe5171..2525d6bb2e6 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterProperty.java @@ -22,13 +22,13 @@ */ public class InterpreterProperty { private String name; - private String value; - private InterpreterPropertyType type; + private Object value; + private InterpreterPropertyWidget widget; - public InterpreterProperty(String name, String value, InterpreterPropertyType type) { + public InterpreterProperty(String name, Object value, InterpreterPropertyWidget widget) { this.name = name; this.value = value; - this.type = type; + this.widget = widget; } public String getName() { @@ -39,19 +39,19 @@ public void setName(String name) { this.name = name; } - public String getValue() { + public Object getValue() { return value; } - public void setValue(String value) { + public void setValue(Object value) { this.value = value; } - public InterpreterPropertyType getType() { - return type; + public InterpreterPropertyWidget getWidget() { + return widget; } - public void setType(InterpreterPropertyType type) { - this.type = type; + public void setWidget(InterpreterPropertyWidget widget) { + this.widget = widget; } } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java index 3f9e2ca6a58..9baef948e54 100644 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java +++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyBuilder.java @@ -28,7 +28,7 @@ public class InterpreterPropertyBuilder { public InterpreterPropertyBuilder add(String name, String defaultValue, String description){ properties.put(name, - new DefaultInterpreterProperty(defaultValue, description, InterpreterPropertyType.text)); + new DefaultInterpreterProperty(defaultValue, description, InterpreterPropertyWidget.text)); return this; } @@ -36,7 +36,7 @@ public InterpreterPropertyBuilder add(String name, String envName, String proper String defaultValue, String description){ properties.put(name, new DefaultInterpreterProperty(envName, propertyName, defaultValue, description, - InterpreterPropertyType.text)); + InterpreterPropertyWidget.text)); return this; } diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java deleted file mode 100644 index 27763d3865f..00000000000 --- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/interpreter/InterpreterPropertyType.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.zeppelin.interpreter; - -/** - * Types of interpreter properties - */ -public enum InterpreterPropertyType { - text, - password -} diff --git a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java index 46c363e0eb4..25e85812455 100644 --- a/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java +++ b/zeppelin-server/src/main/java/org/apache/zeppelin/rest/InterpreterRestApi.java @@ -21,7 +21,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Properties; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.DELETE; @@ -37,7 +36,7 @@ import com.google.gson.Gson; import org.apache.commons.lang.exception.ExceptionUtils; -import org.apache.zeppelin.interpreter.InterpreterPropertyType; +import org.apache.zeppelin.interpreter.InterpreterPropertyWidget; import org.apache.zeppelin.interpreter.InterpreterSettingManager; import org.apache.zeppelin.rest.message.RestartInterpreterRequest; import org.apache.zeppelin.utils.SecurityUtils; @@ -296,11 +295,11 @@ public Response removeRepository(@PathParam("repoId") String repoId) { } /** - * Get available types for property + * Get available widgets for property */ @GET - @Path("property/types") - public Response listInterpreterPropertyTypes() { - return new JsonResponse<>(Status.OK, InterpreterPropertyType.values()).build(); + @Path("property/widgets") + public Response listInterpreterPropertyWidgets() { + return new JsonResponse<>(Status.OK, InterpreterPropertyWidget.values()).build(); } } diff --git a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java index acdb8610d62..0b0c0189055 100644 --- a/zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java +++ b/zeppelin-server/src/test/java/org/apache/zeppelin/rest/AbstractTestRestApi.java @@ -45,7 +45,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.interpreter.InterpreterProperty; -import org.apache.zeppelin.interpreter.InterpreterPropertyType; +import org.apache.zeppelin.interpreter.InterpreterPropertyWidget; import org.apache.zeppelin.interpreter.InterpreterSetting; import org.apache.zeppelin.server.ZeppelinServer; import org.hamcrest.Description; @@ -205,14 +205,14 @@ private static void start(boolean withAuth) throws Exception { if ("true".equals(System.getenv("CI"))) { // set spark master and other properties sparkProperties.put("master", - new InterpreterProperty("master", "local[2]", InterpreterPropertyType.text)); + new InterpreterProperty("master", "local[2]", InterpreterPropertyWidget.text)); sparkProperties.put("spark.cores.max", - new InterpreterProperty("spark.cores.max", "2", InterpreterPropertyType.text)); + new InterpreterProperty("spark.cores.max", "2", InterpreterPropertyWidget.text)); sparkProperties.put("zeppelin.spark.useHiveContext", - new InterpreterProperty("zeppelin.spark.useHiveContext", "false", InterpreterPropertyType.text)); + new InterpreterProperty("zeppelin.spark.useHiveContext", false, InterpreterPropertyWidget.checkbox)); // set spark home for pyspark sparkProperties.put("spark.home", - new InterpreterProperty("spark.home", getSparkHome(), InterpreterPropertyType.text)); + new InterpreterProperty("spark.home", getSparkHome(), InterpreterPropertyWidget.text)); sparkIntpSetting.setProperties(sparkProperties); pySpark = true; @@ -223,18 +223,18 @@ private static void start(boolean withAuth) throws Exception { if (sparkHome != null) { if (System.getenv("SPARK_MASTER") != null) { sparkProperties.put("master", - new InterpreterProperty("master", System.getenv("SPARK_MASTER"), InterpreterPropertyType.text)); + new InterpreterProperty("master", System.getenv("SPARK_MASTER"), InterpreterPropertyWidget.text)); } else { sparkProperties.put("master", - new InterpreterProperty("master", "local[2]", InterpreterPropertyType.text)); + new InterpreterProperty("master", "local[2]", InterpreterPropertyWidget.text)); } sparkProperties.put("spark.cores.max", - new InterpreterProperty("spark.cores.max", "2", InterpreterPropertyType.text)); + new InterpreterProperty("spark.cores.max", "2", InterpreterPropertyWidget.text)); // set spark home for pyspark sparkProperties.put("spark.home", - new InterpreterProperty("spark.home", sparkHome, InterpreterPropertyType.text)); + new InterpreterProperty("spark.home", sparkHome, InterpreterPropertyWidget.text)); sparkProperties.put("zeppelin.spark.useHiveContext", - new InterpreterProperty("zeppelin.spark.useHiveContext", "false", InterpreterPropertyType.text)); + new InterpreterProperty("zeppelin.spark.useHiveContext", false, InterpreterPropertyWidget.checkbox)); pySpark = true; sparkR = true; } diff --git a/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html b/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html index 4fd49729c82..9ab9ca57173 100644 --- a/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html +++ b/zeppelin-web/src/app/interpreter/interpreter-create/interpreter-create.html @@ -272,27 +272,26 @@
Properties
- - + - - @@ -300,20 +299,22 @@
Properties
- - - +
DescriptionThis ```GET``` method returns available types for interpreter property.This ```GET``` method returns available widgets for interpreter property.
URL```http://[zeppelin-server]:[zeppelin-port]/api/interpreter/property/types``````http://[zeppelin-server]:[zeppelin-port]/api/interpreter/property/widgets```
Success code
name valuetypedescription actiondescription
{{key}} + + + + + - + {{newInterpreterSetting.properties[key].description}} - -
+ + + + + - -
diff --git a/zeppelin-web/src/app/interpreter/interpreter.controller.js b/zeppelin-web/src/app/interpreter/interpreter.controller.js index 99fe88823a5..7140345ec22 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.controller.js +++ b/zeppelin-web/src/app/interpreter/interpreter.controller.js @@ -26,7 +26,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou $scope.showRepositoryInfo = false; $scope.searchInterpreter = ''; $scope._ = _; - $scope.interpreterPropertyTypes = []; + $scope.interpreterPropertyWidgets = []; ngToast.dismiss(); $scope.openPermissions = function() { @@ -141,17 +141,17 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou }); }; - var getAvailableInterpreterPropertyTypes = function () { - $http.get(baseUrlSrv.getRestApiBase() + '/interpreter/property/types') + var getAvailableInterpreterPropertyWidgets = function () { + $http.get(baseUrlSrv.getRestApiBase() + '/interpreter/property/widgets') .success(function (data, status, headers, config) { - $scope.interpreterPropertyTypes = data.body; + $scope.interpreterPropertyWidgets = data.body; }).error(function (data, status, headers, config) { console.log('Error %o %o', status, data.message); }); }; var emptyNewProperty = function(object) { - angular.extend(object, {propertyValue: '', propertyKey: '', propertyType: $scope.interpreterPropertyTypes[0]}); + angular.extend(object, {propertyValue: '', propertyKey: '', propertyWidget: $scope.interpreterPropertyWidgets[0]}); }; var emptyNewDependency = function(object) { @@ -192,6 +192,15 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou } }; + $scope.defaultValueByWidget = function(setting) { + if (setting.propertyWidget === 'checkbox') { + setting.propertyValue = false; + return; + } + + setting.propertyValue = ''; + }; + $scope.setPerUserOption = function(settingId, sessionOption) { var option; if (settingId === undefined) { @@ -419,7 +428,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou properties[key] = { value: intpInfo[key].defaultValue, description: intpInfo[key].description, - type: intpInfo[key].type + widget: intpInfo[key].widget }; } } @@ -496,7 +505,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou var newProperties = {}; for (var p in newSetting.properties) { - newProperties[p] = {value: newSetting.properties[p].value, type: newSetting.properties[p].type, name: p}; + newProperties[p] = {value: newSetting.properties[p].value, widget: newSetting.properties[p].widget, name: p}; } request.properties = newProperties; @@ -569,7 +578,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou $scope.newInterpreterSetting.properties[$scope.newInterpreterSetting.propertyKey] = { value: $scope.newInterpreterSetting.propertyValue, - type: $scope.newInterpreterSetting.propertyType + widget: $scope.newInterpreterSetting.propertyWidget }; emptyNewProperty($scope.newInterpreterSetting); } else { @@ -581,7 +590,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou return; } - setting.properties[setting.propertyKey] = {value: setting.propertyValue, type: setting.propertyType}; + setting.properties[setting.propertyKey] = {value: setting.propertyValue, widget: setting.propertyWidget}; emptyNewProperty(setting); } @@ -710,7 +719,7 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou }; var init = function() { - getAvailableInterpreterPropertyTypes(); + getAvailableInterpreterPropertyWidgets(); $scope.resetNewInterpreterSetting(); $scope.resetNewRepositorySetting(); diff --git a/zeppelin-web/src/app/interpreter/interpreter.html b/zeppelin-web/src/app/interpreter/interpreter.html index bdf62dc2e2f..54652a0e092 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.html +++ b/zeppelin-web/src/app/interpreter/interpreter.html @@ -395,23 +395,28 @@
Properties
name value - type - action + action {{key}} - + {{setting.properties[key].value | breakFilter}} + + {{setting.properties[key].value}} + + + {{setting.properties[key].value}} + + {{setting.properties[key].value}} {{setting.properties[key].value ? '***' : ''}} - - - + + {{setting.properties[key].value}} + diff --git a/zeppelin-web/src/index.js b/zeppelin-web/src/index.js index 314be64dabf..a691c65e403 100644 --- a/zeppelin-web/src/index.js +++ b/zeppelin-web/src/index.js @@ -12,65 +12,66 @@ * limitations under the License. */ -import './app/app.js' -import './app/app.controller.js' -import './app/home/home.controller.js' -import './app/handsontable/handsonHelper.js' -import './app/notebook/notebook.controller.js' +import './app/app.js'; +import './app/app.controller.js'; +import './app/home/home.controller.js'; +import './app/handsontable/handsonHelper.js'; +import './app/notebook/notebook.controller.js'; -import './app/tabledata/tabledata.js' -import './app/tabledata/transformation.js' -import './app/tabledata/pivot.js' -import './app/tabledata/passthrough.js' -import './app/tabledata/columnselector.js' -import './app/tabledata/advanced-transformation.js' -import './app/visualization/visualization.js' -import './app/visualization/builtins/visualization-table.js' -import './app/visualization/builtins/visualization-nvd3chart.js' -import './app/visualization/builtins/visualization-barchart.js' -import './app/visualization/builtins/visualization-piechart.js' -import './app/visualization/builtins/visualization-areachart.js' -import './app/visualization/builtins/visualization-linechart.js' -import './app/visualization/builtins/visualization-scatterchart.js' +import './app/tabledata/tabledata.js'; +import './app/tabledata/transformation.js'; +import './app/tabledata/pivot.js'; +import './app/tabledata/passthrough.js'; +import './app/tabledata/columnselector.js'; +import './app/tabledata/advanced-transformation.js'; +import './app/visualization/visualization.js'; +import './app/visualization/builtins/visualization-table.js'; +import './app/visualization/builtins/visualization-nvd3chart.js'; +import './app/visualization/builtins/visualization-barchart.js'; +import './app/visualization/builtins/visualization-piechart.js'; +import './app/visualization/builtins/visualization-areachart.js'; +import './app/visualization/builtins/visualization-linechart.js'; +import './app/visualization/builtins/visualization-scatterchart.js'; -import './app/jobmanager/jobmanager.controller.js' -import './app/jobmanager/jobs/job.controller.js' -import './app/jobmanager/jobmanager.filter.js' -import './app/interpreter/interpreter.controller.js' -import './app/interpreter/interpreter.filter.js' -import './app/credential/credential.controller.js' -import './app/configuration/configuration.controller.js' -import './app/notebook/paragraph/paragraph.controller.js' -import './app/notebook/paragraph/result/result.controller.js' -import './app/search/result-list.controller.js' -import './app/notebookRepos/notebookRepos.controller.js' -import './app/helium' -import './components/arrayOrderingSrv/arrayOrdering.service.js' -import './components/clipboard/clipboard.controller.js' -import './components/navbar/navbar.controller.js' -import './components/ngescape/ngescape.directive.js' -import './components/interpreter/interpreter.directive.js' -import './components/expandCollapse/expandCollapse.directive.js' -import './components/noteName-create/notename.controller.js' -import './components/noteName-import/notenameImport.controller.js' -import './components/popover-html-unsafe/popover-html-unsafe.directive.js' -import './components/popover-html-unsafe/popover-html-unsafe-popup.directive.js' -import './components/editor/codeEditor.directive.js' -import './components/ngenter/ngenter.directive.js' -import './components/dropdowninput/dropdowninput.directive.js' -import './components/resizable/resizable.directive.js' -import './components/noteName-create/visible.directive.js' -import './components/websocketEvents/websocketMsg.service.js' -import './components/websocketEvents/websocketEvents.factory.js' -import './components/noteListDataFactory/noteList.datafactory.js' -import './components/baseUrl/baseUrl.service.js' -import './components/browser-detect/browserDetect.service.js' -import './components/saveAs/saveAs.service.js' -import './components/searchService/search.service.js' -import './components/login/login.controller.js' -import './components/elasticInputCtrl/elasticInput.controller.js' -import './components/noteAction/noteAction.service.js' -import './components/notevarshareService/notevarshare.service.js' -import './components/rename/rename.controller.js' -import './components/rename/rename.service.js' -import './components/helium/helium.service.js' +import './app/jobmanager/jobmanager.controller.js'; +import './app/jobmanager/jobs/job.controller.js'; +import './app/jobmanager/jobmanager.filter.js'; +import './app/interpreter/interpreter.controller.js'; +import './app/interpreter/interpreter.filter.js'; +import './app/credential/credential.controller.js'; +import './app/configuration/configuration.controller.js'; +import './app/notebook/paragraph/paragraph.controller.js'; +import './app/notebook/paragraph/result/result.controller.js'; +import './app/search/result-list.controller.js'; +import './app/notebookRepos/notebookRepos.controller.js'; +import './app/helium'; +import './components/arrayOrderingSrv/arrayOrdering.service.js'; +import './components/clipboard/clipboard.controller.js'; +import './components/navbar/navbar.controller.js'; +import './components/ngescape/ngescape.directive.js'; +import './components/interpreter/interpreter.directive.js'; +import './components/interpreter/widget/widget.number.directive.js'; +import './components/expandCollapse/expandCollapse.directive.js'; +import './components/noteName-create/notename.controller.js'; +import './components/noteName-import/notenameImport.controller.js'; +import './components/popover-html-unsafe/popover-html-unsafe.directive.js'; +import './components/popover-html-unsafe/popover-html-unsafe-popup.directive.js'; +import './components/editor/codeEditor.directive.js'; +import './components/ngenter/ngenter.directive.js'; +import './components/dropdowninput/dropdowninput.directive.js'; +import './components/resizable/resizable.directive.js'; +import './components/noteName-create/visible.directive.js'; +import './components/websocketEvents/websocketMsg.service.js'; +import './components/websocketEvents/websocketEvents.factory.js'; +import './components/noteListDataFactory/noteList.datafactory.js'; +import './components/baseUrl/baseUrl.service.js'; +import './components/browser-detect/browserDetect.service.js'; +import './components/saveAs/saveAs.service.js'; +import './components/searchService/search.service.js'; +import './components/login/login.controller.js'; +import './components/elasticInputCtrl/elasticInput.controller.js'; +import './components/noteAction/noteAction.service.js'; +import './components/notevarshareService/notevarshare.service.js'; +import './components/rename/rename.controller.js'; +import './components/rename/rename.service.js'; +import './components/helium/helium.service.js'; diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java index be65c8c6c5b..3483931e687 100644 --- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java +++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSettingManager.java @@ -173,13 +173,13 @@ private void loadFromFile() { for (String key : p.keySet()) { StringMap fields = (StringMap) p.get(key); // default 'text' - InterpreterPropertyType type = InterpreterPropertyType.text; + InterpreterPropertyWidget widget = InterpreterPropertyWidget.text; try { - type = InterpreterPropertyType.valueOf(fields.get("type")); + widget = InterpreterPropertyWidget.valueOf(fields.get("widget")); } catch (Exception e) { logger.warn("Incorrect type of property {} in settings {}", key, setting.getId()); } - properties.put(key, new InterpreterProperty(key, fields.get("value"), type)); + properties.put(key, new InterpreterProperty(key, fields.get("value"), widget)); } setting.setProperties(properties); @@ -500,7 +500,7 @@ private Map convertInterpreterProperties( for (String key : defaultProperties.keySet()) { DefaultInterpreterProperty defaultInterpreterProperty = defaultProperties.get(key); properties.put(key, new InterpreterProperty(key, defaultInterpreterProperty.getValue(), - defaultInterpreterProperty.getType())); + defaultInterpreterProperty.getWidget())); } return properties; } diff --git a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java index 14eb60ae1fd..f625b464f7a 100644 --- a/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java +++ b/zeppelin-zengine/src/test/java/org/apache/zeppelin/interpreter/InterpreterFactoryTest.java @@ -103,9 +103,9 @@ public void setUp() throws Exception { Maps.newHashMap(), "mock1", null); Map intp1Properties = new HashMap(); intp1Properties.put("PROPERTY_1", - new InterpreterProperty("PROPERTY_1", "VALUE_1", InterpreterPropertyType.text)); + new InterpreterProperty("PROPERTY_1", "VALUE_1", InterpreterPropertyWidget.text)); intp1Properties.put("property_2", - new InterpreterProperty("property_2", "value_2", InterpreterPropertyType.text)); + new InterpreterProperty("property_2", "value_2", InterpreterPropertyWidget.text)); interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList(), new InterpreterOption(true), intp1Properties); ArrayList interpreterInfos2 = new ArrayList<>(); @@ -162,9 +162,9 @@ public void testRemoteRepl() throws Exception { Maps.newHashMap(), "mock1", null); Map intp1Properties = new HashMap(); intp1Properties.put("PROPERTY_1", - new InterpreterProperty("PROPERTY_1", "VALUE_1", InterpreterPropertyType.text)); + new InterpreterProperty("PROPERTY_1", "VALUE_1", InterpreterPropertyWidget.text)); intp1Properties.put("property_2", new InterpreterProperty("property_2", "value_2", - InterpreterPropertyType.text)); + InterpreterPropertyWidget.text)); interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList(), new InterpreterOption(true), intp1Properties); factory = new InterpreterFactory(conf, null, null, null, depResolver, false, interpreterSettingManager); List all = interpreterSettingManager.get(); @@ -201,9 +201,9 @@ public void testRestartInterpreterInScopedMode() throws Exception { Maps.newHashMap(), "mock1", null); Map intp1Properties = new HashMap(); intp1Properties.put("PROPERTY_1", - new InterpreterProperty("PROPERTY_1", "VALUE_1", InterpreterPropertyType.text)); + new InterpreterProperty("PROPERTY_1", "VALUE_1", InterpreterPropertyWidget.text)); intp1Properties.put("property_2", - new InterpreterProperty("property_2", "value_2", InterpreterPropertyType.text)); + new InterpreterProperty("property_2", "value_2", InterpreterPropertyWidget.text)); interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList(), new InterpreterOption(true), intp1Properties); factory = new InterpreterFactory(conf, null, null, null, depResolver, false, interpreterSettingManager); List all = interpreterSettingManager.get(); @@ -248,9 +248,9 @@ public void testRestartInterpreterInIsolatedMode() throws Exception { Maps.newHashMap(), "mock1", null); Map intp1Properties = new HashMap(); intp1Properties.put("PROPERTY_1", - new InterpreterProperty("PROPERTY_1", "VALUE_1", InterpreterPropertyType.text)); + new InterpreterProperty("PROPERTY_1", "VALUE_1", InterpreterPropertyWidget.text)); intp1Properties.put("property_2", - new InterpreterProperty("property_2", "value_2", InterpreterPropertyType.text)); + new InterpreterProperty("property_2", "value_2", InterpreterPropertyWidget.text)); interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList(), new InterpreterOption(true), intp1Properties); factory = new InterpreterFactory(conf, null, null, null, depResolver, false, interpreterSettingManager); List all = interpreterSettingManager.get(); @@ -339,8 +339,8 @@ public void testInterpreterSettingPropertyClass() throws IOException, Repository // check if interpreter instance is saved as Properties in conf/interpreter.json file Map properties = new HashMap(); - properties.put("key1", new InterpreterProperty("key1", "value1", InterpreterPropertyType.text)); - properties.put("key2", new InterpreterProperty("key2", "value2", InterpreterPropertyType.text)); + properties.put("key1", new InterpreterProperty("key1", "value1", InterpreterPropertyWidget.text)); + properties.put("key2", new InterpreterProperty("key2", "value2", InterpreterPropertyWidget.text)); interpreterSettingManager.createNewSetting("newMock", "mock1", new LinkedList(), new InterpreterOption(false), properties); From 373ee418d769edf0dcb3da2e4e44d759bc413c55 Mon Sep 17 00:00:00 2001 From: Tinkoff DWH Date: Thu, 20 Apr 2017 13:21:59 +0500 Subject: [PATCH 17/17] ZEPPELIN-2403 eslint fix --- zeppelin-web/package.json | 2 +- .../app/interpreter/interpreter.controller.js | 649 +++++++++--------- .../widget/widget.number.directive.js | 15 +- zeppelin-web/src/index.js | 122 ++-- 4 files changed, 393 insertions(+), 395 deletions(-) diff --git a/zeppelin-web/package.json b/zeppelin-web/package.json index 17bcb8deddc..9fcf2ed039b 100644 --- a/zeppelin-web/package.json +++ b/zeppelin-web/package.json @@ -36,7 +36,7 @@ "css-loader": "^0.26.1", "eslint": "^3.19.0", "eslint-config-google": "^0.7.1", - "eslint-config-standard": "^10.2.0", + "eslint-config-standard": "^10.2.1", "eslint-plugin-import": "^2.2.0", "eslint-plugin-node": "^4.2.2", "eslint-plugin-promise": "^3.5.0", diff --git a/zeppelin-web/src/app/interpreter/interpreter.controller.js b/zeppelin-web/src/app/interpreter/interpreter.controller.js index 7140345ec22..a48633df9b0 100644 --- a/zeppelin-web/src/app/interpreter/interpreter.controller.js +++ b/zeppelin-web/src/app/interpreter/interpreter.controller.js @@ -12,33 +12,33 @@ * limitations under the License. */ -import { ParagraphStatus, } from '../notebook/paragraph/paragraph.status'; +import { ParagraphStatus, } from '../notebook/paragraph/paragraph.status' -angular.module('zeppelinWebApp').controller('InterpreterCtrl', InterpreterCtrl); +angular.module('zeppelinWebApp').controller('InterpreterCtrl', InterpreterCtrl) function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeout, $route) { - 'ngInject'; - - var interpreterSettingsTmp = []; - $scope.interpreterSettings = []; - $scope.availableInterpreters = {}; - $scope.showAddNewSetting = false; - $scope.showRepositoryInfo = false; - $scope.searchInterpreter = ''; - $scope._ = _; - $scope.interpreterPropertyWidgets = []; - ngToast.dismiss(); + 'ngInject' + + let interpreterSettingsTmp = [] + $scope.interpreterSettings = [] + $scope.availableInterpreters = {} + $scope.showAddNewSetting = false + $scope.showRepositoryInfo = false + $scope.searchInterpreter = '' + $scope._ = _ + $scope.interpreterPropertyWidgets = [] + ngToast.dismiss() $scope.openPermissions = function() { - $scope.showInterpreterAuth = true; - }; + $scope.showInterpreterAuth = true + } $scope.closePermissions = function() { - $scope.showInterpreterAuth = false; - }; + $scope.showInterpreterAuth = false + } - var getSelectJson = function() { - var selectJson = { + let getSelectJson = function() { + let selectJson = { tags: false, multiple: true, tokenSeparators: [',', ' '], @@ -46,19 +46,19 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou ajax: { url: function(params) { if (!params.term) { - return false; + return false } - return baseUrlSrv.getRestApiBase() + '/security/userlist/' + params.term; + return baseUrlSrv.getRestApiBase() + '/security/userlist/' + params.term }, delay: 250, processResults: function(data, params) { - var users = []; + let users = [] if (data.body.users.length !== 0) { - for (var i = 0; i < data.body.users.length; i++) { + for (let i = 0; i < data.body.users.length; i++) { users.push({ 'id': data.body.users[i], 'text': data.body.users[i] - }); + }) } } return { @@ -66,258 +66,259 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou pagination: { more: false } - }; + } }, cache: false } - }; - return selectJson; - }; + } + return selectJson + } $scope.togglePermissions = function(intpName) { - angular.element('#' + intpName + 'Users').select2(getSelectJson()); + angular.element('#' + intpName + 'Users').select2(getSelectJson()) if ($scope.showInterpreterAuth) { - $scope.closePermissions(); + $scope.closePermissions() } else { - $scope.openPermissions(); + $scope.openPermissions() } - }; + } $scope.$on('ngRenderFinished', function(event, data) { - for (var setting = 0; setting < $scope.interpreterSettings.length; setting++) { - angular.element('#' + $scope.interpreterSettings[setting].name + 'Users').select2(getSelectJson()); + for (let setting = 0; setting < $scope.interpreterSettings.length; setting++) { + angular.element('#' + $scope.interpreterSettings[setting].name + 'Users').select2(getSelectJson()) } - }); + }) - var getInterpreterSettings = function() { + let getInterpreterSettings = function() { $http.get(baseUrlSrv.getRestApiBase() + '/interpreter/setting') .success(function(data, status, headers, config) { - $scope.interpreterSettings = data.body; - checkDownloadingDependencies(); + $scope.interpreterSettings = data.body + checkDownloadingDependencies() }).error(function(data, status, headers, config) { - if (status === 401) { - ngToast.danger({ - content: 'You don\'t have permission on this page', - verticalPosition: 'bottom', - timeout: '3000' - }); - setTimeout(function() { - window.location.replace('/'); - }, 3000); - } - console.log('Error %o %o', status, data.message); - }); - }; + if (status === 401) { + ngToast.danger({ + content: 'You don\'t have permission on this page', + verticalPosition: 'bottom', + timeout: '3000' + }) + setTimeout(function() { + window.location.replace('/') + }, 3000) + } + console.log('Error %o %o', status, data.message) + }) + } var checkDownloadingDependencies = function() { - var isDownloading = false; - for (var index = 0; index < $scope.interpreterSettings.length; index++) { - var setting = $scope.interpreterSettings[index]; + let isDownloading = false + for (let index = 0; index < $scope.interpreterSettings.length; index++) { + let setting = $scope.interpreterSettings[index] if (setting.status === 'DOWNLOADING_DEPENDENCIES') { - isDownloading = true; + isDownloading = true } if (setting.status === ParagraphStatus.ERROR || setting.errorReason) { ngToast.danger({content: 'Error setting properties for interpreter \'' + setting.group + '.' + setting.name + '\': ' + setting.errorReason, - verticalPosition: 'top', dismissOnTimeout: false}); + verticalPosition: 'top', + dismissOnTimeout: false}) } } if (isDownloading) { $timeout(function() { if ($route.current.$$route.originalPath === '/interpreter') { - getInterpreterSettings(); + getInterpreterSettings() } - }, 2000); + }, 2000) } - }; + } - var getAvailableInterpreters = function() { + let getAvailableInterpreters = function() { $http.get(baseUrlSrv.getRestApiBase() + '/interpreter').success(function(data, status, headers, config) { - $scope.availableInterpreters = data.body; + $scope.availableInterpreters = data.body }).error(function(data, status, headers, config) { - console.log('Error %o %o', status, data.message); - }); - }; + console.log('Error %o %o', status, data.message) + }) + } - var getAvailableInterpreterPropertyWidgets = function () { + let getAvailableInterpreterPropertyWidgets = function () { $http.get(baseUrlSrv.getRestApiBase() + '/interpreter/property/widgets') .success(function (data, status, headers, config) { - $scope.interpreterPropertyWidgets = data.body; + $scope.interpreterPropertyWidgets = data.body }).error(function (data, status, headers, config) { - console.log('Error %o %o', status, data.message); - }); - }; + console.log('Error %o %o', status, data.message) + }) + } - var emptyNewProperty = function(object) { - angular.extend(object, {propertyValue: '', propertyKey: '', propertyWidget: $scope.interpreterPropertyWidgets[0]}); - }; + let emptyNewProperty = function(object) { + angular.extend(object, {propertyValue: '', propertyKey: '', propertyWidget: $scope.interpreterPropertyWidgets[0]}) + } - var emptyNewDependency = function(object) { - angular.extend(object, {depArtifact: '', depExclude: ''}); - }; + let emptyNewDependency = function(object) { + angular.extend(object, {depArtifact: '', depExclude: ''}) + } - var removeTMPSettings = function(index) { - interpreterSettingsTmp.splice(index, 1); - }; + let removeTMPSettings = function(index) { + interpreterSettingsTmp.splice(index, 1) + } $scope.copyOriginInterpreterSettingProperties = function(settingId) { - var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); - interpreterSettingsTmp[index] = angular.copy($scope.interpreterSettings[index]); - }; + let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) + interpreterSettingsTmp[index] = angular.copy($scope.interpreterSettings[index]) + } $scope.setPerNoteOption = function(settingId, sessionOption) { - var option; + let option if (settingId === undefined) { - option = $scope.newInterpreterSetting.option; + option = $scope.newInterpreterSetting.option } else { - var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); - var setting = $scope.interpreterSettings[index]; - option = setting.option; + let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) + let setting = $scope.interpreterSettings[index] + option = setting.option } if (sessionOption === 'isolated') { - option.perNote = sessionOption; - option.session = false; - option.process = true; + option.perNote = sessionOption + option.session = false + option.process = true } else if (sessionOption === 'scoped') { - option.perNote = sessionOption; - option.session = true; - option.process = false; + option.perNote = sessionOption + option.session = true + option.process = false } else { - option.perNote = 'shared'; - option.session = false; - option.process = false; + option.perNote = 'shared' + option.session = false + option.process = false } - }; + } $scope.defaultValueByWidget = function(setting) { if (setting.propertyWidget === 'checkbox') { - setting.propertyValue = false; - return; + setting.propertyValue = false + return } - setting.propertyValue = ''; - }; + setting.propertyValue = '' + } $scope.setPerUserOption = function(settingId, sessionOption) { - var option; + let option if (settingId === undefined) { - option = $scope.newInterpreterSetting.option; + option = $scope.newInterpreterSetting.option } else { - var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); - var setting = $scope.interpreterSettings[index]; - option = setting.option; + let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) + let setting = $scope.interpreterSettings[index] + option = setting.option } if (sessionOption === 'isolated') { - option.perUser = sessionOption; - option.session = false; - option.process = true; + option.perUser = sessionOption + option.session = false + option.process = true } else if (sessionOption === 'scoped') { - option.perUser = sessionOption; - option.session = true; - option.process = false; + option.perUser = sessionOption + option.session = true + option.process = false } else { - option.perUser = 'shared'; - option.session = false; - option.process = false; + option.perUser = 'shared' + option.session = false + option.process = false } - }; + } $scope.getPerNoteOption = function(settingId) { - var option; + let option if (settingId === undefined) { - option = $scope.newInterpreterSetting.option; + option = $scope.newInterpreterSetting.option } else { - var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); - var setting = $scope.interpreterSettings[index]; - option = setting.option; + let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) + let setting = $scope.interpreterSettings[index] + option = setting.option } if (option.perNote === 'scoped') { - return 'scoped'; + return 'scoped' } else if (option.perNote === 'isolated') { - return 'isolated'; + return 'isolated' } else { - return 'shared'; + return 'shared' } - }; + } $scope.getPerUserOption = function(settingId) { - var option; + let option if (settingId === undefined) { - option = $scope.newInterpreterSetting.option; + option = $scope.newInterpreterSetting.option } else { - var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); - var setting = $scope.interpreterSettings[index]; - option = setting.option; + let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) + let setting = $scope.interpreterSettings[index] + option = setting.option } if (option.perUser === 'scoped') { - return 'scoped'; + return 'scoped' } else if (option.perUser === 'isolated') { - return 'isolated'; + return 'isolated' } else { - return 'shared'; + return 'shared' } - }; + } $scope.getInterpreterRunningOption = function(settingId) { - var sharedModeName = 'shared'; + let sharedModeName = 'shared' - var globallyModeName = 'Globally'; - var perNoteModeName = 'Per Note'; - var perUserModeName = 'Per User'; + let globallyModeName = 'Globally' + let perNoteModeName = 'Per Note' + let perUserModeName = 'Per User' - var option; + let option if (settingId === undefined) { - option = $scope.newInterpreterSetting.option; + option = $scope.newInterpreterSetting.option } else { - var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); - var setting = $scope.interpreterSettings[index]; - option = setting.option; + let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) + let setting = $scope.interpreterSettings[index] + option = setting.option } - var perNote = option.perNote; - var perUser = option.perUser; + let perNote = option.perNote + let perUser = option.perUser // Globally == shared_perNote + shared_perUser if (perNote === sharedModeName && perUser === sharedModeName) { - return globallyModeName; + return globallyModeName } if ($rootScope.ticket.ticket === 'anonymous' && $rootScope.ticket.roles === '[]') { if (perNote !== undefined && typeof perNote === 'string' && perNote !== '') { - return perNoteModeName; + return perNoteModeName } } else if ($rootScope.ticket.ticket !== 'anonymous') { if (perNote !== undefined && typeof perNote === 'string' && perNote !== '') { if (perUser !== undefined && typeof perUser === 'string' && perUser !== '') { - return perUserModeName; + return perUserModeName } - return perNoteModeName; + return perNoteModeName } } - option.perNote = sharedModeName; - option.perUser = sharedModeName; - return globallyModeName; - }; + option.perNote = sharedModeName + option.perUser = sharedModeName + return globallyModeName + } $scope.setInterpreterRunningOption = function(settingId, isPerNoteMode, isPerUserMode) { - var option; + let option if (settingId === undefined) { - option = $scope.newInterpreterSetting.option; + option = $scope.newInterpreterSetting.option } else { - var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); - var setting = $scope.interpreterSettings[index]; - option = setting.option; + let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) + let setting = $scope.interpreterSettings[index] + option = setting.option } - option.perNote = isPerNoteMode; - option.perUser = isPerUserMode; - }; + option.perNote = isPerNoteMode + option.perUser = isPerUserMode + } $scope.updateInterpreterSetting = function(form, settingId) { var thisConfirm = BootstrapDialog.confirm({ @@ -328,75 +329,75 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou message: 'Do you want to update this interpreter and restart with new settings?', callback: function(result) { if (result) { - var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); - var setting = $scope.interpreterSettings[index]; + let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) + let setting = $scope.interpreterSettings[index] if (setting.propertyKey !== '' || setting.propertyKey) { - $scope.addNewInterpreterProperty(settingId); + $scope.addNewInterpreterProperty(settingId) } if (setting.depArtifact !== '' || setting.depArtifact) { - $scope.addNewInterpreterDependency(settingId); + $scope.addNewInterpreterDependency(settingId) } // add missing field of option if (!setting.option) { - setting.option = {}; + setting.option = {} } if (setting.option.isExistingProcess === undefined) { - setting.option.isExistingProcess = false; + setting.option.isExistingProcess = false } if (setting.option.setPermission === undefined) { - setting.option.setPermission = false; + setting.option.setPermission = false } if (setting.option.isUserImpersonate === undefined) { - setting.option.isUserImpersonate = false; + setting.option.isUserImpersonate = false } if (!($scope.getInterpreterRunningOption(settingId) === 'Per User' && $scope.getPerUserOption(settingId) === 'isolated')) { - setting.option.isUserImpersonate = false; + setting.option.isUserImpersonate = false } if (setting.option.remote === undefined) { // remote always true for now - setting.option.remote = true; + setting.option.remote = true } - setting.option.users = angular.element('#' + setting.name + 'Users').val(); + setting.option.users = angular.element('#' + setting.name + 'Users').val() - var request = { + let request = { option: angular.copy(setting.option), properties: angular.copy(setting.properties), dependencies: angular.copy(setting.dependencies) - }; + } - thisConfirm.$modalFooter.find('button').addClass('disabled'); + thisConfirm.$modalFooter.find('button').addClass('disabled') thisConfirm.$modalFooter.find('button:contains("OK")') - .html(' Saving Setting'); + .html(' Saving Setting') $http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/' + settingId, request) .success(function(data, status, headers, config) { - $scope.interpreterSettings[index] = data.body; - removeTMPSettings(index); - checkDownloadingDependencies(); - thisConfirm.close(); + $scope.interpreterSettings[index] = data.body + removeTMPSettings(index) + checkDownloadingDependencies() + thisConfirm.close() }) .error(function(data, status, headers, config) { - console.log('Error %o %o', status, data.message); - ngToast.danger({content: data.message, verticalPosition: 'bottom'}); - form.$show(); - thisConfirm.close(); - }); - return false; + console.log('Error %o %o', status, data.message) + ngToast.danger({content: data.message, verticalPosition: 'bottom'}) + form.$show() + thisConfirm.close() + }) + return false } else { - form.$show(); + form.$show() } } - }); - }; + }) + } $scope.resetInterpreterSetting = function(settingId) { - var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); + let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) // Set the old settings back - $scope.interpreterSettings[index] = angular.copy(interpreterSettingsTmp[index]); - removeTMPSettings(index); - }; + $scope.interpreterSettings[index] = angular.copy(interpreterSettingsTmp[index]) + removeTMPSettings(index) + } $scope.removeInterpreterSetting = function(settingId) { BootstrapDialog.confirm({ @@ -407,33 +408,32 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou if (result) { $http.delete(baseUrlSrv.getRestApiBase() + '/interpreter/setting/' + settingId) .success(function(data, status, headers, config) { - - var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); - $scope.interpreterSettings.splice(index, 1); + let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) + $scope.interpreterSettings.splice(index, 1) }).error(function(data, status, headers, config) { - console.log('Error %o %o', status, data.message); - }); + console.log('Error %o %o', status, data.message) + }) } } - }); - }; + }) + } $scope.newInterpreterGroupChange = function() { - var el = _.pluck(_.filter($scope.availableInterpreters, {'name': $scope.newInterpreterSetting.group}), - 'properties'); - var properties = {}; - for (var i = 0; i < el.length; i++) { - var intpInfo = el[i]; - for (var key in intpInfo) { + let el = _.pluck(_.filter($scope.availableInterpreters, {'name': $scope.newInterpreterSetting.group}), + 'properties') + let properties = {} + for (let i = 0; i < el.length; i++) { + let intpInfo = el[i] + for (let key in intpInfo) { properties[key] = { value: intpInfo[key].defaultValue, description: intpInfo[key].description, widget: intpInfo[key].widget - }; + } } } - $scope.newInterpreterSetting.properties = properties; - }; + $scope.newInterpreterSetting.properties = properties + } $scope.restartInterpreterSetting = function(settingId) { BootstrapDialog.confirm({ @@ -444,29 +444,29 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou if (result) { $http.put(baseUrlSrv.getRestApiBase() + '/interpreter/setting/restart/' + settingId) .success(function(data, status, headers, config) { - var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); - $scope.interpreterSettings[index] = data.body; - ngToast.info('Interpreter stopped. Will be lazily started on next run.'); + let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) + $scope.interpreterSettings[index] = data.body + ngToast.info('Interpreter stopped. Will be lazily started on next run.') }).error(function(data, status, headers, config) { - var errorMsg = (data !== null) ? data.message : 'Could not connect to server.'; - console.log('Error %o %o', status, errorMsg); - ngToast.danger(errorMsg); - }); + let errorMsg = (data !== null) ? data.message : 'Could not connect to server.' + console.log('Error %o %o', status, errorMsg) + ngToast.danger(errorMsg) + }) } } - }); - }; + }) + } $scope.addNewInterpreterSetting = function() { - //user input validation on interpreter creation + // user input validation on interpreter creation if (!$scope.newInterpreterSetting.name || !$scope.newInterpreterSetting.name.trim() || !$scope.newInterpreterSetting.group) { BootstrapDialog.alert({ closable: true, title: 'Add interpreter', message: 'Please fill in interpreter name and choose a group' - }); - return; + }) + return } if ($scope.newInterpreterSetting.name.indexOf('.') >= 0) { @@ -474,8 +474,8 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou closable: true, title: 'Add interpreter', message: '\'.\' is invalid for interpreter name' - }); - return; + }) + return } if (_.findIndex($scope.interpreterSettings, {'name': $scope.newInterpreterSetting.name}) >= 0) { @@ -483,49 +483,49 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou closable: true, title: 'Add interpreter', message: 'Name ' + $scope.newInterpreterSetting.name + ' already exists' - }); - return; + }) + return } - var newSetting = $scope.newInterpreterSetting; + let newSetting = $scope.newInterpreterSetting if (newSetting.propertyKey !== '' || newSetting.propertyKey) { - $scope.addNewInterpreterProperty(); + $scope.addNewInterpreterProperty() } if (newSetting.depArtifact !== '' || newSetting.depArtifact) { - $scope.addNewInterpreterDependency(); + $scope.addNewInterpreterDependency() } if (newSetting.option.setPermission === undefined) { - newSetting.option.setPermission = false; + newSetting.option.setPermission = false } - newSetting.option.users = angular.element('#newInterpreterUsers').val(); + newSetting.option.users = angular.element('#newInterpreterUsers').val() - var request = angular.copy($scope.newInterpreterSetting); + let request = angular.copy($scope.newInterpreterSetting) // Change properties to proper request format - var newProperties = {}; + let newProperties = {} - for (var p in newSetting.properties) { - newProperties[p] = {value: newSetting.properties[p].value, widget: newSetting.properties[p].widget, name: p}; + for (let p in newSetting.properties) { + newProperties[p] = {value: newSetting.properties[p].value, widget: newSetting.properties[p].widget, name: p} } - request.properties = newProperties; + request.properties = newProperties $http.post(baseUrlSrv.getRestApiBase() + '/interpreter/setting', request) .success(function(data, status, headers, config) { - $scope.resetNewInterpreterSetting(); - getInterpreterSettings(); - $scope.showAddNewSetting = false; - checkDownloadingDependencies(); + $scope.resetNewInterpreterSetting() + getInterpreterSettings() + $scope.showAddNewSetting = false + checkDownloadingDependencies() }).error(function(data, status, headers, config) { - console.log('Error %o %o', status, data.message); - ngToast.danger({content: data.message, verticalPosition: 'bottom'}); - }); - }; + console.log('Error %o %o', status, data.message) + ngToast.danger({content: data.message, verticalPosition: 'bottom'}) + }) + } $scope.cancelInterpreterSetting = function() { - $scope.showAddNewSetting = false; - $scope.resetNewInterpreterSetting(); - }; + $scope.showAddNewSetting = false + $scope.resetNewInterpreterSetting() + } $scope.resetNewInterpreterSetting = function() { $scope.newInterpreterSetting = { @@ -541,111 +541,111 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou process: false } - }; - emptyNewProperty($scope.newInterpreterSetting); - }; + } + emptyNewProperty($scope.newInterpreterSetting) + } $scope.removeInterpreterProperty = function(key, settingId) { if (settingId === undefined) { - delete $scope.newInterpreterSetting.properties[key]; + delete $scope.newInterpreterSetting.properties[key] } else { - var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); - delete $scope.interpreterSettings[index].properties[key]; + let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) + delete $scope.interpreterSettings[index].properties[key] } - }; + } $scope.removeInterpreterDependency = function(artifact, settingId) { if (settingId === undefined) { $scope.newInterpreterSetting.dependencies = _.reject($scope.newInterpreterSetting.dependencies, function(el) { - return el.groupArtifactVersion === artifact; - }); + return el.groupArtifactVersion === artifact + }) } else { - var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); + let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) $scope.interpreterSettings[index].dependencies = _.reject($scope.interpreterSettings[index].dependencies, function(el) { - return el.groupArtifactVersion === artifact; - }); + return el.groupArtifactVersion === artifact + }) } - }; + } $scope.addNewInterpreterProperty = function(settingId) { if (settingId === undefined) { // Add new property from create form if (!$scope.newInterpreterSetting.propertyKey || $scope.newInterpreterSetting.propertyKey === '') { - return; + return } $scope.newInterpreterSetting.properties[$scope.newInterpreterSetting.propertyKey] = { value: $scope.newInterpreterSetting.propertyValue, widget: $scope.newInterpreterSetting.propertyWidget - }; - emptyNewProperty($scope.newInterpreterSetting); + } + emptyNewProperty($scope.newInterpreterSetting) } else { // Add new property from edit form - var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); - var setting = $scope.interpreterSettings[index]; + let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) + let setting = $scope.interpreterSettings[index] if (!setting.propertyKey || setting.propertyKey === '') { - return; + return } - setting.properties[setting.propertyKey] = {value: setting.propertyValue, widget: setting.propertyWidget}; + setting.properties[setting.propertyKey] = {value: setting.propertyValue, widget: setting.propertyWidget} - emptyNewProperty(setting); + emptyNewProperty(setting) } - }; + } $scope.addNewInterpreterDependency = function(settingId) { if (settingId === undefined) { // Add new dependency from create form if (!$scope.newInterpreterSetting.depArtifact || $scope.newInterpreterSetting.depArtifact === '') { - return; + return } // overwrite if artifact already exists - var newSetting = $scope.newInterpreterSetting; - for (var d in newSetting.dependencies) { + let newSetting = $scope.newInterpreterSetting + for (let d in newSetting.dependencies) { if (newSetting.dependencies[d].groupArtifactVersion === newSetting.depArtifact) { newSetting.dependencies[d] = { 'groupArtifactVersion': newSetting.depArtifact, 'exclusions': newSetting.depExclude - }; - newSetting.dependencies.splice(d, 1); + } + newSetting.dependencies.splice(d, 1) } } newSetting.dependencies.push({ 'groupArtifactVersion': newSetting.depArtifact, 'exclusions': (newSetting.depExclude === '') ? [] : newSetting.depExclude - }); - emptyNewDependency(newSetting); + }) + emptyNewDependency(newSetting) } else { // Add new dependency from edit form - var index = _.findIndex($scope.interpreterSettings, {'id': settingId}); - var setting = $scope.interpreterSettings[index]; + let index = _.findIndex($scope.interpreterSettings, {'id': settingId}) + let setting = $scope.interpreterSettings[index] if (!setting.depArtifact || setting.depArtifact === '') { - return; + return } // overwrite if artifact already exists - for (var dep in setting.dependencies) { + for (let dep in setting.dependencies) { if (setting.dependencies[dep].groupArtifactVersion === setting.depArtifact) { setting.dependencies[dep] = { 'groupArtifactVersion': setting.depArtifact, 'exclusions': setting.depExclude - }; - setting.dependencies.splice(dep, 1); + } + setting.dependencies.splice(dep, 1) } } setting.dependencies.push({ 'groupArtifactVersion': setting.depArtifact, 'exclusions': (setting.depExclude === '') ? [] : setting.depExclude - }); - emptyNewDependency(setting); + }) + emptyNewDependency(setting) } - }; + } $scope.resetNewRepositorySetting = function() { $scope.newRepoSetting = { @@ -659,30 +659,30 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou proxyPort: null, proxyLogin: '', proxyPassword: '' - }; - }; + } + } - var getRepositories = function() { + let getRepositories = function() { $http.get(baseUrlSrv.getRestApiBase() + '/interpreter/repository') .success(function(data, status, headers, config) { - $scope.repositories = data.body; + $scope.repositories = data.body }).error(function(data, status, headers, config) { - console.log('Error %o %o', status, data.message); - }); - }; + console.log('Error %o %o', status, data.message) + }) + } $scope.addNewRepository = function() { - var request = angular.copy($scope.newRepoSetting); + let request = angular.copy($scope.newRepoSetting) $http.post(baseUrlSrv.getRestApiBase() + '/interpreter/repository', request) .success(function(data, status, headers, config) { - getRepositories(); - $scope.resetNewRepositorySetting(); - angular.element('#repoModal').modal('hide'); + getRepositories() + $scope.resetNewRepositorySetting() + angular.element('#repoModal').modal('hide') }).error(function(data, status, headers, config) { - console.log('Error %o %o', headers, config); - }); - }; + console.log('Error %o %o', headers, config) + }) + } $scope.removeRepository = function(repoId) { BootstrapDialog.confirm({ @@ -693,58 +693,57 @@ function InterpreterCtrl($rootScope, $scope, $http, baseUrlSrv, ngToast, $timeou if (result) { $http.delete(baseUrlSrv.getRestApiBase() + '/interpreter/repository/' + repoId) .success(function(data, status, headers, config) { - var index = _.findIndex($scope.repositories, {'id': repoId}); - $scope.repositories.splice(index, 1); + let index = _.findIndex($scope.repositories, {'id': repoId}) + $scope.repositories.splice(index, 1) }).error(function(data, status, headers, config) { - console.log('Error %o %o', status, data.message); - }); + console.log('Error %o %o', status, data.message) + }) } } - }); - }; + }) + } $scope.isDefaultRepository = function(repoId) { if (repoId === 'central' || repoId === 'local') { - return true; + return true } else { - return false; + return false } - }; + } $scope.showErrorMessage = function(setting) { BootstrapDialog.show({ title: 'Error downloading dependencies', message: setting.errorReason - }); - }; + }) + } - var init = function() { - getAvailableInterpreterPropertyWidgets(); + let init = function() { + getAvailableInterpreterPropertyWidgets() - $scope.resetNewInterpreterSetting(); - $scope.resetNewRepositorySetting(); + $scope.resetNewInterpreterSetting() + $scope.resetNewRepositorySetting() - getInterpreterSettings(); - getAvailableInterpreters(); - getRepositories(); - }; + getInterpreterSettings() + getAvailableInterpreters() + getRepositories() + } $scope.showSparkUI = function(settingId) { $http.get(baseUrlSrv.getRestApiBase() + '/interpreter/getmetainfos/' + settingId + '?propName=url') .success(function(data, status, headers, config) { - var url = data.body.url; + let url = data.body.url if (!url) { BootstrapDialog.alert({ message: 'No spark application running' - }); - return; + }) + return } - window.open(url, '_blank'); + window.open(url, '_blank') }).error(function(data, status, headers, config) { - console.log('Error %o %o', status, data.message); - }); - }; + console.log('Error %o %o', status, data.message) + }) + } - init(); + init() } - diff --git a/zeppelin-web/src/components/interpreter/widget/widget.number.directive.js b/zeppelin-web/src/components/interpreter/widget/widget.number.directive.js index 4a2f596660f..5d66cd1427e 100644 --- a/zeppelin-web/src/components/interpreter/widget/widget.number.directive.js +++ b/zeppelin-web/src/components/interpreter/widget/widget.number.directive.js @@ -12,21 +12,20 @@ * limitations under the License. */ -angular.module('zeppelinWebApp').directive('widgetNumber', numericOnly); +angular.module('zeppelinWebApp').directive('widgetNumber', numericOnly) function numericOnly() { return { require: 'ngModel', link: function (scope, element, attrs, modelCtrl) { modelCtrl.$parsers.push(function (inputValue) { - var transformedInput = inputValue ? inputValue.replace(/[^\d.-]/g, '') : null; + let transformedInput = inputValue ? inputValue.replace(/[^\d.-]/g, '') : null if (transformedInput !== inputValue) { - modelCtrl.$setViewValue(transformedInput); - modelCtrl.$render(); + modelCtrl.$setViewValue(transformedInput) + modelCtrl.$render() } - return transformedInput; - }); + return transformedInput + }) } - }; + } } - diff --git a/zeppelin-web/src/index.js b/zeppelin-web/src/index.js index a691c65e403..4ece4537e46 100644 --- a/zeppelin-web/src/index.js +++ b/zeppelin-web/src/index.js @@ -12,66 +12,66 @@ * limitations under the License. */ -import './app/app.js'; -import './app/app.controller.js'; -import './app/home/home.controller.js'; -import './app/handsontable/handsonHelper.js'; -import './app/notebook/notebook.controller.js'; +import './app/app.js' +import './app/app.controller.js' +import './app/home/home.controller.js' +import './app/handsontable/handsonHelper.js' +import './app/notebook/notebook.controller.js' -import './app/tabledata/tabledata.js'; -import './app/tabledata/transformation.js'; -import './app/tabledata/pivot.js'; -import './app/tabledata/passthrough.js'; -import './app/tabledata/columnselector.js'; -import './app/tabledata/advanced-transformation.js'; -import './app/visualization/visualization.js'; -import './app/visualization/builtins/visualization-table.js'; -import './app/visualization/builtins/visualization-nvd3chart.js'; -import './app/visualization/builtins/visualization-barchart.js'; -import './app/visualization/builtins/visualization-piechart.js'; -import './app/visualization/builtins/visualization-areachart.js'; -import './app/visualization/builtins/visualization-linechart.js'; -import './app/visualization/builtins/visualization-scatterchart.js'; +import './app/tabledata/tabledata.js' +import './app/tabledata/transformation.js' +import './app/tabledata/pivot.js' +import './app/tabledata/passthrough.js' +import './app/tabledata/columnselector.js' +import './app/tabledata/advanced-transformation.js' +import './app/visualization/visualization.js' +import './app/visualization/builtins/visualization-table.js' +import './app/visualization/builtins/visualization-nvd3chart.js' +import './app/visualization/builtins/visualization-barchart.js' +import './app/visualization/builtins/visualization-piechart.js' +import './app/visualization/builtins/visualization-areachart.js' +import './app/visualization/builtins/visualization-linechart.js' +import './app/visualization/builtins/visualization-scatterchart.js' -import './app/jobmanager/jobmanager.controller.js'; -import './app/jobmanager/jobs/job.controller.js'; -import './app/jobmanager/jobmanager.filter.js'; -import './app/interpreter/interpreter.controller.js'; -import './app/interpreter/interpreter.filter.js'; -import './app/credential/credential.controller.js'; -import './app/configuration/configuration.controller.js'; -import './app/notebook/paragraph/paragraph.controller.js'; -import './app/notebook/paragraph/result/result.controller.js'; -import './app/search/result-list.controller.js'; -import './app/notebookRepos/notebookRepos.controller.js'; -import './app/helium'; -import './components/arrayOrderingSrv/arrayOrdering.service.js'; -import './components/clipboard/clipboard.controller.js'; -import './components/navbar/navbar.controller.js'; -import './components/ngescape/ngescape.directive.js'; -import './components/interpreter/interpreter.directive.js'; -import './components/interpreter/widget/widget.number.directive.js'; -import './components/expandCollapse/expandCollapse.directive.js'; -import './components/noteName-create/notename.controller.js'; -import './components/noteName-import/notenameImport.controller.js'; -import './components/popover-html-unsafe/popover-html-unsafe.directive.js'; -import './components/popover-html-unsafe/popover-html-unsafe-popup.directive.js'; -import './components/editor/codeEditor.directive.js'; -import './components/ngenter/ngenter.directive.js'; -import './components/dropdowninput/dropdowninput.directive.js'; -import './components/resizable/resizable.directive.js'; -import './components/noteName-create/visible.directive.js'; -import './components/websocketEvents/websocketMsg.service.js'; -import './components/websocketEvents/websocketEvents.factory.js'; -import './components/noteListDataFactory/noteList.datafactory.js'; -import './components/baseUrl/baseUrl.service.js'; -import './components/browser-detect/browserDetect.service.js'; -import './components/saveAs/saveAs.service.js'; -import './components/searchService/search.service.js'; -import './components/login/login.controller.js'; -import './components/elasticInputCtrl/elasticInput.controller.js'; -import './components/noteAction/noteAction.service.js'; -import './components/notevarshareService/notevarshare.service.js'; -import './components/rename/rename.controller.js'; -import './components/rename/rename.service.js'; -import './components/helium/helium.service.js'; +import './app/jobmanager/jobmanager.controller.js' +import './app/jobmanager/jobs/job.controller.js' +import './app/jobmanager/jobmanager.filter.js' +import './app/interpreter/interpreter.controller.js' +import './app/interpreter/interpreter.filter.js' +import './app/credential/credential.controller.js' +import './app/configuration/configuration.controller.js' +import './app/notebook/paragraph/paragraph.controller.js' +import './app/notebook/paragraph/result/result.controller.js' +import './app/search/result-list.controller.js' +import './app/notebookRepos/notebookRepos.controller.js' +import './app/helium' +import './components/arrayOrderingSrv/arrayOrdering.service.js' +import './components/clipboard/clipboard.controller.js' +import './components/navbar/navbar.controller.js' +import './components/ngescape/ngescape.directive.js' +import './components/interpreter/interpreter.directive.js' +import './components/interpreter/widget/widget.number.directive.js' +import './components/expandCollapse/expandCollapse.directive.js' +import './components/noteName-create/notename.controller.js' +import './components/noteName-import/notenameImport.controller.js' +import './components/popover-html-unsafe/popover-html-unsafe.directive.js' +import './components/popover-html-unsafe/popover-html-unsafe-popup.directive.js' +import './components/editor/codeEditor.directive.js' +import './components/ngenter/ngenter.directive.js' +import './components/dropdowninput/dropdowninput.directive.js' +import './components/resizable/resizable.directive.js' +import './components/noteName-create/visible.directive.js' +import './components/websocketEvents/websocketMsg.service.js' +import './components/websocketEvents/websocketEvents.factory.js' +import './components/noteListDataFactory/noteList.datafactory.js' +import './components/baseUrl/baseUrl.service.js' +import './components/browser-detect/browserDetect.service.js' +import './components/saveAs/saveAs.service.js' +import './components/searchService/search.service.js' +import './components/login/login.controller.js' +import './components/elasticInputCtrl/elasticInput.controller.js' +import './components/noteAction/noteAction.service.js' +import './components/notevarshareService/notevarshare.service.js' +import './components/rename/rename.controller.js' +import './components/rename/rename.service.js' +import './components/helium/helium.service.js'