From: Michael Tremer Date: Tue, 31 May 2022 16:17:39 +0000 (+0000) Subject: Drop unused package name autocompletion X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=981f992edfc8972227cf6148fdc5af0314490096;p=pbs.git Drop unused package name autocompletion Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index f5ae5f18..95e2eb96 100644 --- a/Makefile.am +++ b/Makefile.am @@ -124,7 +124,6 @@ hubdir = $(buildservicedir)/hub web_PYTHON = \ src/web/__init__.py \ - src/web/api.py \ src/web/auth.py \ src/web/base.py \ src/web/builders.py \ diff --git a/src/buildservice/packages.py b/src/buildservice/packages.py index bfdeb9dd..7ed07fdd 100644 --- a/src/buildservice/packages.py +++ b/src/buildservice/packages.py @@ -157,13 +157,6 @@ class Packages(base.Object): return files - def autocomplete(self, query, limit=8): - res = self.db.query("SELECT DISTINCT name FROM packages \ - WHERE packages.name LIKE %s AND packages.type = %s \ - ORDER BY packages.name LIMIT %s", "%%%s%%" % query, "source", limit) - - return [row.name for row in res] - class Package(base.DataObject): table = "packages" diff --git a/src/static/js/pbs.js b/src/static/js/pbs.js index 92980e53..10288e27 100644 --- a/src/static/js/pbs.js +++ b/src/static/js/pbs.js @@ -14,16 +14,6 @@ $(document).ready(function() { // Activate tooltips. $("a[rel=tooltip]").tooltip(); $("span[rel=tooltip]").tooltip(); - - $(".typeahead-packages-autocomplete").typeahead({ - source: function(query, process) { - $.get("/api/packages/autocomplete", { q: query }, function(data) { - if (data.query == query) { - process(data.packages); - } - }); - }, - }); }); function getCookie(name) { diff --git a/src/web/__init__.py b/src/web/__init__.py index 649cb127..6872e154 100644 --- a/src/web/__init__.py +++ b/src/web/__init__.py @@ -9,7 +9,6 @@ from .. import Backend from ..constants import * # Import all handlers -from . import api from . import auth from . import builders from . import builds @@ -214,9 +213,6 @@ class Application(tornado.web.Application): # Log (r"/log", LogHandler), - - # API handlers - (r"/api/packages/autocomplete", api.ApiPackagesAutocomplete), ], default_handler_class=errors.Error404Handler, **settings) # Launch backend diff --git a/src/web/api.py b/src/web/api.py deleted file mode 100644 index ad28fe1c..00000000 --- a/src/web/api.py +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/python - -import tornado.web - -from . import base - -class ApiPackagesAutocomplete(base.BaseHandler): - def get(self): - query = self.get_argument("q") - if not query: - raise tornado.web.HTTPError(400) - - # Query database. - packages = self.backend.packages.autocomplete(query, limit=8) - - res = { - "query" : query, - "packages" : packages, - } - - self.write(res)