Commit 0ba7355e authored by Dimitrios Gogos's avatar Dimitrios Gogos
Browse files

feat: update API product scopes and enhance UI with descriptive labels

parent a4c48e92
Loading
Loading
Loading
Loading
+0 −3
Changes for api-products.example.json: 0 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -20,9 +20,6 @@
    {
      "name": "quality-on-demand",
      "scopes": [
        "qod-sessions-read",
        "qod-sessions-write",
        "qod-sessions-delete",
        "quality-on-demand:sessions:create",
        "quality-on-demand:sessions:read",
        "quality-on-demand:sessions:delete",
+2 −1
Changes for portal-gui/src/components/api-clients/api-client-columns.tsx: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@ import type { ColumnDef } from '@tanstack/react-table';

import { actionsColumn } from '@/components/data-table/actions-column';
import { Badge } from '@/components/ui/badge';
import { apiLabels } from '@/lib/constants';
import type { ApiClient } from '@/types/api-clients';

export function getApiClientColumns(
@@ -54,7 +55,7 @@ export function getApiClientColumns(
        <div className="flex flex-wrap gap-1">
          {row.original.products.map((product) => (
            <Badge key={product} variant="secondary">
              {product}
              {apiLabels[product] ?? product}
            </Badge>
          ))}
        </div>
+2 −1
Changes for portal-gui/src/components/api-clients/create-api-client-dialog.tsx: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import { useApiProducts } from '@/hooks/useApiProducts';
import { useSingleFlight } from '@/hooks/useSingleFlight';
import { apiLabels } from '@/lib/constants';
import { createApiClient } from '@/services/api-clients/api-clients';
import type { CreatedApiClient } from '@/types/api-clients';

@@ -120,7 +121,7 @@ export function CreateApiClientDialog({
                  htmlFor={`product-${product.name}`}
                  className="font-normal"
                >
                  {product.name}
                  {apiLabels[product.name] ?? product.name}
                  {!product.held && (
                    <span className="block text-xs text-muted-foreground">
                      Not granted to you. Ask an operator for access.
+3 −3
Changes for portal-gui/src/components/applications/deploy-app-dialog.tsx: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ import { Checkbox } from '@/components/ui/checkbox';
import type { EdgeCloudZone, AppDeployProps } from '@/types/application';

import { deployApplication } from '@/services/applications/deployments';
import { getEdgeCloudZones } from '@/services/applications/profiles';
import { getActiveEdgeCloudZones } from '@/services/applications/profiles';
import { useSingleFlight } from '@/hooks/useSingleFlight';
import { Alert } from '@/components/ui/alert';
export function DeployApplicationDialog({
@@ -46,7 +46,7 @@ export function DeployApplicationDialog({
      setSelected([]);

      try {
        const data = await getEdgeCloudZones();
        const data = await getActiveEdgeCloudZones();

        if (cancelled) {
          return;
@@ -140,7 +140,7 @@ export function DeployApplicationDialog({

          {!loadingZones && zones.length === 0 && !error && (
            <p className="text-sm text-muted-foreground">
              No edge cloud zones available.
              No active edge cloud zones available.
            </p>
          )}

+9 −15
Changes for portal-gui/src/components/applications/instantiate-app-dialog.tsx: 9 added lines, 15 removed lines.
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ import {
  DialogTitle,
} from '../ui/dialog';

import { getEdgeCloudZones } from '@/services/applications/profiles';
import { getActiveEdgeCloudZones } from '@/services/applications/profiles';
import type {
  AppInstance,
  EdgeCloudZone,
@@ -72,7 +72,7 @@ export const InstantiateApplicationDialog = ({
      setLoadingZones(true);

      try {
        const data = await getEdgeCloudZones();
        const data = await getActiveEdgeCloudZones();

        if (cancelled) {
          return;
@@ -80,11 +80,8 @@ export const InstantiateApplicationDialog = ({

        setZones(data);

        const activeZones = data.filter(
          (zone) => zone.edgeCloudZoneStatus === 'active',
        );
        if (activeZones.length === 1) {
          setSelectedZoneId(activeZones[0]!.edgeCloudZoneId);
        if (data.length === 1) {
          setSelectedZoneId(data[0]!.edgeCloudZoneId);
        }
      } catch (err) {
        if (!cancelled) {
@@ -107,10 +104,7 @@ export const InstantiateApplicationDialog = ({
      cancelled = true;
    };
  }, [open, application.appId]);
  const activeZones = zones.filter(
    (zone) => zone.edgeCloudZoneStatus === 'active',
  );
  const selectedZone = activeZones.find(
  const selectedZone = zones.find(
    (zone) => zone.edgeCloudZoneId === selectedZoneId,
  );

@@ -208,15 +202,15 @@ export const InstantiateApplicationDialog = ({
              </div>
            )}

            {!loadingZones && activeZones.length === 0 && !error && (
            {!loadingZones && zones.length === 0 && !error && (
              <p className="text-sm text-muted-foreground">
                No active edge cloud zones available.
              </p>
            )}

            {!loadingZones && activeZones.length > 0 && (
            {!loadingZones && zones.length > 0 && (
              <div className="space-y-2">
                {activeZones.map((zone) => {
                {zones.map((zone) => {
                  const checked = selectedZoneId === zone.edgeCloudZoneId;

                  return (
@@ -302,7 +296,7 @@ export const InstantiateApplicationDialog = ({
                !name ||
                !appId ||
                !selectedZoneId ||
                activeZones.length === 0
                zones.length === 0
              }
            >
              {submitting ? (
Loading