diff --git a/app/controllers/admin/indexes/item/settings.js b/app/controllers/admin/indexes/item/settings.js
new file mode 100644
index 0000000..7378e58
--- /dev/null
+++ b/app/controllers/admin/indexes/item/settings.js
@@ -0,0 +1,19 @@
+import Controller from '@ember/controller';
+import { action } from '@ember/object';
+import arrayEquals from 'meilisearch-admin/utils/array-equals';
+
+export default class AdminIndexesItemSettingsController extends Controller {
+ @action
+ save() {
+ const fields = Object.keys(this.model.stats.fieldDistribution);
+ const settings = Object.assign({}, this.model.settings);
+
+ ['displayedAttributes', 'searchableAttributes'].forEach((prop) => {
+ if (arrayEquals(settings[prop].sort(), fields.sort())) {
+ settings[prop] = ['*'];
+ }
+ });
+
+ return this.model.index.updateSettings(settings);
+ }
+}
diff --git a/app/templates/admin/indexes/item/settings.hbs b/app/templates/admin/indexes/item/settings.hbs
index df76264..f66553a 100644
--- a/app/templates/admin/indexes/item/settings.hbs
+++ b/app/templates/admin/indexes/item/settings.hbs
@@ -1,8 +1,8 @@
{{page-title "Settings"}}
{{#let (hash td="px-4 py-2 text-left whitespace-nowrap") as |classes|}}
-
Attributes
-
+ Attributes
+
{{/let}}
+
+
diff --git a/app/utils/array-equals.js b/app/utils/array-equals.js
new file mode 100644
index 0000000..ddf1f1d
--- /dev/null
+++ b/app/utils/array-equals.js
@@ -0,0 +1,8 @@
+export default function arrayEquals(a, b) {
+ return (
+ Array.isArray(a) &&
+ Array.isArray(b) &&
+ a.length === b.length &&
+ a.every((val, index) => val === b[index])
+ );
+}
diff --git a/tests/unit/controllers/admin/indexes/item/settings-test.js b/tests/unit/controllers/admin/indexes/item/settings-test.js
new file mode 100644
index 0000000..e469112
--- /dev/null
+++ b/tests/unit/controllers/admin/indexes/item/settings-test.js
@@ -0,0 +1,14 @@
+import { module, test } from 'qunit';
+import { setupTest } from 'ember-qunit';
+
+module('Unit | Controller | admin/indexes/item/settings', function (hooks) {
+ setupTest(hooks);
+
+ // TODO: Replace this with your real tests.
+ test('it exists', function (assert) {
+ let controller = this.owner.lookup(
+ 'controller:admin/indexes/item/settings'
+ );
+ assert.ok(controller);
+ });
+});
diff --git a/tests/unit/utils/array-equals-test.js b/tests/unit/utils/array-equals-test.js
new file mode 100644
index 0000000..cfe3319
--- /dev/null
+++ b/tests/unit/utils/array-equals-test.js
@@ -0,0 +1,10 @@
+import arrayEquals from 'meilisearch-admin/utils/array-equals';
+import { module, test } from 'qunit';
+
+module('Unit | Utility | arrayEquals', function () {
+ // TODO: Replace this with your real tests.
+ test('it works', function (assert) {
+ let result = arrayEquals();
+ assert.ok(result);
+ });
+});