Skip to content

Commit 9cf0cf2

Browse files
authored
Merge pull request #199 from 10up/improvements
Fix: deprecated warning and wrap checkboxes in VStack component
2 parents 1dd4a3c + e74fa05 commit 9cf0cf2

4 files changed

Lines changed: 67 additions & 63 deletions

File tree

assets/js/embeddings/components/fieldsets/meta-inclusion.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@ import Group from '../layout/group';
1212
import { useVectorEmbeddingSettings } from '../../provider';
1313

1414
export default ({ postType, embeddingMode }) => {
15-
const { fieldsIndexingInclude, fieldsIndexingExclude, enablefieldsIndexing, key } = postType;
15+
const { fieldsIndexingInclude, fieldsIndexingExclude, enableFieldsIndexing, key } = postType;
1616
const { setEmbeddingForPostType } = useVectorEmbeddingSettings();
1717
return (
1818
<>
1919
<h4>{__('Post Meta', 'elasticpress-labs')}</h4>
2020
<CheckboxControl
2121
label={__('Post Meta Fields', 'elasticpress-labs')}
22-
checked={enablefieldsIndexing}
22+
checked={enableFieldsIndexing}
2323
onChange={() => {
2424
setEmbeddingForPostType(
2525
key,
2626
null,
27-
'enablefieldsIndexing',
28-
!enablefieldsIndexing,
27+
'enableFieldsIndexing',
28+
!enableFieldsIndexing,
2929
);
3030
}}
3131
/>
32-
{embeddingMode === 'automatic' && enablefieldsIndexing && (
32+
{embeddingMode === 'automatic' && enableFieldsIndexing && (
3333
<>
3434
<Group indent>
3535
<MetaSelect

assets/js/embeddings/components/fieldsets/taxonomy-inclusion.js

Lines changed: 59 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* External dependencies
33
* */
4-
import { CheckboxControl } from '@wordpress/components';
4+
import { CheckboxControl, __experimentalVStack as VStack } from '@wordpress/components';
55
import { __ } from '@wordpress/i18n';
66

77
/**
@@ -20,62 +20,64 @@ export default ({ taxonomies, postType }) => {
2020
<div>
2121
<h4>{__('Taxonomies', 'elasticpress-labs')}</h4>
2222
{hasTaxonomies > 0 ? (
23-
Object.keys(taxonomies).map((taxonomy) => {
24-
const { label, termsInclude, termsExclude, enabled } = taxonomies[taxonomy];
25-
return (
26-
<>
27-
<CheckboxControl
28-
label={label}
29-
checked={enabled}
30-
onChange={() => {
31-
setEmbeddingForPostType(key, taxonomy, 'enabled', !enabled);
32-
}}
33-
/>
34-
{enabled && (
35-
<>
36-
<Group indent>
37-
<TermSelect
38-
postType={postType}
39-
taxonomy={taxonomy}
40-
label={__(
41-
'Include posts that have any of these terms',
42-
'elasticpress-labs',
43-
)}
44-
value={termsInclude}
45-
onChange={(terms) =>
46-
setEmbeddingForPostType(
47-
key,
48-
taxonomy,
49-
'termsInclude',
50-
terms,
51-
)
52-
}
53-
/>
54-
</Group>
55-
<Group indent>
56-
<TermSelect
57-
postType={postType}
58-
taxonomy={taxonomy}
59-
label={__(
60-
'Exclude posts that have any of these terms',
61-
'elasticpress-labs',
62-
)}
63-
onChange={(terms) =>
64-
setEmbeddingForPostType(
65-
key,
66-
taxonomy,
67-
'termsExclude',
68-
terms,
69-
)
70-
}
71-
value={termsExclude}
72-
/>
73-
</Group>
74-
</>
75-
)}
76-
</>
77-
);
78-
})
23+
<VStack>
24+
{Object.keys(taxonomies).map((taxonomy) => {
25+
const { label, termsInclude, termsExclude, enabled } = taxonomies[taxonomy];
26+
return (
27+
<>
28+
<CheckboxControl
29+
label={label}
30+
checked={enabled}
31+
onChange={() => {
32+
setEmbeddingForPostType(key, taxonomy, 'enabled', !enabled);
33+
}}
34+
/>
35+
{enabled && (
36+
<>
37+
<Group indent>
38+
<TermSelect
39+
postType={postType}
40+
taxonomy={taxonomy}
41+
label={__(
42+
'Include posts that have any of these terms',
43+
'elasticpress-labs',
44+
)}
45+
value={termsInclude}
46+
onChange={(terms) =>
47+
setEmbeddingForPostType(
48+
key,
49+
taxonomy,
50+
'termsInclude',
51+
terms,
52+
)
53+
}
54+
/>
55+
</Group>
56+
<Group indent>
57+
<TermSelect
58+
postType={postType}
59+
taxonomy={taxonomy}
60+
label={__(
61+
'Exclude posts that have any of these terms',
62+
'elasticpress-labs',
63+
)}
64+
onChange={(terms) =>
65+
setEmbeddingForPostType(
66+
key,
67+
taxonomy,
68+
'termsExclude',
69+
terms,
70+
)
71+
}
72+
value={termsExclude}
73+
/>
74+
</Group>
75+
</>
76+
)}
77+
</>
78+
);
79+
})}
80+
</VStack>
7981
) : (
8082
<p>
8183
{__(

assets/js/embeddings/components/pages/indexing.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ export default () => {
2424
onChange={setChunkSize}
2525
min={1}
2626
max={300}
27+
__next40pxDefaultSize
2728
/>
2829
<RangeControl
2930
label={__('Chunk Overlap (in words)', 'elasticpress-labs')}
3031
value={chunkOverlap}
3132
onChange={setChunkOverlap}
3233
min={1}
3334
max={100}
35+
__next40pxDefaultSize
3436
/>
3537
</PanelBody>
3638
</Panel>

includes/classes/Feature/VectorEmbeddings/Settings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ function ( $taxonomy ) {
202202
$return[] = [
203203
'embeddable' => true, // whether to allow embeddings for this post type.
204204
'embeddingMode' => 'automatic', // Whether to use auto or manual embedding.
205-
'enablefieldsIndexing' => false, // Whether to flagging content inclusion via post meta.
205+
'enableFieldsIndexing' => false, // Whether to flagging content inclusion via post meta.
206206
'fieldsIndexingInclude' => [], // Meta fields used to flag content for inclusion.
207207
'fieldsIndexingExclude' => [], // Meta fields used to flag content for exclusion. A post with an exluded
208208
'fieldsEmbedding' => [ 'post_title', 'post_content' ], // Fields to use for embedding generation.

0 commit comments

Comments
 (0)