mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Display license of package when enabling
This commit is contained in:
parent
28fb37d788
commit
816bdeccc0
10 changed files with 63 additions and 5 deletions
|
|
@ -43,6 +43,7 @@ Here's an example `helium/zeppelin-example-horizontalbar.json`
|
|||
"name" : "zeppelin_horizontalbar",
|
||||
"description" : "Horizontal Bar chart (example)",
|
||||
"artifact" : "./zeppelin-examples/zeppelin-example-horizontalbar",
|
||||
"license" : "Apache-2.0",
|
||||
"icon" : "<i class='fa fa-bar-chart rotate90flipX'></i>"
|
||||
}
|
||||
```
|
||||
|
|
@ -138,6 +139,7 @@ Json file contains the following information
|
|||
"type" : "VISUALIZATION",
|
||||
"name" : "zeppelin_horizontalbar",
|
||||
"description" : "Horizontal Bar chart (example)",
|
||||
"license" : "Apache-2.0",
|
||||
"artifact" : "./zeppelin-examples/zeppelin-example-horizontalbar",
|
||||
"icon" : "<i class='fa fa-bar-chart rotate90flipX'></i>"
|
||||
}
|
||||
|
|
@ -176,6 +178,16 @@ When artifact exists in local file system
|
|||
artifact: "/path/to/my/visualization"
|
||||
```
|
||||
|
||||
##### license
|
||||
|
||||
License information.
|
||||
|
||||
e.g.
|
||||
|
||||
```
|
||||
license: "Apache-2.0"
|
||||
```
|
||||
|
||||
##### icon
|
||||
|
||||
Icon to be used in visualization select button. String in this field will be rendered as a HTML tag.
|
||||
|
|
|
|||
|
|
@ -21,5 +21,6 @@
|
|||
"artifact" : "zeppelin-examples/zeppelin-example-clock/target/zeppelin-example-clock-0.7.0-SNAPSHOT.jar",
|
||||
"className" : "org.apache.zeppelin.example.app.clock.Clock",
|
||||
"resources" : [[":java.util.Date"]],
|
||||
"license" : "Apache-2.0",
|
||||
"icon" : '<i class="fa fa-clock-o"></i>'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,5 +19,6 @@
|
|||
"name" : "zeppelin_horizontalbar",
|
||||
"description" : "Horizontal Bar chart (example)",
|
||||
"artifact" : "./zeppelin-examples/zeppelin-example-horizontalbar",
|
||||
"license" : "Apache-2.0",
|
||||
"icon" : "<i class='fa fa-bar-chart rotate90flipX'></i>"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,9 @@ public class HeliumPackage {
|
|||
private String className; // entry point
|
||||
private String [][] resources; // resource classnames that requires
|
||||
// [[ .. and .. and .. ] or [ .. and .. and ..] ..]
|
||||
private String license;
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* Type of package
|
||||
*/
|
||||
|
|
@ -47,6 +49,7 @@ public class HeliumPackage {
|
|||
String artifact,
|
||||
String className,
|
||||
String[][] resources,
|
||||
String license,
|
||||
String icon) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
|
|
@ -54,6 +57,7 @@ public class HeliumPackage {
|
|||
this.artifact = artifact;
|
||||
this.className = className;
|
||||
this.resources = resources;
|
||||
this.license = license;
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
|
|
@ -96,6 +100,9 @@ public class HeliumPackage {
|
|||
return resources;
|
||||
}
|
||||
|
||||
public String getLicense() {
|
||||
return license;
|
||||
}
|
||||
public String getIcon() {
|
||||
return icon;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ public class ApplicationLoaderTest {
|
|||
artifact,
|
||||
className,
|
||||
new String[][]{{}},
|
||||
"license",
|
||||
"icon");
|
||||
return app1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,13 +117,42 @@
|
|||
});
|
||||
}
|
||||
|
||||
var getLicense = function(name, artifact) {
|
||||
var pkg = _.filter($scope.defaultVersions[name], function(p) {
|
||||
return p.artifact === artifact;
|
||||
});
|
||||
|
||||
var license;
|
||||
if (pkg.length === 0) {
|
||||
pkg = _.filter($scope.packageInfos[name], function(p) {
|
||||
return p.pkg.artifact === artifact;
|
||||
});
|
||||
|
||||
if (pkg.length > 0) {
|
||||
license = pkg[0].pkg.license;
|
||||
}
|
||||
} else {
|
||||
license = pkg[0].license;
|
||||
}
|
||||
|
||||
if (!license) {
|
||||
license = 'Unknown';
|
||||
}
|
||||
return license;
|
||||
}
|
||||
|
||||
$scope.enable = function(name, artifact) {
|
||||
var license = getLicense(name, artifact);
|
||||
|
||||
var confirm = BootstrapDialog.confirm({
|
||||
closable: false,
|
||||
closeByBackdrop: false,
|
||||
closeByKeyboard: false,
|
||||
title: '',
|
||||
message: 'Do you want to enable ' + name + '? <div style="color:gray">' + artifact + '</div>',
|
||||
message: 'Do you want to enable ' + name + '?' +
|
||||
'<div style="color:gray">' + artifact + '</div>' +
|
||||
'<div style="border-top: 1px solid #efefef; margin-top: 10px; padding-top: 5px;">License</div>' +
|
||||
'<div style="color:gray">' + license + '</div>',
|
||||
callback: function(result) {
|
||||
if (result) {
|
||||
confirm.$modalFooter.find('button').addClass('disabled');
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ public class HeliumApplicationFactoryTest implements JobListenerFactory {
|
|||
"",
|
||||
HeliumTestApplication.class.getName(),
|
||||
new String[][]{},
|
||||
"");
|
||||
"", "");
|
||||
|
||||
Note note1 = notebook.createNote(anonymous);
|
||||
factory.setInterpreters("user", note1.getId(),factory.getDefaultInterpreterSettingList());
|
||||
|
|
@ -181,7 +181,7 @@ public class HeliumApplicationFactoryTest implements JobListenerFactory {
|
|||
"",
|
||||
HeliumTestApplication.class.getName(),
|
||||
new String[][]{},
|
||||
"");
|
||||
"", "");
|
||||
|
||||
Note note1 = notebook.createNote(anonymous);
|
||||
factory.setInterpreters("user", note1.getId(), factory.getDefaultInterpreterSettingList());
|
||||
|
|
@ -221,7 +221,7 @@ public class HeliumApplicationFactoryTest implements JobListenerFactory {
|
|||
"",
|
||||
HeliumTestApplication.class.getName(),
|
||||
new String[][]{},
|
||||
"");
|
||||
"", "");
|
||||
|
||||
Note note1 = notebook.createNote(anonymous);
|
||||
notebook.bindInterpretersToNote("user", note1.getId(), factory.getDefaultInterpreterSettingList());
|
||||
|
|
@ -282,7 +282,7 @@ public class HeliumApplicationFactoryTest implements JobListenerFactory {
|
|||
"",
|
||||
HeliumTestApplication.class.getName(),
|
||||
new String[][]{},
|
||||
"");
|
||||
"", "");
|
||||
|
||||
Note note1 = notebook.createNote(anonymous);
|
||||
notebook.bindInterpretersToNote("user", note1.getId(), factory.getDefaultInterpreterSettingList());
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ public class HeliumLocalRegistryTest {
|
|||
"artifact1",
|
||||
"classname1",
|
||||
new String[][]{},
|
||||
"license",
|
||||
"");
|
||||
FileUtils.writeStringToFile(new File(r1Path, "pkg1.json"), gson.toJson(pkg1));
|
||||
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ public class HeliumTest {
|
|||
"artifact1",
|
||||
"className1",
|
||||
new String[][]{},
|
||||
"",
|
||||
""));
|
||||
|
||||
registry2.add(new HeliumPackage(
|
||||
|
|
@ -99,6 +100,7 @@ public class HeliumTest {
|
|||
"artifact2",
|
||||
"className2",
|
||||
new String[][]{},
|
||||
"",
|
||||
""));
|
||||
|
||||
// then
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ public class HeliumVisualizationFactoryTest {
|
|||
"lodash@3.9.3",
|
||||
"",
|
||||
null,
|
||||
"license",
|
||||
"icon"
|
||||
);
|
||||
hvf.install(pkg);
|
||||
|
|
@ -88,6 +89,7 @@ public class HeliumVisualizationFactoryTest {
|
|||
"zeppelin-bubblechart@0.0.3",
|
||||
"",
|
||||
null,
|
||||
"license",
|
||||
"icon"
|
||||
);
|
||||
List<HeliumPackage> pkgs = new LinkedList<>();
|
||||
|
|
@ -115,6 +117,7 @@ public class HeliumVisualizationFactoryTest {
|
|||
localPkg,
|
||||
"",
|
||||
null,
|
||||
"license",
|
||||
"fa fa-coffee"
|
||||
);
|
||||
List<HeliumPackage> pkgs = new LinkedList<>();
|
||||
|
|
@ -136,6 +139,7 @@ public class HeliumVisualizationFactoryTest {
|
|||
localPkg,
|
||||
"",
|
||||
null,
|
||||
"license",
|
||||
"fa fa-coffee"
|
||||
);
|
||||
List<HeliumPackage> pkgs = new LinkedList<>();
|
||||
|
|
|
|||
Loading…
Reference in a new issue