Documentation
Cloud Registry
Components
Services

EccClientElixirCloudRegistryServices Component

2.0.0-alpha.52
<ecc-client-elixir-cloud-registry-services/>
EccClientElixirCloudRegistryServices

Overview

The ecc-client-elixir-cloud-registry-services component lists the services of a Cloud Registry and shows a "Verified" badge for the verified ones, next to their version. It is the services list of the GA4GH Service Registry package (search, filters, pages, row actions) with a service verification badge in each row, through the list's rowBadges hook, and, for admins, the service verification component's "Verify" or "Remove verification" button in the actions column.

It loads all verifications with one request (GET /verifications, Cloud Registry 0.4.0 and later), not one per row. A verification only counts while the service still has the verified URL and API type (see Verifications). Rows show the badge once the verifications are loaded; if loading fails, the list shows no badges and fires ecc-service-verification-failed. If a later reload fails, the list keeps the verifications it loaded last and fires the event.

Usage

services.tsx
import React, { useMemo } from 'react';
import { EccClientElixirCloudRegistryServices } from '@elixir-cloud/cloud-registry/react/services';
import { RestCloudRegistryProvider } from '@elixir-cloud/cloud-registry/providers';
 
export default function Services({ me }) {
  // created once: a new provider makes the list load again
  const provider = useMemo(
    () => new RestCloudRegistryProvider('https://cloud-registry.example.com/ga4gh/registry/v1'),
    []
  );
 
  return (
    <EccClientElixirCloudRegistryServices
      provider={provider}
      admin={me.admin}
      onEccServiceSelected={(event) => console.log(event.detail.serviceId)}
    />
  );
}

Properties

PropertyTypeDefaultDescription
baseUrlstring""Base URL of the Cloud Registry API, if no provider is set
providerCloudRegistryProviderundefinedData provider (see Providers); takes precedence over baseUrl
adminbooleanfalseWhether to offer "Verify" and "Remove verification" in each row
filterbooleantrueWhether to show the type, organization and environment filters
searchbooleantrueWhether to show the search field
pageSizenumber10Services per page (attribute page-size); 0 or less shows all services on one page, an empty attribute 10
rowActions(service: ExternalService) => unknownundefinedRenders the actions of each row after "Verify" or "Remove verification"; without it, each row has a "View Details" button
rowBadges(service: ExternalService) => unknownundefinedRenders more badges of each row after the "Verified" badge, next to the version

provider and baseUrl

Replacing the provider (or changing baseUrl) renders a new list, which loads the services and the verifications again. The list ignores the results of a verify or remove that was still running then, so its badge may show the state before that change until the next load. In React, create the provider only when its inputs change, e.g. with useMemo. Custom providers implement the optional getVerifications() of CloudRegistryProvider; without it, the list shows no badges and fires ecc-service-verification-failed.

admin

Apps take the value from admin of the registry's GET /me. Admins see a "Not verified" badge for unverified services, and "Verify" or "Remove verification" in the actions column. The list follows their changes without loading the verifications again, also for rows that are no longer shown by then (e.g. on another page). It loads the verifications again after a failed verify or remove whose outcome is unclear (no status, e.g. a lost connection, or a server error) or that conflicts (409), as the service verification component does; other failures (e.g. 400 or 403) changed nothing, and nor did a provider without verifyService() or deleteServiceVerification(). Only the answer of the latest load counts, and a load that was running when an admin's change arrived is replaced by a new one, so an older answer can't bring back a removed verification. The registry checks permissions itself.

filter, search and pageSize

As in the services list of the GA4GH Service Registry package, which this component passes them to.

rowActions

As in the services list: a function that renders the actions of a row from its service, e.g. Edit and Delete buttons. They follow "Verify" or "Remove verification". Setting it replaces the "View Details" button. Set a new function when what it renders changes.

rowBadges

As in the services list: a function that renders badges of a row from its service, next to its version. They follow the "Verified" badge. Set a new function when what it renders changes.

The actions-<id> slots of the services list aren't available through this component; use rowActions and rowBadges instead.

Events

Event NameReact Event NameDetail TypeDescription
ecc-services-changedonEccServicesChanged{ services: ExternalService[] }Fired when the services are loaded
ecc-service-selectedonEccServiceSelected{ serviceId: string }Fired when a service, its row or its "View Details" button is clicked
ecc-service-verification-changedonEccServiceVerificationChanged{ serviceId: string, verification: Verification | null }Fired when an admin verified a service or removed its verification
ecc-service-verification-failedonEccServiceVerificationFailed{ serviceId: string, action: "load" | "verify" | "remove", error: string, status?: number, ... }Fired when loading the verifications, or verifying a service or removing its verification, fails

ecc-service-verification-failed

When loading the verifications of the list fails, serviceId is empty and action is load; status is the HTTP status if there is one, and cause the error that the provider threw. Failures of a row's verify or remove carry the row's service ID, as described for the service verification component.

CSS parts

PartDescription
listThe services list (ecc-client-ga4gh-service-registry-services)

Released under Apache 2.0 License.

Copyright © 2023-2026 ELIXIR