Add tasks list
This commit is contained in:
parent
644b2d203f
commit
a014759ce5
7 changed files with 81 additions and 1 deletions
1
app/components/icons/format-list-checks.js
Normal file
1
app/components/icons/format-list-checks.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
export { FormatListChecks as default } from 'ember-mdi';
|
||||
|
|
@ -18,6 +18,7 @@ Router.map(function () {
|
|||
this.route('keys', function () {
|
||||
this.route('key', { path: '/:uid' });
|
||||
});
|
||||
this.route('tasks', function () {});
|
||||
});
|
||||
this.route('login');
|
||||
});
|
||||
|
|
|
|||
10
app/routes/admin/tasks/index.js
Normal file
10
app/routes/admin/tasks/index.js
Normal file
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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}`);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,11 @@
|
|||
{{/each}}
|
||||
{{! TODO: add link "create new index" }}
|
||||
<div class='border-t my-4'></div>
|
||||
<LinkTo @route='admin.keys' class={{linkClass}}>
|
||||
<LinkTo @route='admin.tasks.index' class={{linkClass}}>
|
||||
<Icons::FormatListChecks class='mr-1' />
|
||||
Tasks
|
||||
</LinkTo>
|
||||
<LinkTo @route='admin.keys.index' class={{linkClass}}>
|
||||
<Icons::KeyOutline class='mr-1' />
|
||||
Keys
|
||||
</LinkTo>
|
||||
|
|
|
|||
45
app/templates/admin/tasks/index.hbs
Normal file
45
app/templates/admin/tasks/index.hbs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<h1 class='text-3xl mb-4'>Tasks</h1>
|
||||
|
||||
<RoyalTable @data={{@model.results}} class='w-full' as |Row data|>
|
||||
<Row as |Column|>
|
||||
<Column @prop='uid' />
|
||||
<Column @prop='indexUid' />
|
||||
<Column @prop='status' />
|
||||
<Column @prop='type' />
|
||||
<Column @prop='details' />
|
||||
<Column @prop='duration' />
|
||||
<Column @prop='enqueuedAt'>
|
||||
{{date-time-format
|
||||
data.expiresAt
|
||||
year='numeric'
|
||||
month='numeric'
|
||||
day='numeric'
|
||||
hour='numeric'
|
||||
minute='numeric'
|
||||
second='numeric'
|
||||
}}
|
||||
</Column>
|
||||
<Column @prop='startedAt'>
|
||||
{{date-time-format
|
||||
data.expiresAt
|
||||
year='numeric'
|
||||
month='numeric'
|
||||
day='numeric'
|
||||
hour='numeric'
|
||||
minute='numeric'
|
||||
second='numeric'
|
||||
}}
|
||||
</Column>
|
||||
<Column @prop='finishedAt'>
|
||||
{{date-time-format
|
||||
data.expiresAt
|
||||
year='numeric'
|
||||
month='numeric'
|
||||
day='numeric'
|
||||
hour='numeric'
|
||||
minute='numeric'
|
||||
second='numeric'
|
||||
}}
|
||||
</Column>
|
||||
</Row>
|
||||
</RoyalTable>
|
||||
11
tests/unit/routes/admin/tasks/index-test.js
Normal file
11
tests/unit/routes/admin/tasks/index-test.js
Normal file
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue