mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Persist 'runOnSelectionChange' under note.json's config field
This commit is contained in:
parent
4904f38659
commit
47dcb5f64a
4 changed files with 24 additions and 15 deletions
|
|
@ -262,7 +262,7 @@ public class ParagraphActionsIT extends AbstractZeppelinIT {
|
|||
return;
|
||||
}
|
||||
try {
|
||||
String xpathToCheckbox = getParagraphXPath(1) + "//ul/li/form/input[contains(@class, 'ng-not-empty')]";
|
||||
String xpathToCheckbox = getParagraphXPath(1) + "//ul/li/form/input[contains(@ng-checked, 'true')]";
|
||||
|
||||
createNewNote();
|
||||
|
||||
|
|
@ -272,12 +272,12 @@ public class ParagraphActionsIT extends AbstractZeppelinIT {
|
|||
|
||||
driver.findElement(By.xpath(getParagraphXPath(1) + "//span[@class='icon-settings']")).click();
|
||||
collector.checkThat("'Run on selection change' checkbox will be shown under dropdown menu ",
|
||||
driver.findElement(By.xpath(getParagraphXPath(1) + "//ul/li/form/input[contains(@ng-model, 'isAutoRunTrue')]")).isDisplayed(),
|
||||
driver.findElement(By.xpath(getParagraphXPath(1) + "//ul/li/form/input[contains(@ng-click, 'turnOnAutoRun(paragraph)')]")).isDisplayed(),
|
||||
CoreMatchers.equalTo(true));
|
||||
|
||||
driver.findElement(By.xpath(xpathToCheckbox)).click();
|
||||
collector.checkThat("If 'Run on selection change' checkbox is unchecked, 'isAutoRunTrue' will be false ",
|
||||
driver.findElement(By.xpath(getParagraphXPath(1) + "//ul/li/span[contains(@ng-if, 'isAutoRunTrue == false')]")).isDisplayed(),
|
||||
collector.checkThat("If 'Run on selection change' checkbox is unchecked, 'paragraph.config.runOnSelectionChange' will be false ",
|
||||
driver.findElement(By.xpath(getParagraphXPath(1) + "//ul/li/span[contains(@ng-if, 'paragraph.config.runOnSelectionChange == false')]")).isDisplayed(),
|
||||
CoreMatchers.equalTo(true));
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -92,14 +92,14 @@ limitations under the License.
|
|||
<li style="padding-top:8px"
|
||||
ng-if="paragraph.settings.forms[$root.keys(paragraph.settings.forms)].options &&
|
||||
paragraph.settings.forms[$root.keys(paragraph.settings.forms)].type != 'checkbox'">
|
||||
<span ng-if="isAutoRunTrue == true" class="fa fa-toggle-on shortcut-icon" style="padding:3px 8px 8px 20px"></span>
|
||||
<span ng-if="isAutoRunTrue == false" class="fa fa-toggle-off shortcut-icon" style="padding:3px 8px 8px 20px"></span>Run on selection change
|
||||
<span ng-if="paragraph.config.runOnSelectionChange == true" class="fa fa-toggle-on shortcut-icon" style="padding:3px 8px 8px 20px"></span>
|
||||
<span ng-if="paragraph.config.runOnSelectionChange == false" class="fa fa-toggle-off shortcut-icon" style="padding:3px 8px 8px 20px"></span>Run on selection change
|
||||
<form style="display:inline; float:right">
|
||||
<input type="checkbox"
|
||||
style="width:16px; margin-right:20px"
|
||||
tooltip-placement="top" tooltip="Even if you uncheck this, still can run the paragraph by pressing Enter"
|
||||
ng-model="isAutoRunTrue"
|
||||
ng-change="turnOnAutoRun()"/>
|
||||
ng-checked="{{paragraph.config.runOnSelectionChange}}"
|
||||
ng-click="turnOnAutoRun(paragraph)"/>
|
||||
</form>
|
||||
</li>
|
||||
<li>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ limitations under the License.
|
|||
ng-class="{'disable': paragraph.status == 'RUNNING' || paragraph.status == 'PENDING' }"
|
||||
name="{{formulaire.name}}" />
|
||||
</div>
|
||||
<div ng-if="isAutoRunTrue == true">
|
||||
<div ng-if="paragraph.config.runOnSelectionChange == true">
|
||||
<select class="form-control input-sm"
|
||||
ng-if="paragraph.settings.forms[formulaire.name].options && paragraph.settings.forms[formulaire.name].type != 'checkbox'"
|
||||
ng-change="runParagraphFromButton(getEditorValue())"
|
||||
|
|
@ -36,7 +36,7 @@ limitations under the License.
|
|||
ng-options="option.value as (option.displayName||option.value) for option in paragraph.settings.forms[formulaire.name].options">
|
||||
</select>
|
||||
</div>
|
||||
<div ng-if="isAutoRunTrue == false">
|
||||
<div ng-if="paragraph.config.runOnSelectionChange == false">
|
||||
<select class="form-control input-sm"
|
||||
ng-if="paragraph.settings.forms[formulaire.name].options && paragraph.settings.forms[formulaire.name].type != 'checkbox'"
|
||||
ng-enter="runParagraphFromButton(getEditorValue())"
|
||||
|
|
|
|||
|
|
@ -114,8 +114,6 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
if (!$scope.paragraph.config) {
|
||||
$scope.paragraph.config = {};
|
||||
}
|
||||
// set dynamic select form's 'Auto Run' true by default
|
||||
$scope.isAutoRunTrue = true;
|
||||
|
||||
noteVarShareService.put($scope.paragraph.id + '_paragraphScope', paragraphScope);
|
||||
|
||||
|
|
@ -123,14 +121,24 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
};
|
||||
|
||||
var initializeDefault = function(config) {
|
||||
var forms = $scope.paragraph.settings.forms;
|
||||
|
||||
if (!config.colWidth) {
|
||||
config.colWidth = 12;
|
||||
}
|
||||
|
||||
|
||||
if (config.enabled === undefined) {
|
||||
config.enabled = true;
|
||||
}
|
||||
|
||||
if (forms[Object.keys(forms)]) {
|
||||
if (forms[Object.keys(forms)].options && forms[Object.keys(forms)].type !== 'checkbox') {
|
||||
if (config.runOnSelectionChange === undefined) {
|
||||
config.runOnSelectionChange = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!config.results) {
|
||||
config.results = {};
|
||||
}
|
||||
|
|
@ -379,8 +387,9 @@ function ParagraphCtrl($scope, $rootScope, $route, $window, $routeParams, $locat
|
|||
$scope.runParagraph(paragraphText, false, false)
|
||||
};
|
||||
|
||||
$scope.turnOnAutoRun = function () {
|
||||
$scope.isAutoRunTrue = !$scope.isAutoRunTrue;
|
||||
$scope.turnOnAutoRun = function (paragraph) {
|
||||
paragraph.config.runOnSelectionChange = !paragraph.config.runOnSelectionChange;
|
||||
commitParagraph(paragraph);
|
||||
};
|
||||
|
||||
$scope.moveUp = function(paragraph) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue