From a014759ce5e3c98c64724096c1704f047d25316e Mon Sep 17 00:00:00 2001 From: Stanislav Romanov Date: Tue, 30 Aug 2022 11:12:35 +0300 Subject: [PATCH] Add tasks list --- app/components/icons/format-list-checks.js | 1 + app/router.js | 1 + app/routes/admin/tasks/index.js | 10 +++++ app/services/meilisearch.js | 8 ++++ app/templates/admin.hbs | 6 ++- app/templates/admin/tasks/index.hbs | 45 +++++++++++++++++++++ tests/unit/routes/admin/tasks/index-test.js | 11 +++++ 7 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 app/components/icons/format-list-checks.js create mode 100644 app/routes/admin/tasks/index.js create mode 100644 app/templates/admin/tasks/index.hbs create mode 100644 tests/unit/routes/admin/tasks/index-test.js diff --git a/app/components/icons/format-list-checks.js b/app/components/icons/format-list-checks.js new file mode 100644 index 0000000..e6c68fc --- /dev/null +++ b/app/components/icons/format-list-checks.js @@ -0,0 +1 @@ +export { FormatListChecks as default } from 'ember-mdi'; diff --git a/app/router.js b/app/router.js index ed08932..a0541aa 100644 --- a/app/router.js +++ b/app/router.js @@ -18,6 +18,7 @@ Router.map(function () { this.route('keys', function () { this.route('key', { path: '/:uid' }); }); + this.route('tasks', function () {}); }); this.route('login'); }); diff --git a/app/routes/admin/tasks/index.js b/app/routes/admin/tasks/index.js new file mode 100644 index 0000000..09d0698 --- /dev/null +++ b/app/routes/admin/tasks/index.js @@ -0,0 +1,10 @@ +import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; + +export default class AdminTasksIndexRoute extends Route { + @service meilisearch; + + model() { + return this.meilisearch.getTasks(); + } +} diff --git a/app/services/meilisearch.js b/app/services/meilisearch.js index 8011c09..f9ac4a0 100644 --- a/app/services/meilisearch.js +++ b/app/services/meilisearch.js @@ -28,4 +28,12 @@ export default class MeilisearchService extends Service { getKey(uid) { return query(`keys/${uid}`); } + + getTasks() { + return query('tasks'); + } + + getTask(uid) { + return query(`tasks/${uid}`); + } } diff --git a/app/templates/admin.hbs b/app/templates/admin.hbs index 2cf473a..b8bd79b 100644 --- a/app/templates/admin.hbs +++ b/app/templates/admin.hbs @@ -25,7 +25,11 @@ {{/each}} {{! TODO: add link "create new index" }}
- + + + Tasks + + Keys diff --git a/app/templates/admin/tasks/index.hbs b/app/templates/admin/tasks/index.hbs new file mode 100644 index 0000000..ea5a8eb --- /dev/null +++ b/app/templates/admin/tasks/index.hbs @@ -0,0 +1,45 @@ +

Tasks

+ + + + + + + + + + + {{date-time-format + data.expiresAt + year='numeric' + month='numeric' + day='numeric' + hour='numeric' + minute='numeric' + second='numeric' + }} + + + {{date-time-format + data.expiresAt + year='numeric' + month='numeric' + day='numeric' + hour='numeric' + minute='numeric' + second='numeric' + }} + + + {{date-time-format + data.expiresAt + year='numeric' + month='numeric' + day='numeric' + hour='numeric' + minute='numeric' + second='numeric' + }} + + + diff --git a/tests/unit/routes/admin/tasks/index-test.js b/tests/unit/routes/admin/tasks/index-test.js new file mode 100644 index 0000000..c1508ee --- /dev/null +++ b/tests/unit/routes/admin/tasks/index-test.js @@ -0,0 +1,11 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'meiliadmin/tests/helpers'; + +module('Unit | Route | admin/tasks/index', function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let route = this.owner.lookup('route:admin/tasks/index'); + assert.ok(route); + }); +});