This commit is contained in:
Lee moon soo 2016-04-12 14:13:16 +02:00
parent be3a1fa7b3
commit 5503f9c100
8 changed files with 51 additions and 26 deletions

View file

@ -141,8 +141,6 @@ public class ApplicationLoader {
return new ResourceSet();
}
String localResourcePoolId = resourcePool.id();
ResourceSet args = new ResourceSet();
ResourceSet allResources;
if (resourcePool instanceof DistributedResourcePool) {
allResources = ((DistributedResourcePool) resourcePool).getAll(false);
@ -171,9 +169,14 @@ public class ApplicationLoader {
boolean found = false;
for (Resource r : resources) {
if (r.getClassName().equals(require)) {
args.add(r);
if (require.startsWith(":") && r.getClassName().equals(require)) {
found = true;
} else if (r.getResourceId().getName().equals(require)) {
found = true;
}
if (found) {
args.add(r);
break;
}
}

View file

@ -96,7 +96,7 @@ public class RemoteAngularObjectRegistry extends AngularObjectRegistry {
public AngularObject removeAndNotifyRemoteProcess(String name, String noteId, String
paragraphId) {
RemoteInterpreterProcess remoteInterpreterProcess = getRemoteInterpreterProcess();
if (!remoteInterpreterProcess.isRunning()) {
if (remoteInterpreterProcess == null || !remoteInterpreterProcess.isRunning()) {
return super.remove(name, noteId, paragraphId);
}

View file

@ -362,11 +362,13 @@ public class RemoteInterpreterServer
}
// put result into resource pool
context.getResourcePool().put(
context.getNoteId(),
context.getParagraphId(),
WellKnownResourceName.ParagraphResult.toString(),
combinedResult);
if (combinedResult.type() == InterpreterResult.Type.TABLE) {
context.getResourcePool().put(
context.getNoteId(),
context.getParagraphId(),
WellKnownResourceName.ZeppelinTableResult.toString(),
combinedResult);
}
return combinedResult;
} finally {
InterpreterContext.remove();

View file

@ -20,7 +20,7 @@ package org.apache.zeppelin.resource;
* Well known resource names in ResourcePool
*/
public enum WellKnownResourceName {
ParagraphResult("zeppelin.paragraph.result"); // paragraph run result
ZeppelinTableResult("zeppelin.paragraph.result.table"); // paragraph run result
String name;
WellKnownResourceName(String name) {

View file

@ -46,6 +46,13 @@ limitations under the License.
ng-class="{'active': isGraphMode('scatterChart')}"
ng-click="setGraphMode('scatterChart', true)"><i class="cf cf-scatter-chart"></i>
</button>
<button type="button"
ng-if="paragraph.result.type != 'TABLE'"
ng-click="switchApp()"
ng-class="{'active' : !paragraph.config.helium.activeApp}"
class="btn btn-default btn-sm"><i class="fa fa-terminal"></i>
</button>
<button type="button"
class="btn btn-default btn-sm"
ng-repeat="app in apps"
@ -64,17 +71,21 @@ limitations under the License.
class="btn btn-default btn-sm dropdown-toggle"
ng-if="suggestion.available && suggestion.available.length > 0"
data-toggle="dropdown"
style="font-weight:bold">
Helium
style="font-weight:bold; background-color:#ffdf96; border: 1px solid #FED233">
He
</button>
<ul class="dropdown-menu"
style="z-index:1002"
ng-if="suggestion.available && suggestion.available.length > 0"
role="menu">
<li class="appSuggestion">
<div ng-repeat="pkgInfo in suggestion.available">
<a ng-click="loadApp(pkgInfo.pkg)">
{{pkgInfo.pkg.name}}
</a>
<button type="button"
class="btn btn-default btn-sm"
ng-click="loadApp(pkgInfo.pkg)"
ng-bind-html="pkgInfo.pkg.icon">
</button>
<span class="inline">{{pkgInfo.pkg.name}}</span>
</div>
</li>
</ul>

View file

@ -366,12 +366,15 @@ angular.module('zeppelinWebApp')
var newType = $scope.getResultType(data.paragraph);
var oldGraphMode = $scope.getGraphMode();
var newGraphMode = $scope.getGraphMode(data.paragraph);
var resultRefreshed = (data.paragraph.dateFinished !== $scope.paragraph.dateFinished) || isEmpty(data.paragraph.result) !== isEmpty($scope.paragraph.result);
var oldActiveApp = _.get($scope.paragraph.config, 'helium.activeApp');
var newActiveApp = _.get(data.paragraph.config, 'helium.activeApp');
var resultRefreshed = (data.paragraph.dateFinished !== $scope.paragraph.dateFinished) ||
isEmpty(data.paragraph.result) !== isEmpty($scope.paragraph.result) ||
(!newActiveApp && oldActiveApp !== newActiveApp);
var statusChanged = (data.paragraph.status !== $scope.paragraph.status);
var oldActiveApp = _.get($scope.paragraph.config, 'helium.activeApp');
var newActiveApp = _.get(data.paragraph.config, 'helium.activeApp');
//console.log("updateParagraph oldData %o, newData %o. type %o -> %o, mode %o -> %o", $scope.paragraph, data, oldType, newType, oldGraphMode, newGraphMode);
@ -2367,9 +2370,8 @@ angular.module('zeppelinWebApp')
$scope.apps.push(app);
$scope.paragraph.apps.push(app);
$scope.switchApp(app.id);
}
$scope.switchApp(app.id);
}
});

View file

@ -434,3 +434,8 @@ table.table-striped {
position: absolute;
right: 15px;
}
.appSuggestion {
width: 200px;
padding: 5px 10px 5px 10px;
}

View file

@ -141,12 +141,14 @@ public class Helium {
ResourcePool resourcePool = intp.getInterpreterGroup().getResourcePool();
ResourceSet allResources;
if (resourcePool == null) {
allResources = new ResourceSet();
} else if (resourcePool instanceof DistributedResourcePool) {
allResources = ((DistributedResourcePool) resourcePool).getAll(false);
if (resourcePool != null) {
if (resourcePool instanceof DistributedResourcePool) {
allResources = ((DistributedResourcePool) resourcePool).getAll(true);
} else {
allResources = resourcePool.getAll();
}
} else {
allResources = resourcePool.getAll();
allResources = ResourcePoolUtils.getAllResources();
}
for (HeliumPackageSearchResult pkg : getAllPackageInfo()) {