Add indexes list
This commit is contained in:
parent
033920d0cc
commit
d5baaac88f
6 changed files with 59 additions and 7 deletions
10
app/routes/admin/indexes/index.js
Normal file
10
app/routes/admin/indexes/index.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class AdminIndexesIndexRoute extends Route {
|
||||
@service meilisearch;
|
||||
|
||||
model() {
|
||||
return this.meilisearch.getIndexes();
|
||||
}
|
||||
}
|
||||
|
|
@ -4,9 +4,10 @@ import query from '../utils/query';
|
|||
|
||||
export default class MeilisearchService extends Service {
|
||||
getIndexes() {
|
||||
return query('indexes').then(({ results }) =>
|
||||
results.map((item) => new Index(item))
|
||||
);
|
||||
return query('indexes').then((result) => {
|
||||
result.results = result.results.map((item) => new Index(item));
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
getHealth() {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
}}
|
||||
<nav>
|
||||
<div class='px-4 py-2 text-sm text-gray'>Indexes</div>
|
||||
{{#each @model as |item|}}
|
||||
{{#each @model.results as |item|}}
|
||||
<LinkTo
|
||||
@route='admin.indexes.item'
|
||||
@model={{item}}
|
||||
|
|
|
|||
30
app/templates/admin/indexes/index.hbs
Normal file
30
app/templates/admin/indexes/index.hbs
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<h1 class='text-3xl mb-4'>Indexes</h1>
|
||||
|
||||
<RoyalTable @data={{@model.results}} class='w-full' as |Row data|>
|
||||
<Row as |Column|>
|
||||
<Column @prop='uid' />
|
||||
<Column @prop='primaryKey' />
|
||||
<Column @prop='createdAt'>
|
||||
{{date-time-format
|
||||
data.createdAt
|
||||
year='numeric'
|
||||
month='numeric'
|
||||
day='numeric'
|
||||
hour='numeric'
|
||||
minute='numeric'
|
||||
second='numeric'
|
||||
}}
|
||||
</Column>
|
||||
<Column @prop='updatedAt'>
|
||||
{{date-time-format
|
||||
data.updatedAt
|
||||
year='numeric'
|
||||
month='numeric'
|
||||
day='numeric'
|
||||
hour='numeric'
|
||||
minute='numeric'
|
||||
second='numeric'
|
||||
}}
|
||||
</Column>
|
||||
</Row>
|
||||
</RoyalTable>
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
<Column @prop='duration' />
|
||||
<Column @prop='enqueuedAt'>
|
||||
{{date-time-format
|
||||
data.expiresAt
|
||||
data.enqueuedAt
|
||||
year='numeric'
|
||||
month='numeric'
|
||||
day='numeric'
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
</Column>
|
||||
<Column @prop='startedAt'>
|
||||
{{date-time-format
|
||||
data.expiresAt
|
||||
data.startedAt
|
||||
year='numeric'
|
||||
month='numeric'
|
||||
day='numeric'
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
</Column>
|
||||
<Column @prop='finishedAt'>
|
||||
{{date-time-format
|
||||
data.expiresAt
|
||||
data.finishedAt
|
||||
year='numeric'
|
||||
month='numeric'
|
||||
day='numeric'
|
||||
|
|
|
|||
11
tests/unit/routes/admin/indexes/index-test.js
Normal file
11
tests/unit/routes/admin/indexes/index-test.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'meiliadmin/tests/helpers';
|
||||
|
||||
module('Unit | Route | admin/indexes/index', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function (assert) {
|
||||
let route = this.owner.lookup('route:admin/indexes/index');
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
Loading…
Reference in a new issue