Add listing for raw page views
This commit is contained in:
parent
b6b07f2cad
commit
41cd00a413
@ -1,3 +1,4 @@
|
||||
import {OrderDirection} from '@extollo/lib'
|
||||
|
||||
export enum FieldType {
|
||||
text = 'text',
|
||||
@ -58,6 +59,8 @@ export interface ResourceConfiguration {
|
||||
key: string,
|
||||
collection: string,
|
||||
primaryKey: string,
|
||||
orderField?: string,
|
||||
orderDirection?: OrderDirection,
|
||||
generateKeyOnInsert?: () => string|number,
|
||||
display: {
|
||||
field?: string,
|
||||
|
@ -3,6 +3,53 @@ import {allResourceActions, FieldType, Renderer, ResourceAction, ResourceConfigu
|
||||
|
||||
export default {
|
||||
resources: [
|
||||
{
|
||||
key: 'pageView',
|
||||
primaryKey: 'page_view_id',
|
||||
collection: 'page_views',
|
||||
display: {
|
||||
field: 'endpoint',
|
||||
singular: 'Raw Page View',
|
||||
plural: 'Raw Page Views',
|
||||
},
|
||||
orderField: 'visited_at',
|
||||
orderDirection: 'desc',
|
||||
supportedActions: [ResourceAction.read, ResourceAction.readOne],
|
||||
fields: [
|
||||
{
|
||||
key: 'visited_at',
|
||||
display: 'Date',
|
||||
type: FieldType.date,
|
||||
renderer: Renderer.datetime,
|
||||
},
|
||||
{
|
||||
key: 'endpoint',
|
||||
display: 'Route',
|
||||
type: FieldType.text,
|
||||
},
|
||||
{
|
||||
key: 'ip',
|
||||
display: 'IP Address',
|
||||
type: FieldType.text,
|
||||
},
|
||||
{
|
||||
key: 'hostname',
|
||||
display: 'Hostname',
|
||||
type: FieldType.text,
|
||||
},
|
||||
{
|
||||
key: 'method',
|
||||
display: 'Method',
|
||||
type: FieldType.text,
|
||||
},
|
||||
{
|
||||
key: 'xhr',
|
||||
display: 'XHR?',
|
||||
type: FieldType.bool,
|
||||
renderer: Renderer.bool,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'workItem',
|
||||
primaryKey: 'work_item_id',
|
||||
|
@ -42,6 +42,8 @@ export class ResourceAPI extends Controller {
|
||||
const result = await this.make<Builder>(Builder)
|
||||
.select(config.primaryKey, ...config.fields.map(x => x.key))
|
||||
.from(config.collection)
|
||||
.limit(500)
|
||||
.orderBy(config.orderField || config.primaryKey, config.orderDirection || 'asc')
|
||||
.connection(this.db.get())
|
||||
.get()
|
||||
.all()
|
||||
|
@ -44,6 +44,9 @@ head
|
||||
a.nav-link(href=route('dash/cobalt/listing/contactSubmission'))
|
||||
i.fas.fa-fw.fa-comment-alt
|
||||
span Contact Form
|
||||
a.nav-link(href=route('dash/cobalt/listing/pageView'))
|
||||
i.fas.fa-fw.fa-chart-bar
|
||||
span Raw Page Views
|
||||
#content-wrapper.d-flex.flex-column
|
||||
#content
|
||||
nav.navbar.navbar-expand.navbar-light.bg-white.topbar.mb-4.static-top.shadow
|
||||
|
Loading…
Reference in New Issue
Block a user