skypilot-nightly 1.0.0.dev20250806__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.

Files changed (123) hide show
  1. sky/__init__.py +2 -2
  2. sky/backends/cloud_vm_ray_backend.py +33 -4
  3. sky/check.py +11 -1
  4. sky/client/cli/command.py +208 -93
  5. sky/client/sdk.py +14 -1
  6. sky/client/sdk_async.py +4 -0
  7. sky/dashboard/out/404.html +1 -1
  8. sky/dashboard/out/_next/static/YAirOGsV1z6B2RJ0VIUmD/_buildManifest.js +1 -0
  9. sky/dashboard/out/_next/static/chunks/1141-a8a8f1adba34c892.js +11 -0
  10. sky/dashboard/out/_next/static/chunks/1871-980a395e92633a5c.js +6 -0
  11. sky/dashboard/out/_next/static/chunks/3785.6003d293cb83eab4.js +1 -0
  12. sky/dashboard/out/_next/static/chunks/3850-ff4a9a69d978632b.js +1 -0
  13. sky/dashboard/out/_next/static/chunks/4725.29550342bd53afd8.js +1 -0
  14. sky/dashboard/out/_next/static/chunks/{4937.d6bf67771e353356.js → 4937.a2baa2df5572a276.js} +1 -1
  15. sky/dashboard/out/_next/static/chunks/6130-2be46d70a38f1e82.js +1 -0
  16. sky/dashboard/out/_next/static/chunks/6601-3e21152fe16da09c.js +1 -0
  17. sky/dashboard/out/_next/static/chunks/{691.6d99cbfba347cebf.js → 691.5eeedf82cc243343.js} +1 -1
  18. sky/dashboard/out/_next/static/chunks/6989-6129c1cfbcf51063.js +1 -0
  19. sky/dashboard/out/_next/static/chunks/6990-0f886f16e0d55ff8.js +1 -0
  20. sky/dashboard/out/_next/static/chunks/8056-019615038d6ce427.js +1 -0
  21. sky/dashboard/out/_next/static/chunks/8252.62b0d23aed618bb2.js +16 -0
  22. sky/dashboard/out/_next/static/chunks/8969-318c3dca725e8e5d.js +1 -0
  23. sky/dashboard/out/_next/static/chunks/9025.a1bef12d672bb66d.js +6 -0
  24. sky/dashboard/out/_next/static/chunks/9159-11421c0f2909236f.js +1 -0
  25. sky/dashboard/out/_next/static/chunks/9360.85b0b1b4054574dd.js +31 -0
  26. sky/dashboard/out/_next/static/chunks/9666.cd4273f2a5c5802c.js +1 -0
  27. sky/dashboard/out/_next/static/chunks/{9847.4c46c5e229c78704.js → 9847.757720f3b40c0aa5.js} +1 -1
  28. sky/dashboard/out/_next/static/chunks/pages/{_app-2a43ea3241bbdacd.js → _app-1e6de35d15a8d432.js} +1 -1
  29. sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-6fd1d2d8441aa54b.js +11 -0
  30. sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-155d477a6c3e04e2.js +1 -0
  31. sky/dashboard/out/_next/static/chunks/pages/{clusters-47f1ddae13a2f8e4.js → clusters-b30460f683e6ba96.js} +1 -1
  32. sky/dashboard/out/_next/static/chunks/pages/config-dfb9bf07b13045f4.js +1 -0
  33. sky/dashboard/out/_next/static/chunks/pages/infra/{[context]-2a44e70b500b6b70.js → [context]-13d53fffc03ccb52.js} +1 -1
  34. sky/dashboard/out/_next/static/chunks/pages/{infra-22faac9325016d83.js → infra-fc9222e26c8e2f0d.js} +1 -1
  35. sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-154f55cf8af55be5.js +11 -0
  36. sky/dashboard/out/_next/static/chunks/pages/jobs/pools/[pool]-f5ccf5d39d87aebe.js +21 -0
  37. sky/dashboard/out/_next/static/chunks/pages/jobs-cdc60fb5d371e16a.js +1 -0
  38. sky/dashboard/out/_next/static/chunks/pages/{users-b90c865a690bfe84.js → users-7ed36e44e779d5c7.js} +1 -1
  39. sky/dashboard/out/_next/static/chunks/pages/{volumes-7af733f5d7b6ed1c.js → volumes-c9695d657f78b5dc.js} +1 -1
  40. sky/dashboard/out/_next/static/chunks/pages/workspace/new-3f88a1c7e86a3f86.js +1 -0
  41. sky/dashboard/out/_next/static/chunks/pages/workspaces/[name]-f72f73bcef9541dc.js +1 -0
  42. sky/dashboard/out/_next/static/chunks/pages/workspaces-8f67be60165724cc.js +1 -0
  43. sky/dashboard/out/_next/static/chunks/webpack-76efbdad99742559.js +1 -0
  44. sky/dashboard/out/_next/static/css/4614e06482d7309e.css +3 -0
  45. sky/dashboard/out/clusters/[cluster]/[job].html +1 -1
  46. sky/dashboard/out/clusters/[cluster].html +1 -1
  47. sky/dashboard/out/clusters.html +1 -1
  48. sky/dashboard/out/config.html +1 -1
  49. sky/dashboard/out/index.html +1 -1
  50. sky/dashboard/out/infra/[context].html +1 -1
  51. sky/dashboard/out/infra.html +1 -1
  52. sky/dashboard/out/jobs/[job].html +1 -1
  53. sky/dashboard/out/jobs/pools/[pool].html +1 -0
  54. sky/dashboard/out/jobs.html +1 -1
  55. sky/dashboard/out/users.html +1 -1
  56. sky/dashboard/out/volumes.html +1 -1
  57. sky/dashboard/out/workspace/new.html +1 -1
  58. sky/dashboard/out/workspaces/[name].html +1 -1
  59. sky/dashboard/out/workspaces.html +1 -1
  60. sky/global_user_state.py +14 -2
  61. sky/jobs/__init__.py +2 -0
  62. sky/jobs/client/sdk.py +43 -2
  63. sky/jobs/server/core.py +48 -1
  64. sky/jobs/server/server.py +52 -3
  65. sky/jobs/state.py +5 -1
  66. sky/schemas/db/global_user_state/002_add_workspace_to_cluster_history.py +35 -0
  67. sky/schemas/db/spot_jobs/003_pool_hash.py +34 -0
  68. sky/serve/client/impl.py +85 -1
  69. sky/serve/client/sdk.py +16 -47
  70. sky/serve/constants.py +2 -1
  71. sky/serve/controller.py +4 -2
  72. sky/serve/serve_state.py +28 -5
  73. sky/serve/serve_utils.py +77 -46
  74. sky/serve/server/core.py +13 -197
  75. sky/serve/server/impl.py +239 -2
  76. sky/serve/service.py +8 -3
  77. sky/server/common.py +11 -4
  78. sky/server/constants.py +1 -1
  79. sky/server/requests/executor.py +5 -3
  80. sky/server/requests/payloads.py +19 -0
  81. sky/task.py +18 -11
  82. sky/templates/kubernetes-ray.yml.j2 +5 -0
  83. sky/templates/sky-serve-controller.yaml.j2 +1 -0
  84. sky/usage/usage_lib.py +8 -6
  85. sky/utils/annotations.py +8 -3
  86. sky/utils/common_utils.py +11 -1
  87. sky/utils/db/migration_utils.py +2 -2
  88. {skypilot_nightly-1.0.0.dev20250806.dist-info → skypilot_nightly-1.0.0.dev20250807.dist-info}/METADATA +18 -13
  89. {skypilot_nightly-1.0.0.dev20250806.dist-info → skypilot_nightly-1.0.0.dev20250807.dist-info}/RECORD +95 -92
  90. sky/client/sdk.pyi +0 -301
  91. sky/dashboard/out/_next/static/Gelsd19kVxXcX7aQQGsGu/_buildManifest.js +0 -1
  92. sky/dashboard/out/_next/static/chunks/1043-75af48ca5d5aaf57.js +0 -1
  93. sky/dashboard/out/_next/static/chunks/1141-8678a9102cc5f67e.js +0 -11
  94. sky/dashboard/out/_next/static/chunks/1664-22b00e32c9ff96a4.js +0 -1
  95. sky/dashboard/out/_next/static/chunks/1871-ced1c14230cad6e1.js +0 -6
  96. sky/dashboard/out/_next/static/chunks/2003.f90b06bb1f914295.js +0 -1
  97. sky/dashboard/out/_next/static/chunks/2350.fab69e61bac57b23.js +0 -1
  98. sky/dashboard/out/_next/static/chunks/2622-951867535095b0eb.js +0 -1
  99. sky/dashboard/out/_next/static/chunks/3785.0a173cd4393f0fef.js +0 -1
  100. sky/dashboard/out/_next/static/chunks/4725.42f21f250f91f65b.js +0 -1
  101. sky/dashboard/out/_next/static/chunks/4869.18e6a4361a380763.js +0 -16
  102. sky/dashboard/out/_next/static/chunks/5230-f3bb2663e442e86c.js +0 -1
  103. sky/dashboard/out/_next/static/chunks/6601-2109d22e7861861c.js +0 -1
  104. sky/dashboard/out/_next/static/chunks/6990-08b2a1cae076a943.js +0 -1
  105. sky/dashboard/out/_next/static/chunks/8969-9a8cca241b30db83.js +0 -1
  106. sky/dashboard/out/_next/static/chunks/9025.99f29acb7617963e.js +0 -6
  107. sky/dashboard/out/_next/static/chunks/938-bda2685db5eae6cf.js +0 -1
  108. sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-7cb24da04ca00956.js +0 -11
  109. sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-1e95993124dbfc57.js +0 -1
  110. sky/dashboard/out/_next/static/chunks/pages/config-d56e64f30db7b42e.js +0 -1
  111. sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-90693cb88b5599a7.js +0 -11
  112. sky/dashboard/out/_next/static/chunks/pages/jobs-ab318e52eb4424a7.js +0 -1
  113. sky/dashboard/out/_next/static/chunks/pages/workspace/new-92f741084a89e27b.js +0 -1
  114. sky/dashboard/out/_next/static/chunks/pages/workspaces/[name]-35e0de5bca55e594.js +0 -1
  115. sky/dashboard/out/_next/static/chunks/pages/workspaces-062525fb5462acb6.js +0 -1
  116. sky/dashboard/out/_next/static/chunks/webpack-387626669badf82e.js +0 -1
  117. sky/dashboard/out/_next/static/css/b3227360726f12eb.css +0 -3
  118. /sky/dashboard/out/_next/static/{Gelsd19kVxXcX7aQQGsGu → YAirOGsV1z6B2RJ0VIUmD}/_ssgManifest.js +0 -0
  119. /sky/dashboard/out/_next/static/chunks/{6135-2d7ed3350659d073.js → 6135-85426374db04811e.js} +0 -0
  120. {skypilot_nightly-1.0.0.dev20250806.dist-info → skypilot_nightly-1.0.0.dev20250807.dist-info}/WHEEL +0 -0
  121. {skypilot_nightly-1.0.0.dev20250806.dist-info → skypilot_nightly-1.0.0.dev20250807.dist-info}/entry_points.txt +0 -0
  122. {skypilot_nightly-1.0.0.dev20250806.dist-info → skypilot_nightly-1.0.0.dev20250807.dist-info}/licenses/LICENSE +0 -0
  123. {skypilot_nightly-1.0.0.dev20250806.dist-info → skypilot_nightly-1.0.0.dev20250807.dist-info}/top_level.txt +0 -0
sky/client/sdk.pyi DELETED
@@ -1,301 +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[server_common.RequestId],
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: server_common.RequestId) -> Any:
253
- ...
254
-
255
-
256
- def stream_and_get(request_id: Optional[server_common.RequestId] = ...,
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[
265
- server_common.RequestId, List[server_common.RequestId]]] = ...,
266
- all_users: bool = ...,
267
- silent: bool = ...) -> server_common.RequestId:
268
- ...
269
-
270
-
271
- def api_status(request_ids: Optional[List[server_common.RequestId]] = ...,
272
- all_status: bool = ...) -> List[payloads.RequestPayload]:
273
- ...
274
-
275
-
276
- def api_info() -> Dict[str, Any]:
277
- ...
278
-
279
-
280
- def api_start(*,
281
- deploy: bool = ...,
282
- host: str = ...,
283
- foreground: bool = ...,
284
- metrics: bool = ...,
285
- metrics_port: Optional[int] = ...,
286
- enable_basic_auth: bool = ...) -> None:
287
- ...
288
-
289
-
290
- def api_stop() -> None:
291
- ...
292
-
293
-
294
- def api_server_logs(follow: bool = ..., tail: Optional[int] = ...) -> None:
295
- ...
296
-
297
-
298
- def api_login(endpoint: Optional[str] = ...,
299
- relogin: bool = ...,
300
- service_account_token: Optional[str] = ...) -> None:
301
- ...
@@ -1 +0,0 @@
1
- self.__BUILD_MANIFEST=function(s,c,a,e,t,u,n,b,r,i,f,j,k,o,h){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":["static/chunks/pages/index-444f1804401f04ea.js"],"/_error":["static/chunks/pages/_error-c66a4e8afc46f17b.js"],"/clusters":["static/chunks/pages/clusters-47f1ddae13a2f8e4.js"],"/clusters/[cluster]":[s,c,a,e,t,b,i,f,u,n,j,r,k,o,h,"static/chunks/1871-ced1c14230cad6e1.js","static/chunks/pages/clusters/[cluster]-1e95993124dbfc57.js"],"/clusters/[cluster]/[job]":[s,c,a,e,t,u,n,"static/chunks/pages/clusters/[cluster]/[job]-7cb24da04ca00956.js"],"/config":["static/chunks/pages/config-d56e64f30db7b42e.js"],"/infra":["static/chunks/pages/infra-22faac9325016d83.js"],"/infra/[context]":["static/chunks/pages/infra/[context]-2a44e70b500b6b70.js"],"/jobs":["static/chunks/pages/jobs-ab318e52eb4424a7.js"],"/jobs/[job]":[s,c,a,e,t,b,f,u,n,r,"static/chunks/pages/jobs/[job]-90693cb88b5599a7.js"],"/users":["static/chunks/pages/users-b90c865a690bfe84.js"],"/volumes":["static/chunks/pages/volumes-7af733f5d7b6ed1c.js"],"/workspace/new":["static/chunks/pages/workspace/new-92f741084a89e27b.js"],"/workspaces":["static/chunks/pages/workspaces-062525fb5462acb6.js"],"/workspaces/[name]":[s,c,a,e,t,b,i,u,n,j,r,k,o,h,"static/chunks/1141-8678a9102cc5f67e.js","static/chunks/pages/workspaces/[name]-35e0de5bca55e594.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/2622-951867535095b0eb.js","static/chunks/6135-2d7ed3350659d073.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-75af48ca5d5aaf57.js","static/chunks/6601-2109d22e7861861c.js","static/chunks/938-bda2685db5eae6cf.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]),h=(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]),m=(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 h(e.workspace))},[_,h,t]),y=(0,r.useCallback)(async()=>{s&&(n.default.invalidate(d,[{clusterName:t,workspace:s.workspace||"default"}]),await h(s.workspace))},[h,s,t]);return(0,r.useEffect)(()=>{(async()=>{let e=await _();e&&h(e.workspace)})()},[t,a,_,h]),{clusterData:s,clusterJobData:l,loading:i,clusterDetailsLoading:i,clusterJobsLoading:f,refreshData:m,refreshClusterJobsOnly:y}}},32045:function(e,t,a){a.d(t,{l4:function(){return n}});var r=a(93225),s=a(47145);async function o(e,t){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];try{let o=[];try{if(a){console.log("Force refreshing clouds by running sky check...");try{let e=await s.x.post("/check",{}),t=e.headers.get("X-Skypilot-Request-ID")||e.headers.get("X-Request-ID"),a=await s.x.get("/api/get?request_id=".concat(t)),r=await a.json();console.log("Sky check completed:",r)}catch(e){console.error("Error running sky check:",e)}}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)),n=await r.json();o=n.return_value?JSON.parse(n.return_value):[],console.log("Enabled clouds:",o)}catch(e){console.error("Error fetching enabled clouds:",e),o=[]}let n={};r.$m.forEach(e=>{let t=o.includes(e.toLowerCase());n[e]={name:e,clusters:0,jobs:0,enabled:t}}),e.forEach(e=>{if(e.cloud){let t=e.cloud;n[t]&&(n[t].clusters+=1,n[t].enabled=!0)}}),t.forEach(e=>{if(e.cloud){let t=e.cloud;n[t]&&(n[t].jobs+=1,n[t].enabled=!0)}});let l=r.$m.length,c=Object.values(n).filter(e=>e.enabled).length;return{clouds:Object.values(n).filter(e=>e.enabled).sort((e,t)=>e.name.localeCompare(t.name)),totalClouds:l,enabledClouds:c}}catch(e){return console.error("Error fetching cloud infrastructure:",e),{clouds:[],totalClouds:r.$m.length,enabledClouds:0}}}async function n(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],{getClusters:t}=await Promise.resolve().then(a.bind(a,23266)),{getManagedJobs:r}=await Promise.resolve().then(a.bind(a,68969)),s=(await Promise.resolve().then(a.bind(a,6378))).default,[n,c]=await Promise.all([s.get(t),s.get(r,[{allUsers:!0}])]),u=n||[],i=(null==c?void 0:c.jobs)||[],[d,g]=await Promise.all([l(u,i),o(u,i,e)]);return{gpuData:d,cloudData:g}}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 t}});/**
2
- * @license lucide-react v0.407.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */let t=(0,r(60998).Z)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},98418:function(e,s,r){r.d(s,{Z:function(){return t}});/**
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 t=(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 t=r(85893),a=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},n=e=>{let{error:s,title:r="Error",onDismiss:n}=e,[c,i]=(0,a.useState)(!1);if((0,a.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),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,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"})})})]})})}},69123:function(e,s,r){r.d(s,{g:function(){return n}});var t=r(85893),a=r(67294),l=r(32350);let n=a.forwardRef((e,s)=>{let{className:r,...a}=e;return(0,t.jsx)("textarea",{className:(0,l.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,...a})});n.displayName="Textarea"},11141:function(e,s,r){r.r(s),r.d(s,{WorkspaceEditor:function(){return R}});var t=r(85893),a=r(67294),l=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:a,...l}=e;return(0,t.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),...l,children:a})},k=e=>{let{className:s="",children:r,...a}=e;return(0,t.jsx)("div",{className:"text-sm leading-relaxed ".concat(s),...a,children:r})};var C=r(53850),L=r(1812),S=r(80938),E=r(1272),A=r(93225),W=r(53081);let Z=e=>{let{message:s}=e;return s?(0,t.jsxs)(w,{className:"border-green-200 bg-green-50",children:[(0,t.jsx)(p.Z,{className:"h-4 w-4 text-green-600"}),(0,t.jsx)(k,{className:"text-green-800",children:s})]}):null},D=e=>{let{workspaceName:s,config:r,enabledClouds:a=[]}=e;if(!r)return null;let l="default"===s,n=0===Object.keys(r).length;if(l&&n)return(0,t.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(a.map(e=>e.toLowerCase()));Object.entries(r).forEach(e=>{let[s,r]=e;if("private"===s||"allowed_users"===s)return;let a=A.Z2[s.toLowerCase()]||s.toUpperCase(),l=null==a?void 0:a.toLowerCase(),n=d.has(l)||Array.from(d).some(e=>e.startsWith(l+"/")),u=()=>"kubernetes"===s.toLowerCase()?Array.from(d).filter(e=>e.startsWith(l+"/")).map(e=>e.split("/")[1]):[];if((null==r?void 0:r.disabled)===!0)i.push(a);else if(r&&Object.keys(r).length>0){let e="";if("gcp"===s.toLowerCase()&&r.project_id)e=" (Project ID: ".concat(r.project_id,")");else if("aws"===s.toLowerCase()&&r.region)e=" (Region: ".concat(r.region,")");else if("kubernetes"===s.toLowerCase()){let s=u();s.length>0&&(e=" (Contexts: ".concat(s.join(", "),")"))}n?c.push((0,t.jsxs)("span",{className:"block",children:[a,e," is enabled."]},"".concat(s,"-enabled"))):o.push((0,t.jsxs)("span",{className:"block text-amber-700",children:[a,e," is configured but not currently available."]},"".concat(s,"-configured-not-enabled")))}else if(n){let e="";if("kubernetes"===s.toLowerCase()){let s=u();s.length>0&&(e=" (Contexts: ".concat(s.join(", "),")"))}c.push((0,t.jsxs)("span",{className:"block",children:[a,e," is enabled (using default settings)."]},"".concat(s,"-default-enabled")))}else o.push((0,t.jsxs)("span",{className:"block text-amber-700",children:[a," 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,t.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,t.jsx)("div",{className:"text-sm text-gray-700 mb-3 p-3 bg-sky-50 rounded border border-sky-200",children:u}):!l&&n?(0,t.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},M=e=>{let{isPrivate:s}=e;return s?(0,t.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,t.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 a=s.allowed_users||[],l=(r||[]).filter(e=>"admin"===e.role).map(e=>e.username),n=[...new Set([...a,...l])];return 0===n.length?(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)("h4",{className:"mb-2 text-xs text-gray-500 tracking-wider",children:"Allowed Users (0)"}),(0,t.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,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("h4",{className:"mb-2 text-xs text-gray-500 tracking-wider",children:["Allowed Users (",n.length,")"]}),(0,t.jsx)("div",{className:"space-y-1 max-h-48 overflow-y-auto border border-gray-200 rounded",children:n.map(e=>{let s=l.includes(e);return(0,t.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,t.jsx)("span",{className:"font-medium text-gray-700",children:e}),s?(0,t.jsxs)("span",{className:"inline-flex items-center text-blue-600",children:[(0,t.jsx)(C.r7,{className:"w-3 h-3 mr-1"}),"Admin"]}):(0,t.jsxs)("span",{className:"inline-flex items-center text-gray-600",children:[(0,t.jsx)(b.Z,{className:"w-3 h-3 mr-1"}),"User"]})]},e)})})]})};function R(e){let{workspaceName:s,isNewWorkspace:r=!1}=e,o=(0,l.useRouter)(),[u,p]=(0,a.useState)({}),[b,w]=(0,a.useState)({}),[k,A]=(0,a.useState)(""),[R,_]=(0,a.useState)(!0),[z,O]=(0,a.useState)(!1),[T,U]=(0,a.useState)(!1),[Y,J]=(0,a.useState)(null),[I,V]=(0,a.useState)(null),[F,H]=(0,a.useState)(null),[X,B]=(0,a.useState)([]),[G,q]=(0,a.useState)({showDialog:!1,deleting:!1,error:null}),[K,Q]=(0,a.useState)({totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:[]}),[$,ee]=(0,a.useState)(!1),es=(0,a.useCallback)(async()=>{_(!0),J(null);try{let e;let[r,t]=await Promise.all([(0,n.fX)(),(0,W.R)()]),a=r[s]||{};p(a),w(a),B(t||[]),e=0===Object.keys(a).length?"".concat(s,":\n # Empty workspace configuration - uses all accessible infrastructure\n"):E.ZP.dump({[s]:a},{indent:2,lineWidth:-1,noRefs:!0,skipInvalid:!0,flowLevel:-1}),A(e)}catch(e){console.error("Error fetching workspace config:",e),J(e)}finally{_(!1)}},[s]),er=(0,a.useCallback)(async()=>{if(!r){ee(!0);try{let[e,r,t]=await Promise.all([(0,c.getClusters)(),(0,i.getManagedJobs)(),(0,n.yz)(s,!0)]),a=e.filter(e=>(e.workspace||"default")===s),l=a.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:a.length,runningClusterCount:l.length,managedJobsCount:x,clouds:Array.isArray(t)?t:[]})}catch(e){console.error("Failed to fetch workspace stats:",e)}finally{ee(!1)}}},[s,r]);(0,a.useEffect)(()=>{r?(_(!1),A("".concat(s,":\n # New workspace configuration\n # Leave empty to use all accessible infrastructure\n"))):(es(),er())},[s,r,es,er]),(0,a.useEffect)(()=>{U(JSON.stringify(u)!==JSON.stringify(b))},[u,b]);let et=e=>{A(e),H(null);try{let r=E.ZP.load(e)||{},t=Object.keys(r);if(0===t.length)p({});else if(1===t.length){let e=t[0];if(e!==s){H('Workspace name cannot be changed. Expected "'.concat(s,'" but found "').concat(e,'".'));return}let a=r[s]||{};p(a)}else H("Configuration must contain only one workspace. Found: ".concat(t.join(", ")))}catch(e){H("Invalid YAML: ".concat(e.message))}},ea=async()=>{O(!0),J(null),V(null);try{if(F)throw Error("Please fix YAML errors before saving");let e=E.ZP.load(k)||{},t=Object.keys(e);if(t.length>0&&t[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)}},el=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,t.jsx)("div",{children:"Loading..."});let ei=r?"Create New Workspace | SkyPilot Dashboard":"Workspace: ".concat(s," | SkyPilot Dashboard");return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x(),{children:(0,t.jsx)("title",{children:ei})}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("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)(d(),{href:"/workspaces",className:"text-sky-blue hover:underline",children:"Workspaces"}),(0,t.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,t.jsx)(d(),{href:r?"/workspace/new":"/workspaces/".concat(s),className:"text-sky-blue hover:underline",children:r?"New Workspace":s}),T&&(0,t.jsx)("span",{className:"ml-3 px-2 py-1 bg-yellow-100 text-yellow-800 text-xs rounded",children:"Unsaved changes"})]}),(0,t.jsxs)("div",{className:"text-sm flex items-center",children:[(R||z||$)&&(0,t.jsxs)("div",{className:"flex items-center mr-4",children:[(0,t.jsx)(g.Z,{size:15,className:"mt-0"}),(0,t.jsx)("span",{className:"ml-2 text-gray-500",children:z?"Saving...":"Loading..."})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[!r&&(0,t.jsxs)("button",{onClick:ec,disabled:R||z||$,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[(0,t.jsx)(j.Z,{className:"w-4 h-4 mr-1.5"}),"Refresh"]}),!r&&"default"!==s&&(0,t.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,t.jsx)(y.Z,{className:"w-4 h-4 mr-1.5"}),"Delete"]})]})]})]}),R?(0,t.jsxs)("div",{className:"flex justify-center items-center py-12",children:[(0,t.jsx)(g.Z,{size:24,className:"mr-2"}),(0,t.jsx)("span",{className:"text-gray-500",children:"Loading workspace configuration..."})]}):(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)(L.X,{error:Y,title:"Error",onDismiss:()=>J(null)}),(0,t.jsx)(Z,{message:I}),(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[!r&&(0,t.jsx)("div",{className:"lg:col-span-1",children:(0,t.jsxs)(m.Zb,{className:"h-full",children:[(0,t.jsx)(m.Ol,{children:(0,t.jsx)(m.ll,{className:"text-base font-normal",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-semibold",children:"Workspace:"})," ",s]}),(0,t.jsx)(M,{isPrivate:!0===b.private})]})})}),(0,t.jsxs)(m.aY,{className:"text-sm pb-2 flex-1",children:[(0,t.jsxs)("div",{className:"py-2 flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center text-gray-600",children:[(0,t.jsx)(C.QT,{className:"w-4 h-4 mr-2 text-gray-500"}),(0,t.jsx)("span",{children:"Clusters (Running / Total)"})]}),(0,t.jsx)("span",{className:"font-normal text-gray-800",children:$?"...":"".concat(K.runningClusterCount," / ").concat(K.totalClusterCount)})]}),(0,t.jsxs)("div",{className:"py-2 flex items-center justify-between border-t border-gray-100",children:[(0,t.jsxs)("div",{className:"flex items-center text-gray-600",children:[(0,t.jsx)(C.Vp,{className:"w-4 h-4 mr-2 text-gray-500"}),(0,t.jsx)("span",{children:"Managed Jobs"})]}),(0,t.jsx)("span",{className:"font-normal text-gray-800",children:$?"...":K.managedJobsCount})]})]}),(0,t.jsxs)("div",{className:"px-6 pb-6 text-sm pt-3",children:[(0,t.jsx)("h4",{className:"mb-2 text-xs text-gray-500 tracking-wider",children:"Enabled Infra"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-x-4 gap-y-1",children:$?(0,t.jsx)("span",{className:"text-gray-500",children:"Loading..."}):K.clouds.length>0?K.clouds.map(e=>(0,t.jsxs)("div",{className:"flex items-center text-gray-700",children:[(0,t.jsx)(C.Ye,{className:"w-3.5 h-3.5 mr-1.5 text-green-500"}),(0,t.jsx)("span",{children:e})]},e)):(0,t.jsx)("span",{className:"text-gray-500 italic",children:"No enabled infrastructure"})}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(D,{workspaceName:s,config:b,enabledClouds:K.clouds})}),(0,t.jsx)(P,{workspaceConfig:b,allUsers:X})]})]})}),(0,t.jsx)("div",{className:r?"lg:col-span-3":"lg:col-span-2",children:(0,t.jsxs)(m.Zb,{className:"h-full flex flex-col",children:[(0,t.jsx)(m.Ol,{children:(0,t.jsx)(m.ll,{className:"text-base font-normal",children:r?"New Workspace YAML":"Edit Workspace YAML"})}),(0,t.jsx)(m.aY,{className:"flex-1 flex flex-col",children:(0,t.jsxs)("div",{className:"space-y-4 flex-1 flex flex-col",children:[F&&(0,t.jsx)(L.X,{error:F,onDismiss:()=>H(null)}),(0,t.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,t.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,t.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,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Example configuration:"}),(0,t.jsx)("div",{className:"p-3 bg-gray-50 border rounded-lg",children:(0,t.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,t.jsx)(f.g,{value:k,onChange:e=>et(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,t.jsx)("div",{className:"flex justify-end space-x-3 pt-3 border-gray-200",children:(0,t.jsxs)(h.z,{onClick:ea,disabled:z||F||R,className:"inline-flex items-center bg-sky-600 hover:bg-sky-700 text-white",children:[(0,t.jsx)(N.Z,{className:"w-4 h-4 mr-1.5"}),z?"Applying...":"Apply"]})})]})]})})]})})]})]}),(0,t.jsx)(v.Vq,{open:G.showDialog,onOpenChange:en,children:(0,t.jsxs)(v.cZ,{className:"sm:max-w-md",children:[(0,t.jsxs)(v.fK,{className:"",children:[(0,t.jsx)(v.$N,{children:"Delete Workspace"}),(0,t.jsxs)(v.Be,{children:['Are you sure you want to delete workspace "',s,'"? This action cannot be undone.']})]}),G.error&&(0,t.jsx)(L.X,{error:G.error,title:"Deletion Failed",onDismiss:()=>q(e=>({...e,error:null}))}),(0,t.jsxs)(v.cN,{className:"",children:[(0,t.jsx)(h.z,{variant:"outline",onClick:en,disabled:G.deleting,children:"Cancel"}),(0,t.jsx)(h.z,{variant:"destructive",onClick:el,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([[2622],{53850:function(e,n,t){t.d(n,{E9:function(){return y},J$:function(){return a},PC:function(){return f},Ps:function(){return s},QT:function(){return h},Vp:function(){return x},W2:function(){return l},Ye:function(){return c},aD:function(){return j},eU:function(){return u},fp:function(){return d},fy:function(){return m},h0:function(){return g},mU:function(){return p},oy:function(){return v},r7:function(){return w}});var r=t(85893);t(67294);var o=t(88507),i=t(28586);function s(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"})})}function l(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("circle",{cx:"10",cy:"10",r:"8"})})}function a(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("circle",{cx:"10",cy:"10",r:"8"})})}function c(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("path",{d:"M6 12l4 4 8-8"})})}function d(e){return(0,r.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{x:"6",y:"5",width:"4",height:"14",rx:"1"}),(0,r.jsx)("rect",{x:"14",y:"5",width:"4",height:"14",rx:"1"})]})}function u(e){return(0,r.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("ellipse",{cx:"12",cy:"4",rx:"8",ry:"2"}),(0,r.jsx)("ellipse",{cx:"12",cy:"20",rx:"8",ry:"2"}),(0,r.jsx)("path",{d:"M4 4v16"}),(0,r.jsx)("path",{d:"M20 4v16"}),(0,r.jsx)("path",{d:"M9 9h6"}),(0,r.jsx)("path",{d:"M9 12h6"}),(0,r.jsx)("path",{d:"M9 15h6"})]})}function h(e){return(0,r.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),(0,r.jsx)("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),(0,r.jsx)("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),(0,r.jsx)("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})}function x(e){return(0,r.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"}),(0,r.jsx)("rect",{width:"20",height:"14",x:"2",y:"6",rx:"2"})]})}function f(e){return(0,r.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",ry:"2"}),(0,r.jsx)("rect",{x:"9",y:"9",width:"6",height:"6"}),(0,r.jsx)("line",{x1:"9",y1:"1",x2:"9",y2:"4"}),(0,r.jsx)("line",{x1:"15",y1:"1",x2:"15",y2:"4"}),(0,r.jsx)("line",{x1:"9",y1:"20",x2:"9",y2:"23"}),(0,r.jsx)("line",{x1:"15",y1:"20",x2:"15",y2:"23"}),(0,r.jsx)("line",{x1:"20",y1:"9",x2:"23",y2:"9"}),(0,r.jsx)("line",{x1:"20",y1:"14",x2:"23",y2:"14"}),(0,r.jsx)("line",{x1:"1",y1:"9",x2:"4",y2:"9"}),(0,r.jsx)("line",{x1:"1",y1:"14",x2:"4",y2:"14"})]})}function g(e){return(0,r.jsxs)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),(0,r.jsx)("polyline",{points:"15 3 21 3 21 9"}),(0,r.jsx)("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}function m(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{d:"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"})})}function w(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})}function p(e){return(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:(0,r.jsx)("path",{transform:"scale(0.85) translate(1.8, 1.8)",d:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"})})}function y(e){return(0,r.jsx)("svg",{...e,stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,r.jsxs)("g",{children:[(0,r.jsx)("path",{fill:"none",d:"M0 0h24v24H0z"}),(0,r.jsx)("path",{d:"M3 18.5V5a3 3 0 0 1 3-3h14a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5A3.5 3.5 0 0 1 3 18.5zM19 20v-3H6.5a1.5 1.5 0 0 0 0 3H19zM10 4H6a1 1 0 0 0-1 1v10.337A3.486 3.486 0 0 1 6.5 15H19V4h-2v8l-3.5-2-3.5 2V4z"})]})})}let j=o.Z,v=i.Z},88950:function(e,n,t){t.d(n,{Bw:function(){return g},Ph:function(){return d},Ql:function(){return m},i4:function(){return h},ki:function(){return u}});var r=t(85893),o=t(67294),i=t(2067),s=t(45895),l=t(7242),a=t(70282),c=t(32350);let d=i.fC;i.ZA;let u=i.B4,h=o.forwardRef((e,n)=>{let{className:t,children:o,...l}=e;return(0,r.jsxs)(i.xz,{ref:n,className:(0,c.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...l,children:[o,(0,r.jsx)(i.JO,{asChild:!0,children:(0,r.jsx)(s.Z,{className:"h-4 w-4 opacity-50"})})]})});h.displayName=i.xz.displayName;let x=o.forwardRef((e,n)=>{let{className:t,...o}=e;return(0,r.jsx)(i.u_,{ref:n,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",t),...o,children:(0,r.jsx)(l.Z,{className:"h-4 w-4"})})});x.displayName=i.u_.displayName;let f=o.forwardRef((e,n)=>{let{className:t,...o}=e;return(0,r.jsx)(i.$G,{ref:n,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",t),...o,children:(0,r.jsx)(s.Z,{className:"h-4 w-4"})})});f.displayName=i.$G.displayName;let g=o.forwardRef((e,n)=>{let{className:t,children:o,position:s="popper",...l}=e;return(0,r.jsx)(i.h_,{children:(0,r.jsxs)(i.VY,{ref:n,className:(0,c.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===s&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:s,...l,children:[(0,r.jsx)(x,{}),(0,r.jsx)(i.l_,{className:(0,c.cn)("p-1","popper"===s&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:o}),(0,r.jsx)(f,{})]})})});g.displayName=i.VY.displayName,o.forwardRef((e,n)=>{let{className:t,...o}=e;return(0,r.jsx)(i.__,{ref:n,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...o})}).displayName=i.__.displayName;let m=o.forwardRef((e,n)=>{let{className:t,children:o,...s}=e;return(0,r.jsxs)(i.ck,{ref:n,className:(0,c.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...s,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(i.wU,{children:(0,r.jsx)(a.Z,{className:"h-4 w-4"})})}),(0,r.jsx)(i.eT,{children:o})]})});m.displayName=i.ck.displayName,o.forwardRef((e,n)=>{let{className:t,...o}=e;return(0,r.jsx)(i.Z0,{ref:n,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",t),...o})}).displayName=i.Z0.displayName},36989:function(e,n,t){t.d(n,{$B:function(){return f},LU:function(){return h},Md:function(){return u},WH:function(){return d},Zg:function(){return g},Zn:function(){return x},xn:function(){return m},yc:function(){return a}});var r=t(85893),o=t(67294),i=t(53302),s=t(11886),l=t(88950);let a=t(51214).nb.REFRESH_INTERVAL,c={placement:"bottom",color:"default"},d=e=>{let{children:n,...t}=e,o=t.content;return t.content=void 0,(0,r.jsx)(i.e,{...c,...t,content:(0,r.jsx)("span",{className:"left-full w-max px-2 py-1 text-sm text-gray-100 bg-gray-500 text-sm capitalize rounded",children:o}),children:n})},u=e=>{let{children:n,...t}=e,o=t.content;return t.content=void 0,(0,r.jsx)(i.e,{...c,...t,content:(0,r.jsx)("span",{className:"left-full w-max px-2 py-1 text-sm text-gray-100 bg-gray-500 text-sm rounded",children:o}),children:n})};function h(e){if(!e&&0!==e)return"-";let n=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(n>=e.value&&r<2){let o=Math.floor(n/e.value);t+="".concat(o).concat(e.label," "),n%=e.value,r++}return t.trim()||"0s"}function x(e){return e.replace(/\x1b\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGKH]/g,"")}function f(e){let{logs:n,controller:t=!1}=e,[i,s]=(0,o.useState)("all"),[a,c]=(0,o.useState)(n),[d,u]=(0,o.useState)([]);return(0,o.useEffect)(()=>{u(function(e){let n;let t=/\((head|worker\d+),/g,r=new Set;for(;null!==(n=t.exec(e));)r.add(n[1]);return Array.from(r).sort((e,n)=>"head"===e?-1:"head"===n?1:e.localeCompare(n,void 0,{numeric:!0,sensitivity:"base"}))}(n))},[n]),(0,o.useEffect)(()=>{"all"===i?c(n):c(n.split("\n").filter(e=>e.includes("(".concat(i,","))).join("\n"))},[i,n]),(0,r.jsxs)("div",{children:[(0,r.jsx)("style",{children:'\n .logs-container {\n background-color: #f7f7f7;\n padding: 16px;\n max-height: calc(100vh - 300px);\n overflow-y: auto;\n overflow-x: hidden;\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;\n line-height: 1.5;\n border-radius: 6px;\n min-height: fit-content;\n }\n\n .log-line {\n display: block;\n white-space: pre-wrap;\n margin: 2px 0;\n }\n\n .log-line .level {\n display: inline;\n width: 1ch;\n margin-right: 1ch;\n font-weight: bold;\n }\n\n .log-line.INFO .level {\n color: #2563eb;\n }\n\n .log-line.WARNING .level {\n color: #d97706;\n }\n\n .log-line.ERROR .level {\n color: #dc2626;\n }\n\n .log-line.DEBUG .level {\n color: #6b7280;\n }\n\n .log-line .timestamp {\n color: #059669;\n margin-right: 1ch;\n white-space: nowrap;\n }\n\n .log-line .location {\n color: #6366f1;\n margin-right: 1ch;\n white-space: nowrap;\n }\n\n .log-line .message {\n color: #111827;\n word-break: break-word;\n white-space: pre-wrap;\n }\n\n .log-line .log-prefix {\n color: #6366f1;\n font-weight: 500;\n }\n\n .log-line .log-rest {\n color: #111827;\n word-break: break-word;\n white-space: pre-wrap;\n }\n'}),!t&&(0,r.jsx)("div",{style:{marginBottom:"1rem"},children:(0,r.jsxs)(l.Ph,{onValueChange:e=>s(e),value:i,children:[(0,r.jsx)(l.i4,{"aria-label":"Node",className:"focus:ring-0 focus:ring-offset-0",children:(0,r.jsx)(l.ki,{placeholder:"Select Node"})}),(0,r.jsxs)(l.Bw,{children:[(0,r.jsx)(l.Ql,{value:"all",children:"All Nodes"}),d.map(e=>(0,r.jsx)(l.Ql,{value:e,children:e},e))]})]})}),(0,r.jsx)("div",{className:"logs-container",dangerouslySetInnerHTML:{__html:a?x(a).split("\n").filter(e=>""!==e.trim()&&!e.match(/<rich_.*?\[bold cyan\]/)&&!e.match(/<rich_.*>.*<\/rich_.*>/)&&!e.match(/├──/)&&!e.match(/└──/)).map(e=>'<span class="log-line"><span class="message">'.concat(e,"</span></span>")).join("\n"):""}})]})}function g(e){let n,{date:t}=e;if(!t)return"N/A";let o=new Date,i=t.getFullYear()+"-"+String(t.getMonth()+1).padStart(2,"0")+"-"+String(t.getDate()).padStart(2,"0"),l=t.toLocaleString("en-US",{hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0,timeZoneName:"short"});return n=function(e){if(!e||"string"!=typeof e)return e;if("just now"===e)return"now";if("less than a minute ago"===e.toLowerCase())return"Less than 1m ago";let n=e.match(/^about\s+(\d+)\s+(\w+)\s+ago$/i);if(n){let e=n[1],t=n[2],r={second:"s",seconds:"s",minute:"m",minutes:"m",hour:"h",hours:"h",day:"d",days:"d",month:"mo",months:"mo",year:"yr",years:"yr"};if(r[t])return"".concat(e).concat(r[t]," ago")}let t=e.match(/^a[n]?\s+(\w+)\s+ago$/i);if(t){let e=t[1],n={second:"s",minute:"m",hour:"h",day:"d",month:"mo",year:"yr"};if(n[e])return"1".concat(n[e]," ago")}let r=e.match(/^(\d+)\s+(\w+)\s+ago$/i);if(r){let e=r[1],n=r[2],t={second:"s",seconds:"s",minute:"m",minutes:"m",hour:"h",hours:"h",day:"d",days:"d",month:"mo",months:"mo",year:"yr",years:"yr"};if(t[n])return"".concat(e).concat(t[n]," ago")}return e}((0,s.B)(t,o,{addSuffix:!0})),(0,r.jsx)(d,{content:i+" "+l,className:"text-sm text-muted-foreground",children:(0,r.jsx)("span",{className:"border-b border-dotted border-gray-400 cursor-help",children:n})})}function m(e){return e?e.getFullYear()+"-"+String(e.getMonth()+1).padStart(2,"0")+"-"+String(e.getDate()).padStart(2,"0")+" "+e.toLocaleString("en-US",{hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!0,timeZoneName:"short"}):"N/A"}},23001:function(e,n,t){t.d(n,{X:function(){return o}});var r=t(67294);function o(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[n,t]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let n=()=>{t(window.innerWidth<e)};return n(),window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)}},[e]),n}},51214:function(e,n,t){t.d(n,{MO:function(){return i},ej:function(){return r},nb:function(){return o}});let r={DEFAULT_TTL:12e4},o={REFRESH_INTERVAL:3e4,GPU_REFRESH_INTERVAL:3e4},i={NAME_TRUNCATE_LENGTH:20}}}]);
@@ -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(2622),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}})}}]);