- {/* Service Info Form */}
-
-
-
-
- setServiceName(e.target.value)}
- placeholder="ör: DynamicCustomerAppService"
- className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
- />
-
-
-
- setDisplayName(e.target.value)}
- placeholder="ör: Müşteri Yönetimi"
- className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
- />
-
-
-
-
-
-
- setPrimaryEntityType(e.target.value)}
- placeholder="ör: Customer"
- className="w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
- />
-
-
-
-
- {/* Action Buttons */}
-
-
-
-
-
-
-
-
-
-
- {/* Results */}
- {(compileResult || publishResult) && (
-
- {/* Compile Result */}
- {compileResult && (
-
-
- {compileResult.success ? (
-
- ) : (
-
- )}
-
- Derleme {compileResult.success ? 'Başarılı' : 'Başarısız'}
-
-
- ({compileResult.compilationTimeMs}ms)
-
-
-
- {!compileResult.success &&
- compileResult.errors &&
- compileResult.errors.length > 0 && (
-
- {compileResult.errors.map((error, index) => (
-
-
-
{error.code}
-
-
{error.message}
-
- Satır {error.line}, Sütun {error.column}
-
-
-
-
- ))}
-
- )}
-
- {compileResult.hasWarnings && compileResult.warnings && (
-
-
Uyarılar:
-
- {compileResult.warnings.map((warning, index) => (
- -
- {warning}
-
- ))}
-
-
- )}
-
- )}
-
- {/* Publish Result */}
- {publishResult && (
-
-
- {publishResult.success ? (
-
- ) : (
-
- )}
-
- Yayınlama {publishResult.success ? 'Başarılı' : 'Başarısız'}
-
-
-
- {publishResult.success && (
-
- {publishResult.controllerName && (
-
- Controller:{' '}
-
- {publishResult.controllerName}
-
-
- )}
- {publishResult.generatedEndpoints &&
- publishResult.generatedEndpoints.length > 0 && (
-
-
- Oluşturulan Endpoint'ler:
-
-
- {publishResult.generatedEndpoints.map((endpoint, index) => (
- -
- {endpoint}
-
- ))}
-
-
- )}
-
- )}
-
- {!publishResult.success && publishResult.errorMessage && (
-
{publishResult.errorMessage}
- )}
-
- )}
-
+ {/* Compile / Publish result banners */}
+ {compileResult && (
+
+ {compileResult.success ? (
+
+ ) : (
+
)}
+
+
+ Derleme {compileResult.success ? 'Başarılı' : 'Başarısız'}
+
+ {!compileResult.success && compileResult.errors && compileResult.errors.length > 0 && (
+
+ {compileResult.errors.map((e, i) => (
+ -
+ [{e.code}] Satır {e.line}: {e.message}
+
+ ))}
+
+ )}
+
+
+ {compileResult.compilationTimeMs}ms
+
+
+ )}
+ {publishResult && !publishResult.success && (
+
+
+
+
Yayınlama Başarısız
+ {publishResult.errorMessage && (
+
{publishResult.errorMessage}
+ )}
+
+
+ )}
+
+ {/* Two-panel layout */}
+
+ {/* LEFT PANEL — Servis Ayarları */}
+
+ {/* Panel header */}
+
+
+
Servis Ayarları
+
+
+ {/* Servis Adı */}
+
+
+
{
+ setServiceName(e.target.value)
+ setSubmitted(false)
+ }}
+ placeholder="ör: DynamicCustomerAppService"
+ className={`w-full px-3 py-2 border rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-colors ${
+ serviceNameError ? 'border-red-500 bg-red-50' : 'border-slate-300'
+ }`}
+ />
+ {serviceNameError &&
Servis adı zorunludur
}
+
+
+ {/* Görünen Ad */}
+
+
+ setDisplayName(e.target.value)}
+ placeholder="ör: Müşteri Yönetimi"
+ className="w-full px-3 py-2 border border-slate-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
+ />
+
+
+ {/* Açıklama */}
+
+
+ setDescription(e.target.value)}
+ placeholder="Bu servisin kısa açıklaması"
+ className="w-full px-3 py-2 border border-slate-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
+ />
+
+
+ {/* Ana Entity Türü */}
+
+
+ setPrimaryEntityType(e.target.value)}
+ placeholder="ör: Customer"
+ className="w-full px-3 py-2 border border-slate-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"
+ />
+
+
+ {/* Aktif */}
+
+
+ setIsActive(e.target.checked)}
+ className="w-4 h-4 rounded accent-blue-600 cursor-pointer"
+ />
+
+
+
+ {/* RIGHT PANEL — Önizleme + Editor */}
+
{/* Monaco Editor */}
-
-
-
C# Code Editor
-
-
Lines: {code.split('\n').length}
-
|
-
Characters: {code.length}
+
+
+
+
+
C# Kod Editörü
+
+
+ Satır: {code.split('\n').length}
+ |
+ Karakter: {code.length}
-
+
{
+ const { translate } = useLocalization()
+ const [services, setServices] = useState([])
+ const [isLoading, setIsLoading] = useState(false)
+ const [searchTerm, setSearchTerm] = useState('')
+ const [filterStatus, setFilterStatus] = useState<'all' | 'Success' | 'Failed' | 'Pending'>('all')
+
+ useEffect(() => {
+ loadServices()
+ }, [])
+
+ const loadServices = async () => {
+ try {
+ setIsLoading(true)
+ const response = await dynamicServiceService.getList()
+ setServices(response.items || [])
+ } catch (error) {
+ console.error('Servisler yüklenirken hata:', error)
+ } finally {
+ setIsLoading(false)
+ }
+ }
+
+ const deleteService = async (serviceId: string) => {
+ if (!confirm('Bu servisi silmek istediğinizden emin misiniz?')) return
+ try {
+ await dynamicServiceService.delete(serviceId)
+ await loadServices()
+ } catch (error) {
+ console.error('Servis silinirken hata:', error)
+ alert('Servis silinirken hata oluştu')
+ }
+ }
+
+ const totalServices = services.length
+ const successServices = services.filter((s) => s.compilationStatus === 'Success').length
+ const failedServices = services.filter((s) => s.compilationStatus === 'Failed').length
+ const activeServices = services.filter((s) => s.isActive).length
+ const inactiveServices = services.filter((s) => !s.isActive).length
+
+ const stats = [
+ {
+ name: 'Toplam',
+ value: totalServices,
+ icon: FaCode,
+ color: 'text-purple-600',
+ bgColor: 'bg-purple-100',
+ },
+ {
+ name: 'Başarılı',
+ value: successServices,
+ icon: FaCheckCircle,
+ color: 'text-emerald-600',
+ bgColor: 'bg-emerald-100',
+ },
+ {
+ name: 'Başarısız',
+ value: failedServices,
+ icon: FaTimesCircle,
+ color: 'text-red-600',
+ bgColor: 'bg-red-100',
+ },
+ {
+ name: 'Aktif',
+ value: activeServices,
+ icon: FaArrowUp,
+ color: 'text-emerald-600',
+ bgColor: 'bg-blue-300',
+ },
+ {
+ name: 'Pasif',
+ value: inactiveServices,
+ icon: FaArrowDown,
+ color: 'text-emerald-600',
+ bgColor: 'bg-green-400',
+ },
+ ]
+
+ const filteredServices = services.filter((service) => {
+ const matchesSearch =
+ service.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
+ (service.displayName || '').toLowerCase().includes(searchTerm.toLowerCase())
+ const matchesFilter = filterStatus === 'all' || service.compilationStatus === filterStatus
+ return matchesSearch && matchesFilter
+ })
+
+ const statusBadge = (status: string) => {
+ if (status === 'Success') return 'bg-emerald-100 text-emerald-700'
+ if (status === 'Failed') return 'bg-red-100 text-red-700'
+ return 'bg-yellow-100 text-yellow-700'
+ }
+
+ const openSwagger = () => {
+ window.open(`${import.meta.env.VITE_API_URL}/swagger/index.html`, '_blank')
+ }
+
+ return (
+
+
+
+ {/* Stats */}
+
+ {stats.map((stat, index) => (
+
+
+
+
{stat.name}
+
{stat.value}
+
+
+
+
+
+
+ ))}
+
+
+ {/* Toolbar */}
+
+
+
+ setSearchTerm(e.target.value)}
+ className="w-full pl-10 pr-4 py-2 border border-slate-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"
+ />
+
+
+
+
+
+
+
+
+ Yeni Servis
+
+
+
+
+
+
+
+ {/* List */}
+ {isLoading ? (
+
+
+
+ ) : filteredServices.length > 0 ? (
+
+ {filteredServices.map((service) => (
+
+
+
+
+
+ {service.displayName && (
+
{service.displayName}
+ )}
+
+ {service.compilationStatus} · v{service.version}
+
+ {service.description && (
+
{service.description}
+ )}
+
+ {service.lastSuccessfulCompilation && (
+
+
+
+ {new Date(service.lastSuccessfulCompilation).toLocaleDateString()}
+
+
+ )}
+
+
+ {/* Actions */}
+
+
+
+
+
+
+
+
+ ))}
+
+ ) : (
+
+
+
+
+
+ {searchTerm || filterStatus !== 'all' ? 'Sonuç bulunamadı' : 'Henüz servis yok'}
+
+
+ {searchTerm || filterStatus !== 'all'
+ ? 'Filtre veya arama kriterlerini değiştirmeyi deneyin.'
+ : 'İlk dinamik servisinizi oluşturmak için başlayın.'}
+
+ {!searchTerm && filterStatus === 'all' && (
+
+
+ Yeni Servis Oluştur
+
+ )}
+
+ )}
+
+ )
+}
+
+export default DynamicServiceManager