You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Nihal Jain (Jira)" <ji...@apache.org> on 2023/04/18 15:40:00 UTC

[jira] [Commented] (HBASE-27802) Manage static javascript resources programatically

    [ https://issues.apache.org/jira/browse/HBASE-27802?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17713633#comment-17713633 ] 

Nihal Jain commented on HBASE-27802:
------------------------------------

Have been looking into [https://bower.io/] to a possible solution. I have done a small PoC to try the same. Would like to hear what others think of this.

Steps to reproduce PoC:
 * Install NPM:
 ** [https://docs.npmjs.com/downloading-and-installing-node-js-and-npm]
 * Install bower:
 ** npm install -g bower

 * PoC Steps
 ** 
{code:java}
## CREATE .bowerrc with following content
➜  cat .bowerrc
{
  "directory": "public",
  "analytics": false,
  "registry": "https://registry.bower.io"
}

## CREATE bower.json with following content
➜  cat bower.json
{
  "name": "hbase-ui",
  "dependencies": {
    "bootstrap": "https://cdn.jsdelivr.net/npm/bootstrap@3.4.1/dist/js/bootstrap.min.js",
    "jquery": "https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js",
    "jquery-tablesortable": "https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.3/js/jquery.tablesorter.min.js",
    "parser-date-iso8601": "https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.3/js/parsers/parser-date-iso8601.min.js",
    "vega": "https://cdn.jsdelivr.net/npm/vega@5.24.0/build/vega.min.js",
    "vega-lite": "https://cdn.jsdelivr.net/npm/vega-lite@5.6.1/build/vega-lite.min.js",
    "vega-embed": "https://cdn.jsdelivr.net/npm/vega-embed@6.21.3/build/vega-embed.min.js"
  }
}

## LIST CONTENT OF DIRECTORY
➜  ll -a
total 32
drwxr-xr-x  5 nihjain  staff   160B Apr 18 21:03 .
drwxr-xr-x  6 nihjain  staff   192B Apr 18 12:09 ..
-rw-r--r--@ 1 nihjain  staff   6.0K Apr 18 20:59 .DS_Store
-rw-r--r--  1 nihjain  staff    93B Apr 18 12:56 .bowerrc
-rw-r--r--@ 1 nihjain  staff   729B Apr 18 16:31 bower.json

## RUN BOWER INSTALL
➜  bower install
bower bootstrap#*               cached https://cdn.jsdelivr.net/npm/bootstrap@3.4.1/dist/js/bootstrap.min.js#e-tag:W/"9b00-sW
bower bootstrap#*             validate e-tag:W/"9b00-sW against https://cdn.jsdelivr.net/npm/bootstrap@3.4.1/dist/js/bootstrap.min.js#*
bower jquery-tablesortable#*    cached https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.3/js/jquery.tablesorter.min.js#e-tag:5eb03ec4-
bower jquery-tablesortable#*  validate e-tag:5eb03ec4- against https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.3/js/jquery.tablesorter.min.js#*
bower jquery#*                  cached https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js#e-tag:W/"15d84-y
bower jquery#*                validate e-tag:W/"15d84-y against https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js#*
bower parser-date-iso8601#*     cached https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.3/js/parsers/parser-date-iso8601.min.js#e-tag:5eb03ec4-
bower parser-date-iso8601#*   validate e-tag:5eb03ec4- against https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.31.3/js/parsers/parser-date-iso8601.min.js#*
bower vega-lite#*               cached https://cdn.jsdelivr.net/npm/vega-lite@5.6.1/build/vega-lite.min.js#e-tag:W/"3bb90-H
bower vega-lite#*             validate e-tag:W/"3bb90-H against https://cdn.jsdelivr.net/npm/vega-lite@5.6.1/build/vega-lite.min.js#*
bower vega#*                    cached https://cdn.jsdelivr.net/npm/vega@5.24.0/build/vega.min.js#e-tag:W/"7cad0-K
bower vega#*                  validate e-tag:W/"7cad0-K against https://cdn.jsdelivr.net/npm/vega@5.24.0/build/vega.min.js#*
bower vega-embed#*              cached https://cdn.jsdelivr.net/npm/vega-embed@6.21.3/build/vega-embed.min.js#e-tag:W/"fb7f-46
bower vega-embed#*            validate e-tag:W/"fb7f-46 against https://cdn.jsdelivr.net/npm/vega-embed@6.21.3/build/vega-embed.min.js#*
bower jquery#*                 install jquery#e-tag:W/"15d84-y
bower bootstrap#*              install bootstrap#e-tag:W/"9b00-sW
bower vega-embed#*             install vega-embed#e-tag:W/"fb7f-46
bower vega#*                   install vega#e-tag:W/"7cad0-K
bower jquery-tablesortable#*   install jquery-tablesortable#e-tag:5eb03ec4-
bower parser-date-iso8601#*    install parser-date-iso8601#e-tag:5eb03ec4-
bower vega-lite#*              install vega-lite#e-tag:W/"3bb90-H

jquery#e-tag:W/"15d84-y public/jquery

bootstrap#e-tag:W/"9b00-sW public/bootstrap

vega-embed#e-tag:W/"fb7f-46 public/vega-embed

vega#e-tag:W/"7cad0-K public/vega

jquery-tablesortable#e-tag:5eb03ec4- public/jquery-tablesortable

parser-date-iso8601#e-tag:5eb03ec4- public/parser-date-iso8601

vega-lite#e-tag:W/"3bb90-H public/vega-lite

## LIST CONTENT OF DIRECTORY
➜  ls -aR
.          ..         .DS_Store  .bowerrc   bower.json public

./public:
.                    bootstrap            jquery-tablesortable vega                 vega-lite
..                   jquery               parser-date-iso8601  vega-embed

./public/bootstrap:
.           ..          .bower.json index.js

./public/jquery:
.           ..          .bower.json index.js

./public/jquery-tablesortable:
.           ..          .bower.json index.js

./public/parser-date-iso8601:
.           ..          .bower.json index.js

./public/vega:
.           ..          .bower.json index.js

./public/vega-embed:
.           ..          .bower.json index.js

./public/vega-lite:
.           ..          .bower.json index.js
{code}

The same idea can be used to generate the files under [https://github.com/apache/hbase/tree/master/hbase-server/src/main/resources/hbase-webapps/static/js] by pointing .bowerrc to point to this path and running 'bower install'. An upgrade would mean just changing the path of js dependency in bower.json. Let me know if this makes sense.

CC: [~ndimiduk]

> Manage static javascript resources programatically
> --------------------------------------------------
>
>                 Key: HBASE-27802
>                 URL: https://issues.apache.org/jira/browse/HBASE-27802
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: Nihal Jain
>            Assignee: Nihal Jain
>            Priority: Major
>
> Currently, the static JavaScript resources need to be manually managed. That is, if any of these has to be updated, we will be required to download them from web and place them under the appropriate path. This can be cumbersome.
> See list of JS under hbase-server at [https://github.com/apache/hbase/tree/master/hbase-server/src/main/resources/hbase-webapps/static/js]
> Need to find a way to manage them with minimal manual effort. Best case would be to manage them as part of build.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)