Skip to content

Commit

Permalink
feat: suppr service WMS-raster/WMTS #470
Browse files Browse the repository at this point in the history
  • Loading branch information
ocruze committed Oct 23, 2024
1 parent da40e6f commit 73214db
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const ServicesListItem: FC<ServicesListItemProps> = ({ service, datasheetName, d

const unpublishServiceMutation = useMutation({
mutationFn: (service: Service) => {
if (![OfferingTypeEnum.WFS, OfferingTypeEnum.WMSVECTOR, OfferingTypeEnum.WMTSTMS].includes(service.type)) {
if (![OfferingTypeEnum.WFS, OfferingTypeEnum.WMSVECTOR, OfferingTypeEnum.WMSRASTER, OfferingTypeEnum.WMTSTMS].includes(service.type)) {
console.warn(`Dépublication de service ${service.type} n'a pas encore été implémentée`);
return Promise.reject(`Dépublication de service ${service.type} n'a pas encore été implémentée`);
}
Expand Down
27 changes: 25 additions & 2 deletions src/Services/EntrepotApi/CartesServiceApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,13 @@ public function unpublish(string $datastoreId, string $offeringId): void
$this->wfsUnpublish($datastoreId, $offering);
break;
case OfferingTypes::WMTSTMS:
$this->tmsUnpublish($datastoreId, $offering);
$this->wmtsTmsUnpublish($datastoreId, $offering);
break;
case OfferingTypes::WMSVECTOR:
$this->wmsVectorUnpublish($datastoreId, $offering);
break;
case OfferingTypes::WMSRASTER:
$this->wmsRasterUnpublish($datastoreId, $offering);
}
}

Expand Down Expand Up @@ -208,7 +210,28 @@ public function wmsVectorUnpublish(string $datastoreId, array $offering, bool $r
/**
* @param array<mixed> $offering
*/
public function tmsUnpublish(string $datastoreId, array $offering, bool $removeStyleFiles = true): void
public function wmsRasterUnpublish(string $datastoreId, array $offering): void
{
// suppression de l'offering
$this->configurationApiService->removeOffering($datastoreId, $offering['_id']);
$configurationId = $offering['configuration']['_id'];

// suppression de la configuration
// la suppression de l'offering nécessite quelques instants, et tant que la suppression de l'offering n'est pas faite, on ne peut pas demander la suppression de la configuration
while (1) {
sleep(3);
$configuration = $this->configurationApiService->get($datastoreId, $configurationId);
if (ConfigurationStatuses::UNPUBLISHED === $configuration['status']) {
break;
}
}
$this->configurationApiService->remove($datastoreId, $configurationId);
}

/**
* @param array<mixed> $offering
*/
public function wmtsTmsUnpublish(string $datastoreId, array $offering, bool $removeStyleFiles = true): void
{
// suppression de l'offering
$this->configurationApiService->removeOffering($datastoreId, $offering['_id']);
Expand Down

0 comments on commit 73214db

Please sign in to comment.