skypilot-nightly 1.0.0.dev20250905__py3-none-any.whl → 1.0.0.dev20251210__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sky/__init__.py +12 -2
- sky/adaptors/aws.py +27 -22
- sky/adaptors/common.py +25 -2
- sky/adaptors/coreweave.py +278 -0
- sky/adaptors/do.py +8 -2
- sky/adaptors/gcp.py +11 -0
- sky/adaptors/ibm.py +5 -2
- sky/adaptors/kubernetes.py +64 -0
- sky/adaptors/nebius.py +3 -1
- sky/adaptors/primeintellect.py +1 -0
- sky/adaptors/seeweb.py +183 -0
- sky/adaptors/shadeform.py +89 -0
- sky/adaptors/slurm.py +478 -0
- sky/admin_policy.py +20 -0
- sky/authentication.py +157 -263
- sky/backends/__init__.py +3 -2
- sky/backends/backend.py +11 -3
- sky/backends/backend_utils.py +630 -185
- sky/backends/cloud_vm_ray_backend.py +1111 -928
- sky/backends/local_docker_backend.py +9 -5
- sky/backends/task_codegen.py +971 -0
- sky/backends/wheel_utils.py +18 -0
- sky/catalog/__init__.py +8 -3
- sky/catalog/aws_catalog.py +4 -0
- sky/catalog/common.py +19 -1
- sky/catalog/data_fetchers/fetch_aws.py +102 -80
- sky/catalog/data_fetchers/fetch_gcp.py +30 -3
- sky/catalog/data_fetchers/fetch_nebius.py +9 -6
- sky/catalog/data_fetchers/fetch_runpod.py +698 -0
- sky/catalog/data_fetchers/fetch_seeweb.py +329 -0
- sky/catalog/data_fetchers/fetch_shadeform.py +142 -0
- sky/catalog/kubernetes_catalog.py +36 -32
- sky/catalog/primeintellect_catalog.py +95 -0
- sky/catalog/runpod_catalog.py +5 -1
- sky/catalog/seeweb_catalog.py +184 -0
- sky/catalog/shadeform_catalog.py +165 -0
- sky/catalog/slurm_catalog.py +243 -0
- sky/check.py +87 -46
- sky/client/cli/command.py +1004 -434
- sky/client/cli/flags.py +4 -2
- sky/{volumes/utils.py → client/cli/table_utils.py} +111 -13
- sky/client/cli/utils.py +79 -0
- sky/client/common.py +12 -2
- sky/client/sdk.py +188 -65
- sky/client/sdk_async.py +34 -33
- sky/cloud_stores.py +82 -3
- sky/clouds/__init__.py +8 -0
- sky/clouds/aws.py +337 -129
- sky/clouds/azure.py +24 -18
- sky/clouds/cloud.py +47 -13
- sky/clouds/cudo.py +16 -13
- sky/clouds/do.py +9 -7
- sky/clouds/fluidstack.py +12 -5
- sky/clouds/gcp.py +14 -7
- sky/clouds/hyperbolic.py +12 -5
- sky/clouds/ibm.py +12 -5
- sky/clouds/kubernetes.py +80 -45
- sky/clouds/lambda_cloud.py +12 -5
- sky/clouds/nebius.py +23 -9
- sky/clouds/oci.py +19 -12
- sky/clouds/paperspace.py +4 -1
- sky/clouds/primeintellect.py +317 -0
- sky/clouds/runpod.py +85 -24
- sky/clouds/scp.py +12 -8
- sky/clouds/seeweb.py +477 -0
- sky/clouds/shadeform.py +400 -0
- sky/clouds/slurm.py +578 -0
- sky/clouds/ssh.py +6 -3
- sky/clouds/utils/scp_utils.py +61 -50
- sky/clouds/vast.py +43 -27
- sky/clouds/vsphere.py +14 -16
- sky/core.py +296 -195
- sky/dashboard/out/404.html +1 -1
- sky/dashboard/out/_next/static/KYAhEFa3FTfq4JyKVgo-s/_buildManifest.js +1 -0
- sky/dashboard/out/_next/static/chunks/1141-9c810f01ff4f398a.js +11 -0
- sky/dashboard/out/_next/static/chunks/1871-7e202677c42f43fe.js +6 -0
- sky/dashboard/out/_next/static/chunks/2260-7703229c33c5ebd5.js +1 -0
- sky/dashboard/out/_next/static/chunks/2369.fc20f0c2c8ed9fe7.js +15 -0
- sky/dashboard/out/_next/static/chunks/2755.edd818326d489a1d.js +26 -0
- sky/dashboard/out/_next/static/chunks/3294.ddda8c6c6f9f24dc.js +1 -0
- sky/dashboard/out/_next/static/chunks/3785.7e245f318f9d1121.js +1 -0
- sky/dashboard/out/_next/static/chunks/{6601-06114c982db410b6.js → 3800-b589397dc09c5b4e.js} +1 -1
- sky/dashboard/out/_next/static/chunks/3850-fd5696f3bbbaddae.js +1 -0
- sky/dashboard/out/_next/static/chunks/4725.172ede95d1b21022.js +1 -0
- sky/dashboard/out/_next/static/chunks/4937.a2baa2df5572a276.js +15 -0
- sky/dashboard/out/_next/static/chunks/6212-7bd06f60ba693125.js +13 -0
- sky/dashboard/out/_next/static/chunks/6856-da20c5fd999f319c.js +1 -0
- sky/dashboard/out/_next/static/chunks/6990-09cbf02d3cd518c3.js +1 -0
- sky/dashboard/out/_next/static/chunks/7359-c8d04e06886000b3.js +30 -0
- sky/dashboard/out/_next/static/chunks/7615-019513abc55b3b47.js +1 -0
- sky/dashboard/out/_next/static/chunks/8640.5b9475a2d18c5416.js +16 -0
- sky/dashboard/out/_next/static/chunks/8969-452f9d5cbdd2dc73.js +1 -0
- sky/dashboard/out/_next/static/chunks/9025.fa408f3242e9028d.js +6 -0
- sky/dashboard/out/_next/static/chunks/9353-8369df1cf105221c.js +1 -0
- sky/dashboard/out/_next/static/chunks/9360.a536cf6b1fa42355.js +31 -0
- sky/dashboard/out/_next/static/chunks/9847.3aaca6bb33455140.js +30 -0
- sky/dashboard/out/_next/static/chunks/pages/_app-68b647e26f9d2793.js +34 -0
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-33f525539665fdfd.js +16 -0
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-a7565f586ef86467.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/clusters-9e5d47818b9bdadd.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/{config-dfb9bf07b13045f4.js → config-718cdc365de82689.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/infra/{[context]-6563820e094f68ca.js → [context]-12c559ec4d81fdbd.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/{infra-aabba60d57826e0f.js → infra-d187cd0413d72475.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-895847b6cf200b04.js +16 -0
- sky/dashboard/out/_next/static/chunks/pages/jobs/pools/[pool]-8d0f4655400b4eb9.js +21 -0
- sky/dashboard/out/_next/static/chunks/pages/jobs-e5a98f17f8513a96.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/plugins/[...slug]-4f46050ca065d8f8.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/users-2f7646eb77785a2c.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/volumes-ef19d49c6d0e8500.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/workspaces/{[name]-af76bb06dbb3954f.js → [name]-96e0f298308da7e2.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/{workspaces-7598c33a746cdc91.js → workspaces-cb4da3abe08ebf19.js} +1 -1
- sky/dashboard/out/_next/static/chunks/webpack-fba3de387ff6bb08.js +1 -0
- sky/dashboard/out/_next/static/css/c5a4cfd2600fc715.css +3 -0
- sky/dashboard/out/clusters/[cluster]/[job].html +1 -1
- sky/dashboard/out/clusters/[cluster].html +1 -1
- sky/dashboard/out/clusters.html +1 -1
- sky/dashboard/out/config.html +1 -1
- sky/dashboard/out/index.html +1 -1
- sky/dashboard/out/infra/[context].html +1 -1
- sky/dashboard/out/infra.html +1 -1
- sky/dashboard/out/jobs/[job].html +1 -1
- sky/dashboard/out/jobs/pools/[pool].html +1 -1
- sky/dashboard/out/jobs.html +1 -1
- sky/dashboard/out/plugins/[...slug].html +1 -0
- sky/dashboard/out/users.html +1 -1
- sky/dashboard/out/volumes.html +1 -1
- sky/dashboard/out/workspace/new.html +1 -1
- sky/dashboard/out/workspaces/[name].html +1 -1
- sky/dashboard/out/workspaces.html +1 -1
- sky/data/data_utils.py +92 -1
- sky/data/mounting_utils.py +177 -30
- sky/data/storage.py +200 -19
- sky/data/storage_utils.py +10 -45
- sky/exceptions.py +18 -7
- sky/execution.py +74 -31
- sky/global_user_state.py +605 -191
- sky/jobs/__init__.py +2 -0
- sky/jobs/client/sdk.py +101 -4
- sky/jobs/client/sdk_async.py +31 -5
- sky/jobs/constants.py +15 -8
- sky/jobs/controller.py +726 -284
- sky/jobs/file_content_utils.py +128 -0
- sky/jobs/log_gc.py +193 -0
- sky/jobs/recovery_strategy.py +250 -100
- sky/jobs/scheduler.py +271 -173
- sky/jobs/server/core.py +367 -114
- sky/jobs/server/server.py +81 -35
- sky/jobs/server/utils.py +89 -35
- sky/jobs/state.py +1498 -620
- sky/jobs/utils.py +771 -306
- sky/logs/agent.py +40 -5
- sky/logs/aws.py +9 -19
- sky/metrics/utils.py +282 -39
- sky/models.py +2 -0
- sky/optimizer.py +7 -6
- sky/provision/__init__.py +38 -1
- sky/provision/aws/config.py +34 -13
- sky/provision/aws/instance.py +5 -2
- sky/provision/azure/instance.py +5 -3
- sky/provision/common.py +22 -0
- sky/provision/cudo/instance.py +4 -3
- sky/provision/do/instance.py +4 -3
- sky/provision/docker_utils.py +112 -28
- sky/provision/fluidstack/instance.py +6 -5
- sky/provision/gcp/config.py +6 -1
- sky/provision/gcp/instance.py +4 -2
- sky/provision/hyperbolic/instance.py +4 -2
- sky/provision/instance_setup.py +66 -20
- sky/provision/kubernetes/__init__.py +2 -0
- sky/provision/kubernetes/config.py +7 -44
- sky/provision/kubernetes/constants.py +0 -1
- sky/provision/kubernetes/instance.py +609 -213
- sky/provision/kubernetes/manifests/fusermount-server-daemonset.yaml +1 -2
- sky/provision/kubernetes/network.py +12 -8
- sky/provision/kubernetes/network_utils.py +8 -25
- sky/provision/kubernetes/utils.py +422 -422
- sky/provision/kubernetes/volume.py +150 -18
- sky/provision/lambda_cloud/instance.py +16 -13
- sky/provision/nebius/instance.py +6 -2
- sky/provision/nebius/utils.py +103 -86
- sky/provision/oci/instance.py +4 -2
- sky/provision/paperspace/instance.py +4 -3
- sky/provision/primeintellect/__init__.py +10 -0
- sky/provision/primeintellect/config.py +11 -0
- sky/provision/primeintellect/instance.py +454 -0
- sky/provision/primeintellect/utils.py +398 -0
- sky/provision/provisioner.py +45 -15
- sky/provision/runpod/__init__.py +2 -0
- sky/provision/runpod/instance.py +4 -3
- sky/provision/runpod/volume.py +69 -13
- sky/provision/scp/instance.py +307 -130
- sky/provision/seeweb/__init__.py +11 -0
- sky/provision/seeweb/config.py +13 -0
- sky/provision/seeweb/instance.py +812 -0
- sky/provision/shadeform/__init__.py +11 -0
- sky/provision/shadeform/config.py +12 -0
- sky/provision/shadeform/instance.py +351 -0
- sky/provision/shadeform/shadeform_utils.py +83 -0
- sky/provision/slurm/__init__.py +12 -0
- sky/provision/slurm/config.py +13 -0
- sky/provision/slurm/instance.py +572 -0
- sky/provision/slurm/utils.py +583 -0
- sky/provision/vast/instance.py +9 -4
- sky/provision/vast/utils.py +10 -6
- sky/provision/volume.py +164 -0
- sky/provision/vsphere/common/ssl_helper.py +1 -1
- sky/provision/vsphere/common/vapiconnect.py +2 -1
- sky/provision/vsphere/common/vim_utils.py +3 -2
- sky/provision/vsphere/instance.py +8 -6
- sky/provision/vsphere/vsphere_utils.py +8 -1
- sky/resources.py +11 -3
- sky/schemas/api/responses.py +107 -6
- sky/schemas/db/global_user_state/008_skylet_ssh_tunnel_metadata.py +34 -0
- sky/schemas/db/global_user_state/009_last_activity_and_launched_at.py +89 -0
- sky/schemas/db/global_user_state/010_save_ssh_key.py +66 -0
- sky/schemas/db/global_user_state/011_is_ephemeral.py +34 -0
- sky/schemas/db/kv_cache/001_initial_schema.py +29 -0
- sky/schemas/db/serve_state/002_yaml_content.py +34 -0
- sky/schemas/db/skypilot_config/001_initial_schema.py +30 -0
- sky/schemas/db/spot_jobs/002_cluster_pool.py +3 -3
- sky/schemas/db/spot_jobs/004_job_file_contents.py +42 -0
- sky/schemas/db/spot_jobs/005_logs_gc.py +38 -0
- sky/schemas/db/spot_jobs/006_controller_pid_started_at.py +34 -0
- sky/schemas/db/spot_jobs/007_config_file_content.py +34 -0
- sky/schemas/generated/jobsv1_pb2.py +86 -0
- sky/schemas/generated/jobsv1_pb2.pyi +254 -0
- sky/schemas/generated/jobsv1_pb2_grpc.py +542 -0
- sky/schemas/generated/managed_jobsv1_pb2.py +76 -0
- sky/schemas/generated/managed_jobsv1_pb2.pyi +278 -0
- sky/schemas/generated/managed_jobsv1_pb2_grpc.py +278 -0
- sky/schemas/generated/servev1_pb2.py +58 -0
- sky/schemas/generated/servev1_pb2.pyi +115 -0
- sky/schemas/generated/servev1_pb2_grpc.py +322 -0
- sky/serve/autoscalers.py +2 -0
- sky/serve/client/impl.py +55 -21
- sky/serve/constants.py +4 -3
- sky/serve/controller.py +17 -11
- sky/serve/load_balancing_policies.py +1 -1
- sky/serve/replica_managers.py +219 -142
- sky/serve/serve_rpc_utils.py +179 -0
- sky/serve/serve_state.py +63 -54
- sky/serve/serve_utils.py +145 -109
- sky/serve/server/core.py +46 -25
- sky/serve/server/impl.py +311 -162
- sky/serve/server/server.py +21 -19
- sky/serve/service.py +84 -68
- sky/serve/service_spec.py +45 -7
- sky/server/auth/loopback.py +38 -0
- sky/server/auth/oauth2_proxy.py +12 -7
- sky/server/common.py +47 -24
- sky/server/config.py +62 -28
- sky/server/constants.py +9 -1
- sky/server/daemons.py +109 -38
- sky/server/metrics.py +76 -96
- sky/server/middleware_utils.py +166 -0
- sky/server/plugins.py +222 -0
- sky/server/requests/executor.py +384 -145
- sky/server/requests/payloads.py +83 -19
- sky/server/requests/preconditions.py +15 -13
- sky/server/requests/request_names.py +123 -0
- sky/server/requests/requests.py +511 -157
- sky/server/requests/serializers/decoders.py +48 -17
- sky/server/requests/serializers/encoders.py +102 -20
- sky/server/requests/serializers/return_value_serializers.py +60 -0
- sky/server/requests/threads.py +117 -0
- sky/server/rest.py +116 -24
- sky/server/server.py +497 -179
- sky/server/server_utils.py +30 -0
- sky/server/stream_utils.py +219 -45
- sky/server/uvicorn.py +30 -19
- sky/setup_files/MANIFEST.in +6 -1
- sky/setup_files/alembic.ini +8 -0
- sky/setup_files/dependencies.py +64 -19
- sky/setup_files/setup.py +44 -44
- sky/sky_logging.py +13 -5
- sky/skylet/attempt_skylet.py +116 -24
- sky/skylet/configs.py +3 -1
- sky/skylet/constants.py +139 -29
- sky/skylet/events.py +74 -14
- sky/skylet/executor/__init__.py +1 -0
- sky/skylet/executor/slurm.py +189 -0
- sky/skylet/job_lib.py +143 -105
- sky/skylet/log_lib.py +252 -8
- sky/skylet/log_lib.pyi +47 -7
- sky/skylet/providers/ibm/node_provider.py +12 -8
- sky/skylet/providers/ibm/vpc_provider.py +13 -12
- sky/skylet/runtime_utils.py +21 -0
- sky/skylet/services.py +524 -0
- sky/skylet/skylet.py +27 -2
- sky/skylet/subprocess_daemon.py +104 -28
- sky/skypilot_config.py +99 -79
- sky/ssh_node_pools/constants.py +12 -0
- sky/ssh_node_pools/core.py +40 -3
- sky/ssh_node_pools/deploy/__init__.py +4 -0
- sky/ssh_node_pools/deploy/deploy.py +952 -0
- sky/ssh_node_pools/deploy/tunnel_utils.py +199 -0
- sky/ssh_node_pools/deploy/utils.py +173 -0
- sky/ssh_node_pools/server.py +20 -21
- sky/{utils/kubernetes/ssh_utils.py → ssh_node_pools/utils.py} +9 -6
- sky/task.py +221 -104
- sky/templates/aws-ray.yml.j2 +1 -0
- sky/templates/azure-ray.yml.j2 +1 -0
- sky/templates/cudo-ray.yml.j2 +1 -0
- sky/templates/do-ray.yml.j2 +1 -0
- sky/templates/fluidstack-ray.yml.j2 +1 -0
- sky/templates/gcp-ray.yml.j2 +1 -0
- sky/templates/hyperbolic-ray.yml.j2 +1 -0
- sky/templates/ibm-ray.yml.j2 +2 -1
- sky/templates/jobs-controller.yaml.j2 +3 -0
- sky/templates/kubernetes-ray.yml.j2 +204 -55
- sky/templates/lambda-ray.yml.j2 +1 -0
- sky/templates/nebius-ray.yml.j2 +3 -0
- sky/templates/oci-ray.yml.j2 +1 -0
- sky/templates/paperspace-ray.yml.j2 +1 -0
- sky/templates/primeintellect-ray.yml.j2 +72 -0
- sky/templates/runpod-ray.yml.j2 +1 -0
- sky/templates/scp-ray.yml.j2 +1 -0
- sky/templates/seeweb-ray.yml.j2 +171 -0
- sky/templates/shadeform-ray.yml.j2 +73 -0
- sky/templates/slurm-ray.yml.j2 +85 -0
- sky/templates/vast-ray.yml.j2 +2 -0
- sky/templates/vsphere-ray.yml.j2 +1 -0
- sky/templates/websocket_proxy.py +188 -43
- sky/usage/usage_lib.py +16 -4
- sky/users/model.conf +1 -1
- sky/users/permission.py +84 -44
- sky/users/rbac.py +31 -3
- sky/utils/accelerator_registry.py +6 -3
- sky/utils/admin_policy_utils.py +18 -5
- sky/utils/annotations.py +128 -6
- sky/utils/asyncio_utils.py +78 -0
- sky/utils/atomic.py +1 -1
- sky/utils/auth_utils.py +153 -0
- sky/utils/cli_utils/status_utils.py +12 -7
- sky/utils/cluster_utils.py +28 -6
- sky/utils/command_runner.py +283 -30
- sky/utils/command_runner.pyi +63 -7
- sky/utils/common.py +3 -1
- sky/utils/common_utils.py +55 -7
- sky/utils/config_utils.py +1 -14
- sky/utils/context.py +127 -40
- sky/utils/context_utils.py +73 -18
- sky/utils/controller_utils.py +229 -70
- sky/utils/db/db_utils.py +95 -18
- sky/utils/db/kv_cache.py +149 -0
- sky/utils/db/migration_utils.py +24 -7
- sky/utils/env_options.py +4 -0
- sky/utils/git.py +559 -1
- sky/utils/kubernetes/create_cluster.sh +15 -30
- sky/utils/kubernetes/delete_cluster.sh +10 -7
- sky/utils/kubernetes/generate_kind_config.py +6 -66
- sky/utils/kubernetes/gpu_labeler.py +13 -3
- sky/utils/kubernetes/k8s_gpu_labeler_job.yaml +2 -1
- sky/utils/kubernetes/k8s_gpu_labeler_setup.yaml +16 -16
- sky/utils/kubernetes/kubernetes_deploy_utils.py +187 -260
- sky/utils/kubernetes/rsync_helper.sh +11 -3
- sky/utils/kubernetes/ssh-tunnel.sh +7 -376
- sky/utils/kubernetes_enums.py +7 -15
- sky/utils/lock_events.py +4 -4
- sky/utils/locks.py +128 -31
- sky/utils/log_utils.py +0 -319
- sky/utils/resource_checker.py +13 -10
- sky/utils/resources_utils.py +53 -29
- sky/utils/rich_utils.py +8 -4
- sky/utils/schemas.py +138 -52
- sky/utils/subprocess_utils.py +17 -4
- sky/utils/thread_utils.py +91 -0
- sky/utils/timeline.py +2 -1
- sky/utils/ux_utils.py +35 -1
- sky/utils/volume.py +88 -4
- sky/utils/yaml_utils.py +9 -0
- sky/volumes/client/sdk.py +48 -10
- sky/volumes/server/core.py +59 -22
- sky/volumes/server/server.py +46 -17
- sky/volumes/volume.py +54 -42
- sky/workspaces/core.py +57 -21
- sky/workspaces/server.py +13 -12
- sky_templates/README.md +3 -0
- sky_templates/__init__.py +3 -0
- sky_templates/ray/__init__.py +0 -0
- sky_templates/ray/start_cluster +183 -0
- sky_templates/ray/stop_cluster +75 -0
- {skypilot_nightly-1.0.0.dev20250905.dist-info → skypilot_nightly-1.0.0.dev20251210.dist-info}/METADATA +343 -65
- skypilot_nightly-1.0.0.dev20251210.dist-info/RECORD +629 -0
- skypilot_nightly-1.0.0.dev20251210.dist-info/top_level.txt +2 -0
- sky/client/cli/git.py +0 -549
- sky/dashboard/out/_next/static/chunks/1121-408ed10b2f9fce17.js +0 -1
- sky/dashboard/out/_next/static/chunks/1141-943efc7aff0f0c06.js +0 -1
- sky/dashboard/out/_next/static/chunks/1836-37fede578e2da5f8.js +0 -40
- sky/dashboard/out/_next/static/chunks/3015-86cabed5d4669ad0.js +0 -1
- sky/dashboard/out/_next/static/chunks/3294.c80326aec9bfed40.js +0 -6
- sky/dashboard/out/_next/static/chunks/3785.4872a2f3aa489880.js +0 -1
- sky/dashboard/out/_next/static/chunks/3850-ff4a9a69d978632b.js +0 -1
- sky/dashboard/out/_next/static/chunks/4045.b30465273dc5e468.js +0 -21
- sky/dashboard/out/_next/static/chunks/4676-9da7fdbde90b5549.js +0 -10
- sky/dashboard/out/_next/static/chunks/4725.10f7a9a5d3ea8208.js +0 -1
- sky/dashboard/out/_next/static/chunks/5339.3fda4a4010ff4e06.js +0 -51
- sky/dashboard/out/_next/static/chunks/6135-4b4d5e824b7f9d3c.js +0 -1
- sky/dashboard/out/_next/static/chunks/649.b9d7f7d10c1b8c53.js +0 -45
- sky/dashboard/out/_next/static/chunks/6856-dca7962af4814e1b.js +0 -1
- sky/dashboard/out/_next/static/chunks/6990-08b2a1cae076a943.js +0 -1
- sky/dashboard/out/_next/static/chunks/7325.b4bc99ce0892dcd5.js +0 -6
- sky/dashboard/out/_next/static/chunks/754-d0da8ab45f9509e9.js +0 -18
- sky/dashboard/out/_next/static/chunks/7669.1f5d9a402bf5cc42.js +0 -36
- sky/dashboard/out/_next/static/chunks/8969-0be3036bf86f8256.js +0 -1
- sky/dashboard/out/_next/static/chunks/9025.c12318fb6a1a9093.js +0 -6
- sky/dashboard/out/_next/static/chunks/9037-fa1737818d0a0969.js +0 -6
- sky/dashboard/out/_next/static/chunks/pages/_app-ce361c6959bc2001.js +0 -34
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-1cbba24bd1bd35f8.js +0 -16
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-0b4b35dc1dfe046c.js +0 -16
- sky/dashboard/out/_next/static/chunks/pages/clusters-469814d711d63b1b.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-dd64309c3fe67ed2.js +0 -11
- sky/dashboard/out/_next/static/chunks/pages/jobs/pools/[pool]-07349868f7905d37.js +0 -16
- sky/dashboard/out/_next/static/chunks/pages/jobs-1f70d9faa564804f.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/users-018bf31cda52e11b.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/volumes-739726d6b823f532.js +0 -1
- sky/dashboard/out/_next/static/chunks/webpack-4fe903277b57b523.js +0 -1
- sky/dashboard/out/_next/static/css/4614e06482d7309e.css +0 -3
- sky/dashboard/out/_next/static/mS-4qZPSkRuA1u-g2wQhg/_buildManifest.js +0 -1
- sky/templates/kubernetes-ssh-jump.yml.j2 +0 -94
- sky/utils/kubernetes/cleanup-tunnel.sh +0 -62
- sky/utils/kubernetes/deploy_remote_cluster.py +0 -1299
- sky/utils/kubernetes/ssh_jump_lifecycle_manager.py +0 -191
- skypilot_nightly-1.0.0.dev20250905.dist-info/RECORD +0 -547
- skypilot_nightly-1.0.0.dev20250905.dist-info/top_level.txt +0 -1
- /sky/dashboard/out/_next/static/{mS-4qZPSkRuA1u-g2wQhg → KYAhEFa3FTfq4JyKVgo-s}/_ssgManifest.js +0 -0
- {skypilot_nightly-1.0.0.dev20250905.dist-info → skypilot_nightly-1.0.0.dev20251210.dist-info}/WHEEL +0 -0
- {skypilot_nightly-1.0.0.dev20250905.dist-info → skypilot_nightly-1.0.0.dev20251210.dist-info}/entry_points.txt +0 -0
- {skypilot_nightly-1.0.0.dev20250905.dist-info → skypilot_nightly-1.0.0.dev20251210.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6856],{32045:function(e,t,o){o.d(t,{R8:function(){return u},Xg:function(){return l},ef:function(){return n}});var r=o(93225),a=o(47145),s=o(94545);async function n(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=(await Promise.resolve().then(o.bind(o,6378))).default,{getClusters:s}=await Promise.resolve().then(o.bind(o,23266)),{getManagedJobs:n}=await Promise.resolve().then(o.bind(o,68969)),{getWorkspaces:l,getEnabledClouds:c}=await Promise.resolve().then(o.bind(o,17324));try{let o={jobs:[]};try{o=await t.get(n,[{allUsers:!0,skipFinished:!0,fields:["cloud","region"]}])}catch(e){console.error("Error fetching managed jobs:",e)}let i=(null==o?void 0:o.jobs)||[],u=[];try{u=await t.get(s)}catch(e){console.error("Error fetching clusters:",e)}let d=u||[],g=[];try{if(e){console.log("Force refreshing clouds by running sky check...");try{let e=await a.x.post("/check",{});if(!e.ok){let t="Failed to run sky check with status ".concat(e.status);throw Error(t)}let t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("X-Request-ID");if(!t)throw Error("No request ID received from server for sky check");let o=await a.x.get("/api/get?request_id=".concat(t));if(!o.ok){let e="Failed to get sky check result with status ".concat(o.status,", error: ").concat(o.statusText);throw Error(e)}let r=await o.json();console.log("Sky check completed:",r)}catch(e){console.error("Error running sky check:",e)}}let o=await t.get(l),r=Object.keys(o||{});if(0===r.length)console.warn("No accessible workspaces found"),g=[];else{let e=new Set;await Promise.all(r.map(async o=>{try{let r=await t.get(c,[o,!1]);Array.isArray(r)&&r.forEach(t=>{t&&e.add(t.toLowerCase())})}catch(e){console.error("Error fetching enabled clouds for workspace ".concat(o,":"),e)}})),g=Array.from(e),console.log("Aggregated enabled clouds across all workspaces:",g)}}catch(e){console.error("Error fetching enabled clouds:",e),g=[]}let f={};r.$m.forEach(e=>{let t=g.includes(e.toLowerCase());f[e]={name:e,clusters:0,jobs:0,enabled:t}}),d.forEach(e=>{if(e.cloud){let t=e.cloud;f[t]&&(f[t].clusters+=1,f[t].enabled=!0)}}),i.forEach(e=>{if(e.cloud){let t=e.cloud;f[t]&&(f[t].jobs+=1,f[t].enabled=!0)}});let h=r.$m.length,p=Object.values(f).filter(e=>e.enabled).length;return{clouds:Object.values(f).filter(e=>e.enabled).sort((e,t)=>e.name.localeCompare(t.name)),totalClouds:h,enabledClouds:p}}catch(e){throw console.error("Error fetching cloud infrastructure:",e),e}}async function l(){try{console.log("[DEBUG] Starting workspace-aware infrastructure fetch");let{getWorkspaces:e}=await Promise.resolve().then(o.bind(o,17324));console.log("[DEBUG] About to call getWorkspaces()");let t=await e();if(console.log("[DEBUG] Workspaces data received:",t),console.log("[DEBUG] Number of accessible workspaces:",Object.keys(t||{}).length),console.log("[DEBUG] Workspace names:",Object.keys(t||{})),!t||0===Object.keys(t).length)return console.log("[DEBUG] No accessible workspaces found - returning empty result"),{workspaces:{},allContextNames:[],allGPUs:[],perContextGPUs:[],perNodeGPUs:[],allSlurmGPUs:[],perClusterSlurmGPUs:[],perNodeSlurmGPUs:[],contextStats:{},contextWorkspaceMap:{},contextErrors:{}};let{getEnabledClouds:r}=await Promise.resolve().then(o.bind(o,17324)),a={},s=[],n={};await Promise.allSettled(Object.entries(t).map(async e=>{let[t,o]=e;console.log("Fetching infrastructure for workspace: ".concat(t));try{console.log("[DEBUG] Fetching enabled clouds for workspace: ".concat(t));let e=await r(t,!0);console.log("[DEBUG] Expanded clouds for ".concat(t,":"),e),a[t]={config:o,clouds:e,contexts:[]},console.log("[DEBUG] Processing expandedClouds for ".concat(t,":"),e),e&&Array.isArray(e)?e.forEach(e=>{if(console.log("[DEBUG] Processing infraItem: ".concat(e)),e.toLowerCase().startsWith("kubernetes/")){let o=e.replace(/^kubernetes\//i,"");console.log("[DEBUG] Extracted kubernetes context: ".concat(o)),s.push(o),n[o]||(n[o]=[]),n[o].includes(t)||n[o].push(t),a[t].contexts.push(o)}else if(e.toLowerCase().startsWith("ssh/")){let o=e.replace(/^ssh\//i,""),r="ssh-".concat(o);console.log("[DEBUG] Extracted SSH context: ".concat(r)),s.push(r),n[r]||(n[r]=[]),n[r].includes(t)||n[r].push(t),a[t].contexts.push(r)}}):console.log("[DEBUG] No expanded clouds or not an array for ".concat(t))}catch(e){throw console.error("Failed to fetch infrastructure for workspace ".concat(t,":"),e),e}}));let{getClusters:l}=await Promise.resolve().then(o.bind(o,23266)),i=(await Promise.resolve().then(o.bind(o,6378))).default,u=[];try{u=await i.get(l)}catch(e){console.error("Error fetching clusters:",e)}let g=u||[],f={};try{f=await d(g)}catch(e){console.error("Error fetching context clusters:",e)}let p=[...new Set(s)].filter(e=>e&&"string"==typeof e),m={allGPUs:[],perContextGPUs:[],perNodeGPUs:[],contextErrors:{}};try{m=await c(p)}catch(e){console.error("Error fetching Kubernetes GPUs:",e)}let _={allSlurmGPUs:[],perClusterSlurmGPUs:[],perNodeSlurmGPUs:[]};try{_=await h(),console.log("[DEBUG] Slurm GPU data in infra.jsx:",_)}catch(e){console.error("Error fetching Slurm GPUs:",e)}let w={workspaces:a,allContextNames:[...new Set(s)].sort(),allGPUs:m.allGPUs||[],perContextGPUs:m.perContextGPUs||[],perNodeGPUs:m.perNodeGPUs||[],allSlurmGPUs:_.allSlurmGPUs||[],perClusterSlurmGPUs:_.perClusterSlurmGPUs||[],perNodeSlurmGPUs:_.perNodeSlurmGPUs||[],contextStats:f,contextWorkspaceMap:n,contextErrors:m.contextErrors||{}};return console.log("[DEBUG] Final result:",w),console.log("[DEBUG] All contexts found:",s),console.log("[DEBUG] Context workspace map:",n),w}catch(e){throw console.error("[DEBUG] Failed to fetch workspace infrastructure:",e),console.error("[DEBUG] Error stack:",e.stack),e}}async function c(e){try{var t,o,r,a,s,n,l;if(!e||0===e.length)return{allGPUs:[],perContextGPUs:[],perNodeGPUs:[],contextErrors:{}};let c={},u={},d={},g={},f=await Promise.allSettled(e.map(e=>i(e))),h={};for(let o=0;o<e.length;o++){let r=f[o];if("fulfilled"===r.status)h[e[o]]=r.value,console.log("[CONTEXT_DEBUG] Context node info result:",e[o],r.value);else{let a=(null===(t=r.reason)||void 0===t?void 0:t.message)||"string"==typeof r.reason&&r.reason||"Context may be unavailable or timed out";console.warn("Failed to get node info for context ".concat(e[o],":"),a),h[e[o]]={},g[e[o]]=a}}for(let t of e){let e=h[t]||{};if(e&&Object.keys(e).length>0){let a={};for(let s in e){let n=e[s];if(!n){console.warn("No node data for node ".concat(s," in context ").concat(t));continue}let l=n.accelerator_type||"-",c=(null===(o=n.total)||void 0===o?void 0:o.accelerator_count)||0,i=(null===(r=n.free)||void 0===r?void 0:r.accelerators_available)||0,u=!1!==n.is_ready;c>0&&(a[l]||(a[l]={gpu_name:l,gpu_requestable_qty_per_node:0,gpu_total:0,gpu_free:0,gpu_not_ready:0,context:t}),a[l].gpu_total+=c,a[l].gpu_free+=i,!1===u&&(a[l].gpu_not_ready+=c),a[l].gpu_requestable_qty_per_node=c)}for(let e in u[t]=Object.values(a),a)e in c?(c[e].gpu_total+=a[e].gpu_total,c[e].gpu_free+=a[e].gpu_free,c[e].gpu_not_ready+=a[e].gpu_not_ready):c[e]={gpu_total:a[e].gpu_total,gpu_free:a[e].gpu_free,gpu_not_ready:a[e].gpu_not_ready,gpu_name:e}}else u[t]=[]}for(let t of e){let e=h[t];if(e&&Object.keys(e).length>0)for(let o in e){let r=e[o];if(!r){console.warn("No node data for node ".concat(o," in context ").concat(t));continue}let i=r.accelerator_type||"-",g=null!==(n=null===(a=r.total)||void 0===a?void 0:a.accelerator_count)&&void 0!==n?n:0,f=null!==(l=null===(s=r.free)||void 0===s?void 0:s.accelerators_available)&&void 0!==l?l:0,h=!1!==r.is_ready;d["".concat(t,"/").concat(o)]={node_name:r.name||o,gpu_name:i,gpu_total:g,gpu_free:f,ip_address:r.ip_address||null,context:t,is_ready:h},"-"===i||!u[t]||u[t].some(e=>e.gpu_name===i)||(i in c||(c[i]={gpu_total:0,gpu_free:0,gpu_not_ready:0,gpu_name:i}),u[t].find(e=>e.gpu_name===i)||u[t].push({gpu_name:i,gpu_not_ready:0,gpu_requestable_qty_per_node:"-",gpu_total:0,gpu_free:0,context:t}))}}return console.log("[CONTEXT_DEBUG] All GPUs summary:",c),console.log("[CONTEXT_DEBUG] Per context GPUs data:",u),console.log("[CONTEXT_DEBUG] Per node GPUs data:",d),console.log("[CONTEXT_DEBUG] Context errors:",g),{allGPUs:Object.values(c).sort((e,t)=>(e.gpu_name||"").localeCompare(t.gpu_name||"")),perContextGPUs:Object.values(u).flat().sort((e,t)=>(e.context||"").localeCompare(t.context||"")||(e.gpu_name||"").localeCompare(t.gpu_name||"")),perNodeGPUs:Object.values(d).sort((e,t)=>(e.context||"").localeCompare(t.context||"")||(e.node_name||"").localeCompare(t.node_name||"")||(e.gpu_name||"").localeCompare(t.gpu_name||"")),contextErrors:g}}catch(e){throw console.error("[infra.jsx] Error in getKubernetesGPUsFromContexts:",e),e}}async function i(e){try{let t=await a.x.post("/kubernetes_node_info",{context:e});if(!t.ok){let o="Failed to get kubernetes node info for context ".concat(e," with status ").concat(t.status,", error: ").concat(t.statusText);throw Error(o)}let o=t.headers.get("X-Skypilot-Request-ID")||t.headers.get("x-request-id");if(!o)throw Error("No request ID received from server for kubernetes node info");let r=await a.x.get("/api/get?request_id=".concat(o));if(!r.ok){let t=await (0,s.oN)(r),o="Failed to get kubernetes node info result for context ".concat(e," with status ").concat(r.status,", error: ").concat(t);throw Error(o)}let n=await r.json();return(n.return_value?JSON.parse(n.return_value):{}).node_info_dict||{}}catch(t){throw console.warn("[infra.jsx] Context ".concat(e," unavailable or timed out:"),t.message),t}}async function u(e){try{let t={};return e.forEach(e=>{let o=null;if("Kubernetes"===e.cloud)(o=e.region)&&(o="kubernetes/".concat(o));else if("SSH"===e.cloud&&(o=e.region)){let e=o.startsWith("ssh-")?o.substring(4):o;o="ssh/".concat(e)}o&&(t[o]||(t[o]={clusters:0,jobs:0}),t[o].jobs+=1)}),t}catch(e){throw console.error("=== Error in getContextJobs ===",e),e}}async function d(e){try{let t={};return e.forEach(e=>{let o=null;if("Kubernetes"===e.cloud)(o=e.region)&&(o="kubernetes/".concat(o));else if("SSH"===e.cloud&&(o=e.region)){let e=o.startsWith("ssh-")?o.substring(4):o;o="ssh/".concat(e)}o&&(t[o]||(t[o]={clusters:0,jobs:0}),t[o].clusters+=1)}),t}catch(e){throw console.error("=== Error in getContextClusters ===",e),e}}async function g(){try{let e=await a.x.post("/slurm_gpu_availability",{});if(!e.ok){let t="Failed to get slurm cluster GPUs with status ".concat(e.status);throw Error(t)}let t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("x-request-id");if(!t)throw Error("No request ID received from server for slurm cluster GPUs");let o=await a.x.get("/api/get?request_id=".concat(t));if(500===o.status){try{let e=await o.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);console.error("Error fetching Slurm cluster GPUs:",t.message)}catch(e){console.error("Error parsing JSON for Slurm error:",e)}}catch(e){console.error("Error parsing JSON for Slurm 500 response:",e)}return[]}if(!o.ok){let e="Failed to get slurm cluster GPUs result with status ".concat(o.status);throw Error(e)}let r=await o.json();return r.return_value?JSON.parse(r.return_value):[]}catch(e){return console.error("Error fetching Slurm cluster GPUs:",e),[]}}async function f(){try{let e=await a.x.get("/slurm_node_info");if(!e.ok){let t="Failed to get slurm node info with status ".concat(e.status);throw Error(t)}let t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("x-request-id");if(!t)throw Error("No request ID received from server for slurm node info");let o=await a.x.get("/api/get?request_id=".concat(t));if(500===o.status){try{let e=await o.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);console.error("Error fetching Slurm per node GPUs:",t.message)}catch(e){console.error("Error parsing JSON for Slurm node error:",e)}}catch(e){console.error("Error parsing JSON for Slurm node 500 response:",e)}return[]}if(!o.ok){let e="Failed to get slurm node info result with status ".concat(o.status);throw Error(e)}let r=await o.json();return r.return_value?JSON.parse(r.return_value):[]}catch(e){return console.error("Error fetching Slurm per node GPUs:",e),[]}}async function h(){try{let e=await g(),t=await f(),o={},r={},a={};for(let t of e){let e=t[0];for(let a of t[1]){let t=a[0],s=a[1].join(", "),n=a[2],l=a[3];t in o?(o[t].gpu_total+=n,o[t].gpu_free+=l):o[t]={gpu_total:n,gpu_free:l,gpu_name:t},r["".concat(e,"#").concat(t)]={gpu_name:t,gpu_requestable_qty_per_node:s,gpu_total:n,gpu_free:l,cluster:e}}}for(let e of t){let t=e.slurm_cluster_name||"default";a["".concat(t,"/").concat(e.node_name,"/").concat(e.gpu_type||"-")]={node_name:e.node_name,gpu_name:e.gpu_type||"-",gpu_total:e.total_gpus||0,gpu_free:e.free_gpus||0,cluster:t,partition:e.partition||"default"}}return{allSlurmGPUs:Object.values(o).sort((e,t)=>e.gpu_name.localeCompare(t.gpu_name)),perClusterSlurmGPUs:Object.values(r).sort((e,t)=>e.cluster.localeCompare(t.cluster)||e.gpu_name.localeCompare(t.gpu_name)),perNodeSlurmGPUs:Object.values(a).sort((e,t)=>(e.cluster||"").localeCompare(t.cluster||"")||(e.node_name||"").localeCompare(t.node_name||"")||(e.gpu_name||"").localeCompare(t.gpu_name||""))}}catch(e){return console.error("Error fetching Slurm GPUs:",e),{allSlurmGPUs:[],perClusterSlurmGPUs:[],perNodeSlurmGPUs:[]}}}},29326:function(e,t,o){o.d(t,{IS:function(){return d},It:function(){return s},MV:function(){return l},Ri:function(){return n},_x:function(){return i},ez:function(){return u},hY:function(){return c},mF:function(){return f},wJ:function(){return g}});var r=o(93225),a=o(15821);async function s(){try{let e=await fetch("".concat(r.f4,"/ssh_node_pools"),{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));return await e.json()}catch(e){return console.error("Error fetching SSH Node Pools:",e),{}}}async function n(e){try{let t=await fetch("".concat(r.f4,"/ssh_node_pools"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw Error("HTTP error! status: ".concat(t.status));return await t.json()}catch(e){throw console.error("Error updating SSH Node Pools:",e),e}}async function l(e){try{let t=await fetch("".concat(r.f4,"/ssh_node_pools/").concat(e),{method:"DELETE",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("HTTP error! status: ".concat(t.status));return await t.json()}catch(e){throw console.error("Error deleting SSH Node Pool:",e),e}}async function c(e,t){try{let o=new FormData;o.append("key_name",e),o.append("key_file",t);let a=await fetch("".concat(r.f4,"/ssh_node_pools/keys"),{method:"POST",body:o});if(!a.ok)throw Error("HTTP error! status: ".concat(a.status));return await a.json()}catch(e){throw console.error("Error uploading SSH key:",e),e}}async function i(e){try{let t=await fetch("".concat(r.f4,"/ssh_node_pools/").concat(e,"/deploy"),{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("HTTP error! status: ".concat(t.status));return await t.json()}catch(e){throw console.error("Error deploying SSH Node Pool:",e),e}}async function u(e){try{let t=await fetch("".concat(r.f4,"/ssh_node_pools/").concat(e,"/down"),{method:"POST",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("HTTP error! status: ".concat(t.status));return await t.json()}catch(e){throw console.error("Error tearing down SSH Node Pool:",e),e}}async function d(e){try{let t=await fetch("".concat(r.f4,"/ssh_node_pools/").concat(e,"/status"),{method:"GET",headers:{"Content-Type":"application/json"}});if(!t.ok)throw Error("HTTP error! status: ".concat(t.status));return await t.json()}catch(e){throw console.error("Error fetching SSH Node Pool status:",e),e}}async function g(e){let t,{requestId:o,signal:s,onNewLog:n}=e,l=Date.now(),c=new Promise(e=>{let o=()=>{let r=Date.now()-l;r>=3e5?e({timeout:!0}):t=setTimeout(o,3e5-r)};t=setTimeout(o,3e5)}),i=(async()=>{try{let e=await fetch("".concat(r.f4,"/api/stream?request_id=").concat(o,"&format=plain&tail=").concat(1e3,"&follow=true"),{method:"GET",headers:{"Content-Type":"application/json"},...s?{signal:s}:{}});if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));let a=e.body.getReader();try{for(;;){let{done:e,value:t}=await a.read();if(e)break;l=Date.now();let o=new TextDecoder().decode(t);n(o)}}finally{a.cancel(),t&&clearTimeout(t)}return{timeout:!1}}catch(e){if(t&&clearTimeout(t),"AbortError"===e.name)return{timeout:!1};throw e}})(),u=await Promise.race([i,c]);if(t&&clearTimeout(t),u.timeout){(0,a.C)("SSH deployment log stream timed out after ".concat(300,"s of inactivity"),"warning");return}}async function f(e){let t,{requestId:o,signal:s,onNewLog:n,operationType:l="operation"}=e,c=Date.now(),i=new Promise(e=>{let o=()=>{let r=Date.now()-c;r>=3e5?e({timeout:!0}):t=setTimeout(o,3e5-r)};t=setTimeout(o,3e5)}),u=(async()=>{try{let e=await fetch("".concat(r.f4,"/api/stream?request_id=").concat(o,"&format=plain&tail=").concat(1e3,"&follow=true"),{method:"GET",headers:{"Content-Type":"application/json"},...s?{signal:s}:{}});if(!e.ok)throw Error("HTTP error! status: ".concat(e.status));let a=e.body.getReader();try{for(;;){let{done:e,value:t}=await a.read();if(e)break;c=Date.now();let o=new TextDecoder().decode(t);n(o)}}finally{a.cancel(),t&&clearTimeout(t)}return{timeout:!1}}catch(e){if(t&&clearTimeout(t),"AbortError"===e.name)return{timeout:!1};throw e}})(),d=await Promise.race([u,i]);if(t&&clearTimeout(t),d.timeout){(0,a.C)("SSH ".concat(l," log stream timed out after ").concat(300,"s of inactivity"),"warning");return}}},53081:function(e,t,o){o.d(t,{R:function(){return a}});var r=o(47145);async function a(){try{let e=await r.x.get("/users");if(!e.ok)throw Error("Failed to fetch users with status ".concat(e.status));return(await e.json()).map(e=>({userId:e.id,username:e.name,role:e.role,created_at:e.created_at}))||[]}catch(e){throw console.error("Failed to fetch users:",e),e}}},19238:function(e,t,o){o.d(t,{C:function(){return s},w:function(){return n}});var r=o(47145),a=o(94545);async function s(){try{return(await r.x.fetch("/volumes",{},"GET")).map(e=>{var t,o,r;let a=e.cloud||"";return e.region&&(a+="/".concat(e.region)),e.zone&&(a+="/".concat(e.zone)),{name:e.name,launched_at:e.launched_at,user_hash:e.user_hash,user_name:e.user_name||"-",workspace:e.workspace||"-",last_attached_at:e.last_attached_at,status:e.status,type:e.type,cloud:e.cloud,region:e.region,zone:e.zone,infra:a,size:"".concat(e.size,"Gi"),config:e.config,storage_class:(null===(t=e.config)||void 0===t?void 0:t.storage_class_name)||"-",access_mode:(null===(o=e.config)||void 0===o?void 0:o.access_mode)||"-",namespace:(null===(r=e.config)||void 0===r?void 0:r.namespace)||"-",name_on_cloud:e.name_on_cloud,usedby_pods:e.usedby_pods,usedby_clusters:e.usedby_clusters}})||[]}catch(e){throw console.error("Failed to fetch volumes:",e),e}}async function n(e){let t="";try{let o=await r.x.post("/volumes/delete",{names:[e]});if(!o.ok)return console.error("Initial API request to delete volume failed with status ".concat(o.status)),{success:!1,msg:"Failed to delete volume with status ".concat(o.status)};let s=o.headers.get("X-SkyPilot-Request-ID")||o.headers.get("X-Request-ID");if(!s)return console.error("No request ID received from server for deleting volume"),{success:!1,msg:"No request ID received from server for deleting volume"};let n=await r.x.get("/api/get?request_id=".concat(s));if(!n.ok){let e=await (0,a.oN)(n);return t="Failed to delete volume with status ".concat(n.status,", error: ").concat(e),console.error(t),{success:!1,msg:t}}return{success:!0}}catch(e){return console.error(t="Failed to delete volume: ".concat(e)),{success:!1,msg:t}}}},36856:function(e,t,o){var r=o(6378),a=o(23266),s=o(68969),n=o(17324),l=o(53081),c=o(19238),i=o(32045),u=o(29326);let d={base:{getClusters:{fn:a.getClusters,args:[]},getManagedJobs:{fn:s.aT,args:[{allUsers:!0}]},getWorkspaces:{fn:n.getWorkspaces,args:[]},getUsers:{fn:l.R,args:[]},getCloudInfrastructure:{fn:i.ef,args:[!1]},getSSHNodePools:{fn:u.It,args:[]},getVolumes:{fn:c.C,args:[]}},dynamic:{getEnabledClouds:{fn:n.getEnabledClouds,requiresWorkspaces:!0}},pages:{clusters:["getClusters","getWorkspaces"],jobs:["getManagedJobs","getClusters","getWorkspaces","getUsers"],infra:["getClusters","getManagedJobs","getCloudInfrastructure","getSSHNodePools"],workspaces:["getWorkspaces","getClusters","getManagedJobs","getEnabledClouds"],users:["getUsers","getClusters","getManagedJobs"],volumes:["getVolumes"]}};class g{async preloadForPage(e,t){let{backgroundPreload:o=!0,force:r=!1}=t||{};if(!d.pages[e]){console.warn("Unknown page: ".concat(e));return}console.log("[CachePreloader] Preloading cache for page: ".concat(e));try{await this._loadPageData(e,r),o&&this._backgroundPreloadOtherPages(e)}catch(t){console.error("[CachePreloader] Error preloading for page ".concat(e,":"),t)}}async _loadPageData(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=d.pages[e],a=[];for(let e of o)if(d.base[e]){let{fn:o,args:s}=d.base[e];t&&r.default.invalidate(o,s),a.push(r.default.get(o,s).then(e=>(this._markAsPreloaded(o,s),e)))}else"getEnabledClouds"===e&&a.push(this._loadEnabledCloudsForAllWorkspaces(t));await Promise.allSettled(a),console.log("[CachePreloader] Loaded data for page: ".concat(e))}async _loadEnabledCloudsForAllWorkspaces(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{e&&r.default.invalidate(n.getWorkspaces);let t=await r.default.get(n.getWorkspaces),o=Object.keys(t||{}).map(t=>(e&&r.default.invalidate(n.getEnabledClouds,[t]),r.default.get(n.getEnabledClouds,[t])));await Promise.allSettled(o)}catch(e){console.error("[CachePreloader] Error loading enabled clouds:",e)}}_backgroundPreloadOtherPages(e){if(this.isPreloading)return;this.isPreloading=!0;let t=new Set(d.pages[e]),o=new Set;Object.keys(d.pages).filter(t=>t!==e).forEach(e=>{d.pages[e].forEach(e=>{t.has(e)||o.add(e)})}),console.log("[CachePreloader] Background preloading ".concat(o.size," unique functions: ").concat(Array.from(o).join(", "))),Promise.allSettled(Array.from(o).map(async e=>{try{if(d.base[e]){let{fn:t,args:o}=d.base[e];await r.default.get(t,o),this._markAsPreloaded(t,o)}else"getEnabledClouds"===e&&await this._loadEnabledCloudsForAllWorkspaces(!1);console.log("[CachePreloader] Background loaded function: ".concat(e))}catch(t){console.error("[CachePreloader] Background load failed for function ".concat(e,":"),t)}})).then(()=>{this.isPreloading=!1,console.log("[CachePreloader] Background preloading complete")})}async preloadBaseFunctions(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];console.log("[CachePreloader] Preloading all base functions");let t=Object.entries(d.base).map(t=>{let[o,{fn:a,args:s}]=t;return e&&r.default.invalidate(a,s),r.default.get(a,s).catch(e=>{console.error("[CachePreloader] Failed to preload ".concat(o,":"),e)})});await Promise.allSettled(t),console.log("[CachePreloader] Base functions preloaded")}getCacheStats(){return{...r.default.getStats(),isPreloading:this.isPreloading}}wasRecentlyPreloaded(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=this._generateKey(e,t),r=this.recentlyPreloaded.get(o);if(!r)return!1;let a=Date.now()-r<this.PRELOAD_GRACE_PERIOD;return a||this.recentlyPreloaded.delete(o),a}_markAsPreloaded(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=this._generateKey(e,t);this.recentlyPreloaded.set(o,Date.now())}_generateKey(e,t){let o=e.toString(),r=this._simpleHash(o),a=t.length>0?JSON.stringify(t):"";return"".concat(r,"_").concat(a)}_simpleHash(e){let t=5381;for(let o=0;o<e.length;o++)t=(t<<5)+t+e.charCodeAt(o);return t>>>0}clearCache(){r.default.clear(),this.isPreloading=!1,this.preloadPromises.clear(),this.recentlyPreloaded.clear(),console.log("[CachePreloader] Cache cleared")}constructor(){this.isPreloading=!1,this.preloadPromises=new Map,this.recentlyPreloaded=new Map,this.PRELOAD_GRACE_PERIOD=5e3}}let f=new g;r.default.setPreloader(f),t.ZP=f}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6990,2350],{30803:function(e,r,t){t.d(r,{z:function(){return i}});var o=t(85893),a=t(67294),s=t(88426),n=t(12003),c=t(32350);let l=(0,n.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),i=a.forwardRef((e,r)=>{let{className:t,variant:a,size:n,asChild:i=!1,...u}=e,d=i?s.g7:"button";return(0,o.jsx)(d,{className:(0,c.cn)(l({variant:a,size:n,className:t})),ref:r,...u})});i.displayName="Button"},37673:function(e,r,t){t.d(r,{Ol:function(){return i},Zb:function(){return l},aY:function(){return f},ll:function(){return u}});var o=t(85893),a=t(67294),s=t(45697),n=t.n(s),c=t(32350);let l=a.forwardRef((e,r)=>{let{className:t,children:a,...s}=e;return(0,o.jsx)("div",{ref:r,className:(0,c.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...s,children:a})});l.displayName="Card",l.propTypes={className:n().string,children:n().node};let i=a.forwardRef((e,r)=>{let{className:t,children:a,...s}=e;return(0,o.jsx)("div",{ref:r,className:(0,c.cn)("flex flex-col space-y-1.5 p-6",t),...s,children:a})});i.displayName="CardHeader",i.propTypes={className:n().string,children:n().node};let u=a.forwardRef((e,r)=>{let{className:t,children:a,...s}=e;return(0,o.jsx)("h3",{ref:r,className:(0,c.cn)("text-2xl font-semibold leading-none tracking-tight",t),...s,children:a})});u.displayName="CardTitle",u.propTypes={className:n().string,children:n().node};let d=a.forwardRef((e,r)=>{let{className:t,children:a,...s}=e;return(0,o.jsx)("p",{ref:r,className:(0,c.cn)("text-sm text-muted-foreground",t),...s,children:a})});d.displayName="CardDescription",d.propTypes={className:n().string,children:n().node};let f=a.forwardRef((e,r)=>{let{className:t,children:a,...s}=e;return(0,o.jsx)("div",{ref:r,className:(0,c.cn)("p-6 pt-0",t),...s,children:a})});f.displayName="CardContent",f.propTypes={className:n().string,children:n().node};let p=a.forwardRef((e,r)=>{let{className:t,children:a,...s}=e;return(0,o.jsx)("div",{ref:r,className:(0,c.cn)("flex items-center p-6 pt-0",t),...s,children:a})});p.displayName="CardFooter",p.propTypes={className:n().string,children:n().node}},17324:function(e,r,t){t.d(r,{MB:function(){return l},eA:function(){return c},getEnabledClouds:function(){return s},getWorkspaces:function(){return a},iE:function(){return u},rF:function(){return d},zl:function(){return i}});var o=t(47145);async function a(){try{let e=await o.x.get("/workspaces");if(!e.ok)throw Error("Error scheduling getWorkspaces: ".concat(e.statusText," (status ").concat(e.status,")"));let r=e.headers.get("X-Skypilot-Request-ID");if(!r){console.warn("X-Skypilot-Request-ID header not found in /workspaces response. Attempting to find request_id in response body as a fallback.");try{let t=await e.json();if(t&&t.request_id)r=t.request_id,console.log("Found request_id in /workspaces response body (fallback):",r);else throw Error("X-Skypilot-Request-ID header not found AND request_id not found in parsed response body from /workspaces.")}catch(r){let e=r.message||"Error processing fallback for request_id from /workspaces response body.";throw console.error("Error in /workspaces request_id fallback logic:",e),Error("X-Skypilot-Request-ID header not found, and fallback to read request_id from body failed: ".concat(e))}}if(!r)throw Error("Failed to obtain X-Skypilot-Request-ID from /workspaces response (checked header and attempted body fallback, but ID is still missing).");console.log("Fetching workspace data with request_id: ".concat(r));let t=await o.x.get("/api/get?request_id=".concat(r));if(!t.ok){let e="Error fetching workspace data for request ID ".concat(r,": ").concat(t.statusText," (status ").concat(t.status,")");try{let o=await t.json();if(o&&o.detail){let t=o.detail;try{let e=JSON.parse(t);e&&e.error?t=e.error:e&&e.result&&e.result.error&&(t=e.result.error)}catch(e){}e="Error fetching workspace data for request ID ".concat(r,": ").concat(t)}}catch(e){}throw Error(e)}let a=await t.json();if(console.log("[Connector Debug] Full resultData from /api/get:",a),"FAILED"===a.status){let e="Unknown error during task execution";if(a.error)"string"==typeof a.error?e=a.error:"object"==typeof a.error&&(e=a.error.message||a.error.detail||JSON.stringify(a.error));else if(a.result&&a.result.error)"string"==typeof a.result.error?e=a.result.error:"object"==typeof a.result.error&&(e=a.result.error.message||a.result.error.detail||JSON.stringify(a.result.error));else if(a.return_value)try{let r=JSON.parse(a.return_value);r.error&&(e="string"==typeof r.error?r.error:r.error.message||r.error.detail||JSON.stringify(r.error))}catch(r){(a.return_value.includes("Error")||a.return_value.includes("Cannot"))&&(e=a.return_value)}throw Error(e)}let s={};if("SUCCEEDED"===a.status&&a.return_value)try{s=JSON.parse(a.return_value),console.log("Successfully parsed workspace data from return_value:",s)}catch(e){throw console.error("Failed to parse workspace data from return_value:",e,"Raw return_value:",a.return_value),Error("Failed to parse workspace data for request ID ".concat(r,": ").concat(e.message))}else a.result&&(console.warn("Using resultData.result as fallback for status ".concat(a.status)),s=a.result);return console.log("Effectively fetched workspace data (to be returned):",s),s||{}}catch(e){throw console.error("Failed to fetch workspaces (in getWorkspaces function):",e.message,e.stack),e}}async function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{let t="/enabled_clouds",a=new URLSearchParams;e&&a.append("workspace",e),r&&a.append("expand","true"),a.toString()&&(t+="?".concat(a.toString()));let s=await o.x.get(t);if(!s.ok)throw Error("Error scheduling getEnabledClouds: ".concat(s.statusText," (status ").concat(s.status,")"));let n=s.headers.get("X-Skypilot-Request-ID");if(!n){console.warn("X-Skypilot-Request-ID header not found in /enabled_clouds response. Attempting to find request_id in response body as a fallback.");try{let e=await s.json();if(e&&e.request_id)n=e.request_id,console.log("Found request_id in /enabled_clouds response body (fallback):",n);else throw Error("X-Skypilot-Request-ID header not found AND request_id not found in parsed response body from /enabled_clouds.")}catch(r){let e=r.message||"Error processing fallback for request_id from /enabled_clouds response body.";throw console.error("Error in /enabled_clouds request_id fallback logic:",e),Error("X-Skypilot-Request-ID header not found, and fallback to read request_id from body failed: ".concat(e))}}if(!n)throw Error("Failed to obtain X-Skypilot-Request-ID from /enabled_clouds response (checked header and attempted body fallback, but ID is still missing).");console.log("Fetching enabled_clouds data with request_id: ".concat(n));let c=await o.x.get("/api/get?request_id=".concat(n));if(!c.ok){let e="Error fetching enabled_clouds data for request ID ".concat(n,": ").concat(c.statusText," (status ").concat(c.status,")");try{let r=await c.json();if(r&&r.detail){let t=r.detail;try{let e=JSON.parse(t);e&&e.error?t=e.error:e&&e.result&&e.result.error&&(t=e.result.error)}catch(e){}e="Error fetching enabled_clouds data for request ID ".concat(n,": ").concat(t)}}catch(e){}throw Error(e)}let l=await c.json();if(console.log("[Connector Debug] Full resultData from /api/get for enabled_clouds:",l),"FAILED"===l.status){let e=l.error||l.result&&l.result.error||"Unknown error during task execution for enabled_clouds";throw Error("Fetching enabled_clouds data failed for request ID ".concat(n,": ").concat(e))}let i=[];if("SUCCEEDED"===l.status&&l.return_value)try{i=JSON.parse(l.return_value),console.log("Successfully parsed enabled_clouds data for workspace ".concat(e,":"),i)}catch(e){throw console.error("Failed to parse enabled_clouds data from return_value:",e,"Raw return_value:",l.return_value),Error("Failed to parse enabled_clouds data for request ID ".concat(n,": ").concat(e.message))}else l.result&&(console.warn("Using resultData.result as fallback for enabled_clouds status ".concat(l.status)),i=l.result);return Array.isArray(i)?i:[]}catch(e){throw console.error("Failed to fetch enabled_clouds (in getEnabledClouds function):",e.message,e.stack),e}}async function n(e,r){console.log("Polling for ".concat(r," task completion with request_id: ").concat(e));let t=await o.x.get("/api/get?request_id=".concat(e));if(!t.ok){let o="Error fetching ".concat(r," data for request ID ").concat(e,": ").concat(t.statusText," (status ").concat(t.status,")");try{let e=await t.json();if(console.error("[Error Debug] ".concat(r," HTTP error response:"),JSON.stringify(e,null,2)),e&&e.detail){if("object"==typeof e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);if(t&&t.message)o="".concat(r," failed: ").concat(t.message);else if(t&&"object"==typeof t){let e=t.type||JSON.stringify(t);o="".concat(r," failed: ").concat(e)}}catch(t){o="".concat(r," failed: ").concat(e.detail.error)}else if("string"==typeof e.detail)o="".concat(r," failed: ").concat(e.detail);else{let t=function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("string"==typeof e&&(e.includes("Cannot")||e.includes("Error")||e.includes("Failed")))return e;if("object"==typeof e&&null!==e)for(let[o,a]of Object.entries(e)){let e=t(a,r?"".concat(r,".").concat(o):o);if(e)return e}return null},a=t(e.detail);a&&(o="".concat(r," failed: ").concat(a))}}}catch(e){console.error("[Error Debug] Failed to parse error response:",e)}throw Error(o)}let a=await t.json();if(console.log("[Connector Debug] ".concat(r," resultData:"),a),"FAILED"===a.status){console.error("[Error Debug] ".concat(r," failed. Full resultData:"),JSON.stringify(a,null,2)),console.error("[Error Debug] resultData.error:",a.error),console.error("[Error Debug] resultData.result:",a.result),console.error("[Error Debug] resultData.return_value:",a.return_value);let e="Unknown error during ".concat(r," task execution");if(a.error)"string"==typeof a.error?e=a.error:"object"==typeof a.error&&(e=a.error.message||a.error.detail||JSON.stringify(a.error));else if(a.result&&a.result.error)"string"==typeof a.result.error?e=a.result.error:"object"==typeof a.result.error&&(e=a.result.error.message||a.result.error.detail||JSON.stringify(a.result.error));else if(a.return_value)try{let r=JSON.parse(a.return_value);r.error&&(e="string"==typeof r.error?r.error:r.error.message||r.error.detail||JSON.stringify(r.error))}catch(r){a.return_value&&(a.return_value.includes("Error")||a.return_value.includes("Cannot"))&&(e=a.return_value)}if(e==="Unknown error during ".concat(r," task execution")){let r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if("string"==typeof e&&(e.includes("Cannot")||e.includes("Error")||e.includes("Failed")))return e;if("object"==typeof e&&null!==e)for(let[o,a]of Object.entries(e)){let e=r(a,t?"".concat(t,".").concat(o):o);if(e)return e}return null},t=r(a);t&&(e=t)}throw Error(e)}let s={};if("SUCCEEDED"===a.status&&a.return_value)try{s=JSON.parse(a.return_value),console.log("Successfully parsed ".concat(r," data:"),s)}catch(t){throw console.error("Failed to parse ".concat(r," data from return_value:"),t,"Raw return_value:",a.return_value),Error("Failed to parse ".concat(r," data for request ID ").concat(e,": ").concat(t.message))}else a.result&&(console.warn("Using resultData.result as fallback for ".concat(r," status ").concat(a.status)),s=a.result);return s}async function c(e,r){try{console.log("Updating workspace ".concat(e," with config:"),r);let t=await o.x.post("/workspaces/update",{workspace_name:e,config:r});if(!t.ok)throw Error("Error scheduling updateWorkspace: ".concat(t.statusText," (status ").concat(t.status,")"));let a=t.headers.get("X-Skypilot-Request-ID");if(!a)throw Error("Failed to obtain request ID for updateWorkspace");return await n(a,"updateWorkspace")}catch(e){throw console.error("Failed to update workspace:",e),e}}let l=async(e,r)=>{try{let t=await o.x.post("/workspaces/create",{workspace_name:e,config:r});if(!t.ok)throw await t.text(),Error("Error scheduling createWorkspace: ".concat(t.statusText," (status ").concat(t.status,")"));let a=t.headers.get("X-Skypilot-Request-ID");if(!a)throw Error("Failed to obtain request ID for createWorkspace");return await n(a,"createWorkspace")}catch(e){throw console.error("Failed to create workspace:",e),e}};async function i(e){try{console.log("Deleting workspace ".concat(e));let r=await o.x.post("/workspaces/delete",{workspace_name:e});if(!r.ok)throw Error("Error scheduling deleteWorkspace: ".concat(r.statusText," (status ").concat(r.status,")"));let t=r.headers.get("X-Skypilot-Request-ID");if(!t)throw Error("Failed to obtain request ID for deleteWorkspace");console.log("[Delete Debug] Got request ID for deleteWorkspace: ".concat(t));try{let e=await n(t,"deleteWorkspace");return console.log("[Delete Debug] deleteWorkspace completed successfully:",e),e}catch(e){throw console.error("[Delete Debug] deleteWorkspace failed with error:",e),console.error("[Delete Debug] Error message:",e.message),e}}catch(e){throw console.error("Failed to delete workspace:",e),e}}async function u(){try{console.log("Getting entire SkyPilot configuration");let e=await o.x.get("/workspaces/config");if(!e.ok)throw Error("Error scheduling getConfig: ".concat(e.statusText," (status ").concat(e.status,")"));let r=e.headers.get("X-Skypilot-Request-ID");if(!r)throw Error("Failed to obtain request ID for getConfig");return await n(r,"getConfig")}catch(e){throw console.error("Failed to get config:",e),e}}async function d(e){try{console.log("Updating entire SkyPilot configuration with config:",e);let r=await o.x.post("/workspaces/config",{config:e});if(!r.ok)throw Error("Error scheduling updateConfig: ".concat(r.statusText," (status ").concat(r.status,")"));let t=r.headers.get("X-Skypilot-Request-ID");if(!t)throw Error("Failed to obtain request ID for updateConfig");return await n(t,"updateConfig")}catch(e){throw console.error("Failed to update config:",e),e}}},32350:function(e,r,t){t.d(r,{cn:function(){return s}});var o=t(90512),a=t(98388);function s(){for(var e=arguments.length,r=Array(e),t=0;t<e;t++)r[t]=arguments[t];return(0,a.m6)((0,o.W)(r))}}}]);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7359,2369],{27325:function(e,t,n){n.d(t,{Z:function(){return r}});/**
|
|
2
|
+
* @license lucide-react v0.407.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/let r=(0,n(60998).Z)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},16826:function(e,t,n){n.d(t,{Z:function(){return r}});/**
|
|
7
|
+
* @license lucide-react v0.407.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/let r=(0,n(60998).Z)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},6521:function(e,t,n){n.d(t,{Z:function(){return r}});/**
|
|
12
|
+
* @license lucide-react v0.407.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/let r=(0,n(60998).Z)("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]])},23293:function(e,t,n){n.d(t,{Z:function(){return r}});/**
|
|
17
|
+
* @license lucide-react v0.407.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/let r=(0,n(60998).Z)("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]])},13626:function(e,t,n){n.d(t,{Z:function(){return r}});/**
|
|
22
|
+
* @license lucide-react v0.407.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/let r=(0,n(60998).Z)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},6327:function(e,t,n){n.d(t,{x8:function(){return eu},VY:function(){return eo},dk:function(){return ea},aV:function(){return er},h_:function(){return en},fC:function(){return ee},Dx:function(){return ei},xz:function(){return et}});var r=n(67294),o=n(36206),i=n(28771),a=n(25360),u=n(91276),l=n(77342),s=n(46063),c=n(95420),d=n(42651),f=n(9981),p=e=>{let t,n;let{present:o,children:a}=e,u=function(e){var t,n;let[o,i]=r.useState(),a=r.useRef(null),u=r.useRef(e),l=r.useRef("none"),[s,c]=(t=e?"mounted":"unmounted",n={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},r.useReducer((e,t)=>n[e][t]??e,t));return r.useEffect(()=>{let e=m(a.current);l.current="mounted"===s?e:"none"},[s]),(0,f.b)(()=>{let t=a.current,n=u.current;if(n!==e){let r=l.current,o=m(t);e?c("MOUNT"):"none"===o||t?.display==="none"?c("UNMOUNT"):n&&r!==o?c("ANIMATION_OUT"):c("UNMOUNT"),u.current=e}},[e,c]),(0,f.b)(()=>{if(o){let e;let t=o.ownerDocument.defaultView??window,n=n=>{let r=m(a.current).includes(n.animationName);if(n.target===o&&r&&(c("ANIMATION_END"),!u.current)){let n=o.style.animationFillMode;o.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===o.style.animationFillMode&&(o.style.animationFillMode=n)})}},r=e=>{e.target===o&&(l.current=m(a.current))};return o.addEventListener("animationstart",r),o.addEventListener("animationcancel",n),o.addEventListener("animationend",n),()=>{t.clearTimeout(e),o.removeEventListener("animationstart",r),o.removeEventListener("animationcancel",n),o.removeEventListener("animationend",n)}}c("ANIMATION_END")},[o,c]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:r.useCallback(e=>{a.current=e?getComputedStyle(e):null,i(e)},[])}}(o),l="function"==typeof a?a({present:u.isPresent}):r.Children.only(a),s=(0,i.e)(u.ref,(t=Object.getOwnPropertyDescriptor(l.props,"ref")?.get)&&"isReactWarning"in t&&t.isReactWarning?l.ref:(t=Object.getOwnPropertyDescriptor(l,"ref")?.get)&&"isReactWarning"in t&&t.isReactWarning?l.props.ref:l.props.ref||l.ref);return"function"==typeof a||u.isPresent?r.cloneElement(l,{ref:s}):null};function m(e){return e?.animationName||"none"}p.displayName="Presence";var g=n(75320),y=n(27552),h=n(6223),v=n(23541),N=n(88426),M=n(85893),D="Dialog",[x,R]=(0,a.b)(D),[w,O]=x(D),b=e=>{let{__scopeDialog:t,children:n,open:o,defaultOpen:i,onOpenChange:a,modal:s=!0}=e,c=r.useRef(null),d=r.useRef(null),[f,p]=(0,l.T)({prop:o,defaultProp:i??!1,onChange:a,caller:D});return(0,M.jsx)(w,{scope:t,triggerRef:c,contentRef:d,contentId:(0,u.M)(),titleId:(0,u.M)(),descriptionId:(0,u.M)(),open:f,onOpenChange:p,onOpenToggle:r.useCallback(()=>p(e=>!e),[p]),modal:s,children:n})};b.displayName=D;var j="DialogTrigger",k=r.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,a=O(j,n),u=(0,i.e)(t,a.triggerRef);return(0,M.jsx)(g.WV.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":K(a.open),...r,ref:u,onClick:(0,o.M)(e.onClick,a.onOpenToggle)})});k.displayName=j;var I="DialogPortal",[C,E]=x(I,{forceMount:void 0}),_=e=>{let{__scopeDialog:t,forceMount:n,children:o,container:i}=e,a=O(I,t);return(0,M.jsx)(C,{scope:t,forceMount:n,children:r.Children.map(o,e=>(0,M.jsx)(p,{present:n||a.open,children:(0,M.jsx)(d.h,{asChild:!0,container:i,children:e})}))})};_.displayName=I;var T="DialogOverlay",F=r.forwardRef((e,t)=>{let n=E(T,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=O(T,e.__scopeDialog);return i.modal?(0,M.jsx)(p,{present:r||i.open,children:(0,M.jsx)(P,{...o,ref:t})}):null});F.displayName=T;var A=(0,N.Z8)("DialogOverlay.RemoveScroll"),P=r.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,o=O(T,n);return(0,M.jsx)(h.Z,{as:A,allowPinchZoom:!0,shards:[o.contentRef],children:(0,M.jsx)(g.WV.div,{"data-state":K(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),W="DialogContent",Z=r.forwardRef((e,t)=>{let n=E(W,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=O(W,e.__scopeDialog);return(0,M.jsx)(p,{present:r||i.open,children:i.modal?(0,M.jsx)(U,{...o,ref:t}):(0,M.jsx)(V,{...o,ref:t})})});Z.displayName=W;var U=r.forwardRef((e,t)=>{let n=O(W,e.__scopeDialog),a=r.useRef(null),u=(0,i.e)(t,n.contentRef,a);return r.useEffect(()=>{let e=a.current;if(e)return(0,v.Ry)(e)},[]),(0,M.jsx)(L,{...e,ref:u,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,o.M)(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:(0,o.M)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=0===t.button&&!0===t.ctrlKey;(2===t.button||n)&&e.preventDefault()}),onFocusOutside:(0,o.M)(e.onFocusOutside,e=>e.preventDefault())})}),V=r.forwardRef((e,t)=>{let n=O(W,e.__scopeDialog),o=r.useRef(!1),i=r.useRef(!1);return(0,M.jsx)(L,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(o.current||n.triggerRef.current?.focus(),t.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(o.current=!0,"pointerdown"!==t.detail.originalEvent.type||(i.current=!0));let r=t.target;n.triggerRef.current?.contains(r)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&i.current&&t.preventDefault()}})}),L=r.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:a,onCloseAutoFocus:u,...l}=e,d=O(W,n),f=r.useRef(null),p=(0,i.e)(t,f);return(0,y.EW)(),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(c.M,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:a,onUnmountAutoFocus:u,children:(0,M.jsx)(s.XB,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":K(d.open),...l,ref:p,onDismiss:()=>d.onOpenChange(!1)})}),(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(J,{titleId:d.titleId}),(0,M.jsx)(Q,{contentRef:f,descriptionId:d.descriptionId})]})]})}),S="DialogTitle",q=r.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,o=O(S,n);return(0,M.jsx)(g.WV.h2,{id:o.titleId,...r,ref:t})});q.displayName=S;var $="DialogDescription",H=r.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,o=O($,n);return(0,M.jsx)(g.WV.p,{id:o.descriptionId,...r,ref:t})});H.displayName=$;var B="DialogClose",z=r.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=O(B,n);return(0,M.jsx)(g.WV.button,{type:"button",...r,ref:t,onClick:(0,o.M)(e.onClick,()=>i.onOpenChange(!1))})});function K(e){return e?"open":"closed"}z.displayName=B;var X="DialogTitleWarning",[Y,G]=(0,a.k)(X,{contentName:W,titleName:S,docsSlug:"dialog"}),J=({titleId:e})=>{let t=G(X),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
27
|
+
|
|
28
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
29
|
+
|
|
30
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return r.useEffect(()=>{e&&!document.getElementById(e)&&console.error(n)},[n,e]),null},Q=({contentRef:e,descriptionId:t})=>{let n=G("DialogDescriptionWarning"),o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${n.contentName}}.`;return r.useEffect(()=>{let n=e.current?.getAttribute("aria-describedby");t&&n&&!document.getElementById(t)&&console.warn(o)},[o,e,t]),null},ee=b,et=k,en=_,er=F,eo=Z,ei=q,ea=H,eu=z}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7615],{47615:function(e,t,s){s.r(t),s.d(t,{ClusterJobs:function(){return J},ManagedJobs:function(){return P},ManagedJobsTable:function(){return U},Status2Actions:function(){return O},filterJobsByName:function(){return M},filterJobsByPool:function(){return A},filterJobsByUser:function(){return I},filterJobsByWorkspace:function(){return F},statusGroups:function(){return R}});var r=s(85893),a=s(67294),n=s(11163),l=s(41664),i=s.n(l),c=s(55739),o=s(30803),d=s(37673),u=s(68764),h=s(36989),x=s(51214),m=s(68969),p=s(6378);class j{_generateFilterKey(e){let{allUsers:t=!0,nameMatch:s,userMatch:r,workspaceMatch:a,poolMatch:n,statuses:l}=e;return["allUsers:".concat(t),s?"name:".concat(s):"",r?"user:".concat(r):"",a?"workspace:".concat(a):"",n?"pool:".concat(n):"",l&&l.length>0?"statuses:".concat(l.sort().join(",")):""].filter(Boolean).join("|")||"default"}_getCacheStatus(e){let t=this.fullDataCache.get(e),s=Date.now();if(!t)return{isCached:!1,isFresh:!1,age:0,maxAge:12e4,hasData:!1};let r=s-t.timestamp;return{isCached:!0,isFresh:r<12e4,age:r,maxAge:12e4,hasData:t.jobs&&Array.isArray(t.jobs),data:t}}async getPaginatedJobs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{page:t=1,limit:s=10,...r}=e,a=this._generateFilterKey(r);try{let e=this._getCacheStatus(a);if(e.isCached&&e.hasData){let n=e.data;if(!n.jobs||Array.isArray(n.jobs)&&0===n.jobs.length){if(!this.prefetching.has(a)){let e=this._loadFullDataset(r,a).catch(()=>{}).finally(()=>this.prefetching.delete(a));this.prefetching.set(a,e)}}else{let l=(t-1)*s,i=n.jobs.slice(l,l+s);if(!this.prefetching.has(a)&&(!e.isFresh||e.age>e.maxAge/2)){let e=this._loadFullDataset(r,a).catch(()=>{}).finally(()=>this.prefetching.delete(a));this.prefetching.set(a,e)}return{jobs:i,total:n.total,totalNoFilter:n.totalNoFilter||n.total,controllerStopped:n.controllerStopped,statusCounts:n.statusCounts||{},fromCache:!0,cacheStatus:e.isFresh?"local_cache_hit":"local_cache_stale_hit"}}}let n=await p.default.get(m.getManagedJobs,[{...r,page:t,limit:s}]),l=(null==n?void 0:n.jobs)||[],i="number"==typeof(null==n?void 0:n.total)?n.total:l.length,c=!!(null==n?void 0:n.controllerStopped);if(!this.prefetching.has(a)){let e=this._loadFullDataset(r,a).catch(e=>{console.warn("Background prefetch of full jobs failed:",e)}).finally(()=>{this.prefetching.delete(a)});this.prefetching.set(a,e)}return{jobs:l,total:i,totalNoFilter:(null==n?void 0:n.totalNoFilter)||i,controllerStopped:c,statusCounts:(null==n?void 0:n.statusCounts)||{},fromCache:!1,cacheStatus:"server_page_fetch"}}catch(e){throw console.error("Error in getPaginatedJobs:",e),e}}async _loadFullDataset(e,t){let s=await p.default.get(m.getManagedJobs,[e]);if(s&&s.__skipCache||s.controllerStopped||!s.jobs)return s;let r={jobs:s.jobs,total:s.jobs.length,totalNoFilter:s.totalNoFilter||s.jobs.length,controllerStopped:!1,statusCounts:s.statusCounts||{},timestamp:Date.now()};return this.fullDataCache.set(t,r),r}isDataLoading(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this._generateFilterKey(e);return this.isLoading.has(t)||this.prefetching.has(t)}isDataCached(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this._generateFilterKey(e),s=this._getCacheStatus(t);return s.isCached&&s.isFresh&&s.hasData}getCacheStatus(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this._generateFilterKey(e);return this._getCacheStatus(t)}invalidateCache(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(e){let t=this._generateFilterKey(e);this.fullDataCache.delete(t),this.isLoading.delete(t),this.prefetching.delete(t)}else this.fullDataCache.clear(),this.isLoading.clear(),this.prefetching.clear();p.default.invalidateFunction(m.getManagedJobs)}getCacheStats(){let e={cachedFilters:Array.from(this.fullDataCache.keys()),loadingFilters:Array.from(this.isLoading.keys()),prefetchingFilters:Array.from(this.prefetching.keys()),cacheSize:this.fullDataCache.size,loadingCount:this.isLoading.size,prefetchingCount:this.prefetching.size};for(let[t,s]of(e.detailedStatus={},this.fullDataCache.entries())){let r=this._getCacheStatus(t);e.detailedStatus[t]={age:r.age,isFresh:r.isFresh,hasData:r.hasData,jobCount:s.jobs?s.jobs.length:0}}return e}constructor(){this.fullDataCache=new Map,this.isLoading=new Map,this.prefetching=new Map}}let f=new j;var g=s(23266),b=s(17324),v=s(13626),w=s(23293),y=s(6521),N=s(16826),k=s(92128),C=s(94545),S=s(99307),L=s(20546),_=s(23001),E=s(10546);let R={active:["PENDING","RUNNING","RECOVERING","SUBMITTED","STARTING","CANCELLING"],finished:["SUCCEEDED","FAILED","CANCELLED","FAILED_SETUP","FAILED_PRECHECKS","FAILED_NO_RESOURCE","FAILED_CONTROLLER"]},D=[{label:"Name",value:"name"},{label:"User",value:"user"},{label:"Workspace",value:"workspace"},{label:"Pool",value:"pool"}];function M(e,t){if(!t||""===t.trim())return e;let s=t.toLowerCase().trim();return e.filter(e=>(e.name||"").toLowerCase().includes(s))}function F(e,t){return t&&"ALL_WORKSPACES"!==t?e.filter(e=>(e.workspace||"default").toLowerCase()===t.toLowerCase()):e}function I(e,t){return t&&"ALL_USERS"!==t?e.filter(e=>(e.user_hash||e.user)===t):e}function A(e,t){if(!t||""===t.trim())return e;let s=t.toLowerCase().trim();return e.filter(e=>(e.pool||"").toLowerCase().includes(s))}let z=e=>{if(!e)return"-";let t=e instanceof Date?e:new Date(1e3*e);return(0,r.jsx)(h.Zg,{date:t})};function P(){let e=(0,n.useRouter)(),[t,s]=(0,a.useState)(!1),[l,c]=(0,a.useState)(!0),[o,d]=(0,a.useState)(!0),u=a.useRef(null),x=a.useRef(null),[j,g]=(0,a.useState)([]),[v,w]=(0,a.useState)([]),[y,N]=(0,a.useState)({name:[],user:[],workspace:[],pool:[]}),k=a.useCallback(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];s(!0),!e&&o&&c(!0);try{let[e]=await Promise.all([p.default.get(m.vs,[{}])]);g(e.pools||[])}catch(e){console.error("Error fetching data:",e)}finally{s(!1),!e&&o&&(c(!1),d(!1))}},[o]);(0,a.useEffect)(()=>{k()},[k]);let C=t=>{(0,E.eG)(e,t)},S=a.useCallback(()=>{let t=new Map;t.set("",""),t.set("status","Status"),t.set("name","Name"),t.set("user","User"),t.set("workspace","Workspace"),t.set("pool","Pool"),w((0,E.Fu)(e,t))},[e,w]);return(0,a.useEffect)(()=>{e.isReady&&S()},[e.isReady,e.query.tab,S]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[(0,r.jsx)("div",{className:"text-base",children:(0,r.jsx)(i(),{href:"/jobs",className:"text-sky-blue hover:underline leading-none",children:"Managed Jobs"})}),(0,r.jsx)("div",{className:"w-full sm:w-auto",children:(0,r.jsx)(E.ML,{propertyList:D,valueList:y,setFilters:w,updateURLParams:C,placeholder:"Filter jobs"})})]}),(0,r.jsx)(E.x$,{filters:v,setFilters:w,updateURLParams:C}),(0,r.jsx)(U,{refreshInterval:h.yc,setLoading:s,refreshDataRef:u,filters:v,onRefresh:()=>{f.invalidateCache(),p.default.invalidate(m.vs,[{}]),p.default.invalidate(b.getWorkspaces),u.current&&u.current(),x.current&&x.current()},poolsData:j,poolsLoading:l,setValueList:N}),(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsx)(Z,{refreshInterval:h.yc,setLoading:s,refreshDataRef:x})})]})}function U(e){let{refreshInterval:t,setLoading:s,refreshDataRef:n,filters:l,onRefresh:j,poolsData:b,poolsLoading:y,setValueList:N}=e,[E,D]=(0,a.useState)([]),[M,F]=(0,a.useState)(0),[I,A]=(0,a.useState)(0),[P,U]=(0,a.useState)({key:null,direction:"ascending"}),[J,Z]=(0,a.useState)(!1),[B,G]=(0,a.useState)(!0),[H,K]=(0,a.useState)(1),[q,V]=(0,a.useState)(10),[Y,$]=(0,a.useState)(null),Q=(0,a.useRef)(null),[X,ee]=(0,a.useState)([]),[et,es]=(0,a.useState)({}),[er,ea]=(0,a.useState)({}),[en,el]=(0,a.useState)(!1),[ei,ec]=(0,a.useState)(!1),[eo,ed]=(0,a.useState)(!1),[eu,eh]=(0,a.useState)("all"),[ex,em]=(0,a.useState)(!0),[ep,ej]=(0,a.useState)({isOpen:!1,title:"",message:"",onConfirm:null}),ef=(0,_.X)(),eg=(0,a.useRef)(0),eb=a.useMemo(()=>{if(!E||0===E.length)return!1;let e=new Set(E.map(e=>e.workspace||"default"));return e.size>1||1===e.size&&!e.has("default")},[E]),ev=a.useMemo(()=>b&&b.length>0,[b]),ew=async()=>{ej({isOpen:!0,title:"Restart Controller",message:"Are you sure you want to restart the controller?",onConfirm:async()=>{try{ed(!0),Z(!0),await (0,m.Ce)("restartcontroller"),await ey()}catch(e){console.error("Error restarting controller:",e)}finally{ed(!1),Z(!1)}}})},ey=a.useCallback(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=!1!==e.includeStatus,r=eg.current+1;eg.current=r,Z(!0),s(!0);try{let e;let s=e=>{let t=(l||[]).find(t=>(t.property||"").toLowerCase()===e);return t&&t.value?String(t.value):void 0};X.length>0?e=X:ex?"active"===eu?e=R.active:"finished"===eu&&(e=R.finished):e=[];let a={allUsers:!0,nameMatch:s("name"),userMatch:s("user"),workspaceMatch:s("workspace"),poolMatch:s("pool"),statuses:e,page:H,limit:q},n=null;if(f.isDataCached(a),f.isDataLoading(a),t)try{n=await p.default.get(g.getClusters)}catch(e){console.error("Error fetching clusters:",e)}let{jobs:i=[],total:c=0,totalNoFilter:o=0,controllerStopped:d=!1,cacheStatus:u="unknown",statusCounts:h={}}=await f.getPaginatedJobs(a)||{},x=!1,m=!1;if(t&&n){let e=null==n?void 0:n.find(e=>(0,C.Ym)(e.cluster)),t=e?e.status:"NOT_FOUND";"STOPPED"==t&&d&&(x=!0),"LAUNCHING"==t&&(m=!0)}r===eg.current&&(D(i),F(c||0),A(o||0),el(!!x),ec(!!m),ea(h),G(!1))}catch(e){console.error("Error fetching data:",e),r===eg.current&&(D([]),el(!1),G(!1))}finally{r===eg.current&&(Z(!1),s(!1))}},[s,l,H,q,X,ex,eu]);a.useEffect(()=>{n&&(n.current=ey)},[n,ey]);let eN=a.useRef(ey);a.useEffect(()=>{eN.current=ey},[ey]);let ek=a.useRef(!0);a.useEffect(()=>{ey({includeStatus:!0}),ek.current=!1},[ey]),a.useEffect(()=>{ek.current||ey({includeStatus:!1})},[H,ey]),a.useEffect(()=>{ek.current||ey({includeStatus:!0})},[l,q,ey]),a.useEffect(()=>{ek.current||ey({includeStatus:!0})},[eu,X,ex,ey]),(0,a.useEffect)(()=>{let e=setInterval(()=>{eN.current&&"visible"===window.document.visibilityState&&eN.current({includeStatus:!0})},t);return()=>{clearInterval(e)}},[t]),(0,a.useEffect)(()=>{K(1)},[eu]),(0,a.useEffect)(()=>{K(1)},[l,q]),(0,a.useEffect)(()=>{ee([]),em(!0)},[eu]),(0,a.useEffect)(()=>{if(!N)return;let e=new Set,t=new Set,s=new Set,r=new Set;E.forEach(a=>{a.name&&e.add(a.name),a.user&&t.add(a.user),a.workspace&&s.add(a.workspace),a.pool&&r.add(a.pool)}),b&&Array.isArray(b)&&b.forEach(e=>{if(!e.name)return;let t=e.jobCounts&&Object.keys(e.jobCounts).length>0,s=null!==e.uptime&&void 0!==e.uptime&&e.uptime>0&&e.uptime<86400;(t||s)&&r.add(e.name)}),N({name:Array.from(e).sort(),user:Array.from(t).sort(),workspace:Array.from(s).sort(),pool:Array.from(r).sort()})},[E,b,N]);let eC=e=>{let t="ascending";P.key===e&&"ascending"===P.direction&&(t="descending"),U({key:e,direction:t})},eS=e=>P.key===e?"ascending"===P.direction?" ↑":" ↓":"";a.useMemo(()=>{let e=E||[];return{active:e.filter(e=>R.active.includes(e.status)).length,finished:e.filter(e=>R.finished.includes(e.status)).length}},[E]);let eL=e=>X.length>0?X.includes(e):"all"===eu||R[eu].includes(e),e_=a.useMemo(()=>E,[E]),eE=a.useMemo(()=>P.key?[...e_].sort((e,t)=>e[P.key]<t[P.key]?"ascending"===P.direction?-1:1:e[P.key]>t[P.key]?"ascending"===P.direction?1:-1:0):e_,[e_,P]),eR=(H-1)*q,eD=M>0?Math.ceil(M/q):0,eM=M>0?Math.min(eR+eE.length,M):0,eF=e=>{if(X.includes(e)){let t=X.filter(t=>t!==e);0===t.length?(em(!0),ee([])):(ee(t),em(!1))}else ee([...X,e]),em(!1);K(1)};return(0,a.useEffect)(()=>{es(er)},[er]),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("div",{className:"flex flex-col space-y-1 mb-1",children:(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between text-sm mb-1",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center",children:[(0,r.jsx)("span",{className:"mr-2 text-sm font-medium",children:"Statuses:"}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-2 items-center",children:[!J&&0===I&&!B&&(0,r.jsx)("span",{className:"text-gray-500 mr-2",children:"No jobs found"}),Object.entries(et).map(e=>{let[t,s]=e;return(0,r.jsxs)("button",{onClick:()=>eF(t),className:"px-3 py-0.5 rounded-full flex items-center space-x-2 ".concat(eL(t)||X.includes(t)?(0,S.Cl)(t):"bg-gray-50 text-gray-600 hover:bg-gray-100"),children:[(0,r.jsx)("span",{children:t}),(0,r.jsx)("span",{className:"text-xs ".concat(eL(t)||X.includes(t)?"bg-white/50":"bg-gray-200"," px-1.5 py-0.5 rounded"),children:s})]},t)}),I>0&&(0,r.jsxs)("div",{className:"flex items-center ml-2 gap-2",children:[(0,r.jsx)("span",{className:"text-gray-500",children:"("}),(0,r.jsx)("button",{onClick:()=>{a.startTransition(()=>{eh("all"),ee([]),em(!0),K(1)})},className:"text-sm font-medium ".concat("all"===eu&&ex?"text-purple-700 underline":"text-gray-600 hover:text-purple-700 hover:underline"),children:"show all jobs"}),(0,r.jsx)("span",{className:"text-gray-500 mx-1",children:"|"}),(0,r.jsx)("button",{onClick:()=>{a.startTransition(()=>{eh("active"),ee([]),em(!0),K(1)})},className:"text-sm font-medium ".concat("active"===eu&&ex?"text-green-700 underline":"text-gray-600 hover:text-green-700 hover:underline"),children:"show all active jobs"}),(0,r.jsx)("span",{className:"text-gray-500 mx-1",children:"|"}),(0,r.jsx)("button",{onClick:()=>{a.startTransition(()=>{eh("finished"),ee([]),em(!0),K(1)})},className:"text-sm font-medium ".concat("finished"===eu&&ex?"text-blue-700 underline":"text-gray-600 hover:text-blue-700 hover:underline"),children:"show all finished jobs"}),(0,r.jsx)("span",{className:"text-gray-500",children:")"})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[J&&(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(c.Z,{size:15,className:"mt-0"}),(0,r.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Loading..."})]}),(0,r.jsxs)("button",{onClick:()=>{j&&j()},disabled:J,className:"text-sky-blue hover:text-sky-blue-bright flex items-center text-sm",children:[(0,r.jsx)(v.Z,{className:"h-4 w-4 mr-1.5"}),(0,r.jsx)("span",{children:"Refresh"})]})]})]})}),ef&&en&&0===eE.length&&!J&&!B&&(0,r.jsx)("div",{className:"mb-4 p-4 bg-gray-50 rounded-lg border",children:(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-3",children:[(0,r.jsxs)("p",{className:"text-gray-700 text-center text-sm",children:["Job controller stopped.",(0,r.jsx)("br",{}),"Restart to check status."]}),(0,r.jsx)(o.z,{variant:"outline",size:"sm",onClick:ew,className:"text-sky-blue hover:text-sky-blue-bright",disabled:J||eo,children:eo?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.Z,{size:12,className:"mr-2"}),"Restarting..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(w.Z,{className:"h-4 w-4 mr-2"}),"Restart"]})})]})}),(0,r.jsx)(d.Zb,{children:(0,r.jsx)("div",{className:"overflow-x-auto rounded-lg",children:(0,r.jsxs)(u.iA,{className:"min-w-full",children:[(0,r.jsx)(u.xD,{children:(0,r.jsxs)(u.SC,{children:[(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("id"),children:["ID",eS("id")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("name"),children:["Name",eS("name")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("user"),children:["User",eS("user")]}),eb&&(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("workspace"),children:["Workspace",eS("workspace")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("submitted_at"),children:["Submitted",eS("submitted_at")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("job_duration"),children:["Duration",eS("job_duration")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("status"),children:["Status",eS("status")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("infra"),children:["Infra",eS("infra")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("cluster"),children:["Resources",eS("cluster")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("recoveries"),children:["Recoveries",eS("recoveries")]}),ev&&(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>eC("pool"),children:["Pool",eS("pool")]}),(0,r.jsx)(u.ss,{children:"Details"}),(0,r.jsx)(u.ss,{children:"Logs"})]})}),(0,r.jsx)(u.RM,{children:J&&B?(0,r.jsx)(u.SC,{children:(0,r.jsx)(u.pj,{colSpan:11+(eb?1:0)+(ev?1:0),className:"text-center py-6 text-gray-500",children:(0,r.jsxs)("div",{className:"flex justify-center items-center",children:[(0,r.jsx)(c.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]})})}):eE.length>0?(0,r.jsx)(r.Fragment,{children:eE.map(e=>(0,r.jsxs)(a.Fragment,{children:[(0,r.jsxs)(u.SC,{children:[(0,r.jsx)(u.pj,{children:(0,r.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.id})}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.name})}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(L.H,{username:e.user,userHash:e.user_hash})}),eb&&(0,r.jsx)(u.pj,{children:(0,r.jsx)(i(),{href:"/workspaces",className:"text-gray-700 hover:text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,r.jsx)(u.pj,{children:z(e.submitted_at)}),(0,r.jsx)(u.pj,{children:(0,h.LU)(e.job_duration)}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(S.OE,{status:e.status})}),(0,r.jsx)(u.pj,{children:e.infra&&"-"!==e.infra?(0,r.jsx)(h.Md,{content:e.full_infra||e.infra,className:"text-sm text-muted-foreground",children:(0,r.jsxs)("span",{children:[(0,r.jsx)(i(),{href:"/infra",className:"text-blue-600 hover:underline",children:e.cloud||e.infra.split("(")[0].trim()}),e.infra.includes("(")&&(0,r.jsx)("span",{children:" "+(()=>{let t=x.MO.NAME_TRUNCATE_LENGTH,s=e.infra.substring(e.infra.indexOf("(")),r=s.substring(1,s.length-1);if(r.length<=t)return s;let a="".concat(r.substring(0,Math.floor((t-3)/2)),"...").concat(r.substring(r.length-Math.ceil((t-3)/2)));return"(".concat(a,")")})()})]})}):(0,r.jsx)("span",{children:e.infra||"-"})}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(h.Md,{content:e.resources_str_full||e.resources_str,className:"text-sm text-muted-foreground",children:(0,r.jsx)("span",{children:e.resources_str})})}),(0,r.jsx)(u.pj,{children:e.recoveries}),ev&&(0,r.jsx)(u.pj,{children:(0,r.jsx)("div",{className:y?"blur-sm transition-all duration-300":"",children:y?"-":(0,h.os)(e.pool,e.pool_hash,b)})}),(0,r.jsx)(u.pj,{children:e.details?(0,r.jsx)(T,{text:e.details,rowId:e.id,expandedRowId:Y,setExpandedRowId:$}):"-"}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(O,{jobParent:"/jobs",jobId:e.id,managed:!0,workspace:e.workspace})})]}),Y===e.id&&(0,r.jsx)(W,{text:e.details,colSpan:11+(eb?1:0)+(ev?1:0),innerRef:Q})]},e.task_job_id))}):(0,r.jsx)(u.SC,{children:(0,r.jsx)(u.pj,{colSpan:11+(eb?1:0)+(ev?1:0),className:"text-center py-6",children:(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[ei&&(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,r.jsx)("p",{className:"text-gray-700",children:"The managed job controller is launching. It will be ready shortly."}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(c.Z,{size:12,className:"mr-2"}),(0,r.jsx)("span",{className:"text-gray-500",children:"Launching..."})]})]}),!en&&!ei&&(0,r.jsx)("p",{className:"text-gray-500",children:"No active jobs"}),!ef&&en&&(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-3 px-4",children:[(0,r.jsx)("p",{className:"text-gray-700 text-center text-sm sm:text-base max-w-md",children:"The managed job controller has been stopped. Restart to check the latest job status."}),(0,r.jsx)(o.z,{variant:"outline",size:"sm",onClick:ew,className:"text-sky-blue hover:text-sky-blue-bright",disabled:J||eo,children:eo?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(c.Z,{size:12,className:"mr-2"}),"Restarting..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(w.Z,{className:"h-4 w-4 mr-2"}),"Restart Controller"]})})]})]})})})})]})})}),(0,r.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,r.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,r.jsxs)("div",{className:"relative inline-block",children:[(0,r.jsxs)("select",{value:q,onChange:e=>{V(parseInt(e.target.value,10)),K(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,r.jsx)("option",{value:10,children:"10"}),(0,r.jsx)("option",{value:30,children:"30"}),(0,r.jsx)("option",{value:50,children:"50"}),(0,r.jsx)("option",{value:100,children:"100"}),(0,r.jsx)("option",{value:200,children:"200"})]}),(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-gray-500 absolute right-0 top-1/2 transform -translate-y-1/2 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,r.jsx)("div",{children:M>0?"".concat(eR+1," – ").concat(eM," of ").concat(M):"0 – 0 of 0"}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{K(e=>Math.max(e-1,1))},disabled:1===H||!eE||0===eE.length,className:"text-gray-500 h-8 w-8 p-0",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-left",children:(0,r.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,r.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{eD>0&&H<eD&&K(e=>e+1)},disabled:0===eD||H>=eD||!eE||0===eE.length,className:"text-gray-500 h-8 w-8 p-0",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-right",children:(0,r.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})}),(0,r.jsx)(k.cV,{isOpen:ep.isOpen,onClose:()=>ej({...ep,isOpen:!1}),onConfirm:ep.onConfirm,title:ep.title,message:ep.message,confirmClassName:"bg-blue-600 hover:bg-blue-700 text-white"})]})}function O(e){let{withLabel:t=!1,jobParent:s,jobId:a,managed:l,workspace:i="default"}=e,c=(0,n.useRouter)(),o=(e,t)=>{e.preventDefault(),e.stopPropagation(),c.push({pathname:"".concat(s,"/").concat(a),query:{tab:t}})},d=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.preventDefault(),e.stopPropagation(),l)(0,m.jh)({jobId:parseInt(a),controller:t});else{let e=s.match(/\/clusters\/(.+)/);if(e){let t=e[1];(0,g.GH)({clusterName:t,jobIds:[a],workspace:i})}}};return(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(h.WH,{content:"View Job Logs",className:"capitalize text-sm text-muted-foreground",children:(0,r.jsxs)("button",{onClick:e=>o(e,"logs"),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",children:[(0,r.jsx)(y.Z,{className:"w-4 h-4"}),t&&(0,r.jsx)("span",{className:"ml-1.5",children:"Logs"})]})},"logs"),(0,r.jsx)(h.WH,{content:"Download Job Logs",className:"capitalize text-sm text-muted-foreground",children:(0,r.jsxs)("button",{onClick:e=>d(e,!1),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",children:[(0,r.jsx)(N.Z,{className:"w-4 h-4"}),t&&(0,r.jsx)("span",{className:"ml-1.5",children:"Download"})]})},"downloadlogs")]})}function J(e){let{clusterName:t,clusterJobData:s,loading:n,refreshClusterJobsOnly:l,userFilter:x=null,nameFilter:m=null,workspace:p="default"}=e,[j,f]=(0,a.useState)(null),[g,b]=(0,a.useState)({key:null,direction:"ascending"}),[w,y]=(0,a.useState)(1),[N,k]=(0,a.useState)(10),C=(0,a.useRef)(null),[_,E]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=e=>{j&&C.current&&!C.current.contains(e.target)&&f(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[j]);let R=a.useMemo(()=>{let e=s||[];return x&&"ALL_USERS"!==x&&(e=I(e,x)),m&&(e=M(e,m)),e},[s,x,m]);(0,a.useEffect)(()=>{JSON.stringify(s)!==JSON.stringify(_)&&E(s)},[s,_]);let D=a.useMemo(()=>g.key?[...R].sort((e,t)=>e[g.key]<t[g.key]?"ascending"===g.direction?-1:1:e[g.key]>t[g.key]?"ascending"===g.direction?1:-1:0):R,[R,g]),F=e=>{let t="ascending";g.key===e&&"ascending"===g.direction&&(t="descending"),b({key:e,direction:t})},A=e=>g.key===e?"ascending"===g.direction?" ↑":" ↓":"",P=Math.ceil(D.length/N),U=(w-1)*N,J=U+N,Z=D.slice(U,J);return(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)(d.Zb,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-4",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold",children:"Cluster Jobs"}),(0,r.jsx)("div",{className:"flex items-center",children:l&&(0,r.jsxs)("button",{onClick:l,disabled:n,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center text-sm ml-2",children:[(0,r.jsx)(v.Z,{className:"w-4 h-4 mr-1"}),"Refresh Jobs"]})})]}),(0,r.jsxs)(u.iA,{children:[(0,r.jsx)(u.xD,{children:(0,r.jsxs)(u.SC,{children:[(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>F("id"),children:["ID",A("id")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>F("job"),children:["Name",A("job")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>F("user"),children:["User",A("user")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>F("submitted_at"),children:["Submitted",A("submitted_at")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>F("job_duration"),children:["Duration",A("job_duration")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>F("status"),children:["Status",A("status")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap",onClick:()=>F("resources"),children:["Resources",A("resources")]}),(0,r.jsx)(u.ss,{className:"whitespace-nowrap",children:"Logs"})]})}),(0,r.jsx)(u.RM,{children:n?(0,r.jsx)(u.SC,{children:(0,r.jsx)(u.pj,{colSpan:8,className:"text-center py-12 text-gray-500",children:(0,r.jsxs)("div",{className:"flex justify-center items-center",children:[(0,r.jsx)(c.Z,{size:24,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading cluster jobs..."})]})})}):Z.length>0?Z.map(e=>(0,r.jsxs)(a.Fragment,{children:[(0,r.jsxs)(u.SC,{className:j===e.id?"selected-row":"",children:[(0,r.jsx)(u.pj,{children:(0,r.jsx)(i(),{href:"/clusters/".concat(t,"/").concat(e.id),className:"text-blue-600",children:e.id})}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(i(),{href:"/clusters/".concat(t,"/").concat(e.id),className:"text-blue-600",children:(0,r.jsx)(T,{text:e.job||"Unnamed job",rowId:e.id,expandedRowId:j,setExpandedRowId:f})})}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(L.H,{username:e.user,userHash:e.user_hash})}),(0,r.jsx)(u.pj,{children:z(e.submitted_at)}),(0,r.jsx)(u.pj,{children:(0,h.LU)(e.job_duration)}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(S.OE,{status:e.status})}),(0,r.jsx)(u.pj,{children:e.resources}),(0,r.jsx)(u.pj,{className:"flex content-center items-center",children:(0,r.jsx)(O,{jobParent:"/clusters/".concat(t),jobId:e.id,managed:!1,workspace:p})})]}),j===e.id&&(0,r.jsx)(W,{text:e.job||"Unnamed job",colSpan:8,innerRef:C})]},e.id)):(0,r.jsx)(u.SC,{children:(0,r.jsx)(u.pj,{colSpan:8,className:"text-center py-6 text-gray-500",children:"No jobs found"})})})]})]}),D&&D.length>0&&(0,r.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,r.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,r.jsxs)("div",{className:"relative inline-block",children:[(0,r.jsxs)("select",{value:N,onChange:e=>{k(parseInt(e.target.value,10)),y(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,r.jsx)("option",{value:5,children:"5"}),(0,r.jsx)("option",{value:10,children:"10"}),(0,r.jsx)("option",{value:20,children:"20"}),(0,r.jsx)("option",{value:50,children:"50"})]}),(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-gray-500 absolute right-0 top-1/2 transform -translate-y-1/2 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,r.jsxs)("div",{children:[U+1," – ",Math.min(J,D.length)," of"," ",D.length]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{y(e=>Math.max(e-1,1))},disabled:1===w,className:"text-gray-500 h-8 w-8 p-0",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-left",children:(0,r.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,r.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{y(e=>Math.min(e+1,P))},disabled:w===P||0===P,className:"text-gray-500 h-8 w-8 p-0",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-right",children:(0,r.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})})]})}function W(e){let{text:t,colSpan:s,innerRef:a}=e;return(0,r.jsx)(u.SC,{className:"expanded-details",children:(0,r.jsx)(u.pj,{colSpan:s,children:(0,r.jsx)("div",{className:"p-4 bg-gray-50 rounded-md border border-gray-200",ref:a,children:(0,r.jsx)("div",{className:"flex justify-between items-start",children:(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900",children:"Full Details"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-700",style:{whiteSpace:"pre-wrap"},children:t})]})})})})})}function T(e){let{text:t,rowId:s,expandedRowId:n,setExpandedRowId:l}=e,i=t||"",c=i.length>50,o=n===s,d=c?"".concat(i.substring(0,50)):i,u=(0,a.useRef)(null);return(0,r.jsxs)("div",{className:"truncated-details relative max-w-full flex items-center",children:[(0,r.jsx)("span",{className:"truncate",children:d}),c&&(0,r.jsx)("button",{ref:u,type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),l(o?null:s)},className:"text-blue-600 hover:text-blue-800 font-medium ml-1 flex-shrink-0","data-button-type":"show-more-less",children:o?"... show less":"... show more"})]})}function Z(e){let{refreshInterval:t,setLoading:s,refreshDataRef:n}=e,[l,o]=(0,a.useState)([]),[x,j]=(0,a.useState)({key:null,direction:"ascending"}),[f,g]=(0,a.useState)(!1),[b,v]=(0,a.useState)(!0),[w,y]=(0,a.useState)(1),[N,k]=(0,a.useState)(10),C=a.useCallback(async()=>{g(!0),s(!0);try{let{pools:e=[]}=await p.default.get(m.vs,[{}])||{};o(e),v(!1)}catch(e){console.error("Error fetching pools data:",e),o([]),v(!1)}finally{g(!1),s(!1)}},[s]);a.useEffect(()=>{n&&(n.current=C)},[n,C]),(0,a.useEffect)(()=>{o([]);let e=!0;C();let s=setInterval(()=>{e&&"visible"===window.document.visibilityState&&C()},t);return()=>{e=!1,clearInterval(s)}},[t,C]);let L=e=>{let t="ascending";x.key===e&&"ascending"===x.direction&&(t="descending"),j({key:e,direction:t})},_=e=>x.key===e?"ascending"===x.direction?" ↑":" ↓":"",R=a.useMemo(()=>x.key?[...l].sort((e,t)=>e[x.key]<t[x.key]?"ascending"===x.direction?-1:1:e[x.key]>t[x.key]?"ascending"===x.direction?1:-1:0):l,[l,x]),D=Math.ceil(R.length/N),M=(w-1)*N,F=M+N,I=R.slice(M,F),A=e=>{if(!e||!e.replica_info||0===e.replica_info.length)return"0 (target: 0)";let t=e.replica_info.filter(e=>"READY"===e.status).length,s=e.target_num_replicas||0;return"".concat(t," (target: ").concat(s,")")},z=e=>{let{jobCounts:t}=e;return(0,r.jsx)(h.x9,{jobCounts:t,getStatusStyle:S.Cl})},P=e=>{let{replicaInfo:t}=e;return(0,r.jsx)(h.Kl,{replicaInfo:t})};return(0,r.jsxs)(d.Zb,{children:[(0,r.jsx)("div",{className:"overflow-x-auto rounded-lg",children:(0,r.jsxs)(u.iA,{className:"min-w-full table-fixed",children:[(0,r.jsx)(u.xD,{children:(0,r.jsxs)(u.SC,{children:[(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap w-32",onClick:()=>L("name"),children:["Pool",_("name")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap w-40",onClick:()=>L("job_counts"),children:["Jobs",_("job_counts")]}),(0,r.jsx)(u.ss,{className:"whitespace-nowrap w-20",children:"Workers"}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap w-36",onClick:()=>L("requested_resources_str"),children:["Worker Details",_("requested_resources_str")]}),(0,r.jsxs)(u.ss,{className:"sortable whitespace-nowrap w-40",onClick:()=>L("requested_resources_str"),children:["Worker Resources",_("requested_resources_str")]})]})}),(0,r.jsx)(u.RM,{children:f&&b?(0,r.jsx)(u.SC,{children:(0,r.jsx)(u.pj,{colSpan:5,className:"text-center py-6 text-gray-500",children:(0,r.jsxs)("div",{className:"flex justify-center items-center",children:[(0,r.jsx)(c.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]})})}):I.length>0?I.map(e=>(0,r.jsxs)(u.SC,{children:[(0,r.jsx)(u.pj,{children:(0,r.jsx)(i(),{href:"/jobs/pools/".concat(e.name),className:"text-blue-600 hover:text-blue-800",children:e.name})}),(0,r.jsx)(u.pj,{children:(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,r.jsx)(z,{jobCounts:e.jobCounts}),(0,r.jsx)(i(),{href:(0,E.P2)("/jobs","pool",":",e.name),className:"text-blue-600 hover:text-blue-800 text-xs",children:"See all jobs"})]})}),(0,r.jsx)(u.pj,{children:A(e)}),(0,r.jsx)(u.pj,{children:(0,r.jsx)(P,{replicaInfo:e.replica_info})}),(0,r.jsx)(u.pj,{children:e.requested_resources_str||"-"})]},e.name)):(0,r.jsx)(u.SC,{children:(0,r.jsx)(u.pj,{colSpan:5,className:"text-center py-6 text-gray-500",children:"No pools found"})})})]})}),I.length>0&&D>1&&(0,r.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-t border-gray-200",children:[(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)("span",{className:"text-sm text-gray-700",children:"Rows per page:"}),(0,r.jsxs)("select",{value:N,onChange:e=>{k(parseInt(e.target.value,10)),y(1)},className:"border border-gray-300 rounded px-2 py-1 text-sm",children:[(0,r.jsx)("option",{value:5,children:"5"}),(0,r.jsx)("option",{value:10,children:"10"}),(0,r.jsx)("option",{value:25,children:"25"}),(0,r.jsx)("option",{value:50,children:"50"})]})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsxs)("span",{className:"text-sm text-gray-700",children:[M+1,"-",Math.min(F,R.length)," of"," ",R.length]}),(0,r.jsx)("button",{onClick:()=>{y(e=>Math.max(e-1,1))},disabled:1===w,className:"px-2 py-1 text-sm border border-gray-300 rounded disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-50",children:"Previous"}),(0,r.jsx)("button",{onClick:()=>{y(e=>Math.min(e+1,D))},disabled:w===D,className:"px-2 py-1 text-sm border border-gray-300 rounded disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-50",children:"Next"})]})]})]})}},10546:function(e,t,s){s.d(t,{Fu:function(){return o},ML:function(){return u},P2:function(){return d},cm:function(){return i},eG:function(){return c},x$:function(){return h}});var r=s(85893),a=s(67294),n=s(88950);let l=(e,t)=>{var s;let{property:r,operator:a,value:n}=t;if(!n)return!0;if(!r){let t=n.toLowerCase();return Object.values(e).some(e=>null==e?void 0:e.toString().toLowerCase().includes(t))}let l=null===(s=e[r.toLowerCase()])||void 0===s?void 0:s.toString().toLowerCase(),i=n.toString().toLowerCase();switch(a){case"=":return l===i;case":":return null==l?void 0:l.includes(i);default:return!0}},i=(e,t)=>0===t.length?e:e.filter(e=>{let s=null;for(let r=0;r<t.length;r++){let a=l(e,t[r]);s=null===s?a:s&&a}return s}),c=(e,t)=>{let s={...e.query},r=[],a=[],n=[];t.map((e,t)=>{var s;r.push(null!==(s=e.property.toLowerCase())&&void 0!==s?s:""),a.push(e.operator),n.push(e.value)}),s.property=r,s.operator=a,s.value=n,e.replace({pathname:e.pathname,query:s},void 0,{shallow:!0})},o=(e,t)=>{let s={...e.query},r=s.property,a=s.operator,n=s.value;if(void 0===r)return[];let l=[],i=Array.isArray(r)?r.length:1;if(1===i)l.push({property:t.get(r),operator:a,value:n});else for(let e=0;e<i;e++)l.push({property:t.get(r[e]),operator:a[e],value:n[e]});return l},d=(e,t,s,r)=>{if(!r)return e;let a=new URLSearchParams({property:t.toLowerCase(),operator:s,value:r});return"".concat(e,"?").concat(a.toString())},u=e=>{var t,s;let{propertyList:l=[],valueList:i,setFilters:c,updateURLParams:o,placeholder:d="Filter items"}=e,u=(0,a.useRef)(null),h=(0,a.useRef)(null),[x,m]=(0,a.useState)(!1),[p,j]=(0,a.useState)(""),[f,g]=(0,a.useState)((null===(t=l[0])||void 0===t?void 0:t.value)||"status"),[b,v]=(0,a.useState)([]);(0,a.useEffect)(()=>{let e=e=>{h.current&&!h.current.contains(e.target)&&u.current&&!u.current.contains(e.target)&&m(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]),(0,a.useEffect)(()=>{let e=[];i&&"object"==typeof i&&(e=i[f]||[]),""!==p.trim()&&(e=e.filter(e=>e&&e.toString().toLowerCase().includes(p.toLowerCase()))),v(e)},[f,i,p]);let w=e=>{let t=l.find(t=>t.value===e);return t?t.label:e},y=e=>{c(t=>{let s=[...t,{property:w(f),operator:":",value:e}];return o(s),s}),m(!1),j(""),u.current.focus()};return(0,r.jsxs)("div",{className:"flex flex-row border border-gray-300 rounded-md overflow-visible bg-white",children:[(0,r.jsx)("div",{className:"border-r border-gray-300 flex-shrink-0",children:(0,r.jsxs)(n.Ph,{onValueChange:g,value:f,children:[(0,r.jsx)(n.i4,{"aria-label":"Filter Property",className:"focus:ring-0 focus:ring-offset-0 border-none rounded-l-md rounded-r-none w-20 sm:w-24 md:w-32 h-8 text-xs sm:text-sm bg-white",children:(0,r.jsx)(n.ki,{placeholder:(null===(s=l[0])||void 0===s?void 0:s.label)||"Status"})}),(0,r.jsx)(n.Bw,{children:l.map((e,t)=>(0,r.jsx)(n.Ql,{value:e.value,children:e.label},"property-item-".concat(t)))})]})}),(0,r.jsxs)("div",{className:"relative flex-1",children:[(0,r.jsx)("input",{type:"text",ref:u,placeholder:d,value:p,onChange:e=>{j(e.target.value),x||m(!0)},onFocus:()=>{m(!0)},onKeyDown:e=>{"Enter"===e.key&&""!==p.trim()?(c(e=>{let t=[...e,{property:w(f),operator:":",value:p}];return o(t),t}),j(""),m(!1)):"Escape"===e.key&&(m(!1),u.current.blur())},className:"h-8 w-full px-3 pr-8 text-sm border-none rounded-l-none rounded-r-md focus:ring-0 focus:outline-none",autoComplete:"off"}),p&&(0,r.jsx)("button",{onClick:()=>{j(""),m(!1)},className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",title:"Clear filter",tabIndex:-1,children:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),x&&b.length>0&&(0,r.jsx)("div",{ref:h,className:"absolute z-50 mt-1 w-full bg-white border border-gray-200 rounded-md shadow-lg max-h-60 overflow-y-auto",style:{zIndex:9999},children:b.map((e,t)=>(0,r.jsx)("div",{className:"px-3 py-2 cursor-pointer hover:bg-gray-50 text-sm ".concat(t!==b.length-1?"border-b border-gray-100":""),onClick:()=>y(e),children:(0,r.jsx)("span",{className:"text-sm text-gray-700",children:e})},"".concat(e,"-").concat(t)))})]})]})},h=e=>{let{filters:t=[],setFilters:s,updateURLParams:a}=e,n=e=>{s(t=>{let s=t.filter((t,s)=>s!==e);return a(s),s})};return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"flex items-center gap-4 py-2 px-2",children:(0,r.jsxs)("div",{className:"flex flex-wrap items-content gap-2",children:[t.map((e,t)=>(0,r.jsx)(x,{filter:e,onRemove:()=>n(t)},"filteritem-".concat(t))),t.length>0&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("button",{onClick:()=>{a([]),s([])},className:"rounded-full px-4 py-1 text-sm text-gray-700 bg-gray-200 hover:bg-gray-300",children:"Clear filters"})})]})})})},x=e=>{let{filter:t,onRemove:s}=e;return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"flex items-center text-blue-600 bg-blue-100 px-1 py-1 rounded-full text-sm",children:[(0,r.jsxs)("div",{className:"flex items-center gap-1 px-2",children:[(0,r.jsx)("span",{children:"".concat(t.property," ")}),(0,r.jsx)("span",{children:"".concat(t.operator," ")}),(0,r.jsx)("span",{children:" ".concat(t.value)})]}),(0,r.jsx)("button",{onClick:()=>s(),className:"p-0.5 ml-1 transform text-gray-400 hover:text-gray-600 bg-blue-500 hover:bg-blue-600 rounded-full flex flex-col items-center",title:"Clear filter",children:(0,r.jsx)("svg",{className:"h-3 w-3",fill:"none",stroke:"white",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:5,d:"M6 18L18 6M6 6l12 12"})})})]})})}}}]);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8640],{88507:function(e,n,t){t.d(n,{Z:function(){return r}});/**
|
|
2
|
+
* @license lucide-react v0.407.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/let r=(0,t(60998).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},28586:function(e,n,t){t.d(n,{Z:function(){return r}});/**
|
|
7
|
+
* @license lucide-react v0.407.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/let r=(0,t(60998).Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},43767:function(e,n,t){t.d(n,{Z:function(){return r}});/**
|
|
12
|
+
* @license lucide-react v0.407.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/let r=(0,t(60998).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},23001:function(e,n,t){t.d(n,{X:function(){return l}});var r=t(67294);function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[n,t]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let n=()=>{t(window.innerWidth<e)};return n(),window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)}},[e]),n}},12003:function(e,n,t){t.d(n,{j:function(){return i}});var r=t(90512);let l=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,u=r.W,i=(e,n)=>t=>{var r;if((null==n?void 0:n.variants)==null)return u(e,null==t?void 0:t.class,null==t?void 0:t.className);let{variants:i,defaultVariants:a}=n,d=Object.keys(i).map(e=>{let n=null==t?void 0:t[e],r=null==a?void 0:a[e];if(null===n)return null;let u=l(n)||l(r);return i[e][u]}),s=t&&Object.entries(t).reduce((e,n)=>{let[t,r]=n;return void 0===r||(e[t]=r),e},{});return u(e,d,null==n?void 0:null===(r=n.compoundVariants)||void 0===r?void 0:r.reduce((e,n)=>{let{class:t,className:r,...l}=n;return Object.entries(l).every(e=>{let[n,t]=e;return Array.isArray(t)?t.includes({...a,...s}[n]):({...a,...s})[n]===t})?[...e,t,r]:e},[]),null==t?void 0:t.class,null==t?void 0:t.className)}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8969],{68969:function(e,t,o){o.d(t,{Ce:function(){return f},NJ:function(){return g},UA:function(){return h},aT:function(){return d},getManagedJobs:function(){return l},jh:function(){return p},vs:function(){return u}});var r=o(67294),a=o(15821),n=o(93225),s=o(6378),c=o(47145);let i=["job_id","_job_id","job_name","user_name","user_hash","workspace","submitted_at","job_duration","status","resources","cloud","region","accelerators","cluster_resources","cluster_resources_full","recovery_count","pool","pool_hash","details","failure_reason"];async function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{var t;let{allUsers:o=!0,skipFinished:r=!1,allFields:a=!1,nameMatch:s,userMatch:l,workspaceMatch:d,poolMatch:u,page:h,limit:g,statuses:f,fields:p,jobIDs:b}=e,_={all_users:o,verbose:!0,skip_finished:r};void 0!==s&&(_.name_match=s),void 0!==l&&(_.user_match=l),void 0!==d&&(_.workspace_match=d),void 0!==u&&(_.pool_match=u),void 0!==h&&(_.page=h),void 0!==g&&(_.limit=g),void 0!==f&&f.length>0&&(_.statuses=f),void 0!==b&&b.length>0&&(_.job_ids=b),a||(p&&p.length>0?_.fields=p:_.fields=i);let m=await c.x.post("/jobs/queue/v2",_);if(!m.ok){let e="Failed to get managed jobs with status ".concat(m.status);throw Error(e)}let w=m.headers.get("X-Skypilot-Request-ID");if(!w)throw Error("No request ID received from server for managed jobs");let y=await c.x.get("/api/get?request_id=".concat(w)),j=y.statusText;if(500===y.status)try{let e=await y.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);if(t.type&&t.type===n.iW)return{jobs:[],total:0,controllerStopped:!0};j=t.message||String(e.detail.error)}catch(t){console.error("Error parsing JSON from data.detail.error:",t),j=String(e.detail.error)}}catch(e){console.error("Error parsing response JSON:",e),j=String(e)}if(!y.ok){let e="API request to get managed jobs result failed with status ".concat(y.status,", error: ").concat(j);throw Error(e)}let v=await y.json(),k=v.return_value?JSON.parse(v.return_value):[],S=Array.isArray(k)?k:(null==k?void 0:k.jobs)||[],C=Array.isArray(k)?S.length:null!==(t=null==k?void 0:k.total)&&void 0!==t?t:S.length,E=(null==k?void 0:k.total_no_filter)||C,q=(null==k?void 0:k.status_counts)||{};return{jobs:S.map(e=>{var t;let o=0;e.end_at&&e.submitted_at?o=e.end_at-e.submitted_at:e.submitted_at&&(o=Date.now()/1e3-e.submitted_at);let r=[];e.submitted_at&&r.push({type:"PENDING",timestamp:e.submitted_at}),e.start_at&&r.push({type:"RUNNING",timestamp:e.start_at}),e.end_at&&r.push({type:e.status,timestamp:e.end_at});let a="",n="",s="",c="",i="";try{if(a=e.cloud||"",s=e.cluster_resources,n=e.region||"","-"===n&&(n=""),a&&(c=a,n&&(c+=" (".concat(n,")"))),i=c,e.accelerators){let t=Object.entries(e.accelerators).map(e=>{let[t,o]=e;return"".concat(o,"x").concat(t)}).join(", ");t&&(i+=" (".concat(t,")"))}}catch(t){s=e.cluster_resources}return{id:e.job_id,task_job_id:e._job_id,task:e.task_name,name:e.job_name,job_duration:e.job_duration,total_duration:o,workspace:e.workspace,status:e.status,requested_resources:e.resources,resources_str:s,resources_str_full:e.cluster_resources_full||s,cloud:a,region:e.region,infra:c,full_infra:i,recoveries:e.recovery_count,details:e.details||e.failure_reason,user:e.user_name,user_hash:e.user_hash,submitted_at:e.submitted_at?new Date(1e3*e.submitted_at):null,events:r,dag_yaml:e.user_yaml,entrypoint:e.entrypoint,git_commit:(null===(t=e.metadata)||void 0===t?void 0:t.git_commit)||"-",pool:e.pool,pool_hash:e.pool_hash,current_cluster_name:e.current_cluster_name,job_id_on_pool_cluster:e.job_id_on_pool_cluster,accelerators:e.accelerators}}),total:C,totalNoFilter:E,controllerStopped:!1,statusCounts:q}}catch(e){throw console.error("Error fetching managed job data:",e),e}}async function d(e){let{allUsers:t=!0,nameMatch:o,userMatch:r,workspaceMatch:a,poolMatch:n,page:s=1,limit:c=10,jobIDs:i,fields:d,allFields:u=!1,useClientPagination:h=!0}=e||{};try{if(!h)return await l(e);let g=await l({allUsers:t,nameMatch:o,userMatch:r,workspaceMatch:a,poolMatch:n,jobIDs:i,fields:d,allFields:u});if(g.controllerStopped||!g.jobs)return g;let f=g.jobs,p=f.length,b=(s-1)*c;return{jobs:f.slice(b,b+c),total:p,controllerStopped:!1}}catch(e){throw console.error("Error fetching managed job data with client pagination:",e),e}}async function u(){try{let e=await c.x.post("/jobs/pool_status",{pool_names:null});if(!e.ok){let t="Initial API request to get pool status failed with status ".concat(e.status);throw Error(t)}let t=e.headers.get("X-Skypilot-Request-ID");if(!t)throw Error("No request ID received from server for getting pool status");let o=await c.x.get("/api/get?request_id=".concat(t)),r=o.statusText;if(500===o.status)try{let e=await o.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);if(t.type&&t.type===n.iW)return{pools:[],controllerStopped:!0};r=t.message||String(e.detail.error)}catch(t){console.error("Error parsing JSON from data.detail.error:",t),r=String(e.detail.error)}}catch(e){console.error("Error parsing response JSON:",e),r=String(e)}if(!o.ok){let e="API request to get pool status result failed with status ".concat(o.status,", error: ").concat(r);throw Error(e)}let a=await o.json(),i=a.return_value?JSON.parse(a.return_value):[],d={jobs:[]};try{let e=await s.default.get(l,[{allUsers:!0,skipFinished:!0,fields:["pool","status"]}]);e.controllerStopped||(d=e)}catch(e){console.warn("Failed to fetch jobs for pool job counts:",e)}let u={},h=["SUCCEEDED","FAILED","FAILED_SETUP","FAILED_PRECHECKS","FAILED_NO_RESOURCE","FAILED_CONTROLLER","CANCELLED"];return d.jobs&&Array.isArray(d.jobs)&&d.jobs.forEach(e=>{let t=e.pool,o=e.status;t&&!h.includes(o)&&(u[t]||(u[t]={}),u[t][o]=(u[t][o]||0)+1)}),{pools:i.map(e=>({...e,jobCounts:u[e.name]||{}})),controllerStopped:!1}}catch(e){throw console.error("Error fetching pools:",e),e}}function h(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,[o,a]=(0,r.useState)(null),[n,c]=(0,r.useState)(!0);return(0,r.useEffect)(()=>{(async function(){if(e)try{var t;c(!0);let o=await s.default.get(l,[{allUsers:!0,allFields:!0,jobIDs:[e]}]),r=null==o?void 0:null===(t=o.jobs)||void 0===t?void 0:t.find(t=>String(t.id)===String(e));r?a({jobs:[r],controllerStopped:o.controllerStopped||!1}):a({jobs:[],controllerStopped:o.controllerStopped||!1})}catch(e){console.error("Error fetching single managed job data:",e),a({jobs:[],controllerStopped:!1})}finally{c(!1)}})()},[e,t]),{jobData:o,loading:n}}async function g(e){let t,{jobId:o,controller:r=!1,signal:s,onNewLog:c}=e,i=Date.now(),l=new Promise(e=>{let o=()=>{let r=Date.now()-i;r>=3e4?e({timeout:!0}):t=setTimeout(o,3e4-r)};t=setTimeout(o,3e4)}),d=window.location.origin,u="".concat(d).concat(n.f4),h=(async()=>{try{let e=(await fetch("".concat(u,"/jobs/logs"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({controller:r,follow:!1,job_id:o,tail:1e4}),...s?{signal:s}:{}})).body.getReader();try{for(;;){let{done:t,value:o}=await e.read();if(t)break;i=Date.now();let r=new TextDecoder().decode(o);c(r)}}finally{if(!s||!s.aborted)try{e.cancel()}catch(e){"AbortError"!==e.name&&console.warn("Error canceling reader:",e)}t&&clearTimeout(t)}return{timeout:!1}}catch(e){if(t&&clearTimeout(t),"AbortError"===e.name)return{timeout:!1};throw e}})(),g=await Promise.race([h,l]);if(t&&clearTimeout(t),g.timeout){(0,a.C)("Log request for job ".concat(o," timed out after ").concat(30,"s of inactivity"),"warning");return}}async function f(e,t,o){let r="",s="",c="",i={};if("restartcontroller"===e)r="Restarting",s="restarted",c="jobs/queue/v2",i={all_users:!0,refresh:!0,skip_finished:!0,fields:["status"]},t="controller";else throw Error("Invalid action: ".concat(e));(0,a.C)("".concat(r," job ").concat(t,"..."),"info");let l=window.location.origin,d="".concat(l).concat(n.f4);try{try{let e=await fetch("".concat(d,"/").concat(c),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!e.ok){console.error("Initial API request ".concat(c," failed with status ").concat(e.status)),(0,a.C)("".concat(r," job ").concat(t," failed with status ").concat(e.status,"."),"error");return}let l=e.headers.get("X-Skypilot-Request-ID");if(!l){console.error("No request ID received from server for ".concat(c)),(0,a.C)("".concat(r," job ").concat(t," failed with no request ID."),"error");return}let u=await fetch("".concat(d,"/api/get?request_id=").concat(l));if(200===u.status)(0,a.C)("Job ".concat(t," ").concat(s," successfully."),"success");else if(500===u.status)try{let e=await u.json();if(e.detail&&e.detail.error)try{let s=JSON.parse(e.detail.error);s.type&&s.type===n.Bo?(0,a.C)("".concat(r," job ").concat(t," is not supported!"),"error",1e4):s.type&&s.type===n.mF?(0,a.C)("Cluster ".concat(o," does not exist."),"error"):s.type&&s.type===n.iW?(0,a.C)("Cluster ".concat(o," is not up."),"error"):(0,a.C)("".concat(r," job ").concat(t," failed: ").concat(s.type),"error")}catch(o){(0,a.C)("".concat(r," job ").concat(t," failed: ").concat(e.detail.error),"error")}else(0,a.C)("".concat(r," job ").concat(t," failed with no details."),"error")}catch(e){(0,a.C)("".concat(r," job ").concat(t," failed with parse error."),"error")}else(0,a.C)("".concat(r," job ").concat(t," failed with status ").concat(u.status,"."),"error")}catch(e){console.error("Fetch error:",e),(0,a.C)("Network error ".concat(r," job ").concat(t,": ").concat(e.message),"error")}}catch(e){console.error("Error in handleStop:",e),(0,a.C)("Critical error ".concat(r," job ").concat(t,": ").concat(e.message),"error")}}async function p(e){let{jobId:t=null,name:o=null,controller:r=!1}=e;try{let e=await c.x.fetch("/jobs/download_logs",{job_id:t,name:o,controller:r,refresh:!1}),s=Object.values(e||{});if(!s.length){(0,a.C)("No logs found to download.","warning");return}let i=window.location.origin,l="".concat(i).concat(n.f4,"/download"),d=await fetch("".concat(l,"?relative=items"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({folder_paths:s})});if(!d.ok){let e=await d.text();throw Error("Download failed: ".concat(d.status," ").concat(e))}let u=await d.blob(),h=window.URL.createObjectURL(u),g=document.createElement("a"),f=new Date().toISOString().replace(/[:.]/g,"-"),p=t?"job-".concat(t):o?"job-".concat(o):"job";g.href=h,g.download="managed-".concat(p,"-").concat(r?"controller-logs":"logs","-").concat(f,".zip"),document.body.appendChild(g),g.click(),g.remove(),window.URL.revokeObjectURL(h)}catch(e){console.error("Error downloading managed job logs:",e),(0,a.C)("Error downloading managed job logs: ".concat(e.message),"error")}}},15821:function(e,t,o){o.d(t,{C:function(){return r}});function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5e3,r=document.getElementById("toast-container");r||((r=document.createElement("div")).id="toast-container",r.className="fixed top-0 right-0 p-4 z-[9999] flex flex-col items-end space-y-2",document.body.appendChild(r));let a=document.createElement("div");switch(a.className="rounded-md border-l-4 p-4 shadow-md flex items-center justify-between max-w-md w-full mb-2 pointer-events-auto",t){case"success":a.className+=" bg-green-100 border-green-500 text-green-800";break;case"error":a.className+=" bg-red-100 border-red-500 text-red-800";break;case"warning":a.className+=" bg-yellow-100 border-yellow-500 text-yellow-800";break;default:a.className+=" bg-blue-100 border-blue-500 text-blue-800"}return a.innerHTML='\n <div class="flex-1 mr-2">\n <p class="text-sm font-medium">'.concat(e,'</p>\n </div>\n <button class="text-gray-500 hover:text-gray-700 focus:outline-none" aria-label="Close toast">\n <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <line x1="18" y1="6" x2="6" y2="18"></line>\n <line x1="6" y1="6" x2="18" y2="18"></line>\n </svg>\n </button>\n '),r.appendChild(a),a.querySelector("button").addEventListener("click",()=>{r.removeChild(a)}),setTimeout(()=>{r.contains(a)&&r.removeChild(a)},o),a}},6378:function(e,t,o){o.r(t),o.d(t,{DashboardCache:function(){return n},dashboardCache:function(){return s}});let r=o(51214).ej.DEFAULT_TTL;function a(e){let t=5381;for(let o=0;o<e.length;o++)t=(t<<5)+t+e.charCodeAt(o);return t>>>0}class n{setPreloader(e){this.preloader=e}async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=o.ttl||r,n=!1!==o.refreshOnAccess,s=this._generateKey(e,t),c=e.name||"anonymous",i=this.cache.get(s),l=Date.now();if(i&&l-i.lastUpdated<a){let o=Math.round((l-i.lastUpdated)/1e3);if(this._debug("Cache HIT for ".concat(c," (age: ").concat(o,"s, TTL: ").concat(Math.round(a/1e3),"s)")),n&&(this.cache.set(s,{data:i.data,lastUpdated:l}),this._debug("Cache TTL refreshed for ".concat(c))),!this.backgroundJobs.has(s)){var d;(null===(d=this.preloader)||void 0===d?void 0:d.wasRecentlyPreloaded(e,t))?this._debug("Skipping background refresh for ".concat(c," - recently preloaded")):this._refreshInBackground(e,t,s)}return i.data}if(this.pendingRequests.has(s))return this._debug("Request deduplication: Waiting for pending request for ".concat(c)),this.pendingRequests.get(s);let u=(async()=>{try{let o=await e(...t);if(o&&o.__skipCache){if(this._debug("Skip caching for ".concat(c," due to __skipCache flag on result")),i)return i.data;return o}return this.cache.set(s,{data:o,lastUpdated:Date.now()}),o}catch(e){if(i)return console.warn("Failed to fetch fresh data for ".concat(s,"/").concat(c,", returning stale data:"),e),i.data;throw e}finally{this.pendingRequests.delete(s)}})();return this.pendingRequests.set(s,u),u}invalidate(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=this._generateKey(e,t);this.cache.delete(o),this.backgroundJobs.delete(o),this.pendingRequests.delete(o)}invalidateFunction(e){let t=a(e.toString()),o=[];for(let e of this.cache.keys())e.startsWith("".concat(t,"_"))&&o.push(e);o.forEach(e=>{this.cache.delete(e),this.backgroundJobs.delete(e),this.pendingRequests.delete(e)})}clear(){this.cache.clear(),this.backgroundJobs.clear(),this.pendingRequests.clear()}getStats(){return{cacheSize:this.cache.size,backgroundJobs:this.backgroundJobs.size,pendingRequests:this.pendingRequests.size,keys:Array.from(this.cache.keys())}}getDetailedStats(){let e=Date.now(),t=[];for(let[o,r]of this.cache.entries()){let a=e-r.lastUpdated;t.push({key:o,age:Math.round(a/1e3),lastUpdated:new Date(r.lastUpdated).toISOString(),hasBackgroundJob:this.backgroundJobs.has(o),hasPendingRequest:this.pendingRequests.has(o)})}return{cacheSize:this.cache.size,backgroundJobs:this.backgroundJobs.size,pendingRequests:this.pendingRequests.size,entries:t.sort((e,t)=>e.age-t.age)}}setDebugMode(e){this.debugMode=e}_debug(e){for(var t=arguments.length,o=Array(t>1?t-1:0),r=1;r<t;r++)o[r-1]=arguments[r];this.debugMode&&console.log("[DashboardCache] ".concat(e),...o)}_refreshInBackground(e,t,o){this.backgroundJobs.set(o,!0),e(...t).then(e=>{e&&e.__skipCache||this.cache.set(o,{data:e,lastUpdated:Date.now()})}).catch(e=>{console.warn("Background refresh failed for ".concat(o,":"),e)}).finally(()=>{this.backgroundJobs.delete(o)})}_generateKey(e,t){let o=a(e.toString()),r=t.length>0?JSON.stringify(t):"";return"".concat(o,"_").concat(r)}constructor(){this.cache=new Map,this.backgroundJobs=new Map,this.pendingRequests=new Map,this.debugMode=!1,this.preloader=null}}let s=new n;t.default=s}}]);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9025],{99333:function(e,n,r){r.d(n,{Z:function(){return t}});/**
|
|
2
|
+
* @license lucide-react v0.407.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/let t=(0,r(60998).Z)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},54042:function(e,n,r){r.r(n),r.d(n,{Config:function(){return p}});var t=r(85893),l=r(67294),s=r(11163),a=r(30803),i=r(37673),o=r(17324),c=r(1812),u=r(55739),d=r(99333),m=r(1272),f=r(36989),x=r(47145);function h(){let[e,n]=(0,l.useState)(null),[r,s]=(0,l.useState)(null),a=async()=>{let e=await x.x.get("/api/health");if(!e.ok){console.error("API request /api/health failed with status ".concat(e.status));return}let r=await e.json();r.version&&n(r.version),r.commit&&s(r.commit)};return((0,l.useEffect)(()=>{a()},[]),e)?(0,t.jsx)(f.Md,{content:r?"Commit: ".concat(r):"Commit information not available",className:"text-sm text-muted-foreground",children:(0,t.jsxs)("div",{className:"text-sm text-gray-500 cursor-help border-b border-dotted border-gray-400 inline-block",children:["Version: ",e]})}):null}var v=r(17853),g=r(83454);function p(){let e=(0,s.useRouter)(),[n,r]=(0,l.useState)(""),[f,p]=(0,l.useState)(!0),[j,b]=(0,l.useState)(!1),[y,w]=(0,l.useState)(null),[N,k]=(0,l.useState)(!1),[L,A]=(0,l.useState)(!1),C=(0,l.useRef)(null);(0,l.useEffect)(()=>{E(),(async()=>{A(await (0,v.TO)())})()},[]),(0,l.useEffect)(()=>()=>{C.current&&clearTimeout(C.current)},[]);let E=async()=>{p(!0),w(null);try{let e=await (0,o.iE)();0===Object.keys(e).length?r(""):r(m.ZP.dump(e,{indent:2}))}catch(e){console.error("Error loading config:",e),w(e)}finally{p(!1)}},S=async()=>{b(!0),w(null),C.current&&(clearTimeout(C.current),C.current=null);try{let e=await x.x.get("/users/role");if(!e.ok){let n=await e.json();throw Error(n.detail||"Failed to get user role")}let r=await e.json(),t=r.role;if("admin"!=t){w(Error("".concat(r.name," is logged in as non-admin and cannot edit config"))),b(!1);return}let l=m.ZP.load(n);if(null==l&&(l={}),"object"!=typeof l||Array.isArray(l)){let e="Invalid config structure: Configuration must be a mapping (key-value pairs) in YAML format.";Array.isArray(l),e="Invalid config structure: Configuration must be a mapping (key-value pairs) in YAML format.",w(Error(e)),b(!1);return}await (0,o.rF)(l),k(!0),C.current=setTimeout(()=>{k(!1),C.current=null},5e3)}catch(e){console.error("Error saving config:",e),w(e)}finally{b(!1)}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,t.jsx)("div",{className:"text-base flex items-center",children:(0,t.jsx)("span",{className:"text-sky-blue",children:"SkyPilot API Server"})}),(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("div",{className:"text-sm flex items-center",children:(f||j)&&(0,t.jsxs)("div",{className:"flex items-center mr-4",children:[(0,t.jsx)(u.Z,{size:15,className:"mt-0"}),(0,t.jsx)("span",{className:"ml-2 text-gray-500",children:j?"Applying...":"Loading..."})]})}),L&&(0,t.jsxs)("button",{onClick:()=>{let e=(0,v.ki)(),n=g.env.SKYPILOT_RELEASE_NAME||"skypilot";window.open("".concat(e,"/d/skypilot-apiserver-overview/skypilot-api-server?orgId=1&from=now-1h&to=now&timezone=browser&var-app=").concat("".concat(n,"-api")),"_blank")},className:"inline-flex items-center px-3 py-2 text-sm font-medium text-white bg-sky-blue-bright border border-transparent rounded-md shadow-sm hover:bg-sky-blue focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-sky-blue mr-4",children:[(0,t.jsx)("svg",{className:"w-4 h-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})}),"View API Server Metrics"]}),(0,t.jsx)(h,{})]})]}),(0,t.jsxs)(i.Zb,{className:"w-full",children:[(0,t.jsx)(i.Ol,{children:(0,t.jsx)(i.ll,{className:"text-base font-normal flex items-center justify-between",children:(0,t.jsx)("span",{children:"Edit SkyPilot API Server Configuration"})})}),(0,t.jsxs)(i.aY,{className:"space-y-4",children:[(0,t.jsxs)("p",{className:"text-sm text-gray-600 mb-3",children:["Refer to the"," ",(0,t.jsx)("a",{href:"https://docs.skypilot.co/en/latest/reference/config.html",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:"SkyPilot Docs"})," ","for details. The configuration should be in YAML format."]}),N&&(0,t.jsx)("div",{className:"bg-green-50 border border-green-200 rounded p-4 mb-6",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),(0,t.jsx)("div",{className:"ml-3",children:(0,t.jsx)("p",{className:"text-sm font-medium text-green-800",children:"Configuration saved successfully!"})})]}),(0,t.jsx)("div",{className:"ml-auto pl-3",children:(0,t.jsx)("div",{className:"-mx-1.5 -my-1.5",children:(0,t.jsxs)("button",{type:"button",onClick:()=>{k(!1),C.current&&(clearTimeout(C.current),C.current=null)},className:"inline-flex rounded-md bg-green-50 p-1.5 text-green-500 hover:bg-green-100 focus:outline-none focus:ring-2 focus:ring-green-600 focus:ring-offset-2 focus:ring-offset-green-50",children:[(0,t.jsx)("span",{className:"sr-only",children:"Dismiss"}),(0,t.jsx)("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})})]})}),y&&(0,t.jsx)("div",{className:"mb-6",children:(0,t.jsx)(c.X,{error:y,title:"Failed to apply new configuration",onDismiss:()=>w(null)})}),(0,t.jsx)("div",{className:"w-full",children:(0,t.jsx)("textarea",{value:n,onChange:e=>r(e.target.value),className:"w-full h-96 p-3 border border-gray-300 rounded font-mono text-sm resize-vertical focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:f?"Loading configuration...":"# Enter SkyPilot configuration in YAML format\n# Example:\n# kubernetes:\n# allowed_contexts: [default, my-context]",disabled:f||j})}),(0,t.jsxs)("div",{className:"flex justify-end space-x-3 pt-3",children:[(0,t.jsx)(a.z,{variant:"outline",onClick:()=>{e.push("/workspaces")},disabled:j,children:"Cancel"}),(0,t.jsx)(a.z,{onClick:S,disabled:f||j,className:"inline-flex items-center bg-sky-600 hover:bg-sky-700 text-white",children:j?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.Z,{size:16,className:"mr-2"}),"Applying..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.Z,{className:"w-4 h-4 mr-1.5"}),"Apply"]})})]})]})]})]})}},1812:function(e,n,r){r.d(n,{X:function(){return a}});var t=r(85893),l=r(67294);let s=e=>{if(!(null==e?void 0:e.message))return"An unexpected error occurred.";let n=e.message;return n.includes("failed:")&&(n=n.split("failed:")[1].trim()),n},a=e=>{let{error:n,title:r="Error",onDismiss:a}=e,[i,o]=(0,l.useState)(!1);if((0,l.useEffect)(()=>{n&&o(!1)},[n]),!n||i)return null;let c="string"==typeof n?n:s(n);return(0,t.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,t.jsx)("div",{className:"ml-3",children:(0,t.jsxs)("div",{className:"text-sm text-red-800",children:[(0,t.jsxs)("strong",{children:[r,":"]})," ",c]})})]}),(0,t.jsx)("button",{onClick:()=>{o(!0),a&&a()},className:"flex-shrink-0 ml-4 text-red-400 hover:text-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-50 rounded","aria-label":"Dismiss error",children:(0,t.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}},17853:function(e,n,r){r.d(n,{TO:function(){return s},ki:function(){return a}});let t=null,l=null,s=async()=>null!==t?t:l||(l=(async()=>{try{let e="".concat(window.location.origin,"/grafana"),n=await fetch("".concat(e,"/api/health"),{method:"GET",credentials:"include",headers:{Accept:"application/json"},signal:AbortSignal.timeout(5e3)});return 200==n.status}catch(e){return console.debug("Grafana availability check failed:",e),t=!1,!1}finally{l=null}})()),a=()=>"".concat(window.location.origin,"/grafana")},12003:function(e,n,r){r.d(n,{j:function(){return a}});var t=r(90512);let l=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,s=t.W,a=(e,n)=>r=>{var t;if((null==n?void 0:n.variants)==null)return s(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:a,defaultVariants:i}=n,o=Object.keys(a).map(e=>{let n=null==r?void 0:r[e],t=null==i?void 0:i[e];if(null===n)return null;let s=l(n)||l(t);return a[e][s]}),c=r&&Object.entries(r).reduce((e,n)=>{let[r,t]=n;return void 0===t||(e[r]=t),e},{});return s(e,o,null==n?void 0:null===(t=n.compoundVariants)||void 0===t?void 0:t.reduce((e,n)=>{let{class:r,className:t,...l}=n;return Object.entries(l).every(e=>{let[n,r]=e;return Array.isArray(r)?r.includes({...i,...c}[n]):({...i,...c})[n]===r})?[...e,r,t]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9353],{9353:function(e,t,r){r.r(t),r.d(t,{Layout:function(){return v}});var s=r(85893),n=r(67294),a=r(66235),l=r(23001),i=r(43767),o=r(33067),c=r(26409),d=r(94849),x=r(6556);function u(){let{startTour:e}=(0,d.r)(),{shouldShowTourPrompt:t,markTourCompleted:r}=(0,x.n)(),[a,l]=(0,n.useState)(!1),[u,m]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(m(!0),t){let e=setTimeout(()=>{l(!0)},2e3);return()=>clearTimeout(e)}},[t]);let h=()=>{l(!1),r()};return u&&t&&a?(0,s.jsx)("div",{className:"fixed top-20 right-6 z-50 max-w-sm",children:(0,s.jsxs)("div",{className:"bg-white rounded-md shadow-lg border border-gray-200 p-4 transform transition-all duration-300 ease-out",children:[(0,s.jsx)("button",{onClick:h,className:"absolute top-3 right-3 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full p-1 transition-all duration-150","aria-label":"Dismiss notification",children:(0,s.jsx)(i.Z,{className:"w-3 h-3"})}),(0,s.jsxs)("div",{className:"pr-6",children:[(0,s.jsxs)("div",{className:"flex items-start mb-3",children:[(0,s.jsx)("div",{className:"flex items-center justify-center w-7 h-7 bg-blue-50 rounded-full mr-3 mt-0.5",children:(0,s.jsx)(o.Z,{className:"w-3.5 h-3.5 text-blue-600"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-sm font-medium text-gray-900 mb-1",children:"Welcome to SkyPilot!"}),(0,s.jsx)("p",{className:"text-sm text-gray-600 leading-relaxed",children:"New to the dashboard? Take a quick guided tour to discover all the features."})]})]}),(0,s.jsxs)("div",{className:"flex space-x-2 ml-10",children:[(0,s.jsxs)("button",{onClick:()=>{l(!1),e()},className:"flex items-center px-3 py-1.5 bg-blue-600 text-white text-sm font-medium rounded hover:bg-blue-700 transition-colors duration-150",children:[(0,s.jsx)(c.Z,{className:"w-3 h-3 mr-1.5"}),"Start Tour"]}),(0,s.jsx)("button",{onClick:h,className:"px-3 py-1.5 text-sm font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-100 rounded transition-colors duration-150",children:"Maybe Later"})]})]})]})}):null}var m=r(19185);function h(e){let{children:t,text:r}=e,[a,l]=(0,n.useState)(!1);return(0,s.jsxs)("div",{className:"relative",onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[t,a&&(0,s.jsx)("div",{className:"absolute top-0 right-0 transform -translate-y-full -translate-x-2 mb-2 px-2 py-1 bg-gray-700 text-white text-xs rounded-md shadow-lg whitespace-nowrap z-50",children:r})]})}function f(){let{startTour:e}=(0,d.r)();return(0,s.jsx)(h,{text:"Start a tour",children:(0,s.jsx)("button",{onClick:e,className:"fixed bottom-4 right-4 bg-transparent text-gray-400 p-2 rounded-full hover:text-gray-500 focus:outline-none","aria-label":"Start Tour",children:(0,s.jsx)(m.Z,{className:"h-5 w-5"})})})}let p=(0,n.createContext)(void 0);function g(e){let{children:t}=e,[r,a]=(0,n.useState)(!1),l=(0,n.useCallback)(()=>{a(!0)},[]),i=(0,n.useCallback)(()=>{a(!1)},[]);return(0,s.jsx)(p.Provider,{value:{isUpgrading:r,reportUpgrade:l,clearUpgrade:i},children:t})}function b(){let e=(0,n.useContext)(p);if(!e)throw Error("useUpgradeDetection must be used within UpgradeDetectionProvider");return e}function j(){let{isUpgrading:e}=b();return e?(0,s.jsx)("div",{className:"fixed top-[56px] left-0 right-0 z-40 bg-yellow-50 border-b border-yellow-200",children:(0,s.jsx)("div",{className:"max-w-7xl mx-auto py-3 px-4 sm:px-6 lg:px-8",children:(0,s.jsx)("div",{className:"flex items-center justify-center",children:(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsxs)("svg",{className:"h-5 w-5 text-yellow-600 mr-2 animate-spin",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),(0,s.jsx)("span",{className:"text-sm font-medium text-yellow-800",children:"Your SkyPilot deployment is undergoing upgrades. Refresh in a few moments."})]})})})}):null}function y(e){let{children:t,highlighted:r}=e;(0,l.X)();let{reportUpgrade:i,clearUpgrade:o,isUpgrading:c}=b();return(0,n.useEffect)(()=>{window.__upgradeInterceptorInstalled||(window.fetch=function(e,t){let r=window.fetch;return async function(s,n){let a;try{a=await r(s,n)}catch(e){throw e}try{if(function(e){let t;try{t="string"==typeof e?e:e.url}catch(e){return!1}return["/_next/static/","/_next/image",".js",".mjs",".css",".woff",".woff2",".ttf",".eot",".svg",".png",".jpg",".jpeg",".gif",".webp",".ico"].some(e=>t.includes(e))}(s))return a;if(503===a.status){let t=a.clone();try{let r=await t.json();r.detail&&(r.detail.includes("shutting down")||r.detail.includes("try again later"))&&e()}catch(e){console.debug("Non-JSON 503 response, ignoring.")}}else(a.ok||a.status>=200&&a.status<300)&&t()}catch(e){console.error("Error in upgrade detection interceptor:",e)}return a}}(i,o),window.__upgradeInterceptorInstalled=!0)},[i,o]),(0,s.jsxs)("div",{className:"min-h-screen bg-gray-50",children:[(0,s.jsx)("div",{className:"fixed top-0 left-0 right-0 z-50 shadow-sm",children:(0,s.jsx)(a.Du,{})}),(0,s.jsx)(j,{}),(0,s.jsx)("div",{className:"transition-all duration-200 ease-in-out min-h-screen",style:{paddingTop:c?"112px":"56px"},children:(0,s.jsx)("main",{className:"p-6",children:t})}),(0,s.jsx)(u,{}),(0,s.jsx)(f,{})]})}function v(e){return(0,s.jsx)(g,{children:(0,s.jsx)(a.Hn,{children:(0,s.jsx)(y,{...e})})})}},66235:function(e,t,r){r.d(t,{Ap:function(){return y},Du:function(){return v},Hn:function(){return j}});var s=r(85893),n=r(67294),a=r(25675),l=r.n(a),i=r(11163),o=r(41664),c=r.n(o),d=r(53850),x=r(40355),u=r(6021),m=r(93225),h=r(36989),f=r(23001),p=r(23800);let g={key:d._m,server:d.QT,briefcase:d.Vp,chip:d.PC,book:d.E9,users:d.oy,volume:d.eU},b=(0,n.createContext)(null);function j(e){let{children:t}=e,[r,a]=(0,n.useState)(!0),[l,i]=(0,n.useState)(!1),[o,c]=(0,n.useState)(null),[d,x]=(0,n.useState)(null),u=window.location.origin,h="".concat(u).concat(m.f4);return(0,n.useEffect)(()=>{fetch("".concat(h,"/api/health")).then(e=>e.json()).then(e=>{e.user&&e.user.name&&(c(e.user.name),(async()=>{try{let e=await fetch("".concat(h,"/users/role"));if(e.ok){let t=await e.json();t.role&&x(t.role)}}catch(e){console.log("Could not fetch user role:",e)}})())}).catch(e=>{console.error("Error fetching user data:",e)})},[h]),(0,s.jsx)(b.Provider,{value:{isSidebarOpen:r,toggleSidebar:()=>{a(e=>!e)},isMobileSidebarOpen:l,toggleMobileSidebar:()=>{i(e=>!e)},userEmail:o,userRole:d},children:t})}function y(){let e=(0,n.useContext)(b);if(!e)throw Error("useSidebar must be used within a SidebarProvider");return e}function v(){let e,t;let r=(0,i.useRouter)(),a=(0,f.X)(),{userEmail:o,userRole:b,isMobileSidebarOpen:j,toggleMobileSidebar:v}=y(),[N,w]=(0,n.useState)(!1),[k,C]=(0,n.useState)(null),{ungrouped:S,groups:E}=(0,p.d7)(),_=(0,p.x1)(),W=(0,n.useRef)(null),z=(0,n.useRef)(null),L=(0,n.useRef)(null);(0,n.useEffect)(()=>{function e(e){W.current&&!W.current.contains(e.target)&&w(!1),z.current&&!z.current.contains(e.target)&&!e.target.closest(".mobile-menu-button")&&j&&v(),L.current&&!L.current.contains(e.target)&&C(null)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[W,j,v]);let U=e=>"/workspaces"===e?r.pathname.startsWith("/workspaces")||r.pathname.startsWith("/workspace"):r.pathname.startsWith(e),H=e=>{let t=U(e);return"inline-flex items-center border-b-2 ".concat(t?"border-transparent text-blue-600":"border-transparent hover:text-blue-600"," ").concat(a?"px-2 py-1":"px-1 pt-1 space-x-2")},M=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=!t&&U(e);return"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(r?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600")},P=(e,t)=>{let r=g[e];return r?n.createElement(r,{className:t}):e},D=e=>(0,s.jsxs)(s.Fragment,{children:[e.icon&&(0,s.jsx)("span",{className:"text-base leading-none mr-1","aria-hidden":"true",children:P(e.icon,"w-4 h-4")}),(0,s.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,s.jsx)("span",{children:e.label}),e.badge&&(0,s.jsx)("span",{className:"text-[10px] uppercase tracking-wide bg-blue-100 text-blue-700 px-1.5 py-0.5 rounded-full",children:e.badge})]})]}),T=e=>{if("string"!=typeof e)return e;let t=_.find(t=>t.path===e);if(!t||!t.path.startsWith("/plugins"))return e;let r=t.path.replace(/^\/+/,"").split("/").slice(1).filter(Boolean);return{pathname:"/plugins/[...slug]",query:r.length?{slug:r}:{}}},F=e=>e.external?(0,s.jsx)("a",{href:e.href,target:e.target,rel:e.rel,className:"inline-flex items-center border-b-2 border-transparent px-1 pt-1 space-x-2 text-gray-700 hover:text-blue-600",children:D(e)},e.id):(0,s.jsx)(c(),{href:T(e.href),className:H(e.href),prefetch:!1,children:D(e)},e.id),R=e=>{let t=(0,s.jsxs)(s.Fragment,{children:[e.icon&&(0,s.jsx)("span",{className:"text-base leading-none mr-2","aria-hidden":"true",children:P(e.icon,"w-5 h-5")}),(0,s.jsxs)("span",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{children:e.label}),e.badge&&(0,s.jsx)("span",{className:"text-[10px] uppercase tracking-wide bg-blue-100 text-blue-700 px-1.5 py-0.5 rounded-full",children:e.badge})]})]});return e.external?(0,s.jsx)("a",{href:e.href,target:e.target,rel:e.rel,className:M(e.href,!0),onClick:v,children:t},e.id):(0,s.jsx)(c(),{href:T(e.href),className:M(e.href),onClick:v,prefetch:!1,children:t},e.id)},Z=(e,t)=>{let r=k===e;return(0,s.jsxs)("div",{className:"relative",ref:L,children:[(0,s.jsxs)("button",{onClick:()=>C(r?null:e),className:"inline-flex items-center align-middle border-b-2 px-1 pt-1 space-x-1 ".concat(r?"text-blue-600 border-blue-600":"border-transparent text-gray-700 hover:text-blue-600"),children:[(0,s.jsx)("span",{children:e}),(0,s.jsx)("svg",{className:"w-4 h-4 transition-transform ".concat(r?"rotate-180":""),fill:"currentColor",viewBox:"0 0 20 20",children:(0,s.jsx)("path",{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"})})]}),r&&(0,s.jsx)("div",{className:"absolute top-full left-0 mt-1 min-w-[8rem] bg-white rounded-md shadow-lg border border-gray-200 z-50",children:(0,s.jsx)("div",{className:"py-1",children:t.map(e=>(0,s.jsx)(c(),{href:T(e.href),className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 transition-colors",onClick:()=>C(null),prefetch:!1,children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[e.icon&&(0,s.jsx)("span",{className:"text-base leading-none",children:P(e.icon,"w-4 h-4")}),(0,s.jsx)("span",{children:e.label})]})},e.id))})})]},e)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"fixed top-0 left-0 right-0 bg-white z-30 h-14 px-4 border-b border-gray-200 shadow-sm",children:(0,s.jsxs)("div",{className:"flex items-center justify-between h-full",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-4 mr-4 md:mr-6",children:[a&&(0,s.jsx)("button",{onClick:v,className:"mobile-menu-button p-2 rounded-md text-gray-600 hover:text-blue-600 hover:bg-gray-100 transition-colors","aria-label":"Toggle mobile menu",children:(0,s.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:j?"M6 18L18 6M6 6l12 12":"M4 6h16M4 12h16M4 18h16"})})}),(0,s.jsx)(c(),{href:"/",className:"flex items-center px-1 pt-1 h-full",prefetch:!1,children:(0,s.jsx)("div",{className:"h-20 w-20 flex items-center justify-center",children:(0,s.jsx)(l(),{src:"".concat(m.GW,"/skypilot.svg"),alt:"SkyPilot Logo",width:80,height:80,priority:!0,className:"w-full h-full object-contain"})})})]}),!a&&(0,s.jsxs)("div",{className:"flex items-center space-x-2 md:space-x-4 mr-6",children:[(0,s.jsxs)(c(),{href:"/clusters",className:H("/clusters"),prefetch:!1,children:[(0,s.jsx)(d.QT,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Clusters"})]}),(0,s.jsxs)(c(),{href:"/jobs",className:H("/jobs"),prefetch:!1,children:[(0,s.jsx)(d.Vp,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Jobs"})]}),(0,s.jsxs)(c(),{href:"/volumes",className:H("/volumes"),prefetch:!1,children:[(0,s.jsx)(d.eU,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Volumes"})]}),(0,s.jsx)("div",{className:"border-l border-gray-200 h-6 mx-1"}),(0,s.jsxs)(c(),{href:"/infra",className:H("/infra"),prefetch:!1,children:[(0,s.jsx)(d.PC,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Infra"})]}),(0,s.jsxs)(c(),{href:"/workspaces",className:H("/workspaces"),prefetch:!1,children:[(0,s.jsx)(d.E9,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Workspaces"})]}),(0,s.jsxs)(c(),{href:"/users",className:H("/users"),prefetch:!1,children:[(0,s.jsx)(d.oy,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Users"})]})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-1 ml-auto",children:[!a&&(0,s.jsxs)(s.Fragment,{children:[S.map(e=>F(e)),Object.entries(E).map(e=>{let[t,r]=e;return Z(t,r)}),(0,s.jsx)(h.WH,{content:"Documentation",className:"text-sm text-muted-foreground",children:(0,s.jsxs)("a",{href:"https://skypilot.readthedocs.io/en/latest/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center align-middle border-b-2 border-transparent px-1 pt-1 space-x-1 text-gray-600 hover:text-blue-600 transition-colors duration-150 cursor-pointer",title:"Docs",children:[(0,s.jsx)("span",{className:"leading-none",children:"Docs"}),(0,s.jsx)(d.h0,{className:"w-3.5 h-3.5"})]})}),(0,s.jsx)(h.WH,{content:"GitHub Repository",className:"text-sm text-muted-foreground",children:(0,s.jsx)("a",{href:"https://github.com/skypilot-org/skypilot",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center align-middle p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"GitHub",children:(0,s.jsx)(d.fy,{className:"w-5 h-5"})})}),(0,s.jsx)(h.WH,{content:"Join Slack",className:"text-sm text-muted-foreground",children:(0,s.jsx)("a",{href:"https://slack.skypilot.co/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center align-middle p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"Slack",children:(0,s.jsx)(d.mU,{className:"w-5 h-5"})})}),(0,s.jsx)(h.WH,{content:"Leave Feedback",className:"text-sm text-muted-foreground",children:(0,s.jsx)("a",{href:"https://github.com/skypilot-org/skypilot/issues/new",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center align-middle p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"Leave Feedback",children:(0,s.jsx)(d.aD,{className:"w-5 h-5"})})}),(0,s.jsx)("div",{className:"border-l border-gray-200 h-6"}),(0,s.jsx)(h.WH,{content:"Configuration",className:"text-sm text-muted-foreground",children:(0,s.jsx)(c(),{href:"/config",className:"inline-flex items-center justify-center p-2 rounded-full transition-colors duration-150 cursor-pointer ".concat(U("/config")?"text-blue-600 hover:bg-gray-100":"text-gray-600 hover:bg-gray-100"),title:"Configuration",prefetch:!1,children:(0,s.jsx)(x.Z,{className:"w-5 h-5"})})})]}),o&&(0,s.jsxs)("div",{className:"relative",ref:W,children:[(0,s.jsx)("button",{onClick:()=>w(!N),className:"inline-flex items-center justify-center rounded-full transition-colors duration-150 cursor-pointer hover:ring-2 hover:ring-blue-200",title:"User Profile",children:(0,s.jsx)("div",{className:"".concat(a?"w-6 h-6 text-xs":"w-7 h-7 text-sm"," bg-blue-600 text-white rounded-full flex items-center justify-center font-medium hover:bg-blue-700 transition-colors"),children:o?o.includes("@")?o.split("@")[0].charAt(0).toUpperCase():o.charAt(0).toUpperCase():"?"})}),N&&(0,s.jsxs)("div",{className:"absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg z-50 border border-gray-200",children:[(e=o,t=null,o&&o.includes("@")&&(e=o.split("@")[0],t=o),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"px-4 pt-2 pb-1 text-sm font-medium text-gray-900",children:e}),t&&(0,s.jsx)("div",{className:"px-4 pt-0 pb-1 text-xs text-gray-500",children:t}),b&&(0,s.jsx)("div",{className:"px-4 pt-0 pb-2 text-xs",children:"admin"===b?(0,s.jsxs)("span",{className:"inline-flex items-center text-blue-600",children:[(0,s.jsx)(d.r7,{className:"w-3 h-3 mr-1"}),"Admin"]}):(0,s.jsxs)("span",{className:"inline-flex items-center text-gray-600",children:[(0,s.jsx)(u.Z,{className:"w-3 h-3 mr-1"}),"User"]})})]})),(0,s.jsx)("div",{className:"border-t border-gray-200 mx-1 my-1"}),(0,s.jsx)(c(),{href:"/users",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-blue-600",onClick:()=>w(!1),prefetch:!1,children:"See all users"})]})]})]}),(0,s.jsx)("div",{className:"border-l border-gray-200 h-6 mx-1"})]})}),a&&(0,s.jsxs)(s.Fragment,{children:[j&&(0,s.jsx)("div",{className:"fixed top-14 left-0 right-0 bottom-0 bg-black bg-opacity-50 z-40",onClick:v}),(0,s.jsx)("div",{ref:z,className:"fixed top-14 left-0 h-[calc(100vh-56px)] w-64 bg-white border-r border-gray-200 shadow-lg z-50 transform transition-transform duration-300 ease-in-out ".concat(j?"translate-x-0":"-translate-x-full"),children:(0,s.jsx)("nav",{className:"flex-1 overflow-y-auto py-6",children:(0,s.jsxs)("div",{className:"px-4 space-y-1",children:[(0,s.jsxs)(c(),{href:"/clusters",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(U("/clusters")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:v,prefetch:!1,children:[(0,s.jsx)(d.QT,{className:"w-5 h-5 mr-3"}),"Clusters"]}),(0,s.jsxs)(c(),{href:"/jobs",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(U("/jobs")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:v,prefetch:!1,children:[(0,s.jsx)(d.Vp,{className:"w-5 h-5 mr-3"}),"Jobs"]}),(0,s.jsxs)(c(),{href:"/volumes",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(U("/volumes")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:v,prefetch:!1,children:[(0,s.jsx)(d.eU,{className:"w-5 h-5 mr-3"}),"Volumes"]}),(0,s.jsx)("div",{className:"border-t border-gray-200 my-4"}),(0,s.jsxs)(c(),{href:"/infra",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(U("/infra")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:v,prefetch:!1,children:[(0,s.jsx)(d.PC,{className:"w-5 h-5 mr-3"}),"Infra"]}),(0,s.jsxs)(c(),{href:"/workspaces",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(U("/workspaces")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:v,prefetch:!1,children:[(0,s.jsx)(d.E9,{className:"w-5 h-5 mr-3"}),"Workspaces"]}),(0,s.jsxs)(c(),{href:"/users",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(U("/users")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:v,prefetch:!1,children:[(0,s.jsx)(d.oy,{className:"w-5 h-5 mr-3"}),"Users"]}),(0,s.jsx)("div",{className:"border-t border-gray-200 my-4"}),S.map(e=>R(e)),Object.entries(E).map(e=>{let[t,r]=e;return(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"px-4 py-2 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:t}),r.map(e=>R(e))]},t)}),(S.length>0||Object.keys(E).length>0)&&(0,s.jsx)("div",{className:"border-t border-gray-200 my-4"}),(0,s.jsxs)("a",{href:"https://skypilot.readthedocs.io/en/latest/",target:"_blank",rel:"noopener noreferrer",className:"flex items-center px-4 py-3 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-blue-600 rounded-md transition-colors",onClick:v,children:[(0,s.jsx)(d.h0,{className:"w-5 h-5 mr-3"}),"Documentation"]}),(0,s.jsxs)("a",{href:"https://github.com/skypilot-org/skypilot",target:"_blank",rel:"noopener noreferrer",className:"flex items-center px-4 py-3 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-blue-600 rounded-md transition-colors",onClick:v,children:[(0,s.jsx)(d.fy,{className:"w-5 h-5 mr-3"}),"GitHub"]}),(0,s.jsxs)("a",{href:"https://slack.skypilot.co/",target:"_blank",rel:"noopener noreferrer",className:"flex items-center px-4 py-3 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-blue-600 rounded-md transition-colors",onClick:v,children:[(0,s.jsx)(d.mU,{className:"w-5 h-5 mr-3"}),"Slack"]}),(0,s.jsxs)(c(),{href:"/config",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(U("/config")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:v,prefetch:!1,children:[(0,s.jsx)(x.Z,{className:"w-5 h-5 mr-3"}),"Configuration"]})]})})})]})]})}},23001:function(e,t,r){r.d(t,{X:function(){return n}});var s=r(67294);function n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[t,r]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let t=()=>{r(window.innerWidth<e)};return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[e]),t}}}]);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9360,8640],{88507:function(e,s,t){t.d(s,{Z:function(){return r}});/**
|
|
2
|
+
* @license lucide-react v0.407.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/let r=(0,t(60998).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},81260:function(e,s,t){t.d(s,{Z:function(){return r}});/**
|
|
7
|
+
* @license lucide-react v0.407.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/let r=(0,t(60998).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},47603:function(e,s,t){t.d(s,{Z:function(){return r}});/**
|
|
12
|
+
* @license lucide-react v0.407.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/let r=(0,t(60998).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},28586:function(e,s,t){t.d(s,{Z:function(){return r}});/**
|
|
17
|
+
* @license lucide-react v0.407.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/let r=(0,t(60998).Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},43767:function(e,s,t){t.d(s,{Z:function(){return r}});/**
|
|
22
|
+
* @license lucide-react v0.407.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/let r=(0,t(60998).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},1812:function(e,s,t){t.d(s,{X:function(){return l}});var r=t(85893),a=t(67294);let n=e=>{if(!(null==e?void 0:e.message))return"An unexpected error occurred.";let s=e.message;return s.includes("failed:")&&(s=s.split("failed:")[1].trim()),s},l=e=>{let{error:s,title:t="Error",onDismiss:l}=e,[o,i]=(0,a.useState)(!1);if((0,a.useEffect)(()=>{s&&i(!1)},[s]),!s||o)return null;let c="string"==typeof s?s:n(s);return(0,r.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:(0,r.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,r.jsx)("div",{className:"ml-3",children:(0,r.jsxs)("div",{className:"text-sm text-red-800",children:[(0,r.jsxs)("strong",{children:[t,":"]})," ",c]})})]}),(0,r.jsx)("button",{onClick:()=>{i(!0),l&&l()},className:"flex-shrink-0 ml-4 text-red-400 hover:text-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-50 rounded","aria-label":"Dismiss error",children:(0,r.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}},82077:function(e,s,t){t.r(s),t.d(s,{Workspaces:function(){return z},getWorkspaceClusters:function(){return _},getWorkspaceManagedJobs:function(){return L}});var r=t(85893),a=t(67294),n=t(11163),l=t(17324),o=t(37673),i=t(68764),c=t(30803),d=t(55739),u=t(1272),m=t(50326);t(53850);var h=t(1812),x=t(13626),p=t(81260);/**
|
|
27
|
+
* @license lucide-react v0.407.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/let f=(0,t(60998).Z)("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);var g=t(47603),j=t(23001),v=t(47615),w=t(6378),k=t(51214),b=t(36856),y=t(47145),N=t(94545),C=t(93225),E=t(41664),S=t.n(E);async function _(e){try{return(await y.x.fetch("/status",{cluster_names:null,all_users:!0,include_credentials:!1,include_handle:!1,override_skypilot_config:{active_workspace:e}})).map(e=>({status:"UP"===e.status?"RUNNING":"STOPPED"===e.status?"STOPPED":"INIT"===e.status?"LAUNCHING":"TERMINATED",cluster:e.name,user:e.user_name,user_hash:e.user_hash,cluster_hash:e.cluster_hash,cloud:e.cloud,region:e.region,zone:e.zone,launched_at:e.launched_at,handle:e.handle,last_use:e.last_use,autostop:e.autostop,to_down:e.to_down,resources_str:e.resources_str,workspace:e.workspace||"default"})).filter(s=>s.workspace===e)}catch(t){let s="Error fetching clusters for workspace ".concat(e,": ").concat(t);throw console.error(s),Error(s)}}async function L(e){try{let s=await y.x.post("/jobs/queue/v2",{all_users:!0,verbose:!0,skip_finished:!0,workspace_match:e,fields:["workspace","status"],override_skypilot_config:{active_workspace:e}});if(!s.ok){let t="Initial API request to get managed jobs failed with status ".concat(s.status," for workspace ").concat(e);throw Error(t)}let t=s.headers.get("X-Skypilot-Request-ID");if(!t){let s="No request ID received from server for getting managed jobs for workspace ".concat(e);throw Error(s)}let r=await y.x.get("/api/get?request_id=".concat(t)),a=r.statusText;if(500===r.status)try{let e=await r.json();if(e.detail&&e.detail.error)try{let s=JSON.parse(e.detail.error);if(s.type&&s.type===C.iW)return{jobs:[]};a=s.message||String(e.detail.error)}catch(s){console.error("Error parsing JSON from data.detail.error:",s),a=String(e.detail.error)}}catch(e){console.error("Error parsing response JSON:",e),a=String(e)}if(!r.ok){let s="API request to get managed jobs result failed with status ".concat(r.status,", error: ").concat(a," for workspace ").concat(e);throw Error(s)}let n=await r.json(),l=n.return_value?JSON.parse(n.return_value):{jobs:[]};return l.jobs&&(l.jobs=l.jobs.map(e=>({...e,workspace:e.workspace||"default"})),l.jobs=l.jobs.filter(s=>s.workspace===e)),l}catch(t){let s="Error fetching managed jobs for workspace ".concat(e,": ").concat(t);throw console.error(s),Error(s)}}let Z=e=>{let{isPrivate:s}=e;return s?(0,r.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-700 border border-gray-300",children:"Private"}):(0,r.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-700 border border-green-300",children:"Public"})};function z(){let[e,s]=(0,a.useState)([]),[t,E]=(0,a.useState)({runningClusters:0,totalClusters:0,managedJobs:0}),[z,D]=(0,a.useState)(!0),[M,R]=(0,a.useState)(null),[O,P]=(0,a.useState)({key:"name",direction:"asc"}),[T,W]=(0,a.useState)(""),[J,A]=(0,a.useState)(!1),[I,F]=(0,a.useState)({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null}),[q,V]=(0,a.useState)({open:!1,message:"",userName:""}),[B,H]=(0,a.useState)(null),[X,U]=(0,a.useState)(!1),[G,K]=(0,a.useState)(null),[$,Q]=(0,a.useState)(null),Y=(0,n.useRouter)(),ee=(0,j.X)(),es=async()=>{if(B&&Date.now()-B.timestamp<3e5)return B;U(!0);try{let e=await y.x.get("/users/role");if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to get user role")}let s=await e.json(),t={role:s.role,name:s.name,timestamp:Date.now()};return H(t),U(!1),t}catch(e){throw U(!1),e}},et=async(e,s)=>{try{let t=await es();if("admin"!==t.role)return V({open:!0,message:e,userName:t.name.toLowerCase()}),!1;return s(),!0}catch(e){return console.error("Failed to check user role:",e),V({open:!0,message:"Error: ".concat(e.message),userName:""}),!1}},er=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&D(!0);try{let e=await w.default.get(l.getWorkspaces);R(e);let t=Object.keys(e),r=t.map(async e=>{try{let[s,t,r]=await Promise.all([w.default.get(l.getEnabledClouds,[e]),w.default.get(_,[e]),w.default.get(L,[e])]);return{workspaceName:e,enabledClouds:s,clusters:t||[],managedJobs:r||{jobs:[]}}}catch(s){return console.error("Error fetching workspace data:",s),{workspaceName:e,enabledClouds:[],clusters:[],managedJobs:{jobs:[]}}}}),a=await Promise.all(r),n=[],o=[],i={};a.forEach(e=>{let{workspaceName:s,enabledClouds:t,clusters:r,managedJobs:a}=e;r.forEach(e=>{n.push(e)}),a.jobs.forEach(e=>{o.push(e)}),i[s]=t}),Object.fromEntries(n.map(e=>[e.cluster,e.workspace||"default"]));let c={};t.forEach(e=>{c[e]={name:e,totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:new Set}});let d=0;n.forEach(e=>{let s=e.workspace||"default";c[s]||(c[s]={name:s,totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:new Set}),c[s].totalClusterCount++,("RUNNING"===e.status||"LAUNCHING"===e.status)&&(c[s].runningClusterCount++,d++),e.cloud&&c[s].clouds.add(e.cloud)});let u=new Set(v.statusGroups.active),m=0;(o||[]).forEach(e=>{let s=e.workspace||"default";c[s]&&u.has(e.status)&&c[s].managedJobsCount++,u.has(e.status)&&m++});let h=Object.values(c).filter(e=>t.includes(e.name)).map(e=>{let s=Array.isArray(i[e.name])?i[e.name]:[];return{...e,clouds:s}}).sort((e,s)=>e.name.localeCompare(s.name));s(h),E({runningClusters:d,totalClusters:n.length,managedJobs:m})}catch(e){console.error("Error fetching workspace data:",e),s([]),E({runningClusters:0,totalClusters:0,managedJobs:0})}e&&D(!1)};(0,a.useEffect)(()=>{(async()=>{await b.ZP.preloadForPage("workspaces"),er(!0)})();let e=setInterval(()=>{"visible"===window.document.visibilityState&&er(!1)},k.nb.REFRESH_INTERVAL);return()=>clearInterval(e)},[]);let ea=e=>{let s="asc";O.key===e&&"asc"===O.direction&&(s="desc"),P({key:e,direction:s})},en=e=>O.key===e?"asc"===O.direction?" ↑":" ↓":"",el=a.useMemo(()=>{if(!e)return[];let s=e;if(T&&""!==T.trim()){let t=T.toLowerCase().trim();s=e.filter(e=>!!(e.name.toLowerCase().includes(t)||e.clouds.some(e=>{let s=C.Z2[e.toLowerCase()]||e;return e.toLowerCase().includes(t)||s.toLowerCase().includes(t)}))||!!(!0===((null==M?void 0:M[e.name])||{}).private?"private":"public").includes(t))}return(0,N.R0)(s,O.key,O.direction)},[e,O,T,M]),eo=e=>{et("cannot delete workspace",()=>{F({confirmOpen:!0,workspaceToDelete:e,deleting:!1,error:null})})},ei=async()=>{if(I.workspaceToDelete){F(e=>({...e,deleting:!0,error:null}));try{await (0,l.zl)(I.workspaceToDelete),Q('Workspace "'.concat(I.workspaceToDelete,'" deleted successfully!')),F({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null}),w.default.invalidate(l.getWorkspaces),w.default.invalidateFunction(_),w.default.invalidateFunction(L),await er(!0)}catch(e){console.error("Error deleting workspace:",e),F(e=>({...e,deleting:!1,error:null})),K(e)}}},ec=()=>{F({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null})},ed=e=>{et("cannot edit workspace",()=>{Y.push("/workspaces/".concat(e))})};return z&&0===e.length?(0,r.jsxs)("div",{className:"flex justify-center items-center h-64",children:[(0,r.jsx)(d.Z,{}),(0,r.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading workspaces..."})]}):(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"fixed top-20 right-4 z-[9999] max-w-md",children:[$&&(0,r.jsx)("div",{className:"bg-green-50 border border-green-200 rounded p-4 mb-4",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:(0,r.jsx)("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),(0,r.jsx)("div",{className:"ml-3",children:(0,r.jsx)("p",{className:"text-sm font-medium text-green-800",children:$})})]}),(0,r.jsx)("div",{className:"ml-auto pl-3",children:(0,r.jsxs)("button",{type:"button",onClick:()=>Q(null),className:"inline-flex rounded-md bg-green-50 p-1.5 text-green-500 hover:bg-green-100",children:[(0,r.jsx)("span",{className:"sr-only",children:"Dismiss"}),(0,r.jsx)("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})]})}),(0,r.jsx)(h.X,{error:G,title:"Error",onDismiss:()=>K(null)})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2 h-5",children:[(0,r.jsx)("div",{className:"text-base flex items-center",children:(0,r.jsx)("span",{className:"text-sky-blue leading-none",children:"Workspaces"})}),(0,r.jsxs)("div",{className:"flex items-center",children:[z&&(0,r.jsxs)("div",{className:"flex items-center mr-2",children:[(0,r.jsx)(d.Z,{size:15,className:"mt-0"}),(0,r.jsx)("span",{className:"ml-2 text-gray-500 text-xs",children:"Refreshing..."})]}),(0,r.jsxs)("button",{onClick:()=>{w.default.invalidate(l.getWorkspaces),w.default.invalidateFunction(l.getEnabledClouds),w.default.invalidateFunction(_),w.default.invalidateFunction(L),er(!0)},disabled:z,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,r.jsx)(x.Z,{className:"h-4 w-4 mr-1.5"}),!ee&&(0,r.jsx)("span",{children:"Refresh"})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{className:"relative flex-1 max-w-md",children:[(0,r.jsx)("input",{type:"text",placeholder:"Filter workspaces",value:T,onChange:e=>W(e.target.value),className:"h-8 w-full px-3 pr-8 text-sm border border-gray-300 rounded-md focus:ring-1 focus:ring-sky-500 focus:border-sky-500 outline-none"}),T&&(0,r.jsx)("button",{onClick:()=>W(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",title:"Clear search",children:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,r.jsx)("button",{onClick:()=>{et("cannot create workspace",()=>{Y.push("/workspace/new")})},disabled:X,className:"ml-4 bg-sky-600 hover:bg-sky-700 text-white flex items-center rounded-md px-3 py-1 text-sm font-medium transition-colors duration-200",title:"Create Workspace",children:X?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d.Z,{size:12,className:"mr-2"}),(0,r.jsx)("span",{children:"Create Workspace"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p.Z,{className:"h-4 w-4 mr-2"}),"Create Workspace"]})})]}),0!==e.length||z?(0,r.jsx)(o.Zb,{children:(0,r.jsx)("div",{className:"overflow-x-auto rounded-lg",children:(0,r.jsxs)(i.iA,{className:"min-w-full",children:[(0,r.jsx)(i.xD,{children:(0,r.jsxs)(i.SC,{children:[(0,r.jsxs)(i.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>ea("name"),children:["Workspace",en("name")]}),(0,r.jsxs)(i.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>ea("totalClusterCount"),children:["Clusters ",en("totalClusterCount")]}),(0,r.jsxs)(i.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>ea("managedJobsCount"),children:["Jobs",en("managedJobsCount")]}),(0,r.jsx)(i.ss,{className:"whitespace-nowrap",children:"Enabled infra"}),(0,r.jsx)(i.ss,{className:"whitespace-nowrap",children:"Actions"})]})}),(0,r.jsx)(i.RM,{children:z&&0===el.length?(0,r.jsx)(i.SC,{children:(0,r.jsx)(i.pj,{colSpan:5,className:"text-center py-6 text-gray-500",children:(0,r.jsxs)("div",{className:"flex justify-center items-center",children:[(0,r.jsx)(d.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]})})}):el.length>0?el.map(e=>{let s=!0===((null==M?void 0:M[e.name])||{}).private;return(0,r.jsxs)(i.SC,{className:"hover:bg-gray-50",children:[(0,r.jsxs)(i.pj,{className:"",children:[(0,r.jsx)("button",{onClick:()=>ed(e.name),disabled:X,className:"text-blue-600 hover:text-blue-600 hover:underline text-left",children:e.name}),(0,r.jsx)("span",{className:"ml-2",children:(0,r.jsx)(Z,{isPrivate:s})})]}),(0,r.jsx)(i.pj,{children:(0,r.jsxs)("button",{onClick:()=>{Y.push({pathname:"/clusters",query:{workspace:e.name}})},className:"text-gray-700 hover:text-blue-600 hover:underline",children:[e.runningClusterCount," running,"," ",e.totalClusterCount," total"]})}),(0,r.jsx)(i.pj,{children:(0,r.jsx)("button",{onClick:()=>{Y.push({pathname:"/jobs",query:{workspace:e.name}})},className:"text-gray-700 hover:text-blue-600 hover:underline",children:e.managedJobsCount})}),(0,r.jsx)(i.pj,{children:e.clouds.length>0?[...e.clouds].sort().map((s,t)=>{let a=C.Z2[s.toLowerCase()]||s;return(0,r.jsxs)("span",{children:[(0,r.jsx)(S(),{href:"/infra",className:"inline-flex items-center px-2 py-1 rounded text-sm bg-sky-100 text-sky-800 hover:bg-sky-200 hover:text-sky-900 transition-colors duration-200",children:a}),t<e.clouds.length-1&&" "]},s)}):(0,r.jsx)("span",{className:"text-gray-500 text-sm",children:"-"})}),(0,r.jsxs)(i.pj,{children:[(0,r.jsx)(c.z,{variant:"ghost",size:"sm",onClick:()=>ed(e.name),disabled:X,className:"text-gray-600 hover:text-gray-800 mr-1",children:(0,r.jsx)(f,{className:"w-4 h-4"})}),(0,r.jsx)(c.z,{variant:"ghost",size:"sm",onClick:()=>eo(e.name),disabled:"default"===e.name||X,title:"default"===e.name?"Cannot delete default workspace":"Delete workspace",className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:(0,r.jsx)(g.Z,{className:"w-4 h-4"})})]})]},e.name)}):(0,r.jsx)(i.SC,{children:(0,r.jsx)(i.pj,{colSpan:5,className:"text-center py-6 text-gray-500",children:"No workspaces found"})})})]})})}):(0,r.jsxs)("div",{className:"text-center py-10",children:[(0,r.jsx)("p",{className:"text-lg text-gray-600",children:"No workspaces found."}),(0,r.jsx)("p",{className:"text-sm text-gray-500 mt-2",children:"Create a cluster to see its workspace here."})]}),M&&(0,r.jsx)(m.Vq,{open:J,onOpenChange:A,children:(0,r.jsxs)(m.cZ,{className:"sm:max-w-md md:max-w-lg lg:max-w-xl xl:max-w-2xl w-full max-h-[90vh] flex flex-col",children:[(0,r.jsx)(m.fK,{children:(0,r.jsx)(m.$N,{className:"pr-10",children:"All Workspaces Configuration"})}),(0,r.jsx)("div",{className:"flex-grow overflow-y-auto py-4",children:(0,r.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",overflowX:"auto",whiteSpace:"pre",wordBreak:"normal"},children:u.ZP.dump(M,{indent:2})})})]})}),(0,r.jsx)(m.Vq,{open:q.open,onOpenChange:e=>{V(s=>({...s,open:e})),e||K(null)},children:(0,r.jsxs)(m.cZ,{className:"sm:max-w-md transition-all duration-200 ease-in-out",children:[(0,r.jsxs)(m.fK,{children:[(0,r.jsx)(m.$N,{children:"Permission Denied"}),(0,r.jsx)(m.Be,{children:X?(0,r.jsxs)("div",{className:"flex items-center py-2",children:[(0,r.jsx)(d.Z,{size:16,className:"mr-2"}),(0,r.jsx)("span",{children:"Checking permissions..."})]}):(0,r.jsx)(r.Fragment,{children:q.userName?(0,r.jsxs)(r.Fragment,{children:[q.userName," is logged in as non-admin and ",q.message,"."]}):q.message})})]}),(0,r.jsx)(m.cN,{children:(0,r.jsx)(c.z,{variant:"outline",onClick:()=>V(e=>({...e,open:!1})),disabled:X,children:"OK"})})]})}),(0,r.jsx)(m.Vq,{open:I.confirmOpen,onOpenChange:e=>{e||(ec(),K(null))},children:(0,r.jsxs)(m.cZ,{className:"sm:max-w-md",children:[(0,r.jsxs)(m.fK,{children:[(0,r.jsx)(m.$N,{children:"Delete Workspace"}),(0,r.jsxs)(m.Be,{children:['Are you sure you want to delete workspace "',I.workspaceToDelete,'"? This action cannot be undone.']})]}),(0,r.jsxs)(m.cN,{children:[(0,r.jsx)(c.z,{variant:"outline",onClick:ec,disabled:I.deleting,children:"Cancel"}),(0,r.jsx)(c.z,{variant:"destructive",onClick:ei,disabled:I.deleting,children:I.deleting?"Deleting...":"Delete"})]})]})})]})}k.nb.REFRESH_INTERVAL},23001:function(e,s,t){t.d(s,{X:function(){return a}});var r=t(67294);function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[s,t]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let s=()=>{t(window.innerWidth<e)};return s(),window.addEventListener("resize",s),()=>{window.removeEventListener("resize",s)}},[e]),s}},12003:function(e,s,t){t.d(s,{j:function(){return l}});var r=t(90512);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,n=r.W,l=(e,s)=>t=>{var r;if((null==s?void 0:s.variants)==null)return n(e,null==t?void 0:t.class,null==t?void 0:t.className);let{variants:l,defaultVariants:o}=s,i=Object.keys(l).map(e=>{let s=null==t?void 0:t[e],r=null==o?void 0:o[e];if(null===s)return null;let n=a(s)||a(r);return l[e][n]}),c=t&&Object.entries(t).reduce((e,s)=>{let[t,r]=s;return void 0===r||(e[t]=r),e},{});return n(e,i,null==s?void 0:null===(r=s.compoundVariants)||void 0===r?void 0:r.reduce((e,s)=>{let{class:t,className:r,...a}=s;return Object.entries(a).every(e=>{let[s,t]=e;return Array.isArray(t)?t.includes({...o,...c}[s]):({...o,...c})[s]===t})?[...e,t,r]:e},[]),null==t?void 0:t.class,null==t?void 0:t.className)}}}]);
|