Retire Packaging Deb project repos
This commit is part of a series to retire the Packaging Deb project. Step 2 is to remove all content from the project repos, replacing it with a README notification where to find ongoing work, and how to recover the repo if needed at some future point (as in https://docs.openstack.org/infra/manual/drivers.html#retiring-a-project). Change-Id: I18055a3524ece7338b7e8f345fb85c53760bef13
This commit is contained in:
parent
080d368696
commit
4915c0dfe1
9
.gitignore
vendored
9
.gitignore
vendored
@ -1,9 +0,0 @@
|
|||||||
*.pyc
|
|
||||||
*.sw?
|
|
||||||
*.sqlite3
|
|
||||||
.DS_STORE
|
|
||||||
*.egg-info
|
|
||||||
.venv
|
|
||||||
.tox
|
|
||||||
build
|
|
||||||
dist
|
|
@ -1,4 +0,0 @@
|
|||||||
[gerrit]
|
|
||||||
host=review.openstack.org
|
|
||||||
port=29418
|
|
||||||
project=openstack/xstatic-magic-search.git
|
|
@ -1,8 +0,0 @@
|
|||||||
include README.txt
|
|
||||||
recursive-include xstatic/pkg/magic_search *
|
|
||||||
|
|
||||||
global-exclude *.pyc
|
|
||||||
global-exclude *.pyo
|
|
||||||
global-exclude *.orig
|
|
||||||
global-exclude *.rej
|
|
||||||
|
|
14
README
Normal file
14
README
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
This project is no longer maintained.
|
||||||
|
|
||||||
|
The contents of this repository are still available in the Git
|
||||||
|
source code management system. To see the contents of this
|
||||||
|
repository before it reached its end of life, please check out the
|
||||||
|
previous commit with "git checkout HEAD^1".
|
||||||
|
|
||||||
|
For ongoing work on maintaining OpenStack packages in the Debian
|
||||||
|
distribution, please see the Debian OpenStack packaging team at
|
||||||
|
https://wiki.debian.org/OpenStack/.
|
||||||
|
|
||||||
|
For any further questions, please email
|
||||||
|
openstack-dev@lists.openstack.org or join #openstack-dev on
|
||||||
|
Freenode.
|
21
README.txt
21
README.txt
@ -1,21 +0,0 @@
|
|||||||
XStatic-MagicSearch
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
MagicSearch is an AngularJS directive that provides a UI for both faceted
|
|
||||||
filtering and as-you-type filtering. It is intended for filtering tables,
|
|
||||||
such as an AngularJS smart-table, but it can be used in any situation
|
|
||||||
where you can provide it with facets/options and consume its events.
|
|
||||||
|
|
||||||
MagicSearch was initially developed by David Kavanagh for Eucalyptus.
|
|
||||||
|
|
||||||
|
|
||||||
MagicSearch javascript library packaged for setuptools (easy_install) / pip.
|
|
||||||
|
|
||||||
This package is intended to be used by **any** project that needs these files.
|
|
||||||
|
|
||||||
It intentionally does **not** provide any extra code except some metadata
|
|
||||||
**nor** has any extra requirements. You MAY use some minimal support code from
|
|
||||||
the XStatic base package, if you like.
|
|
||||||
|
|
||||||
You can find more info about the xstatic packaging way in the package `XStatic`.
|
|
||||||
|
|
27
setup.py
27
setup.py
@ -1,27 +0,0 @@
|
|||||||
from xstatic.pkg import magic_search as xs
|
|
||||||
|
|
||||||
# The README.txt file should be written in reST so that PyPI can use
|
|
||||||
# it to generate your project's PyPI page.
|
|
||||||
long_description = open('README.txt').read()
|
|
||||||
|
|
||||||
from setuptools import setup, find_packages
|
|
||||||
|
|
||||||
setup(
|
|
||||||
name=xs.PACKAGE_NAME,
|
|
||||||
version=xs.PACKAGE_VERSION,
|
|
||||||
description=xs.DESCRIPTION,
|
|
||||||
long_description=long_description,
|
|
||||||
classifiers=xs.CLASSIFIERS,
|
|
||||||
keywords=xs.KEYWORDS,
|
|
||||||
maintainer=xs.MAINTAINER,
|
|
||||||
maintainer_email=xs.MAINTAINER_EMAIL,
|
|
||||||
license=xs.LICENSE,
|
|
||||||
url=xs.HOMEPAGE,
|
|
||||||
platforms=xs.PLATFORMS,
|
|
||||||
packages=find_packages(),
|
|
||||||
namespace_packages=['xstatic', 'xstatic.pkg', ],
|
|
||||||
include_package_data=True,
|
|
||||||
zip_safe=False,
|
|
||||||
install_requires=[], # nothing! :)
|
|
||||||
# if you like, you MAY use the 'XStatic' package.
|
|
||||||
)
|
|
8
tox.ini
8
tox.ini
@ -1,8 +0,0 @@
|
|||||||
[tox]
|
|
||||||
minversion = 1.6
|
|
||||||
skipsdist = True
|
|
||||||
envlist = py27,py33,py34
|
|
||||||
|
|
||||||
[testenv:venv]
|
|
||||||
commands = {posargs}
|
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
__import__('pkg_resources').declare_namespace(__name__)
|
|
@ -1 +0,0 @@
|
|||||||
__import__('pkg_resources').declare_namespace(__name__)
|
|
@ -1,49 +0,0 @@
|
|||||||
"""
|
|
||||||
XStatic resource package
|
|
||||||
|
|
||||||
See package 'XStatic' for documentation and basic tools.
|
|
||||||
"""
|
|
||||||
|
|
||||||
DISPLAY_NAME = 'Magic-Search' # official name, upper/lowercase allowed, no spaces
|
|
||||||
PACKAGE_NAME = 'XStatic-%s' % DISPLAY_NAME # name used for PyPi
|
|
||||||
|
|
||||||
NAME = __name__.split('.')[-1] # package name (e.g. 'foo' or 'foo_bar')
|
|
||||||
# please use a all-lowercase valid python
|
|
||||||
# package name
|
|
||||||
|
|
||||||
VERSION = '0.2.5' # version of the packaged files, please use the upstream
|
|
||||||
# version number
|
|
||||||
BUILD = '1' # our package build number, so we can release new builds
|
|
||||||
# with fixes for xstatic stuff.
|
|
||||||
PACKAGE_VERSION = VERSION + '.' + BUILD # version used for PyPi
|
|
||||||
|
|
||||||
DESCRIPTION = "%s %s (XStatic packaging standard)" % (DISPLAY_NAME, VERSION)
|
|
||||||
|
|
||||||
PLATFORMS = 'any'
|
|
||||||
CLASSIFIERS = []
|
|
||||||
KEYWORDS = '%s xstatic' % NAME
|
|
||||||
|
|
||||||
# XStatic-* package maintainer:
|
|
||||||
MAINTAINER = 'Randy Bertram'
|
|
||||||
MAINTAINER_EMAIL = 'rbertram@us.ibm.com'
|
|
||||||
|
|
||||||
# this refers to the project homepage of the stuff we packaged:
|
|
||||||
HOMEPAGE = 'https://github.com/eucalyptus/magic-search'
|
|
||||||
|
|
||||||
# this refers to all files:
|
|
||||||
LICENSE = '(same as %s)' % DISPLAY_NAME
|
|
||||||
|
|
||||||
from os.path import join, dirname
|
|
||||||
BASE_DIR = join(dirname(__file__), 'data')
|
|
||||||
# linux package maintainers just can point to their file locations like this:
|
|
||||||
#BASE_DIR = '/usr/share/javascript/jquery'
|
|
||||||
|
|
||||||
LOCATIONS = {
|
|
||||||
# CDN locations (if no public CDN exists, use an empty dict)
|
|
||||||
# if value is a string, it is a base location, just append relative
|
|
||||||
# path/filename. if value is a dict, do another lookup using the
|
|
||||||
# relative path/filename you want.
|
|
||||||
# your relative path/filenames should usually be without version
|
|
||||||
# information, because either the base dir/url is exactly for this
|
|
||||||
# version or the mapping will care for accessing this version.
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
<!--! Magic Searchbar -->
|
|
||||||
<div class="magic-search" magic-overrides="">
|
|
||||||
<div class="search-bar">
|
|
||||||
<i class="fi-filter go"></i>
|
|
||||||
<div class="search-main-area">
|
|
||||||
<span class="item-list">
|
|
||||||
<span class="label radius secondary item"
|
|
||||||
ng-repeat="facet in currentSearch" ng-cloak="cloak">
|
|
||||||
<span>
|
|
||||||
{{ facet.label[0] }}:<b>{{ facet.label[1] }}</b>
|
|
||||||
</span>
|
|
||||||
<a class="remove" ng-click="removeFacet($index, $event)" title="{{ strings.remove }}">
|
|
||||||
<i class="fi-x"></i>
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
<span class="search-selected label" ng-cloak="" ng-show="facetSelected">
|
|
||||||
{{ facetSelected.label[0] }}:
|
|
||||||
</span>
|
|
||||||
<div class="search-entry" is-open="isMenuOpen">
|
|
||||||
<input class="search-input" type="text" data-dropdown="facet-drop" dropdown-toggle=""
|
|
||||||
placeholder="{{ strings.prompt }}" autocomplete="off" />
|
|
||||||
<ul id="facet-drop" class="f-dropdown dropdown-menu" data-dropdown-content="">
|
|
||||||
<li ng-repeat="facet in filteredObj" ng-show="!facetSelected">
|
|
||||||
<a ng-click="facetClicked($index, $event, facet.name)"
|
|
||||||
ng-show="!isMatchLabel(facet.label)">{{ facet.label }}</a>
|
|
||||||
<a ng-click="facetClicked($index, $event, facet.name)"
|
|
||||||
ng-show="isMatchLabel(facet.label)">
|
|
||||||
{{ facet.label[0] }}<span class="match">{{ facet.label[1] }}</span>{{ facet.label[2] }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li ng-repeat="option in filteredOptions" ng-show="facetSelected">
|
|
||||||
<a ng-click="optionClicked($index, $event, option.key)"
|
|
||||||
ng-show="!isMatchLabel(option.label)">
|
|
||||||
{{ option.label }}
|
|
||||||
</a>
|
|
||||||
<a ng-click="optionClicked($index, $event, option.key)"
|
|
||||||
ng-show="isMatchLabel(option.label)">
|
|
||||||
{{ option.label[0] }}<span class="match">{{ option.label[1] }}</span>{{ option.label[2] }}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<a ng-click="clearSearch()" ng-show="currentSearch.length > 0" title="{{ strings.cancel }}">
|
|
||||||
<i class="fi-x cancel"></i>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
@ -1,417 +0,0 @@
|
|||||||
/**
|
|
||||||
* @fileOverview Magic Search JS
|
|
||||||
* @requires AngularJS
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Allow the module to be pre-defined with additional dependencies
|
|
||||||
try{
|
|
||||||
angular.module('MagicSearch');
|
|
||||||
} catch (exception) {
|
|
||||||
angular.module('MagicSearch', []);
|
|
||||||
}
|
|
||||||
|
|
||||||
angular.module('MagicSearch')
|
|
||||||
.directive('magicSearch', function($compile) {
|
|
||||||
return {
|
|
||||||
restrict: 'E',
|
|
||||||
scope: {
|
|
||||||
facets_param: '@facets',
|
|
||||||
filter_keys: '=filterKeys',
|
|
||||||
strings: '=strings'
|
|
||||||
},
|
|
||||||
templateUrl: function (scope, elem) {
|
|
||||||
return elem.template;
|
|
||||||
},
|
|
||||||
controller: function ($scope, $element, $timeout) {
|
|
||||||
var searchInput = $element.find('.search-input');
|
|
||||||
$scope.promptString = $scope.strings.prompt;
|
|
||||||
$scope.currentSearch = [];
|
|
||||||
$scope.initSearch = function() {
|
|
||||||
if (typeof $scope.facets_param === 'string') {
|
|
||||||
// Parse facets JSON and convert to a list of facets.
|
|
||||||
var tmp = $scope.facets_param.replace(/__apos__/g, "\'").replace(/__dquote__/g, '\\"').replace(/__bslash__/g, "\\");
|
|
||||||
$scope.facetsObj = JSON.parse(tmp);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Assume this is a usable javascript object
|
|
||||||
$scope.facetsObj = $scope.facets_param;
|
|
||||||
}
|
|
||||||
$scope.facetsSave = $scope.copyFacets($scope.facetsObj);
|
|
||||||
$scope.initFacets();
|
|
||||||
};
|
|
||||||
$scope.initFacets = function() {
|
|
||||||
// set facets selected and remove them from facetsObj
|
|
||||||
var initialFacets = window.location.search;
|
|
||||||
if (initialFacets.indexOf('?') === 0) {
|
|
||||||
initialFacets = initialFacets.slice(1);
|
|
||||||
}
|
|
||||||
initialFacets = initialFacets.split('&');
|
|
||||||
if (initialFacets.length > 1 || initialFacets[0].length > 0) {
|
|
||||||
$timeout(function() {
|
|
||||||
$scope.strings.prompt = '';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
angular.forEach(initialFacets, function(facet, idx) {
|
|
||||||
var facetParts = facet.split('=');
|
|
||||||
angular.forEach($scope.facetsObj, function(value, idx) {
|
|
||||||
if (value.name == facetParts[0]) {
|
|
||||||
if (value.options === undefined) {
|
|
||||||
$scope.currentSearch.push({'name':facet, 'label':[value.label, facetParts[1]]});
|
|
||||||
// allow free-form facets to remain
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
angular.forEach(value.options, function(option, idx) {
|
|
||||||
if (option.key == facetParts[1]) {
|
|
||||||
$scope.currentSearch.push({'name':facet, 'label':[value.label, option.label]});
|
|
||||||
if (value.singleton === true) {
|
|
||||||
$scope.deleteFacetEntirely(facetParts);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$scope.deleteFacetSelection(facetParts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
if ($scope.textSearch !== undefined) {
|
|
||||||
$scope.currentSearch.push({'name':'text='+$scope.textSearch, 'label':[$scope.strings.text, $scope.textSearch]});
|
|
||||||
}
|
|
||||||
$scope.filteredObj = $scope.facetsObj;
|
|
||||||
};
|
|
||||||
$scope.addFacets = function(facets) {
|
|
||||||
// add a facets javascript object to the existing list
|
|
||||||
for (var facet in facets) {
|
|
||||||
$scope.facetsObj.append(facet);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
$scope.copyFacets = function(facets) {
|
|
||||||
var ret = [];
|
|
||||||
for (var i=0; i<facets.length; i++) {
|
|
||||||
var facet = Object.create(facets[i]);
|
|
||||||
if (facets[i].options !== undefined) {
|
|
||||||
facet.options = [];
|
|
||||||
for (var j=0; j<facets[i].options.length; j++) {
|
|
||||||
facet.options.push(Object.create(facets[i].options[j]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ret.push(facet);
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
};
|
|
||||||
// removes a facet from the menu
|
|
||||||
$scope.deleteFacetSelection = function(facetParts) {
|
|
||||||
angular.forEach($scope.facetsObj.slice(), function(facet, idx) {
|
|
||||||
if (facet.name == facetParts[0]) {
|
|
||||||
if (facet.options === undefined) {
|
|
||||||
return; // allow free-form facets to remain
|
|
||||||
}
|
|
||||||
for (var i=0; i<facet.options.length; i++) {
|
|
||||||
var option = facet.options[i];
|
|
||||||
if (option.key == facetParts[1]) {
|
|
||||||
$scope.facetsObj[idx].options.splice($scope.facetsObj[idx].options.indexOf(option), 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (facet.options.length === 0) {
|
|
||||||
$scope.facetsObj.splice($scope.facetsObj.indexOf(facet), 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
$scope.deleteFacetEntirely = function(facetParts) {
|
|
||||||
// remove entire facet
|
|
||||||
angular.forEach($scope.facetsObj.slice(), function(facet, idx) {
|
|
||||||
if (facet.name == facetParts[0]) {
|
|
||||||
$scope.facetsObj.splice($scope.facetsObj.indexOf(facet), 1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
searchInput.on('keydown', function($event) {
|
|
||||||
var key = $event.keyCode || $event.charCode;
|
|
||||||
if (key == 9) { // prevent default when we can.
|
|
||||||
$event.preventDefault();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
searchInput.on('keyup', function($event) { // handle ctrl-char input
|
|
||||||
if ($event.metaKey === true) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var searchVal = searchInput.val();
|
|
||||||
var key = $event.keyCode || $event.charCode;
|
|
||||||
if (key == 9) { // tab, so select facet if narrowed down to 1
|
|
||||||
if ($scope.facetSelected === undefined) {
|
|
||||||
if ($scope.filteredObj.length != 1) return;
|
|
||||||
$scope.facetClicked(0, '', $scope.filteredObj[0].name);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if ($scope.filteredOptions === undefined || $scope.filteredOptions.length != 1) return;
|
|
||||||
$scope.optionClicked(0, '', $scope.filteredOptions[0].key);
|
|
||||||
$scope.resetState();
|
|
||||||
}
|
|
||||||
$timeout(function() {
|
|
||||||
searchInput.val('');
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (key == 27) { // esc, so cancel and reset everthing
|
|
||||||
$timeout(function() {
|
|
||||||
$scope.hideMenu();
|
|
||||||
searchInput.val('');
|
|
||||||
});
|
|
||||||
$scope.resetState();
|
|
||||||
var textFilter = $scope.textSearch;
|
|
||||||
if (textFilter === undefined) {
|
|
||||||
textFilter = '';
|
|
||||||
}
|
|
||||||
$scope.$emit('textSearch', textFilter, $scope.filter_keys);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (key == 13) { // enter, so accept value
|
|
||||||
// if tag search, treat as regular facet
|
|
||||||
if ($scope.facetSelected && $scope.facetSelected.options === undefined) {
|
|
||||||
var curr = $scope.facetSelected;
|
|
||||||
curr.name = curr.name + '=' + searchVal;
|
|
||||||
curr.label[1] = searchVal;
|
|
||||||
$scope.currentSearch.push(curr);
|
|
||||||
$scope.resetState();
|
|
||||||
$scope.emitQuery();
|
|
||||||
$scope.showMenu();
|
|
||||||
}
|
|
||||||
// if text search treat as search
|
|
||||||
else {
|
|
||||||
for (i=0; i<$scope.currentSearch.length; i++) {
|
|
||||||
if ($scope.currentSearch[i].name.indexOf('text') === 0) {
|
|
||||||
$scope.currentSearch.splice(i, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$scope.currentSearch.push({'name':'text='+searchVal, 'label':[$scope.strings.text, searchVal]});
|
|
||||||
$scope.$apply();
|
|
||||||
$scope.hideMenu();
|
|
||||||
searchInput.val('');
|
|
||||||
$scope.$emit('textSearch', searchVal, $scope.filter_keys);
|
|
||||||
$scope.textSearch = searchVal;
|
|
||||||
}
|
|
||||||
$scope.filteredObj = $scope.facetsObj;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (searchVal === '') {
|
|
||||||
$scope.filteredObj = $scope.facetsObj;
|
|
||||||
$scope.$apply();
|
|
||||||
$scope.$emit('textSearch', '', $scope.filter_keys);
|
|
||||||
if ($scope.facetSelected && $scope.facetSelected.options === undefined) {
|
|
||||||
$scope.resetState();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$scope.filterFacets(searchVal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
searchInput.on('keypress', function($event) { // handle character input
|
|
||||||
var searchVal = searchInput.val();
|
|
||||||
var key = $event.which || $event.keyCode || $event.charCode;
|
|
||||||
if (key != 8 && key != 46 && key != 13 && key != 9 && key != 27) {
|
|
||||||
searchVal = searchVal + String.fromCharCode(key).toLowerCase();
|
|
||||||
}
|
|
||||||
if (searchVal == ' ') { // space and field is empty, show menu
|
|
||||||
$scope.showMenu();
|
|
||||||
$timeout(function() {
|
|
||||||
searchInput.val('');
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (searchVal === '') {
|
|
||||||
$scope.filteredObj = $scope.facetsObj;
|
|
||||||
$scope.$apply();
|
|
||||||
$scope.$emit('textSearch', '', $scope.filter_keys);
|
|
||||||
if ($scope.facetSelected && $scope.facetSelected.options === undefined) {
|
|
||||||
$scope.resetState();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (key != 8 && key != 46) {
|
|
||||||
$scope.filterFacets(searchVal);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$scope.filterFacets = function(searchVal) {
|
|
||||||
// try filtering facets/options.. if no facets match, do text search
|
|
||||||
var i, idx, label;
|
|
||||||
var filtered = [];
|
|
||||||
if ($scope.facetSelected === undefined) {
|
|
||||||
$scope.filteredObj = $scope.facetsObj;
|
|
||||||
for (i=0; i<$scope.filteredObj.length; i++) {
|
|
||||||
var facet = $scope.filteredObj[i];
|
|
||||||
idx = facet.label.toLowerCase().indexOf(searchVal);
|
|
||||||
if (idx > -1) {
|
|
||||||
label = [facet.label.substring(0, idx), facet.label.substring(idx, idx + searchVal.length), facet.label.substring(idx + searchVal.length)];
|
|
||||||
filtered.push({'name':facet.name, 'label':label, 'options':facet.options});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (filtered.length > 0) {
|
|
||||||
$scope.showMenu();
|
|
||||||
$timeout(function() {
|
|
||||||
$scope.filteredObj = filtered;
|
|
||||||
}, 0.1);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$scope.$emit('textSearch', searchVal, $scope.filter_keys);
|
|
||||||
$scope.hideMenu();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else { // assume option search
|
|
||||||
$scope.filteredOptions = $scope.facetOptions;
|
|
||||||
if ($scope.facetOptions === undefined) { // no options, assume free form text facet
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (i=0; i<$scope.filteredOptions.length; i++) {
|
|
||||||
var option = $scope.filteredOptions[i];
|
|
||||||
idx = option.label.toLowerCase().indexOf(searchVal);
|
|
||||||
if (idx > -1) {
|
|
||||||
label = [option.label.substring(0, idx), option.label.substring(idx, idx + searchVal.length), option.label.substring(idx + searchVal.length)];
|
|
||||||
filtered.push({'key':option.key, 'label':label});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (filtered.length > 0) {
|
|
||||||
$scope.showMenu();
|
|
||||||
$timeout(function() {
|
|
||||||
$scope.filteredOptions = filtered;
|
|
||||||
}, 0.1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// enable text entry when mouse clicked anywhere in search box
|
|
||||||
$element.find('.search-main-area').on('click', function($event) {
|
|
||||||
var target = $($event.target);
|
|
||||||
if (target.is('.search-main-area')) {
|
|
||||||
searchInput.trigger('focus');
|
|
||||||
$scope.showMenu();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// when facet clicked, add 1st part of facet and set up options
|
|
||||||
$scope.facetClicked = function($index, $event, name) {
|
|
||||||
$scope.hideMenu();
|
|
||||||
var facet = $scope.filteredObj[$index];
|
|
||||||
var label = facet.label;
|
|
||||||
if (Array.isArray(label)) {
|
|
||||||
label = label.join('');
|
|
||||||
}
|
|
||||||
$scope.facetSelected = {'name':facet.name, 'label':[label, '']};
|
|
||||||
if (facet.options !== undefined) {
|
|
||||||
$scope.filteredOptions = $scope.facetOptions = facet.options;
|
|
||||||
$scope.showMenu();
|
|
||||||
}
|
|
||||||
$timeout(function() {
|
|
||||||
searchInput.val('');
|
|
||||||
});
|
|
||||||
$scope.strings.prompt = '';
|
|
||||||
$timeout(function() {
|
|
||||||
searchInput.focus();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
// when option clicked, complete facet and send event
|
|
||||||
$scope.optionClicked = function($index, $event, name) {
|
|
||||||
$scope.hideMenu();
|
|
||||||
var curr = $scope.facetSelected;
|
|
||||||
curr.name = curr.name + '=' + name;
|
|
||||||
curr.label[1] = $scope.filteredOptions[$index].label;
|
|
||||||
if (Array.isArray(curr.label[1])) {
|
|
||||||
curr.label[1] = curr.label[1].join('');
|
|
||||||
}
|
|
||||||
$scope.currentSearch.push(curr);
|
|
||||||
$scope.resetState();
|
|
||||||
$scope.emitQuery();
|
|
||||||
$scope.showMenu();
|
|
||||||
};
|
|
||||||
// send event with new query string
|
|
||||||
$scope.emitQuery = function(removed) {
|
|
||||||
var query = '';
|
|
||||||
for (var i=0; i<$scope.currentSearch.length; i++) {
|
|
||||||
if ($scope.currentSearch[i].name.indexOf('text') !== 0) {
|
|
||||||
if (query.length > 0) query = query + "&";
|
|
||||||
query = query + $scope.currentSearch[i].name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (removed !== undefined && removed.indexOf('text') === 0) {
|
|
||||||
$scope.$emit('textSearch', '', $scope.filter_keys);
|
|
||||||
$scope.textSearch = undefined;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$scope.$emit('searchUpdated', query);
|
|
||||||
if ($scope.currentSearch.length > 0) {
|
|
||||||
// prune facets as needed from menus
|
|
||||||
var newFacet = $scope.currentSearch[$scope.currentSearch.length-1].name;
|
|
||||||
var facetParts = newFacet.split('=');
|
|
||||||
angular.forEach($scope.facetsSave, function(facet, idx) {
|
|
||||||
if (facet.name == facetParts[0]) {
|
|
||||||
if (facet.singleton === true) {
|
|
||||||
$scope.deleteFacetEntirely(facetParts);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$scope.deleteFacetSelection(facetParts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// remove facet and either update filter or search
|
|
||||||
$scope.removeFacet = function($index, $event) {
|
|
||||||
var removed = $scope.currentSearch[$index].name;
|
|
||||||
$scope.currentSearch.splice($index, 1);
|
|
||||||
if ($scope.facetSelected === undefined) {
|
|
||||||
$scope.emitQuery(removed);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$scope.resetState();
|
|
||||||
searchInput.val('');
|
|
||||||
}
|
|
||||||
if ($scope.currentSearch.length === 0) {
|
|
||||||
$scope.strings.prompt = $scope.promptString;
|
|
||||||
}
|
|
||||||
// re-init to restore facets cleanly
|
|
||||||
$scope.facetsObj = $scope.copyFacets($scope.facetsSave);
|
|
||||||
$scope.currentSearch = [];
|
|
||||||
$scope.initFacets();
|
|
||||||
};
|
|
||||||
// clear entire searchbar
|
|
||||||
$scope.clearSearch = function() {
|
|
||||||
if ($scope.currentSearch.length > 0) {
|
|
||||||
$scope.currentSearch = [];
|
|
||||||
$scope.facetsObj = $scope.copyFacets($scope.facetsSave);
|
|
||||||
$scope.resetState();
|
|
||||||
$scope.$emit('searchUpdated', '');
|
|
||||||
$scope.$emit('textSearch', '', $scope.filter_keys);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
$scope.isMatchLabel = function(label) {
|
|
||||||
return Array.isArray(label);
|
|
||||||
};
|
|
||||||
$scope.resetState = function() {
|
|
||||||
searchInput.val('');
|
|
||||||
$scope.filteredObj = $scope.facetsObj;
|
|
||||||
$scope.facetSelected = undefined;
|
|
||||||
$scope.facetOptions = undefined;
|
|
||||||
$scope.filteredOptions = undefined;
|
|
||||||
if ($scope.currentSearch.length === 0) {
|
|
||||||
$scope.strings.prompt = $scope.promptString;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
// showMenu and hideMenu depend on foundation's dropdown. They need
|
|
||||||
// to be modified to work with another dropdown implemenation (i.e. bootstrap)
|
|
||||||
$scope.showMenu = function() {
|
|
||||||
$timeout(function() {
|
|
||||||
if ($('#facet-drop').hasClass('open') === false && $scope.filteredObj.length > 0) {
|
|
||||||
$('.search-input').trigger('click');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
$scope.hideMenu = function() {
|
|
||||||
$(document).foundation('dropdown', 'closeall');
|
|
||||||
};
|
|
||||||
$scope.initSearch();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
})
|
|
||||||
;
|
|
@ -1,109 +0,0 @@
|
|||||||
/* Copyright 2014-2015 Eucalyptus Systems, Inc. */
|
|
||||||
|
|
||||||
/*-----------------------------------------
|
|
||||||
Colors
|
|
||||||
----------------------------------------- */
|
|
||||||
$bordercolor: #ccc;
|
|
||||||
$iconcolor: #6a737b;
|
|
||||||
$textcolor: #444;
|
|
||||||
$background: white;
|
|
||||||
$itembackground: #e6e7e8;
|
|
||||||
|
|
||||||
/*-----------------------------------------
|
|
||||||
Item list
|
|
||||||
----------------------------------------- */
|
|
||||||
@mixin item-list {
|
|
||||||
.item-list {
|
|
||||||
position: relative;
|
|
||||||
//top: -0.30rem;
|
|
||||||
.item {
|
|
||||||
color: #333;
|
|
||||||
background-color: $itembackground;
|
|
||||||
height: 1.3rem;
|
|
||||||
margin-right: 0.5rem;
|
|
||||||
a {
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@-moz-document url-prefix() {
|
|
||||||
.item-list {
|
|
||||||
.item {
|
|
||||||
top: -0.40rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.search-selected {
|
|
||||||
top: -0.40rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*-----------------------------------------
|
|
||||||
Magic Search bar
|
|
||||||
----------------------------------------- */
|
|
||||||
.search-bar {
|
|
||||||
position: relative;
|
|
||||||
border: 1px solid $bordercolor;
|
|
||||||
background-color: $background;
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
padding: 0.25rem;
|
|
||||||
height: auto;
|
|
||||||
i.fi-filter {
|
|
||||||
color: $iconcolor;
|
|
||||||
position: absolute;
|
|
||||||
top: 0.35rem;
|
|
||||||
left: 0.65rem;
|
|
||||||
}
|
|
||||||
.search-main-area {
|
|
||||||
position: relative;
|
|
||||||
margin-left: 1.65rem;
|
|
||||||
margin-right: 1.65rem;
|
|
||||||
cursor: text;
|
|
||||||
}
|
|
||||||
@include item-list;
|
|
||||||
//.item-list {
|
|
||||||
// margin-bottom: 0.125rem;
|
|
||||||
//}
|
|
||||||
.search-selected {
|
|
||||||
position: relative;
|
|
||||||
padding-left: 0;
|
|
||||||
padding-right: 0;
|
|
||||||
background-color: $background;
|
|
||||||
color: $textcolor;
|
|
||||||
}
|
|
||||||
.search-entry {
|
|
||||||
position: relative;
|
|
||||||
display: inline-block;
|
|
||||||
height: 1.5rem;
|
|
||||||
height: 1.5rem;
|
|
||||||
}
|
|
||||||
.search-input {
|
|
||||||
width: 17.5rem;
|
|
||||||
border: 0;
|
|
||||||
box-shadow: none;
|
|
||||||
height: 1.5rem;
|
|
||||||
padding: 0.25rem;
|
|
||||||
margin-bottom: 0;
|
|
||||||
background-color: $background;
|
|
||||||
&:focus {
|
|
||||||
box-shadow: none;
|
|
||||||
background-color: $background;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.match {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
i.cancel {
|
|
||||||
color: $iconcolor;
|
|
||||||
&:hover {
|
|
||||||
color: darkred;
|
|
||||||
}
|
|
||||||
position: absolute;
|
|
||||||
top: 0.35rem;
|
|
||||||
right: 0.65rem;
|
|
||||||
}
|
|
||||||
.f-dropdown.open {
|
|
||||||
left: 0 !important;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user