Example #1
0
 def autocomplete(self, **kwargs):
     """
     Provides autocomplete functionality for DAS web UI.
     """
     query = kwargs.get("query", "").strip()
     result = autocomplete_helper(query, self.dasmgr, self.daskeys)
     dataset = [r for r in result if r["value"].find("dataset=") != -1]
     dbsinst = kwargs.get("dbs_instance", self.dbs_global)
     if self.dataset_daemon and len(dataset):
         dbsmgr = self._get_dbsmgr(dbsinst)
         if query.find("dataset=") != -1:
             query = query.replace("dataset=", "")
         for row in dbsmgr.find(query):
             result.append({"css": "ac-info", "value": "dataset=%s" % row, "info": "dataset"})
     return result
Example #2
0
 def autocomplete(self, **kwargs):
     """
     Provides autocomplete functionality for DAS web UI.
     """
     query = kwargs.get("query", "").strip()
     result = autocomplete_helper(query, self.dasmgr, self.daskeys)
     dataset = [r for r in result if r['value'].find('dataset=')!=-1]
     dbsinst = kwargs.get('dbs_instance', self.dbs_global)
     if  self.dataset_daemon and len(dataset):
         dbs_urls = [d for d in self.dbsmgr.keys() if d.find(dbsinst) != -1]
         if  len(dbs_urls) == 1:
             dbsmgr = self.dbsmgr[dbs_urls[0]]
             if  query.find('dataset=') != -1:
                 query = query.replace('dataset=', '')
             for row in dbsmgr.find(query):
                 result.append({'css': 'ac-info',
                                'value': 'dataset=%s' % row,
                                'info': 'dataset'})
     return result
Example #3
0
 def autocomplete(self, **kwargs):
     """
     Provides autocomplete functionality for DAS web UI.
     """
     query = kwargs.get("query", "").strip()
     result = autocomplete_helper(query, self.dasmgr, self.daskeys)
     dataset = [r for r in result if r['value'].find('dataset=')!=-1]
     dbsinst = kwargs.get('dbs_instance', self.dbs_global)
     if  self.dataset_daemon and len(dataset):
         dbsmgr = self._get_dbsmgr(dbsinst)
         # we shall autocomplete the last token so queries like
         # file dataset=/ZMM/.. are autocompleted
         prefix = ''
         if ' ' in query:
             prefix = '  '.join(query.split()[:-1]) + ' '
             print('prefix=', prefix)
             query = query.split()[-1]
         if  query.find('dataset=') != -1:
             query = query.replace('dataset=', '')
         for row in dbsmgr.find(query):
             result.append({'css': 'ac-info',
                            'value': prefix + 'dataset=%s' % row,
                            'info': 'dataset'})
     return result