Skip to content

Commit 82456d3

Browse files
committed
➖ Get rid of selectize js and jquery
The purpose of selectize was to allow users to select vulnerability and relate it to some package. Selectize allowed users to get some autocomplete and filtering while they searched for the vulnerability. We were already planing to replace selectize js since it is not maintained. Other similar libraries are also not maintained as well(select2). Users don't need autocomplete for vulnerabilities since they would alreay know the CVE id,hence it doesnt add much value as far as UX is considered. A simple text input is used instead. Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
1 parent 5d3ee7f commit 82456d3

20 files changed

Lines changed: 223 additions & 15292 deletions

vulnerabilities/forms.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,35 +22,35 @@
2222

2323
from django import forms
2424

25-
from vulnerabilities.models import Package
25+
from vulnerabilities.models import Package, PackageRelatedVulnerability, Vulnerability
2626

2727

2828
def get_package_types():
29-
pkg_types = [(i.type, i.type)
30-
for i in Package.objects.distinct("type").all()]
31-
pkg_types.append((None, 'package type'))
29+
pkg_types = [(i.type, i.type) for i in Package.objects.distinct("type").all()]
30+
pkg_types.append((None, "package type"))
3231
return pkg_types
3332

3433

3534
def get_package_namespaces():
36-
pkg_namespaces = [(i.namespace, i.namespace)
37-
for i in Package.objects.distinct("namespace").all() if i.namespace]
38-
pkg_namespaces.append((None, 'package namespace'))
35+
pkg_namespaces = [
36+
(i.namespace, i.namespace)
37+
for i in Package.objects.distinct("namespace").all()
38+
if i.namespace
39+
]
40+
pkg_namespaces.append((None, "package namespace"))
3941
return pkg_namespaces
4042

4143

4244
class PackageForm(forms.Form):
4345

4446
type = forms.ChoiceField(choices=get_package_types)
45-
namespace = forms.ChoiceField(
46-
choices=get_package_namespaces, required=False)
47-
name = forms.CharField(widget=forms.TextInput(
48-
attrs={'placeholder': 'package name'}))
49-
version = forms.CharField(widget=forms.TextInput(
50-
attrs={'placeholder': 'package version'}), required=False)
47+
namespace = forms.ChoiceField(choices=get_package_namespaces, required=False)
48+
name = forms.CharField(widget=forms.TextInput(attrs={"placeholder": "package name"}))
49+
version = forms.CharField(
50+
widget=forms.TextInput(attrs={"placeholder": "package version"}), required=False
51+
)
5152

5253

53-
class VulnerabilitySearchForm(forms.Form):
54+
class CVEForm(forms.Form):
5455

55-
vuln_id = forms.CharField(widget=forms.TextInput(
56-
attrs={'placeholder': 'vulnerability id'}))
56+
cve_id = forms.CharField(widget=forms.TextInput(attrs={"placeholder": "vulnerability id"}))

vulnerabilities/static/css/font-awesome.css.ABOUT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ owner: FortAwesome
88
author: Dave Gandy
99
notes: This is the minified version of Font Awesome.
1010

11-
license: MIT
11+
license: mit
1212
license_file: font-awesome.css.LICENSE
Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,20 @@
1-
Font Awesome Free License
2-
-------------------------
1+
The MIT License (MIT)
32

4-
Font Awesome Free is free, open source, and GPL friendly. You can use it for
5-
commercial projects, open source projects, or really almost whatever you want.
6-
Full Font Awesome Free license: https://fontawesome.com/license/free.
73

8-
# Icons: CC BY 4.0 License (https://creativecommons.org/licenses/by/4.0/)
9-
In the Font Awesome Free download, the CC BY 4.0 license applies to all icons
10-
packaged as SVG and JS file types.
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to deal
6+
in the Software without restriction, including without limitation the rights
7+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
1110

12-
# Fonts: SIL OFL 1.1 License (https://scripts.sil.org/OFL)
13-
In the Font Awesome Free download, the SIL OFL license applies to all icons
14-
packaged as web and desktop font files.
11+
The above copyright notice and this permission notice shall be included in
12+
all copies or substantial portions of the Software.
1513

16-
# Code: MIT License (https://opensource.org/licenses/MIT)
17-
In the Font Awesome Free download, the MIT license applies to all non-font and
18-
non-icon files.
19-
20-
# Attribution
21-
Attribution is required by MIT, SIL OFL, and CC BY licenses. Downloaded Font
22-
Awesome Free files already contain embedded comments with sufficient
23-
attribution, so you shouldn't need to do anything additional when using these
24-
files normally.
25-
26-
We've kept attribution comments terse, so we ask that you do not actively work
27-
to remove them from files, especially code. They're a great way for folks to
28-
learn about Font Awesome.
29-
30-
# Brand Icons
31-
All brand icons are trademarks of their respective owners. The use of these
32-
trademarks does not indicate endorsement of the trademark holder by Font
33-
Awesome, nor vice versa. **Please do not use brand logos for any purpose except
34-
to represent the company, product, or service to which they refer.**
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
THE SOFTWARE.

0 commit comments

Comments
 (0)