globalSearch.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. const subManager = new SubsManager();
  2. BlazeComponent.extendComponent({
  3. events() {
  4. return [
  5. {
  6. 'click .js-due-cards-view-change': Popup.open('globalSearchViewChange'),
  7. },
  8. ];
  9. },
  10. }).register('globalSearchHeaderBar');
  11. Template.globalSearch.helpers({
  12. userId() {
  13. return Meteor.userId();
  14. },
  15. });
  16. BlazeComponent.extendComponent({
  17. events() {
  18. return [
  19. {
  20. 'click .js-due-cards-view-me'() {
  21. Utils.setDueCardsView('me');
  22. Popup.close();
  23. },
  24. 'click .js-due-cards-view-all'() {
  25. Utils.setDueCardsView('all');
  26. Popup.close();
  27. },
  28. },
  29. ];
  30. },
  31. }).register('globalSearchViewChangePopup');
  32. BlazeComponent.extendComponent({
  33. onCreated() {
  34. this.searching = new ReactiveVar(false);
  35. this.hasResults = new ReactiveVar(false);
  36. this.hasQueryErrors = new ReactiveVar(false);
  37. this.query = new ReactiveVar('');
  38. this.resultsHeading = new ReactiveVar('');
  39. this.searchLink = new ReactiveVar(null);
  40. this.myLists = new ReactiveVar([]);
  41. this.myLabelNames = new ReactiveVar([]);
  42. this.myBoardNames = new ReactiveVar([]);
  43. this.results = new ReactiveVar([]);
  44. this.hasNextPage = new ReactiveVar(false);
  45. this.hasPreviousPage = new ReactiveVar(false);
  46. this.queryParams = null;
  47. this.parsingErrors = [];
  48. this.resultsCount = 0;
  49. this.totalHits = 0;
  50. this.queryErrors = null;
  51. this.colorMap = null;
  52. this.resultsPerPage = 25;
  53. Meteor.call('myLists', (err, data) => {
  54. if (!err) {
  55. this.myLists.set(data);
  56. }
  57. });
  58. Meteor.call('myLabelNames', (err, data) => {
  59. if (!err) {
  60. this.myLabelNames.set(data);
  61. }
  62. });
  63. Meteor.call('myBoardNames', (err, data) => {
  64. if (!err) {
  65. this.myBoardNames.set(data);
  66. }
  67. });
  68. },
  69. onRendered() {
  70. Meteor.subscribe('setting');
  71. // eslint-disable-next-line no-console
  72. //console.log('lang:', TAPi18n.getLanguage());
  73. this.colorMap = Boards.colorMap();
  74. // eslint-disable-next-line no-console
  75. // console.log('colorMap:', this.colorMap);
  76. if (Session.get('globalQuery')) {
  77. this.searchAllBoards(Session.get('globalQuery'));
  78. }
  79. },
  80. resetSearch() {
  81. this.searching.set(false);
  82. this.results.set([]);
  83. this.hasResults.set(false);
  84. this.hasQueryErrors.set(false);
  85. this.resultsHeading.set('');
  86. this.parsingErrors = [];
  87. this.resultsCount = 0;
  88. this.totalHits = 0;
  89. this.queryErrors = null;
  90. },
  91. getSessionData() {
  92. return SessionData.findOne({
  93. userId: Meteor.userId(),
  94. sessionId: SessionData.getSessionId(),
  95. });
  96. },
  97. getResults() {
  98. // eslint-disable-next-line no-console
  99. // console.log('getting results');
  100. if (this.queryParams) {
  101. const sessionData = this.getSessionData();
  102. // eslint-disable-next-line no-console
  103. // console.log('selector:', sessionData.getSelector());
  104. // console.log('session data:', sessionData);
  105. const projection = sessionData.getProjection();
  106. projection.skip = 0;
  107. const cards = Cards.find(
  108. { _id: { $in: sessionData.cards } },
  109. projection,
  110. );
  111. this.queryErrors = sessionData.errors;
  112. if (this.queryErrors.length) {
  113. this.hasQueryErrors.set(true);
  114. return null;
  115. }
  116. if (cards) {
  117. this.totalHits = sessionData.totalHits;
  118. this.resultsCount = cards.count();
  119. this.resultsStart = sessionData.lastHit - this.resultsCount + 1;
  120. this.resultsEnd = sessionData.lastHit;
  121. this.resultsHeading.set(this.getResultsHeading());
  122. this.results.set(cards);
  123. this.hasNextPage.set(sessionData.lastHit < sessionData.totalHits);
  124. this.hasPreviousPage.set(
  125. sessionData.lastHit - sessionData.resultsCount > 0,
  126. );
  127. }
  128. }
  129. this.resultsCount = 0;
  130. return null;
  131. },
  132. errorMessages() {
  133. if (this.parsingErrors.length) {
  134. return this.parsingErrorMessages();
  135. }
  136. return this.queryErrorMessages();
  137. },
  138. parsingErrorMessages() {
  139. const messages = [];
  140. if (this.parsingErrors.length) {
  141. this.parsingErrors.forEach(err => {
  142. messages.push(TAPi18n.__(err.tag, err.value));
  143. });
  144. }
  145. return messages;
  146. },
  147. queryErrorMessages() {
  148. messages = [];
  149. this.queryErrors.forEach(err => {
  150. let value = err.color ? TAPi18n.__(`color-${err.value}`) : err.value;
  151. if (!value) {
  152. value = err.value;
  153. }
  154. messages.push(TAPi18n.__(err.tag, value));
  155. });
  156. return messages;
  157. },
  158. searchAllBoards(query) {
  159. query = query.trim();
  160. // eslint-disable-next-line no-console
  161. //console.log('query:', query);
  162. this.query.set(query);
  163. this.resetSearch();
  164. if (!query) {
  165. return;
  166. }
  167. this.searching.set(true);
  168. const reOperator1 = new RegExp(
  169. '^((?<operator>[\\p{Letter}\\p{Mark}]+):|(?<abbrev>[#@]))(?<value>[\\p{Letter}\\p{Mark}]+)(\\s+|$)',
  170. 'iu',
  171. );
  172. const reOperator2 = new RegExp(
  173. '^((?<operator>[\\p{Letter}\\p{Mark}]+):|(?<abbrev>[#@]))(?<quote>["\']*)(?<value>.*?)\\k<quote>(\\s+|$)',
  174. 'iu',
  175. );
  176. const reText = new RegExp('^(?<text>\\S+)(\\s+|$)', 'u');
  177. const reQuotedText = new RegExp(
  178. '^(?<quote>["\'])(?<text>.*?)\\k<quote>(\\s+|$)',
  179. 'u',
  180. );
  181. const reNegatedOperator = new RegExp('^-(?<operator>.*)$');
  182. const operators = {
  183. 'operator-board': 'boards',
  184. 'operator-board-abbrev': 'boards',
  185. 'operator-swimlane': 'swimlanes',
  186. 'operator-swimlane-abbrev': 'swimlanes',
  187. 'operator-list': 'lists',
  188. 'operator-list-abbrev': 'lists',
  189. 'operator-label': 'labels',
  190. 'operator-label-abbrev': 'labels',
  191. 'operator-user': 'users',
  192. 'operator-user-abbrev': 'users',
  193. 'operator-member': 'members',
  194. 'operator-member-abbrev': 'members',
  195. 'operator-assignee': 'assignees',
  196. 'operator-assignee-abbrev': 'assignees',
  197. 'operator-status': 'status',
  198. 'operator-due': 'dueAt',
  199. 'operator-created': 'createdAt',
  200. 'operator-modified': 'modifiedAt',
  201. 'operator-comment': 'comments',
  202. 'operator-has': 'has',
  203. 'operator-sort': 'sort',
  204. };
  205. const predicates = {
  206. due: {
  207. 'predicate-overdue': 'overdue',
  208. },
  209. durations: {
  210. 'predicate-week': 'week',
  211. 'predicate-month': 'month',
  212. 'predicate-quarter': 'quarter',
  213. 'predicate-year': 'year',
  214. },
  215. status: {
  216. 'predicate-archived': 'archived',
  217. 'predicate-all': 'all',
  218. 'predicate-ended': 'ended',
  219. 'predicate-public': 'public',
  220. 'predicate-private': 'private',
  221. },
  222. sorts: {
  223. 'predicate-due': 'dueAt',
  224. 'predicate-created': 'createdAt',
  225. 'predicate-modified': 'modifiedAt',
  226. },
  227. has: {
  228. 'predicate-description': 'description',
  229. 'predicate-checklist': 'checklist',
  230. 'predicate-attachment': 'attachment',
  231. },
  232. };
  233. const predicateTranslations = {};
  234. Object.entries(predicates).forEach(([category, catPreds]) => {
  235. predicateTranslations[category] = {};
  236. Object.entries(catPreds).forEach(([tag, value]) => {
  237. predicateTranslations[category][TAPi18n.__(tag)] = value;
  238. });
  239. });
  240. // eslint-disable-next-line no-console
  241. // console.log('predicateTranslations:', predicateTranslations);
  242. const operatorMap = {};
  243. Object.entries(operators).forEach(([key, value]) => {
  244. operatorMap[TAPi18n.__(key).toLowerCase()] = value;
  245. });
  246. // eslint-disable-next-line no-console
  247. // console.log('operatorMap:', operatorMap);
  248. const params = {
  249. limit: this.resultsPerPage,
  250. boards: [],
  251. swimlanes: [],
  252. lists: [],
  253. users: [],
  254. members: [],
  255. assignees: [],
  256. labels: [],
  257. status: [],
  258. dueAt: null,
  259. createdAt: null,
  260. modifiedAt: null,
  261. comments: [],
  262. has: [],
  263. };
  264. let text = '';
  265. while (query) {
  266. m = query.match(reOperator1);
  267. if (!m) {
  268. m = query.match(reOperator2);
  269. if (m) {
  270. query = query.replace(reOperator2, '');
  271. }
  272. } else {
  273. query = query.replace(reOperator1, '');
  274. }
  275. if (m) {
  276. let op;
  277. if (m.groups.operator) {
  278. op = m.groups.operator.toLowerCase();
  279. } else {
  280. op = m.groups.abbrev.toLowerCase();
  281. }
  282. // eslint-disable-next-line no-prototype-builtins
  283. if (operatorMap.hasOwnProperty(op)) {
  284. let value = m.groups.value;
  285. if (operatorMap[op] === 'labels') {
  286. if (value in this.colorMap) {
  287. value = this.colorMap[value];
  288. // console.log('found color:', value);
  289. }
  290. } else if (
  291. ['dueAt', 'createdAt', 'modifiedAt'].includes(operatorMap[op])
  292. ) {
  293. let days = parseInt(value, 10);
  294. let duration = null;
  295. if (isNaN(days)) {
  296. if (predicateTranslations.durations[value]) {
  297. duration = predicateTranslations.durations[value];
  298. value = moment();
  299. } else if (predicateTranslations.due[value] === 'overdue') {
  300. value = moment();
  301. duration = 'days';
  302. days = 0;
  303. } else {
  304. this.parsingErrors.push({
  305. tag: 'operator-number-expected',
  306. value: { operator: op, value },
  307. });
  308. value = null;
  309. }
  310. } else {
  311. value = moment();
  312. }
  313. if (value) {
  314. if (operatorMap[op] === 'dueAt') {
  315. value = value.add(days, duration ? duration : 'days').format();
  316. } else {
  317. value = value
  318. .subtract(days, duration ? duration : 'days')
  319. .format();
  320. }
  321. }
  322. } else if (operatorMap[op] === 'sort') {
  323. let negated = false;
  324. const m = value.match(reNegatedOperator);
  325. if (m) {
  326. value = m.groups.operator;
  327. negated = true;
  328. }
  329. if (!predicateTranslations.sorts[value]) {
  330. this.parsingErrors.push({
  331. tag: 'operator-sort-invalid',
  332. value,
  333. });
  334. } else {
  335. value = {
  336. name: predicateTranslations.sorts[value],
  337. order: negated ? 'des' : 'asc',
  338. };
  339. }
  340. } else if (operatorMap[op] === 'status') {
  341. if (!predicateTranslations.status[value]) {
  342. this.parsingErrors.push({
  343. tag: 'operator-status-invalid',
  344. value,
  345. });
  346. } else {
  347. value = predicateTranslations.status[value];
  348. }
  349. } else if (operatorMap[op] === 'has') {
  350. if (!predicateTranslations.has[value]) {
  351. this.parsingErrors.push({
  352. tag: 'operator-has-invalid',
  353. value,
  354. });
  355. } else {
  356. value = predicateTranslations.has[value];
  357. }
  358. }
  359. if (Array.isArray(params[operatorMap[op]])) {
  360. params[operatorMap[op]].push(value);
  361. } else {
  362. params[operatorMap[op]] = value;
  363. }
  364. } else {
  365. this.parsingErrors.push({
  366. tag: 'operator-unknown-error',
  367. value: op,
  368. });
  369. }
  370. continue;
  371. }
  372. m = query.match(reQuotedText);
  373. if (!m) {
  374. m = query.match(reText);
  375. if (m) {
  376. query = query.replace(reText, '');
  377. }
  378. } else {
  379. query = query.replace(reQuotedText, '');
  380. }
  381. if (m) {
  382. text += (text ? ' ' : '') + m.groups.text;
  383. }
  384. }
  385. // eslint-disable-next-line no-console
  386. // console.log('text:', text);
  387. params.text = text;
  388. // eslint-disable-next-line no-console
  389. console.log('params:', params);
  390. this.queryParams = params;
  391. if (this.parsingErrors.length) {
  392. this.searching.set(false);
  393. this.queryErrors = this.parsingErrorMessages();
  394. this.hasResults.set(true);
  395. this.hasQueryErrors.set(true);
  396. return;
  397. }
  398. this.autorun(() => {
  399. const handle = Meteor.subscribe(
  400. 'globalSearch',
  401. SessionData.getSessionId(),
  402. params,
  403. );
  404. Tracker.nonreactive(() => {
  405. Tracker.autorun(() => {
  406. if (handle.ready()) {
  407. this.getResults();
  408. this.searching.set(false);
  409. this.hasResults.set(true);
  410. }
  411. });
  412. });
  413. });
  414. },
  415. nextPage() {
  416. const sessionData = this.getSessionData();
  417. this.autorun(() => {
  418. const handle = Meteor.subscribe('nextPage', sessionData.sessionId);
  419. Tracker.nonreactive(() => {
  420. Tracker.autorun(() => {
  421. if (handle.ready()) {
  422. this.getResults();
  423. this.searching.set(false);
  424. this.hasResults.set(true);
  425. }
  426. });
  427. });
  428. });
  429. },
  430. previousPage() {
  431. const sessionData = this.getSessionData();
  432. this.autorun(() => {
  433. const handle = Meteor.subscribe('previousPage', sessionData.sessionId);
  434. Tracker.nonreactive(() => {
  435. Tracker.autorun(() => {
  436. if (handle.ready()) {
  437. this.getResults();
  438. this.searching.set(false);
  439. this.hasResults.set(true);
  440. }
  441. });
  442. });
  443. });
  444. },
  445. getResultsHeading() {
  446. if (this.resultsCount === 0) {
  447. return TAPi18n.__('no-cards-found');
  448. } else if (this.resultsCount === 1) {
  449. return TAPi18n.__('one-card-found');
  450. } else if (this.resultsCount === this.totalHits) {
  451. return TAPi18n.__('n-cards-found', this.resultsCount);
  452. }
  453. return TAPi18n.__('n-n-of-n-cards-found', {
  454. start: this.resultsStart,
  455. end: this.resultsEnd,
  456. total: this.totalHits,
  457. });
  458. },
  459. getSearchHref() {
  460. const baseUrl = window.location.href.replace(/([?#].*$|\s*$)/, '');
  461. return `${baseUrl}?q=${encodeURIComponent(this.query.get())}`;
  462. },
  463. searchInstructions() {
  464. tags = {
  465. operator_board: TAPi18n.__('operator-board'),
  466. operator_list: TAPi18n.__('operator-list'),
  467. operator_swimlane: TAPi18n.__('operator-swimlane'),
  468. operator_comment: TAPi18n.__('operator-comment'),
  469. operator_label: TAPi18n.__('operator-label'),
  470. operator_label_abbrev: TAPi18n.__('operator-label-abbrev'),
  471. operator_user: TAPi18n.__('operator-user'),
  472. operator_user_abbrev: TAPi18n.__('operator-user-abbrev'),
  473. operator_member: TAPi18n.__('operator-member'),
  474. operator_member_abbrev: TAPi18n.__('operator-member-abbrev'),
  475. operator_assignee: TAPi18n.__('operator-assignee'),
  476. operator_assignee_abbrev: TAPi18n.__('operator-assignee-abbrev'),
  477. operator_due: TAPi18n.__('operator-due'),
  478. operator_created: TAPi18n.__('operator-created'),
  479. operator_modified: TAPi18n.__('operator-modified'),
  480. operator_status: TAPi18n.__('operator-status'),
  481. operator_has: TAPi18n.__('operator-has'),
  482. predicate_overdue: TAPi18n.__('predicate-overdue'),
  483. predicate_archived: TAPi18n.__('predicate-archived'),
  484. predicate_all: TAPi18n.__('predicate-all'),
  485. predicate_ended: TAPi18n.__('predicate-ended'),
  486. predicate_week: TAPi18n.__('predicate-week'),
  487. predicate_month: TAPi18n.__('predicate-month'),
  488. predicate_quarter: TAPi18n.__('predicate-quarter'),
  489. predicate_year: TAPi18n.__('predicate-year'),
  490. predicate_attachment: TAPi18n.__('predicate-attachment'),
  491. predicate_description: TAPi18n.__('predicate-description'),
  492. predicate_checklist: TAPi18n.__('predicate-checklist'),
  493. predicate_public: TAPi18n.__('predicate-public'),
  494. predicate_private: TAPi18n.__('predicate-private'),
  495. };
  496. text = `# ${TAPi18n.__('globalSearch-instructions-heading')}`;
  497. text += `\n${TAPi18n.__('globalSearch-instructions-description', tags)}`;
  498. text += `\n${TAPi18n.__('globalSearch-instructions-operators', tags)}`;
  499. text += `\n* ${TAPi18n.__(
  500. 'globalSearch-instructions-operator-board',
  501. tags,
  502. )}`;
  503. text += `\n* ${TAPi18n.__(
  504. 'globalSearch-instructions-operator-list',
  505. tags,
  506. )}`;
  507. text += `\n* ${TAPi18n.__(
  508. 'globalSearch-instructions-operator-swimlane',
  509. tags,
  510. )}`;
  511. text += `\n* ${TAPi18n.__(
  512. 'globalSearch-instructions-operator-comment',
  513. tags,
  514. )}`;
  515. text += `\n* ${TAPi18n.__(
  516. 'globalSearch-instructions-operator-label',
  517. tags,
  518. )}`;
  519. text += `\n* ${TAPi18n.__(
  520. 'globalSearch-instructions-operator-hash',
  521. tags,
  522. )}`;
  523. text += `\n* ${TAPi18n.__(
  524. 'globalSearch-instructions-operator-user',
  525. tags,
  526. )}`;
  527. text += `\n* ${TAPi18n.__('globalSearch-instructions-operator-at', tags)}`;
  528. text += `\n* ${TAPi18n.__(
  529. 'globalSearch-instructions-operator-member',
  530. tags,
  531. )}`;
  532. text += `\n* ${TAPi18n.__(
  533. 'globalSearch-instructions-operator-assignee',
  534. tags,
  535. )}`;
  536. text += `\n* ${TAPi18n.__('globalSearch-instructions-operator-due', tags)}`;
  537. text += `\n* ${TAPi18n.__(
  538. 'globalSearch-instructions-operator-created',
  539. tags,
  540. )}`;
  541. text += `\n* ${TAPi18n.__(
  542. 'globalSearch-instructions-operator-modified',
  543. tags,
  544. )}`;
  545. text += `\n* ${TAPi18n.__(
  546. 'globalSearch-instructions-status-archived',
  547. tags,
  548. )}`;
  549. text += `\n* ${TAPi18n.__(
  550. 'globalSearch-instructions-status-public',
  551. tags,
  552. )}`;
  553. text += `\n* ${TAPi18n.__(
  554. 'globalSearch-instructions-status-private',
  555. tags,
  556. )}`;
  557. text += `\n* ${TAPi18n.__('globalSearch-instructions-status-all', tags)}`;
  558. text += `\n* ${TAPi18n.__('globalSearch-instructions-status-ended', tags)}`;
  559. text += `\n* ${TAPi18n.__('globalSearch-instructions-operator-has', tags)}`;
  560. text += `\n## ${TAPi18n.__('heading-notes')}`;
  561. text += `\n* ${TAPi18n.__('globalSearch-instructions-notes-1', tags)}`;
  562. text += `\n* ${TAPi18n.__('globalSearch-instructions-notes-2', tags)}`;
  563. text += `\n* ${TAPi18n.__('globalSearch-instructions-notes-3', tags)}`;
  564. text += `\n* ${TAPi18n.__('globalSearch-instructions-notes-3-2', tags)}`;
  565. text += `\n* ${TAPi18n.__('globalSearch-instructions-notes-4', tags)}`;
  566. text += `\n* ${TAPi18n.__('globalSearch-instructions-notes-5', tags)}`;
  567. return text;
  568. },
  569. labelColors() {
  570. return Boards.simpleSchema()._schema['labels.$.color'].allowedValues.map(
  571. color => {
  572. return { color, name: TAPi18n.__(`color-${color}`) };
  573. },
  574. );
  575. },
  576. events() {
  577. return [
  578. {
  579. 'submit .js-search-query-form'(evt) {
  580. evt.preventDefault();
  581. this.searchAllBoards(evt.target.searchQuery.value);
  582. },
  583. 'click .js-next-page'(evt) {
  584. evt.preventDefault();
  585. this.nextPage();
  586. },
  587. 'click .js-previous-page'(evt) {
  588. evt.preventDefault();
  589. this.previousPage();
  590. },
  591. 'click .js-label-color'(evt) {
  592. evt.preventDefault();
  593. const input = document.getElementById('global-search-input');
  594. this.query.set(
  595. `${input.value} ${TAPi18n.__('operator-label')}:"${
  596. evt.currentTarget.textContent
  597. }"`,
  598. );
  599. document.getElementById('global-search-input').focus();
  600. },
  601. 'click .js-board-title'(evt) {
  602. evt.preventDefault();
  603. const input = document.getElementById('global-search-input');
  604. this.query.set(
  605. `${input.value} ${TAPi18n.__('operator-board')}:"${
  606. evt.currentTarget.textContent
  607. }"`,
  608. );
  609. document.getElementById('global-search-input').focus();
  610. },
  611. 'click .js-list-title'(evt) {
  612. evt.preventDefault();
  613. const input = document.getElementById('global-search-input');
  614. this.query.set(
  615. `${input.value} ${TAPi18n.__('operator-list')}:"${
  616. evt.currentTarget.textContent
  617. }"`,
  618. );
  619. document.getElementById('global-search-input').focus();
  620. },
  621. 'click .js-label-name'(evt) {
  622. evt.preventDefault();
  623. const input = document.getElementById('global-search-input');
  624. this.query.set(
  625. `${input.value} ${TAPi18n.__('operator-label')}:"${
  626. evt.currentTarget.textContent
  627. }"`,
  628. );
  629. document.getElementById('global-search-input').focus();
  630. },
  631. },
  632. ];
  633. },
  634. }).register('globalSearch');