Giter VIP home page Giter VIP logo

rockstor-jslibs's People

Contributors

froggyflox avatar mflyer avatar phillxnet avatar schakrava avatar sfranzen avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

rockstor-jslibs's Issues

Clarify mixed licenses for the jslibs collection

This repo initially carries a GPLv2+ LICENSE file. However this is potentially misleading as the majority of the js code contained within is individually licensed as per their respective headers.
It has been assumed (and we state) that this LICENSE file pertains to the collection itself:
See: initial first-release notes here: https://github.com/rockstor/rockstor-jslibs/releases/tag/4.5.1

The following licenses are expressed in the contained files within this repo:

  • Bracketed combinations with 'or' are indications of licensing choice where one can adopt one or more of those indicated.
  • Bracketed combinations with 'and' are multi-licensed where all licenses must pertain concurrently.

MIT / Apache-2.0 / (MIT or GPL-2.0-only) / GPL-2.0-only / (GPL-2.0-or-later or MIT) / New BSD License / (MIT or GPL-1.0-only) / GPL-3.0-or-later

It is therefore proposed that we replace this single license file with an abstract of the licenses involved.

It is also proposed that we adopt, where possible, SPDX standards when indicating the various licenses:
https://github.com/spdx/spdx-spec
https://spdx.github.io/spdx-spec/v2.3/
SPDX License List: https://spdx.org/licenses/

Resolve differences between website download and GitHub release

As of GitHub release 4.5.1 in this repository there exists a discrepency between that tar.gz and our long standing website download. This has come to light in the development of the following rockstor-core pull request:

source rockstor-jslibs directly from GitHub releases: rockstor/rockstor-core#2441

Setup of comparable directories

The archives have differing top-level embeded directories.

mkdir github-lib
mkdir website-lib

wget -O GitHub-4.5.1.tar.gz https://github.com/rockstor/rockstor-jslibs/archive/refs/tags/4.5.1.tar.gz
tar zxvf GitHub-4.5.1.tar.gz --directory github-lib --strip-components=1

wget -O website.tar.gz https://rockstor.com/downloads/jslibs/rockstor-jslibs.tar.gz
tar zxvf website.tar.gz --directory website-lib --strip-components=1

Compare the normalised directories

rleap15-4:~/jslibs-compare # diff <(tree ./github-lib/) <(tree ./website-lib)

1c1
< ./github-lib/
---
> ./website-lib
5a6
> ├── bootstrap-editable.min.js
6a8
> ├── bootstrap-switch.min.js
9a12
> ├── clipboard.min.js
22a26
> ├── dataTables.bootstrap.min.js
27a32
> ├── handlebars-v4.0.5.js
75a81
> ├── underscore-1.3.2.js
78c84
< 11 directories, 64 files
---
> 11 directories, 70 files

I.e. website-lib has 6 additional files, likely included to account for hardwired version expectation within our existing rockstor-core code.

A finding that is consistent with, for one example, the missing hard-wired requirement of underscore-1.3.2.js file when using the GitHub release as per the above referenced rockstor/rockstor-core#2441.

"/opt/rockstor/static/js/lib/underscore-1.3.2.js" failed (2: No such file or directory)

As part of an extract from the nginx error log on visiting our initial setup page after resourcing the proposed GitHub release system for our jslibs.

2022/12/12 15:31:22 [error] 27471#27471: *47 open() "/opt/rockstor/static/js/lib/underscore-1.3.2.js" failed (2: No such file or directory), client: 192.168.2.xxx, server: ~^(?<myhost>.+)$, request: "GET /static/js/lib/underscore-1.3.2.js HTTP/1.1", host: "rleap15-4.lan", referrer: "https://rleap15-4.lan/"
2022/12/12 15:31:22 [error] 27471#27471: *46 open() "/opt/rockstor/static/js/lib/handlebars-v4.0.5.js" failed (2: No such file or directory), client: 192.168.2.xxx, server: ~^(?<myhost>.+)$, request: "GET /static/js/lib/handlebars-v4.0.5.js HTTP/1.1", host: "rleap15-4.lan", referrer: "https://rleap15-4.lan/"
2022/12/12 15:31:22 [error] 27471#27471: *37 open() "/opt/rockstor/static/js/lib/dataTables.bootstrap.min.js" failed (2: No such file or directory), client: 192.168.2.xxx, server: ~^(?<myhost>.+)$, request: "GET /static/js/lib/dataTables.bootstrap.min.js HTTP/1.1", host: "rleap15-4.lan", referrer: "https://rleap15-4.lan/"
2022/12/12 15:31:22 [error] 27471#27471: *47 open() "/opt/rockstor/static/js/lib/clipboard.min.js" failed (2: No such file or directory), client: 192.168.2.xxx, server: ~^(?<myhost>.+)$, request: "GET /static/js/lib/clipboard.min.js HTTP/1.1", host: "rleap15-4.lan", referrer: "https://rleap15-4.lan/"
2022/12/12 15:31:23 [error] 27471#27471: *46 open() "/opt/rockstor/static/js/lib/underscore-1.3.2.js" failed (2: No such file or directory), client: 192.168.2.xxx, server: ~^(?<myhost>.+)$, request: "GET /static/js/lib/underscore-1.3.2.js HTTP/1.1", host: "rleap15-4.lan", referrer: "https://rleap15-4.lan/"
2022/12/12 15:31:23 [error] 27471#27471: *37 open() "/opt/rockstor/static/js/lib/handlebars-v4.0.5.js" failed (2: No such file or directory), client: 192.168.2.xxx, server: ~^(?<myhost>.+)$, request: "GET /static/js/lib/handlebars-v4.0.5.js HTTP/1.1", host: "rleap15-4.lan", referrer: "https://rleap15-4.lan/"
2022/12/12 15:31:23 [error] 27471#27471: *47 open() "/opt/rockstor/static/js/lib/dataTables.bootstrap.min.js" failed (2: No such file or directory), client: 192.168.2.xxx, server: ~^(?<myhost>.+)$, request: "GET /static/js/lib/dataTables.bootstrap.min.js HTTP/1.1", host: "rleap15-4.lan", referrer: "https://rleap15-4.lan/"
2022/12/12 15:31:23 [error] 27471#27471: *46 open() "/opt/rockstor/static/js/lib/clipboard.min.js" failed (2: No such file or directory), client: 192.168.2.xxx, server: ~^(?<myhost>.+)$, request: "GET /static/js/lib/clipboard.min.js HTTP/1.1", host: "rleap15-4.lan", referrer: "https://rleap15-4.lan/"

Informed from related/linked issue in rockstor-core:

  • remove requirement for underscore-1.3.2.js - See: "normalise on underscore.js in setup.html & base.html": rockstor/rockstor-core#2444
  • add missing bootstrap-editable.min.js
  • add missing bootstrap-switch.min.js
  • add missing clipboard.min.js
  • add missing dataTables.bootstrap.min.js
  • add missing handlebars-v4.0.5.js

remove redundant jquery.sparkline.min.js

This library is believed to be unused and is also alone in this repository for it's use of the BSD-3-Clause license. As part of a clean-up within this repository and in a continuing effort to reduce our license breadth it is proposed that it be removed.

grep -R "jquery.sparkline"
src/rockstor/storageadmin/templates/storageadmin/base.html:    <script src="/static/js/lib/jquery.sparkline.min.js"></script>
src/rockstor/storageadmin/templates/storageadmin/setup.html:    <script src="/static/js/lib/jquery.sparkline.min.js"></script>

and the following returns nothing, in this repo or rockstor-core.

grep -R "inlinesparkline\|dynamicsparkline\|dynamicbar\|inlinebar"

Removing flot.js & related

Hi @schakrava & @priyaganti,
actually on my side there's no more need of flot.js libs
Had a grep -Rl flot to check is we're still using it, but got results only from base.html and setup.html

    <script src="/static/js/lib/jquery.flot.js"></script>
    <script src="/static/js/lib/jquery.flot.navigate.js"></script>
    <script src="/static/js/lib/jquery.flot.resize.js"></script>
    <script src="/static/js/lib/jquery.flot.stack.js"></script>
    <script src="/static/js/lib/jquery.flot.tooltip_0.5.js"></script>
    <script src="/static/js/lib/jquery.flot.axislabels.js"></script>
    <script src="/static/js/lib/jquery.flot.stackpercent.js"></script>
    <script src="/static/js/lib/jquery.flot.time.js"></script>

In addition to having some "random tests" over Rockstor pages, for all I know that lib was used only on Widgets, can you confirm this? Removing flot 8 js libs will make Rockstor at least a little lighter

BR
Mirko

Add 'Contributing' section to README.md

Thanks to @StephenBrown2 for helping to highlight this issue. Our current README contains only a file-by-file/pkg-by-pkg breakdown of License info, and a quick description. We are missing a 'Contributing' section containing linking back to either our general contributor doc section:

or to a dedicated section within our docs developer/contributing docs such as we have for our docs:
https://rockstor.com/docs/contribute/contribute_documentation.html#contributedocs
or rock-ons:
https://rockstor.com/docs/contribute/contribute_rockons.html

See partner issue on the canonical nature of our docs re contributions:
rockstor/rockon-registry#350

Add HTMX 2 library

As part of rocksor-core issue Reduce JS libs dependencies via HTMX it is required that we first add the HTMX js library itself: to begin centralising/reducing our JS dependencies.

From the HTMX main website we have:

htmx gives you access to AJAX, CSS Transitions, WebSockets and Server Sent Events directly in HTML, using attributes, so you can build modern user interfaces with the simplicity and power of hypertext

Source code: https://github.com/bigskysoftware/htmx

License info re 1.9.8 from unpkg: https://unpkg.com/browse/[email protected]/LICENSE BSD 2-Clause License
License from source: https://github.com/bigskysoftware/htmx/blob/master/LICENSE

  • SPDX full name "BSD 2-Clause "Simplified" License" reference: BSD-2-Clause

Changelog: https://github.com/bigskysoftware/htmx/blob/master/CHANGELOG.md

README.md: https://github.com/bigskysoftware/htmx#readme

From above readme:

htmx is small (~14k min.gz'd), dependency-free, extendable & IE11 compatible

Remove redundant cubism.v1.js

This js library has not been updated (upstream) for 8 years.

See: https://github.com/square/cubism/wiki/Cubism#context for tells of it's use.
In rockstor-jslibs

grep -R "cubism"

Returns entries for only itself.

And in rockstor-core we have:

grep -R "cubism"
src/rockstor/storageadmin/templates/storageadmin/base.html:    <script src="/static/js/lib/cubism.v1.js"></script>
src/rockstor/storageadmin/templates/storageadmin/setup.html:    <script src="/static/js/lib/cubism.v1.js"></script>

It is also one of only three libraries within the repo that are Apache-2.0.

Add socket.io.min.js.map file

During test rpmbuild of rockstor-core testing branch PR: Update Django to latest 4.2 LTS ..." a new sensitivity regarding this file surfaced. Previous rpmbuilds for testing channel rockstor-core did not show this sensitivity.

It is proposed that we add this file to our testing branch in this repo to circumvent this new sensitivity and return to an rpmbuildable state.

Follow-up, in part, and map file matched to the changes made within testing branch in this repo in PR:
Update socket.io client lib #36 #37

Where

was introduced, and the old version of the map file removed.

Proposed new/matching map file:

Our existing (updated in #37) socket.io.min.js file does contain the following flag:

//# sourceMappingURL=socket.io.min.js.map

Which is thought to be triggering our newer Django collectstatic to flag the absence of this file, which is not normally required, and fail our rpmbuild process via the collectstatic step executed within the %check scriptlet.

Create testing branch

Our rockstor-core and rockstor-rpmbuild repos currently have master and testing branches intended to build our stable and testing release rpms. Similarly, we need the same seperation in this repository to enable the same seperation. This would facilitate testing upgraded jslibs conmponents in testing before their eventual adoption in master.

Fix README.md newline issue

Our recently added license orientated README.md has multiple new-line issues which makes for difficult reading.

remove redundant json2.js - IE8 compatibility layer

From the hom page of this json library: https://github.com/douglascrockford/JSON-js
we have:

json2.js: This file creates a JSON property in the global object, if there
isn't already one, setting its value to an object containing a stringify
method and a parse method. The parse method uses the eval method to do the
parsing, guarding it with several regular expressions to defend against
accidental code execution hazards. On current browsers, this file does nothing,
preferring the built-in JSON object. There is no reason to use this file unless
fate compels you to support IE8, which is something that no one should ever
have to do again.

As such it is proposed that we remove this library and any reference to it in https://github.com/rockstor/rockstor-core

Upgrade bootstrap js/css

Issue in rockstor-core: rockstor/rockstor-core#2548

Upgrading bootstrap to at least 4.6 would be nice.
The license and supported browsers look fine.

Reasoning: it has built-in switches. This means we could remove the dependency to external bootstrap-switch library.
Cons: there will be breaking changes (https://getbootstrap.com/docs/4.6/migration/, https://getbootstrap.com/docs/5.2/migration/)

My opinion: since v3.x works fine with latest modern browsers, there is no rush to upgrade.
Therefore it is a nice-to-have, but alas a low-prio task.

update license, with permission, on jquery-cron-window.js

After pr #19 is is clear that we have, within rockstor-jslibs, a single source file under a GPL-2.0-only license. In an effort to normalise on GPL-X.0-or-later where we can it is proposed that we modify this files license to GPL-3.0-or-later. See the related issue re "-or-later" on rockstor-core here:
rockstor/rockstor-core#2447

Permission from the file's author @MFlyer (a prior prolific Rockstor contributor) has been received via email: thanks Mirko.

License relevant existing file header:

* Created by Mirko Arena for Rockstor BTRFS Storage System.
* Licensed under the GPL Version 2 license.

It is proposed that we update this (under the above authors permission) to GPL-3.0-or-later, essentially removing the lock to GPL-2.0 where there was no explicit "-or-later" but there was a specified version: there-by requiring the explicit use of "or later" which is otherwise granted when no version is specified. See our README.md for reference:
https://github.com/rockstor/rockstor-jslibs#license

The overall intention here is to minimise our license breadth. And hopefully move some files resident in this repository (rockstor-jslibs) to where they are ultimately deployed within rockstor-core. This file would be a candidate for this move, post license update (that move would be under it's own issue).

Proposed change is to maintain the family of GPL (in line with rockstor-core) but move up a version and add -or-later, plus move to SPDX format for the file header license identifier.

 * Created by Mirko Arena for Rockstor BTRFS Storage System.
 * SPDX-License-Identifier: GPL-3.0-or-later

As per SPDX License List

@MFlyer Thanks for you time and understanding on this rather dry request, and do let me know if I have misunderstood anything here. I'll prepare a pull request.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.