|
|
@@ -1,19 +1,19 @@
|
|
|
import { ApiService } from '../../services/ApiService';
|
|
|
import { ToastService } from '../../services/ToastService';
|
|
|
import { Router } from '../../app/Router';
|
|
|
-import { ShopDetail, QdrantEmbedding, QdrantError } from '../../types';
|
|
|
+import { SiteDetail, QdrantEmbedding, QdrantError } from '../../types';
|
|
|
import { getIcon } from '../../utils/icons';
|
|
|
import { formatRelativeTime, getDomainFromUrl, getStatusBadgeClass, getContentTypeLabel } from '../../utils/helpers';
|
|
|
|
|
|
-export class ShopDetailPage {
|
|
|
+export class SiteDetailPage {
|
|
|
private element: HTMLElement | null = null;
|
|
|
- private shopDetail: ShopDetail | null = null;
|
|
|
+ private siteDetail: SiteDetail | null = null;
|
|
|
private eventsbound: boolean = false;
|
|
|
private qdrantEmbeddings: QdrantEmbedding[] = [];
|
|
|
private qdrantErrors: QdrantError[] = [];
|
|
|
|
|
|
constructor(
|
|
|
- private shopId: string,
|
|
|
+ private siteId: string,
|
|
|
private apiService: ApiService,
|
|
|
private toastService: ToastService,
|
|
|
private router: Router
|
|
|
@@ -27,28 +27,28 @@ export class ShopDetailPage {
|
|
|
<!-- Loading state -->
|
|
|
<div class="flex items-center justify-center py-12" id="loading">
|
|
|
<div class="w-8 h-8 spinner"></div>
|
|
|
- <span class="ml-3 text-gray-600 dark:text-gray-400">Loading shop details...</span>
|
|
|
+ <span class="ml-3 text-gray-600 dark:text-gray-400">Loading site details...</span>
|
|
|
</div>
|
|
|
`;
|
|
|
|
|
|
- this.loadShopDetail();
|
|
|
+ this.loadSiteDetail();
|
|
|
return this.element;
|
|
|
}
|
|
|
|
|
|
- private async loadShopDetail(): Promise<void> {
|
|
|
+ private async loadSiteDetail(): Promise<void> {
|
|
|
try {
|
|
|
- // Load shop details first (critical)
|
|
|
- console.log('[ShopDetailPage] Loading shop details for:', this.shopId);
|
|
|
- const shopResponse = await this.apiService.getShop(this.shopId);
|
|
|
- console.log('[ShopDetailPage] Shop response:', shopResponse);
|
|
|
+ // Load site details first (critical)
|
|
|
+ console.log('[SiteDetailPage] Loading site details for:', this.siteId);
|
|
|
+ const siteResponse = await this.apiService.getSite(this.siteId);
|
|
|
+ console.log('[SiteDetailPage] Site response:', siteResponse);
|
|
|
|
|
|
- if (shopResponse.success && shopResponse.data) {
|
|
|
- this.shopDetail = shopResponse.data;
|
|
|
+ if (siteResponse.success && siteResponse.data) {
|
|
|
+ this.siteDetail = siteResponse.data;
|
|
|
|
|
|
// Load Qdrant data in parallel (optional - these can fail without breaking the page)
|
|
|
const [embeddingsResponse, errorsResponse] = await Promise.allSettled([
|
|
|
- this.apiService.getShopQdrantEmbeddings(this.shopId),
|
|
|
- this.apiService.getShopQdrantErrors(this.shopId)
|
|
|
+ this.apiService.getSiteQdrantEmbeddings(this.siteId),
|
|
|
+ this.apiService.getSiteQdrantErrors(this.siteId)
|
|
|
]);
|
|
|
|
|
|
// Handle embeddings response (won't break if it fails)
|
|
|
@@ -57,7 +57,7 @@ export class ShopDetailPage {
|
|
|
const embeddingsData = (embeddingsResponse.value.data as any).data?.embeddings || [];
|
|
|
this.qdrantEmbeddings = embeddingsData;
|
|
|
} else if (embeddingsResponse.status === 'rejected') {
|
|
|
- console.warn('[ShopDetailPage] Embeddings failed:', embeddingsResponse.reason);
|
|
|
+ console.warn('[SiteDetailPage] Embeddings failed:', embeddingsResponse.reason);
|
|
|
}
|
|
|
|
|
|
// Handle errors response (won't break if it fails)
|
|
|
@@ -66,27 +66,27 @@ export class ShopDetailPage {
|
|
|
const errorsData = (errorsResponse.value.data as any).data?.errors || [];
|
|
|
this.qdrantErrors = errorsData;
|
|
|
} else if (errorsResponse.status === 'rejected') {
|
|
|
- console.warn('[ShopDetailPage] Errors fetch failed:', errorsResponse.reason);
|
|
|
+ console.warn('[SiteDetailPage] Errors fetch failed:', errorsResponse.reason);
|
|
|
}
|
|
|
|
|
|
- this.renderShopDetail();
|
|
|
+ this.renderSiteDetail();
|
|
|
} else {
|
|
|
- console.error('[ShopDetailPage] Shop API returned error:', shopResponse.error);
|
|
|
- this.toastService.error('Load Error', shopResponse.error || 'Failed to load shop details');
|
|
|
- this.router.navigate('/shops');
|
|
|
+ console.error('[SiteDetailPage] Site API returned error:', siteResponse.error);
|
|
|
+ this.toastService.error('Load Error', siteResponse.error || 'Failed to load site details');
|
|
|
+ this.router.navigate('/sites');
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- console.error('[ShopDetailPage] Exception loading shop details:', error);
|
|
|
- this.toastService.error('Error', 'Failed to load shop details');
|
|
|
- this.router.navigate('/shops');
|
|
|
+ console.error('[SiteDetailPage] Exception loading site details:', error);
|
|
|
+ this.toastService.error('Error', 'Failed to load site details');
|
|
|
+ this.router.navigate('/sites');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private renderShopDetail(): void {
|
|
|
- if (!this.shopDetail || !this.element) return;
|
|
|
+ private renderSiteDetail(): void {
|
|
|
+ if (!this.siteDetail || !this.element) return;
|
|
|
|
|
|
- const { shop, analytics, content_metadata, scrape_history } = this.shopDetail;
|
|
|
- const domain = getDomainFromUrl(shop.url);
|
|
|
+ const { site, analytics, content_metadata, scrape_history } = this.siteDetail;
|
|
|
+ const domain = getDomainFromUrl(site.url);
|
|
|
|
|
|
this.element.innerHTML = `
|
|
|
<!-- Header -->
|
|
|
@@ -95,11 +95,11 @@ export class ShopDetailPage {
|
|
|
<nav class="flex" aria-label="Breadcrumb">
|
|
|
<ol class="flex items-center space-x-4">
|
|
|
<li>
|
|
|
- <a href="/shops" class="text-gray-400 hover:text-gray-500" onclick="event.preventDefault(); window.dispatchEvent(new CustomEvent('navigate', {detail: '/shops'}))">
|
|
|
+ <a href="/sites" class="text-gray-400 hover:text-gray-500" onclick="event.preventDefault(); window.dispatchEvent(new CustomEvent('navigate', {detail: '/sites'}))">
|
|
|
<div class="w-5 h-5">
|
|
|
${getIcon('shops')}
|
|
|
</div>
|
|
|
- <span class="sr-only">Shops</span>
|
|
|
+ <span class="sr-only">Sites</span>
|
|
|
</a>
|
|
|
</li>
|
|
|
<li>
|
|
|
@@ -107,7 +107,7 @@ export class ShopDetailPage {
|
|
|
<svg class="flex-shrink-0 h-5 w-5 text-gray-300" fill="currentColor" viewBox="0 0 20 20">
|
|
|
<path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" />
|
|
|
</svg>
|
|
|
- <span class="ml-4 text-sm text-gray-500 dark:text-gray-400">Shop Details</span>
|
|
|
+ <span class="ml-4 text-sm text-gray-500 dark:text-gray-400">Site Details</span>
|
|
|
</div>
|
|
|
</li>
|
|
|
</ol>
|
|
|
@@ -116,7 +116,7 @@ export class ShopDetailPage {
|
|
|
${domain}
|
|
|
</h2>
|
|
|
<p class="mt-1 text-sm text-gray-500 dark:text-gray-400">
|
|
|
- ${shop.url}
|
|
|
+ ${site.url}
|
|
|
</p>
|
|
|
</div>
|
|
|
<div class="mt-4 flex md:mt-0 md:ml-4 space-x-3">
|
|
|
@@ -124,15 +124,15 @@ export class ShopDetailPage {
|
|
|
<div class="w-4 h-4 mr-2" id="scrape-icon">${getIcon('play')}</div>
|
|
|
<span id="scrape-text">Run Scrape</span>
|
|
|
</button>
|
|
|
- ${shop.qdrant_enabled && shop.custom_id ? `
|
|
|
+ ${site.qdrant_enabled && site.custom_id ? `
|
|
|
<button type="button" class="btn btn-primary" id="trigger-qdrant-sync">
|
|
|
<div class="w-4 h-4 mr-2" id="sync-icon">${getIcon('search')}</div>
|
|
|
<span id="sync-text">Sync to Qdrant</span>
|
|
|
</button>
|
|
|
` : ''}
|
|
|
- <button type="button" class="btn btn-danger" id="delete-shop">
|
|
|
+ <button type="button" class="btn btn-danger" id="delete-site">
|
|
|
<div class="w-4 h-4 mr-2">${getIcon('delete')}</div>
|
|
|
- Delete Shop
|
|
|
+ Delete Site
|
|
|
</button>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -169,11 +169,11 @@ export class ShopDetailPage {
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <!-- Shop Settings -->
|
|
|
+ <!-- Site Settings -->
|
|
|
<div class="card">
|
|
|
<div class="card-header">
|
|
|
- <h3 class="text-lg font-medium text-gray-900 dark:text-white">Shop Settings</h3>
|
|
|
- <p class="text-sm text-gray-500 dark:text-gray-400">Configure shop identifiers and metadata</p>
|
|
|
+ <h3 class="text-lg font-medium text-gray-900 dark:text-white">Site Settings</h3>
|
|
|
+ <p class="text-sm text-gray-500 dark:text-gray-400">Configure site identifiers and metadata</p>
|
|
|
</div>
|
|
|
<div class="card-body">
|
|
|
<div class="space-y-6">
|
|
|
@@ -185,7 +185,7 @@ export class ShopDetailPage {
|
|
|
<div class="flex items-center space-x-2">
|
|
|
<input
|
|
|
type="text"
|
|
|
- value="${shop.id}"
|
|
|
+ value="${site.id}"
|
|
|
readonly
|
|
|
class="flex-1 px-3 py-2 bg-gray-50 dark:bg-gray-700 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-500 dark:text-gray-400 cursor-not-allowed"
|
|
|
/>
|
|
|
@@ -212,7 +212,7 @@ export class ShopDetailPage {
|
|
|
<input
|
|
|
type="text"
|
|
|
id="custom-id-input"
|
|
|
- value="${shop.custom_id || ''}"
|
|
|
+ value="${site.custom_id || ''}"
|
|
|
placeholder="e.g., 550e8400-e29b-41d4-a716-446655440000"
|
|
|
class="flex-1 px-3 py-2 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg text-gray-900 dark:text-white focus:ring-2 focus:ring-blue-500 focus:border-transparent"
|
|
|
/>
|
|
|
@@ -224,7 +224,7 @@ export class ShopDetailPage {
|
|
|
<div class="w-4 h-4 mr-1">${getIcon('save')}</div>
|
|
|
Save
|
|
|
</button>
|
|
|
- ${shop.custom_id ? `
|
|
|
+ ${site.custom_id ? `
|
|
|
<button
|
|
|
type="button"
|
|
|
id="clear-custom-id"
|
|
|
@@ -238,7 +238,7 @@ export class ShopDetailPage {
|
|
|
<p class="mt-1 text-xs text-gray-500 dark:text-gray-400">
|
|
|
Optional UUID for custom identification. Must be a valid UUID format.
|
|
|
</p>
|
|
|
- ${shop.qdrant_enabled && shop.custom_id ? `
|
|
|
+ ${site.qdrant_enabled && site.custom_id ? `
|
|
|
<div class="mt-2 flex items-start space-x-2 text-xs text-yellow-600 dark:text-yellow-400">
|
|
|
<div class="w-4 h-4 flex-shrink-0">${getIcon('warning')}</div>
|
|
|
<span>
|
|
|
@@ -316,24 +316,24 @@ export class ShopDetailPage {
|
|
|
<div class="flex items-center justify-between">
|
|
|
<div>
|
|
|
<h3 class="text-lg font-medium text-gray-900 dark:text-white">Vector Search (Qdrant)</h3>
|
|
|
- <p class="text-sm text-gray-500 dark:text-gray-400">Enable semantic search for this shop's content</p>
|
|
|
+ <p class="text-sm text-gray-500 dark:text-gray-400">Enable semantic search for this site's content</p>
|
|
|
</div>
|
|
|
<div class="flex items-center space-x-3">
|
|
|
<label class="flex items-center cursor-pointer">
|
|
|
- <input type="checkbox" id="qdrant-toggle" class="sr-only" ${shop.qdrant_enabled ? 'checked' : ''}>
|
|
|
+ <input type="checkbox" id="qdrant-toggle" class="sr-only" ${site.qdrant_enabled ? 'checked' : ''}>
|
|
|
<div class="relative">
|
|
|
<div class="block bg-gray-600 w-14 h-8 rounded-full"></div>
|
|
|
- <div class="dot absolute left-1 top-1 bg-white w-6 h-6 rounded-full transition ${shop.qdrant_enabled ? 'transform translate-x-6 bg-blue-600' : ''}"></div>
|
|
|
+ <div class="dot absolute left-1 top-1 bg-white w-6 h-6 rounded-full transition ${site.qdrant_enabled ? 'transform translate-x-6 bg-blue-600' : ''}"></div>
|
|
|
</div>
|
|
|
<span class="ml-3 text-sm font-medium text-gray-900 dark:text-white">
|
|
|
- ${shop.qdrant_enabled ? 'Enabled' : 'Disabled'}
|
|
|
+ ${site.qdrant_enabled ? 'Enabled' : 'Disabled'}
|
|
|
</span>
|
|
|
</label>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="card-body">
|
|
|
- ${shop.qdrant_enabled ? `
|
|
|
+ ${site.qdrant_enabled ? `
|
|
|
<div class="space-y-6">
|
|
|
<!-- Embeddings Status -->
|
|
|
<div>
|
|
|
@@ -393,7 +393,7 @@ export class ShopDetailPage {
|
|
|
` : ''}
|
|
|
|
|
|
<!-- Custom ID Warning -->
|
|
|
- ${!shop.custom_id ? `
|
|
|
+ ${!site.custom_id ? `
|
|
|
<div class="bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg p-4">
|
|
|
<div class="flex">
|
|
|
<div class="flex-shrink-0">
|
|
|
@@ -402,7 +402,7 @@ export class ShopDetailPage {
|
|
|
<div class="ml-3">
|
|
|
<h4 class="text-sm font-medium text-yellow-800 dark:text-yellow-300">Custom ID Required</h4>
|
|
|
<p class="text-sm text-yellow-700 dark:text-yellow-400 mt-1">
|
|
|
- This shop needs a custom ID to use Qdrant features. The custom ID cannot be changed once set when Qdrant is enabled.
|
|
|
+ This site needs a custom ID to use Qdrant features. The custom ID cannot be changed once set when Qdrant is enabled.
|
|
|
</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -414,7 +414,7 @@ export class ShopDetailPage {
|
|
|
<div class="w-12 h-12 bg-gray-100 dark:bg-gray-700 rounded-lg flex items-center justify-center mx-auto mb-3">
|
|
|
<div class="w-6 h-6 text-gray-400">${getIcon('search')}</div>
|
|
|
</div>
|
|
|
- <p class="text-gray-500 dark:text-gray-400 mb-4">Vector search is disabled for this shop</p>
|
|
|
+ <p class="text-gray-500 dark:text-gray-400 mb-4">Vector search is disabled for this site</p>
|
|
|
<p class="text-sm text-gray-400 dark:text-gray-500">
|
|
|
Enable Qdrant to automatically create embeddings of scraped content for semantic search via MCP tools.
|
|
|
</p>
|
|
|
@@ -432,14 +432,14 @@ export class ShopDetailPage {
|
|
|
this.eventsbound = true;
|
|
|
|
|
|
// Navigation breadcrumb
|
|
|
- this.element.querySelector('a[href="/shops"]')?.addEventListener('click', (e) => {
|
|
|
+ this.element.querySelector('a[href="/sites"]')?.addEventListener('click', (e) => {
|
|
|
e.preventDefault();
|
|
|
- this.router.navigate('/shops');
|
|
|
+ this.router.navigate('/sites');
|
|
|
});
|
|
|
|
|
|
// Trigger scrape
|
|
|
this.element.querySelector('#trigger-scrape')?.addEventListener('click', async (e) => {
|
|
|
- if (!this.shopDetail) return;
|
|
|
+ if (!this.siteDetail) return;
|
|
|
|
|
|
const button = e.currentTarget as HTMLButtonElement;
|
|
|
const icon = this.element?.querySelector('#scrape-icon');
|
|
|
@@ -454,7 +454,7 @@ export class ShopDetailPage {
|
|
|
if (text) text.textContent = 'Starting...';
|
|
|
|
|
|
try {
|
|
|
- const response = await this.apiService.createJob(this.shopDetail.shop.url);
|
|
|
+ const response = await this.apiService.createJob(this.siteDetail.site.url);
|
|
|
|
|
|
if (response.success) {
|
|
|
this.toastService.success('Scrape Started', 'A new scraping job has been queued');
|
|
|
@@ -473,7 +473,7 @@ export class ShopDetailPage {
|
|
|
|
|
|
// Trigger Qdrant sync
|
|
|
this.element.querySelector('#trigger-qdrant-sync')?.addEventListener('click', async (e) => {
|
|
|
- if (!this.shopDetail) return;
|
|
|
+ if (!this.siteDetail) return;
|
|
|
|
|
|
const button = e.currentTarget as HTMLButtonElement;
|
|
|
const icon = this.element?.querySelector('#sync-icon');
|
|
|
@@ -488,7 +488,7 @@ export class ShopDetailPage {
|
|
|
if (text) text.textContent = 'Syncing...';
|
|
|
|
|
|
try {
|
|
|
- const response = await this.apiService.forceQdrantSync(this.shopId);
|
|
|
+ const response = await this.apiService.forceQdrantSync(this.siteId);
|
|
|
|
|
|
if (response.success && response.data) {
|
|
|
this.toastService.success(
|
|
|
@@ -496,7 +496,7 @@ export class ShopDetailPage {
|
|
|
`Syncing ${response.data.items_queued} items to Qdrant`
|
|
|
);
|
|
|
// Reload the page after a short delay to show updated status
|
|
|
- setTimeout(() => this.loadShopDetail(), 2000);
|
|
|
+ setTimeout(() => this.loadSiteDetail(), 2000);
|
|
|
} else {
|
|
|
this.toastService.error('Sync Failed', response.error || 'Failed to start Qdrant sync');
|
|
|
}
|
|
|
@@ -510,22 +510,22 @@ export class ShopDetailPage {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- // Delete shop
|
|
|
- this.element.querySelector('#delete-shop')?.addEventListener('click', async () => {
|
|
|
- const confirmed = confirm('Are you sure you want to delete this shop? This will remove all associated data and cannot be undone.');
|
|
|
+ // Delete site
|
|
|
+ this.element.querySelector('#delete-site')?.addEventListener('click', async () => {
|
|
|
+ const confirmed = confirm('Are you sure you want to delete this site? This will remove all associated data and cannot be undone.');
|
|
|
|
|
|
if (confirmed) {
|
|
|
try {
|
|
|
- const response = await this.apiService.deleteShop(this.shopId);
|
|
|
+ const response = await this.apiService.deleteSite(this.siteId);
|
|
|
|
|
|
if (response.success) {
|
|
|
- this.toastService.success('Shop Deleted', 'Shop and all data have been removed');
|
|
|
- this.router.navigate('/shops');
|
|
|
+ this.toastService.success('Site Deleted', 'Site and all data have been removed');
|
|
|
+ this.router.navigate('/sites');
|
|
|
} else {
|
|
|
- this.toastService.error('Delete Failed', response.error || 'Failed to delete shop');
|
|
|
+ this.toastService.error('Delete Failed', response.error || 'Failed to delete site');
|
|
|
}
|
|
|
} catch (error) {
|
|
|
- this.toastService.error('Error', 'Failed to delete shop');
|
|
|
+ this.toastService.error('Error', 'Failed to delete site');
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -536,15 +536,15 @@ export class ShopDetailPage {
|
|
|
const enabled = checkbox.checked;
|
|
|
|
|
|
try {
|
|
|
- const response = await this.apiService.updateShopQdrant(this.shopId, enabled);
|
|
|
+ const response = await this.apiService.updateSiteQdrant(this.siteId, enabled);
|
|
|
|
|
|
if (response.success) {
|
|
|
this.toastService.success(
|
|
|
'Qdrant Updated',
|
|
|
- `Vector search has been ${enabled ? 'enabled' : 'disabled'} for this shop`
|
|
|
+ `Vector search has been ${enabled ? 'enabled' : 'disabled'} for this site`
|
|
|
);
|
|
|
// Reload the page to show updated status
|
|
|
- await this.loadShopDetail();
|
|
|
+ await this.loadSiteDetail();
|
|
|
} else {
|
|
|
// Revert checkbox state on error
|
|
|
checkbox.checked = !enabled;
|
|
|
@@ -560,13 +560,13 @@ export class ShopDetailPage {
|
|
|
// Clear Qdrant errors
|
|
|
this.element.querySelector('#clear-qdrant-errors')?.addEventListener('click', async () => {
|
|
|
try {
|
|
|
- const response = await this.apiService.clearShopQdrantErrors(this.shopId);
|
|
|
+ const response = await this.apiService.clearSiteQdrantErrors(this.siteId);
|
|
|
|
|
|
if (response.success) {
|
|
|
this.toastService.success('Errors Cleared', 'Qdrant errors have been cleared');
|
|
|
// Clear errors from local state and re-render
|
|
|
this.qdrantErrors = [];
|
|
|
- this.renderShopDetail();
|
|
|
+ this.renderSiteDetail();
|
|
|
} else {
|
|
|
this.toastService.error('Clear Failed', response.error || 'Failed to clear Qdrant errors');
|
|
|
}
|
|
|
@@ -577,10 +577,10 @@ export class ShopDetailPage {
|
|
|
|
|
|
// Copy internal ID to clipboard
|
|
|
this.element.querySelector('#copy-internal-id')?.addEventListener('click', async () => {
|
|
|
- if (!this.shopDetail) return;
|
|
|
+ if (!this.siteDetail) return;
|
|
|
|
|
|
try {
|
|
|
- await navigator.clipboard.writeText(this.shopDetail.shop.id);
|
|
|
+ await navigator.clipboard.writeText(this.siteDetail.site.id);
|
|
|
this.toastService.success('Copied', 'Internal ID copied to clipboard');
|
|
|
} catch (error) {
|
|
|
this.toastService.error('Copy Failed', 'Failed to copy to clipboard');
|
|
|
@@ -589,7 +589,7 @@ export class ShopDetailPage {
|
|
|
|
|
|
// Save custom ID
|
|
|
this.element.querySelector('#save-custom-id')?.addEventListener('click', async () => {
|
|
|
- if (!this.shopDetail) return;
|
|
|
+ if (!this.siteDetail) return;
|
|
|
|
|
|
const input = this.element?.querySelector('#custom-id-input') as HTMLInputElement;
|
|
|
if (!input) return;
|
|
|
@@ -604,7 +604,7 @@ export class ShopDetailPage {
|
|
|
}
|
|
|
|
|
|
// Warn if changing custom ID while Qdrant is enabled
|
|
|
- if (this.shopDetail.shop.qdrant_enabled && this.shopDetail.shop.custom_id && newCustomId !== this.shopDetail.shop.custom_id) {
|
|
|
+ if (this.siteDetail.site.qdrant_enabled && this.siteDetail.site.custom_id && newCustomId !== this.siteDetail.site.custom_id) {
|
|
|
const confirmed = confirm(
|
|
|
'Warning: Changing the custom ID while Qdrant is enabled may cause issues with existing collections. ' +
|
|
|
'It is recommended to disable Qdrant first. Do you want to continue?'
|
|
|
@@ -613,8 +613,8 @@ export class ShopDetailPage {
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
- const response = await this.apiService.updateShopCustomId(
|
|
|
- this.shopId,
|
|
|
+ const response = await this.apiService.updateSiteCustomId(
|
|
|
+ this.siteId,
|
|
|
newCustomId || null
|
|
|
);
|
|
|
|
|
|
@@ -624,7 +624,7 @@ export class ShopDetailPage {
|
|
|
newCustomId ? `Custom ID set to ${newCustomId}` : 'Custom ID removed'
|
|
|
);
|
|
|
// Reload the page to show updated data
|
|
|
- await this.loadShopDetail();
|
|
|
+ await this.loadSiteDetail();
|
|
|
} else {
|
|
|
this.toastService.error('Update Failed', response.error || 'Failed to update custom ID');
|
|
|
}
|
|
|
@@ -635,10 +635,10 @@ export class ShopDetailPage {
|
|
|
|
|
|
// Clear custom ID
|
|
|
this.element.querySelector('#clear-custom-id')?.addEventListener('click', async () => {
|
|
|
- if (!this.shopDetail) return;
|
|
|
+ if (!this.siteDetail) return;
|
|
|
|
|
|
// Warn if clearing custom ID while Qdrant is enabled
|
|
|
- if (this.shopDetail.shop.qdrant_enabled) {
|
|
|
+ if (this.siteDetail.site.qdrant_enabled) {
|
|
|
const confirmed = confirm(
|
|
|
'Warning: Removing the custom ID while Qdrant is enabled may cause issues with existing collections. ' +
|
|
|
'It is recommended to disable Qdrant first. Do you want to continue?'
|
|
|
@@ -650,12 +650,12 @@ export class ShopDetailPage {
|
|
|
if (!confirmClear) return;
|
|
|
|
|
|
try {
|
|
|
- const response = await this.apiService.updateShopCustomId(this.shopId, null);
|
|
|
+ const response = await this.apiService.updateSiteCustomId(this.siteId, null);
|
|
|
|
|
|
if (response.success) {
|
|
|
this.toastService.success('Custom ID Cleared', 'Custom ID has been removed');
|
|
|
// Reload the page to show updated data
|
|
|
- await this.loadShopDetail();
|
|
|
+ await this.loadSiteDetail();
|
|
|
} else {
|
|
|
this.toastService.error('Clear Failed', response.error || 'Failed to clear custom ID');
|
|
|
}
|