ZEPPELIN-2403 did properties immutable, added new type 'checkbox'

This commit is contained in:
Tinkoff DWH 2017-04-17 13:38:59 +05:00
parent 14353b1200
commit dd5d6c809a
21 changed files with 104 additions and 99 deletions

View file

@ -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": {

View file

@ -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": {

View file

@ -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"
}
}
},

View file

@ -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,

View file

@ -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": {

View file

@ -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,

View file

@ -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": {

View file

@ -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": {

View file

@ -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",

View file

@ -526,14 +526,15 @@ public class SparkInterpreter extends Interpreter {
}
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 @@ public class SparkInterpreter extends Interpreter {
}
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 {

View file

@ -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": {

View file

@ -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",

View file

@ -23,11 +23,11 @@ package org.apache.zeppelin.interpreter;
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 class DefaultInterpreterProperty {
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 class DefaultInterpreterProperty {
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 class DefaultInterpreterProperty {
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) {

View file

@ -156,9 +156,9 @@ public abstract class Interpreter {
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());
}
}
}

View file

@ -22,10 +22,10 @@ package org.apache.zeppelin.interpreter;
*/
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 class InterpreterProperty {
this.name = name;
}
public String getValue() {
public Object getValue() {
return value;
}
public void setValue(String value) {
public void setValue(Object value) {
this.value = value;
}

View file

@ -22,5 +22,6 @@ package org.apache.zeppelin.interpreter;
*/
public enum InterpreterPropertyType {
text,
password
password,
checkbox
}

View file

@ -209,7 +209,7 @@ public abstract class AbstractTestRestApi {
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 @@ public abstract class AbstractTestRestApi {
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;
}

View file

@ -272,27 +272,23 @@ limitations under the License.
<tr>
<th>name</th>
<th>value</th>
<th style="width: 10%;">type</th>
<th>description</th>
<th>action</th>
<th>description</th>
</tr>
<tr ng-repeat="key in newInterpreterSetting.properties | sortByKey">
<td>{{key}}</td>
<td style="vertical-align: middle;" ng-switch on="newInterpreterSetting.properties[key].type">
<textarea ng-switch-default msd-elastic ng-model="newInterpreterSetting.properties[key].value"></textarea>
<input ng-switch-when="password" type="password" msd-elastic ng-model="newInterpreterSetting.properties[key].value" />
</td>
<td style="vertical-align: middle;">
<select ng-model="newInterpreterSetting.properties[key].type" ng-options="item for item in interpreterPropertyTypes">
</select>
</td>
<td style="vertical-align: middle;">
{{newInterpreterSetting.properties[key].description}}
<input ng-switch-when="checkbox" type="checkbox" msd-elastic ng-model="newInterpreterSetting.properties[key].value" />
</td>
<td style="vertical-align: middle;">
<button class="btn btn-default btn-sm fa fa-remove" ng-click="removeInterpreterProperty(key)">
</button>
</td>
<td style="vertical-align: middle;">
{{newInterpreterSetting.properties[key].description}}
</td>
</tr>
<tr>
@ -303,17 +299,16 @@ limitations under the License.
<td style="vertical-align: middle;" ng-switch on="newInterpreterSetting.propertyType">
<textarea ng-switch-default msd-elastic ng-model="newInterpreterSetting.propertyValue"></textarea>
<input ng-switch-when="password" type="password" msd-elastic ng-model="newInterpreterSetting.propertyValue" />
<input ng-switch-when="checkbox" type="checkbox" msd-elastic ng-model="newInterpreterSetting.propertyValue" />
</td>
<td style="vertical-align: middle;">
<select ng-model="newInterpreterSetting.propertyType" ng-init="newInterpreterSetting.propertyType=interpreterPropertyTypes[0]"
ng-options="item for item in interpreterPropertyTypes">
<select msd-elastic ng-model="newInterpreterSetting.propertyType" ng-init="newInterpreterSetting.propertyType=interpreterPropertyTypes[0]"
ng-options="item for item in interpreterPropertyTypes" ng-change="defaultValueByType(newInterpreterSetting)">
</select>
</td>
<td></td>
<td style="vertical-align: middle;">
<button class="btn btn-default btn-sm fa fa-plus" ng-click="addNewInterpreterProperty()">
</button>
</td>
<td></td>
</tr>
</table>
</div>

View file

@ -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) {

View file

@ -395,8 +395,7 @@ limitations under the License.
<tr>
<th style="width:40%">name</th>
<th style="width:40%">value</th>
<th style="width:10%" ng-if="valueform.$visible">type</th>
<th style="width:10%" ng-if="valueform.$visible">action</th>
<th style="width:20%" ng-if="valueform.$visible">action</th>
</tr>
</thead>
<tr ng-repeat="key in setting.properties | sortByKey" >
@ -408,10 +407,9 @@ limitations under the License.
<span ng-switch-when="password" editable-password="setting.properties[key].value" e-form="valueform" e-msd-elastic>
{{setting.properties[key].value ? '***' : ''}}
</span>
</td>
<td style="vertical-align: middle;" ng-if="valueform.$visible">
<select ng-model="setting.properties[key].type" ng-options="item for item in interpreterPropertyTypes">
</select>
<span ng-switch-when="checkbox" editable-checkbox="setting.properties[key].value" e-form="valueform" e-msd-elastic>
{{setting.properties[key].value}}
</span>
</td>
<td style="vertical-align: middle;" ng-if="valueform.$visible">
<button class="btn btn-default btn-sm fa fa-remove"
@ -428,13 +426,12 @@ limitations under the License.
<td style="vertical-align: middle;" ng-switch on="setting.propertyType">
<textarea ng-switch-default msd-elastic ng-model="setting.propertyValue"></textarea>
<input ng-switch-when="password" type="password" msd-elastic ng-model="setting.propertyValue" />
<input ng-switch-when="checkbox" type="checkbox" msd-elastic ng-model="setting.propertyValue" />
</td>
<td style="vertical-align: middle;">
<select ng-model="setting.propertyType" ng-init="setting.propertyType=interpreterPropertyTypes[0]"
ng-options="item for item in interpreterPropertyTypes">
ng-options="item for item in interpreterPropertyTypes" ng-change="defaultValueByType(setting)">
</select>
</td>
<td style="vertical-align: middle;">
<button class="btn btn-default btn-sm fa fa-plus"
ng-click="addNewInterpreterProperty(setting.id)">
</button>

View file

@ -280,7 +280,8 @@ public class InterpreterSetting {
Map<String, InterpreterProperty> propertyMap = (Map<String, InterpreterProperty>) 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;