このコミットが含まれているのは:
@@ -198,7 +198,10 @@ class CountsPopulation
|
|||||||
raw = params['tags']
|
raw = params['tags']
|
||||||
tokens = raw.split.reject { _1.downcase == 'type:or' }
|
tokens = raw.split.reject { _1.downcase == 'type:or' }
|
||||||
refs = PostTagSearch.parse_references(params, tokens, partial: true)
|
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|
|
predicates = literals.map do |literal|
|
||||||
reference = literal[:reference]
|
reference = literal[:reference]
|
||||||
expression = if reference
|
expression = if reference
|
||||||
|
|||||||
@@ -434,7 +434,7 @@ class CountsTableQuery
|
|||||||
bound = @connection.quote(point)
|
bound = @connection.quote(point)
|
||||||
if population.history && @definition.resource == 'posts'
|
if population.history && @definition.resource == 'posts'
|
||||||
key = kind == 'internal' ? 'tag_id' : 'external_tag_id'
|
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 }', " +
|
"JOIN JSON_TABLE(v.tags_json, '$[*]' COLUMNS (tag_id BIGINT PATH '$.#{ key }', " +
|
||||||
"version_no INT PATH '$.version_no' NULL ON EMPTY)) recorded_tag")
|
"version_no INT PATH '$.version_no' NULL ON EMPTY)) recorded_tag")
|
||||||
.where('recorded_tag.tag_id IN (?)', ids).group('recorded_tag.tag_id')
|
.where('recorded_tag.tag_id IN (?)', ids).group('recorded_tag.tag_id')
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import FormField from '@/components/common/FormField'
|
|||||||
import HelpPopover from '@/components/common/HelpPopover'
|
import HelpPopover from '@/components/common/HelpPopover'
|
||||||
import TagInput from '@/components/common/TagInput'
|
import TagInput from '@/components/common/TagInput'
|
||||||
import { Button } from '@/components/ui/button'
|
import { Button } from '@/components/ui/button'
|
||||||
import { countsUseLatest, fieldsForCounts, normaliseCountsParams, readCountSort,
|
import { countsRequestParams, countsUseLatest, fieldsForCounts, normaliseCountsParams, readCountSort,
|
||||||
selectedCountChildren, selectedCountColumns } from '@/lib/counts'
|
selectedCountChildren, selectedCountColumns } from '@/lib/counts'
|
||||||
import { countsNestedIsScalar } from '@/lib/countsDisplay'
|
import { countsNestedIsScalar } from '@/lib/countsDisplay'
|
||||||
import { useCountsDefinition } from '@/lib/countsDefinitions'
|
import { useCountsDefinition } from '@/lib/countsDefinitions'
|
||||||
@@ -26,9 +26,11 @@ import type { CountsResource, CountsResult } from '@/lib/counts'
|
|||||||
|
|
||||||
const CountsControls = (
|
const CountsControls = (
|
||||||
{ resource, applied, open, setOpen, execute, displayJSON, displayRowNumbers,
|
{ 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
|
resource: CountsResource; applied: URLSearchParams; open: boolean
|
||||||
conditionLabels?: CountsResult['conditionLabels']
|
conditionLabels?: CountsResult['conditionLabels']
|
||||||
|
conditionLabelsParams?: string
|
||||||
pending?: boolean
|
pending?: boolean
|
||||||
setOpen: (open: boolean) => void
|
setOpen: (open: boolean) => void
|
||||||
execute: (params: URLSearchParams) => void
|
execute: (params: URLSearchParams) => void
|
||||||
@@ -42,6 +44,8 @@ const CountsControls = (
|
|||||||
const id = useId ()
|
const id = useId ()
|
||||||
const motion = useClientMotion ()
|
const motion = useClientMotion ()
|
||||||
const [draft, setDraft] = useState (() => new URLSearchParams (applied))
|
const [draft, setDraft] = useState (() => new URLSearchParams (applied))
|
||||||
|
const labelParams = conditionLabelsParams == null
|
||||||
|
? null : new URLSearchParams (conditionLabelsParams)
|
||||||
const thumbnail = selectedCountColumns (resource, applied, definition).includes ('thumbnail')
|
const thumbnail = selectedCountColumns (resource, applied, definition).includes ('thumbnail')
|
||||||
const previousApplied = useRef ({ resource, params: new URLSearchParams (applied) })
|
const previousApplied = useRef ({ resource, params: new URLSearchParams (applied) })
|
||||||
const appliedState = applied.toString ()
|
const appliedState = applied.toString ()
|
||||||
@@ -282,7 +286,12 @@ const CountsControls = (
|
|||||||
</div>}
|
</div>}
|
||||||
</FormField>}
|
</FormField>}
|
||||||
<CountsAdditionalConditions params={draft} update={update}
|
<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>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -454,8 +454,14 @@ export const countsConditionValue = (
|
|||||||
return translateUIMessage ('bot', 'counts', locale).text
|
return translateUIMessage ('bot', 'counts', locale).text
|
||||||
if (value == null) return 'NULL'
|
if (value == null) return 'NULL'
|
||||||
if (axis.field === 'tags' || axis.field === 'user')
|
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
|
|| translateUIMessage ('notRegistered', 'counts', locale).text
|
||||||
|
}
|
||||||
if (axis.field === 'changed_field')
|
if (axis.field === 'changed_field')
|
||||||
return translateUIMessage (countsFieldLabel (String (value)), 'counts', locale).text
|
return translateUIMessage (countsFieldLabel (String (value)), 'counts', locale).text
|
||||||
if (typeof value === 'boolean')
|
if (typeof value === 'boolean')
|
||||||
|
|||||||
@@ -342,7 +342,9 @@ const CountsResourceContent = (
|
|||||||
<div ref={controlsArea} className="shrink-0"
|
<div ref={controlsArea} className="shrink-0"
|
||||||
style={{ minHeight: definition == null ? controlsHeight : undefined }}>
|
style={{ minHeight: definition == null ? controlsHeight : undefined }}>
|
||||||
{definition != null && <CountsControls key={`${resource}:${params.get ('definition')}`}
|
{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')}
|
pending={running || fetching || !params.has ('execution_at')}
|
||||||
open={open} setOpen={setOpen}
|
open={open} setOpen={setOpen}
|
||||||
reorder={value => update ('order', value)}
|
reorder={value => update ('order', value)}
|
||||||
|
|||||||
新しいイシューから参照
ユーザーをブロックする