Add links to item's pages in context menu
This commit is contained in:
parent
4b2c82a722
commit
e45252c0d9
3 changed files with 59 additions and 4 deletions
|
|
@ -78,6 +78,13 @@ export default class MonacoEditorComponent extends Component {
|
|||
|
||||
this.editor = editor.create(el, options);
|
||||
|
||||
if (Array.isArray(this.args.actions)) {
|
||||
this.args.actions.forEach((item) => {
|
||||
// assign because item can be a proxy object
|
||||
this.editor.addAction(Object.assign({}, item));
|
||||
});
|
||||
}
|
||||
|
||||
const minHeight = this.args.minHeight ?? 160;
|
||||
const maxHeight = this.args.maxHeight ?? 420;
|
||||
// Autoresize height of element
|
||||
|
|
|
|||
|
|
@ -2,8 +2,11 @@ import Controller from '@ember/controller';
|
|||
import { action } from '@ember/object';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
import { Magnify, Table, /* MapOutline, */ CodeJson } from 'ember-mdi';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default class AdminIndexesItemDocumentsIndexController extends Controller {
|
||||
@service router;
|
||||
|
||||
@tracked q = null;
|
||||
@tracked limit = 20;
|
||||
@tracked page = 1;
|
||||
|
|
@ -65,6 +68,11 @@ export default class AdminIndexesItemDocumentsIndexController extends Controller
|
|||
return result;
|
||||
}
|
||||
|
||||
@action
|
||||
goToPage(route, index, id) {
|
||||
this.router.transitionTo(route, index, id);
|
||||
}
|
||||
|
||||
@action
|
||||
toggleAttribute(name) {
|
||||
if (this.attributes.includes(name)) {
|
||||
|
|
|
|||
|
|
@ -66,7 +66,8 @@
|
|||
@icon={{icon}}
|
||||
@onClick={{set this 'dataView'}}
|
||||
@value={{key}}
|
||||
class='w-auto rounded-none first:rounded-l last:rounded-r {{if (eq this.dataView key) "text-primary"}}'
|
||||
class='w-auto rounded-none first:rounded-l last:rounded-r
|
||||
{{if (eq this.dataView key) "text-primary"}}'
|
||||
/>
|
||||
{{/each-in}}
|
||||
</div>
|
||||
|
|
@ -118,7 +119,7 @@
|
|||
class='absolute z-dropdown right-0 w-28 mt-2 py-1 origin-top-right bg-base-7 border rounded shadow-sm outline-none'
|
||||
>
|
||||
<LinkTo
|
||||
@route='admin.indexes.item.documents.document'
|
||||
@route='admin.indexes.item.documents.document.index'
|
||||
@models={{models}}
|
||||
class={{linkClasses}}
|
||||
>
|
||||
|
|
@ -148,12 +149,51 @@
|
|||
{{/let}}
|
||||
</SimpleTable>
|
||||
{{else if (eq this.dataView 'json')}}
|
||||
{{#each @model.data.hits as |item|}}
|
||||
|
||||
{{#each @model.data.hits as |data|}}
|
||||
<MonacoEditor
|
||||
@value={{json-stringify item}}
|
||||
@value={{json-stringify data}}
|
||||
@language='json'
|
||||
@readOnly={{true}}
|
||||
@minHeight={{0}}
|
||||
@actions={{array
|
||||
(hash
|
||||
label='Go to View page'
|
||||
id='go-to-view-page'
|
||||
contextMenuGroupId='navigation'
|
||||
contextMenuOrder=1
|
||||
run=(fn
|
||||
this.goToPage
|
||||
'admin.indexes.item.documents.document.index'
|
||||
@model.index
|
||||
data
|
||||
)
|
||||
)
|
||||
(hash
|
||||
label='Go to Edit page'
|
||||
id='go-to-edit-page'
|
||||
contextMenuGroupId='navigation'
|
||||
contextMenuOrder=2
|
||||
run=(fn
|
||||
this.goToPage
|
||||
'admin.indexes.item.documents.document.edit'
|
||||
@model.index
|
||||
data
|
||||
)
|
||||
)
|
||||
(hash
|
||||
label='Go to Delete page'
|
||||
id='go-to-delete-page'
|
||||
contextMenuGroupId='navigation'
|
||||
contextMenuOrder=3
|
||||
run=(fn
|
||||
this.goToPage
|
||||
'admin.indexes.item.documents.document.delete'
|
||||
@model.index
|
||||
data
|
||||
)
|
||||
)
|
||||
}}
|
||||
class='mb-4'
|
||||
/>
|
||||
{{/each}}
|
||||
|
|
|
|||
Loading…
Reference in a new issue