12483: Merge branch 'master' into 12483-writable-fs
[arvados.git] / apps / workbench / app / assets / javascripts / components / search.js
index 0e879413ac7e400fc4830312e79dcdf106c7d459..2fe73193e7f116fcda6c2831c8c2250c2a266aee 100644 (file)
@@ -37,6 +37,10 @@ window.SearchResultsTable = {
     },
     view: function(vnode) {
         var loader = vnode.attrs.loader
+        var iconsMap = {
+            collections: m('i.fa.fa-fw.fa-archive'),
+            projects: m('i.fa.fa-fw.fa-folder'),
+        }
         return m('table.table.table-condensed', [
             m('thead', m('tr', [
                 m('th'),
@@ -50,9 +54,13 @@ window.SearchResultsTable = {
                         m('td', [
                             item.workbenchBaseURL() &&
                                 m('a.btn.btn-xs.btn-default', {
-                                    title: 'Show '+item.objectType.description,
+                                    'data-original-title': 'show '+item.objectType.description,
+                                    'data-placement': 'top',
+                                    'data-toggle': 'tooltip',
                                     href: item.workbenchBaseURL()+'/'+item.objectType.wb_path+'/'+item.uuid,
-                                }, item.objectType.label),
+                                    // Bootstrap's tooltip feature
+                                    oncreate: function(vnode) { $(vnode.dom).tooltip() },
+                                }, iconsMap[item.objectType.wb_path]),
                         ]),
                         m('td.arvados-uuid', item.uuid),
                         m('td', item.name || '(unnamed)'),
@@ -100,37 +108,31 @@ window.Search = {
                     }
                     var searchable_objects = [
                         {
-                            wb_path: 'groups',
+                            wb_path: 'projects',
                             api_path: 'arvados/v1/groups',
                             filters: [['group_class', '=', 'project']],
-                            label: 'P',
-                            description: 'Project',
+                            description: 'project',
                         },
                         {
                             wb_path: 'collections',
                             api_path: 'arvados/v1/collections',
                             filters: [],
-                            label: 'C',
-                            description: 'Collection',
+                            description: 'collection',
                         },
                     ]
                     return new MergingLoader({
                         sessionKey: key,
                         // For every session, search for every object type
-                        children: searchable_objects.map(function(obj_type){
+                        children: searchable_objects.map(function(obj_type) {
                             return new MultipageLoader({
                                 sessionKey: key,
-                                objectKind: obj_type.label,
                                 loadFunc: function(filters) {
+                                    // Apply additional type dependant filters
+                                    filters = filters.concat(obj_type.filters)
                                     var tsquery = to_tsquery(q)
                                     if (tsquery) {
-                                        filters = filters.slice(0)
                                         filters.push(['any', '@@', tsquery])
                                     }
-                                    // Apply additional type dependant filters, if any.
-                                    for (var f of obj_type.filters) {
-                                        filters.push(f)
-                                    }
                                     return vnode.state.sessionDB.request(session, obj_type.api_path, {
                                         data: {
                                             filters: JSON.stringify(filters),
@@ -145,9 +147,9 @@ window.Search = {
                                     })
                                 },
                             })
-                        })
+                        }),
                     })
-                })
+                }),
             })
         })
     },