Commit 2e4c1472 authored by Labros Papadopoulos's avatar Labros Papadopoulos
Browse files

fix: Active clusters to be shown only in clusters tables and be terminated...

fix: Active clusters to be shown only in clusters tables and be terminated when user presses delete cluster
parent def66f04
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -9,13 +9,12 @@ stages:
variables:
  DOCKER_HOST: unix:///var/run/docker.sock
  DOCKER_DRIVER: overlay2
  TESTCONTAINERS_HOST_OVERRIDE: "localhost"
  TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE: "/var/run/docker.sock"
  TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX: "labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/"
  TESTCONTAINERS_HOST_OVERRIDE: 'localhost'
  TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE: '/var/run/docker.sock'
  TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX: 'labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/'
  TESTCONTAINERS_CHECKS_DISABLE: 'true'
  IMAGE_NAME: 'hypo-portal'


dev_image_build_job:
  stage: dev_image_build
  tags:
@@ -23,7 +22,7 @@ dev_image_build_job:
  image:
    name: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/docker:29.1.3
  variables:
    BUILT_IMAGE: "$CI_REGISTRY/$CI_PROJECT_PATH/$IMAGE_NAME:$CI_COMMIT_SHORT_SHA"
    BUILT_IMAGE: '$CI_REGISTRY/$CI_PROJECT_PATH/$IMAGE_NAME:$CI_COMMIT_SHORT_SHA'
  before_script:
    - docker info > /dev/null
    - apk add --no-cache curl
@@ -101,7 +100,7 @@ develop_image_tag_job:
  image:
    name: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/docker:29.1.3
  variables:
    DEVELOP_IMAGE: "$CI_REGISTRY/$CI_PROJECT_PATH/$IMAGE_NAME:dev-latest"
    DEVELOP_IMAGE: '$CI_REGISTRY/$CI_PROJECT_PATH/$IMAGE_NAME:dev-latest'
  before_script:
    - docker info > /dev/null
  script:
@@ -115,7 +114,6 @@ develop_image_tag_job:
  only:
    - develop


validate_main_source_job:
  stage: validate_main_source
  tags:
@@ -132,7 +130,6 @@ validate_main_source_job:
        $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"'
    - when: never


semantic_versioning_job:
  image: labs.etsi.org:5050/osl/hypo/code/org.etsi.osl.hypo.ops/cicd/integration.tests/node:lts
  tags:
+9 −10
Original line number Diff line number Diff line
# 1.0.0 (2026-06-29)


### Bug Fixes

* add debug for build command ([78352b6](https://labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.portal/web/commit/78352b67993d1d1efb2952c101655cc384c1b8e9))
* disable lint test ([4f542dc](https://labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.portal/web/commit/4f542dc3ea1fd3523c80760159ab169edfa6d9ea))
* Edit .gitlab-ci.yml ([7d60bb4](https://labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.portal/web/commit/7d60bb4fea629e04bcf0716797671e29ad786008))
* export syntax ([b401ce5](https://labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.portal/web/commit/b401ce586a83f4ec2a40c8fbcfc15fe63f84306a))
* new build command ([d3d5120](https://labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.portal/web/commit/d3d5120a426fbf7a865b05836b65a0c99e089509))
* new remove roboto test ([a1e4058](https://labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.portal/web/commit/a1e40582a04c39f78cd5da9f771f8ae0a3107359))
* remove old roboto issue ([edbf32a](https://labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.portal/web/commit/edbf32a2a3d365f238690c714b406b9aa130ea92))
* test build flags ([ac5992f](https://labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.portal/web/commit/ac5992fdf60ce2edfe43565e8a4b5c118d4b7860))
* test remove roboto ([0e7ab93](https://labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.portal/web/commit/0e7ab9342414205b7b7b136cb5f819ffc745eca7))
- add debug for build command ([78352b6](https://labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.portal/web/commit/78352b67993d1d1efb2952c101655cc384c1b8e9))
- disable lint test ([4f542dc](https://labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.portal/web/commit/4f542dc3ea1fd3523c80760159ab169edfa6d9ea))
- Edit .gitlab-ci.yml ([7d60bb4](https://labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.portal/web/commit/7d60bb4fea629e04bcf0716797671e29ad786008))
- export syntax ([b401ce5](https://labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.portal/web/commit/b401ce586a83f4ec2a40c8fbcfc15fe63f84306a))
- new build command ([d3d5120](https://labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.portal/web/commit/d3d5120a426fbf7a865b05836b65a0c99e089509))
- new remove roboto test ([a1e4058](https://labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.portal/web/commit/a1e40582a04c39f78cd5da9f771f8ae0a3107359))
- remove old roboto issue ([edbf32a](https://labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.portal/web/commit/edbf32a2a3d365f238690c714b406b9aa130ea92))
- test build flags ([ac5992f](https://labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.portal/web/commit/ac5992fdf60ce2edfe43565e8a4b5c118d4b7860))
- test remove roboto ([0e7ab93](https://labs.etsi.org/rep/osl/hypo/code/org.etsi.osl.hypo.portal/web/commit/0e7ab9342414205b7b7b136cb5f819ffc745eca7))
+36 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
import { auth } from '@/auth';
import { Session } from 'next-auth';
import { ServiceInventoryManagement } from '@/services/tmf';
import { Api as ApiTmf638, Error as ErrorTmf638, Service, ServiceUpdate } from '@/services/tmf638';

export async function getListService({
  fields,
@@ -67,6 +68,41 @@ export async function getKubernetesServices() {
  return api.listService(query);
}

export async function getService(id: string): Promise<{ data?: Service; error?: ErrorTmf638 }> {
  const session: Session | null = await auth();
  const api = new ServiceInventoryManagement(session);
  try {
    const response = await api.retrieveService(id);
    return { data: response.data, error: response.error };
  } catch (error) {
    return {
      error: {
        code: 'UNKNOWN_ERROR',
        reason: error instanceof Error ? error.message : String(error),
      },
    };
  }
}

export async function serviceEdit(
  serviceId: string,
  service: Partial<ServiceUpdate>,
): Promise<{ data?: Service; error?: ErrorTmf638 }> {
  const session: Session | null = await auth();
  const api = new ServiceInventoryManagement(session);
  try {
    const response = await api.patchService(serviceId, service);
    return { data: response.data, error: response.error };
  } catch (error) {
    return {
      error: {
        code: 'UNKNOWN_ERROR',
        reason: error instanceof Error ? error.message : String(error),
      },
    };
  }
}

// export async function getListService({ orderDateFrom, orderDateTo, offset, limit }: { orderDateFrom: string | undefined; orderDateTo: string | undefined; offset: number; limit: number; }) {
//   const session: Session | null = await auth();
//   const api = new ServiceOrderingManagement(session);
+29 −0
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@ import React, { useState } from 'react';
import { Button } from '@nextui-org/react';
import PlatformDeleteModal from './platform-delete-modal';
import PlatformClustersAddModal from './platform-clusters-add-modal';
import { getService, serviceEdit } from '@/actions/services';
import { ServiceStateType, ServiceUpdate } from '@/services/tmf638';

type ClusterItem = {
  id?: string;
@@ -42,6 +44,33 @@ const PlatformClustersButtons: React.FC<PlatformClustersButtonsProps> = ({
          onDeselect();
        }}
        ossId={selectedCluster?.id || null}
        onDelete={async (ossId) => {
          try {
            if (!ossId) throw new Error('No OSS id provided');
            const currentService = await getService(ossId);
            if (!currentService.data) {
              throw new Error(currentService.error?.reason ?? 'Service not found');
            }
            if (!currentService.data.id) {
              throw new Error('Service has no id');
            }
            const serviceUpdate: Partial<ServiceUpdate> = {
              ...currentService,
              state: 'TERMINATED' as ServiceStateType,
            };
            await serviceEdit(currentService.data.id, serviceUpdate);
          } catch (err) {
            // surface error for now and keep UI responsive
            console.error('Failed to delete OSS:', err);
          } finally {
            // refresh parent data in any case; await if it returns a promise
            try {
              await refreshData();
            } catch (err) {
              console.error('Failed to refresh after delete:', err);
            }
          }
        }}
      />
      <Button
        className={`h-10 w-[103px] rounded bg-maestro-blue-08 px-0 text-[13px] font-semibold ${selectedCluster ? 'text-maestro-gray-disabled' : 'text-maestro-black-cart-text'}`}
+1 −0
Original line number Diff line number Diff line
@@ -642,6 +642,7 @@ class ServiceInventoryManagement extends ApiTmf638<string> {
        method: 'GET',
        query: {
          isKubernetes: true,
          state: 'ACTIVE',
        },
        format: 'json',
      });