Make filters implicit; Update symbols
This commit is contained in:
parent
06cc1abbb1
commit
9173780568
@ -109,6 +109,10 @@ Otherwise, have a great day =^.^=
|
|||||||
right: 0;
|
right: 0;
|
||||||
left: auto;
|
left: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#version-filter-count {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
@ -297,7 +301,7 @@ Otherwise, have a great day =^.^=
|
|||||||
|
|
||||||
#version-filter li label {
|
#version-filter li label {
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
width: 80%;
|
width: 40%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.version-filter-input {
|
.version-filter-input {
|
||||||
@ -425,7 +429,7 @@ Otherwise, have a great day =^.^=
|
|||||||
<div id="version-filter">
|
<div id="version-filter">
|
||||||
<div class="btn-group" filter-dropdown>
|
<div class="btn-group" filter-dropdown>
|
||||||
<button type="button" class="btn btn-default dropdown-toggle">
|
<button type="button" class="btn btn-default dropdown-toggle">
|
||||||
Version <span class="caret"></span>
|
Version <span id="version-filter-count" class="badge">{{versionFilterCount(version_filters)}}</span> <span class="caret"></span>
|
||||||
</button>
|
</button>
|
||||||
<ul id="version-filter-selector" class="dropdown-menu">
|
<ul id="version-filter-selector" class="dropdown-menu">
|
||||||
<li class="checkbox">
|
<li class="checkbox">
|
||||||
@ -436,11 +440,8 @@ Otherwise, have a great day =^.^=
|
|||||||
</li>
|
</li>
|
||||||
<li role="separator" class="divider"></li>
|
<li role="separator" class="divider"></li>
|
||||||
<li class="checkbox" ng-repeat="(filter, vars) in version_filters">
|
<li class="checkbox" ng-repeat="(filter, vars) in version_filters">
|
||||||
<label>
|
<label ng-attr-for="filter-{filter}">{{filter}}</label>
|
||||||
<input type="checkbox" ng-model="version_filters[filter].enabled" />
|
<input type="text" ng-attr-id="filter-{filter}" class="version-filter-input form-control filter-input" maxlength="6" placeholder="1.62.0" ng-model="version_filters[filter].version_str" ng-model-options="{debounce: 50}"/>
|
||||||
{{filter}}
|
|
||||||
</label>
|
|
||||||
<input type="text" class="version-filter-input form-control filter-input" maxlength="6" placeholder="1.62.0" ng-model="version_filters[filter].version_str" ng-model-options="{debounce: 50}"/>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -137,13 +137,13 @@
|
|||||||
$scope.themes = THEMES_DEFAULT;
|
$scope.themes = THEMES_DEFAULT;
|
||||||
|
|
||||||
const DEFAULT_VERSION_FILTERS = {
|
const DEFAULT_VERSION_FILTERS = {
|
||||||
">=": { enabled: false, version_str: "" },
|
"≥": { enabled: false, version_str: "" },
|
||||||
"<=": { enabled: false, version_str: "" },
|
"≤": { enabled: false, version_str: "" },
|
||||||
"==": { enabled: false, version_str: "" },
|
"=": { enabled: false, version_str: "" },
|
||||||
};
|
};
|
||||||
// Weird workaround to get a copy of the object
|
// Weird workaround to get a copy of the object
|
||||||
$scope.version_filters = JSON.parse(JSON.stringify(DEFAULT_VERSION_FILTERS));
|
$scope.version_filters = JSON.parse(JSON.stringify(DEFAULT_VERSION_FILTERS));
|
||||||
$scope.version_regex = new RegExp('\\d\.\\d{2}\.\\d');
|
$scope.version_regex = new RegExp('1\.\\d{2}\.\\d');
|
||||||
|
|
||||||
$scope.selectTheme = function (theme) {
|
$scope.selectTheme = function (theme) {
|
||||||
setTheme(theme, true);
|
setTheme(theme, true);
|
||||||
@ -175,16 +175,8 @@
|
|||||||
$scope.version_filters = JSON.parse(JSON.stringify(DEFAULT_VERSION_FILTERS));
|
$scope.version_filters = JSON.parse(JSON.stringify(DEFAULT_VERSION_FILTERS));
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.versionSymbol = function() {
|
$scope.versionFilterCount = function(obj) {
|
||||||
const version_filters = $scope.version_filters;
|
return Object.values(obj).filter(x => x.enabled).length;
|
||||||
let filter = ">=";
|
|
||||||
for (const key in version_filters) {
|
|
||||||
if (version_filters[key]) {
|
|
||||||
filter = key;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return filter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.byVersion = function(lint) {
|
$scope.byVersion = function(lint) {
|
||||||
@ -214,10 +206,13 @@
|
|||||||
let version_str = filters[filter].version_str;
|
let version_str = filters[filter].version_str;
|
||||||
|
|
||||||
// Skip the work for version strings with invalid lengths or characters
|
// Skip the work for version strings with invalid lengths or characters
|
||||||
if (!filters[filter].enabled || !validate_version_str(version_str)) {
|
if (!validate_version_str(version_str)) {
|
||||||
|
filters[filter].enabled = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filters[filter].enabled = true;
|
||||||
|
|
||||||
let result = cmp_version(lint_version, version_str, filter);
|
let result = cmp_version(lint_version, version_str, filter);
|
||||||
if (result && filter === "==") {
|
if (result && filter === "==") {
|
||||||
return true;
|
return true;
|
||||||
@ -226,10 +221,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
let cmp_filter;
|
let cmp_filter;
|
||||||
if (filter === ">=") {
|
if (filter === "≥") {
|
||||||
cmp_filter = "<=";
|
cmp_filter = "≤";
|
||||||
} else {
|
} else {
|
||||||
cmp_filter = ">=";
|
cmp_filter = "≥";
|
||||||
}
|
}
|
||||||
|
|
||||||
let cmp_version_str = filters[cmp_filter].version_str;
|
let cmp_version_str = filters[cmp_filter].version_str;
|
||||||
|
Loading…
Reference in New Issue
Block a user