EccClientElixirCloudRegistryServiceCreate Component
Overview
The ecc-client-elixir-cloud-registry-service-create
component provides a comprehensive form interface for creating new service registrations in the Elixir Cloud Registry. It includes validation, error handling, and support for both basic and advanced service metadata.
This component extends the GA4GH Service Registry specification with additional features specific to the Elixir Cloud ecosystem.
Usage
Basic Service Creation
This example demonstrates the basic service creation form with default settings.
Properties
Property | Type | Default | Description |
---|---|---|---|
provider | CloudRegistryProvider | null | Data provider for service creation operations (see Providers) |
provider
The data provider responsible for creating services in the registry. You must provide a provider that implements the CloudRegistryProvider
interface, which extends the base ServiceRegistryProvider
with creation capabilities. See the Providers documentation for detailed information about available providers and how to create custom ones.
The provider must support service creation operations. If no provider is provided, the component will emit a validation error.
import { RestCloudRegistryProvider } from '@elixir-cloud/cloud-registry/providers';
const provider = new RestCloudRegistryProvider('https://cloud-registry.example.com/ga4gh/registry/v1');
<EccClientElixirCloudRegistryServiceCreate provider={provider} />
Events
Event Name | React Event Name | Detail Type | Description |
---|---|---|---|
ecc-service-created | onEccServiceCreated | { serviceId: string, serviceData: object, message: string } | Fired when a service is successfully created |
ecc-service-create-failed | onEccServiceCreateFailed | { error: string } | Fired when service creation fails |
ecc-service-create-validation-failed | onEccServiceCreateValidationFailed | { error: string } | Fired when there are validation errors |
ecc-service-created
Emitted when a service is successfully created in the registry, providing the new service ID, the submitted service data, and a success message.
<EccClientElixirCloudRegistryServiceCreate
onEccServiceCreated={(event) => {
console.log('Service created:', event.detail.serviceId);
console.log('Service data:', event.detail.serviceData);
console.log('Message:', event.detail.message);
// Navigate to the new service or show success message
}}
/>
ecc-service-create-failed
Emitted when service creation fails due to server errors, network issues, or other runtime problems.
<EccClientElixirCloudRegistryServiceCreate
onEccServiceCreateFailed={(event) => {
console.error('Service creation failed:', event.detail.error);
// Display error message to user
alert(`Failed to create service: ${event.detail.error}`);
}}
/>
ecc-service-create-validation-failed
Emitted when there are validation errors in the form data before submission or when the component is misconfigured.
<EccClientElixirCloudRegistryServiceCreate
onEccServiceCreateValidationFailed={(event) => {
console.error('Validation error:', event.detail.error);
// Handle validation errors appropriately
alert(`Please fix the following error: ${event.detail.error}`);
}}
/>