- Updated AutomationService to include estimated_word_count. - Increased stage_1_batch_size from 20 to 50 in AutomationViewSet. - Changed Keywords model to replace 'intent' property with 'country'. - Adjusted ClusteringService to allow a maximum of 50 keywords for clustering. - Modified admin and management commands to remove 'intent' and use 'country' instead. - Updated serializers to reflect the change from 'intent' to 'country'. - Adjusted views and filters to use 'country' instead of 'intent'. - Updated frontend forms, filters, and pages to replace 'intent' with 'country'. - Added migration to remove 'intent' field and add 'country' field to SeedKeyword model.
99 lines
2.2 KiB
TypeScript
99 lines
2.2 KiB
TypeScript
/**
|
|
* Keyword Form Configuration
|
|
* Field definitions for Add/Edit Keyword modal
|
|
*/
|
|
|
|
import { FormField } from '../../components/common/FormModal';
|
|
|
|
export interface KeywordFormConfig {
|
|
fields: FormField[];
|
|
}
|
|
|
|
/**
|
|
* Get keyword form fields configuration
|
|
* Can be customized with dynamic options (e.g., clusters)
|
|
*/
|
|
export const getKeywordFormConfig = (options?: {
|
|
clusters?: Array<{ id: number; name: string }>;
|
|
}): FormField[] => {
|
|
const clusterOptions = options?.clusters
|
|
? [
|
|
{ value: '', label: 'No Cluster' },
|
|
...options.clusters.map((c) => ({
|
|
value: c.id.toString(),
|
|
label: c.name,
|
|
})),
|
|
]
|
|
: [{ value: '', label: 'No Cluster' }];
|
|
|
|
return [
|
|
{
|
|
key: 'keyword',
|
|
label: 'Keyword',
|
|
type: 'text',
|
|
placeholder: 'Enter keyword',
|
|
value: '',
|
|
onChange: () => {},
|
|
required: true,
|
|
},
|
|
{
|
|
key: 'volume',
|
|
label: 'Volume',
|
|
type: 'number',
|
|
value: 0,
|
|
onChange: () => {},
|
|
required: false,
|
|
},
|
|
{
|
|
key: 'difficulty',
|
|
label: 'Difficulty',
|
|
type: 'number',
|
|
value: 0,
|
|
onChange: () => {},
|
|
min: 1,
|
|
max: 5,
|
|
required: false,
|
|
},
|
|
{
|
|
key: 'country',
|
|
label: 'Country',
|
|
type: 'select',
|
|
value: 'US',
|
|
onChange: () => {},
|
|
options: [
|
|
{ value: 'US', label: 'United States' },
|
|
{ value: 'CA', label: 'Canada' },
|
|
{ value: 'GB', label: 'United Kingdom' },
|
|
{ value: 'AE', label: 'United Arab Emirates' },
|
|
{ value: 'AU', label: 'Australia' },
|
|
{ value: 'IN', label: 'India' },
|
|
{ value: 'PK', label: 'Pakistan' },
|
|
],
|
|
required: false,
|
|
},
|
|
{
|
|
key: 'cluster_id',
|
|
label: 'Cluster',
|
|
type: 'select',
|
|
value: '',
|
|
onChange: () => {},
|
|
options: clusterOptions,
|
|
required: false,
|
|
},
|
|
{
|
|
key: 'status',
|
|
label: 'Status',
|
|
type: 'select',
|
|
value: 'pending',
|
|
onChange: () => {},
|
|
options: [
|
|
{ value: 'pending', label: 'Pending' },
|
|
{ value: 'active', label: 'Active' },
|
|
{ value: 'archived', label: 'Archived' },
|
|
],
|
|
required: false,
|
|
},
|
|
];
|
|
};
|
|
|