From 8fde373b7ae9da4af8e22718336440f56e504be4 Mon Sep 17 00:00:00 2001 From: Stanislav Romanov Date: Tue, 18 Oct 2022 11:27:34 +0300 Subject: [PATCH] Add editor --- app/components/button-group.hbs | 8 +- app/components/button-group.js | 13 --- app/components/button.js | 4 +- .../admin/indexes/item/documents/index.js | 1 + .../admin/indexes/item/documents/index.js | 42 +++++++ .../admin/indexes/item/documents/index.hbs | 103 +++++++++++------- 6 files changed, 110 insertions(+), 61 deletions(-) delete mode 100644 app/components/button-group.js diff --git a/app/components/button-group.hbs b/app/components/button-group.hbs index a1fafdd..53cac6a 100644 --- a/app/components/button-group.hbs +++ b/app/components/button-group.hbs @@ -1,7 +1,3 @@ -
- {{yield - (hash - Button=(component "button" group=this) - ) - }} +
+ {{yield}}
diff --git a/app/components/button-group.js b/app/components/button-group.js deleted file mode 100644 index 94e7365..0000000 --- a/app/components/button-group.js +++ /dev/null @@ -1,13 +0,0 @@ -import Component from '@glimmer/component'; -import { action } from '@ember/object'; - -export default class ButtonGroupComponent extends Component { - @action - buttonPressed(value) { - if (typeof this.args.onClick !== 'function') { - return; - } - - this.args.onClick(value); - } -} diff --git a/app/components/button.js b/app/components/button.js index b354690..26aec1c 100644 --- a/app/components/button.js +++ b/app/components/button.js @@ -14,8 +14,8 @@ export const sizes = { export const iconSizes = { sm: 18, - md: 20, - lg: 22, + md: 24, + lg: 26, }; export const styles = { diff --git a/app/controllers/admin/indexes/item/documents/index.js b/app/controllers/admin/indexes/item/documents/index.js index 1970471..0d9952d 100644 --- a/app/controllers/admin/indexes/item/documents/index.js +++ b/app/controllers/admin/indexes/item/documents/index.js @@ -11,6 +11,7 @@ export default class AdminIndexesItemDocumentsIndexController extends Controller @tracked limit = 20; @tracked page = 1; @tracked dataView = 'table'; + @tracked isAdvancedSearch = false; @tracked sort; @tracked hiddenFields = []; @tracked attributesToRetrieve = []; diff --git a/app/routes/admin/indexes/item/documents/index.js b/app/routes/admin/indexes/item/documents/index.js index afcde12..46522bb 100644 --- a/app/routes/admin/indexes/item/documents/index.js +++ b/app/routes/admin/indexes/item/documents/index.js @@ -1,6 +1,46 @@ import Route from '@ember/routing/route'; import { hash } from 'rsvp'; +const uri = 'https://docs.meilisearch.com/reference/api/search'; +const searchSchema = { + name: 'search', + uri, + fileMatch: [uri], + schema: { + $id: uri, + type: 'object', + properties: { + q: { + type: 'string', + }, + // minWordSizeForTypos: { + // type: 'object', + // properties: { + // oneTypo: { type: 'integer' }, + // twoTypos: { type: 'integer' }, + // }, + // additionalProperties: false, + // }, + // disableOnWords: { + // type: 'array', + // items: { + // type: 'string', + // }, + // uniqueItems: true, + // }, + // disableOnAttributes: { + // type: 'array', + // items: { + // type: 'string', + // }, + // uniqueItems: true, + // }, + }, + additionalProperties: false, + required: ['q'], + }, +}; + export default class AdminIndexesItemDocumentsIndexRoute extends Route { queryParams = { q: { refreshModel: true }, @@ -25,6 +65,8 @@ export default class AdminIndexesItemDocumentsIndexRoute extends Route { return hash({ index, + searchSchema, + search: { q: '' }, data: index.search(q, options), sortableAttributes: index.getSortableAttributes(), displayedAttributes: index.getSetting('displayed-attributes'), diff --git a/app/templates/admin/indexes/item/documents/index.hbs b/app/templates/admin/indexes/item/documents/index.hbs index 576c533..9ed53ce 100644 --- a/app/templates/admin/indexes/item/documents/index.hbs +++ b/app/templates/admin/indexes/item/documents/index.hbs @@ -1,34 +1,70 @@ -
- {{! q }} - +
+ + {{#each-in this.views as |key icon|}} + +
+ +{{#if this.isAdvancedSearch}} + + + +{{else}} +
+ {{! q }} + + + {{! sort }} + {{#if this.sortValues.length}} + + {{/if}} + + {{! limit }} - {{/if}} - - {{! limit }} - -
+
+{{/if}} {{!--
@@ -43,18 +79,6 @@
--}} {{#if (gt @model.data.estimatedTotalHits 0)}} -
- {{#each-in this.views as |key icon|}} -
- {{#if (eq this.dataView 'table')}} {{else if (eq this.dataView 'json')}} - {{#each @model.data.hits as |data|}}