Small fixes
This commit is contained in:
parent
8441d0fab6
commit
a88d88308b
4 changed files with 34 additions and 8 deletions
|
|
@ -1,6 +1,5 @@
|
|||
import Component from '@glimmer/component';
|
||||
import { action } from '@ember/object';
|
||||
// import { tracked } from '@glimmer/tracking';
|
||||
|
||||
export default class ButtonGroupComponent extends Component {
|
||||
@action
|
||||
|
|
|
|||
|
|
@ -10,6 +10,26 @@ export default class AdminIndexesItemDataController extends Controller {
|
|||
|
||||
queryParams = ['q', 'page', 'limit'];
|
||||
|
||||
get sortedFields() {
|
||||
const fields = Object.keys(this.model.stats.fieldDistribution);
|
||||
const primaryKey = this.model.index.primaryKey ?? 'id';
|
||||
const sortedArray = fields
|
||||
.filter((item) => item !== primaryKey)
|
||||
.sort((a, b) => {
|
||||
if (a > b || a.charAt(0) === '_') {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (a < b) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
});
|
||||
|
||||
return [primaryKey].concat(sortedArray);
|
||||
}
|
||||
|
||||
@action
|
||||
searchTextChanged(value) {
|
||||
this.q = value === '' ? null : value;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import Route from '@ember/routing/route';
|
||||
import { hash } from 'rsvp';
|
||||
|
||||
export default class AdminIndexesItemDataRoute extends Route {
|
||||
queryParams = {
|
||||
|
|
@ -15,8 +16,14 @@ export default class AdminIndexesItemDataRoute extends Route {
|
|||
|
||||
async model({ q, page, limit }) {
|
||||
const offset = limit * --page;
|
||||
const index = this.modelFor('admin.indexes.item');
|
||||
const stats = index.getStats();
|
||||
|
||||
return this.modelFor('admin.indexes.item').search(q, { offset, limit });
|
||||
return hash({
|
||||
data: index.search(q, { offset, limit }),
|
||||
index,
|
||||
stats,
|
||||
});
|
||||
}
|
||||
|
||||
resetController(controller, isExiting) {
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
<div class="mb-4 flex items-center">
|
||||
<MdIcon @icon="check" class="mr-1" @size="18" />
|
||||
Hits: {{@model.nbHits}}
|
||||
Hits: {{@model.data.nbHits}}
|
||||
<MdIcon @icon="clock-outline" class="ml-6 mr-1" @size="18" />
|
||||
Time spent: {{@model.processingTimeMs}} ms
|
||||
Time spent: {{@model.data.processingTimeMs}} ms
|
||||
</div>
|
||||
|
||||
{{#if (gt @model.nbHits 0)}}
|
||||
{{#if (gt @model.data.nbHits 0)}}
|
||||
<div class="mb-4 flex items-center">
|
||||
<ButtonGroup @value={{this.dataView}} @onClick={{set this 'dataView'}} as |bg|>
|
||||
<bg.button
|
||||
|
|
@ -31,12 +31,12 @@
|
|||
</div>
|
||||
|
||||
{{#if (eq this.dataView 'table')}}
|
||||
table
|
||||
|
||||
{{/if}}
|
||||
|
||||
{{#if (eq this.dataView 'map')}}
|
||||
{{!-- {{#if (eq this.dataView 'map')}}
|
||||
map
|
||||
{{/if}}
|
||||
{{/if}} --}}
|
||||
|
||||
{{!-- {{#if (eq this.dataView 'card')}}
|
||||
<div class="mb-4">
|
||||
|
|
|
|||
Loading…
Reference in a new issue