meilisearch-admin/app/components/index-setting.js

30 lines
619 B
JavaScript
Raw Normal View History

2022-09-02 08:53:33 +00:00
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { tracked } from '@glimmer/tracking';
export default class FormIndexSettingComponent extends Component {
@tracked value;
constructor() {
super(...arguments);
this.setInitialValue();
}
@action
save() {
2022-09-06 10:22:13 +00:00
this.args.index.updateSetting(this.args.name, this.value);
2022-09-02 08:53:33 +00:00
}
@action
async setInitialValue() {
2022-09-06 10:31:08 +00:00
const result = await this.args.index.getSetting(this.args.name);
this.value = JSON.stringify(result);
2022-09-02 08:53:33 +00:00
}
@action
async reset() {
this.args.index.resetSetting(this.args.name);
}
}