skypilot-nightly 1.0.0.dev20250604__py3-none-any.whl → 1.0.0.dev20250606__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sky/__init__.py +2 -2
- sky/admin_policy.py +5 -0
- sky/catalog/__init__.py +2 -2
- sky/catalog/common.py +7 -9
- sky/cli.py +11 -9
- sky/client/cli.py +11 -9
- sky/client/sdk.py +30 -12
- sky/clouds/kubernetes.py +2 -2
- sky/dashboard/out/404.html +1 -1
- sky/dashboard/out/_next/static/99m-BAySO8Q7J-ul1jZVL/_buildManifest.js +1 -0
- sky/dashboard/out/_next/static/chunks/{236-fef38aa6e5639300.js → 236-a90f0a9753a10420.js} +2 -2
- sky/dashboard/out/_next/static/chunks/614-635a84e87800f99e.js +66 -0
- sky/dashboard/out/_next/static/chunks/{856-f1b1f7f47edde2e8.js → 856-3a32da4b84176f6d.js} +1 -1
- sky/dashboard/out/_next/static/chunks/937.3759f538f11a0953.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-35cbeb5214fd4036.js +6 -0
- sky/dashboard/out/_next/static/chunks/pages/config-1a1eeb949dab8897.js +6 -0
- sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-2d23a9c7571e6320.js +16 -0
- sky/dashboard/out/_next/static/chunks/pages/users-262aab38b9baaf3a.js +16 -0
- sky/dashboard/out/_next/static/chunks/pages/workspaces-384ea5fa0cea8f28.js +1 -0
- sky/dashboard/out/_next/static/chunks/{webpack-f27c9a32aa3d9c6d.js → webpack-65d465f948974c0d.js} +1 -1
- sky/dashboard/out/_next/static/css/667d941a2888ce6e.css +3 -0
- sky/dashboard/out/clusters/[cluster]/[job].html +1 -1
- sky/dashboard/out/clusters/[cluster].html +1 -1
- sky/dashboard/out/clusters.html +1 -1
- sky/dashboard/out/config.html +1 -1
- sky/dashboard/out/index.html +1 -1
- sky/dashboard/out/infra/[context].html +1 -1
- sky/dashboard/out/infra.html +1 -1
- sky/dashboard/out/jobs/[job].html +1 -1
- sky/dashboard/out/jobs.html +1 -1
- sky/dashboard/out/users.html +1 -1
- sky/dashboard/out/workspace/new.html +1 -1
- sky/dashboard/out/workspaces/[name].html +1 -1
- sky/dashboard/out/workspaces.html +1 -1
- sky/execution.py +44 -46
- sky/global_user_state.py +118 -83
- sky/jobs/client/sdk.py +4 -1
- sky/jobs/server/core.py +5 -1
- sky/models.py +1 -0
- sky/resources.py +22 -1
- sky/serve/load_balancer.py +56 -45
- sky/server/constants.py +3 -1
- sky/server/requests/payloads.py +9 -0
- sky/server/server.py +30 -9
- sky/setup_files/MANIFEST.in +1 -0
- sky/setup_files/dependencies.py +2 -0
- sky/skylet/constants.py +10 -4
- sky/skypilot_config.py +4 -2
- sky/templates/websocket_proxy.py +11 -1
- sky/users/__init__.py +0 -0
- sky/users/model.conf +15 -0
- sky/users/permission.py +178 -0
- sky/users/rbac.py +86 -0
- sky/users/server.py +66 -0
- sky/utils/schemas.py +20 -7
- sky/workspaces/core.py +2 -2
- {skypilot_nightly-1.0.0.dev20250604.dist-info → skypilot_nightly-1.0.0.dev20250606.dist-info}/METADATA +3 -1
- {skypilot_nightly-1.0.0.dev20250604.dist-info → skypilot_nightly-1.0.0.dev20250606.dist-info}/RECORD +70 -66
- sky/catalog/constants.py +0 -8
- sky/dashboard/out/_next/static/chunks/614-3d29f98e0634b179.js +0 -66
- sky/dashboard/out/_next/static/chunks/937.f97f83652028e944.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-62c9982dc3675725.js +0 -6
- sky/dashboard/out/_next/static/chunks/pages/config-35383adcb0edb5e2.js +0 -6
- sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-a62a3c65dc9bc57c.js +0 -11
- sky/dashboard/out/_next/static/chunks/pages/users-07b523ccb19317ad.js +0 -6
- sky/dashboard/out/_next/static/chunks/pages/workspaces-f54921ec9eb20965.js +0 -1
- sky/dashboard/out/_next/static/css/63d3995d8b528eb1.css +0 -3
- sky/dashboard/out/_next/static/vWwfD3jOky5J5jULHp8JT/_buildManifest.js +0 -1
- /sky/dashboard/out/_next/static/{vWwfD3jOky5J5jULHp8JT → 99m-BAySO8Q7J-ul1jZVL}/_ssgManifest.js +0 -0
- /sky/dashboard/out/_next/static/chunks/{121-8f55ee3fa6301784.js → 121-865d2bf8a3b84c6a.js} +0 -0
- /sky/dashboard/out/_next/static/chunks/{37-947904ccc5687bac.js → 37-beedd583fea84cc8.js} +0 -0
- /sky/dashboard/out/_next/static/chunks/{682-2be9b0f169727f2f.js → 682-6647f0417d5662f0.js} +0 -0
- /sky/dashboard/out/_next/static/chunks/{843-a097338acb89b7d7.js → 843-c296541442d4af88.js} +0 -0
- /sky/dashboard/out/_next/static/chunks/{969-d7b6fb7f602bfcb3.js → 969-c7abda31c10440ac.js} +0 -0
- /sky/dashboard/out/_next/static/chunks/pages/{_app-67925f5e6382e22f.js → _app-cb81dc4d27f4d009.js} +0 -0
- /sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/{[job]-158b70da336d8607.js → [job]-65d04d5d77cbb6b6.js} +0 -0
- {skypilot_nightly-1.0.0.dev20250604.dist-info → skypilot_nightly-1.0.0.dev20250606.dist-info}/WHEEL +0 -0
- {skypilot_nightly-1.0.0.dev20250604.dist-info → skypilot_nightly-1.0.0.dev20250606.dist-info}/entry_points.txt +0 -0
- {skypilot_nightly-1.0.0.dev20250604.dist-info → skypilot_nightly-1.0.0.dev20250606.dist-info}/licenses/LICENSE +0 -0
- {skypilot_nightly-1.0.0.dev20250604.dist-info → skypilot_nightly-1.0.0.dev20250606.dist-info}/top_level.txt +0 -0
sky/__init__.py
CHANGED
@@ -5,7 +5,7 @@ from typing import Optional
|
|
5
5
|
import urllib.request
|
6
6
|
|
7
7
|
# Replaced with the current commit when building the wheels.
|
8
|
-
_SKYPILOT_COMMIT_SHA = '
|
8
|
+
_SKYPILOT_COMMIT_SHA = 'ce6c6d0637b94a0e13823d0a96cefad39dd7de41'
|
9
9
|
|
10
10
|
|
11
11
|
def _get_git_commit():
|
@@ -35,7 +35,7 @@ def _get_git_commit():
|
|
35
35
|
|
36
36
|
|
37
37
|
__commit__ = _get_git_commit()
|
38
|
-
__version__ = '1.0.0.
|
38
|
+
__version__ = '1.0.0.dev20250606'
|
39
39
|
__root_dir__ = os.path.dirname(os.path.abspath(__file__))
|
40
40
|
|
41
41
|
|
sky/admin_policy.py
CHANGED
@@ -21,6 +21,11 @@ class RequestOptions:
|
|
21
21
|
dryrun: Is the request a dryrun?
|
22
22
|
"""
|
23
23
|
cluster_name: Optional[str]
|
24
|
+
# Keep these two fields for backward compatibility. The values are copied
|
25
|
+
# from task.resources.autostop_config, so that legacy admin policy plugins
|
26
|
+
# can still read the correct autostop config from request options before
|
27
|
+
# we drop the compatibility.
|
28
|
+
# TODO(aylei): remove these fields after 0.12.0
|
24
29
|
idle_minutes_to_autostop: Optional[int]
|
25
30
|
down: bool
|
26
31
|
dryrun: bool
|
sky/catalog/__init__.py
CHANGED
@@ -4,8 +4,8 @@ import importlib
|
|
4
4
|
import typing
|
5
5
|
from typing import Dict, List, Optional, Set, Tuple, Union
|
6
6
|
|
7
|
-
from sky.catalog import constants as service_catalog_constants
|
8
7
|
from sky.catalog.config import fallback_to_default_catalog
|
8
|
+
from sky.skylet import constants
|
9
9
|
from sky.utils import resources_utils
|
10
10
|
from sky.utils import subprocess_utils
|
11
11
|
|
@@ -18,7 +18,7 @@ CloudFilter = Optional[Union[List[str], str]]
|
|
18
18
|
|
19
19
|
def _map_clouds_catalog(clouds: CloudFilter, method_name: str, *args, **kwargs):
|
20
20
|
if clouds is None:
|
21
|
-
clouds = list(
|
21
|
+
clouds = list(constants.ALL_CLOUDS)
|
22
22
|
|
23
23
|
# TODO(hemil): Remove this once the common service catalog
|
24
24
|
# functions are refactored from clouds/kubernetes.py to
|
sky/catalog/common.py
CHANGED
@@ -11,8 +11,8 @@ import filelock
|
|
11
11
|
|
12
12
|
from sky import sky_logging
|
13
13
|
from sky.adaptors import common as adaptors_common
|
14
|
-
from sky.catalog import constants as service_catalog_constants
|
15
14
|
from sky.clouds import cloud as cloud_lib
|
15
|
+
from sky.skylet import constants
|
16
16
|
from sky.utils import common_utils
|
17
17
|
from sky.utils import registry
|
18
18
|
from sky.utils import rich_utils
|
@@ -28,8 +28,7 @@ else:
|
|
28
28
|
logger = sky_logging.init_logger(__name__)
|
29
29
|
|
30
30
|
_ABSOLUTE_VERSIONED_CATALOG_DIR = os.path.join(
|
31
|
-
os.path.expanduser(
|
32
|
-
service_catalog_constants.CATALOG_SCHEMA_VERSION)
|
31
|
+
os.path.expanduser(constants.CATALOG_DIR), constants.CATALOG_SCHEMA_VERSION)
|
33
32
|
os.makedirs(_ABSOLUTE_VERSIONED_CATALOG_DIR, exist_ok=True)
|
34
33
|
|
35
34
|
|
@@ -96,7 +95,7 @@ def get_modified_catalog_file_mounts() -> Dict[str, str]:
|
|
96
95
|
def _get_modified_catalogs() -> List[str]:
|
97
96
|
"""Returns a list of modified catalogs relative to the catalog dir."""
|
98
97
|
modified_catalogs = []
|
99
|
-
for cloud_name in
|
98
|
+
for cloud_name in constants.ALL_CLOUDS:
|
100
99
|
cloud_catalog_dir = os.path.join(_ABSOLUTE_VERSIONED_CATALOG_DIR,
|
101
100
|
cloud_name)
|
102
101
|
if not os.path.exists(cloud_catalog_dir):
|
@@ -114,9 +113,8 @@ def get_modified_catalog_file_mounts() -> Dict[str, str]:
|
|
114
113
|
modified_catalog_path_map = {} # Map of remote: local catalog paths
|
115
114
|
for catalog in modified_catalog_list:
|
116
115
|
# Use relative paths for remote to handle varying usernames on the cloud
|
117
|
-
remote_path = os.path.join(
|
118
|
-
|
119
|
-
service_catalog_constants.CATALOG_SCHEMA_VERSION, catalog)
|
116
|
+
remote_path = os.path.join(constants.CATALOG_DIR,
|
117
|
+
constants.CATALOG_SCHEMA_VERSION, catalog)
|
120
118
|
local_path = os.path.expanduser(remote_path)
|
121
119
|
modified_catalog_path_map[remote_path] = local_path
|
122
120
|
return modified_catalog_path_map
|
@@ -198,8 +196,8 @@ def read_catalog(filename: str,
|
|
198
196
|
# Atomic check, to avoid conflicts with other processes.
|
199
197
|
with filelock.FileLock(meta_path + '.lock'):
|
200
198
|
if _need_update():
|
201
|
-
url = f'{
|
202
|
-
url_fallback = f'{
|
199
|
+
url = f'{constants.HOSTED_CATALOG_DIR_URL}/{constants.CATALOG_SCHEMA_VERSION}/{filename}' # pylint: disable=line-too-long
|
200
|
+
url_fallback = f'{constants.HOSTED_CATALOG_DIR_URL_S3_MIRROR}/{constants.CATALOG_SCHEMA_VERSION}/{filename}' # pylint: disable=line-too-long
|
203
201
|
headers = {'User-Agent': 'SkyPilot/0.7'}
|
204
202
|
update_frequency_str = ''
|
205
203
|
if pull_frequency_hours is not None:
|
sky/cli.py
CHANGED
@@ -26,6 +26,7 @@ each other.
|
|
26
26
|
import collections
|
27
27
|
import copy
|
28
28
|
import datetime
|
29
|
+
import fnmatch
|
29
30
|
import functools
|
30
31
|
import getpass
|
31
32
|
import os
|
@@ -61,7 +62,6 @@ from sky import skypilot_config
|
|
61
62
|
from sky.adaptors import common as adaptors_common
|
62
63
|
from sky.benchmark import benchmark_state
|
63
64
|
from sky.benchmark import benchmark_utils
|
64
|
-
from sky.catalog import constants as service_catalog_constants
|
65
65
|
from sky.client import sdk
|
66
66
|
from sky.data import storage_utils
|
67
67
|
from sky.provision.kubernetes import constants as kubernetes_constants
|
@@ -209,14 +209,14 @@ def _get_cluster_records_and_set_ssh_config(
|
|
209
209
|
return cluster_records
|
210
210
|
|
211
211
|
|
212
|
-
def
|
213
|
-
|
212
|
+
def _get_glob_matches(candidate_names: List[str],
|
213
|
+
glob_patterns: List[str]) -> List[str]:
|
214
|
+
"""Returns a list of names that match the glob pattern."""
|
214
215
|
glob_storages = []
|
215
|
-
for
|
216
|
-
|
217
|
-
glob_storage = global_user_state.get_glob_storage_name(storage_object)
|
216
|
+
for glob_pattern in glob_patterns:
|
217
|
+
glob_storage = fnmatch.filter(candidate_names, glob_pattern)
|
218
218
|
if not glob_storage:
|
219
|
-
click.echo(f'Storage {
|
219
|
+
click.echo(f'Storage {glob_pattern} not found.')
|
220
220
|
glob_storages.extend(glob_storage)
|
221
221
|
return list(set(glob_storages))
|
222
222
|
|
@@ -3836,7 +3836,7 @@ def show_gpus(
|
|
3836
3836
|
clouds_to_list: Union[Optional[str], List[str]] = cloud_name
|
3837
3837
|
if cloud_name is None:
|
3838
3838
|
clouds_to_list = [
|
3839
|
-
c for c in
|
3839
|
+
c for c in constants.ALL_CLOUDS
|
3840
3840
|
if c != 'kubernetes' and c != 'ssh'
|
3841
3841
|
]
|
3842
3842
|
|
@@ -4135,7 +4135,9 @@ def storage_delete(names: List[str], all: bool, yes: bool, async_call: bool): #
|
|
4135
4135
|
return
|
4136
4136
|
names = [storage['name'] for storage in storages]
|
4137
4137
|
else:
|
4138
|
-
|
4138
|
+
storages = sdk.get(sdk.storage_ls())
|
4139
|
+
existing_storage_names = [storage['name'] for storage in storages]
|
4140
|
+
names = _get_glob_matches(existing_storage_names, names)
|
4139
4141
|
if names:
|
4140
4142
|
if not yes:
|
4141
4143
|
storage_names = ', '.join(names)
|
sky/client/cli.py
CHANGED
@@ -26,6 +26,7 @@ each other.
|
|
26
26
|
import collections
|
27
27
|
import copy
|
28
28
|
import datetime
|
29
|
+
import fnmatch
|
29
30
|
import functools
|
30
31
|
import getpass
|
31
32
|
import os
|
@@ -61,7 +62,6 @@ from sky import skypilot_config
|
|
61
62
|
from sky.adaptors import common as adaptors_common
|
62
63
|
from sky.benchmark import benchmark_state
|
63
64
|
from sky.benchmark import benchmark_utils
|
64
|
-
from sky.catalog import constants as service_catalog_constants
|
65
65
|
from sky.client import sdk
|
66
66
|
from sky.data import storage_utils
|
67
67
|
from sky.provision.kubernetes import constants as kubernetes_constants
|
@@ -209,14 +209,14 @@ def _get_cluster_records_and_set_ssh_config(
|
|
209
209
|
return cluster_records
|
210
210
|
|
211
211
|
|
212
|
-
def
|
213
|
-
|
212
|
+
def _get_glob_matches(candidate_names: List[str],
|
213
|
+
glob_patterns: List[str]) -> List[str]:
|
214
|
+
"""Returns a list of names that match the glob pattern."""
|
214
215
|
glob_storages = []
|
215
|
-
for
|
216
|
-
|
217
|
-
glob_storage = global_user_state.get_glob_storage_name(storage_object)
|
216
|
+
for glob_pattern in glob_patterns:
|
217
|
+
glob_storage = fnmatch.filter(candidate_names, glob_pattern)
|
218
218
|
if not glob_storage:
|
219
|
-
click.echo(f'Storage {
|
219
|
+
click.echo(f'Storage {glob_pattern} not found.')
|
220
220
|
glob_storages.extend(glob_storage)
|
221
221
|
return list(set(glob_storages))
|
222
222
|
|
@@ -3836,7 +3836,7 @@ def show_gpus(
|
|
3836
3836
|
clouds_to_list: Union[Optional[str], List[str]] = cloud_name
|
3837
3837
|
if cloud_name is None:
|
3838
3838
|
clouds_to_list = [
|
3839
|
-
c for c in
|
3839
|
+
c for c in constants.ALL_CLOUDS
|
3840
3840
|
if c != 'kubernetes' and c != 'ssh'
|
3841
3841
|
]
|
3842
3842
|
|
@@ -4135,7 +4135,9 @@ def storage_delete(names: List[str], all: bool, yes: bool, async_call: bool): #
|
|
4135
4135
|
return
|
4136
4136
|
names = [storage['name'] for storage in storages]
|
4137
4137
|
else:
|
4138
|
-
|
4138
|
+
storages = sdk.get(sdk.storage_ls())
|
4139
|
+
existing_storage_names = [storage['name'] for storage in storages]
|
4140
|
+
names = _get_glob_matches(existing_storage_names, names)
|
4139
4141
|
if names:
|
4140
4142
|
if not yes:
|
4141
4143
|
storage_names = ', '.join(names)
|
sky/client/sdk.py
CHANGED
@@ -400,18 +400,22 @@ def launch(
|
|
400
400
|
retry_until_up: whether to retry launching the cluster until it is
|
401
401
|
up.
|
402
402
|
idle_minutes_to_autostop: automatically stop the cluster after this
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
403
|
+
many minute of idleness, i.e., no running or pending jobs in the
|
404
|
+
cluster's job queue. Idleness gets reset whenever setting-up/
|
405
|
+
running/pending jobs are found in the job queue. Setting this
|
406
|
+
flag is equivalent to running
|
407
|
+
``sky.launch(...)`` and then
|
408
|
+
``sky.autostop(idle_minutes=<minutes>)``. If set, the autostop
|
409
|
+
config specified in the task' resources will be overridden by
|
410
|
+
this parameter.
|
409
411
|
dryrun: if True, do not actually launch the cluster.
|
410
412
|
down: Tear down the cluster after all jobs finish (successfully or
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
413
|
+
abnormally). If --idle-minutes-to-autostop is also set, the
|
414
|
+
cluster will be torn down after the specified idle time.
|
415
|
+
Note that if errors occur during provisioning/data syncing/setting
|
416
|
+
up, the cluster will not be torn down for debugging purposes. If
|
417
|
+
set, the autostop config specified in the task' resources will be
|
418
|
+
overridden by this parameter.
|
415
419
|
backend: backend to use. If None, use the default backend
|
416
420
|
(CloudVMRayBackend).
|
417
421
|
optimize_target: target to optimize for. Choices: OptimizeTarget.COST,
|
@@ -468,12 +472,28 @@ def launch(
|
|
468
472
|
'Please contact the SkyPilot team if you '
|
469
473
|
'need this feature at slack.skypilot.co.')
|
470
474
|
dag = dag_utils.convert_entrypoint_to_dag(task)
|
475
|
+
# Override the autostop config from command line flags to task YAML.
|
476
|
+
for task in dag.tasks:
|
477
|
+
for resource in task.resources:
|
478
|
+
resource.override_autostop_config(
|
479
|
+
down=down, idle_minutes=idle_minutes_to_autostop)
|
480
|
+
if resource.autostop_config is not None:
|
481
|
+
# For backward-compatbility, get the final autostop config for
|
482
|
+
# admin policy.
|
483
|
+
# TODO(aylei): remove this after 0.12.0
|
484
|
+
down = resource.autostop_config.down
|
485
|
+
idle_minutes_to_autostop = resource.autostop_config.idle_minutes
|
486
|
+
|
471
487
|
request_options = admin_policy.RequestOptions(
|
472
488
|
cluster_name=cluster_name,
|
473
489
|
idle_minutes_to_autostop=idle_minutes_to_autostop,
|
474
490
|
down=down,
|
475
491
|
dryrun=dryrun)
|
476
492
|
validate(dag, admin_policy_request_options=request_options)
|
493
|
+
# The flags have been applied to the task YAML and the backward
|
494
|
+
# compatibility of admin policy has been handled. We should no longer use
|
495
|
+
# these flags.
|
496
|
+
del down, idle_minutes_to_autostop
|
477
497
|
|
478
498
|
confirm_shown = False
|
479
499
|
if _need_confirmation:
|
@@ -537,9 +557,7 @@ def launch(
|
|
537
557
|
task=dag_str,
|
538
558
|
cluster_name=cluster_name,
|
539
559
|
retry_until_up=retry_until_up,
|
540
|
-
idle_minutes_to_autostop=idle_minutes_to_autostop,
|
541
560
|
dryrun=dryrun,
|
542
|
-
down=down,
|
543
561
|
backend=backend.NAME if backend else None,
|
544
562
|
optimize_target=optimize_target,
|
545
563
|
no_setup=no_setup,
|
sky/clouds/kubernetes.py
CHANGED
@@ -188,8 +188,8 @@ class Kubernetes(clouds.Cloud):
|
|
188
188
|
# Try kubeconfig if present
|
189
189
|
current_context = (
|
190
190
|
kubernetes_utils.get_current_kube_config_context_name())
|
191
|
-
if (current_context is None
|
192
|
-
kubernetes_utils.is_incluster_config_available()):
|
191
|
+
if ((current_context is None or current_context.startswith('ssh-'))
|
192
|
+
and kubernetes_utils.is_incluster_config_available()):
|
193
193
|
# If no kubeconfig contexts found, use in-cluster if available
|
194
194
|
current_context = kubernetes.in_cluster_context_name()
|
195
195
|
allowed_contexts = []
|
sky/dashboard/out/404.html
CHANGED
@@ -1 +1 @@
|
|
1
|
-
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><title>404: This page could not be found</title><meta name="next-head-count" content="3"/><link rel="preload" href="/dashboard/_next/static/css/
|
1
|
+
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><title>404: This page could not be found</title><meta name="next-head-count" content="3"/><link rel="preload" href="/dashboard/_next/static/css/667d941a2888ce6e.css" as="style"/><link rel="stylesheet" href="/dashboard/_next/static/css/667d941a2888ce6e.css" data-n-g=""/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/dashboard/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/dashboard/_next/static/chunks/webpack-65d465f948974c0d.js" defer=""></script><script src="/dashboard/_next/static/chunks/framework-87d061ee6ed71b28.js" defer=""></script><script src="/dashboard/_next/static/chunks/main-e0e2335212e72357.js" defer=""></script><script src="/dashboard/_next/static/chunks/pages/_app-cb81dc4d27f4d009.js" defer=""></script><script src="/dashboard/_next/static/chunks/pages/_error-1be831200e60c5c0.js" defer=""></script><script src="/dashboard/_next/static/99m-BAySO8Q7J-ul1jZVL/_buildManifest.js" defer=""></script><script src="/dashboard/_next/static/99m-BAySO8Q7J-ul1jZVL/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">This page could not be found<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"99m-BAySO8Q7J-ul1jZVL","assetPrefix":"/dashboard","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
|
@@ -0,0 +1 @@
|
|
1
|
+
self.__BUILD_MANIFEST=function(s,c,a,e,t,r,n,u,i,b,j,k){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":["static/chunks/pages/index-6b0d9e5031b70c58.js"],"/_error":["static/chunks/pages/_error-1be831200e60c5c0.js"],"/clusters":[s,r,n,c,a,e,t,u,b,"static/chunks/pages/clusters-5549a350f97d7ef3.js"],"/clusters/[cluster]":[s,r,n,c,a,e,t,u,i,b,"static/chunks/pages/clusters/[cluster]-35cbeb5214fd4036.js"],"/clusters/[cluster]/[job]":[s,c,"static/chunks/pages/clusters/[cluster]/[job]-65d04d5d77cbb6b6.js"],"/config":[s,r,c,a,"static/chunks/pages/config-1a1eeb949dab8897.js"],"/infra":[s,c,a,e,t,j,"static/chunks/pages/infra-13b117a831702196.js"],"/infra/[context]":[s,c,a,e,t,j,"static/chunks/pages/infra/[context]-b68ddeed712d45b5.js"],"/jobs":[s,n,c,a,e,t,u,i,"static/chunks/pages/jobs-a76b2700eca236f7.js"],"/jobs/[job]":[s,r,c,e,"static/chunks/pages/jobs/[job]-2d23a9c7571e6320.js"],"/users":[s,c,a,e,t,"static/chunks/pages/users-262aab38b9baaf3a.js"],"/workspace/new":[s,r,n,c,a,e,t,u,i,k,"static/chunks/pages/workspace/new-c7516f2b4c3727c0.js"],"/workspaces":[s,r,n,c,a,e,t,u,i,"static/chunks/pages/workspaces-384ea5fa0cea8f28.js"],"/workspaces/[name]":[s,r,n,c,a,e,t,u,i,k,"static/chunks/pages/workspaces/[name]-7799de9e691e35d8.js"],sortedPages:["/","/_app","/_error","/clusters","/clusters/[cluster]","/clusters/[cluster]/[job]","/config","/infra","/infra/[context]","/jobs","/jobs/[job]","/users","/workspace/new","/workspaces","/workspaces/[name]"]}}("static/chunks/614-635a84e87800f99e.js","static/chunks/470-9e7a479cc8303baa.js","static/chunks/293-351268365226d251.js","static/chunks/969-c7abda31c10440ac.js","static/chunks/856-3a32da4b84176f6d.js","static/chunks/798-c0525dc3f21e488d.js","static/chunks/121-865d2bf8a3b84c6a.js","static/chunks/973-1a09cac61cfcc1e1.js","static/chunks/236-a90f0a9753a10420.js","static/chunks/37-beedd583fea84cc8.js","static/chunks/682-6647f0417d5662f0.js","static/chunks/843-c296541442d4af88.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|
@@ -1,6 +1,6 @@
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[236],{8236:function(e,s,t){t.d(s,{L4:function(){return A},Nk:function(){return I},x2:function(){return R}});var n=t(5893),r=t(7294),a=t(1163),l=t(1664),i=t.n(l),c=t(8799),o=t(803),d=t(7673),h=t(8764),x=t(6989),u=t(8969),m=t(3266),
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[236],{8236:function(e,s,t){t.d(s,{L4:function(){return A},Nk:function(){return I},x2:function(){return R}});var n=t(5893),r=t(7294),a=t(1163),l=t(1664),i=t.n(l),c=t(8799),o=t(803),d=t(7673),h=t(8764),x=t(6989),u=t(8969),m=t(3266),j=t(7324),p=t(9470),f=t(3626),g=t(998);/**
|
2
2
|
* @license lucide-react v0.407.0 - ISC
|
3
3
|
*
|
4
4
|
* This source code is licensed under the ISC license.
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
6
|
-
*/let w=(0,g.Z)("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]),b=(0,g.Z)("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]),N=(0,g.Z)("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);var y=t(9284),v=t(4545),k=t(9307),C=t(3001),S=t(8950),E=t(6378),L=t(6856);let R={active:["PENDING","RUNNING","RECOVERING","SUBMITTED","STARTING","CANCELLING"],finished:["SUCCEEDED","FAILED","CANCELLED","FAILED_SETUP","FAILED_PRECHECKS","FAILED_NO_RESOURCE","FAILED_CONTROLLER"]},M="__ALL_WORKSPACES__",_=e=>{if(!e)return"-";let s=(0,x.GV)(e);if(r.isValidElement(s)&&s.props&&s.props.children&&(s=r.isValidElement(s.props.children)&&s.props.children.props&&s.props.children.props.children?s.props.children.props.children:s.props.children),"string"!=typeof s)return s;if("just now"===s)return"now";let t=s.match(/^About\s+(\d+)\s+(\w+)\s+ago$/);if(t){let e=t[1],s=t[2],n={second:"sec",seconds:"secs",minute:"min",minutes:"mins",hour:"hr",hours:"hrs",day:"d",days:"d",month:"mo",months:"mos",year:"yr",years:"yrs"};if(n[s])return"~ ".concat(e," ").concat(n[s]," ago")}let n=s.match(/^a[n]?\s+(\w+)\s+ago$/);if(n){let e=n[1],s={second:"sec",minute:"min",hour:"hr",day:"d",month:"mo",year:"yr"};if(s[e])return"1 ".concat(s[e]," ago")}let a=s.match(/^(\d+)\s+(\w+)\s+ago$/);if(a){let e=a[1],s=a[2],t={seconds:"secs",minutes:"mins",hours:"hrs",days:"d",months:"mo",years:"yr"};if(t[s])return"".concat(e," ").concat(t[s]," ago")}return s};function I(){let e=(0,a.useRouter)(),[s,t]=(0,r.useState)(!1),l=r.useRef(null),[o,d]=(0,r.useState)({isOpen:!1,title:"",message:"",onConfirm:null}),h=(0,C.X)(),[m,g]=(0,r.useState)(M),[w,b]=(0,r.useState)([]);return(0,r.useEffect)(()=>{e.isReady&&e.query.workspace&&g(Array.isArray(e.query.workspace)?e.query.workspace[0]:e.query.workspace)},[e.isReady,e.query.workspace]),(0,r.useEffect)(()=>{(async()=>{try{await L.ZP.preloadForPage("jobs");let e=await E.default.get(p.fX),s=Object.keys(e),t=(await E.default.get(u.getManagedJobs,[{allUsers:!0}])).jobs||[],n=[...new Set(t.map(e=>e.workspace||"default").filter(e=>e))],r=new Set(s);n.forEach(e=>r.add(e)),b(Array.from(r).sort())}catch(e){console.error("Error fetching data for workspace filter:",e),b(["default"])}})()},[]),(0,n.jsxs)(j.A,{highlighted:"jobs",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,n.jsxs)("div",{className:"text-base flex items-center",children:[(0,n.jsx)(i(),{href:"/jobs",className:"text-sky-blue hover:underline leading-none",children:"Managed Jobs"}),(0,n.jsxs)(S.Ph,{value:m,onValueChange:g,children:[(0,n.jsx)(S.i4,{className:"h-8 w-48 ml-4 mr-2 text-sm border-none focus:ring-0 focus:outline-none",children:(0,n.jsx)(S.ki,{placeholder:"Filter by workspace...",children:m===M?"All Workspaces":m})}),(0,n.jsxs)(S.Bw,{children:[(0,n.jsx)(S.Ql,{value:M,children:"All Workspaces"}),w.map(e=>(0,n.jsx)(S.Ql,{value:e,children:e},e))]})]})]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[s&&(0,n.jsxs)("div",{className:"flex items-center mr-2",children:[(0,n.jsx)(c.Z,{size:15,className:"mt-0"}),(0,n.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Loading..."})]}),(0,n.jsxs)("button",{onClick:()=>{E.default.invalidate(u.getManagedJobs,[{allUsers:!0}]),E.default.invalidate(p.fX),l.current&&l.current()},disabled:s,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",title:"Refresh",children:[(0,n.jsx)(f.Z,{className:"h-4 w-4 mr-1.5"}),!h&&(0,n.jsx)("span",{children:"Refresh"})]})]})]}),(0,n.jsx)(O,{refreshInterval:x.yc,setLoading:t,refreshDataRef:l,workspaceFilter:m}),(0,n.jsx)(y.cV,{isOpen:o.isOpen,onClose:()=>d({...o,isOpen:!1}),onConfirm:o.onConfirm,title:o.title,message:o.message})]})}function O(e){let{refreshInterval:s,setLoading:t,refreshDataRef:a,workspaceFilter:l}=e,[p,j]=(0,r.useState)([]),[f,g]=(0,r.useState)({key:null,direction:"ascending"}),[b,N]=(0,r.useState)(!1),[C,S]=(0,r.useState)(!0),[L,I]=(0,r.useState)(1),[O,A]=(0,r.useState)(10),[F,U]=(0,r.useState)(null),W=(0,r.useRef)(null),[Z,q]=(0,r.useState)([]),[T,V]=(0,r.useState)({}),[J,B]=(0,r.useState)(!1),[G,H]=(0,r.useState)(!1),[X,$]=(0,r.useState)(!1),[K,Q]=(0,r.useState)("active"),[Y,ee]=(0,r.useState)(!0),[es,et]=(0,r.useState)({isOpen:!1,title:"",message:"",onConfirm:null}),en=async()=>{et({isOpen:!0,title:"Restart Controller",message:"Are you sure you want to restart the controller? This will temporarily interrupt job management.",onConfirm:async()=>{try{$(!0),N(!0),await (0,u.Ce)("restartcontroller"),await er()}catch(e){console.error("Error restarting controller:",e)}finally{$(!1),N(!1)}}})},er=r.useCallback(async()=>{N(!0),t(!0);try{let[e,s]=await Promise.all([E.default.get(u.getManagedJobs,[{allUsers:!0}]),E.default.get(m.getClusters)]),{jobs:t=[],controllerStopped:n=!1}=e||{},r=null==s?void 0:s.find(e=>(0,v.Ym)(e.cluster)),a=r?r.status:"NOT_FOUND",l=!1;"STOPPED"==a&&n&&(l=!0),"LAUNCHING"==a?H(!0):H(!1),j(t),B(l),S(!1)}catch(e){console.error("Error fetching data:",e),j([]),B(!1),S(!1)}finally{N(!1),t(!1)}},[t]);r.useEffect(()=>{a&&(a.current=er)},[a,er]),(0,r.useEffect)(()=>{j([]);let e=!0;er();let t=setInterval(()=>{e&&er()},s);return()=>{e=!1,clearInterval(t)}},[s,er]),(0,r.useEffect)(()=>{I(1)},[K,null==p?void 0:p.length]),(0,r.useEffect)(()=>{q([]),ee(!0)},[K]);let ea=e=>{let s="ascending";f.key===e&&"ascending"===f.direction&&(s="descending"),g({key:e,direction:s})},el=e=>f.key===e?"ascending"===f.direction?" ↑":" ↓":"";r.useMemo(()=>{let e=p||[];return{active:e.filter(e=>R.active.includes(e.status)).length,finished:e.filter(e=>R.finished.includes(e.status)).length}},[p]);let ei=e=>Z.length>0?Z.includes(e):R[K].includes(e),ec=r.useMemo(()=>{let e=l&&l!==M?p.filter(e=>(e.workspace||"default").toLowerCase()===l.toLowerCase()):p;return Z.length>0?e.filter(e=>Z.includes(e.status)):Y?e.filter(e=>R[K].includes(e.status)):[]},[p,K,Z,Y,l]),eo=r.useMemo(()=>f.key?[...ec].sort((e,s)=>e[f.key]<s[f.key]?"ascending"===f.direction?-1:1:e[f.key]>s[f.key]?"ascending"===f.direction?1:-1:0):ec,[ec,f]),ed=Math.ceil(eo.length/O),eh=(L-1)*O,ex=eh+O,eu=eo.slice(eh,ex),em=e=>{if(Z.includes(e)){let s=Z.filter(s=>s!==e);0===s.length?(ee(!0),q([])):(q(s),ee(!1))}else q([...Z,e]),ee(!1)};return(0,r.useEffect)(()=>{V((p||[]).reduce((e,s)=>(e[s.status]=(e[s.status]||0)+1,e),{}))},[p]),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("div",{className:"flex flex-col space-y-1 mb-1",children:(0,n.jsxs)("div",{className:"flex flex-wrap items-center text-sm mb-1",children:[(0,n.jsx)("span",{className:"mr-2 text-sm font-medium",children:"Statuses:"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 items-center",children:[!b&&(!p||0===p.length)&&!C&&(0,n.jsx)("span",{className:"text-gray-500 mr-2",children:"No jobs found"}),Object.entries(T).map(e=>{let[s,t]=e;return(0,n.jsxs)("button",{onClick:()=>em(s),className:"px-3 py-1 rounded-full flex items-center space-x-2 ".concat(ei(s)||Z.includes(s)?(0,k.Cl)(s):"bg-gray-50 text-gray-600 hover:bg-gray-100"),children:[(0,n.jsx)("span",{children:s}),(0,n.jsx)("span",{className:"text-xs ".concat(ei(s)||Z.includes(s)?"bg-white/50":"bg-gray-200"," px-1.5 py-0.5 rounded"),children:t})]},s)}),p&&p.length>0&&(0,n.jsxs)("div",{className:"flex items-center ml-2 gap-2",children:[(0,n.jsx)("span",{className:"text-gray-500",children:"("}),(0,n.jsx)("button",{onClick:()=>{Q("active"),q([]),ee(!0)},className:"text-sm font-medium ".concat("active"===K&&Y?"text-green-700 underline":"text-gray-600 hover:text-green-700 hover:underline"),children:"show all active jobs"}),(0,n.jsx)("span",{className:"text-gray-500 mx-1",children:"|"}),(0,n.jsx)("button",{onClick:()=>{Q("finished"),q([]),ee(!0)},className:"text-sm font-medium ".concat("finished"===K&&Y?"text-blue-700 underline":"text-gray-600 hover:text-blue-700 hover:underline"),children:"show all finished jobs"}),(0,n.jsx)("span",{className:"text-gray-500",children:")"})]})]})]})}),(0,n.jsx)(d.Zb,{children:(0,n.jsxs)(h.iA,{children:[(0,n.jsx)(h.xD,{children:(0,n.jsxs)(h.SC,{children:[(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("id"),children:["ID",el("id")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("name"),children:["Name",el("name")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("user"),children:["User",el("user")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("workspace"),children:["Workspace",el("workspace")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("submitted_at"),children:["Submitted",el("submitted_at")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("job_duration"),children:["Duration",el("job_duration")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("status"),children:["Status",el("status")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("priority"),children:["Priority",el("priority")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("resources_str"),children:["Requested",el("resources_str")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("infra"),children:["Infra",el("infra")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("cluster"),children:["Resources",el("cluster")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("recoveries"),children:["Recoveries",el("recoveries")]}),(0,n.jsx)(h.ss,{children:"Details"}),(0,n.jsx)(h.ss,{children:"Logs"})]})}),(0,n.jsx)(h.RM,{children:b||C?(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:13,className:"text-center py-6 text-gray-500",children:(0,n.jsxs)("div",{className:"flex justify-center items-center",children:[(0,n.jsx)(c.Z,{size:20,className:"mr-2"}),(0,n.jsx)("span",{children:"Loading..."})]})})}):eu.length>0?(0,n.jsx)(n.Fragment,{children:eu.map(e=>(0,n.jsxs)(r.Fragment,{children:[(0,n.jsxs)(h.SC,{children:[(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.id})}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.name})}),(0,n.jsx)(h.pj,{children:e.user}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/workspaces",className:"text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,n.jsx)(h.pj,{children:_(e.submitted_at)}),(0,n.jsx)(h.pj,{children:(0,x.LU)(e.job_duration)}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(k.OE,{status:e.status})}),(0,n.jsx)(h.pj,{children:e.priority}),(0,n.jsx)(h.pj,{children:e.requested_resources}),(0,n.jsx)(h.pj,{children:e.infra&&"-"!==e.infra?(0,n.jsx)(x.Md,{content:e.full_infra||e.infra,className:"text-sm text-muted-foreground",children:(0,n.jsxs)("span",{children:[(0,n.jsx)(i(),{href:"/infra",className:"text-blue-600 hover:underline",children:e.cloud||e.infra.split("(")[0].trim()}),e.infra.includes("(")&&(0,n.jsx)("span",{children:" "+e.infra.substring(e.infra.indexOf("("))})]})}):(0,n.jsx)("span",{children:e.infra||"-"})}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(x.Md,{content:e.resources_str_full||e.resources_str,className:"text-sm text-muted-foreground",children:(0,n.jsx)("span",{children:e.resources_str})})}),(0,n.jsx)(h.pj,{children:e.recoveries}),(0,n.jsx)(h.pj,{children:e.details?(0,n.jsx)(P,{text:e.details,rowId:e.id,expandedRowId:F,setExpandedRowId:U}):"-"}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(D,{jobParent:"/jobs",jobId:e.id,managed:!0})})]}),F===e.id&&(0,n.jsx)(z,{text:e.details,colSpan:13,innerRef:W})]},e.id))}):(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:13,className:"text-center py-6",children:(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[G&&(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,n.jsx)("p",{className:"text-gray-700",children:"The managed job controller is launching. Please wait for it to be ready."}),(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(c.Z,{size:12,className:"mr-2"}),(0,n.jsx)("span",{className:"text-gray-500",children:"Launching..."})]})]}),!J&&!G&&(0,n.jsx)("p",{className:"text-gray-500",children:"No active jobs"}),J&&(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,n.jsx)("p",{className:"text-gray-700",children:"The managed job controller has been stopped. Please restart it to check the latest job status."}),(0,n.jsx)(o.z,{variant:"outline",size:"sm",onClick:en,className:"text-sky-blue hover:text-sky-blue-bright",disabled:b||X,children:X?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(c.Z,{size:12,className:"mr-2"}),"Restarting..."]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(w,{className:"h-4 w-4 mr-2"}),"Restart Controller"]})})]})]})})})})]})}),eo&&eo.length>0&&(0,n.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,n.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,n.jsxs)("div",{className:"relative inline-block",children:[(0,n.jsxs)("select",{value:O,onChange:e=>{A(parseInt(e.target.value,10)),I(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,n.jsx)("option",{value:10,children:"10"}),(0,n.jsx)("option",{value:30,children:"30"}),(0,n.jsx)("option",{value:50,children:"50"}),(0,n.jsx)("option",{value:100,children:"100"}),(0,n.jsx)("option",{value:200,children:"200"})]}),(0,n.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,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,n.jsxs)("div",{children:[eh+1," – ",Math.min(ex,eo.length)," of"," ",eo.length]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{I(e=>Math.max(e-1,1))},disabled:1===L,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.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,n.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{I(e=>Math.min(e+1,ed))},disabled:L===ed||0===ed,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.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,n.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})}),(0,n.jsx)(y.cV,{isOpen:es.isOpen,onClose:()=>et({...es,isOpen:!1}),onConfirm:es.onConfirm,title:es.title,message:es.message})]})}function D(e){let{withLabel:s=!1,jobParent:t,jobId:r,managed:l}=e,i=(0,a.useRouter)(),c=(e,s)=>{e.preventDefault(),e.stopPropagation(),i.push({pathname:"".concat(t,"/").concat(r),query:{tab:s}})};return(0,n.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,n.jsx)(x.WH,{content:"View Job Logs",className:"capitalize text-sm text-muted-foreground",children:(0,n.jsxs)("button",{onClick:e=>c(e,"logs"),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",children:[(0,n.jsx)(b,{className:"w-4 h-4"}),s&&(0,n.jsx)("span",{className:"ml-1.5",children:"Logs"})]})},"logs"),l&&(0,n.jsx)(x.WH,{content:"View Controller Logs",className:"capitalize text-sm text-muted-foreground",children:(0,n.jsxs)("button",{onClick:e=>c(e,"controllerlogs"),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",children:[(0,n.jsx)(N,{className:"w-4 h-4"}),s&&(0,n.jsx)("span",{className:"ml-2",children:"Controller Logs"})]})},"controllerlogs")]})}function A(e){let{clusterName:s,clusterJobData:t,loading:a,refreshClusterJobsOnly:l}=e,[u,m]=(0,r.useState)(null),[p,j]=(0,r.useState)({key:null,direction:"ascending"}),[g,w]=(0,r.useState)(1),[b,N]=(0,r.useState)(10),y=(0,r.useRef)(null),[v,C]=(0,r.useState)(null);(0,r.useEffect)(()=>{let e=e=>{u&&y.current&&!y.current.contains(e.target)&&m(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[u]);let S=r.useMemo(()=>t||[],[t]);(0,r.useEffect)(()=>{JSON.stringify(t)!==JSON.stringify(v)&&C(t)},[t,v]);let E=r.useMemo(()=>p.key?[...S].sort((e,s)=>e[p.key]<s[p.key]?"ascending"===p.direction?-1:1:e[p.key]>s[p.key]?"ascending"===p.direction?1:-1:0):S,[S,p]),L=e=>{let s="ascending";p.key===e&&"ascending"===p.direction&&(s="descending"),j({key:e,direction:s})},R=e=>p.key===e?"ascending"===p.direction?" ↑":" ↓":"",M=Math.ceil(E.length/b),I=(g-1)*b,O=I+b,A=E.slice(I,O);return(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsxs)(d.Zb,{children:[(0,n.jsxs)("div",{className:"flex items-center justify-between p-4",children:[(0,n.jsx)("h3",{className:"text-lg font-semibold",children:"Cluster Jobs"}),(0,n.jsx)("div",{className:"flex items-center",children:l&&(0,n.jsxs)("button",{onClick:l,disabled:a,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center text-sm ml-2",children:[(0,n.jsx)(f.Z,{className:"w-4 h-4 mr-1"}),"Refresh Jobs"]})})]}),(0,n.jsxs)(h.iA,{children:[(0,n.jsx)(h.xD,{children:(0,n.jsxs)(h.SC,{children:[(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("id"),children:["ID",R("id")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("job"),children:["Name",R("job")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("user"),children:["User",R("user")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("workspace"),children:["Workspace",R("workspace")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("submitted_at"),children:["Submitted",R("submitted_at")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("job_duration"),children:["Duration",R("job_duration")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("status"),children:["Status",R("status")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("resources"),children:["Resources",R("resources")]}),(0,n.jsx)(h.ss,{className:"whitespace-nowrap",children:"Logs"})]})}),(0,n.jsx)(h.RM,{children:a?(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:9,className:"text-center py-12 text-gray-500",children:(0,n.jsxs)("div",{className:"flex justify-center items-center",children:[(0,n.jsx)(c.Z,{size:24,className:"mr-2"}),(0,n.jsx)("span",{children:"Loading cluster jobs..."})]})})}):A.length>0?A.map(e=>(0,n.jsxs)(r.Fragment,{children:[(0,n.jsxs)(h.SC,{className:u===e.id?"selected-row":"",children:[(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/clusters/".concat(s,"/").concat(e.id),className:"text-blue-600",children:e.id})}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/clusters/".concat(s,"/").concat(e.id),className:"text-blue-600",children:(0,n.jsx)(P,{text:e.job||"Unnamed job",rowId:e.id,expandedRowId:u,setExpandedRowId:m})})}),(0,n.jsx)(h.pj,{children:e.user}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/workspaces",className:"text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,n.jsx)(h.pj,{children:_(e.submitted_at)}),(0,n.jsx)(h.pj,{children:(0,x.LU)(e.job_duration)}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(k.OE,{status:e.status})}),(0,n.jsx)(h.pj,{children:e.resources}),(0,n.jsx)(h.pj,{className:"flex content-center items-center",children:(0,n.jsx)(D,{jobParent:"/clusters/".concat(s),jobId:e.id,managed:!1})})]}),u===e.id&&(0,n.jsx)(z,{text:e.job||"Unnamed job",colSpan:9,innerRef:y})]},e.id)):(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:8,className:"text-center py-6 text-gray-500",children:"No jobs found"})})})]})]}),E&&E.length>0&&(0,n.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,n.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,n.jsxs)("div",{className:"relative inline-block",children:[(0,n.jsxs)("select",{value:b,onChange:e=>{N(parseInt(e.target.value,10)),w(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,n.jsx)("option",{value:5,children:"5"}),(0,n.jsx)("option",{value:10,children:"10"}),(0,n.jsx)("option",{value:20,children:"20"}),(0,n.jsx)("option",{value:50,children:"50"})]}),(0,n.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,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,n.jsxs)("div",{children:[I+1," – ",Math.min(O,E.length)," of"," ",E.length]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{w(e=>Math.max(e-1,1))},disabled:1===g,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.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,n.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{w(e=>Math.min(e+1,M))},disabled:g===M||0===M,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.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,n.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})})]})}function z(e){let{text:s,colSpan:t,innerRef:r}=e;return(0,n.jsx)(h.SC,{className:"expanded-details",children:(0,n.jsx)(h.pj,{colSpan:t,children:(0,n.jsx)("div",{className:"p-4 bg-gray-50 rounded-md border border-gray-200",ref:r,children:(0,n.jsx)("div",{className:"flex justify-between items-start",children:(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-gray-900",children:"Full Details"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-gray-700",style:{whiteSpace:"pre-wrap"},children:s})]})})})})})}function P(e){let{text:s,rowId:t,expandedRowId:a,setExpandedRowId:l}=e,i=s||"",c=i.length>50,o=a===t,d=c?"".concat(i.substring(0,50)):i,h=(0,r.useRef)(null);return(0,n.jsxs)("div",{className:"truncated-details relative max-w-full flex items-center",children:[(0,n.jsx)("span",{className:"truncate",children:d}),c&&(0,n.jsx)("button",{ref:h,type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),l(o?null:t)},className:"text-blue-600 hover:text-blue-800 font-medium ml-1 flex-shrink-0","data-button-type":"show-more-less",children:o?"... show less":"... show more"})]})}}}]);
|
6
|
+
*/let w=(0,g.Z)("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]),b=(0,g.Z)("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]),N=(0,g.Z)("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);var y=t(9284),v=t(4545),k=t(9307),C=t(3001),S=t(8950),E=t(6378),L=t(6856);let R={active:["PENDING","RUNNING","RECOVERING","SUBMITTED","STARTING","CANCELLING"],finished:["SUCCEEDED","FAILED","CANCELLED","FAILED_SETUP","FAILED_PRECHECKS","FAILED_NO_RESOURCE","FAILED_CONTROLLER"]},M="__ALL_WORKSPACES__",_=e=>{if(!e)return"-";let s=(0,x.GV)(e);if(r.isValidElement(s)&&s.props&&s.props.children&&(s=r.isValidElement(s.props.children)&&s.props.children.props&&s.props.children.props.children?s.props.children.props.children:s.props.children),"string"!=typeof s)return s;if("just now"===s)return"now";let t=s.match(/^About\s+(\d+)\s+(\w+)\s+ago$/);if(t){let e=t[1],s=t[2],n={second:"sec",seconds:"secs",minute:"min",minutes:"mins",hour:"hr",hours:"hrs",day:"d",days:"d",month:"mo",months:"mos",year:"yr",years:"yrs"};if(n[s])return"~ ".concat(e," ").concat(n[s]," ago")}let n=s.match(/^a[n]?\s+(\w+)\s+ago$/);if(n){let e=n[1],s={second:"sec",minute:"min",hour:"hr",day:"d",month:"mo",year:"yr"};if(s[e])return"1 ".concat(s[e]," ago")}let a=s.match(/^(\d+)\s+(\w+)\s+ago$/);if(a){let e=a[1],s=a[2],t={seconds:"secs",minutes:"mins",hours:"hrs",days:"d",months:"mo",years:"yr"};if(t[s])return"".concat(e," ").concat(t[s]," ago")}return s};function I(){let e=(0,a.useRouter)(),[s,t]=(0,r.useState)(!1),l=r.useRef(null),[o,d]=(0,r.useState)({isOpen:!1,title:"",message:"",onConfirm:null}),h=(0,C.X)(),[m,g]=(0,r.useState)(M),[w,b]=(0,r.useState)([]);return(0,r.useEffect)(()=>{e.isReady&&e.query.workspace&&g(Array.isArray(e.query.workspace)?e.query.workspace[0]:e.query.workspace)},[e.isReady,e.query.workspace]),(0,r.useEffect)(()=>{(async()=>{try{await L.ZP.preloadForPage("jobs");let e=await E.default.get(j.fX),s=Object.keys(e),t=(await E.default.get(u.getManagedJobs,[{allUsers:!0}])).jobs||[],n=[...new Set(t.map(e=>e.workspace||"default").filter(e=>e))],r=new Set(s);n.forEach(e=>r.add(e)),b(Array.from(r).sort())}catch(e){console.error("Error fetching data for workspace filter:",e),b(["default"])}})()},[]),(0,n.jsxs)(p.A,{highlighted:"jobs",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,n.jsxs)("div",{className:"text-base flex items-center",children:[(0,n.jsx)(i(),{href:"/jobs",className:"text-sky-blue hover:underline leading-none",children:"Managed Jobs"}),(0,n.jsxs)(S.Ph,{value:m,onValueChange:g,children:[(0,n.jsx)(S.i4,{className:"h-8 w-48 ml-4 mr-2 text-sm border-none focus:ring-0 focus:outline-none",children:(0,n.jsx)(S.ki,{placeholder:"Filter by workspace...",children:m===M?"All Workspaces":m})}),(0,n.jsxs)(S.Bw,{children:[(0,n.jsx)(S.Ql,{value:M,children:"All Workspaces"}),w.map(e=>(0,n.jsx)(S.Ql,{value:e,children:e},e))]})]})]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[s&&(0,n.jsxs)("div",{className:"flex items-center mr-2",children:[(0,n.jsx)(c.Z,{size:15,className:"mt-0"}),(0,n.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Loading..."})]}),(0,n.jsxs)("button",{onClick:()=>{E.default.invalidate(u.getManagedJobs,[{allUsers:!0}]),E.default.invalidate(j.fX),l.current&&l.current()},disabled:s,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",title:"Refresh",children:[(0,n.jsx)(f.Z,{className:"h-4 w-4 mr-1.5"}),!h&&(0,n.jsx)("span",{children:"Refresh"})]})]})]}),(0,n.jsx)(O,{refreshInterval:x.yc,setLoading:t,refreshDataRef:l,workspaceFilter:m}),(0,n.jsx)(y.cV,{isOpen:o.isOpen,onClose:()=>d({...o,isOpen:!1}),onConfirm:o.onConfirm,title:o.title,message:o.message})]})}function O(e){let{refreshInterval:s,setLoading:t,refreshDataRef:a,workspaceFilter:l}=e,[j,p]=(0,r.useState)([]),[f,g]=(0,r.useState)({key:null,direction:"ascending"}),[b,N]=(0,r.useState)(!1),[C,S]=(0,r.useState)(!0),[L,I]=(0,r.useState)(1),[O,A]=(0,r.useState)(10),[P,U]=(0,r.useState)(null),W=(0,r.useRef)(null),[Z,q]=(0,r.useState)([]),[T,V]=(0,r.useState)({}),[J,B]=(0,r.useState)(!1),[G,H]=(0,r.useState)(!1),[X,$]=(0,r.useState)(!1),[K,Q]=(0,r.useState)("active"),[Y,ee]=(0,r.useState)(!0),[es,et]=(0,r.useState)({isOpen:!1,title:"",message:"",onConfirm:null}),en=async()=>{et({isOpen:!0,title:"Restart Controller",message:"Are you sure you want to restart the controller?",onConfirm:async()=>{try{$(!0),N(!0),await (0,u.Ce)("restartcontroller"),await er()}catch(e){console.error("Error restarting controller:",e)}finally{$(!1),N(!1)}}})},er=r.useCallback(async()=>{N(!0),t(!0);try{let[e,s]=await Promise.all([E.default.get(u.getManagedJobs,[{allUsers:!0}]),E.default.get(m.getClusters)]),{jobs:t=[],controllerStopped:n=!1}=e||{},r=null==s?void 0:s.find(e=>(0,v.Ym)(e.cluster)),a=r?r.status:"NOT_FOUND",l=!1;"STOPPED"==a&&n&&(l=!0),"LAUNCHING"==a?H(!0):H(!1),p(t),B(l),S(!1)}catch(e){console.error("Error fetching data:",e),p([]),B(!1),S(!1)}finally{N(!1),t(!1)}},[t]);r.useEffect(()=>{a&&(a.current=er)},[a,er]),(0,r.useEffect)(()=>{p([]);let e=!0;er();let t=setInterval(()=>{e&&er()},s);return()=>{e=!1,clearInterval(t)}},[s,er]),(0,r.useEffect)(()=>{I(1)},[K,null==j?void 0:j.length]),(0,r.useEffect)(()=>{q([]),ee(!0)},[K]);let ea=e=>{let s="ascending";f.key===e&&"ascending"===f.direction&&(s="descending"),g({key:e,direction:s})},el=e=>f.key===e?"ascending"===f.direction?" ↑":" ↓":"";r.useMemo(()=>{let e=j||[];return{active:e.filter(e=>R.active.includes(e.status)).length,finished:e.filter(e=>R.finished.includes(e.status)).length}},[j]);let ei=e=>Z.length>0?Z.includes(e):R[K].includes(e),ec=r.useMemo(()=>{let e=l&&l!==M?j.filter(e=>(e.workspace||"default").toLowerCase()===l.toLowerCase()):j;return Z.length>0?e.filter(e=>Z.includes(e.status)):Y?e.filter(e=>R[K].includes(e.status)):[]},[j,K,Z,Y,l]),eo=r.useMemo(()=>f.key?[...ec].sort((e,s)=>e[f.key]<s[f.key]?"ascending"===f.direction?-1:1:e[f.key]>s[f.key]?"ascending"===f.direction?1:-1:0):ec,[ec,f]),ed=Math.ceil(eo.length/O),eh=(L-1)*O,ex=eh+O,eu=eo.slice(eh,ex),em=e=>{if(Z.includes(e)){let s=Z.filter(s=>s!==e);0===s.length?(ee(!0),q([])):(q(s),ee(!1))}else q([...Z,e]),ee(!1)};return(0,r.useEffect)(()=>{V((j||[]).reduce((e,s)=>(e[s.status]=(e[s.status]||0)+1,e),{}))},[j]),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("div",{className:"flex flex-col space-y-1 mb-1",children:(0,n.jsxs)("div",{className:"flex flex-wrap items-center text-sm mb-1",children:[(0,n.jsx)("span",{className:"mr-2 text-sm font-medium",children:"Statuses:"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 items-center",children:[!b&&(!j||0===j.length)&&!C&&(0,n.jsx)("span",{className:"text-gray-500 mr-2",children:"No jobs found"}),Object.entries(T).map(e=>{let[s,t]=e;return(0,n.jsxs)("button",{onClick:()=>em(s),className:"px-3 py-1 rounded-full flex items-center space-x-2 ".concat(ei(s)||Z.includes(s)?(0,k.Cl)(s):"bg-gray-50 text-gray-600 hover:bg-gray-100"),children:[(0,n.jsx)("span",{children:s}),(0,n.jsx)("span",{className:"text-xs ".concat(ei(s)||Z.includes(s)?"bg-white/50":"bg-gray-200"," px-1.5 py-0.5 rounded"),children:t})]},s)}),j&&j.length>0&&(0,n.jsxs)("div",{className:"flex items-center ml-2 gap-2",children:[(0,n.jsx)("span",{className:"text-gray-500",children:"("}),(0,n.jsx)("button",{onClick:()=>{Q("active"),q([]),ee(!0)},className:"text-sm font-medium ".concat("active"===K&&Y?"text-green-700 underline":"text-gray-600 hover:text-green-700 hover:underline"),children:"show all active jobs"}),(0,n.jsx)("span",{className:"text-gray-500 mx-1",children:"|"}),(0,n.jsx)("button",{onClick:()=>{Q("finished"),q([]),ee(!0)},className:"text-sm font-medium ".concat("finished"===K&&Y?"text-blue-700 underline":"text-gray-600 hover:text-blue-700 hover:underline"),children:"show all finished jobs"}),(0,n.jsx)("span",{className:"text-gray-500",children:")"})]})]})]})}),(0,n.jsx)(d.Zb,{children:(0,n.jsxs)(h.iA,{children:[(0,n.jsx)(h.xD,{children:(0,n.jsxs)(h.SC,{children:[(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("id"),children:["ID",el("id")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("name"),children:["Name",el("name")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("user"),children:["User",el("user")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("workspace"),children:["Workspace",el("workspace")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("submitted_at"),children:["Submitted",el("submitted_at")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("job_duration"),children:["Duration",el("job_duration")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("status"),children:["Status",el("status")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("priority"),children:["Priority",el("priority")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("resources_str"),children:["Requested",el("resources_str")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("infra"),children:["Infra",el("infra")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("cluster"),children:["Resources",el("cluster")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("recoveries"),children:["Recoveries",el("recoveries")]}),(0,n.jsx)(h.ss,{children:"Details"}),(0,n.jsx)(h.ss,{children:"Logs"})]})}),(0,n.jsx)(h.RM,{children:b||C?(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:13,className:"text-center py-6 text-gray-500",children:(0,n.jsxs)("div",{className:"flex justify-center items-center",children:[(0,n.jsx)(c.Z,{size:20,className:"mr-2"}),(0,n.jsx)("span",{children:"Loading..."})]})})}):eu.length>0?(0,n.jsx)(n.Fragment,{children:eu.map(e=>(0,n.jsxs)(r.Fragment,{children:[(0,n.jsxs)(h.SC,{children:[(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.id})}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.name})}),(0,n.jsx)(h.pj,{children:e.user}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/workspaces",className:"text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,n.jsx)(h.pj,{children:_(e.submitted_at)}),(0,n.jsx)(h.pj,{children:(0,x.LU)(e.job_duration)}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(k.OE,{status:e.status})}),(0,n.jsx)(h.pj,{children:e.priority}),(0,n.jsx)(h.pj,{children:e.requested_resources}),(0,n.jsx)(h.pj,{children:e.infra&&"-"!==e.infra?(0,n.jsx)(x.Md,{content:e.full_infra||e.infra,className:"text-sm text-muted-foreground",children:(0,n.jsxs)("span",{children:[(0,n.jsx)(i(),{href:"/infra",className:"text-blue-600 hover:underline",children:e.cloud||e.infra.split("(")[0].trim()}),e.infra.includes("(")&&(0,n.jsx)("span",{children:" "+e.infra.substring(e.infra.indexOf("("))})]})}):(0,n.jsx)("span",{children:e.infra||"-"})}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(x.Md,{content:e.resources_str_full||e.resources_str,className:"text-sm text-muted-foreground",children:(0,n.jsx)("span",{children:e.resources_str})})}),(0,n.jsx)(h.pj,{children:e.recoveries}),(0,n.jsx)(h.pj,{children:e.details?(0,n.jsx)(F,{text:e.details,rowId:e.id,expandedRowId:P,setExpandedRowId:U}):"-"}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(D,{jobParent:"/jobs",jobId:e.id,managed:!0})})]}),P===e.id&&(0,n.jsx)(z,{text:e.details,colSpan:13,innerRef:W})]},e.id))}):(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:13,className:"text-center py-6",children:(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[G&&(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,n.jsx)("p",{className:"text-gray-700",children:"The managed job controller is launching. It will be ready shortly."}),(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(c.Z,{size:12,className:"mr-2"}),(0,n.jsx)("span",{className:"text-gray-500",children:"Launching..."})]})]}),!J&&!G&&(0,n.jsx)("p",{className:"text-gray-500",children:"No active jobs"}),J&&(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,n.jsx)("p",{className:"text-gray-700",children:"The managed job controller has been stopped. Restart to check the latest job status."}),(0,n.jsx)(o.z,{variant:"outline",size:"sm",onClick:en,className:"text-sky-blue hover:text-sky-blue-bright",disabled:b||X,children:X?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(c.Z,{size:12,className:"mr-2"}),"Restarting..."]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(w,{className:"h-4 w-4 mr-2"}),"Restart Controller"]})})]})]})})})})]})}),eo&&eo.length>0&&(0,n.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,n.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,n.jsxs)("div",{className:"relative inline-block",children:[(0,n.jsxs)("select",{value:O,onChange:e=>{A(parseInt(e.target.value,10)),I(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,n.jsx)("option",{value:10,children:"10"}),(0,n.jsx)("option",{value:30,children:"30"}),(0,n.jsx)("option",{value:50,children:"50"}),(0,n.jsx)("option",{value:100,children:"100"}),(0,n.jsx)("option",{value:200,children:"200"})]}),(0,n.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,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,n.jsxs)("div",{children:[eh+1," – ",Math.min(ex,eo.length)," of"," ",eo.length]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{I(e=>Math.max(e-1,1))},disabled:1===L,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.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,n.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{I(e=>Math.min(e+1,ed))},disabled:L===ed||0===ed,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.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,n.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})}),(0,n.jsx)(y.cV,{isOpen:es.isOpen,onClose:()=>et({...es,isOpen:!1}),onConfirm:es.onConfirm,title:es.title,message:es.message})]})}function D(e){let{withLabel:s=!1,jobParent:t,jobId:r,managed:l}=e,i=(0,a.useRouter)(),c=(e,s)=>{e.preventDefault(),e.stopPropagation(),i.push({pathname:"".concat(t,"/").concat(r),query:{tab:s}})};return(0,n.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,n.jsx)(x.WH,{content:"View Job Logs",className:"capitalize text-sm text-muted-foreground",children:(0,n.jsxs)("button",{onClick:e=>c(e,"logs"),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",children:[(0,n.jsx)(b,{className:"w-4 h-4"}),s&&(0,n.jsx)("span",{className:"ml-1.5",children:"Logs"})]})},"logs"),l&&(0,n.jsx)(x.WH,{content:"View Controller Logs",className:"capitalize text-sm text-muted-foreground",children:(0,n.jsxs)("button",{onClick:e=>c(e,"controllerlogs"),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",children:[(0,n.jsx)(N,{className:"w-4 h-4"}),s&&(0,n.jsx)("span",{className:"ml-2",children:"Controller Logs"})]})},"controllerlogs")]})}function A(e){let{clusterName:s,clusterJobData:t,loading:a,refreshClusterJobsOnly:l}=e,[u,m]=(0,r.useState)(null),[j,p]=(0,r.useState)({key:null,direction:"ascending"}),[g,w]=(0,r.useState)(1),[b,N]=(0,r.useState)(10),y=(0,r.useRef)(null),[v,C]=(0,r.useState)(null);(0,r.useEffect)(()=>{let e=e=>{u&&y.current&&!y.current.contains(e.target)&&m(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[u]);let S=r.useMemo(()=>t||[],[t]);(0,r.useEffect)(()=>{JSON.stringify(t)!==JSON.stringify(v)&&C(t)},[t,v]);let E=r.useMemo(()=>j.key?[...S].sort((e,s)=>e[j.key]<s[j.key]?"ascending"===j.direction?-1:1:e[j.key]>s[j.key]?"ascending"===j.direction?1:-1:0):S,[S,j]),L=e=>{let s="ascending";j.key===e&&"ascending"===j.direction&&(s="descending"),p({key:e,direction:s})},R=e=>j.key===e?"ascending"===j.direction?" ↑":" ↓":"",M=Math.ceil(E.length/b),I=(g-1)*b,O=I+b,A=E.slice(I,O);return(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsxs)(d.Zb,{children:[(0,n.jsxs)("div",{className:"flex items-center justify-between p-4",children:[(0,n.jsx)("h3",{className:"text-lg font-semibold",children:"Cluster Jobs"}),(0,n.jsx)("div",{className:"flex items-center",children:l&&(0,n.jsxs)("button",{onClick:l,disabled:a,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center text-sm ml-2",children:[(0,n.jsx)(f.Z,{className:"w-4 h-4 mr-1"}),"Refresh Jobs"]})})]}),(0,n.jsxs)(h.iA,{children:[(0,n.jsx)(h.xD,{children:(0,n.jsxs)(h.SC,{children:[(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("id"),children:["ID",R("id")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("job"),children:["Name",R("job")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("user"),children:["User",R("user")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("workspace"),children:["Workspace",R("workspace")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("submitted_at"),children:["Submitted",R("submitted_at")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("job_duration"),children:["Duration",R("job_duration")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("status"),children:["Status",R("status")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("resources"),children:["Resources",R("resources")]}),(0,n.jsx)(h.ss,{className:"whitespace-nowrap",children:"Logs"})]})}),(0,n.jsx)(h.RM,{children:a?(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:9,className:"text-center py-12 text-gray-500",children:(0,n.jsxs)("div",{className:"flex justify-center items-center",children:[(0,n.jsx)(c.Z,{size:24,className:"mr-2"}),(0,n.jsx)("span",{children:"Loading cluster jobs..."})]})})}):A.length>0?A.map(e=>(0,n.jsxs)(r.Fragment,{children:[(0,n.jsxs)(h.SC,{className:u===e.id?"selected-row":"",children:[(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/clusters/".concat(s,"/").concat(e.id),className:"text-blue-600",children:e.id})}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/clusters/".concat(s,"/").concat(e.id),className:"text-blue-600",children:(0,n.jsx)(F,{text:e.job||"Unnamed job",rowId:e.id,expandedRowId:u,setExpandedRowId:m})})}),(0,n.jsx)(h.pj,{children:e.user}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/workspaces",className:"text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,n.jsx)(h.pj,{children:_(e.submitted_at)}),(0,n.jsx)(h.pj,{children:(0,x.LU)(e.job_duration)}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(k.OE,{status:e.status})}),(0,n.jsx)(h.pj,{children:e.resources}),(0,n.jsx)(h.pj,{className:"flex content-center items-center",children:(0,n.jsx)(D,{jobParent:"/clusters/".concat(s),jobId:e.id,managed:!1})})]}),u===e.id&&(0,n.jsx)(z,{text:e.job||"Unnamed job",colSpan:9,innerRef:y})]},e.id)):(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:8,className:"text-center py-6 text-gray-500",children:"No jobs found"})})})]})]}),E&&E.length>0&&(0,n.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,n.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,n.jsxs)("div",{className:"relative inline-block",children:[(0,n.jsxs)("select",{value:b,onChange:e=>{N(parseInt(e.target.value,10)),w(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,n.jsx)("option",{value:5,children:"5"}),(0,n.jsx)("option",{value:10,children:"10"}),(0,n.jsx)("option",{value:20,children:"20"}),(0,n.jsx)("option",{value:50,children:"50"})]}),(0,n.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,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,n.jsxs)("div",{children:[I+1," – ",Math.min(O,E.length)," of"," ",E.length]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{w(e=>Math.max(e-1,1))},disabled:1===g,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.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,n.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{w(e=>Math.min(e+1,M))},disabled:g===M||0===M,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.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,n.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})})]})}function z(e){let{text:s,colSpan:t,innerRef:r}=e;return(0,n.jsx)(h.SC,{className:"expanded-details",children:(0,n.jsx)(h.pj,{colSpan:t,children:(0,n.jsx)("div",{className:"p-4 bg-gray-50 rounded-md border border-gray-200",ref:r,children:(0,n.jsx)("div",{className:"flex justify-between items-start",children:(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-gray-900",children:"Full Details"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-gray-700",style:{whiteSpace:"pre-wrap"},children:s})]})})})})})}function F(e){let{text:s,rowId:t,expandedRowId:a,setExpandedRowId:l}=e,i=s||"",c=i.length>50,o=a===t,d=c?"".concat(i.substring(0,50)):i,h=(0,r.useRef)(null);return(0,n.jsxs)("div",{className:"truncated-details relative max-w-full flex items-center",children:[(0,n.jsx)("span",{className:"truncate",children:d}),c&&(0,n.jsx)("button",{ref:h,type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),l(o?null:t)},className:"text-blue-600 hover:text-blue-800 font-medium ml-1 flex-shrink-0","data-button-type":"show-more-less",children:o?"... show less":"... show more"})]})}}}]);
|