コミットを比較

...
4 コミット
作成者 SHA1 メッセージ 日付
みてるぞ 9f92dbfb06 #434 2026-10-29 18:10:13 +09:00
みてるぞ 549a45e9d5 #434 2026-10-29 12:38:03 +09:00
みてるぞ 7090f63ab6 #434 2026-10-29 12:30:42 +09:00
みてるぞ 7536330ecf #434 2026-10-29 12:28:20 +09:00
13個のファイルの変更、245行の追加、52行の削除
+10
ファイルの表示
@@ -82,6 +82,16 @@ class CountsCondition
def apply(scope, entry)
raise ArgumentError unless entry.is_a?(Hash)
if entry['operator'] == 'axis_eq'
raise ArgumentError unless (entry.keys - ['field', 'operator', 'grain', 'value']).empty?
value = entry['value']
unless value.nil? || value.is_a?(String) || value.is_a?(Numeric) || [true, false].include?(value)
raise ArgumentError
end
raise ArgumentError if value.is_a?(String) && value.bytesize > 8192
return @population.axis_condition(scope, entry)
end
allowed = ['field', 'operator', 'value', 'end', 'blank', 'input', 'values']
raise ArgumentError if (entry.keys - allowed).any?
+51 -26
ファイルの表示
@@ -62,6 +62,35 @@ class CountsPopulation
@authorisation_flg ? HistoryAccess.sql(model, row) : 'TRUE'
end
def axis_condition(scope, entry)
key = entry.fetch('field')
raise ArgumentError unless definition.axes(history).include?(key)
if entry.key?('grain')
unless definition.fields[key] == :datetime && CountsAxes::GRAINS.include?(entry['grain'])
raise ArgumentError
end
end
if key == 'tags'
scope = scope.where(snapshot_membership(entry.fetch('value')))
elsif key == 'changed_field'
raise ArgumentError unless history && definition.changes.include?(entry['value'])
scope = scope.where(Arel.sql(changed_sql(entry['value'])))
elsif definition.fields[key] == :datetime && entry['grain']
scope = scope.where(definition.expression(key) => nil) if entry['value'].nil?
if entry['value']
expression = CountsAxes.time_expression(definition.expression(key),
entry['grain'], timezone)
scope = scope.where("#{ expression } = ?", entry['value'])
end
else
raise ArgumentError unless definition.axes(history).include?(key)
scope = scope.where(definition.expression(key) => entry['value'])
end
scope
end
private
def make_population
@@ -69,7 +98,8 @@ class CountsPopulation
@scope = @scope.from("#{ table } v").select('v.*')
previous = ['rows', 'cols'].any? do |key|
QueryState.axes(params.fetch(key, '')).any? { _1['field'] == 'changed_field' }
end || QueryState.records(params, 'drill').any? { _1['field'] == 'changed_field' }
end || (QueryState.records(params, 'drill') + QueryState.records(params, 'conditions'))
.any? { _1['field'] == 'changed_field' }
if previous
keys = definition.keys.map { "previous.#{ _1 } = v.#{ _1 }" }.join(' AND ')
@scope = @scope.joins("LEFT JOIN #{ table } previous ON #{ keys } " +
@@ -106,6 +136,14 @@ class CountsPopulation
end
apply_tags if params['tags'].present? || params['tag'].present?
conditions = QueryState.records(params, 'conditions')
drills = QueryState.records(params, 'drill')
raise ArgumentError unless drills.length <= 100
drills.each do |entry|
raise ArgumentError unless (entry.keys - ['field', 'grain', 'value']).empty?
condition = entry.merge('operator' => 'axis_eq')
conditions << condition unless conditions.include?(condition)
end
raise ArgumentError unless conditions.is_a?(Array) && conditions.length <= 100
values = QueryState.records(params, 'condition_values')
@@ -114,7 +152,13 @@ class CountsPopulation
raise ArgumentError unless index.between?(0, conditions.length - 1)
raise ArgumentError unless conditions[index]['values'] == true
end
evaluated = []
conditions.each_with_index do |entry, index|
if entry['operator'] == 'axis_eq'
next if evaluated.include?(entry)
evaluated << entry
end
if entry.key?('values')
raise ArgumentError unless entry['values'] == true
@@ -123,30 +167,7 @@ class CountsPopulation
end
apply_condition(entry)
end
drills = QueryState.records(params, 'drill')
raise ArgumentError unless drills.is_a?(Array) && drills.length <= 100
drills.each do |entry|
key = entry.fetch('field')
if key == 'tags'
@scope = @scope.where(snapshot_membership(entry.fetch('value')))
elsif key == 'changed_field'
raise ArgumentError unless history && definition.changes.include?(entry['value'])
@scope = @scope.where(Arel.sql(changed_sql(entry['value'])))
elsif definition.fields[key] == :datetime && entry['grain']
@scope = @scope.where(definition.expression(key) => nil) if entry['value'].nil?
if entry['value']
expression = CountsAxes.time_expression(definition.expression(key),
entry['grain'], timezone)
@scope = @scope.where("#{ expression } = ?", entry['value'])
end
else
raise ArgumentError unless definition.axes(history).include?(key)
@scope = @scope.where(definition.expression(key) => entry['value'])
end
end
end
def apply_condition(entry)
@@ -174,9 +195,13 @@ class CountsPopulation
end
return unless params['tags'].present?
refs = PostTagSearch.parse_references(params, params['tags'].split)
raw = params['tags']
literals = PostTagSearch.literals(nil, raw, references: refs)
tokens = raw.split.reject { _1.downcase == 'type:or' }
refs = PostTagSearch.parse_references(params, tokens, partial: true)
locale = Locale.find_by(code: params.fetch('locale', 'ja'))
raise ArgumentError unless locale
literals = PostTagSearch.literals(locale, tokens.join(' '), references: refs)
predicates = literals.map do |literal|
reference = literal[:reference]
expression = if reference
+17 -2
ファイルの表示
@@ -57,7 +57,7 @@ class CountsTableQuery
end
def metadata
{ population_count: nil, population_count_computed: false,
{ condition_labels: condition_labels, population_count: nil, population_count_computed: false,
excluded_count: nil, excluded_count_scope: 'current_query',
population_count_scope: 'all_recorded_versions',
page:, limit:, execution_at: population.at.iso8601(6), at: @params['at'].presence,
@@ -378,6 +378,21 @@ class CountsTableQuery
end
end
def condition_labels
entries = QueryState.records(@params, 'conditions').select { _1['operator'] == 'axis_eq' }
entries += QueryState.records(@params, 'drill')
entries.group_by { _1['field'] }.to_h do |field, conditions|
values = conditions.map { _1['value'] }.compact.uniq
labels = case field
when 'tags' then tag_labels(values)
when 'user'
User.where(id: values).pluck(:id, :name).to_h.transform_keys(&:to_s)
else {}
end
[field, labels]
end
end
def axis_labels(records, column_values)
result = {}
@axis_names = {}
@@ -419,7 +434,7 @@ class CountsTableQuery
bound = @connection.quote(point)
if population.history && @definition.resource == 'posts'
key = kind == 'internal' ? 'tag_id' : 'external_tag_id'
pairs = population.scope.except(:select, :order).joins(
pairs = HistoryAccess.visible(population.scope, 'v').except(:select, :order).joins(
"JOIN JSON_TABLE(v.tags_json, '$[*]' COLUMNS (tag_id BIGINT PATH '$.#{ key }', " +
"version_no INT PATH '$.version_no' NULL ON EMPTY)) recorded_tag")
.where('recorded_tag.tag_id IN (?)', ids).group('recorded_tag.tag_id')
+11 -1
ファイルの表示
@@ -1,6 +1,6 @@
# Shared literal parsing and reference resolution for current and snapshot post search.
class PostTagSearch
def self.parse_references(raw, literals)
def self.parse_references(raw, literals, partial: false)
return nil unless raw.key?('tag_refs')
references = QueryState.records(raw, 'tag_refs')
@@ -15,6 +15,16 @@ class PostTagSearch
end
raise ArgumentError unless valid
if partial
remaining = references.dup
result = literals.map do |literal|
index = remaining.index { _1['name'] == literal }
index ? remaining.delete_at(index) : nil
end
raise ArgumentError if remaining.any?
return result
end
references.map { _1['name'] } == literals ? references : nil
end
+3 -2
ファイルの表示
@@ -1,7 +1,7 @@
# Public query grammar shared with frontend/src/lib/queryState.ts.
class QueryState
SCHEMAS = {
'conditions' => ['field', 'operator', 'value', 'end', 'blank', 'input', 'values'],
'conditions' => ['field', 'operator', 'value', 'end', 'blank', 'input', 'values', 'grain', 'value_type'],
'condition_values' => ['condition', 'value', 'value_type'],
'drill' => ['field', 'grain', 'value', 'value_type'],
'tag_refs' => ['name', 'tag_id', 'external_tag_id', 'negative', 'missing'],
@@ -57,7 +57,8 @@ class QueryState
records.sort.map do |_index, record|
type = record.delete('value_type')
if ['drill', 'measures', 'column_order', 'condition_values'].include?(key)
if (['drill', 'measures', 'column_order', 'condition_values'].include?(key) ||
(key == 'conditions' && record['operator'] == 'axis_eq'))
raise ArgumentError unless ['null', 'string', 'number', 'boolean'].include?(type)
raise ArgumentError unless type == 'null' || record.key?('value')
+21 -5
ファイルの表示
@@ -7,11 +7,15 @@ import { countsConditionInputs, countsEventTypes, countsFieldLabel, countsFilter
countsSetOperators, useCountsDefinition }
from '@/lib/countsDefinitions'
import useDialogue from '@/lib/dialogues/useDialogue'
import { countsConditionValue } from '@/lib/countsDisplay'
import { countsAxisLabel } from '@/lib/countsDefinitions'
import { useLocale } from '@/lib/useLocale'
import { inputClass } from '@/lib/utils'
import { useUITranslation } from '@/lib/useUITranslation'
import { readCountState, encodeCountState } from '@/lib/queryState'
import type { CountsResult } from '@/lib/counts'
import type { DialogueFormControls } from '@/lib/dialogues/useDialogue'
import type { CountsCondition, CountsDefinition } from '@/lib/countsDefinitions'
@@ -90,13 +94,15 @@ const ConditionEditor = (
}
const CountsAdditionalConditions = ({ params, update }: {
const CountsAdditionalConditions = ({ params, update, conditionLabels }: {
conditionLabels?: CountsResult['conditionLabels']
params: URLSearchParams
update: (key: string, value: string) => void },
) => {
const { label, message } = useUITranslation ('counts')
const definition = useCountsDefinition ()
const dialogue = useDialogue ()
const locale = useLocale ()
const conditions = readCountState<CountsCondition[]> (params, 'conditions', [])
const metadata = definition.filterFields ?? definition.fields
const fields = metadata.filter (field => field.operators.length > 0 && !field.legacy)
@@ -127,7 +133,7 @@ const CountsAdditionalConditions = ({ params, update }: {
{
const options: string[] = type === 'boolean' ? ['true', 'false'] : [...countsEventTypes]
const namespace = type === 'boolean' ? 'truthValues' : 'events'
return <select value={condition[key] ?? ''} disabled={condition.blank}
return <select value={condition[key] == null ? '' : String (condition[key])} disabled={condition.blank}
className={inputClass (false, 'h-10 w-36 min-w-0 max-w-full py-1')}
aria-label={aria.text}
lang={aria.language}
@@ -140,10 +146,10 @@ const CountsAdditionalConditions = ({ params, update }: {
}
if (type === 'datetime')
return <DateTimeField precision="second" className="h-10 w-48 min-w-0 max-w-full py-1"
value={condition[key] ?? ''} disabled={condition.blank}
value={condition[key] == null ? '' : String (condition[key])} disabled={condition.blank}
aria-label={aria.text} lang={aria.language}
onChange={value => patch (index, { [key]: value ?? '' })}/>
return <input value={condition[key] ?? ''} disabled={condition.blank}
return <input value={condition[key] == null ? '' : String (condition[key])} disabled={condition.blank}
type={(type === 'integer' || type === 'interval') ? 'number' : 'text'}
className={inputClass (false, 'h-10 w-36 min-w-0 max-w-full py-1')}
aria-label={aria.text} lang={aria.language}
@@ -153,7 +159,17 @@ const CountsAdditionalConditions = ({ params, update }: {
<legend className="flex items-center gap-2">{label ('additionalConditions')}
<Button type="button" variant="outline" size="sm" disabled={fields.length === 0}
onClick={() => edit ()}>{label ('add')}</Button></legend>
{conditions.map ((condition, index) => (
{conditions.map ((condition, index) => condition.operator === 'axis_eq' ? (
<div key={index} className="flex flex-wrap items-center gap-2 border-b py-2">
<span>{countsAxisLabel (condition, definition, locale).text}</span>
<span>{label ('operatorSymbols.eq')}</span>
<span>{countsConditionValue (condition.value, condition, locale,
params.get ('timezone') ?? 'UTC', conditionLabels)}</span>
<Button type="button" variant="ghost" size="sm"
aria-label={message ('remove').text}
onClick={() => write (conditions.filter ((_, position) => position !== index))}>
×</Button>
</div>) : (
<div key={index} className="flex min-w-0 flex-wrap items-center gap-x-2 gap-y-2
border-b border-slate-200 py-2 dark:border-slate-700">
<Button type="button" variant="ghost" size="sm" onClick={() => edit (index)}
+69 -7
ファイルの表示
@@ -9,7 +9,7 @@ import FormField from '@/components/common/FormField'
import HelpPopover from '@/components/common/HelpPopover'
import TagInput from '@/components/common/TagInput'
import { Button } from '@/components/ui/button'
import { countsUseLatest, fieldsForCounts, normaliseCountsParams, readCountSort,
import { countsRequestParams, countsUseLatest, fieldsForCounts, normaliseCountsParams, readCountSort,
selectedCountChildren, selectedCountColumns } from '@/lib/counts'
import { countsNestedIsScalar } from '@/lib/countsDisplay'
import { useCountsDefinition } from '@/lib/countsDefinitions'
@@ -17,17 +17,20 @@ import { useClientMotion } from '@/lib/useClientMotion'
import { inputClass } from '@/lib/utils'
import { useUITranslation } from '@/lib/useUITranslation'
import { readCountState, setCountState } from '@/lib/queryState'
import { readCountState, setCountState, encodeCountState } from '@/lib/queryState'
import type { ReactNode } from 'react'
import type { CountsResource } from '@/lib/counts'
import type { CountsResource, CountsResult } from '@/lib/counts'
const CountsControls = (
{ resource, applied, open, setOpen, execute, displayJSON, displayRowNumbers,
displayThumbnail, reorder, actions, pending = false }: {
displayThumbnail, reorder, actions, conditionLabels, conditionLabelsParams,
pending = false }: {
resource: CountsResource; applied: URLSearchParams; open: boolean
conditionLabels?: CountsResult['conditionLabels']
conditionLabelsParams?: string
pending?: boolean
setOpen: (open: boolean) => void
execute: (params: URLSearchParams) => void
@@ -41,6 +44,8 @@ const CountsControls = (
const id = useId ()
const motion = useClientMotion ()
const [draft, setDraft] = useState (() => new URLSearchParams (applied))
const labelParams = conditionLabelsParams == null
? null : new URLSearchParams (conditionLabelsParams)
const thumbnail = selectedCountColumns (resource, applied, definition).includes ('thumbnail')
const previousApplied = useRef ({ resource, params: new URLSearchParams (applied) })
const appliedState = applied.toString ()
@@ -92,6 +97,27 @@ const CountsControls = (
const update = (key: string, value: string) => setDraft (previous => {
const next = new URLSearchParams (previous)
setCountState (next, key, value)
if (key === 'tags')
{
const tokens = value.split (/\s+/).filter (token => token
&& token.toLowerCase () !== 'type:or')
const remaining = [...tokens]
const references = readCountState<Record<string, string | number | boolean>[]> (
previous, 'tag_refs', []).flatMap (reference => {
const name = String (reference.name)
const exact = remaining.indexOf (name)
const index = exact >= 0 ? exact : remaining.findIndex (token =>
token.replace (/^not:/i, '') === name.replace (/^not:/i, ''))
if (index < 0) return []
const [token] = remaining.splice (index, 1)
return [token === name ? reference : { ...reference, name: token,
negative: token.toLowerCase ().startsWith ('not:') }]
})
for (const name of [...next.keys ()])
if (name === 'tag_refs' || name.startsWith ('tag_refs.')) next.delete (name)
if (references.length > 0)
setCountState (next, 'tag_refs', encodeCountState ('tag_refs', references))
}
if (key === 'limit') next.delete ('page')
if (next.toString () === previous.toString ()) return previous
if (['rows', 'cols'].includes (key) && next.get ('sort') !== '') next.delete ('sort')
@@ -226,10 +252,46 @@ const CountsControls = (
</FormField>)}
</div>
{resource === 'posts' && <FormField label={label ('columns.tags')}>
{() => <TagInput includeNico includeUnused value={draft.get ('tags') ?? ''}
setValue={value => update ('tags', value)}/>}
{() => <div className="flex flex-wrap items-center gap-2">
<TagInput includeNico includeUnused value={draft.get ('tags') ?? ''}
setValue={value => update ('tags', value)}/>
<select value={(draft.get ('match') === 'any'
|| draft.get ('tags')?.split (/\s+/).some (token =>
token.toLowerCase () === 'type:or')) ? 'any' : 'all'}
className={inputClass (false, 'h-10 w-auto')}
aria-label={message ('columns.tags').text}
onChange={event => {
const match = event.target.value
setDraft (previous => {
const next = new URLSearchParams (previous)
next.set ('match', match)
next.set ('tags', (next.get ('tags') ?? '').split (/\s+/)
.filter (token => token.toLowerCase () !== 'type:or').join (' '))
next.delete ('page')
return next
})
}}>
<option value="all">AND</option><option value="any">OR</option>
</select>
{draft.get ('tags') && <>
<Button type="button" variant="ghost" size="sm"
aria-label={message ('remove').text} onClick={() => setDraft (previous => {
const next = new URLSearchParams (previous)
for (const key of [...next.keys ()])
if (['tags', 'tag', 'kind', 'match', 'tag_refs', 'page'].includes (key)
|| key.startsWith ('tag_refs.')) next.delete (key)
return next
})}>×</Button>
</>}
</div>}
</FormField>}
<CountsAdditionalConditions params={draft} update={update}/>
<CountsAdditionalConditions params={draft} update={update}
conditionLabels={(labelParams != null
&& draft.get ('current') === labelParams.get ('current')
&& draft.get ('at') === labelParams.get ('at')
&& countsRequestParams (draft).toString ()
=== countsRequestParams (labelParams).toString ())
? conditionLabels : undefined}/>
</fieldset>
</div>
</div>
+4 -4
ファイルの表示
@@ -86,10 +86,10 @@ const CountsSummaryTable = (
: totals.get (JSON.stringify ([row.values, column.values])) ?? 0
const drill = (row: CountsPivotHeader, column: CountsPivotHeader) => {
const next = new URLSearchParams (params)
const existing = readCountState<Record<string, string | number | null>[]> (params, 'drill', [])
setCountState (next, 'drill', encodeCountState ('drill', [...existing,
...row.values.map ((value, index) => ({ ...rows[index], value })),
...column.values.map ((value, index) => ({ ...cols[index], value }))]))
const existing = readCountState<Record<string, string | number | null>[]> (params, 'conditions', [])
setCountState (next, 'conditions', encodeCountState ('conditions', [...existing,
...row.values.map ((value, index) => ({ ...rows[index], operator: 'axis_eq', value })),
...column.values.map ((value, index) => ({ ...cols[index], operator: 'axis_eq', value }))]))
next.set ('mode', 'details')
next.delete ('sort')
next.delete ('page')
+18 -1
ファイルの表示
@@ -2,7 +2,7 @@ import { countsFieldLabel } from '@/lib/countsDefinitions'
import { apiDownload, apiGet } from '@/lib/api'
import { currentViewingLocale, localeLanguage } from '@/lib/locales'
import { readCountState, encodeCountState } from '@/lib/queryState'
import { readCountState, encodeCountState, setCountState } from '@/lib/queryState'
import type { CountsAxis, CountsDefinition } from '@/lib/countsDefinitions'
import type { LocaleCode } from '@/lib/locales'
@@ -77,6 +77,7 @@ export type CountsResult = {
executionAt?: string
columnValues?: (string | number | null)[][]
cells?: { values: (string | number | null)[]; count: number }[]
conditionLabels?: Record<string, Record<string, string | null>>
axisLabels?: Record<string, Record<string, string | null>>
axisNames?: Record<string, Record<string, Record<string, unknown>>>
rows?: { field: string; grain?: string }[]
@@ -368,6 +369,22 @@ export const normaliseCountsParams = (
definition?: CountsDefinition,
): URLSearchParams => {
const params = new URLSearchParams (source)
const drills = readCountState<Record<string, unknown>[]> (params, 'drill', [])
if (params.get ('tag'))
{
drills.push ({ field: 'tags', value: `${params.get ('kind') ?? 'internal'}:${
params.get ('tag')}` })
params.delete ('tag')
params.delete ('kind')
}
if (drills.length > 0)
{
const conditions = readCountState<Record<string, unknown>[]> (params, 'conditions', [])
setCountState (params, 'conditions', encodeCountState ('conditions', [
...conditions, ...drills.map (entry => ({ ...entry, operator: 'axis_eq' }))]))
for (const key of [...params.keys ()])
if (key === 'drill' || key.startsWith ('drill.')) params.delete (key)
}
if (!params.has ('limit')) params.set ('limit', '100')
const nameScope = params.get ('name_scope')
if (definition?.conditionAliases != null && (nameScope == null || nameScope === 'locale'))
+1 -1
ファイルの表示
@@ -8,7 +8,7 @@ import type { CountField, CountsResource } from '@/lib/counts'
export type CountsAxis = { field: string; grain?: string }
export type CountsCondition = {
field: string; operator: string; value?: string; end?: string; blank?: boolean
field: string; operator: string; grain?: string; value?: string | number | boolean | null; end?: string; blank?: boolean
input?: 'single' | 'multiple' | 'list'; values?: (string | number | boolean)[] }
export type CountsFieldType = 'string' | 'integer' | 'datetime' | 'enum'
| 'json' | 'boolean' | 'interval'
+33
ファイルの表示
@@ -445,6 +445,39 @@ const countsDateValue = (
}
export const countsConditionValue = (
value: string | number | boolean | null | undefined,
axis: CountsAxis, locale: LocaleCode, timezone: string,
labels?: Record<string, Record<string, string | null>>,
): string => {
if (axis.field === 'user' && value == null)
return translateUIMessage ('bot', 'counts', locale).text
if (value == null) return 'NULL'
if (axis.field === 'tags' || axis.field === 'user')
{
if (labels == null) return '…'
const names = labels[axis.field]
if (names == null || !Object.prototype.hasOwnProperty.call (names, String (value)))
return '—'
return names[String (value)]
|| translateUIMessage ('notRegistered', 'counts', locale).text
}
if (axis.field === 'changed_field')
return translateUIMessage (countsFieldLabel (String (value)), 'counts', locale).text
if (typeof value === 'boolean')
return translateUIMessage (`truthValues.${value}`, 'counts', locale).text
if (axis.grain != null)
return countsDateValue (String (value), axis.grain, locale, timezone) ?? String (value)
if (axis.field === 'event_type')
return translateUIMessage (`events.${value}`, 'counts', locale).text
if (axis.field === 'category' || axis.field === 'tag_category')
return translateUIMessage (`common:categories.${value}`, 'counts', locale).text
if (['language_code', 'source_language_code'].includes (axis.field))
return languageUIMessage (String (value), locale).text
return String (value)
}
export const countsSummaryValue = (
value: string | number | null,
axis: CountsAxis,
+5 -3
ファイルの表示
@@ -1,7 +1,7 @@
// Public URL grammar: space-delimited tokens and indexed scalar fields, never JSON.
export type QueryRecord = Record<string, string | number | boolean | null | undefined>
const schemas: Record<string, string[]> = {
conditions: ['field', 'operator', 'value', 'end', 'blank', 'input', 'values'],
conditions: ['field', 'operator', 'value', 'end', 'blank', 'input', 'values', 'grain', 'value_type'],
condition_values: ['condition', 'value', 'value_type'],
drill: ['field', 'grain', 'value', 'value_type'],
tag_refs: ['name', 'tag_id', 'external_tag_id', 'negative', 'missing'],
@@ -54,7 +54,8 @@ export const setQueryRecords = (
if (!schemas[key]?.includes (field)) continue
const name = `${key}.${index}.${field}`
if (field === 'value'
&& ['drill', 'measures', 'column_order', 'condition_values'].includes (key))
&& (['drill', 'measures', 'column_order', 'condition_values'].includes (key)
|| (key === 'conditions' && record.operator === 'axis_eq')))
params.set (`${key}.${index}.value_type`, value == null ? 'null' : typeof value)
if (value == null) continue
params.set (name, typeof value === 'boolean'
@@ -71,7 +72,8 @@ export const readCountState = <T,> (
key: string,
fallback: T,
): T => {
if (!params.has (key)) return fallback
if (!params.has (key) && ![...params.keys ()].some (name =>
name.startsWith (`${key}.`))) return fallback
if (key === 'rows' || key === 'cols')
return queryList (params.get (key)).map (token => {
const [field, grain] = token.split (':')
+2
ファイルの表示
@@ -343,6 +343,8 @@ const CountsResourceContent = (
style={{ minHeight: definition == null ? controlsHeight : undefined }}>
{definition != null && <CountsControls key={`${resource}:${params.get ('definition')}`}
resource={resource} applied={params}
conditionLabels={errorFlg ? undefined : data?.conditionLabels}
conditionLabelsParams={resultParams.toString ()}
pending={running || fetching || !params.has ('execution_at')}
open={open} setOpen={setOpen}
reorder={value => update ('order', value)}