You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by ah...@apache.org on 2017/02/16 01:24:04 UTC

zeppelin git commit: [ZEPPELIN-2099] Add NPM link for helium pkgs published in npm

Repository: zeppelin
Updated Branches:
  refs/heads/master d053e5b33 -> 7805dd8c9


[ZEPPELIN-2099] Add NPM link for helium pkgs published in npm

### What is this PR for?

Add NPM link for helium pkgs published in npm while coloring grey for local packages to distinguish easily.

### What type of PR is it?
[Improvement]

### TODOs

- [x] Add link to published npm packages
- [x] Grey color for local to distinguish

### What is the Jira issue?

[ZEPPELIN-2099](https://issues.apache.org/jira/browse/ZEPPELIN-2099)

### How should this be tested?

1. Build Zeppelin using ` mvn clean package -Phelium-dev-Pexamples -DskipTests;` for creating helium examples.
2. Open the `/helium` page

- click the name of published npm package.
- check color of local package.

### Screenshots (if appropriate)

#### NPM Link
![npm-link](https://cloud.githubusercontent.com/assets/4968473/22859688/2d0322f6-f128-11e6-83db-b1a0013a04bf.gif)

#### Local Package Name Color
![image](https://cloud.githubusercontent.com/assets/4968473/22859724/f36866e4-f129-11e6-8bf2-dfd5a69b536e.png)

### Questions:
* Does the licenses files need update? - NO
* Is there breaking changes for older versions? - NO
* Does this needs documentation? - NO

Author: 1ambda <1a...@gmail.com>

Closes #2006 from 1ambda/ZEPPELIN-2099/adding-npm-link-to-helium-pkg and squashes the following commits:

659bb03 [1ambda] fix: isLocalPackage condition
d4ac923 [1ambda] feat: Add color to local packages
3ff460e [1ambda] feat: Add npm link for helium pkgs published in npm


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/7805dd8c
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/7805dd8c
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/7805dd8c

Branch: refs/heads/master
Commit: 7805dd8c92aa1d8c3a3a36f5ac7a9ab68e40df7a
Parents: d053e5b
Author: 1ambda <1a...@gmail.com>
Authored: Mon Feb 13 00:16:29 2017 +0900
Committer: ahyoungryu <ah...@apache.org>
Committed: Thu Feb 16 10:23:54 2017 +0900

----------------------------------------------------------------------
 zeppelin-web/src/app/helium/helium.controller.js | 13 +++++++++++++
 zeppelin-web/src/app/helium/helium.css           |  6 ++++++
 zeppelin-web/src/app/helium/helium.html          |  7 ++++++-
 3 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7805dd8c/zeppelin-web/src/app/helium/helium.controller.js
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/helium/helium.controller.js b/zeppelin-web/src/app/helium/helium.controller.js
index 7734180..fafa4ec 100644
--- a/zeppelin-web/src/app/helium/helium.controller.js
+++ b/zeppelin-web/src/app/helium/helium.controller.js
@@ -12,6 +12,8 @@
  * limitations under the License.
  */
 
+import { HeliumType, } from '../../components/helium/helium-type';
+
 angular.module('zeppelinWebApp').controller('HeliumCtrl', HeliumCtrl);
 
 function HeliumCtrl($scope, $rootScope, $sce, baseUrlSrv, ngToast, heliumService) {
@@ -213,4 +215,15 @@ function HeliumCtrl($scope, $rootScope, $sce, baseUrlSrv, ngToast, heliumService
       $scope.showVersions[pkgName] = true;
     }
   };
+
+  $scope.isLocalPackage = function(pkgSearchResult) {
+    const pkg = pkgSearchResult.pkg;
+    return pkg.artifact && !pkg.artifact.includes('@');
+  };
+
+  $scope.hasNpmLink = function(pkgSearchResult) {
+    const pkg = pkgSearchResult.pkg;
+    return (pkg.type === HeliumType.SPELL || pkg.type === HeliumType.VISUALIZATION) &&
+      !$scope.isLocalPackage(pkgSearchResult);
+  };
 }

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7805dd8c/zeppelin-web/src/app/helium/helium.css
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/helium/helium.css b/zeppelin-web/src/app/helium/helium.css
index e66797d..c8643a4 100644
--- a/zeppelin-web/src/app/helium/helium.css
+++ b/zeppelin-web/src/app/helium/helium.css
@@ -127,3 +127,9 @@
   underline;color:#3071a9;
   display: inline-block;
 }
+
+.heliumLocalPackage {
+  color: #636363;
+}
+
+

http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7805dd8c/zeppelin-web/src/app/helium/helium.html
----------------------------------------------------------------------
diff --git a/zeppelin-web/src/app/helium/helium.html b/zeppelin-web/src/app/helium/helium.html
index 341ade3..f67797c 100644
--- a/zeppelin-web/src/app/helium/helium.html
+++ b/zeppelin-web/src/app/helium/helium.html
@@ -51,7 +51,12 @@ limitations under the License.
         <div class="heliumPackageIcon"
              ng-bind-html=pkgInfo.pkg.icon></div>
         <div class="heliumPackageName">
-          {{pkgName}}
+          <span ng-if="hasNpmLink(pkgInfo)">
+            <a target="_blank" href="https://www.npmjs.com/package/{{pkgName}}">{{pkgName}}</a>
+          </span>
+          <span ng-if="!hasNpmLink(pkgInfo)" ng-class="{'heliumLocalPackage': isLocalPackage(pkgInfo)}">
+            {{pkgName}}
+          </span>
           <span class="heliumType">{{pkgInfo.pkg.type}}</span>
         </div>
         <div ng-show="!pkgInfo.enabled"