skypilot-nightly 1.0.0.dev20250804__py3-none-any.whl → 1.0.0.dev20250807__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.
Potentially problematic release.
This version of skypilot-nightly might be problematic. Click here for more details.
- sky/__init__.py +2 -2
- sky/backends/cloud_vm_ray_backend.py +33 -4
- sky/catalog/kubernetes_catalog.py +8 -0
- sky/catalog/nebius_catalog.py +0 -1
- sky/check.py +11 -1
- sky/client/cli/command.py +234 -100
- sky/client/sdk.py +30 -9
- sky/client/sdk_async.py +815 -0
- sky/clouds/kubernetes.py +6 -1
- sky/clouds/nebius.py +1 -4
- sky/dashboard/out/404.html +1 -1
- sky/dashboard/out/_next/static/YAirOGsV1z6B2RJ0VIUmD/_buildManifest.js +1 -0
- sky/dashboard/out/_next/static/chunks/1141-a8a8f1adba34c892.js +11 -0
- sky/dashboard/out/_next/static/chunks/1871-980a395e92633a5c.js +6 -0
- sky/dashboard/out/_next/static/chunks/3785.6003d293cb83eab4.js +1 -0
- sky/dashboard/out/_next/static/chunks/{3698-7874720877646365.js → 3850-ff4a9a69d978632b.js} +1 -1
- sky/dashboard/out/_next/static/chunks/4725.29550342bd53afd8.js +1 -0
- sky/dashboard/out/_next/static/chunks/{4937.d6bf67771e353356.js → 4937.a2baa2df5572a276.js} +1 -1
- sky/dashboard/out/_next/static/chunks/6130-2be46d70a38f1e82.js +1 -0
- sky/dashboard/out/_next/static/chunks/6601-3e21152fe16da09c.js +1 -0
- sky/dashboard/out/_next/static/chunks/{691.6d99cbfba347cebf.js → 691.5eeedf82cc243343.js} +1 -1
- sky/dashboard/out/_next/static/chunks/6989-6129c1cfbcf51063.js +1 -0
- sky/dashboard/out/_next/static/chunks/6990-0f886f16e0d55ff8.js +1 -0
- sky/dashboard/out/_next/static/chunks/8056-019615038d6ce427.js +1 -0
- sky/dashboard/out/_next/static/chunks/8252.62b0d23aed618bb2.js +16 -0
- sky/dashboard/out/_next/static/chunks/8969-318c3dca725e8e5d.js +1 -0
- sky/dashboard/out/_next/static/chunks/{9025.7937c16bc8623516.js → 9025.a1bef12d672bb66d.js} +1 -1
- sky/dashboard/out/_next/static/chunks/9159-11421c0f2909236f.js +1 -0
- sky/dashboard/out/_next/static/chunks/9360.85b0b1b4054574dd.js +31 -0
- sky/dashboard/out/_next/static/chunks/9666.cd4273f2a5c5802c.js +1 -0
- sky/dashboard/out/_next/static/chunks/{9847.4c46c5e229c78704.js → 9847.757720f3b40c0aa5.js} +1 -1
- sky/dashboard/out/_next/static/chunks/{9984.78ee6d2c6fa4b0e8.js → 9984.c5564679e467d245.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/{_app-a67ae198457b9886.js → _app-1e6de35d15a8d432.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-6fd1d2d8441aa54b.js +11 -0
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-155d477a6c3e04e2.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/clusters-b30460f683e6ba96.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/{config-8620d099cbef8608.js → config-dfb9bf07b13045f4.js} +1 -1
- sky/dashboard/out/_next/static/chunks/pages/infra/[context]-13d53fffc03ccb52.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/infra-fc9222e26c8e2f0d.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-154f55cf8af55be5.js +11 -0
- sky/dashboard/out/_next/static/chunks/pages/jobs/pools/[pool]-f5ccf5d39d87aebe.js +21 -0
- sky/dashboard/out/_next/static/chunks/pages/jobs-cdc60fb5d371e16a.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/users-7ed36e44e779d5c7.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/volumes-c9695d657f78b5dc.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/workspace/new-3f88a1c7e86a3f86.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/workspaces/[name]-f72f73bcef9541dc.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/workspaces-8f67be60165724cc.js +1 -0
- sky/dashboard/out/_next/static/chunks/webpack-76efbdad99742559.js +1 -0
- sky/dashboard/out/_next/static/css/4614e06482d7309e.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 -0
- sky/dashboard/out/jobs.html +1 -1
- 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/global_user_state.py +14 -2
- sky/jobs/__init__.py +2 -0
- sky/jobs/client/sdk.py +43 -2
- sky/jobs/client/sdk_async.py +135 -0
- sky/jobs/server/core.py +48 -1
- sky/jobs/server/server.py +52 -3
- sky/jobs/state.py +5 -1
- sky/jobs/utils.py +3 -1
- sky/provision/kubernetes/utils.py +30 -4
- sky/provision/nebius/instance.py +1 -0
- sky/provision/nebius/utils.py +9 -1
- sky/schemas/db/global_user_state/002_add_workspace_to_cluster_history.py +35 -0
- sky/schemas/db/spot_jobs/003_pool_hash.py +34 -0
- sky/serve/client/impl.py +85 -1
- sky/serve/client/sdk.py +16 -47
- sky/serve/client/sdk_async.py +130 -0
- sky/serve/constants.py +3 -1
- sky/serve/controller.py +6 -3
- sky/serve/load_balancer.py +3 -1
- sky/serve/serve_state.py +93 -5
- sky/serve/serve_utils.py +200 -67
- sky/serve/server/core.py +13 -197
- sky/serve/server/impl.py +261 -23
- sky/serve/service.py +15 -3
- sky/server/auth/__init__.py +0 -0
- sky/server/auth/authn.py +46 -0
- sky/server/auth/oauth2_proxy.py +185 -0
- sky/server/common.py +119 -21
- sky/server/constants.py +1 -1
- sky/server/daemons.py +60 -11
- sky/server/requests/executor.py +5 -3
- sky/server/requests/payloads.py +19 -0
- sky/server/rest.py +114 -0
- sky/server/server.py +44 -40
- sky/setup_files/dependencies.py +2 -0
- sky/skylet/constants.py +1 -1
- sky/skylet/events.py +5 -1
- sky/skylet/skylet.py +3 -1
- sky/task.py +61 -21
- sky/templates/kubernetes-ray.yml.j2 +9 -0
- sky/templates/nebius-ray.yml.j2 +1 -0
- sky/templates/sky-serve-controller.yaml.j2 +1 -0
- sky/usage/usage_lib.py +8 -6
- sky/utils/annotations.py +8 -3
- sky/utils/common_utils.py +11 -1
- sky/utils/controller_utils.py +7 -0
- sky/utils/db/migration_utils.py +2 -2
- sky/utils/rich_utils.py +120 -0
- {skypilot_nightly-1.0.0.dev20250804.dist-info → skypilot_nightly-1.0.0.dev20250807.dist-info}/METADATA +22 -13
- {skypilot_nightly-1.0.0.dev20250804.dist-info → skypilot_nightly-1.0.0.dev20250807.dist-info}/RECORD +120 -112
- sky/client/sdk.pyi +0 -300
- sky/dashboard/out/_next/static/KiGGm4fK0CpmN6BT17jkh/_buildManifest.js +0 -1
- sky/dashboard/out/_next/static/chunks/1043-928582d4860fef92.js +0 -1
- sky/dashboard/out/_next/static/chunks/1141-3f10a5a9f697c630.js +0 -11
- sky/dashboard/out/_next/static/chunks/1664-22b00e32c9ff96a4.js +0 -1
- sky/dashboard/out/_next/static/chunks/1871-7e17c195296e2ea9.js +0 -6
- sky/dashboard/out/_next/static/chunks/2003.f90b06bb1f914295.js +0 -1
- sky/dashboard/out/_next/static/chunks/2350.fab69e61bac57b23.js +0 -1
- sky/dashboard/out/_next/static/chunks/3785.95524bc443db8260.js +0 -1
- sky/dashboard/out/_next/static/chunks/4725.42f21f250f91f65b.js +0 -1
- sky/dashboard/out/_next/static/chunks/4869.18e6a4361a380763.js +0 -16
- sky/dashboard/out/_next/static/chunks/5230-f3bb2663e442e86c.js +0 -1
- sky/dashboard/out/_next/static/chunks/6601-234b1cf963c7280b.js +0 -1
- sky/dashboard/out/_next/static/chunks/6989-983d3ae7a874de98.js +0 -1
- sky/dashboard/out/_next/static/chunks/6990-08b2a1cae076a943.js +0 -1
- sky/dashboard/out/_next/static/chunks/8969-9a8cca241b30db83.js +0 -1
- sky/dashboard/out/_next/static/chunks/938-40d15b6261ec8dc1.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-fa63e8b1d203f298.js +0 -11
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-9e7df5fc761c95a7.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/clusters-956ad430075efee8.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/infra/[context]-9cfd875eecb6eaf5.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/infra-0fbdc9072f19fbe2.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-6c5af4c86e6ab3d3.js +0 -11
- sky/dashboard/out/_next/static/chunks/pages/jobs-6393a9edc7322b54.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/users-34d6bb10c3b3ee3d.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/volumes-225c8dae0634eb7f.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/workspace/new-92f741084a89e27b.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/workspaces/[name]-4d41c9023287f59a.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/workspaces-e4cb7e97d37e93ad.js +0 -1
- sky/dashboard/out/_next/static/chunks/webpack-13145516b19858fb.js +0 -1
- sky/dashboard/out/_next/static/css/b3227360726f12eb.css +0 -3
- /sky/dashboard/out/_next/static/{KiGGm4fK0CpmN6BT17jkh → YAirOGsV1z6B2RJ0VIUmD}/_ssgManifest.js +0 -0
- /sky/dashboard/out/_next/static/chunks/{6135-d0e285ac5f3f2485.js → 6135-85426374db04811e.js} +0 -0
- {skypilot_nightly-1.0.0.dev20250804.dist-info → skypilot_nightly-1.0.0.dev20250807.dist-info}/WHEEL +0 -0
- {skypilot_nightly-1.0.0.dev20250804.dist-info → skypilot_nightly-1.0.0.dev20250807.dist-info}/entry_points.txt +0 -0
- {skypilot_nightly-1.0.0.dev20250804.dist-info → skypilot_nightly-1.0.0.dev20250807.dist-info}/licenses/LICENSE +0 -0
- {skypilot_nightly-1.0.0.dev20250804.dist-info → skypilot_nightly-1.0.0.dev20250807.dist-info}/top_level.txt +0 -0
sky/client/sdk.pyi
DELETED
|
@@ -1,300 +0,0 @@
|
|
|
1
|
-
"""Stub for sky.client.sdk, generated by stubgen."""
|
|
2
|
-
import io
|
|
3
|
-
from typing import Any, Dict, List, Optional, Tuple, Union
|
|
4
|
-
|
|
5
|
-
from _typeshed import Incomplete
|
|
6
|
-
import requests
|
|
7
|
-
|
|
8
|
-
import sky
|
|
9
|
-
from sky import admin_policy as admin_policy
|
|
10
|
-
from sky import backends as backends
|
|
11
|
-
from sky import exceptions as exceptions
|
|
12
|
-
from sky import sky_logging as sky_logging
|
|
13
|
-
from sky import skypilot_config as skypilot_config
|
|
14
|
-
from sky.server import common as server_common
|
|
15
|
-
from sky.server import rest as rest
|
|
16
|
-
from sky.server.requests import payloads as payloads
|
|
17
|
-
from sky.skylet import autostop_lib as autostop_lib
|
|
18
|
-
from sky.skylet import constants as constants
|
|
19
|
-
from sky.usage import usage_lib as usage_lib
|
|
20
|
-
from sky.utils import admin_policy_utils as admin_policy_utils
|
|
21
|
-
from sky.utils import annotations as annotations
|
|
22
|
-
from sky.utils import cluster_utils as cluster_utils
|
|
23
|
-
from sky.utils import common as common
|
|
24
|
-
from sky.utils import common_utils as common_utils
|
|
25
|
-
from sky.utils import dag_utils as dag_utils
|
|
26
|
-
from sky.utils import env_options as env_options
|
|
27
|
-
from sky.utils import infra_utils as infra_utils
|
|
28
|
-
from sky.utils import rich_utils as rich_utils
|
|
29
|
-
from sky.utils import status_lib as status_lib
|
|
30
|
-
from sky.utils import subprocess_utils as subprocess_utils
|
|
31
|
-
from sky.utils import ux_utils as ux_utils
|
|
32
|
-
from sky.utils.kubernetes import ssh_utils as ssh_utils
|
|
33
|
-
|
|
34
|
-
logger: Incomplete
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def reload_config() -> None:
|
|
38
|
-
...
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def stream_response(request_id: Optional[str],
|
|
42
|
-
response: requests.Response,
|
|
43
|
-
output_stream: Optional['io.TextIOBase'] = ...,
|
|
44
|
-
resumable: bool = ...) -> Any:
|
|
45
|
-
...
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
def check(infra_list: Optional[Tuple[str, ...]],
|
|
49
|
-
verbose: bool,
|
|
50
|
-
workspace: Optional[str] = ...) -> server_common.RequestId:
|
|
51
|
-
...
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def enabled_clouds(workspace: Optional[str] = ...,
|
|
55
|
-
expand: bool = ...) -> server_common.RequestId:
|
|
56
|
-
...
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
def list_accelerators(gpus_only: bool = ...,
|
|
60
|
-
name_filter: Optional[str] = ...,
|
|
61
|
-
region_filter: Optional[str] = ...,
|
|
62
|
-
quantity_filter: Optional[int] = ...,
|
|
63
|
-
clouds: Optional[Union[List[str], str]] = ...,
|
|
64
|
-
all_regions: bool = ...,
|
|
65
|
-
require_price: bool = ...,
|
|
66
|
-
case_sensitive: bool = ...) -> server_common.RequestId:
|
|
67
|
-
...
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
def list_accelerator_counts(
|
|
71
|
-
gpus_only: bool = ...,
|
|
72
|
-
name_filter: Optional[str] = ...,
|
|
73
|
-
region_filter: Optional[str] = ...,
|
|
74
|
-
quantity_filter: Optional[int] = ...,
|
|
75
|
-
clouds: Optional[Union[List[str],
|
|
76
|
-
str]] = ...) -> server_common.RequestId:
|
|
77
|
-
...
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
def optimize(
|
|
81
|
-
dag: sky.Dag,
|
|
82
|
-
minimize: common.OptimizeTarget = ...,
|
|
83
|
-
admin_policy_request_options: Optional[admin_policy.RequestOptions] = ...
|
|
84
|
-
) -> server_common.RequestId:
|
|
85
|
-
...
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
def workspaces() -> server_common.RequestId:
|
|
89
|
-
...
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
def validate(
|
|
93
|
-
dag: sky.Dag,
|
|
94
|
-
workdir_only: bool = ...,
|
|
95
|
-
admin_policy_request_options: Optional[admin_policy.RequestOptions] = ...
|
|
96
|
-
) -> None:
|
|
97
|
-
...
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
def dashboard(starting_page: Optional[str] = ...) -> None:
|
|
101
|
-
...
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
def launch(task: Union['sky.Task', 'sky.Dag'],
|
|
105
|
-
cluster_name: Optional[str] = ...,
|
|
106
|
-
retry_until_up: bool = ...,
|
|
107
|
-
idle_minutes_to_autostop: Optional[int] = ...,
|
|
108
|
-
wait_for: Optional[autostop_lib.AutostopWaitFor] = ...,
|
|
109
|
-
dryrun: bool = ...,
|
|
110
|
-
down: bool = ...,
|
|
111
|
-
backend: Optional['backends.Backend'] = ...,
|
|
112
|
-
optimize_target: common.OptimizeTarget = ...,
|
|
113
|
-
no_setup: bool = ...,
|
|
114
|
-
clone_disk_from: Optional[str] = ...,
|
|
115
|
-
fast: bool = ...,
|
|
116
|
-
_need_confirmation: bool = ...,
|
|
117
|
-
_is_launched_by_jobs_controller: bool = ...,
|
|
118
|
-
_is_launched_by_sky_serve_controller: bool = ...,
|
|
119
|
-
_disable_controller_check: bool = ...) -> server_common.RequestId:
|
|
120
|
-
...
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
def exec(
|
|
124
|
-
task: Union['sky.Task', 'sky.Dag'],
|
|
125
|
-
cluster_name: Optional[str] = ...,
|
|
126
|
-
dryrun: bool = ...,
|
|
127
|
-
down: bool = ...,
|
|
128
|
-
backend: Optional['backends.Backend'] = ...) -> server_common.RequestId:
|
|
129
|
-
...
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
def tail_logs(cluster_name: str,
|
|
133
|
-
job_id: Optional[int],
|
|
134
|
-
follow: bool,
|
|
135
|
-
tail: int = ...,
|
|
136
|
-
output_stream: Optional['io.TextIOBase'] = ...) -> int:
|
|
137
|
-
...
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
def download_logs(cluster_name: str,
|
|
141
|
-
job_ids: Optional[List[str]]) -> Dict[str, str]:
|
|
142
|
-
...
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
def start(cluster_name: str,
|
|
146
|
-
idle_minutes_to_autostop: Optional[int] = ...,
|
|
147
|
-
wait_for: Optional[autostop_lib.AutostopWaitFor] = ...,
|
|
148
|
-
retry_until_up: bool = ...,
|
|
149
|
-
down: bool = ...,
|
|
150
|
-
force: bool = ...) -> server_common.RequestId:
|
|
151
|
-
...
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
def down(cluster_name: str, purge: bool = ...) -> server_common.RequestId:
|
|
155
|
-
...
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
def stop(cluster_name: str, purge: bool = ...) -> server_common.RequestId:
|
|
159
|
-
...
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
def autostop(cluster_name: str,
|
|
163
|
-
idle_minutes: int,
|
|
164
|
-
wait_for: Optional[autostop_lib.AutostopWaitFor] = ...,
|
|
165
|
-
down: bool = ...) -> server_common.RequestId:
|
|
166
|
-
...
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
def queue(cluster_name: str,
|
|
170
|
-
skip_finished: bool = ...,
|
|
171
|
-
all_users: bool = ...) -> server_common.RequestId:
|
|
172
|
-
...
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
def job_status(cluster_name: str,
|
|
176
|
-
job_ids: Optional[List[int]] = ...) -> server_common.RequestId:
|
|
177
|
-
...
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
def cancel(
|
|
181
|
-
cluster_name: str,
|
|
182
|
-
all: bool = ...,
|
|
183
|
-
all_users: bool = ...,
|
|
184
|
-
job_ids: Optional[List[int]] = ...,
|
|
185
|
-
_try_cancel_if_cluster_is_init: bool = ...) -> server_common.RequestId:
|
|
186
|
-
...
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
def status(cluster_names: Optional[List[str]] = ...,
|
|
190
|
-
refresh: common.StatusRefreshMode = ...,
|
|
191
|
-
all_users: bool = ...) -> server_common.RequestId:
|
|
192
|
-
...
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
def endpoints(cluster: str,
|
|
196
|
-
port: Optional[Union[int, str]] = ...) -> server_common.RequestId:
|
|
197
|
-
...
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
def cost_report(days: Optional[int] = ...) -> server_common.RequestId:
|
|
201
|
-
...
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
def storage_ls() -> server_common.RequestId:
|
|
205
|
-
...
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
def storage_delete(name: str) -> server_common.RequestId:
|
|
209
|
-
...
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
def local_up(gpus: bool,
|
|
213
|
-
ips: Optional[List[str]],
|
|
214
|
-
ssh_user: Optional[str],
|
|
215
|
-
ssh_key: Optional[str],
|
|
216
|
-
cleanup: bool,
|
|
217
|
-
context_name: Optional[str] = ...,
|
|
218
|
-
password: Optional[str] = ...) -> server_common.RequestId:
|
|
219
|
-
...
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
def local_down() -> server_common.RequestId:
|
|
223
|
-
...
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
def ssh_up(infra: Optional[str] = ...,
|
|
227
|
-
file: Optional[str] = ...) -> server_common.RequestId:
|
|
228
|
-
...
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
def ssh_down(infra: Optional[str] = ...) -> server_common.RequestId:
|
|
232
|
-
...
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
def realtime_kubernetes_gpu_availability(
|
|
236
|
-
context: Optional[str] = ...,
|
|
237
|
-
name_filter: Optional[str] = ...,
|
|
238
|
-
quantity_filter: Optional[int] = ...,
|
|
239
|
-
is_ssh: Optional[bool] = ...) -> server_common.RequestId:
|
|
240
|
-
...
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
def kubernetes_node_info(
|
|
244
|
-
context: Optional[str] = ...) -> server_common.RequestId:
|
|
245
|
-
...
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
def status_kubernetes() -> server_common.RequestId:
|
|
249
|
-
...
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
def get(request_id: str) -> Any:
|
|
253
|
-
...
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
def stream_and_get(request_id: Optional[str] = ...,
|
|
257
|
-
log_path: Optional[str] = ...,
|
|
258
|
-
tail: Optional[int] = ...,
|
|
259
|
-
follow: bool = ...,
|
|
260
|
-
output_stream: Optional['io.TextIOBase'] = ...) -> Any:
|
|
261
|
-
...
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
def api_cancel(request_ids: Optional[Union[str, List[str]]] = ...,
|
|
265
|
-
all_users: bool = ...,
|
|
266
|
-
silent: bool = ...) -> server_common.RequestId:
|
|
267
|
-
...
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
def api_status(request_ids: Optional[List[str]] = ...,
|
|
271
|
-
all_status: bool = ...) -> List[payloads.RequestPayload]:
|
|
272
|
-
...
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
def api_info() -> Dict[str, Any]:
|
|
276
|
-
...
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
def api_start(*,
|
|
280
|
-
deploy: bool = ...,
|
|
281
|
-
host: str = ...,
|
|
282
|
-
foreground: bool = ...,
|
|
283
|
-
metrics: bool = ...,
|
|
284
|
-
metrics_port: Optional[int] = ...,
|
|
285
|
-
enable_basic_auth: bool = ...) -> None:
|
|
286
|
-
...
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
def api_stop() -> None:
|
|
290
|
-
...
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
def api_server_logs(follow: bool = ..., tail: Optional[int] = ...) -> None:
|
|
294
|
-
...
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
def api_login(endpoint: Optional[str] = ...,
|
|
298
|
-
relogin: bool = ...,
|
|
299
|
-
service_account_token: Optional[str] = ...) -> None:
|
|
300
|
-
...
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
self.__BUILD_MANIFEST=function(s,c,e,a,t,u,n,f,r,i,j,b,k,o,h,d){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":["static/chunks/pages/index-444f1804401f04ea.js"],"/_error":["static/chunks/pages/_error-c66a4e8afc46f17b.js"],"/clusters":["static/chunks/pages/clusters-956ad430075efee8.js"],"/clusters/[cluster]":[s,c,e,a,t,r,j,b,u,n,f,k,i,o,h,d,"static/chunks/1871-7e17c195296e2ea9.js","static/chunks/pages/clusters/[cluster]-9e7df5fc761c95a7.js"],"/clusters/[cluster]/[job]":[s,c,e,a,t,u,n,f,"static/chunks/pages/clusters/[cluster]/[job]-fa63e8b1d203f298.js"],"/config":["static/chunks/pages/config-8620d099cbef8608.js"],"/infra":["static/chunks/pages/infra-0fbdc9072f19fbe2.js"],"/infra/[context]":["static/chunks/pages/infra/[context]-9cfd875eecb6eaf5.js"],"/jobs":["static/chunks/pages/jobs-6393a9edc7322b54.js"],"/jobs/[job]":[s,c,e,a,t,r,b,u,n,f,i,"static/chunks/pages/jobs/[job]-6c5af4c86e6ab3d3.js"],"/users":["static/chunks/pages/users-34d6bb10c3b3ee3d.js"],"/volumes":["static/chunks/pages/volumes-225c8dae0634eb7f.js"],"/workspace/new":["static/chunks/pages/workspace/new-92f741084a89e27b.js"],"/workspaces":["static/chunks/pages/workspaces-e4cb7e97d37e93ad.js"],"/workspaces/[name]":[s,c,e,a,t,r,j,u,n,f,k,i,o,h,d,"static/chunks/1141-3f10a5a9f697c630.js","static/chunks/pages/workspaces/[name]-4d41c9023287f59a.js"],sortedPages:["/","/_app","/_error","/clusters","/clusters/[cluster]","/clusters/[cluster]/[job]","/config","/infra","/infra/[context]","/jobs","/jobs/[job]","/users","/volumes","/workspace/new","/workspaces","/workspaces/[name]"]}}("static/chunks/616-3d59f75e2ccf9321.js","static/chunks/5230-f3bb2663e442e86c.js","static/chunks/5739-d67458fcb1386c92.js","static/chunks/1664-22b00e32c9ff96a4.js","static/chunks/7411-b15471acd2cba716.js","static/chunks/6989-983d3ae7a874de98.js","static/chunks/3698-7874720877646365.js","static/chunks/6135-d0e285ac5f3f2485.js","static/chunks/1272-1ef0bf0237faccdb.js","static/chunks/8969-9a8cca241b30db83.js","static/chunks/1559-6c00e20454194859.js","static/chunks/6212-7bd06f60ba693125.js","static/chunks/6990-08b2a1cae076a943.js","static/chunks/1043-928582d4860fef92.js","static/chunks/6601-234b1cf963c7280b.js","static/chunks/938-40d15b6261ec8dc1.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1043],{50326:function(e,t,a){a.d(t,{$N:function(){return p},Be:function(){return _},Vq:function(){return c},cN:function(){return f},cZ:function(){return d},fK:function(){return g}});var r=a(85893),s=a(67294),o=a(6327),n=a(32350),l=a(43767);let c=o.fC;o.xz;let u=o.h_;o.x8;let i=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(o.aV,{ref:t,className:(0,n.cn)("fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...s})});i.displayName=o.aV.displayName;let d=s.forwardRef((e,t)=>{let{className:a,children:s,...c}=e;return(0,r.jsxs)(u,{children:[(0,r.jsx)(i,{}),(0,r.jsxs)(o.VY,{ref:t,className:(0,n.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-gray-200 bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...c,children:[s,(0,r.jsxs)(o.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-gray-100 data-[state=open]:text-gray-500",children:[(0,r.jsx)(l.Z,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});d.displayName=o.VY.displayName;let g=e=>{let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,n.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...a})};g.displayName="DialogHeader";let f=e=>{let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,n.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a})};f.displayName="DialogFooter";let p=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(o.Dx,{ref:t,className:(0,n.cn)("text-lg font-semibold leading-none tracking-tight",a),...s})});p.displayName=o.Dx.displayName;let _=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(o.dk,{ref:t,className:(0,n.cn)("text-sm text-gray-500",a),...s})});_.displayName=o.dk.displayName},23266:function(e,t,a){a.d(t,{QL:function(){return g},Sl:function(){return i},getClusters:function(){return c},uR:function(){return u}});var r=a(67294),s=a(15821),o=a(47145),n=a(6378);let l={UP:"RUNNING",STOPPED:"STOPPED",INIT:"LAUNCHING",null:"TERMINATED"};async function c(){let{clusterNames:e=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{return(await o.x.fetch("/status",{cluster_names:e,all_users:!0})).map(e=>{let t="",a=t=e.zone?e.zone:e.region;return t&&t.length>25&&(t=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15;if(!e||e.length<=t)return e;if(t<=3)return"...";let a=Math.floor((t-3)/2),r=a+(t-3)%2;return 0===a?e.substring(0,r)+"...":e.substring(0,r)+"..."+e.substring(e.length-a)}(t,25)),{status:l[e.status],cluster:e.name,user:e.user_name,user_hash:e.user_hash,cloud:e.cloud,region:e.region,infra:t?e.cloud+" ("+t+")":e.cloud,full_infra:a?"".concat(e.cloud," (").concat(a,")"):e.cloud,cpus:e.cpus,mem:e.memory,gpus:e.accelerators,resources_str:e.resources_str,resources_str_full:e.resources_str_full,time:new Date(1e3*e.launched_at),num_nodes:e.nodes,workspace:e.workspace,autostop:e.autostop,to_down:e.to_down,jobs:[],command:e.last_creation_command||e.last_use,task_yaml:e.last_creation_yaml||"{}",events:[{time:new Date(1e3*e.launched_at),event:"Cluster created."}]}})}catch(e){return console.error("Error fetching clusters:",e),[]}}async function u(){try{let e=await o.x.fetch("/cost_report",{days:30});console.log("Raw cluster history data:",e);let t=e.map(e=>{let t="Unknown";e.cloud?t=e.cloud:e.resources&&e.resources.cloud&&(t=e.resources.cloud);let a=e.user_name||"-";return{status:e.status?l[e.status]:"TERMINATED",cluster:e.name,user:a,user_hash:e.user_hash,cloud:t,region:"",infra:t,full_infra:t,resources_str:e.resources_str,resources_str_full:e.resources_str_full,time:e.launched_at?new Date(1e3*e.launched_at):null,num_nodes:e.num_nodes||1,duration:e.duration,total_cost:e.total_cost,workspace:e.workspace||"default",autostop:-1,to_down:!1,cluster_hash:e.cluster_hash,usage_intervals:e.usage_intervals,command:e.last_creation_command||"",task_yaml:e.last_creation_yaml||"{}",events:[{time:e.launched_at?new Date(1e3*e.launched_at):new Date,event:"Cluster created."}]}});return console.log("Processed cluster history data:",t),t}catch(e){return console.error("Error fetching cluster history:",e),[]}}async function i(e){let{clusterName:t,jobId:a,onNewLog:r,workspace:n}=e;try{await o.x.stream("/logs",{follow:!1,cluster_name:t,job_id:a,override_skypilot_config:{active_workspace:n||"default"}},r)}catch(e){console.error("Error in streamClusterJobLogs:",e),(0,s.C)("Error in streamClusterJobLogs: ".concat(e.message),"error")}}async function d(e){let{clusterName:t,workspace:a}=e;try{return(await o.x.fetch("/queue",{cluster_name:t,all_users:!0,override_skypilot_config:{active_workspace:a}})).map(e=>{var r;let s=e.end_at?e.end_at:Date.now()/1e3,o=0,n=0;return e.submitted_at&&(o=s-e.submitted_at),e.start_at&&(n=s-e.start_at),{id:e.job_id,status:e.status,job:e.job_name,user:e.username,user_hash:e.user_hash,gpus:e.accelerators||{},submitted_at:e.submitted_at?new Date(1e3*e.submitted_at):null,resources:e.resources,cluster:t,total_duration:o,job_duration:n,infra:"",logs:"",workspace:a||"default",git_commit:(null===(r=e.metadata)||void 0===r?void 0:r.git_commit)||"-"}})}catch(e){return console.error("Error fetching cluster jobs:",e),[]}}function g(e){let{cluster:t,job:a=null}=e,[s,o]=(0,r.useState)(null),[l,u]=(0,r.useState)(null),[i,g]=(0,r.useState)(!0),[f,p]=(0,r.useState)(!0),_=(0,r.useCallback)(async()=>{if(t)try{g(!0);let e=await n.default.get(c,[{clusterNames:[t]}]);return o(e[0]),e[0]}catch(e){console.error("Error fetching cluster data:",e)}finally{g(!1)}return null},[t]),m=(0,r.useCallback)(async e=>{if(t)try{p(!0);let a=await n.default.get(d,[{clusterName:t,workspace:e||"default"}]);u(a)}catch(e){console.error("Error fetching cluster job data:",e)}finally{p(!1)}},[t]),h=(0,r.useCallback)(async()=>{n.default.invalidate(c,[{clusterNames:[t]}]);let e=await _();e&&(n.default.invalidate(d,[{clusterName:t,workspace:e.workspace||"default"}]),await m(e.workspace))},[_,m,t]),b=(0,r.useCallback)(async()=>{s&&(n.default.invalidate(d,[{clusterName:t,workspace:s.workspace||"default"}]),await m(s.workspace))},[m,s,t]);return(0,r.useEffect)(()=>{(async()=>{let e=await _();e&&m(e.workspace)})()},[t,a,_,m]),{clusterData:s,clusterJobData:l,loading:i,clusterDetailsLoading:i,clusterJobsLoading:f,refreshData:h,refreshClusterJobsOnly:b}}},32045:function(e,t,a){a.d(t,{l4:function(){return n}});var r=a(93225),s=a(47145);async function o(e,t){try{let a=[];try{let e=await s.x.get("/enabled_clouds"),t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("X-Request-ID"),r=await s.x.get("/api/get?request_id=".concat(t)),o=await r.json();a=o.return_value?JSON.parse(o.return_value):[],console.log("Enabled clouds:",a)}catch(e){console.error("Error fetching enabled clouds:",e),a=[]}let o={};r.$m.forEach(e=>{let t=a.includes(e.toLowerCase());o[e]={name:e,clusters:0,jobs:0,enabled:t}}),e.forEach(e=>{if(e.cloud){let t=e.cloud;o[t]&&(o[t].clusters+=1,o[t].enabled=!0)}}),t.forEach(e=>{if(e.cloud){let t=e.cloud;o[t]&&(o[t].jobs+=1,o[t].enabled=!0)}});let n=r.$m.length,l=Object.values(o).filter(e=>e.enabled).length;return{clouds:Object.values(o).filter(e=>e.enabled).sort((e,t)=>e.name.localeCompare(t.name)),totalClouds:n,enabledClouds:l}}catch(e){return console.error("Error fetching cloud infrastructure:",e),{clouds:[],totalClouds:r.$m.length,enabledClouds:0}}}async function n(){let{getClusters:e}=await Promise.resolve().then(a.bind(a,23266)),{getManagedJobs:t}=await Promise.resolve().then(a.bind(a,68969)),r=(await Promise.resolve().then(a.bind(a,6378))).default,[s,n]=await Promise.all([r.get(e),r.get(t,[{allUsers:!0}])]),c=s||[],u=(null==n?void 0:n.jobs)||[],[i,d]=await Promise.all([l(c,u),o(c,u)]);return{gpuData:i,cloudData:d}}async function l(e,t){return await g({clusters:e||[],jobs:t||[]})}async function c(){try{let e=await s.x.post("/realtime_kubernetes_gpu_availability",{context:null,name_filter:null,quantity_filter:null});if(!e.ok)return console.error("Error fetching Kubernetes context GPUs (in getKubernetesContextGPUs): ".concat(e.status," ").concat(e.statusText)),[];let t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("x-request-id");if(!t)return console.error("No request ID returned for Kubernetes GPU availability (in getKubernetesContextGPUs)"),[];let a=await s.x.get("/api/get?request_id=".concat(t)),r=await a.text();if(500===a.status){try{let e=JSON.parse(r);if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);console.error("[infra.jsx] getKubernetesContextGPUs: Server error detail:",t.message)}catch(t){console.error("[infra.jsx] getKubernetesContextGPUs: Error parsing server error JSON:",t,"Original error text:",e.detail.error)}}catch(e){console.error("[infra.jsx] getKubernetesContextGPUs: Error parsing 500 error response JSON:",e,"Raw text was:",r)}return[]}let o=JSON.parse(r);return o.return_value?JSON.parse(o.return_value):[]}catch(e){return console.error("[infra.jsx] Outer error in getKubernetesContextGPUs:",e),[]}}async function u(){try{let e=await s.x.get("/all_contexts");if(!e.ok)return console.error("Error fetching all contexts: ".concat(e.status," ").concat(e.statusText)),[];let t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("x-request-id");if(!t)return console.error("No request ID returned for /all_contexts"),[];let a=await s.x.get("/api/get?request_id=".concat(t)),r=await a.json();return r.return_value?JSON.parse(r.return_value):[]}catch(e){return console.error("[infra.jsx] Error in getAllContexts:",e),[]}}async function i(e){try{let t=await s.x.post("/kubernetes_node_info",{context:e}),a=t.headers.get("X-Skypilot-Request-ID")||t.headers.get("x-request-id"),r=await s.x.get("/api/get?request_id=".concat(a));if(500===r.status){try{let e=await r.json();if(e.detail&&e.detail.error)try{let t=JSON.parse(e.detail.error);console.error("Error fetching Kubernetes per node GPUs:",t.message)}catch(e){console.error("Error parsing JSON:",e)}}catch(e){console.error("Error parsing JSON:",e)}return{}}let o=await r.json();return(o.return_value?JSON.parse(o.return_value):{}).node_info_dict||{}}catch(t){return console.error("[infra.jsx] Error in getKubernetesPerNodeGPUs for context",e,":",t),{}}}async function d(e){try{let t=e.clusters,a=e.jobs,r={};return t.forEach(e=>{let t=null;if("Kubernetes"===e.cloud)(t=e.region)&&(t="kubernetes/".concat(t));else if("SSH"===e.cloud&&(t=e.region)){let e=t.startsWith("ssh-")?t.substring(4):t;t="ssh/".concat(e)}t&&(r[t]||(r[t]={clusters:0,jobs:0}),r[t].clusters+=1)}),a.forEach(e=>{let t=null;if("Kubernetes"===e.cloud)(t=e.region)&&(t="kubernetes/".concat(t));else if("SSH"===e.cloud&&(t=e.region)){let e=t.startsWith("ssh-")?t.substring(4):t;t="ssh/".concat(e)}t&&(r[t]||(r[t]={clusters:0,jobs:0}),r[t].jobs+=1)}),r}catch(e){return console.error("=== Error in getContextClustersAndJobs ===",e),{}}}async function g(e){try{let o=await u();if(!o||0===o.length)return console.log("No contexts found from /all_contexts endpoint."),{allContextNames:[],allGPUs:[],perContextGPUs:[],perNodeGPUs:[],contextStats:{}};let n=await d(e),l=await c(),g=new Map;l&&l.forEach(e=>{g.set(e[0],e[1])});let f={},p={},_={};for(let e of o){p[e]||(p[e]=[]);let o=g.get(e);if(o&&o.length>0)for(let t of o){let a=t[0],r=t[1].join(", "),s=t[2],o=t[3];a in f?(f[a].gpu_total+=s,f[a].gpu_free+=o):f[a]={gpu_total:s,gpu_free:o,gpu_name:a},p[e].push({gpu_name:a,gpu_requestable_qty_per_node:r,gpu_total:s,gpu_free:o,context:e})}let n=await i(e);if(n&&Object.keys(n).length>0)for(let o in n){var t,a,r,s;let l=n[o],c=l.accelerator_type||"-",u=null!==(r=null===(t=l.total)||void 0===t?void 0:t.accelerator_count)&&void 0!==r?r:0,i=null!==(s=null===(a=l.free)||void 0===a?void 0:a.accelerators_available)&&void 0!==s?s:0;_["".concat(e,"/").concat(o)]={node_name:l.name,gpu_name:c,gpu_total:u,gpu_free:i,ip_address:l.ip_address||null,context:e},"-"===c||p[e].some(e=>e.gpu_name===c)||(c in f||(f[c]={gpu_total:0,gpu_free:0,gpu_name:c}),p[e].find(e=>e.gpu_name===c)||p[e].push({gpu_name:c,gpu_requestable_qty_per_node:"-",gpu_total:0,gpu_free:0,context:e}))}0===p[e].length&&n&&Object.keys(n).length}return{allContextNames:o.sort(),allGPUs:Object.values(f).sort((e,t)=>e.gpu_name.localeCompare(t.gpu_name)),perContextGPUs:Object.values(p).flat().sort((e,t)=>e.context.localeCompare(t.context)||e.gpu_name.localeCompare(t.gpu_name)),perNodeGPUs:Object.values(_).sort((e,t)=>e.context.localeCompare(t.context)||e.node_name.localeCompare(t.node_name)||e.gpu_name.localeCompare(t.gpu_name)),contextStats:n}}catch(e){return console.error("[infra.jsx] Outer error in getKubernetesGPUs:",e),{allContextNames:[],allGPUs:[],perContextGPUs:[],perNodeGPUs:[],contextStats:{}}}}},53081:function(e,t,a){a.d(t,{R:function(){return s}}),a(23266),a(68969);var r=a(47145);async function s(){try{let e=await r.x.get("/users");if(!e.ok)throw Error("HTTP error! 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){return console.error("Failed to fetch users:",e),[]}}},19238:function(e,t,a){a.d(t,{C:function(){return s},w:function(){return o}});var r=a(47145);async function s(){try{return(await r.x.fetch("/volumes",{},"GET")).map(e=>{var t,a,r;let s=e.cloud||"";return e.region&&(s+="/".concat(e.region)),e.zone&&(s+="/".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:s,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===(a=e.config)||void 0===a?void 0:a.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){return console.error("Failed to fetch volumes:",e),[]}}async function o(e){let t="";try{let a=await r.x.post("/volumes/delete",{names:[e]}),s=a.headers.get("X-SkyPilot-Request-ID")||a.headers.get("X-Request-ID"),o=await r.x.get("/api/get?request_id=".concat(s));if(500===o.status){try{let e=await o.json();if(e.detail&&e.detail.error)try{t=JSON.parse(e.detail.error).message}catch(e){console.error("Error parsing JSON:",e)}}catch(e){console.error("Error parsing JSON:",e)}return{success:!1,msg:t}}return{success:!0}}catch(e){return console.error("Failed to delete volume:",e),{success:!1,msg:e.message}}}},36856:function(e,t,a){var r=a(6378),s=a(23266),o=a(68969),n=a(17324),l=a(53081),c=a(32045),u=a(19238);let i={base:{getClusters:{fn:s.getClusters,args:[]},getClusterHistory:{fn:s.uR,args:[]},getManagedJobs:{fn:o.getManagedJobs,args:[{allUsers:!0}]},getWorkspaces:{fn:n.fX,args:[]},getUsers:{fn:l.R,args:[]},getInfraData:{fn:c.l4,args:[]},getVolumes:{fn:u.C,args:[]}},dynamic:{getEnabledClouds:{fn:n.yz,requiresWorkspaces:!0}},pages:{clusters:["getClusters","getClusterHistory","getWorkspaces","getUsers"],jobs:["getManagedJobs","getClusters","getWorkspaces","getUsers"],infra:["getInfraData","getClusters","getManagedJobs"],workspaces:["getWorkspaces","getClusters","getManagedJobs","getEnabledClouds"],users:["getUsers","getClusters","getManagedJobs"],volumes:["getVolumes"]}};class d{async preloadForPage(e,t){let{backgroundPreload:a=!0,force:r=!1}=t||{};if(!i.pages[e]){console.warn("Unknown page: ".concat(e));return}console.log("[CachePreloader] Preloading cache for page: ".concat(e));try{await this._loadPageData(e,r),a&&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],a=i.pages[e],s=[];for(let e of a)if(i.base[e]){let{fn:a,args:o}=i.base[e];t&&r.default.invalidate(a,o),s.push(r.default.get(a,o))}else"getEnabledClouds"===e&&s.push(this._loadEnabledCloudsForAllWorkspaces(t));await Promise.allSettled(s),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.fX);let t=await r.default.get(n.fX),a=Object.keys(t||{}).map(t=>(e&&r.default.invalidate(n.yz,[t]),r.default.get(n.yz,[t])));await Promise.allSettled(a)}catch(e){console.error("[CachePreloader] Error loading enabled clouds:",e)}}_backgroundPreloadOtherPages(e){if(this.isPreloading)return;this.isPreloading=!0;let t=Object.keys(i.pages).filter(t=>t!==e);console.log("[CachePreloader] Background preloading pages: ".concat(t.join(", "))),Promise.allSettled(t.map(async e=>{try{await this._loadPageData(e,!1),console.log("[CachePreloader] Background loaded: ".concat(e))}catch(t){console.error("[CachePreloader] Background load failed for ".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(i.base).map(t=>{let[a,{fn:s,args:o}]=t;return e&&r.default.invalidate(s,o),r.default.get(s,o).catch(e=>{console.error("[CachePreloader] Failed to preload ".concat(a,":"),e)})});await Promise.allSettled(t),console.log("[CachePreloader] Base functions preloaded")}getCacheStats(){return{...r.default.getStats(),isPreloading:this.isPreloading}}clearCache(){r.default.clear(),this.isPreloading=!1,this.preloadPromises.clear(),console.log("[CachePreloader] Cache cleared")}constructor(){this.isPreloading=!1,this.preloadPromises=new Map}}let g=new d;t.ZP=g}}]);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1141],{99333:function(e,s,r){r.d(s,{Z:function(){return a}});/**
|
|
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 a=(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"}]])},98418:function(e,s,r){r.d(s,{Z:function(){return a}});/**
|
|
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 a=(0,r(60998).Z)("Trash",[["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"}]])},1812:function(e,s,r){r.d(s,{X:function(){return n}});var a=r(85893),l=r(67294);let t=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},n=e=>{let{error:s,title:r="Error",onDismiss:n}=e,[c,i]=(0,l.useState)(!1);if((0,l.useEffect)(()=>{s&&i(!1)},[s]),!s||c)return null;let o="string"==typeof s?s:t(s);return(0,a.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex",children:[(0,a.jsx)("div",{className:"flex-shrink-0",children:(0,a.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,a.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,a.jsx)("div",{className:"ml-3",children:(0,a.jsxs)("div",{className:"text-sm text-red-800",children:[(0,a.jsxs)("strong",{children:[r,":"]})," ",o]})})]}),(0,a.jsx)("button",{onClick:()=>{i(!0),n&&n()},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,a.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,a.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"})})})]})})}},69123:function(e,s,r){r.d(s,{g:function(){return n}});var a=r(85893),l=r(67294),t=r(32350);let n=l.forwardRef((e,s)=>{let{className:r,...l}=e;return(0,a.jsx)("textarea",{className:(0,t.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),ref:s,...l})});n.displayName="Textarea"},11141:function(e,s,r){r.r(s),r.d(s,{WorkspaceEditor:function(){return R}});var a=r(85893),l=r(67294),t=r(11163),n=r(17324),c=r(23266),i=r(68969);r(6135);var o=r(41664),d=r.n(o),u=r(9008),x=r.n(u),m=r(37673),h=r(30803),f=r(69123),g=r(55739),p=r(70282),b=r(6021),j=r(13626),y=r(98418),N=r(99333),v=r(50326);let w=e=>{let{className:s="",variant:r="default",children:l,...t}=e;return(0,a.jsx)("div",{role:"alert",className:"".concat("relative w-full rounded-lg border p-4 flex items-start space-x-2"," ").concat({default:"bg-blue-50 border-blue-200 text-blue-800",destructive:"bg-red-50 border-red-200 text-red-800"}[r]," ").concat(s),...t,children:l})},k=e=>{let{className:s="",children:r,...l}=e;return(0,a.jsx)("div",{className:"text-sm leading-relaxed ".concat(s),...l,children:r})};var C=r(53850),L=r(1812),S=r(80938),E=r(1272),Z=r(93225),D=r(53081);let M=e=>{let{message:s}=e;return s?(0,a.jsxs)(w,{className:"border-green-200 bg-green-50",children:[(0,a.jsx)(p.Z,{className:"h-4 w-4 text-green-600"}),(0,a.jsx)(k,{className:"text-green-800",children:s})]}):null},A=e=>{let{workspaceName:s,config:r,enabledClouds:l=[]}=e;if(!r)return null;let t="default"===s,n=0===Object.keys(r).length;if(t&&n)return(0,a.jsx)("div",{className:"text-sm text-gray-500 mb-3 italic p-3 bg-sky-50 rounded border border-sky-200",children:"Workspace 'default' can use all accessible infrastructure."});let c=[],i=[],o=[],d=new Set(l.map(e=>e.toLowerCase()));Object.entries(r).forEach(e=>{let[s,r]=e;if("private"===s||"allowed_users"===s)return;let l=Z.Z2[s.toLowerCase()]||s.toUpperCase(),t=d.has(null==l?void 0:l.toLowerCase());if((null==r?void 0:r.disabled)===!0)i.push(l);else if(r&&Object.keys(r).length>0){let e="";"gcp"===s.toLowerCase()&&r.project_id?e=" (Project ID: ".concat(r.project_id,")"):"aws"===s.toLowerCase()&&r.region&&(e=" (Region: ".concat(r.region,")")),t?c.push((0,a.jsxs)("span",{className:"block",children:[l,e," is enabled."]},"".concat(s,"-enabled"))):o.push((0,a.jsxs)("span",{className:"block text-amber-700",children:[l,e," is configured but not currently available."]},"".concat(s,"-configured-not-enabled")))}else t?c.push((0,a.jsxs)("span",{className:"block",children:[l," is enabled (using default settings)."]},"".concat(s,"-default-enabled"))):o.push((0,a.jsxs)("span",{className:"block text-amber-700",children:[l," is configured but not currently available."]},"".concat(s,"-default-not-enabled")))});let u=[];if(i.length>0){let e=i.join(" and ");u.push((0,a.jsxs)("span",{className:"block",children:[e," ",1===i.length?"is":"are"," explicitly disabled."]},"disabled-clouds"))}return(u.push(...c),u.push(...o),u.length>0)?(0,a.jsx)("div",{className:"text-sm text-gray-700 mb-3 p-3 bg-sky-50 rounded border border-sky-200",children:u}):!t&&n?(0,a.jsx)("div",{className:"text-sm text-gray-500 mb-3 italic p-3 bg-sky-50 rounded border border-sky-200",children:"This workspace has no specific cloud resource configurations and can use all accessible infrastructure."}):null},W=e=>{let{isPrivate:s}=e;return s?(0,a.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,a.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"})},P=e=>{let{workspaceConfig:s,allUsers:r}=e;if(!s.private)return null;let l=s.allowed_users||[],t=(r||[]).filter(e=>"admin"===e.role).map(e=>e.username),n=[...new Set([...l,...t])];return 0===n.length?(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsx)("h4",{className:"mb-2 text-xs text-gray-500 tracking-wider",children:"Allowed Users (0)"}),(0,a.jsx)("div",{className:"text-amber-600 text-xs italic p-2 bg-amber-50 rounded border border-amber-200",children:"No users configured (workspace may be inaccessible)"})]}):(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsxs)("h4",{className:"mb-2 text-xs text-gray-500 tracking-wider",children:["Allowed Users (",n.length,")"]}),(0,a.jsx)("div",{className:"space-y-1 max-h-48 overflow-y-auto border border-gray-200 rounded",children:n.map(e=>{let s=t.includes(e);return(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs p-2 bg-gray-50 hover:bg-gray-100 border-b border-gray-100 last:border-b-0",children:[(0,a.jsx)("span",{className:"font-medium text-gray-700",children:e}),s?(0,a.jsxs)("span",{className:"inline-flex items-center text-blue-600",children:[(0,a.jsx)(C.r7,{className:"w-3 h-3 mr-1"}),"Admin"]}):(0,a.jsxs)("span",{className:"inline-flex items-center text-gray-600",children:[(0,a.jsx)(b.Z,{className:"w-3 h-3 mr-1"}),"User"]})]},e)})})]})};function R(e){let{workspaceName:s,isNewWorkspace:r=!1}=e,o=(0,t.useRouter)(),[u,p]=(0,l.useState)({}),[b,w]=(0,l.useState)({}),[k,Z]=(0,l.useState)(""),[R,_]=(0,l.useState)(!0),[z,O]=(0,l.useState)(!1),[T,U]=(0,l.useState)(!1),[Y,J]=(0,l.useState)(null),[I,V]=(0,l.useState)(null),[F,H]=(0,l.useState)(null),[X,B]=(0,l.useState)([]),[G,q]=(0,l.useState)({showDialog:!1,deleting:!1,error:null}),[K,Q]=(0,l.useState)({totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:[]}),[$,ee]=(0,l.useState)(!1),es=(0,l.useCallback)(async()=>{_(!0),J(null);try{let e;let[r,a]=await Promise.all([(0,n.fX)(),(0,D.R)()]),l=r[s]||{};p(l),w(l),B(a||[]),e=0===Object.keys(l).length?"".concat(s,":\n # Empty workspace configuration - uses all accessible infrastructure\n"):E.ZP.dump({[s]:l},{indent:2,lineWidth:-1,noRefs:!0,skipInvalid:!0,flowLevel:-1}),Z(e)}catch(e){console.error("Error fetching workspace config:",e),J(e)}finally{_(!1)}},[s]),er=(0,l.useCallback)(async()=>{if(!r){ee(!0);try{let[e,r,a]=await Promise.all([(0,c.getClusters)(),(0,i.getManagedJobs)(),(0,n.yz)(s,!0)]),l=e.filter(e=>(e.workspace||"default")===s),t=l.filter(e=>"RUNNING"===e.status||"LAUNCHING"===e.status),o={};e.forEach(e=>{o[e.cluster]=e.workspace||"default"});let d=r.jobs||[],u=new Set(S.statusGroups.active),x=0;d.forEach(e=>{let r=e.cluster_name||e.resources&&e.resources.cluster_name;r&&o[r]===s&&u.has(e.status)&&x++}),Q({totalClusterCount:l.length,runningClusterCount:t.length,managedJobsCount:x,clouds:Array.isArray(a)?a:[]})}catch(e){console.error("Failed to fetch workspace stats:",e)}finally{ee(!1)}}},[s,r]);(0,l.useEffect)(()=>{r?(_(!1),Z("".concat(s,":\n # New workspace configuration\n # Leave empty to use all accessible infrastructure\n"))):(es(),er())},[s,r,es,er]),(0,l.useEffect)(()=>{U(JSON.stringify(u)!==JSON.stringify(b))},[u,b]);let ea=e=>{Z(e),H(null);try{let r=E.ZP.load(e)||{},a=Object.keys(r);if(0===a.length)p({});else if(1===a.length){let e=a[0];if(e!==s){H('Workspace name cannot be changed. Expected "'.concat(s,'" but found "').concat(e,'".'));return}let l=r[s]||{};p(l)}else H("Configuration must contain only one workspace. Found: ".concat(a.join(", ")))}catch(e){H("Invalid YAML: ".concat(e.message))}},el=async()=>{O(!0),J(null),V(null);try{if(F)throw Error("Please fix YAML errors before saving");let e=E.ZP.load(k)||{},a=Object.keys(e);if(a.length>0&&a[0]!==s)throw Error('Workspace name cannot be changed. Expected "'.concat(s,'".'));r?(await (0,n.MB)(s,u),V("Workspace created successfully!"),setTimeout(()=>{o.push("/workspaces/".concat(s))},1500)):(await (0,n.eA)(s,u),V("Workspace updated successfully!"),w(u),er())}catch(e){console.error("Error saving workspace:",e),J(e)}finally{O(!1)}},et=async()=>{q(e=>({...e,deleting:!0,error:null}));try{await (0,n.zl)(s),V("Workspace deleted successfully!"),setTimeout(()=>{o.push("/workspaces")},1500)}catch(e){console.error("Error deleting workspace:",e),q(s=>({...s,deleting:!1,error:e}))}},en=()=>{q({showDialog:!1,deleting:!1,error:null})},ec=async()=>{await Promise.all([es(),er()])};if(!o.isReady)return(0,a.jsx)("div",{children:"Loading..."});let ei=r?"Create New Workspace | SkyPilot Dashboard":"Workspace: ".concat(s," | SkyPilot Dashboard");return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(x(),{children:(0,a.jsx)("title",{children:ei})}),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,a.jsxs)("div",{className:"text-base flex items-center",children:[(0,a.jsx)(d(),{href:"/workspaces",className:"text-sky-blue hover:underline",children:"Workspaces"}),(0,a.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,a.jsx)(d(),{href:r?"/workspace/new":"/workspaces/".concat(s),className:"text-sky-blue hover:underline",children:r?"New Workspace":s}),T&&(0,a.jsx)("span",{className:"ml-3 px-2 py-1 bg-yellow-100 text-yellow-800 text-xs rounded",children:"Unsaved changes"})]}),(0,a.jsxs)("div",{className:"text-sm flex items-center",children:[(R||z||$)&&(0,a.jsxs)("div",{className:"flex items-center mr-4",children:[(0,a.jsx)(g.Z,{size:15,className:"mt-0"}),(0,a.jsx)("span",{className:"ml-2 text-gray-500",children:z?"Saving...":"Loading..."})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[!r&&(0,a.jsxs)("button",{onClick:ec,disabled:R||z||$,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[(0,a.jsx)(j.Z,{className:"w-4 h-4 mr-1.5"}),"Refresh"]}),!r&&"default"!==s&&(0,a.jsxs)("button",{onClick:()=>q({...G,showDialog:!0}),disabled:G.deleting||z,className:"text-red-600 hover:text-red-700 font-medium inline-flex items-center",children:[(0,a.jsx)(y.Z,{className:"w-4 h-4 mr-1.5"}),"Delete"]})]})]})]}),R?(0,a.jsxs)("div",{className:"flex justify-center items-center py-12",children:[(0,a.jsx)(g.Z,{size:24,className:"mr-2"}),(0,a.jsx)("span",{className:"text-gray-500",children:"Loading workspace configuration..."})]}):(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)(L.X,{error:Y,title:"Error",onDismiss:()=>J(null)}),(0,a.jsx)(M,{message:I}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[!r&&(0,a.jsx)("div",{className:"lg:col-span-1",children:(0,a.jsxs)(m.Zb,{className:"h-full",children:[(0,a.jsx)(m.Ol,{children:(0,a.jsx)(m.ll,{className:"text-base font-normal",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"font-semibold",children:"Workspace:"})," ",s]}),(0,a.jsx)(W,{isPrivate:!0===b.private})]})})}),(0,a.jsxs)(m.aY,{className:"text-sm pb-2 flex-1",children:[(0,a.jsxs)("div",{className:"py-2 flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center text-gray-600",children:[(0,a.jsx)(C.QT,{className:"w-4 h-4 mr-2 text-gray-500"}),(0,a.jsx)("span",{children:"Clusters (Running / Total)"})]}),(0,a.jsx)("span",{className:"font-normal text-gray-800",children:$?"...":"".concat(K.runningClusterCount," / ").concat(K.totalClusterCount)})]}),(0,a.jsxs)("div",{className:"py-2 flex items-center justify-between border-t border-gray-100",children:[(0,a.jsxs)("div",{className:"flex items-center text-gray-600",children:[(0,a.jsx)(C.Vp,{className:"w-4 h-4 mr-2 text-gray-500"}),(0,a.jsx)("span",{children:"Managed Jobs"})]}),(0,a.jsx)("span",{className:"font-normal text-gray-800",children:$?"...":K.managedJobsCount})]})]}),(0,a.jsxs)("div",{className:"px-6 pb-6 text-sm pt-3",children:[(0,a.jsx)("h4",{className:"mb-2 text-xs text-gray-500 tracking-wider",children:"Enabled Infra"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-x-4 gap-y-1",children:$?(0,a.jsx)("span",{className:"text-gray-500",children:"Loading..."}):K.clouds.length>0?K.clouds.map(e=>(0,a.jsxs)("div",{className:"flex items-center text-gray-700",children:[(0,a.jsx)(C.Ye,{className:"w-3.5 h-3.5 mr-1.5 text-green-500"}),(0,a.jsx)("span",{children:e})]},e)):(0,a.jsx)("span",{className:"text-gray-500 italic",children:"No enabled infrastructure"})}),(0,a.jsx)("div",{className:"mt-4",children:(0,a.jsx)(A,{workspaceName:s,config:b,enabledClouds:K.clouds})}),(0,a.jsx)(P,{workspaceConfig:b,allUsers:X})]})]})}),(0,a.jsx)("div",{className:r?"lg:col-span-3":"lg:col-span-2",children:(0,a.jsxs)(m.Zb,{className:"h-full flex flex-col",children:[(0,a.jsx)(m.Ol,{children:(0,a.jsx)(m.ll,{className:"text-base font-normal",children:r?"New Workspace YAML":"Edit Workspace YAML"})}),(0,a.jsx)(m.aY,{className:"flex-1 flex flex-col",children:(0,a.jsxs)("div",{className:"space-y-4 flex-1 flex flex-col",children:[F&&(0,a.jsx)(L.X,{error:F,onDismiss:()=>H(null)}),(0,a.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,a.jsxs)("p",{className:"text-sm text-gray-600 mb-3",children:["Configure infra-specific settings for this workspace. Leave empty to use all accessible infrastructure. Refer to"," ",(0,a.jsx)("a",{href:"https://docs.skypilot.co/en/latest/admin/workspaces.html#configuration",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600",children:"SkyPilot Docs"})," ","for more details."]}),(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Example configuration:"}),(0,a.jsx)("div",{className:"p-3 bg-gray-50 border rounded-lg",children:(0,a.jsx)("pre",{className:"text-xs font-mono text-gray-600 whitespace-pre-wrap",children:"".concat(s||"my-workspace",":\n private: true\n allowed_users:\n - user1@mydomain.com\n - user2@mydomain.com\n gcp:\n project_id: xxx\n disabled: false\n kubernetes:\n allowed_contexts:\n - context-1")})})]}),(0,a.jsx)(f.g,{value:k,onChange:e=>ea(e.target.value),className:"font-mono text-sm flex-1 resize-none",style:{minHeight:"350px"},spellCheck:!1,placeholder:"# Enter workspace configuration in YAML format"}),(0,a.jsx)("div",{className:"flex justify-end space-x-3 pt-3 border-gray-200",children:(0,a.jsxs)(h.z,{onClick:el,disabled:z||F||R,className:"inline-flex items-center bg-sky-600 hover:bg-sky-700 text-white",children:[(0,a.jsx)(N.Z,{className:"w-4 h-4 mr-1.5"}),z?"Applying...":"Apply"]})})]})]})})]})})]})]}),(0,a.jsx)(v.Vq,{open:G.showDialog,onOpenChange:en,children:(0,a.jsxs)(v.cZ,{className:"sm:max-w-md",children:[(0,a.jsxs)(v.fK,{className:"",children:[(0,a.jsx)(v.$N,{children:"Delete Workspace"}),(0,a.jsxs)(v.Be,{children:['Are you sure you want to delete workspace "',s,'"? This action cannot be undone.']})]}),G.error&&(0,a.jsx)(L.X,{error:G.error,title:"Deletion Failed",onDismiss:()=>q(e=>({...e,error:null}))}),(0,a.jsxs)(v.cN,{className:"",children:[(0,a.jsx)(h.z,{variant:"outline",onClick:en,disabled:G.deleting,children:"Cancel"}),(0,a.jsx)(h.z,{variant:"destructive",onClick:et,disabled:G.deleting,children:G.deleting?"Deleting...":"Delete"})]})]})})]})]})}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1664],{56101:function(e,t){"use strict";var n,r,o,u;Object.defineProperty(t,"__esModule",{value:!0}),function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ACTION_FAST_REFRESH:function(){return s},ACTION_NAVIGATE:function(){return f},ACTION_PREFETCH:function(){return i},ACTION_REFRESH:function(){return l},ACTION_RESTORE:function(){return a},ACTION_SERVER_ACTION:function(){return d},ACTION_SERVER_PATCH:function(){return c},PrefetchCacheEntryStatus:function(){return r},PrefetchKind:function(){return n},isThenable:function(){return p}});let l="refresh",f="navigate",a="restore",c="server-patch",i="prefetch",s="fast-refresh",d="server-action";function p(e){return e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}(o=n||(n={})).AUTO="auto",o.FULL="full",o.TEMPORARY="temporary",(u=r||(r={})).fresh="fresh",u.reusable="reusable",u.expired="expired",u.stale="stale",("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},27670:function(e,t,n){"use strict";function r(e,t,n,r){return!1}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getDomainLocale",{enumerable:!0,get:function(){return r}}),n(51297),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},24116:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return O}});let r=n(10260),o=n(85893),u=r._(n(67294)),l=n(69975),f=n(92712),a=n(28547),c=n(84350),i=n(38109),s=n(54494),d=n(55716),p=n(388),y=n(27670),b=n(6220),h=n(56101),v=new Set;function _(e,t,n,r,o,u){if(u||(0,f.isLocalURL)(t)){if(!r.bypassPrefetchedCheck){let o=t+"%"+n+"%"+(void 0!==r.locale?r.locale:"locale"in e?e.locale:void 0);if(v.has(o))return;v.add(o)}(async()=>u?e.prefetch(t,o):e.prefetch(t,n,r))().catch(e=>{})}}function C(e){return"string"==typeof e?e:(0,a.formatUrl)(e)}let O=u.default.forwardRef(function(e,t){let n,r;let{href:a,as:v,children:O,prefetch:g=null,passHref:E,replace:j,shallow:P,scroll:T,locale:M,onClick:R,onMouseEnter:m,onTouchStart:A,legacyBehavior:k=!1,...I}=e;n=O,k&&("string"==typeof n||"number"==typeof n)&&(n=(0,o.jsx)("a",{children:n}));let x=u.default.useContext(s.RouterContext),L=u.default.useContext(d.AppRouterContext),S=null!=x?x:L,N=!x,U=!1!==g,w=null===g?h.PrefetchKind.AUTO:h.PrefetchKind.FULL,{href:K,as:F}=u.default.useMemo(()=>{if(!x){let e=C(a);return{href:e,as:v?C(v):e}}let[e,t]=(0,l.resolveHref)(x,a,!0);return{href:e,as:v?(0,l.resolveHref)(x,v):t||e}},[x,a,v]),H=u.default.useRef(K),D=u.default.useRef(F);k&&(r=u.default.Children.only(n));let V=k?r&&"object"==typeof r&&r.ref:t,[q,z,B]=(0,p.useIntersection)({rootMargin:"200px"}),G=u.default.useCallback(e=>{(D.current!==F||H.current!==K)&&(B(),D.current=F,H.current=K),q(e),V&&("function"==typeof V?V(e):"object"==typeof V&&(V.current=e))},[F,V,K,B,q]);u.default.useEffect(()=>{S&&z&&U&&_(S,K,F,{locale:M},{kind:w},N)},[F,K,z,M,U,null==x?void 0:x.locale,S,N,w]);let Y={ref:G,onClick(e){k||"function"!=typeof R||R(e),k&&r.props&&"function"==typeof r.props.onClick&&r.props.onClick(e),S&&!e.defaultPrevented&&function(e,t,n,r,o,l,a,c,i){let{nodeName:s}=e.currentTarget;if("A"===s.toUpperCase()&&(function(e){let t=e.currentTarget.getAttribute("target");return t&&"_self"!==t||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which}(e)||!i&&!(0,f.isLocalURL)(n)))return;e.preventDefault();let d=()=>{let e=null==a||a;"beforePopState"in t?t[o?"replace":"push"](n,r,{shallow:l,locale:c,scroll:e}):t[o?"replace":"push"](r||n,{scroll:e})};i?u.default.startTransition(d):d()}(e,S,K,F,j,P,T,M,N)},onMouseEnter(e){k||"function"!=typeof m||m(e),k&&r.props&&"function"==typeof r.props.onMouseEnter&&r.props.onMouseEnter(e),S&&(U||!N)&&_(S,K,F,{locale:M,priority:!0,bypassPrefetchedCheck:!0},{kind:w},N)},onTouchStart:function(e){k||"function"!=typeof A||A(e),k&&r.props&&"function"==typeof r.props.onTouchStart&&r.props.onTouchStart(e),S&&(U||!N)&&_(S,K,F,{locale:M,priority:!0,bypassPrefetchedCheck:!0},{kind:w},N)}};if((0,c.isAbsoluteUrl)(F))Y.href=F;else if(!k||E||"a"===r.type&&!("href"in r.props)){let e=void 0!==M?M:null==x?void 0:x.locale,t=(null==x?void 0:x.isLocaleDomain)&&(0,y.getDomainLocale)(F,e,null==x?void 0:x.locales,null==x?void 0:x.domainLocales);Y.href=t||(0,b.addBasePath)((0,i.addLocale)(F,e,null==x?void 0:x.defaultLocale))}return k?u.default.cloneElement(r,Y):(0,o.jsx)("a",{...I,...Y,children:n})});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},388:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"useIntersection",{enumerable:!0,get:function(){return a}});let r=n(67294),o=n(40460),u="function"==typeof IntersectionObserver,l=new Map,f=[];function a(e){let{rootRef:t,rootMargin:n,disabled:a}=e,c=a||!u,[i,s]=(0,r.useState)(!1),d=(0,r.useRef)(null),p=(0,r.useCallback)(e=>{d.current=e},[]);return(0,r.useEffect)(()=>{if(u){if(c||i)return;let e=d.current;if(e&&e.tagName)return function(e,t,n){let{id:r,observer:o,elements:u}=function(e){let t;let n={root:e.root||null,margin:e.rootMargin||""},r=f.find(e=>e.root===n.root&&e.margin===n.margin);if(r&&(t=l.get(r)))return t;let o=new Map;return t={id:n,observer:new IntersectionObserver(e=>{e.forEach(e=>{let t=o.get(e.target),n=e.isIntersecting||e.intersectionRatio>0;t&&n&&t(n)})},e),elements:o},f.push(n),l.set(n,t),t}(n);return u.set(e,t),o.observe(e),function(){if(u.delete(e),o.unobserve(e),0===u.size){o.disconnect(),l.delete(r);let e=f.findIndex(e=>e.root===r.root&&e.margin===r.margin);e>-1&&f.splice(e,1)}}}(e,e=>e&&s(e),{root:null==t?void 0:t.current,rootMargin:n})}else if(!i){let e=(0,o.requestIdleCallback)(()=>s(!0));return()=>(0,o.cancelIdleCallback)(e)}},[c,n,t,i,d.current]),[p,i,(0,r.useCallback)(()=>{s(!1)},[])]}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},41664:function(e,t,n){e.exports=n(24116)}}]);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1871,2003],{39037:function(e,s,t){t.r(s),t.d(s,{ClusterTable:function(){return _},Clusters:function(){return O},Status2Actions:function(){return q},enabledActions:function(){return V},handleVSCodeConnection:function(){return H}});var r=t(85893),a=t(67294),l=t(11163),n=t(55739),c=t(36989),i=t(41664),o=t.n(i),u=t(30803),d=t(37673),h=t(68764),x=t(23266),p=t(17324),m=t(53081),f=t(94545),j=t(13626),v=t(60998);/**
|
|
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 g=(0,v.Z)("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]),w=(0,v.Z)("SquareCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);t(6135);var y=t(92128),b=t(99307),k=t(23001),N=t(88950),C=t(6378),S=t(36856);t(1272);var L=t(20546);let M=[{label:"Status",value:"status"},{label:"Cluster",value:"cluster"},{label:"User",value:"user"},{label:"Workspace",value:"workspace"},{label:"Infra",value:"infra"}],R=(e,s)=>{let t="",r="";return e>=0&&(t=e+"m",r=" "),s&&(t+="".concat(r,"(down)")),""===t&&(t="-"),t},I=(e,s)=>{if(e&&e.includes("@")){let t=e.split("@")[0];return s&&s!==t?"".concat(t," (").concat(s,")"):t}let t=e||s||"N/A";return s&&s!==t?"".concat(t," (").concat(s,")"):t},E=e=>{if(!e||0===e)return"-";let s=e=Math.floor(e),t="",r=0;for(let e of[{value:31536e3,label:"y"},{value:2592e3,label:"mo"},{value:86400,label:"d"},{value:3600,label:"h"},{value:60,label:"m"},{value:1,label:"s"}])if(s>=e.value&&r<2){let a=Math.floor(s/e.value);t+="".concat(a).concat(e.label," "),s%=e.value,r++}return t.trim()||"0s"};function O(){let e=(0,l.useRouter)(),[s,t]=(0,a.useState)(!1),i=a.useRef(null),[u,d]=(0,a.useState)(!1),[h,f]=(0,a.useState)(!1),[v,g]=(0,a.useState)(null),[w,b]=(0,a.useState)(()=>!!e.isReady&&"true"===e.query.history),[N,L]=(0,a.useState)(!0),R=(0,k.X)(),[E,O]=(0,a.useState)([]),[H,F]=(0,a.useState)({status:[],cluster:[],user:[],workspace:[],infra:[]});(0,a.useEffect)(()=>{if(e.isReady){q();let s="true"===e.query.history;w!==s&&(L(!1),b(s),setTimeout(()=>L(!0),50))}},[e.isReady,e.query.history]),(0,a.useEffect)(()=>{(async()=>{try{await S.ZP.preloadForPage("clusters");let e=await C.default.get(p.fX),s=Object.keys(e),t=await C.default.get(x.getClusters),r=[...new Set(t.map(e=>e.workspace||"default").filter(e=>e))],a=new Set(s);r.includes("default")&&a.has("default"),r.forEach(e=>a.add(e));let l=await C.default.get(m.R),n=[...new Set(t.map(e=>({userId:e.user_hash||e.user,username:e.user})).filter(e=>e.userId)).values()],c=new Map;l.forEach(e=>{c.set(e.userId,{userId:e.userId,username:e.username,display:I(e.username,e.userId)})}),n.forEach(e=>{c.has(e.userId)||c.set(e.userId,{userId:e.userId,username:e.username,display:I(e.username,e.userId)})})}catch(e){console.error("Error fetching data for filters:",e)}})()},[]);let V=s=>{let t={...e.query},r=[],a=[],l=[];s.map((e,s)=>{var t;r.push(null!==(t=e.property.toLowerCase())&&void 0!==t?t:""),a.push(e.operator),l.push(e.value)}),t.property=r,t.operator=a,t.value=l,e.replace({pathname:e.pathname,query:t},void 0,{shallow:!0})},W=s=>{let t={...e.query};t.history=s.toString(),e.replace({pathname:e.pathname,query:t},void 0,{shallow:!0})},q=()=>{let s={...e.query},t=s.property,r=s.operator,a=s.value;if(void 0===t)return;let l=[],n=Array.isArray(t)?t.length:1,c=new Map;if(c.set("",""),c.set("status","Status"),c.set("cluster","Cluster"),c.set("user","User"),c.set("workspace","Workspace"),c.set("infra","Infra"),1===n)l.push({property:c.get(t),operator:r,value:a});else for(let e=0;e<n;e++)l.push({property:c.get(t[e]),operator:r[e],value:a[e]});O(l)};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-1 min-h-[20px]",children:[(0,r.jsx)("div",{className:"flex items-center gap-2",children:(0,r.jsx)(o(),{href:"/clusters",className:"text-sky-blue hover:underline leading-none text-base",children:"Sky Clusters"})}),(0,r.jsx)("div",{className:"w-full sm:w-auto",children:(0,r.jsx)(z,{propertyList:M,valueList:H,setFilters:O,updateURLParams:V,placeholder:"Filter clusters"})}),(0,r.jsxs)("div",{className:"flex items-center gap-2 ml-auto",children:[(0,r.jsxs)("label",{className:"flex items-center cursor-pointer",children:[(0,r.jsx)("input",{type:"checkbox",checked:w,onChange:e=>{let s=e.target.checked;b(s),W(s)},className:"sr-only"}),(0,r.jsx)("div",{className:"relative inline-flex h-5 w-9 items-center rounded-full ".concat(N?"transition-colors":""," ").concat(w?"bg-sky-600":"bg-gray-300"),children:(0,r.jsx)("span",{className:"inline-block h-3 w-3 transform rounded-full bg-white ".concat(N?"transition-transform":""," ").concat(w?"translate-x-5":"translate-x-1")})}),(0,r.jsx)("span",{className:"ml-2 text-sm text-gray-700",children:"Show history (Last 30 days)"})]}),s&&(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(n.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:()=>{C.default.invalidate(x.getClusters),C.default.invalidate(x.uR),C.default.invalidate(p.fX),C.default.invalidate(m.R),i.current&&i.current()},disabled:s,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,r.jsx)(j.Z,{className:"h-4 w-4 mr-1.5"}),!R&&(0,r.jsx)("span",{children:"Refresh"})]})]})]}),(0,r.jsx)(A,{filters:E,setFilters:O,updateURLParams:V}),(0,r.jsx)(_,{refreshInterval:c.yc,setLoading:t,refreshDataRef:i,filters:E,showHistory:w,onOpenSSHModal:e=>{g(e),d(!0)},onOpenVSCodeModal:e=>{g(e),f(!0)},setOptionValues:F}),(0,r.jsx)(y.Oh,{isOpen:u,onClose:()=>d(!1),cluster:v}),(0,r.jsx)(y._R,{isOpen:h,onClose:()=>f(!1),cluster:v})]})}function _(e){let{refreshInterval:s,setLoading:t,refreshDataRef:l,filters:i,showHistory:p,onOpenSSHModal:m,onOpenVSCodeModal:j,setOptionValues:v}=e,[g,w]=(0,a.useState)([]),[y,k]=(0,a.useState)({key:null,direction:"ascending"}),[N,S]=(0,a.useState)(!1),[M,I]=(0,a.useState)(!0),[O,_]=(0,a.useState)(1),[H,F]=(0,a.useState)(10),V=e=>{let s={status:[],cluster:[],user:[],workspace:[],infra:[]},t=(e,s)=>{e.includes(s)||e.push(s)};return e.map(e=>{t(s.status,e.status),t(s.cluster,e.cluster),t(s.user,e.user),t(s.workspace,e.workspace),t(s.infra,e.infra)}),s},W=a.useCallback(async()=>{t(!0),S(!0);try{let e=await C.default.get(x.getClusters);if(p){let s=await C.default.get(x.uR),t=e.map(e=>({...e,isHistorical:!1})),r=s.map(e=>({...e,isHistorical:!0})),a=[...t];r.forEach(s=>{e.some(e=>(e.cluster||e.name)===(s.cluster||s.name))||a.push(s)}),v(V(a)),w(a)}else{let s=e.map(e=>({...e,isHistorical:!1}));v(V(s)),w(s)}}catch(e){console.error("Error fetching cluster data:",e),v(V([])),w([])}t(!1),S(!1),I(!1)},[t,p,v]),z=(e,s)=>{var t;let{property:r,operator:a,value:l}=s;if(!l)return!0;if(!r){let s=l.toLowerCase();return Object.values(e).some(e=>null==e?void 0:e.toString().toLowerCase().includes(s))}let n=null===(t=e[r.toLowerCase()])||void 0===t?void 0:t.toString().toLowerCase(),c=l.toString().toLowerCase();switch(a){case"=":return n===c;case":":return null==n?void 0:n.includes(c);default:return!0}},A=a.useMemo(()=>{let e=0===i.length?g:g.filter(e=>{let s=null;for(let t=0;t<i.length;t++){let r=z(e,i[t]);s=null===s?r:s&&r}return s});return(0,f.R0)(e,y.key,y.direction)},[g,y,i]);a.useEffect(()=>{l&&(l.current=W)},[l,W]),(0,a.useEffect)(()=>{w([]);let e=!0;W();let t=setInterval(()=>{e&&W()},s);return()=>{e=!1,clearInterval(t)}},[s,W]),(0,a.useEffect)(()=>{_(1)},[g.length]);let Z=e=>{let s="ascending";y.key===e&&"ascending"===y.direction&&(s="descending"),k({key:e,direction:s})},B=e=>y.key===e?"ascending"===y.direction?" ↑":" ↓":"",P=Math.ceil(A.length/H),U=(O-1)*H,D=U+H,X=A.slice(U,D);return(0,r.jsxs)("div",{children:[(0,r.jsx)(d.Zb,{children:(0,r.jsx)("div",{className:"overflow-x-auto rounded-lg",children:(0,r.jsxs)(h.iA,{className:"min-w-full",children:[(0,r.jsx)(h.xD,{children:(0,r.jsxs)(h.SC,{children:[(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Z("status"),children:["Status",B("status")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Z("cluster"),children:["Cluster",B("cluster")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Z("user"),children:["User",B("user")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Z("workspace"),children:["Workspace",B("workspace")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Z("infra"),children:["Infra",B("infra")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Z("resources_str"),children:["Resources",B("resources_str")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Z("time"),children:["Started",B("time")]}),p&&(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Z("duration"),children:["Duration",B("duration")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Z("autostop"),children:["Autostop",B("autostop")]}),(0,r.jsx)(h.ss,{className:"md:sticky md:right-0 md:bg-white",children:"Actions"})]})}),(0,r.jsx)(h.RM,{children:N&&M?(0,r.jsx)(h.SC,{children:(0,r.jsx)(h.pj,{colSpan:9,className:"text-center py-6 text-gray-500",children:(0,r.jsxs)("div",{className:"flex justify-center items-center",children:[(0,r.jsx)(n.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]})})}):X.length>0?X.map((e,s)=>(0,r.jsxs)(h.SC,{children:[(0,r.jsx)(h.pj,{children:(0,r.jsx)(b.OE,{status:e.status})}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(o(),{href:"/clusters/".concat(e.isHistorical?e.cluster_hash:e.cluster||e.name),className:"text-blue-600",children:e.cluster||e.name})}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(L.H,{username:e.user,userHash:e.user_hash})}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(o(),{href:"/workspaces",className:"text-gray-700 hover:text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(c.Md,{content:e.full_infra||e.infra,className:"text-sm text-muted-foreground",children:(0,r.jsxs)("span",{children:[(0,r.jsx)(o(),{href:"/infra",className:"text-blue-600 hover:underline",children:e.cloud}),e.infra.includes("(")&&(0,r.jsx)("span",{children:" "+e.infra.substring(e.infra.indexOf("("))})]})})}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(c.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)(h.pj,{children:(0,r.jsx)(c.Zg,{date:e.time})}),p&&(0,r.jsx)(h.pj,{children:E(e.duration)}),(0,r.jsx)(h.pj,{children:e.isHistorical?"-":R(e.autostop,e.to_down)}),(0,r.jsx)(h.pj,{className:"text-left md:sticky md:right-0 md:bg-white",children:!e.isHistorical&&(0,r.jsx)(q,{cluster:e.cluster,status:e.status,onOpenSSHModal:m,onOpenVSCodeModal:j})})]},s)):(0,r.jsx)(h.SC,{children:(0,r.jsx)(h.pj,{colSpan:9,className:"text-center py-6 text-gray-500",children:p?"No clusters found":"No active clusters"})})})]})})}),g.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:H,onChange:e=>{F(parseInt(e.target.value,10)),_(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:"".concat(U+1," - ").concat(Math.min(D,A.length)," of ").concat(A.length)}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(u.z,{variant:"ghost",size:"icon",onClick:()=>{_(e=>Math.max(e-1,1))},disabled:1===O,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)(u.z,{variant:"ghost",size:"icon",onClick:()=>{_(e=>Math.min(e+1,P))},disabled:O===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"})})})]})]})})]})}let H=(e,s)=>{s&&s(e)},F=(e,s)=>{s?s(e):window.open("ssh://".concat(e))},V=e=>"RUNNING"===e?["connect","VSCode"]:[],W={connect:(0,r.jsx)(g,{className:"w-4 h-4 text-gray-500 inline-block"}),VSCode:(0,r.jsx)(w,{className:"w-4 h-4 text-gray-500 inline-block"})};function q(e){let{withLabel:s=!1,cluster:t,status:a,onOpenSSHModal:l,onOpenVSCodeModal:n}=e,i=V(a),o=(0,k.X)(),u=e=>{switch(e){case"connect":F(t,l);break;case"VSCode":H(t,n);break;default:return}};return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"flex items-center space-x-4",children:Object.entries(W).map(e=>{let t,a,[l,n]=e;switch(l){case"connect":t="Connect",a="Connect with SSH";break;case"VSCode":t="VSCode",a="Open in VS Code"}return(s||(t=""),i.includes(l))?(0,r.jsx)(c.WH,{content:a,className:"capitalize text-sm text-muted-foreground",children:(0,r.jsxs)("button",{onClick:()=>u(l),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[n,!o&&(0,r.jsx)("span",{className:"ml-1.5",children:t})]})},l):(0,r.jsx)(c.WH,{content:a,className:"capitalize text-sm text-muted-foreground",children:(0,r.jsxs)("span",{className:"opacity-30 flex items-center cursor-not-allowed text-sm",title:l,children:[n,!o&&(0,r.jsx)("span",{className:"ml-1.5",children:t})]})},l)})})})}let z=e=>{let{propertyList:s=[],valueList:t,setFilters:l,updateURLParams:n,placeholder:c="Filter clusters"}=e,i=(0,a.useRef)(null),o=(0,a.useRef)(null),[u,d]=(0,a.useState)(!1),[h,x]=(0,a.useState)(""),[p,m]=(0,a.useState)("status"),[f,j]=(0,a.useState)([]);(0,a.useEffect)(()=>{let e=e=>{o.current&&!o.current.contains(e.target)&&i.current&&!i.current.contains(e.target)&&d(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]),(0,a.useEffect)(()=>{let e=[];if(t&&"object"==typeof t)switch(p){case"status":e=t.status||[];break;case"user":e=t.user||[];break;case"cluster":e=t.cluster||[];break;case"workspace":e=t.workspace||[];break;case"infra":e=t.infra||[]}""!==h.trim()&&(e=e.filter(e=>e&&e.toString().toLowerCase().includes(h.toLowerCase()))),j(e)},[p,t,h]);let v=e=>{let t=s.find(s=>s.value===e);return t?t.label:e},g=e=>{l(s=>{let t=[...s,{property:v(p),operator:":",value:e}];return n(t),t}),d(!1),x(""),i.current.focus()};return(0,r.jsxs)("div",{className:"flex flex-row border border-gray-300 rounded-md overflow-visible",children:[(0,r.jsx)("div",{className:"border-r border-gray-300 flex-shrink-0",children:(0,r.jsxs)(N.Ph,{onValueChange:m,value:p,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",children:(0,r.jsx)(N.ki,{placeholder:"Status"})}),(0,r.jsx)(N.Bw,{children:s.map((e,s)=>(0,r.jsx)(N.Ql,{value:e.value,children:e.label},"property-item-".concat(s)))})]})}),(0,r.jsxs)("div",{className:"relative flex-1",children:[(0,r.jsx)("input",{type:"text",ref:i,placeholder:c,value:h,onChange:e=>{x(e.target.value),u||d(!0)},onFocus:()=>{d(!0)},onKeyDown:e=>{"Enter"===e.key&&""!==h.trim()?(l(e=>{let s=[...e,{property:v(p),operator:":",value:h}];return n(s),s}),x(""),d(!1)):"Escape"===e.key&&(d(!1),i.current.blur())},className:"h-8 w-full sm:w-96 px-3 pr-8 text-sm border-none rounded-l-none rounded-r-md focus:ring-0 focus:outline-none",autoComplete:"off"}),h&&(0,r.jsx)("button",{onClick:()=>{x(""),d(!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"})})}),u&&f.length>0&&(0,r.jsx)("div",{ref:o,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:f.map((e,s)=>(0,r.jsx)("div",{className:"px-3 py-2 cursor-pointer hover:bg-gray-50 text-sm ".concat(s!==f.length-1?"border-b border-gray-100":""),onClick:()=>g(e),children:(0,r.jsx)("span",{className:"text-sm text-gray-700",children:e})},"".concat(e,"-").concat(s)))})]})]})},A=e=>{let{filters:s=[],setFilters:t,updateURLParams:a}=e,l=e=>{t(s=>{let t=s.filter((s,t)=>t!==e);return a(t),t})};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:[s.map((e,s)=>(0,r.jsx)(Z,{filter:e,onRemove:()=>l(s)},"filteritem-".concat(s))),s.length>0&&(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("button",{onClick:()=>{a([]),t([])},className:"rounded-full px-4 py-1 text-sm text-gray-700 bg-gray-200 hover:bg-gray-300",children:"Clear filters"})})]})})})},Z=e=>{let{filter:s,onRemove:t}=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(s.property," ")}),(0,r.jsx)("span",{children:"".concat(s.operator," ")}),(0,r.jsx)("span",{children:" ".concat(s.value)})]}),(0,r.jsx)("button",{onClick:()=>t(),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"})})})]})})}},12003:function(e,s,t){t.d(s,{j:function(){return n}});var r=t(90512);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,l=r.W,n=(e,s)=>t=>{var r;if((null==s?void 0:s.variants)==null)return l(e,null==t?void 0:t.class,null==t?void 0:t.className);let{variants:n,defaultVariants:c}=s,i=Object.keys(n).map(e=>{let s=null==t?void 0:t[e],r=null==c?void 0:c[e];if(null===s)return null;let l=a(s)||a(r);return n[e][l]}),o=t&&Object.entries(t).reduce((e,s)=>{let[t,r]=s;return void 0===r||(e[t]=r),e},{});return l(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({...c,...o}[s]):({...c,...o})[s]===t})?[...e,t,r]:e},[]),null==t?void 0:t.class,null==t?void 0:t.className)}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2003],{12003:function(l,e,n){n.d(e,{j:function(){return s}});var r=n(90512);let u=l=>"boolean"==typeof l?`${l}`:0===l?"0":l,t=r.W,s=(l,e)=>n=>{var r;if((null==e?void 0:e.variants)==null)return t(l,null==n?void 0:n.class,null==n?void 0:n.className);let{variants:s,defaultVariants:i}=e,a=Object.keys(s).map(l=>{let e=null==n?void 0:n[l],r=null==i?void 0:i[l];if(null===e)return null;let t=u(e)||u(r);return s[l][t]}),c=n&&Object.entries(n).reduce((l,e)=>{let[n,r]=e;return void 0===r||(l[n]=r),l},{});return t(l,a,null==e?void 0:null===(r=e.compoundVariants)||void 0===r?void 0:r.reduce((l,e)=>{let{class:n,className:r,...u}=e;return Object.entries(u).every(l=>{let[e,n]=l;return Array.isArray(n)?n.includes({...i,...c}[e]):({...i,...c})[e]===n})?[...l,n,r]:l},[]),null==n?void 0:n.class,null==n?void 0:n.className)}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2350],{32350:function(n,r,u){u.d(r,{cn:function(){return c}});var e=u(90512),t=u(98388);function c(){for(var n=arguments.length,r=Array(n),u=0;u<n;u++)r[u]=arguments[u];return(0,t.m6)((0,e.W)(r))}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3785,2003],{42557:function(e,s,r){r.d(s,{I:function(){return l}});var t=r(85893),a=r(67294),n=r(32350);let l=a.forwardRef((e,s)=>{let{className:r,type:a,...l}=e;return(0,t.jsx)("input",{type:a,className:(0,n.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),ref:s,...l})});l.displayName="Input"},36185:function(e,s,r){r.d(s,{_:function(){return c}});var t=r(85893),a=r(67294),n=r(49102),l=r(12003),i=r(32350);let o=(0,l.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=a.forwardRef((e,s)=>{let{className:r,...a}=e;return(0,t.jsx)(n.f,{ref:s,className:(0,i.cn)(o(),r),...a})});c.displayName=n.f.displayName},33785:function(e,s,r){r.r(s),r.d(s,{NewWorkspace:function(){return b}});var t=r(85893),a=r(67294),n=r(11163),l=r(41664),i=r.n(l),o=r(5152),c=r.n(o),u=r(17324),d=r(30803),f=r(42557),m=r(36185),p=r(37673);let x=c()(()=>Promise.all([r.e(616),r.e(5739),r.e(7411),r.e(1272),r.e(1559),r.e(6989),r.e(3698),r.e(6135),r.e(8969),r.e(1043),r.e(6601),r.e(938),r.e(1141)]).then(r.bind(r,11141)).then(e=>e.WorkspaceEditor),{loadableGenerated:{webpack:()=>[11141]},ssr:!1});function b(){(0,n.useRouter)();let[e,s]=(0,a.useState)(""),[r,l]=(0,a.useState)(!1),[o,c]=(0,a.useState)({}),[b,h]=(0,a.useState)(!0);(0,a.useEffect)(()=>{v()},[]);let v=async()=>{try{let e=await (0,u.fX)();c(e)}catch(e){console.error("Failed to fetch existing workspaces:",e)}finally{h(!1)}},k=()=>{e.trim()&&!y&&l(!0)},y=e.trim()&&o.hasOwnProperty(e.trim()),w=e.trim()&&!y;return r?(0,t.jsx)(x,{workspaceName:e,isNewWorkspace:!0}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4 h-5",children:(0,t.jsxs)("div",{className:"text-base flex items-center",children:[(0,t.jsx)(i(),{href:"/workspaces",className:"text-sky-blue hover:underline",children:"Workspaces"}),(0,t.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,t.jsx)("span",{className:"text-sky-blue",children:"New Workspace"})]})}),(0,t.jsxs)(p.Zb,{className:"max-w-md",children:[(0,t.jsx)(p.Ol,{children:(0,t.jsx)(p.ll,{className:"text-base font-normal",children:"Create New Workspace"})}),(0,t.jsxs)(p.aY,{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(m._,{htmlFor:"workspace-name",className:"text-sm font-normal",children:"Workspace name"}),(0,t.jsx)(f.I,{id:"workspace-name",value:e,onChange:e=>s(e.target.value),placeholder:"Enter workspace name",autoFocus:!0,onKeyPress:e=>{"Enter"===e.key&&w&&k()}}),y?(0,t.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:['Workspace "',e,'" already exists.'," ",(0,t.jsx)(i(),{href:"/workspaces/".concat(e),className:"text-blue-600 hover:underline",children:"View the workspace"})]}):(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a unique name for your workspace"})]}),(0,t.jsx)(d.z,{onClick:k,disabled:!w||b,className:"w-full bg-sky-600 hover:bg-sky-700 text-white disabled:bg-gray-300 disabled:text-gray-500",children:b?"Loading...":"Next: Configure Workspace"})]})]})]})}},49102:function(e,s,r){r.d(s,{f:function(){return i}});var t=r(67294),a=r(75320),n=r(85893),l=t.forwardRef((e,s)=>(0,n.jsx)(a.WV.label,{...e,ref:s,onMouseDown:s=>{s.target.closest("button, input, select, textarea")||(e.onMouseDown?.(s),!s.defaultPrevented&&s.detail>1&&s.preventDefault())}}));l.displayName="Label";var i=l},12003:function(e,s,r){r.d(s,{j:function(){return l}});var t=r(90512);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,n=t.W,l=(e,s)=>r=>{var t;if((null==s?void 0:s.variants)==null)return n(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:l,defaultVariants:i}=s,o=Object.keys(l).map(e=>{let s=null==r?void 0:r[e],t=null==i?void 0:i[e];if(null===s)return null;let n=a(s)||a(t);return l[e][n]}),c=r&&Object.entries(r).reduce((e,s)=>{let[r,t]=s;return void 0===t||(e[r]=t),e},{});return n(e,o,null==s?void 0:null===(t=s.compoundVariants)||void 0===t?void 0:t.reduce((e,s)=>{let{class:r,className:t,...a}=s;return Object.entries(a).every(e=>{let[s,r]=e;return Array.isArray(r)?r.includes({...i,...c}[s]):({...i,...c})[s]===r})?[...e,r,t]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4725],{1812:function(e,s,r){r.d(s,{X:function(){return a}});var t=r(85893),n=r(67294);let l=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},a=e=>{let{error:s,title:r="Error",onDismiss:a}=e,[c,i]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{s&&i(!1)},[s]),!s||c)return null;let o="string"==typeof s?s:l(s);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,":"]})," ",o]})})]}),(0,t.jsx)("button",{onClick:()=>{i(!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"})})})]})})}},99307:function(e,s,r){r.d(s,{Cl:function(){return c},OE:function(){return d}});var t=r(85893);r(67294);var n=r(55739),l=r(36989),a=r(53850);let c=e=>{switch(e){case"LAUNCHING":return"bg-blue-100 text-sky-blue";case"RUNNING":case"IN_USE":return"bg-green-50 text-green-700";case"STOPPED":return"bg-yellow-100 text-yellow-800";case"TERMINATED":default:return"bg-gray-100 text-gray-800";case"PENDING":case"CANCELLED":case"CANCELLING":return"bg-yellow-50 text-yellow-700";case"SUCCEEDED":return"bg-blue-50 text-blue-700";case"FAILED":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":return"bg-red-50 text-red-700";case"RECOVERING":return"bg-orange-50 text-orange-700";case"SUBMITTED":case"READY":return"bg-indigo-50 text-indigo-700";case"STARTING":return"bg-cyan-50 text-cyan-700";case"FAILED_SETUP":return"bg-pink-50 text-pink-700"}},i=e=>{switch(e){case"LAUNCHING":case"STARTING":return(0,t.jsx)(n.Z,{size:12,className:"w-3 h-3 mr-1"});case"RUNNING":case"IN_USE":default:return(0,t.jsx)(a.W2,{className:"w-3 h-3 mr-1"});case"STOPPED":return(0,t.jsx)(a.fp,{className:"w-3 h-3 mr-1"});case"TERMINATED":case"FAILED":case"CANCELLED":return(0,t.jsx)(a.Ps,{className:"w-3 h-3 mr-1"});case"SUCCEEDED":return(0,t.jsx)(a.Ye,{className:"w-3 h-3 mr-1"});case"PENDING":case"RECOVERING":case"SUBMITTED":case"CANCELLING":case"FAILED_SETUP":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":case"READY":return(0,t.jsx)(a.J$,{className:"w-3 h-3 mr-1"})}},o=e=>{let s=c(e),r=i(e);return(0,t.jsxs)("span",{className:"".concat("inline-flex items-center px-2 py-1 rounded-full text-sm"," ").concat(s),children:[r,e]})},d=e=>{let{status:s}=e;return(0,t.jsx)(l.WH,{content:s,className:"text-muted-foreground text-sm",children:(0,t.jsx)("span",{children:o(s)})})}},68764:function(e,s,r){r.d(s,{RM:function(){return i},SC:function(){return o},iA:function(){return a},pj:function(){return u},ss:function(){return d},xD:function(){return c}});var t=r(85893),n=r(67294),l=r(32350);let a=n.forwardRef((e,s)=>{let{className:r,...n}=e;return(0,t.jsx)("div",{className:"relative w-full overflow-auto",children:(0,t.jsx)("table",{ref:s,className:(0,l.cn)("w-full caption-bottom text-base",r),...n})})});a.displayName="Table";let c=n.forwardRef((e,s)=>{let{className:r,...n}=e;return(0,t.jsx)("thead",{ref:s,className:(0,l.cn)("[&_tr]:border-b",r),...n})});c.displayName="TableHeader";let i=n.forwardRef((e,s)=>{let{className:r,...n}=e;return(0,t.jsx)("tbody",{ref:s,className:(0,l.cn)("[&_tr:last-child]:border-0",r),...n})});i.displayName="TableBody",n.forwardRef((e,s)=>{let{className:r,...n}=e;return(0,t.jsx)("tfoot",{ref:s,className:(0,l.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",r),...n})}).displayName="TableFooter";let o=n.forwardRef((e,s)=>{let{className:r,...n}=e;return(0,t.jsx)("tr",{ref:s,className:(0,l.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",r),...n})});o.displayName="TableRow";let d=n.forwardRef((e,s)=>{let{className:r,...n}=e;return(0,t.jsx)("th",{ref:s,className:(0,l.cn)("h-12 px-4 text-left align-middle font-medium text-[hsl(var(--text-strong))] [&:has([role=checkbox])]:pr-0",r),...n})});d.displayName="TableHead";let u=n.forwardRef((e,s)=>{let{className:r,...n}=e;return(0,t.jsx)("td",{ref:s,className:(0,l.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",r),...n})});u.displayName="TableCell",n.forwardRef((e,s)=>{let{className:r,...n}=e;return(0,t.jsx)("caption",{ref:s,className:(0,l.cn)("mt-4 text-base text-muted-foreground",r),...n})}).displayName="TableCaption"},54725:function(e,s,r){r.r(s),r.d(s,{Volumes:function(){return k}});var t=r(85893),n=r(67294),l=r(45697),a=r.n(l),c=r(55739),i=r(65168),o=r(30803),d=r(68764),u=r(19238),h=r(51214),x=r(94545),m=r(13626),f=r(47603),j=r(23001),p=r(37673),g=r(50326),N=r(1812),v=r(41664),b=r.n(v),y=r(36989),w=r(99307),E=r(6378),C=r(36856);let R=h.nb.REFRESH_INTERVAL;function k(){let[e,s]=(0,n.useState)(!1),r=(0,n.useRef)(null),l=(0,j.X)(),[a,i]=(0,n.useState)(!1),[d,h]=(0,n.useState)(null),[x,f]=(0,n.useState)(null),[p,v]=(0,n.useState)(!1),y=()=>{E.default.invalidate(u.C),r.current&&r.current()},w=async()=>{if(d){v(!0),f(null);try{let e=await (0,u.w)(d.name);if(!e.success)throw Error(e.msg);i(!1),h(null),y()}catch(e){f(e)}finally{v(!1)}}},k=()=>{i(!1),h(null),f(null)};return(0,n.useEffect)(()=>{C.ZP.preloadForPage("volumes")},[]),(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",children:(0,t.jsx)(b(),{href:"/volumes",className:"text-sky-blue hover:underline leading-none",children:"Volumes"})}),(0,t.jsxs)("div",{className:"flex items-center",children:[e&&(0,t.jsxs)("div",{className:"flex items-center mr-2",children:[(0,t.jsx)(c.Z,{size:15,className:"mt-0"}),(0,t.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Loading..."})]}),(0,t.jsxs)("button",{onClick:y,disabled:e,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,t.jsx)(m.Z,{className:"h-4 w-4 mr-1.5"}),!l&&(0,t.jsx)("span",{children:"Refresh"})]})]})]}),(0,t.jsx)(L,{refreshInterval:R,setLoading:s,refreshDataRef:r,onDeleteVolume:e=>{h(e),i(!0),f(null)}},"volumes"),(0,t.jsx)(g.Vq,{open:a,onOpenChange:k,children:(0,t.jsxs)(g.cZ,{className:"sm:max-w-md",children:[(0,t.jsxs)(g.fK,{children:[(0,t.jsx)(g.$N,{children:"Delete Volume"}),(0,t.jsxs)(g.Be,{children:['Are you sure you want to delete volume "',(null==d?void 0:d.name)||"this volume",'"? This action cannot be undone.']})]}),(0,t.jsx)(N.X,{error:x,title:"Deletion Failed",onDismiss:()=>f(null)}),(0,t.jsxs)(g.cN,{children:[(0,t.jsx)(o.z,{variant:"outline",onClick:k,disabled:p,children:"Cancel"}),(0,t.jsx)(o.z,{variant:"destructive",onClick:w,disabled:p,children:p?"Deleting...":"Delete"})]})]})})]})}function L(e){let{refreshInterval:s,setLoading:r,refreshDataRef:l,onDeleteVolume:a}=e,[i,h]=(0,n.useState)([]),[m,j]=(0,n.useState)({key:null,direction:"ascending"}),[g,N]=(0,n.useState)(!1),[v,b]=(0,n.useState)(!0),[C,R]=(0,n.useState)(1),[k,L]=(0,n.useState)(10),S=(0,n.useCallback)(async()=>{r(!0),N(!0);try{let e=await E.default.get(u.C);h(e)}catch(e){console.error("Failed to fetch volumes:",e),h([])}finally{r(!1),N(!1),b(!1)}},[r]),A=(0,n.useMemo)(()=>(0,x.R0)(i,m.key,m.direction),[i,m]);(0,n.useEffect)(()=>{l&&(l.current=S)},[l,S]),(0,n.useEffect)(()=>{h([]);let e=!0;S();let r=setInterval(()=>{e&&S()},s);return()=>{e=!1,clearInterval(r)}},[s,S]),(0,n.useEffect)(()=>{R(1)},[i.length]);let I=e=>{let s="ascending";m.key===e&&"ascending"===m.direction&&(s="descending"),j({key:e,direction:s})},_=e=>m.key===e?"ascending"===m.direction?" ↑":" ↓":"",T=Math.ceil(A.length/k),z=(C-1)*k,U=z+k,F=A.slice(z,U),M=e=>e||"-",O=e=>{if(!e)return"N/A";try{let s=new Date(1e3*e);return(0,t.jsx)(y.Zg,{date:s})}catch(e){return"Invalid Date"}};return(0,t.jsxs)("div",{children:[(0,t.jsx)(p.Zb,{children:(0,t.jsx)("div",{className:"overflow-x-auto rounded-lg",children:(0,t.jsxs)(d.iA,{className:"min-w-full",children:[(0,t.jsx)(d.xD,{children:(0,t.jsxs)(d.SC,{children:[(0,t.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>I("name"),children:["Name",_("name")]}),(0,t.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>I("infra"),children:["Infra",_("infra")]}),(0,t.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>I("status"),children:["Status",_("status")]}),(0,t.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>I("size"),children:["Size",_("size")]}),(0,t.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>I("user_name"),children:["User",_("user_name")]}),(0,t.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>I("last_attached_at"),children:["Last Use",_("last_attached_at")]}),(0,t.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>I("type"),children:["Type",_("type")]}),(0,t.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>I("usedby_clusters"),children:["Used By",_("usedby_clusters")]}),(0,t.jsx)(d.ss,{children:"Actions"})]})}),(0,t.jsx)(d.RM,{children:g&&v?(0,t.jsx)(d.SC,{children:(0,t.jsx)(d.pj,{colSpan:11,className:"text-center py-6 text-gray-500",children:(0,t.jsxs)("div",{className:"flex justify-center items-center",children:[(0,t.jsx)(c.Z,{size:20,className:"mr-2"}),(0,t.jsx)("span",{children:"Loading..."})]})})}):F.length>0?F.map(e=>(0,t.jsxs)(d.SC,{children:[(0,t.jsx)(d.pj,{className:"font-medium",children:e.name}),(0,t.jsx)(d.pj,{children:e.infra||"N/A"}),(0,t.jsx)(d.pj,{children:(0,t.jsx)(w.OE,{status:e.status})}),(0,t.jsx)(d.pj,{children:M(e.size)}),(0,t.jsx)(d.pj,{children:e.user_name||"N/A"}),(0,t.jsx)(d.pj,{children:O(e.last_attached_at)}),(0,t.jsx)(d.pj,{children:e.type||"N/A"}),(0,t.jsx)(d.pj,{children:(0,t.jsx)(D,{clusters:e.usedby_clusters,pods:e.usedby_pods})}),(0,t.jsx)(d.pj,{children:(0,t.jsx)(o.z,{variant:"ghost",size:"sm",onClick:()=>a(e),className:"text-red-600 hover:text-red-700 hover:bg-red-50",title:"Delete volume",children:(0,t.jsx)(f.Z,{className:"w-4 h-4"})})})]},e.name)):(0,t.jsx)(d.SC,{children:(0,t.jsx)(d.pj,{colSpan:11,className:"text-center py-6 text-gray-500",children:"No volumes found"})})})]})})}),i.length>0&&(0,t.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,t.jsxs)("div",{className:"relative inline-block",children:[(0,t.jsxs)("select",{value:k,onChange:e=>{L(parseInt(e.target.value,10)),R(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,t.jsx)("option",{value:10,children:"10"}),(0,t.jsx)("option",{value:30,children:"30"}),(0,t.jsx)("option",{value:50,children:"50"}),(0,t.jsx)("option",{value:100,children:"100"}),(0,t.jsx)("option",{value:200,children:"200"})]}),(0,t.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,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,t.jsxs)("div",{children:[z+1," – ",Math.min(U,i.length)," of"," ",i.length]}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{R(e=>Math.max(e-1,1))},disabled:1===C,className:"text-gray-500 h-8 w-8 p-0",children:(0,t.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,t.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,t.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{R(e=>Math.min(e+1,T))},disabled:C===T||0===T,className:"text-gray-500 h-8 w-8 p-0",children:(0,t.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,t.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})})]})}function D(e){let{clusters:s,pods:r}=e,[l,a]=(0,n.useState)(null),c=Array.isArray(s)&&s.length>0?s:Array.isArray(r)&&r.length>0?r:[],o=Array.isArray(s)&&s.length>0;if(!c||0===c.length)return"N/A";let d=c.slice(0,2),u=c.slice(2);return(0,t.jsxs)(t.Fragment,{children:[d.map((e,s)=>(0,t.jsxs)("span",{children:[o?(0,t.jsx)(b(),{href:"/clusters/".concat(encodeURIComponent(e)),className:"text-sky-blue hover:underline",children:e}):(0,t.jsx)("span",{children:e}),s<d.length-1?", ":""]},e)),u.length>0&&(0,t.jsxs)(t.Fragment,{children:[","," ",(0,t.jsxs)("span",{className:"text-sky-blue cursor-pointer underline",onClick:e=>{a(e.currentTarget)},style:{userSelect:"none"},children:["+",u.length," more"]}),(0,t.jsx)(i.ZP,{open:!!l,anchorEl:l,onClose:()=>{a(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:(0,t.jsx)("div",{style:{padding:12,maxWidth:300},children:u.map(e=>(0,t.jsx)("div",{style:{marginBottom:4},children:o?(0,t.jsx)(b(),{href:"/clusters/".concat(encodeURIComponent(e)),className:"text-sky-blue hover:underline",children:e}):(0,t.jsx)("span",{children:e})},e))})})]})]})}L.propTypes={refreshInterval:a().number.isRequired,setLoading:a().func.isRequired,refreshDataRef:a().shape({current:a().func}).isRequired,onDeleteVolume:a().func.isRequired}},94545:function(e,s,r){function t(e){return e.startsWith("sky-jobs-controller-")}function n(e,s,r){return null===s?e:[...e].sort((e,t)=>e[s]<t[s]?"ascending"===r?-1:1:e[s]>t[s]?"ascending"===r?1:-1:0)}r.d(s,{R0:function(){return n},Ym:function(){return t}})}}]);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4869,2003],{81260:function(e,s,r){r.d(s,{Z:function(){return l}});/**
|
|
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 l=(0,r(60998).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},47603:function(e,s,r){r.d(s,{Z:function(){return l}});/**
|
|
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 l=(0,r(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"}]])},1812:function(e,s,r){r.d(s,{X:function(){return n}});var l=r(85893),t=r(67294);let a=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},n=e=>{let{error:s,title:r="Error",onDismiss:n}=e,[i,o]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{s&&o(!1)},[s]),!s||i)return null;let c="string"==typeof s?s:a(s);return(0,l.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex",children:[(0,l.jsx)("div",{className:"flex-shrink-0",children:(0,l.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,l.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,l.jsx)("div",{className:"ml-3",children:(0,l.jsxs)("div",{className:"text-sm text-red-800",children:[(0,l.jsxs)("strong",{children:[r,":"]})," ",c]})})]}),(0,l.jsx)("button",{onClick:()=>{o(!0),n&&n()},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,l.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,l.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,r){r.r(s),r.d(s,{Workspaces:function(){return M}});var l=r(85893),t=r(67294),a=r(11163),n=r(23266),i=r(68969),o=r(17324),c=r(37673),d=r(68764),u=r(30803),m=r(55739),x=r(1272),h=r(50326);r(53850);var p=r(1812),g=r(13626),j=r(81260);/**
|
|
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 f=(0,r(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 v=r(47603),w=r(23001),b=r(80938),N=r(6378),k=r(51214),y=r(36856),C=r(47145),L=r(94545),S=r(93225),z=r(41664),Z=r.n(z);let D=e=>{let{isPrivate:s}=e;return s?(0,l.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,l.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"})},E=k.nb.REFRESH_INTERVAL;function M(){let[e,s]=(0,t.useState)([]),[r,k]=(0,t.useState)({runningClusters:0,totalClusters:0,managedJobs:0}),[z,M]=(0,t.useState)(!0),[R,O]=(0,t.useState)(null),[J,A]=(0,t.useState)({key:"name",direction:"asc"}),[P,T]=(0,t.useState)(""),[W,F]=(0,t.useState)(!1),[B,V]=(0,t.useState)({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null}),[X,q]=(0,t.useState)({open:!1,message:"",userName:""}),[I,_]=(0,t.useState)(null),[H,K]=(0,t.useState)(!1),[U,$]=(0,t.useState)(null),[G,Q]=(0,t.useState)(null),Y=(0,a.useRouter)(),ee=(0,w.X)(),es=async()=>{if(I&&Date.now()-I.timestamp<3e5)return I;K(!0);try{let e=await C.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(),r={role:s.role,name:s.name,timestamp:Date.now()};return _(r),K(!1),r}catch(e){throw K(!1),e}},er=async(e,s)=>{try{let r=await es();if("admin"!==r.role)return q({open:!0,message:e,userName:r.name.toLowerCase()}),!1;return s(),!0}catch(e){return console.error("Failed to check user role:",e),q({open:!0,message:"Error: ".concat(e.message),userName:""}),!1}},el=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&M(!0);try{let[e,r,l]=await Promise.all([N.default.get(o.fX),N.default.get(n.getClusters),N.default.get(i.getManagedJobs,[{allUsers:!0}])]);O(e);let t=Object.keys(e),a=await Promise.all(t.map(e=>N.default.get(o.yz,[e]))),c=Object.fromEntries(t.map((e,s)=>[e,a[s]]));Object.fromEntries(r.map(e=>[e.cluster,e.workspace||"default"]));let d={};t.forEach(e=>{d[e]={name:e,totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:new Set}});let u=0;r.forEach(e=>{let s=e.workspace||"default";d[s]||(d[s]={name:s,totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:new Set}),d[s].totalClusterCount++,("RUNNING"===e.status||"LAUNCHING"===e.status)&&(d[s].runningClusterCount++,u++),e.cloud&&d[s].clouds.add(e.cloud)});let m=l.jobs||[],x=new Set(b.statusGroups.active),h=0;m.forEach(e=>{let s=e.workspace||"default";d[s]&&x.has(e.status)&&d[s].managedJobsCount++,x.has(e.status)&&h++});let p=Object.values(d).filter(e=>t.includes(e.name)).map(e=>({...e,clouds:Array.isArray(c[e.name])?c[e.name]:[]})).sort((e,s)=>e.name.localeCompare(s.name));s(p),k({runningClusters:u,totalClusters:r.length,managedJobs:h})}catch(e){console.error("Error fetching workspace data:",e),s([]),k({runningClusters:0,totalClusters:0,managedJobs:0})}e&&M(!1)};(0,t.useEffect)(()=>{(async()=>{await y.ZP.preloadForPage("workspaces"),el(!0)})();let e=setInterval(()=>{el(!1)},E);return()=>clearInterval(e)},[]);let et=e=>{let s="asc";J.key===e&&"asc"===J.direction&&(s="desc"),A({key:e,direction:s})},ea=e=>J.key===e?"asc"===J.direction?" ↑":" ↓":"",en=t.useMemo(()=>{if(!e)return[];let s=e;if(P&&""!==P.trim()){let r=P.toLowerCase().trim();s=e.filter(e=>!!(e.name.toLowerCase().includes(r)||e.clouds.some(e=>{let s=S.Z2[e.toLowerCase()]||e;return e.toLowerCase().includes(r)||s.toLowerCase().includes(r)}))||!!(!0===((null==R?void 0:R[e.name])||{}).private?"private":"public").includes(r))}return(0,L.R0)(s,J.key,J.direction)},[e,J,P,R]),ei=e=>{er("cannot delete workspace",()=>{V({confirmOpen:!0,workspaceToDelete:e,deleting:!1,error:null})})},eo=async()=>{if(B.workspaceToDelete){V(e=>({...e,deleting:!0,error:null}));try{await (0,o.zl)(B.workspaceToDelete),Q('Workspace "'.concat(B.workspaceToDelete,'" deleted successfully!')),V({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null}),N.default.invalidate(o.fX),await el(!0)}catch(e){console.error("Error deleting workspace:",e),V(e=>({...e,deleting:!1,error:null})),$(e)}}},ec=()=>{V({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null})},ed=e=>{er("cannot edit workspace",()=>{Y.push("/workspaces/".concat(e))})};return z&&0===e.length?(0,l.jsxs)("div",{className:"flex justify-center items-center h-64",children:[(0,l.jsx)(m.Z,{}),(0,l.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading workspaces..."})]}):(0,l.jsxs)("div",{children:[(0,l.jsxs)("div",{className:"fixed top-20 right-4 z-[9999] max-w-md",children:[G&&(0,l.jsx)("div",{className:"bg-green-50 border border-green-200 rounded p-4 mb-4",children:(0,l.jsxs)("div",{className:"flex items-center justify-between",children:[(0,l.jsxs)("div",{className:"flex items-center",children:[(0,l.jsx)("div",{className:"flex-shrink-0",children:(0,l.jsx)("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,l.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,l.jsx)("div",{className:"ml-3",children:(0,l.jsx)("p",{className:"text-sm font-medium text-green-800",children:G})})]}),(0,l.jsx)("div",{className:"ml-auto pl-3",children:(0,l.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,l.jsx)("span",{className:"sr-only",children:"Dismiss"}),(0,l.jsx)("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,l.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,l.jsx)(p.X,{error:U,title:"Error",onDismiss:()=>$(null)})]}),(0,l.jsxs)("div",{className:"flex items-center justify-between mb-2 h-5",children:[(0,l.jsx)("div",{className:"text-base flex items-center",children:(0,l.jsx)("span",{className:"text-sky-blue leading-none",children:"Workspaces"})}),(0,l.jsxs)("div",{className:"flex items-center",children:[z&&(0,l.jsxs)("div",{className:"flex items-center mr-2",children:[(0,l.jsx)(m.Z,{size:15,className:"mt-0"}),(0,l.jsx)("span",{className:"ml-2 text-gray-500 text-xs",children:"Refreshing..."})]}),(0,l.jsxs)("button",{onClick:()=>{N.default.invalidate(o.fX),N.default.invalidate(n.getClusters),N.default.invalidate(i.getManagedJobs,[{allUsers:!0}]),N.default.invalidateFunction(o.yz),el(!0)},disabled:z,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,l.jsx)(g.Z,{className:"h-4 w-4 mr-1.5"}),!ee&&(0,l.jsx)("span",{children:"Refresh"})]})]})]}),(0,l.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,l.jsxs)("div",{className:"relative flex-1 max-w-md",children:[(0,l.jsx)("input",{type:"text",placeholder:"Filter workspaces",value:P,onChange:e=>T(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"}),P&&(0,l.jsx)("button",{onClick:()=>T(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",title:"Clear search",children:(0,l.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,l.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,l.jsx)("button",{onClick:()=>{er("cannot create workspace",()=>{Y.push("/workspace/new")})},disabled:H,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:H?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(m.Z,{size:12,className:"mr-2"}),(0,l.jsx)("span",{children:"Create Workspace"})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(j.Z,{className:"h-4 w-4 mr-2"}),"Create Workspace"]})})]}),0!==e.length||z?(0,l.jsx)(c.Zb,{children:(0,l.jsx)("div",{className:"overflow-x-auto rounded-lg",children:(0,l.jsxs)(d.iA,{className:"min-w-full",children:[(0,l.jsx)(d.xD,{children:(0,l.jsxs)(d.SC,{children:[(0,l.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>et("name"),children:["Workspace",ea("name")]}),(0,l.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>et("totalClusterCount"),children:["Clusters ",ea("totalClusterCount")]}),(0,l.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>et("managedJobsCount"),children:["Jobs",ea("managedJobsCount")]}),(0,l.jsx)(d.ss,{className:"whitespace-nowrap",children:"Enabled infra"}),(0,l.jsx)(d.ss,{className:"whitespace-nowrap",children:"Actions"})]})}),(0,l.jsx)(d.RM,{children:z&&0===en.length?(0,l.jsx)(d.SC,{children:(0,l.jsx)(d.pj,{colSpan:5,className:"text-center py-6 text-gray-500",children:(0,l.jsxs)("div",{className:"flex justify-center items-center",children:[(0,l.jsx)(m.Z,{size:20,className:"mr-2"}),(0,l.jsx)("span",{children:"Loading..."})]})})}):en.length>0?en.map(e=>{let s=!0===((null==R?void 0:R[e.name])||{}).private;return(0,l.jsxs)(d.SC,{className:"hover:bg-gray-50",children:[(0,l.jsxs)(d.pj,{className:"",children:[(0,l.jsx)("button",{onClick:()=>ed(e.name),disabled:H,className:"text-blue-600 hover:text-blue-600 hover:underline text-left",children:e.name}),(0,l.jsx)("span",{className:"ml-2",children:(0,l.jsx)(D,{isPrivate:s})})]}),(0,l.jsx)(d.pj,{children:(0,l.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,l.jsx)(d.pj,{children:(0,l.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,l.jsx)(d.pj,{children:e.clouds.length>0?[...e.clouds].sort().map((s,r)=>{let t=S.Z2[s.toLowerCase()]||s;return(0,l.jsxs)("span",{children:[(0,l.jsx)(Z(),{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:t}),r<e.clouds.length-1&&" "]},s)}):(0,l.jsx)("span",{className:"text-gray-500 text-sm",children:"-"})}),(0,l.jsxs)(d.pj,{children:[(0,l.jsx)(u.z,{variant:"ghost",size:"sm",onClick:()=>ed(e.name),disabled:H,className:"text-gray-600 hover:text-gray-800 mr-1",children:(0,l.jsx)(f,{className:"w-4 h-4"})}),(0,l.jsx)(u.z,{variant:"ghost",size:"sm",onClick:()=>ei(e.name),disabled:"default"===e.name||H,title:"default"===e.name?"Cannot delete default workspace":"Delete workspace",className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:(0,l.jsx)(v.Z,{className:"w-4 h-4"})})]})]},e.name)}):(0,l.jsx)(d.SC,{children:(0,l.jsx)(d.pj,{colSpan:5,className:"text-center py-6 text-gray-500",children:"No workspaces found"})})})]})})}):(0,l.jsxs)("div",{className:"text-center py-10",children:[(0,l.jsx)("p",{className:"text-lg text-gray-600",children:"No workspaces found."}),(0,l.jsx)("p",{className:"text-sm text-gray-500 mt-2",children:"Create a cluster to see its workspace here."})]}),R&&(0,l.jsx)(h.Vq,{open:W,onOpenChange:F,children:(0,l.jsxs)(h.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,l.jsx)(h.fK,{children:(0,l.jsx)(h.$N,{className:"pr-10",children:"All Workspaces Configuration"})}),(0,l.jsx)("div",{className:"flex-grow overflow-y-auto py-4",children:(0,l.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",overflowX:"auto",whiteSpace:"pre",wordBreak:"normal"},children:x.ZP.dump(R,{indent:2})})})]})}),(0,l.jsx)(h.Vq,{open:X.open,onOpenChange:e=>{q(s=>({...s,open:e})),e||$(null)},children:(0,l.jsxs)(h.cZ,{className:"sm:max-w-md transition-all duration-200 ease-in-out",children:[(0,l.jsxs)(h.fK,{children:[(0,l.jsx)(h.$N,{children:"Permission Denied"}),(0,l.jsx)(h.Be,{children:H?(0,l.jsxs)("div",{className:"flex items-center py-2",children:[(0,l.jsx)(m.Z,{size:16,className:"mr-2"}),(0,l.jsx)("span",{children:"Checking permissions..."})]}):(0,l.jsx)(l.Fragment,{children:X.userName?(0,l.jsxs)(l.Fragment,{children:[X.userName," is logged in as non-admin and ",X.message,"."]}):X.message})})]}),(0,l.jsx)(h.cN,{children:(0,l.jsx)(u.z,{variant:"outline",onClick:()=>q(e=>({...e,open:!1})),disabled:H,children:"OK"})})]})}),(0,l.jsx)(h.Vq,{open:B.confirmOpen,onOpenChange:e=>{e||(ec(),$(null))},children:(0,l.jsxs)(h.cZ,{className:"sm:max-w-md",children:[(0,l.jsxs)(h.fK,{children:[(0,l.jsx)(h.$N,{children:"Delete Workspace"}),(0,l.jsxs)(h.Be,{children:['Are you sure you want to delete workspace "',B.workspaceToDelete,'"? This action cannot be undone.']})]}),(0,l.jsxs)(h.cN,{children:[(0,l.jsx)(u.z,{variant:"outline",onClick:ec,disabled:B.deleting,children:"Cancel"}),(0,l.jsx)(u.z,{variant:"destructive",onClick:eo,disabled:B.deleting,children:B.deleting?"Deleting...":"Delete"})]})]})})]})}},12003:function(e,s,r){r.d(s,{j:function(){return n}});var l=r(90512);let t=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=l.W,n=(e,s)=>r=>{var l;if((null==s?void 0:s.variants)==null)return a(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:n,defaultVariants:i}=s,o=Object.keys(n).map(e=>{let s=null==r?void 0:r[e],l=null==i?void 0:i[e];if(null===s)return null;let a=t(s)||t(l);return n[e][a]}),c=r&&Object.entries(r).reduce((e,s)=>{let[r,l]=s;return void 0===l||(e[r]=l),e},{});return a(e,o,null==s?void 0:null===(l=s.compoundVariants)||void 0===l?void 0:l.reduce((e,s)=>{let{class:r,className:l,...t}=s;return Object.entries(t).every(e=>{let[s,r]=e;return Array.isArray(r)?r.includes({...i,...c}[s]):({...i,...c})[s]===r})?[...e,r,l]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}}}]);
|