このコミットが含まれているのは:
2026-10-29 18:10:13 +09:00
コミット 9f92dbfb06
5個のファイルの変更、27行の追加、7行の削除
+4 -1
ファイルの表示
@@ -198,7 +198,10 @@ class CountsPopulation
raw = params['tags']
tokens = raw.split.reject { _1.downcase == 'type:or' }
refs = PostTagSearch.parse_references(params, tokens, partial: true)
literals = PostTagSearch.literals(nil, tokens.join(' '), references: refs)
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
+1 -1
ファイルの表示
@@ -434,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')
+12 -3
ファイルの表示
@@ -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'
@@ -26,9 +26,11 @@ import type { CountsResource, CountsResult } from '@/lib/counts'
const CountsControls = (
{ resource, applied, open, setOpen, execute, displayJSON, displayRowNumbers,
displayThumbnail, reorder, actions, conditionLabels, 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
@@ -42,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 ()
@@ -282,7 +286,12 @@ const CountsControls = (
</div>}
</FormField>}
<CountsAdditionalConditions params={draft} update={update}
conditionLabels={conditionLabels}/>
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>
+7 -1
ファイルの表示
@@ -454,8 +454,14 @@ export const countsConditionValue = (
return translateUIMessage ('bot', 'counts', locale).text
if (value == null) return 'NULL'
if (axis.field === 'tags' || axis.field === 'user')
return labels?.[axis.field]?.[String (value)]
{
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')
+3 -1
ファイルの表示
@@ -342,7 +342,9 @@ const CountsResourceContent = (
<div ref={controlsArea} className="shrink-0"
style={{ minHeight: definition == null ? controlsHeight : undefined }}>
{definition != null && <CountsControls key={`${resource}:${params.get ('definition')}`}
resource={resource} applied={params} conditionLabels={data?.conditionLabels}
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)}