Adjust preset record list filter styles and logic
This commit is contained in:
@@ -5,6 +5,13 @@ import { Module } from '../module'
|
||||
import { Button } from './types'
|
||||
|
||||
const kind = 'RecordList'
|
||||
|
||||
interface FilterPreset {
|
||||
name: string;
|
||||
filter: unknown[];
|
||||
roles: string[];
|
||||
}
|
||||
|
||||
interface Options {
|
||||
moduleID: string;
|
||||
prefilter: string;
|
||||
@@ -58,7 +65,7 @@ interface Options {
|
||||
|
||||
bulkRecordEditEnabled: boolean;
|
||||
inlineRecordEditEnabled: boolean;
|
||||
recordFilters: Array<Record<string, any>>
|
||||
filterPresets: FilterPreset[];
|
||||
}
|
||||
|
||||
const defaults: Readonly<Options> = Object.freeze({
|
||||
@@ -107,8 +114,8 @@ const defaults: Readonly<Options> = Object.freeze({
|
||||
showRefresh: false,
|
||||
|
||||
bulkRecordEditEnabled: true,
|
||||
inlineRecordEditEnabled: false
|
||||
recordFilters: []
|
||||
inlineRecordEditEnabled: false,
|
||||
filterPresets: []
|
||||
})
|
||||
|
||||
export class PageBlockRecordList extends PageBlock {
|
||||
@@ -132,8 +139,8 @@ export class PageBlockRecordList extends PageBlock {
|
||||
this.options.fields = o.fields
|
||||
}
|
||||
|
||||
if (o.recordFilters) {
|
||||
this.options.recordFilters = o.recordFilters
|
||||
if (o.filterPresets) {
|
||||
this.options.filterPresets = o.filterPresets
|
||||
}
|
||||
|
||||
if (o.editFields) {
|
||||
|
||||
@@ -40,8 +40,8 @@ interface OAuth2TokenResponse {
|
||||
access_token: string;
|
||||
refresh_token: string;
|
||||
expires_in: number;
|
||||
|
||||
roles?: string;
|
||||
|
||||
roles?: string[];
|
||||
name?: string;
|
||||
handle?: string;
|
||||
email?: string;
|
||||
@@ -574,7 +574,7 @@ export class Auth {
|
||||
name: oa2tkn.name,
|
||||
handle: oa2tkn.handle,
|
||||
email: oa2tkn.email,
|
||||
roles: oa2tkn.roles ? [oa2tkn.roles] : [],
|
||||
roles: oa2tkn.roles || [],
|
||||
})
|
||||
|
||||
if (oa2tkn.preferred_language) {
|
||||
|
||||
Reference in New Issue
Block a user