Merge branch 'master' into 12107-faster-git
[arvados.git] / apps / workbench / app / assets / javascripts / components / collections.js
index a2054c1a03673cebcdef0b4f549e4c9ae8a74f31..33fca6c7b770bf35354244e1d783de77c571cb80 100644 (file)
@@ -47,7 +47,16 @@ window.CollectionsTable = {
             m('tbody', [
                 loader.items().map(function(item) {
                     return m('tr', [
-                        m('td', m('a.btn.btn-xs.btn-default', {href: item.session.baseURL.replace('://', '://workbench.')+'collections/'+item.uuid}, 'Show')),
+                        m('td', [
+                            // Guess workbench.{apihostport} is a
+                            // Workbench... unless the host part of
+                            // apihostport is an IPv4 or [IPv6]
+                            // address.
+                            item.session.baseURL.match('://(\\[|\\d+\\.\\d+\\.\\d+\\.\\d+[:/])') ? null :
+                                m('a.btn.btn-xs.btn-default', {
+                                    href: item.session.baseURL.replace('://', '://workbench.')+'collections/'+item.uuid,
+                                }, 'Show'),
+                        ]),
                         m('td.arvados-uuid', item.uuid),
                         m('td', item.name || '(unnamed)'),
                         m('td', m(LocalizedDateTime, {parse: item.modified_at})),
@@ -92,8 +101,11 @@ window.CollectionsSearch = {
                     return new MultipageLoader({
                         sessionKey: key,
                         loadFunc: function(filters) {
-                            if (q)
-                                filters.push(['any', '@@', q+':*'])
+                            var tsquery = to_tsquery(q)
+                            if (tsquery) {
+                                filters = filters.slice(0)
+                                filters.push(['any', '@@', tsquery])
+                            }
                             return vnode.state.sessionDB.request(session, 'arvados/v1/collections', {
                                 data: {
                                     filters: JSON.stringify(filters),
@@ -116,14 +128,14 @@ window.CollectionsSearch = {
         return m('form', {
             onsubmit: function() {
                 vnode.state.searchActive(vnode.state.searchEntered())
-                vnode.state.forgetSavedState = true
+                vnode.state.forgetSavedHeight = true
                 return false
             },
         }, [
             m(SaveUIState, {
                 defaultState: '',
                 currentState: vnode.state.searchActive,
-                forgetSavedState: vnode.state.forgetSavedState,
+                forgetSavedHeight: vnode.state.forgetSavedHeight,
                 saveBodyHeight: true,
             }),
             vnode.state.loader && [