diff --git a/app/pods/components/publications/publication-case-search/component.js b/app/pods/components/publications/publication-case-search/component.js
new file mode 100644
index 0000000000..b703ad7eb2
--- /dev/null
+++ b/app/pods/components/publications/publication-case-search/component.js
@@ -0,0 +1,72 @@
+import Component from '@glimmer/component';
+import { action } from '@ember/object';
+import { isEmpty } from '@ember/utils';
+import { tracked } from '@glimmer/tracking';
+import { timeout } from 'ember-concurrency';
+import { restartableTask } from 'ember-concurrency-decorators';
+import search from 'frontend-kaleidos/utils/mu-search';
+
+export default class PublicationsPublicationCaseSearchComponent extends Component {
+ @tracked searchText;
+ @tracked isShowingResults = false;
+ @tracked searchResults;
+
+ searchFields = Object.freeze([
+ 'title',
+ 'publicationFlowNumber',
+ 'publicationFlowRemark',
+ 'shortTitle',
+ 'subcaseTitle',
+ 'subcaseSubTitle',
+ 'publicationFlowNumacNumbers',
+ 'publicationFlowId'
+ ]);
+ searchModifier = Object.freeze(':phrase_prefix:');
+
+ @restartableTask
+ *debouncedSearch(event) {
+ this.searchText = event.target.value;
+ if (!isEmpty(this.searchText)) {
+ yield timeout(500);
+ yield this.search.perform();
+ } else {
+ this.searchResults = [];
+ this.hideResults();
+ }
+ }
+
+ @action
+ showResults() {
+ this.isShowingResults = true;
+ }
+
+ @action
+ hideResults() {
+ this.isShowingResults = false;
+ }
+
+ @restartableTask
+ *search() {
+ if (!isEmpty(this.searchText)) {
+ this.searchResults = yield this.searchPublications.perform(this.searchText);
+ this.showResults();
+ } else {
+ this.searchResults = [];
+ this.hideResults();
+ }
+ }
+
+ @restartableTask
+ *searchPublications(searchTerm) {
+ const filter = {
+ ':has:publicationFlowNumber': 'true',
+ };
+ filter[`${this.searchModifier}${this.searchFields.join(',')}`] = searchTerm;
+ const searchResults = yield search('cases', 0, 10, null, filter, (item) => {
+ const entry = item.attributes;
+ entry.id = item.id;
+ return entry;
+ });
+ return searchResults;
+ }
+}
diff --git a/app/pods/components/publications/publication-case-search/template.hbs b/app/pods/components/publications/publication-case-search/template.hbs
new file mode 100644
index 0000000000..0b924f6751
--- /dev/null
+++ b/app/pods/components/publications/publication-case-search/template.hbs
@@ -0,0 +1,40 @@
+
+{{#if this.isShowingResults}}
+
+ {{#each this.searchResults as |result|}}
+
+
+ {{#if result.subcaseSubTitle}}
+ {{result.subcaseSubTitle}}
+ {{else if result.subcaseTitle}}
+ {{result.subcaseTitle}}
+ {{else if result.shortTitle}}
+ {{result.shortTitle}}
+ {{else if result.title}}
+ {{result.title}}
+ {{/if}}
+
+ {{result.publicationFlowNumber}}
+
+
+ {{else}}
+ {{ t "no-results-found" }}
+ {{/each}}
+
+{{/if}}
\ No newline at end of file
diff --git a/app/pods/publications/controller.js b/app/pods/publications/controller.js
index a6385883b9..1044ec4c5d 100644
--- a/app/pods/publications/controller.js
+++ b/app/pods/publications/controller.js
@@ -4,9 +4,6 @@ import {
action, set
} from '@ember/object';
import { tracked } from '@glimmer/tracking';
-import { timeout } from 'ember-concurrency';
-import { restartableTask } from 'ember-concurrency-decorators';
-import search from 'frontend-kaleidos/utils/mu-search';
export default class PublicationsController extends Controller {
@service publicationService;
@@ -15,9 +12,6 @@ export default class PublicationsController extends Controller {
@tracked hasError = false;
@tracked numberIsAlreadyUsed = false;
@tracked isCreatingPublication = false;
- @tracked searchText;
- @tracked showSearchResults = false;
- @tracked searchResults;
@tracked showLoader = false;
@tracked isShowPublicationFilterModal = false;
@@ -40,37 +34,6 @@ export default class PublicationsController extends Controller {
longTitle: null,
};
- @restartableTask
- *debouncedSearchTask(event) {
- this.searchText = event.target.value;
- yield timeout(500);
- yield this.search(this.searchText);
- }
-
- @action
- async search() {
- const filter = {
- ':has:publicationFlowNumber': 1,
- };
- if (this.searchText.length === 0 || this.searchText === '') {
- this.showSearchResults = false;
- } else {
- this.textSearchFields = ['title', 'publicationFlowNumber', 'publicationFlowRemark', 'shortTitle', 'subcaseTitle', 'subcaseSubTitle', 'publicationFlowNumacNumbers', 'publicationFlowId'];
- const searchModifier = ':phrase_prefix:';
- const textSearchKey = this.textSearchFields.join(',');
- filter[`${searchModifier}${textSearchKey}`] = `${this.searchText}*`;
- this.showSearchResults = true;
- this.searchResults = await search('cases', 0, 10, null, filter, (item) => {
- const entry = item.attributes;
- entry.id = item.id;
- return entry;
- });
- if (this.searchResults.length === 0) {
- this.searchResults = false;
- }
- }
- }
-
get getError() {
return this.hasError;
}
diff --git a/app/pods/publications/template.hbs b/app/pods/publications/template.hbs
index 4c62e0b5d9..7c5a9e00f0 100644
--- a/app/pods/publications/template.hbs
+++ b/app/pods/publications/template.hbs
@@ -16,45 +16,7 @@
-
- {{#if showSearchResults}}
-
- {{#each this.searchResults as |result|}}
-
-
- {{#if result.subcaseSubTitle}}
- {{result.subcaseSubTitle}}
- {{else if result.subcaseTitle}}
- {{result.subcaseTitle}}
- {{else if result.shortTitle}}
- {{result.shortTitle}}
- {{else if result.title}}
- {{result.title}}
- {{/if}}
-
- {{result.publicationFlowNumber}}
-
-
- {{else}}
- {{ t "no-results-found" }}
- {{/each}}
-
- {{/if}}
+
diff --git a/config/environment.js b/config/environment.js
index c15b80818c..bd824e7e31 100644
--- a/config/environment.js
+++ b/config/environment.js
@@ -14,7 +14,7 @@ module.exports = function(environment) {
metricsAdapters: [
{
name: 'Matomo',
- environments: ['development', 'test', 'cypress-test', 'production'],
+ environments: ['production'],
config: {
scriptUrl: 'https://dev-kaleidos-matomo.redpencil.io', // Can optionally be CDN-sourced
trackerUrl: 'https://dev-kaleidos-matomo.redpencil.io',