From 2b58be2fea0f1744c51e450a8be59a06f4b11ff7 Mon Sep 17 00:00:00 2001 From: Stanislav Romanov Date: Wed, 23 Mar 2022 13:28:29 +0300 Subject: [PATCH] Add sidebar --- app/components/menu-item.hbs | 6 +++++ app/helpers/capitalize.js | 6 +++++ app/index.html | 2 +- app/routes/admin.js | 9 ++++++- app/templates/admin.hbs | 25 ++++++++++++++++++ app/templates/admin/indexes.hbs | 25 +----------------- config/tailwind.config.js | 6 +++++ public/{favicon.svg => logo.svg} | 0 .../integration/components/menu-item-test.js | 26 +++++++++++++++++++ tests/integration/helpers/capitalize-test.js | 17 ++++++++++++ 10 files changed, 96 insertions(+), 26 deletions(-) create mode 100644 app/components/menu-item.hbs create mode 100644 app/helpers/capitalize.js create mode 100644 app/templates/admin.hbs rename public/{favicon.svg => logo.svg} (100%) create mode 100644 tests/integration/components/menu-item-test.js create mode 100644 tests/integration/helpers/capitalize-test.js diff --git a/app/components/menu-item.hbs b/app/components/menu-item.hbs new file mode 100644 index 0000000..3e51c18 --- /dev/null +++ b/app/components/menu-item.hbs @@ -0,0 +1,6 @@ + + {{#if @icon}} + + {{/if}} + {{@name}} + diff --git a/app/helpers/capitalize.js b/app/helpers/capitalize.js new file mode 100644 index 0000000..6758d73 --- /dev/null +++ b/app/helpers/capitalize.js @@ -0,0 +1,6 @@ +import { helper } from '@ember/component/helper'; +import { capitalize as func } from '@ember/string'; + +export default helper(function capitalize([str]) { + return func(str); +}); diff --git a/app/index.html b/app/index.html index c3944bf..a4367a7 100644 --- a/app/index.html +++ b/app/index.html @@ -4,7 +4,7 @@ MeiliSearch Admin - + {{content-for "head"}} diff --git a/app/routes/admin.js b/app/routes/admin.js index cb12e52..6256d24 100644 --- a/app/routes/admin.js +++ b/app/routes/admin.js @@ -1,3 +1,10 @@ import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; -export default class AdminRoute extends Route {} +export default class AdminRoute extends Route { + @service meilisearch; + + async model() { + return this.meilisearch.getRawIndexes(); + } +} diff --git a/app/templates/admin.hbs b/app/templates/admin.hbs new file mode 100644 index 0000000..d149f7a --- /dev/null +++ b/app/templates/admin.hbs @@ -0,0 +1,25 @@ +
+
+

+ MeiliSearch + MeiliSearch Admin +

+ +
+ +
+
+ +
+ {{outlet}} +
+
diff --git a/app/templates/admin/indexes.hbs b/app/templates/admin/indexes.hbs index f61800e..c24cd68 100644 --- a/app/templates/admin/indexes.hbs +++ b/app/templates/admin/indexes.hbs @@ -1,24 +1 @@ -{{page-title "Indexes"}} - -
- -
- {{outlet}} -
-
+{{outlet}} diff --git a/config/tailwind.config.js b/config/tailwind.config.js index 30d8614..09100aa 100644 --- a/config/tailwind.config.js +++ b/config/tailwind.config.js @@ -9,6 +9,12 @@ module.exports = { spacing: { base: '1.5rem', }, + colors: { + light: '#E5E7EB', + secondary: '#374151', + dark: '#1F2937', + primary: '#2563EB', + }, }, }, variants: { diff --git a/public/favicon.svg b/public/logo.svg similarity index 100% rename from public/favicon.svg rename to public/logo.svg diff --git a/tests/integration/components/menu-item-test.js b/tests/integration/components/menu-item-test.js new file mode 100644 index 0000000..3509473 --- /dev/null +++ b/tests/integration/components/menu-item-test.js @@ -0,0 +1,26 @@ +import { module, test } from 'qunit'; +import { setupRenderingTest } from 'ember-qunit'; +import { render } from '@ember/test-helpers'; +import { hbs } from 'ember-cli-htmlbars'; + +module('Integration | Component | menu-item', function (hooks) { + setupRenderingTest(hooks); + + test('it renders', async function (assert) { + // Set any properties with this.set('myProperty', 'value'); + // Handle any actions with this.set('myAction', function(val) { ... }); + + await render(hbs``); + + assert.dom(this.element).hasText(''); + + // Template block usage: + await render(hbs` + + template block text + + `); + + assert.dom(this.element).hasText('template block text'); + }); +}); diff --git a/tests/integration/helpers/capitalize-test.js b/tests/integration/helpers/capitalize-test.js new file mode 100644 index 0000000..40bc20a --- /dev/null +++ b/tests/integration/helpers/capitalize-test.js @@ -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 | capitalize', function (hooks) { + setupRenderingTest(hooks); + + // TODO: Replace this with your real tests. + test('it renders', async function (assert) { + this.set('inputValue', '1234'); + + await render(hbs`{{capitalize this.inputValue}}`); + + assert.dom(this.element).hasText('1234'); + }); +});