Add stop-words to settings
This commit is contained in:
parent
7dd473d0c8
commit
1fa3e19ad9
5 changed files with 40 additions and 4 deletions
|
|
@ -3,6 +3,8 @@ import { action } from '@ember/object';
|
|||
import arrayEquals from 'meilisearch-admin/utils/array-equals';
|
||||
|
||||
export default class AdminIndexesItemSettingsController extends Controller {
|
||||
returnChar = '\n';
|
||||
|
||||
@action
|
||||
save() {
|
||||
const fields = Object.keys(this.model.stats.fieldDistribution);
|
||||
|
|
|
|||
9
app/helpers/split.js
Normal file
9
app/helpers/split.js
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { helper } from '@ember/component/helper';
|
||||
|
||||
function split(positional) {
|
||||
let [separator, maybeValue] = positional;
|
||||
console.log(positional.length, separator, maybeValue);
|
||||
return (str) => str.split(separator);
|
||||
}
|
||||
|
||||
export default helper(split);
|
||||
|
|
@ -78,6 +78,12 @@
|
|||
</SortableObjects>
|
||||
</div>
|
||||
|
||||
<InputTextarea
|
||||
@label="Stop-words"
|
||||
@value={{join this.returnChar @model.settings.stopWords}}
|
||||
@onChange={{pipe (split this.returnChar) (set @model.settings 'stopWords')}}
|
||||
/>
|
||||
|
||||
<Button
|
||||
@text="Save"
|
||||
@pendingText="Saving"
|
||||
|
|
|
|||
|
|
@ -10,13 +10,15 @@ module.exports = {
|
|||
primary: '#2563EB',
|
||||
},
|
||||
},
|
||||
emberPowerSelect: theme => ({
|
||||
emberPowerSelect: (theme) => ({
|
||||
default: {
|
||||
trigger: {
|
||||
borderRadius: theme('borderRadius.default'),
|
||||
borderColor: theme('borderColor.border'),
|
||||
fontSize: theme('fontSize.base'),
|
||||
padding: `${theme('spacing.2')} ${theme('spacing.10')} ${theme('spacing.2')} ${theme('spacing.3')}`,
|
||||
padding: `${theme('spacing.2')} ${theme('spacing.10')} ${theme(
|
||||
'spacing.2'
|
||||
)} ${theme('spacing.3')}`,
|
||||
minHeight: '42px',
|
||||
lineHeight: theme('lineHeight.normal'),
|
||||
maxWidth: theme('maxWidth.md'),
|
||||
|
|
@ -86,7 +88,7 @@ module.exports = {
|
|||
'&[aria-current="true"]': {
|
||||
backgroundColor: theme('colors.gray.light'),
|
||||
color: null,
|
||||
}
|
||||
},
|
||||
},
|
||||
placeholder: {
|
||||
// display: 'block',
|
||||
|
|
@ -97,7 +99,7 @@ module.exports = {
|
|||
lineHeight: theme('lineHeight.normal'),
|
||||
},
|
||||
search: {
|
||||
paddingBottom: theme('spacing.2')
|
||||
paddingBottom: theme('spacing.2'),
|
||||
},
|
||||
searchInput: {
|
||||
borderRadius: theme('borderRadius.default'),
|
||||
|
|
|
|||
17
tests/integration/helpers/split-test.js
Normal file
17
tests/integration/helpers/split-test.js
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupRenderingTest } from 'ember-qunit';
|
||||
import { render } from '@ember/test-helpers';
|
||||
import { hbs } from 'ember-cli-htmlbars';
|
||||
|
||||
module('Integration | Helper | split', function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
||||
// TODO: Replace this with your real tests.
|
||||
test('it renders', async function (assert) {
|
||||
this.set('inputValue', '1234');
|
||||
|
||||
await render(hbs`{{split this.inputValue}}`);
|
||||
|
||||
assert.dom(this.element).hasText('1234');
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue