177 lines
4.2 KiB
Handlebars
177 lines
4.2 KiB
Handlebars
<IndexSetting
|
|
@name='displayedAttributes'
|
|
@index={{@model}}
|
|
/>
|
|
|
|
<IndexSetting
|
|
@name='distinctAttribute'
|
|
@index={{@model}}
|
|
/>
|
|
|
|
{{!-- <label class="text-xl mb-2 block">
|
|
Displayed attributes
|
|
</label>
|
|
<div class="mb-2">
|
|
{{#each @model.index.fields as |item|}}
|
|
{{#let
|
|
(or
|
|
(eq @model.displayedAttributes.firstObject '*')
|
|
(includes item @model.displayedAttributes)
|
|
) as |checked|
|
|
}}
|
|
<Badge
|
|
@label={{item}}
|
|
@icon={{if checked this.Check this.CircleMedium}}
|
|
@style={{if checked 'success'}}
|
|
class="cursor-pointer"
|
|
{{on 'click' (fn this.setAttributeValue 'displayedAttributes' item)}}
|
|
/>
|
|
{{/let}}
|
|
{{/each}}
|
|
</div>
|
|
<div class="mb-4">
|
|
<Button
|
|
@text="Update"
|
|
@style="primary"
|
|
@size="small"
|
|
@onClick={{fn
|
|
this.update
|
|
'updateDisplayedAttributes'
|
|
@model.displayedAttributes
|
|
}}
|
|
/>
|
|
<Button
|
|
@text="Reset"
|
|
@size="small"
|
|
@style="outline"
|
|
@onClick={{fn this.reset 'resetDisplayedAttributes'}}
|
|
/>
|
|
</div>
|
|
<label class="text-xl mb-2 block">
|
|
Searchable attributes
|
|
</label>
|
|
<div class="mb-2">
|
|
{{#each @model.index.fields as |item|}}
|
|
{{#let
|
|
(or
|
|
(eq @model.searchableAttributes.firstObject '*')
|
|
(includes item @model.searchableAttributes)
|
|
) as |checked|
|
|
}}
|
|
<Badge
|
|
@label={{item}}
|
|
@icon={{if checked this.Check this.CircleMedium}}
|
|
@style={{if checked 'success'}}
|
|
class="cursor-pointer"
|
|
{{on 'click' (fn this.setAttributeValue 'searchableAttributes' item)}}
|
|
/>
|
|
{{/let}}
|
|
{{/each}}
|
|
</div>
|
|
<div class="mb-4">
|
|
<Button
|
|
@text="Update"
|
|
@style="primary"
|
|
@size="small"
|
|
@onClick={{fn
|
|
this.update
|
|
'updateSearchableAttributes'
|
|
@model.searchableAttributes
|
|
}}
|
|
/>
|
|
<Button
|
|
@text="Reset"
|
|
@size="small"
|
|
@style="outline"
|
|
@onClick={{fn this.reset 'resetSearchableAttributes'}}
|
|
/>
|
|
</div> --}}
|
|
{{!--
|
|
<RoyalTable @data={{@model.attributes}} as |Row data|>
|
|
<Row as |Column|>
|
|
<Column @prop="name" />
|
|
<Column @name="Displayed">
|
|
<InputCheckbox
|
|
@checked={{data.displayed}}
|
|
@onChange={{set data 'displayed'}}
|
|
/>
|
|
</Column>
|
|
<Column @name="Filterable">
|
|
<InputCheckbox
|
|
@checked={{data.filterable}}
|
|
@onChange={{set data 'filterable'}}
|
|
/>
|
|
</Column>
|
|
<Column @name="Searchable">
|
|
<InputCheckbox
|
|
@checked={{data.searchable}}
|
|
@onChange={{set data 'searchable'}}
|
|
/>
|
|
</Column>
|
|
<Column @name="Sortable">
|
|
<InputCheckbox
|
|
@checked={{data.sortable}}
|
|
@onChange={{set data 'sortable'}}
|
|
/>
|
|
</Column>
|
|
</Row>
|
|
</RoyalTable>
|
|
<InputSelect
|
|
@label="Distinct attribute"
|
|
@options={{keys @model.stats.fieldDistribution}}
|
|
@selected={{@model.settings.distinctAttribute}}
|
|
@onChange={{set @model.settings 'distinctAttribute'}}
|
|
@allowClear={{true}} as |option|
|
|
>
|
|
{{option}}
|
|
</InputSelect>
|
|
<div class="mb-4">
|
|
<label class="mb-2">
|
|
Ranking rules
|
|
</label>
|
|
<div {{sortable-group onChange=this.reorderItems}}>
|
|
{{#each @model.settings.rankingRules as |item|}}
|
|
<div
|
|
class="flex items-center px-4 py-2 mb-2 border max-w-md"
|
|
{{sortable-item model=item}}
|
|
>
|
|
<Icons::DragVertical class="mr-2 -ml-2 cursor-move" />
|
|
{{item}}
|
|
<Icons::CloseThick
|
|
@size="16"
|
|
class="ml-auto cursor-pointer"
|
|
{{on 'click' (fn this.removeRankingRule item)}}
|
|
/>
|
|
</div>
|
|
{{/each}}
|
|
</div>
|
|
{{#if this.rankingRulesFields.length}}
|
|
<InputSelect
|
|
@options={{this.rankingRulesFields}}
|
|
@onChange={{this.selectNewRankingRule}}
|
|
@placeholder="Add field" as |option|
|
|
>
|
|
{{option}}
|
|
</InputSelect>
|
|
{{/if}}
|
|
</div>
|
|
<InputTextarea
|
|
@label="Stop-words"
|
|
@value={{json-stringify @model.settings.stopWords}}
|
|
@onChange={{fn this.saveStrToJSON 'stopWords' (array)}}
|
|
@helper="JSON format"
|
|
/>
|
|
<InputTextarea
|
|
@label="Synonyms"
|
|
@value={{json-stringify @model.settings.synonyms}}
|
|
@onChange={{fn this.saveStrToJSON 'synonyms' this.emptyObj}}
|
|
@helper="JSON format"
|
|
/>
|
|
<Button
|
|
@text="Save"
|
|
@pendingText="Saving"
|
|
@fulfilledText="Done"
|
|
@rejectedText="Error"
|
|
@icon={{this.ContentSaveOutline}}
|
|
@onClick={{this.save}}
|
|
/> --}}
|