skypilot-nightly 1.0.0.dev20250609__py3-none-any.whl → 1.0.0.dev20250610__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 +3 -0
- sky/authentication.py +1 -7
- sky/backends/cloud_vm_ray_backend.py +9 -20
- sky/cli.py +2 -4
- sky/client/cli.py +2 -4
- sky/client/sdk.py +49 -4
- sky/clouds/kubernetes.py +15 -24
- sky/dashboard/out/404.html +1 -1
- sky/dashboard/out/_next/static/4lwUJxN6KwBqUxqO1VccB/_buildManifest.js +1 -0
- sky/dashboard/out/_next/static/chunks/211.692afc57e812ae1a.js +1 -0
- sky/dashboard/out/_next/static/chunks/350.9e123a4551f68b0d.js +1 -0
- sky/dashboard/out/_next/static/chunks/37-d8aebf1683522a0b.js +6 -0
- sky/dashboard/out/_next/static/chunks/42.d39e24467181b06b.js +6 -0
- sky/dashboard/out/_next/static/chunks/443.b2242d0efcdf5f47.js +1 -0
- sky/dashboard/out/_next/static/chunks/470-4d1a5dbe58a8a2b9.js +1 -0
- sky/dashboard/out/_next/static/chunks/{121-865d2bf8a3b84c6a.js → 491.b3d264269613fe09.js} +3 -3
- sky/dashboard/out/_next/static/chunks/513.211357a2914a34b2.js +1 -0
- sky/dashboard/out/_next/static/chunks/600.9cc76ec442b22e10.js +16 -0
- sky/dashboard/out/_next/static/chunks/616-d6128fa9e7cae6e6.js +39 -0
- sky/dashboard/out/_next/static/chunks/664-047bc03493fda379.js +1 -0
- sky/dashboard/out/_next/static/chunks/682.4dd5dc116f740b5f.js +6 -0
- sky/dashboard/out/_next/static/chunks/760-a89d354797ce7af5.js +1 -0
- sky/dashboard/out/_next/static/chunks/799-3625946b2ec2eb30.js +8 -0
- sky/dashboard/out/_next/static/chunks/804-4c9fc53aa74bc191.js +21 -0
- sky/dashboard/out/_next/static/chunks/843-6fcc4bf91ac45b39.js +11 -0
- sky/dashboard/out/_next/static/chunks/856-0776dc6ed6000c39.js +1 -0
- sky/dashboard/out/_next/static/chunks/901-b424d293275e1fd7.js +1 -0
- sky/dashboard/out/_next/static/chunks/938-a75b7712639298b7.js +1 -0
- sky/dashboard/out/_next/static/chunks/947-6620842ef80ae879.js +35 -0
- sky/dashboard/out/_next/static/chunks/969-20d54a9d998dc102.js +1 -0
- sky/dashboard/out/_next/static/chunks/973-c807fc34f09c7df3.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/_app-4768de0aede04dc9.js +20 -0
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-89216c616dbaa9c5.js +6 -0
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-451a14e7e755ebbc.js +6 -0
- sky/dashboard/out/_next/static/chunks/pages/clusters-e56b17fd85d0ba58.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/config-497a35a7ed49734a.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/infra/[context]-d2910be98e9227cb.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/infra-780860bcc1103945.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-b3dbf38b51cb29be.js +16 -0
- sky/dashboard/out/_next/static/chunks/pages/jobs-fe233baf3d073491.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/users-c69ffcab9d6e5269.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/workspace/new-31aa8bdcb7592635.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/workspaces/[name]-c8c2191328532b7d.js +1 -0
- sky/dashboard/out/_next/static/chunks/pages/workspaces-82e6601baa5dd280.js +1 -0
- sky/dashboard/out/_next/static/chunks/webpack-0574a5a4ba3cf0ac.js +1 -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/exceptions.py +18 -0
- sky/global_user_state.py +181 -74
- sky/jobs/client/sdk.py +29 -21
- sky/provision/kubernetes/constants.py +9 -0
- sky/provision/kubernetes/utils.py +106 -7
- sky/serve/client/sdk.py +56 -45
- sky/server/common.py +1 -5
- sky/server/requests/executor.py +50 -20
- sky/server/requests/payloads.py +3 -0
- sky/server/requests/process.py +69 -29
- sky/server/server.py +1 -0
- sky/server/stream_utils.py +111 -55
- sky/skylet/constants.py +1 -2
- sky/skypilot_config.py +99 -25
- sky/users/permission.py +1 -1
- sky/utils/admin_policy_utils.py +9 -3
- sky/utils/context.py +21 -1
- sky/utils/controller_utils.py +16 -1
- sky/utils/kubernetes/exec_kubeconfig_converter.py +19 -47
- {skypilot_nightly-1.0.0.dev20250609.dist-info → skypilot_nightly-1.0.0.dev20250610.dist-info}/METADATA +1 -1
- {skypilot_nightly-1.0.0.dev20250609.dist-info → skypilot_nightly-1.0.0.dev20250610.dist-info}/RECORD +85 -74
- sky/dashboard/out/_next/static/chunks/236-619ed0248fb6fdd9.js +0 -6
- sky/dashboard/out/_next/static/chunks/293-351268365226d251.js +0 -1
- sky/dashboard/out/_next/static/chunks/37-600191c5804dcae2.js +0 -6
- sky/dashboard/out/_next/static/chunks/470-680c19413b8f808b.js +0 -1
- sky/dashboard/out/_next/static/chunks/63-e2d7b1e75e67c713.js +0 -66
- sky/dashboard/out/_next/static/chunks/682-b60cfdacc15202e8.js +0 -6
- sky/dashboard/out/_next/static/chunks/843-16c7194621b2b512.js +0 -11
- sky/dashboard/out/_next/static/chunks/856-affc52adf5403a3a.js +0 -1
- sky/dashboard/out/_next/static/chunks/969-2c584e28e6b4b106.js +0 -1
- sky/dashboard/out/_next/static/chunks/973-aed916d5b02d2d63.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/_app-5f16aba5794ee8e7.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-d31688d3e52736dd.js +0 -6
- sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-e7d8710a9b0491e5.js +0 -6
- sky/dashboard/out/_next/static/chunks/pages/clusters-3c674e5d970e05cb.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/config-3aac7a015c6eede1.js +0 -6
- sky/dashboard/out/_next/static/chunks/pages/infra/[context]-46d2e4ad6c487260.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/infra-7013d816a2a0e76c.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-f7f0c9e156d328bc.js +0 -16
- sky/dashboard/out/_next/static/chunks/pages/jobs-87e60396c376292f.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/users-9355a0f13d1db61d.js +0 -16
- sky/dashboard/out/_next/static/chunks/pages/workspace/new-9a749cca1813bd27.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/workspaces/[name]-8eeb628e03902f1b.js +0 -1
- sky/dashboard/out/_next/static/chunks/pages/workspaces-8fbcc5ab4af316d0.js +0 -1
- sky/dashboard/out/_next/static/chunks/webpack-65d465f948974c0d.js +0 -1
- sky/dashboard/out/_next/static/xos0euNCptbGAM7_Q3Acl/_buildManifest.js +0 -1
- /sky/dashboard/out/_next/static/{xos0euNCptbGAM7_Q3Acl → 4lwUJxN6KwBqUxqO1VccB}/_ssgManifest.js +0 -0
- {skypilot_nightly-1.0.0.dev20250609.dist-info → skypilot_nightly-1.0.0.dev20250610.dist-info}/WHEEL +0 -0
- {skypilot_nightly-1.0.0.dev20250609.dist-info → skypilot_nightly-1.0.0.dev20250610.dist-info}/entry_points.txt +0 -0
- {skypilot_nightly-1.0.0.dev20250609.dist-info → skypilot_nightly-1.0.0.dev20250610.dist-info}/licenses/LICENSE +0 -0
- {skypilot_nightly-1.0.0.dev20250609.dist-info → skypilot_nightly-1.0.0.dev20250610.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 = 'd738e2a04a6185c2c01cb41ad2456cbc964411f0'
|
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.dev20250610'
|
39
39
|
__root_dir__ = os.path.dirname(os.path.abspath(__file__))
|
40
40
|
|
41
41
|
|
sky/admin_policy.py
CHANGED
@@ -29,6 +29,7 @@ class RequestOptions:
|
|
29
29
|
idle_minutes_to_autostop: Optional[int]
|
30
30
|
down: bool
|
31
31
|
dryrun: bool
|
32
|
+
is_client_side: bool = False
|
32
33
|
|
33
34
|
|
34
35
|
@dataclasses.dataclass
|
@@ -50,10 +51,12 @@ class UserRequest:
|
|
50
51
|
task: User specified task.
|
51
52
|
skypilot_config: Global skypilot config to be used in this request.
|
52
53
|
request_options: Request options. It is None for jobs and services.
|
54
|
+
at_client_side: Is the request intercepted by the policy at client-side?
|
53
55
|
"""
|
54
56
|
task: 'sky.Task'
|
55
57
|
skypilot_config: 'sky.Config'
|
56
58
|
request_options: Optional['RequestOptions'] = None
|
59
|
+
at_client_side: bool = False
|
57
60
|
|
58
61
|
|
59
62
|
@dataclasses.dataclass
|
sky/authentication.py
CHANGED
@@ -439,13 +439,7 @@ def setup_kubernetes_authentication(config: Dict[str, Any]) -> Dict[str, Any]:
|
|
439
439
|
# Add the user's public key to the SkyPilot cluster.
|
440
440
|
secret_name = clouds.Kubernetes.SKY_SSH_KEY_SECRET_NAME
|
441
441
|
secret_field_name = clouds.Kubernetes().ssh_key_secret_field_name
|
442
|
-
context = config['provider']
|
443
|
-
'context', kubernetes_utils.get_current_kube_config_context_name())
|
444
|
-
if context == kubernetes.in_cluster_context_name():
|
445
|
-
# If the context is an in-cluster context name, we are running in a pod
|
446
|
-
# with in-cluster configuration. We need to set the context to None
|
447
|
-
# to use the mounted service account.
|
448
|
-
context = None
|
442
|
+
context = kubernetes_utils.get_context_from_config(config['provider'])
|
449
443
|
namespace = kubernetes_utils.get_namespace_from_config(config['provider'])
|
450
444
|
k8s = kubernetes.kubernetes
|
451
445
|
with open(public_key_path, 'r', encoding='utf-8') as f:
|
@@ -2904,14 +2904,6 @@ class CloudVmRayBackend(backends.Backend['CloudVmRayResourceHandle']):
|
|
2904
2904
|
# TODO(suquark): once we have sky on PyPI, we should directly
|
2905
2905
|
# install sky from PyPI.
|
2906
2906
|
local_wheel_path, wheel_hash = wheel_utils.build_sky_wheel()
|
2907
|
-
# The most frequent reason for the failure of a provision
|
2908
|
-
# request is resource unavailability instead of rate
|
2909
|
-
# limiting; to make users wait shorter, we do not make
|
2910
|
-
# backoffs exponential.
|
2911
|
-
backoff = common_utils.Backoff(
|
2912
|
-
initial_backoff=_RETRY_UNTIL_UP_INIT_GAP_SECONDS,
|
2913
|
-
max_backoff_factor=1)
|
2914
|
-
attempt_cnt = 1
|
2915
2907
|
while True:
|
2916
2908
|
# For on-demand instances, RetryingVmProvisioner will retry
|
2917
2909
|
# within the given region first, then optionally retry on all
|
@@ -2955,19 +2947,16 @@ class CloudVmRayBackend(backends.Backend['CloudVmRayResourceHandle']):
|
|
2955
2947
|
error_message = str(e)
|
2956
2948
|
|
2957
2949
|
if retry_until_up:
|
2958
|
-
|
2959
|
-
# Sleep and retry.
|
2960
|
-
gap_seconds = backoff.current_backoff()
|
2961
|
-
plural = 's' if attempt_cnt > 1 else ''
|
2950
|
+
gap_seconds = _RETRY_UNTIL_UP_INIT_GAP_SECONDS
|
2962
2951
|
retry_message = ux_utils.retry_message(
|
2963
|
-
f'Retry after {gap_seconds:.0f}s '
|
2964
|
-
|
2965
|
-
|
2966
|
-
|
2967
|
-
|
2968
|
-
|
2969
|
-
|
2970
|
-
|
2952
|
+
f'Retry after {gap_seconds:.0f}s ')
|
2953
|
+
hint_message = (f'\n{retry_message} '
|
2954
|
+
f'{ux_utils.log_path_hint(log_path)}'
|
2955
|
+
f'{colorama.Style.RESET_ALL}')
|
2956
|
+
raise exceptions.ExecutionRetryableError(
|
2957
|
+
error_message,
|
2958
|
+
hint=hint_message,
|
2959
|
+
retry_wait_seconds=gap_seconds)
|
2971
2960
|
# Clean up the cluster's entry in `sky status`.
|
2972
2961
|
# Do not remove the stopped cluster from the global state
|
2973
2962
|
# if failed to start.
|
sky/cli.py
CHANGED
@@ -6248,13 +6248,11 @@ def api_info():
|
|
6248
6248
|
name=api_server_user['name'])
|
6249
6249
|
else:
|
6250
6250
|
user = models.User.get_current_user()
|
6251
|
-
|
6252
|
-
click.echo(f'Using SkyPilot API server: {url}\n'
|
6251
|
+
click.echo(f'Using SkyPilot API server and dashboard: {url}\n'
|
6253
6252
|
f'{ux_utils.INDENT_SYMBOL}Status: {api_server_info["status"]}, '
|
6254
6253
|
f'commit: {api_server_info["commit"]}, '
|
6255
6254
|
f'version: {api_server_info["version"]}\n'
|
6256
|
-
f'{ux_utils.
|
6257
|
-
f'{ux_utils.INDENT_LAST_SYMBOL}Dashboard: {dashboard_url}')
|
6255
|
+
f'{ux_utils.INDENT_LAST_SYMBOL}User: {user.name} ({user.id})')
|
6258
6256
|
|
6259
6257
|
|
6260
6258
|
@cli.group(cls=_NaturalOrderGroup)
|
sky/client/cli.py
CHANGED
@@ -6248,13 +6248,11 @@ def api_info():
|
|
6248
6248
|
name=api_server_user['name'])
|
6249
6249
|
else:
|
6250
6250
|
user = models.User.get_current_user()
|
6251
|
-
|
6252
|
-
click.echo(f'Using SkyPilot API server: {url}\n'
|
6251
|
+
click.echo(f'Using SkyPilot API server and dashboard: {url}\n'
|
6253
6252
|
f'{ux_utils.INDENT_SYMBOL}Status: {api_server_info["status"]}, '
|
6254
6253
|
f'commit: {api_server_info["commit"]}, '
|
6255
6254
|
f'version: {api_server_info["version"]}\n'
|
6256
|
-
f'{ux_utils.
|
6257
|
-
f'{ux_utils.INDENT_LAST_SYMBOL}Dashboard: {dashboard_url}')
|
6255
|
+
f'{ux_utils.INDENT_LAST_SYMBOL}User: {user.name} ({user.id})')
|
6258
6256
|
|
6259
6257
|
|
6260
6258
|
@cli.group(cls=_NaturalOrderGroup)
|
sky/client/sdk.py
CHANGED
@@ -42,10 +42,12 @@ from sky.server.requests import payloads
|
|
42
42
|
from sky.server.requests import requests as requests_lib
|
43
43
|
from sky.skylet import constants
|
44
44
|
from sky.usage import usage_lib
|
45
|
+
from sky.utils import admin_policy_utils
|
45
46
|
from sky.utils import annotations
|
46
47
|
from sky.utils import cluster_utils
|
47
48
|
from sky.utils import common
|
48
49
|
from sky.utils import common_utils
|
50
|
+
from sky.utils import context as sky_context
|
49
51
|
from sky.utils import dag_utils
|
50
52
|
from sky.utils import env_options
|
51
53
|
from sky.utils import infra_utils
|
@@ -355,6 +357,7 @@ def dashboard(starting_page: Optional[str] = None) -> None:
|
|
355
357
|
@usage_lib.entrypoint
|
356
358
|
@server_common.check_server_healthy_or_start
|
357
359
|
@annotations.client_api
|
360
|
+
@sky_context.contextual
|
358
361
|
def launch(
|
359
362
|
task: Union['sky.Task', 'sky.Dag'],
|
360
363
|
cluster_name: Optional[str] = None,
|
@@ -490,6 +493,50 @@ def launch(
|
|
490
493
|
idle_minutes_to_autostop=idle_minutes_to_autostop,
|
491
494
|
down=down,
|
492
495
|
dryrun=dryrun)
|
496
|
+
with admin_policy_utils.apply_and_use_config_in_current_request(
|
497
|
+
dag, request_options=request_options, at_client_side=True) as dag:
|
498
|
+
return _launch(
|
499
|
+
dag,
|
500
|
+
cluster_name,
|
501
|
+
request_options,
|
502
|
+
retry_until_up,
|
503
|
+
idle_minutes_to_autostop,
|
504
|
+
dryrun,
|
505
|
+
down,
|
506
|
+
backend,
|
507
|
+
optimize_target,
|
508
|
+
no_setup,
|
509
|
+
clone_disk_from,
|
510
|
+
fast,
|
511
|
+
_need_confirmation,
|
512
|
+
_is_launched_by_jobs_controller,
|
513
|
+
_is_launched_by_sky_serve_controller,
|
514
|
+
_disable_controller_check,
|
515
|
+
)
|
516
|
+
|
517
|
+
|
518
|
+
def _launch(
|
519
|
+
dag: 'sky.Dag',
|
520
|
+
cluster_name: str,
|
521
|
+
request_options: admin_policy.RequestOptions,
|
522
|
+
retry_until_up: bool = False,
|
523
|
+
idle_minutes_to_autostop: Optional[int] = None,
|
524
|
+
dryrun: bool = False,
|
525
|
+
down: bool = False, # pylint: disable=redefined-outer-name
|
526
|
+
backend: Optional[backends.Backend] = None,
|
527
|
+
optimize_target: common.OptimizeTarget = common.OptimizeTarget.COST,
|
528
|
+
no_setup: bool = False,
|
529
|
+
clone_disk_from: Optional[str] = None,
|
530
|
+
fast: bool = False,
|
531
|
+
# Internal only:
|
532
|
+
# pylint: disable=invalid-name
|
533
|
+
_need_confirmation: bool = False,
|
534
|
+
_is_launched_by_jobs_controller: bool = False,
|
535
|
+
_is_launched_by_sky_serve_controller: bool = False,
|
536
|
+
_disable_controller_check: bool = False,
|
537
|
+
) -> server_common.RequestId:
|
538
|
+
"""Auxiliary function for launch(), refer to launch() for details."""
|
539
|
+
|
493
540
|
validate(dag, admin_policy_request_options=request_options)
|
494
541
|
# The flags have been applied to the task YAML and the backward
|
495
542
|
# compatibility of admin policy has been handled. We should no longer use
|
@@ -1845,10 +1892,8 @@ def api_start(
|
|
1845
1892
|
# Explain why current process exited
|
1846
1893
|
logger.info('API server is already running:')
|
1847
1894
|
api_server_url = server_common.get_server_url(host)
|
1848
|
-
|
1849
|
-
|
1850
|
-
logger.info(f'{ux_utils.INDENT_SYMBOL}SkyPilot API server: '
|
1851
|
-
f'{api_server_url} {dashboard_msg}\n'
|
1895
|
+
logger.info(f'{ux_utils.INDENT_SYMBOL}SkyPilot API server and dashboard: '
|
1896
|
+
f'{api_server_url}\n'
|
1852
1897
|
f'{ux_utils.INDENT_LAST_SYMBOL}'
|
1853
1898
|
f'View API server logs at: {constants.API_SERVER_LOGS}')
|
1854
1899
|
|
sky/clouds/kubernetes.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
"""Kubernetes."""
|
2
|
+
import os
|
2
3
|
import re
|
3
4
|
import subprocess
|
4
5
|
import tempfile
|
@@ -106,17 +107,6 @@ class Kubernetes(clouds.Cloud):
|
|
106
107
|
context = resources.region
|
107
108
|
if context is None:
|
108
109
|
context = kubernetes_utils.get_current_kube_config_context_name()
|
109
|
-
# Features to be disabled for exec auth
|
110
|
-
is_exec_auth, message = kubernetes_utils.is_kubeconfig_exec_auth(
|
111
|
-
context)
|
112
|
-
if is_exec_auth:
|
113
|
-
assert isinstance(message, str), message
|
114
|
-
# Controllers cannot spin up new pods with exec auth.
|
115
|
-
unsupported_features[
|
116
|
-
clouds.CloudImplementationFeatures.HOST_CONTROLLERS] = message
|
117
|
-
# Pod does not have permissions to down itself with exec auth.
|
118
|
-
unsupported_features[
|
119
|
-
clouds.CloudImplementationFeatures.AUTODOWN] = message
|
120
110
|
unsupported_features[clouds.CloudImplementationFeatures.STOP] = (
|
121
111
|
'Stopping clusters is not supported on Kubernetes.')
|
122
112
|
unsupported_features[clouds.CloudImplementationFeatures.AUTOSTOP] = (
|
@@ -537,20 +527,17 @@ class Kubernetes(clouds.Cloud):
|
|
537
527
|
# If remote_identity is not a dict, use
|
538
528
|
k8s_service_account_name = remote_identity
|
539
529
|
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
#
|
530
|
+
lc = schemas.RemoteIdentityOptions.LOCAL_CREDENTIALS.value
|
531
|
+
sa = schemas.RemoteIdentityOptions.SERVICE_ACCOUNT.value
|
532
|
+
|
533
|
+
if k8s_service_account_name == lc or k8s_service_account_name == sa:
|
534
|
+
# Use the default service account if remote identity is not set.
|
535
|
+
# For LOCAL_CREDENTIALS, this is for in-cluster authentication
|
536
|
+
# which needs a serviceaccount (specifically for SSH node pools
|
537
|
+
# which uses in-cluster authentication internally, and we would
|
538
|
+
# like to support exec-auth when the user is also using SSH infra)
|
548
539
|
k8s_service_account_name = (
|
549
540
|
kubernetes_utils.DEFAULT_SERVICE_ACCOUNT_NAME)
|
550
|
-
k8s_automount_sa_token = 'true'
|
551
|
-
else:
|
552
|
-
# User specified a custom service account
|
553
|
-
k8s_automount_sa_token = 'true'
|
554
541
|
|
555
542
|
fuse_device_required = bool(resources.requires_fuse)
|
556
543
|
|
@@ -624,7 +611,7 @@ class Kubernetes(clouds.Cloud):
|
|
624
611
|
'k8s_ssh_jump_name': self.SKY_SSH_JUMP_NAME,
|
625
612
|
'k8s_ssh_jump_image': ssh_jump_image,
|
626
613
|
'k8s_service_account_name': k8s_service_account_name,
|
627
|
-
'k8s_automount_sa_token':
|
614
|
+
'k8s_automount_sa_token': 'true',
|
628
615
|
'k8s_fuse_device_required': fuse_device_required,
|
629
616
|
# Namespace to run the fusermount-server daemonset in
|
630
617
|
'k8s_skypilot_system_namespace': _SKYPILOT_SYSTEM_NAMESPACE,
|
@@ -863,6 +850,10 @@ class Kubernetes(clouds.Cloud):
|
|
863
850
|
f'> {kubeconfig_file}',
|
864
851
|
shell=True,
|
865
852
|
check=True)
|
853
|
+
if os.path.exists(kubeconfig_file):
|
854
|
+
# convert auth plugin paths (e.g.: gke-gcloud-auth-plugin)
|
855
|
+
kubeconfig_file = kubernetes_utils.format_kubeconfig_exec_auth_with_cache(kubeconfig_file) # pylint: disable=line-too-long
|
856
|
+
|
866
857
|
# Upload kubeconfig to the default path to avoid having to set
|
867
858
|
# KUBECONFIG in the environment.
|
868
859
|
return {kubernetes.DEFAULT_KUBECONFIG_PATH: kubeconfig_file}
|
sky/dashboard/out/404.html
CHANGED
@@ -1 +1 @@
|
|
1
|
-
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><
|
1
|
+
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><meta name="next-head-count" content="2"/><link rel="preload" href="/dashboard/_next/static/css/8b1c8321d4c02372.css" as="style"/><link rel="stylesheet" href="/dashboard/_next/static/css/8b1c8321d4c02372.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-0574a5a4ba3cf0ac.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-4768de0aede04dc9.js" defer=""></script><script src="/dashboard/_next/static/chunks/pages/_error-1be831200e60c5c0.js" defer=""></script><script src="/dashboard/_next/static/4lwUJxN6KwBqUxqO1VccB/_buildManifest.js" defer=""></script><script src="/dashboard/_next/static/4lwUJxN6KwBqUxqO1VccB/_ssgManifest.js" defer=""></script></head><body><div id="__next"></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"4lwUJxN6KwBqUxqO1VccB","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,n,b,r,u,i,j,k,f){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":["static/chunks/pages/index-6b0d9e5031b70c58.js"],"/_error":["static/chunks/pages/_error-1be831200e60c5c0.js"],"/clusters":["static/chunks/pages/clusters-e56b17fd85d0ba58.js"],"/clusters/[cluster]":[s,c,a,e,t,b,u,n,i,r,j,k,f,"static/chunks/37-d8aebf1683522a0b.js","static/chunks/pages/clusters/[cluster]-451a14e7e755ebbc.js"],"/clusters/[cluster]/[job]":[s,c,a,e,t,n,"static/chunks/pages/clusters/[cluster]/[job]-89216c616dbaa9c5.js"],"/config":["static/chunks/pages/config-497a35a7ed49734a.js"],"/infra":["static/chunks/pages/infra-780860bcc1103945.js"],"/infra/[context]":["static/chunks/pages/infra/[context]-d2910be98e9227cb.js"],"/jobs":["static/chunks/pages/jobs-fe233baf3d073491.js"],"/jobs/[job]":[s,c,a,e,t,b,n,r,"static/chunks/pages/jobs/[job]-b3dbf38b51cb29be.js"],"/users":["static/chunks/pages/users-c69ffcab9d6e5269.js"],"/workspace/new":["static/chunks/pages/workspace/new-31aa8bdcb7592635.js"],"/workspaces":["static/chunks/pages/workspaces-82e6601baa5dd280.js"],"/workspaces/[name]":[s,c,a,e,t,b,u,n,i,r,j,k,f,"static/chunks/843-6fcc4bf91ac45b39.js","static/chunks/pages/workspaces/[name]-c8c2191328532b7d.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/616-d6128fa9e7cae6e6.js","static/chunks/760-a89d354797ce7af5.js","static/chunks/799-3625946b2ec2eb30.js","static/chunks/804-4c9fc53aa74bc191.js","static/chunks/664-047bc03493fda379.js","static/chunks/470-4d1a5dbe58a8a2b9.js","static/chunks/798-c0525dc3f21e488d.js","static/chunks/969-20d54a9d998dc102.js","static/chunks/947-6620842ef80ae879.js","static/chunks/901-b424d293275e1fd7.js","static/chunks/856-0776dc6ed6000c39.js","static/chunks/973-c807fc34f09c7df3.js","static/chunks/938-a75b7712639298b7.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[211],{803:function(e,r,n){n.d(r,{z:function(){return d}});var t=n(5893),l=n(7294),a=n(8426),s=n(2003),i=n(2350);let o=(0,s.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),d=l.forwardRef((e,r)=>{let{className:n,variant:l,size:s,asChild:d=!1,...c}=e,u=d?a.g7:"button";return(0,t.jsx)(u,{className:(0,i.cn)(o({variant:l,size:s,className:n})),ref:r,...c})});d.displayName="Button"},7673:function(e,r,n){n.d(r,{Ol:function(){return d},Zb:function(){return o},aY:function(){return f},eW:function(){return p},ll:function(){return c}});var t=n(5893),l=n(7294),a=n(5697),s=n.n(a),i=n(2350);let o=l.forwardRef((e,r)=>{let{className:n,children:l,...a}=e;return(0,t.jsx)("div",{ref:r,className:(0,i.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",n),...a,children:l})});o.displayName="Card",o.propTypes={className:s().string,children:s().node};let d=l.forwardRef((e,r)=>{let{className:n,children:l,...a}=e;return(0,t.jsx)("div",{ref:r,className:(0,i.cn)("flex flex-col space-y-1.5 p-6",n),...a,children:l})});d.displayName="CardHeader",d.propTypes={className:s().string,children:s().node};let c=l.forwardRef((e,r)=>{let{className:n,children:l,...a}=e;return(0,t.jsx)("h3",{ref:r,className:(0,i.cn)("text-2xl font-semibold leading-none tracking-tight",n),...a,children:l})});c.displayName="CardTitle",c.propTypes={className:s().string,children:s().node};let u=l.forwardRef((e,r)=>{let{className:n,children:l,...a}=e;return(0,t.jsx)("p",{ref:r,className:(0,i.cn)("text-sm text-muted-foreground",n),...a,children:l})});u.displayName="CardDescription",u.propTypes={className:s().string,children:s().node};let f=l.forwardRef((e,r)=>{let{className:n,children:l,...a}=e;return(0,t.jsx)("div",{ref:r,className:(0,i.cn)("p-6 pt-0",n),...a,children:l})});f.displayName="CardContent",f.propTypes={className:s().string,children:s().node};let p=l.forwardRef((e,r)=>{let{className:n,children:l,...a}=e;return(0,t.jsx)("div",{ref:r,className:(0,i.cn)("flex items-center p-6 pt-0",n),...a,children:l})});p.displayName="CardFooter",p.propTypes={className:s().string,children:s().node}},2003:function(e,r,n){n.d(r,{j:function(){return s}});var t=n(512);let l=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=t.W,s=(e,r)=>n=>{var t;if((null==r?void 0:r.variants)==null)return a(e,null==n?void 0:n.class,null==n?void 0:n.className);let{variants:s,defaultVariants:i}=r,o=Object.keys(s).map(e=>{let r=null==n?void 0:n[e],t=null==i?void 0:i[e];if(null===r)return null;let a=l(r)||l(t);return s[e][a]}),d=n&&Object.entries(n).reduce((e,r)=>{let[n,t]=r;return void 0===t||(e[n]=t),e},{});return a(e,o,null==r?void 0:null===(t=r.compoundVariants)||void 0===t?void 0:t.reduce((e,r)=>{let{class:n,className:t,...l}=r;return Object.entries(l).every(e=>{let[r,n]=e;return Array.isArray(n)?n.includes({...i,...d}[r]):({...i,...d})[r]===n})?[...e,n,t]:e},[]),null==n?void 0:n.class,null==n?void 0:n.className)}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[350],{2350:function(n,r,u){u.d(r,{cn:function(){return c}});var e=u(512),t=u(8388);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))}}}]);
|
@@ -0,0 +1,6 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[37,211],{9037:function(e,s,t){t.r(s),t.d(s,{ClusterTable:function(){return O},Clusters:function(){return _},Status2Actions:function(){return W},enabledActions:function(){return L},handleVSCodeConnection:function(){return M}});var r=t(5893),n=t(7294),l=t(1163),a=t(8799),c=t(6989),i=t(1664),o=t.n(i),d=t(803),u=t(7673),h=t(8764),x=t(3266),p=t(7324),f=t(4545),m=t(3626),j=t(998);/**
|
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,j.Z)("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]),v=(0,j.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(9470);var w=t(9284),y=t(9307),N=t(3001),b=t(8950),k=t(6378),C=t(6856);t(1272);let S="__ALL_WORKSPACES__",R=(e,s)=>{let t="",r="";return e>=0&&(t=e+"m",r=" "),s&&(t+="".concat(r,"(down)")),""===t&&(t="-"),t};function _(){let e=(0,l.useRouter)(),[s,t]=(0,n.useState)(!1),i=n.useRef(null),[d,u]=(0,n.useState)(!1),[h,f]=(0,n.useState)(!1),[j,g]=(0,n.useState)(null),[v,y]=(0,n.useState)(S),[R,_]=(0,n.useState)([]),M=(0,N.X)();return(0,n.useEffect)(()=>{e.isReady&&e.query.workspace&&y(Array.isArray(e.query.workspace)?e.query.workspace[0]:e.query.workspace)},[e.isReady,e.query.workspace]),(0,n.useEffect)(()=>{(async()=>{try{await C.ZP.preloadForPage("clusters");let e=await k.default.get(p.fX),s=Object.keys(e),t=await k.default.get(x.getClusters),r=[...new Set(t.map(e=>e.workspace||"default").filter(e=>e))],n=new Set(s);r.includes("default")&&n.has("default"),r.forEach(e=>n.add(e)),_(Array.from(n).sort())}catch(e){console.error("Error fetching data for workspace filter:",e),_(["default"])}})()},[]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,r.jsxs)("div",{className:"text-base flex items-center",children:[(0,r.jsx)(o(),{href:"/clusters",className:"text-sky-blue hover:underline leading-none",children:"Sky Clusters"}),(0,r.jsxs)(b.Ph,{value:v,onValueChange:y,children:[(0,r.jsx)(b.i4,{className:"h-8 w-48 ml-4 mr-2 text-sm border-none focus:ring-0 focus:outline-none",children:(0,r.jsx)(b.ki,{placeholder:"Filter by workspace...",children:v===S?"All Workspaces":v})}),(0,r.jsxs)(b.Bw,{children:[(0,r.jsx)(b.Ql,{value:S,children:"All Workspaces"}),R.map(e=>(0,r.jsx)(b.Ql,{value:e,children:e},e))]})]})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[s&&(0,r.jsxs)("div",{className:"flex items-center mr-2",children:[(0,r.jsx)(a.Z,{size:15,className:"mt-0"}),(0,r.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),(0,r.jsxs)("button",{onClick:()=>{k.default.invalidate(x.getClusters),k.default.invalidate(p.fX),i.current&&i.current()},disabled:s,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,r.jsx)(m.Z,{className:"h-4 w-4 mr-1.5"}),!M&&(0,r.jsx)("span",{children:"Refresh"})]})]})]}),(0,r.jsx)(O,{refreshInterval:c.yc,setLoading:t,refreshDataRef:i,workspaceFilter:v,onOpenSSHModal:e=>{g(e),u(!0)},onOpenVSCodeModal:e=>{g(e),f(!0)}}),(0,r.jsx)(w.Oh,{isOpen:d,onClose:()=>u(!1),cluster:j}),(0,r.jsx)(w._R,{isOpen:h,onClose:()=>f(!1),cluster:j})]})}function O(e){let{refreshInterval:s,setLoading:t,refreshDataRef:l,workspaceFilter:i,onOpenSSHModal:p,onOpenVSCodeModal:m}=e,[j,g]=(0,n.useState)([]),[v,w]=(0,n.useState)({key:null,direction:"ascending"}),[N,b]=(0,n.useState)(!1),[C,_]=(0,n.useState)(!0),[O,M]=(0,n.useState)(1),[A,L]=(0,n.useState)(10),V=n.useCallback(async()=>{t(!0),b(!0),g(await k.default.get(x.getClusters)),t(!1),b(!1),_(!1)},[t]),z=n.useMemo(()=>{let e=j;return i&&i!==S&&(e=j.filter(e=>(e.workspace||"default").toLowerCase()===i.toLowerCase())),(0,f.R0)(e,v.key,v.direction)},[j,v,i]);n.useEffect(()=>{l&&(l.current=V)},[l,V]),(0,n.useEffect)(()=>{g([]);let e=!0;V();let t=setInterval(()=>{e&&V()},s);return()=>{e=!1,clearInterval(t)}},[s,V]),(0,n.useEffect)(()=>{M(1)},[j.length]);let E=e=>{let s="ascending";v.key===e&&"ascending"===v.direction&&(s="descending"),w({key:e,direction:s})},q=e=>v.key===e?"ascending"===v.direction?" ↑":" ↓":"",T=Math.ceil(z.length/A),Z=(O-1)*A,F=Z+A,H=z.slice(Z,F);return(0,r.jsxs)("div",{children:[(0,r.jsx)(u.Zb,{children:(0,r.jsxs)(h.iA,{children:[(0,r.jsx)(h.xD,{children:(0,r.jsxs)(h.SC,{children:[(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>E("status"),children:["Status",q("status")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>E("cluster"),children:["Cluster",q("cluster")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>E("user"),children:["User",q("user")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>E("workspace"),children:["Workspace",q("workspace")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>E("infra"),children:["Infra",q("infra")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>E("resources_str"),children:["Resources",q("resources_str")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>E("time"),children:["Started",q("time")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>E("autostop"),children:["Autostop",q("autostop")]}),(0,r.jsx)(h.ss,{children:"Actions"})]})}),(0,r.jsx)(h.RM,{children:N&&C?(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)(a.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]})})}):H.length>0?H.map((e,s)=>(0,r.jsxs)(h.SC,{children:[(0,r.jsx)(h.pj,{children:(0,r.jsx)(y.OE,{status:e.status})}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(o(),{href:"/clusters/".concat(e.cluster),className:"text-blue-600",children:e.cluster})}),(0,r.jsx)(h.pj,{children:e.user}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(o(),{href:"/workspaces",className:"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,c.GV)(e.time)}),(0,r.jsx)(h.pj,{children:R(e.autostop,e.to_down)}),(0,r.jsx)(h.pj,{className:"text-left",children:(0,r.jsx)(W,{cluster:e.cluster,status:e.status,onOpenSSHModal:p,onOpenVSCodeModal:m})})]},s)):(0,r.jsx)(h.SC,{children:(0,r.jsx)(h.pj,{colSpan:9,className:"text-center py-6 text-gray-500",children:"No active clusters"})})})]})}),j.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:A,onChange:e=>{L(parseInt(e.target.value,10)),M(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.jsxs)("div",{children:[Z+1," – ",Math.min(F,j.length)," of"," ",j.length]}),(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(d.z,{variant:"ghost",size:"icon",onClick:()=>{M(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)(d.z,{variant:"ghost",size:"icon",onClick:()=>{M(e=>Math.min(e+1,T))},disabled:O===T||0===T,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 M=(e,s)=>{s&&s(e)},A=(e,s)=>{s?s(e):window.open("ssh://".concat(e))},L=e=>"RUNNING"===e?["connect","VSCode"]:[],V={connect:(0,r.jsx)(g,{className:"w-4 h-4 text-gray-500 inline-block"}),VSCode:(0,r.jsx)(v,{className:"w-4 h-4 text-gray-500 inline-block"})};function W(e){let{withLabel:s=!1,cluster:t,status:n,onOpenSSHModal:l,onOpenVSCodeModal:a}=e,i=L(n),o=(0,N.X)(),d=e=>{switch(e){case"connect":A(t,l);break;case"VSCode":M(t,a);break;default:return}};return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("div",{className:"flex items-center space-x-4",children:Object.entries(V).map(e=>{let t,n,[l,a]=e;switch(l){case"connect":t="Connect",n="Connect with SSH";break;case"VSCode":t="VSCode",n="Open in VS Code"}return(s||(t=""),i.includes(l))?(0,r.jsx)(c.WH,{content:n,className:"capitalize text-sm text-muted-foreground",children:(0,r.jsxs)("button",{onClick:()=>d(l),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[a,!o&&(0,r.jsx)("span",{className:"ml-1.5",children:t})]})},l):(0,r.jsx)(c.WH,{content:n,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:[a,!o&&(0,r.jsx)("span",{className:"ml-1.5",children:t})]})},l)})})})}},803:function(e,s,t){t.d(s,{z:function(){return o}});var r=t(5893),n=t(7294),l=t(8426),a=t(2003),c=t(2350);let i=(0,a.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),o=n.forwardRef((e,s)=>{let{className:t,variant:n,size:a,asChild:o=!1,...d}=e,u=o?l.g7:"button";return(0,r.jsx)(u,{className:(0,c.cn)(i({variant:n,size:a,className:t})),ref:s,...d})});o.displayName="Button"},7673:function(e,s,t){t.d(s,{Ol:function(){return o},Zb:function(){return i},aY:function(){return h},eW:function(){return x},ll:function(){return d}});var r=t(5893),n=t(7294),l=t(5697),a=t.n(l),c=t(2350);let i=n.forwardRef((e,s)=>{let{className:t,children:n,...l}=e;return(0,r.jsx)("div",{ref:s,className:(0,c.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...l,children:n})});i.displayName="Card",i.propTypes={className:a().string,children:a().node};let o=n.forwardRef((e,s)=>{let{className:t,children:n,...l}=e;return(0,r.jsx)("div",{ref:s,className:(0,c.cn)("flex flex-col space-y-1.5 p-6",t),...l,children:n})});o.displayName="CardHeader",o.propTypes={className:a().string,children:a().node};let d=n.forwardRef((e,s)=>{let{className:t,children:n,...l}=e;return(0,r.jsx)("h3",{ref:s,className:(0,c.cn)("text-2xl font-semibold leading-none tracking-tight",t),...l,children:n})});d.displayName="CardTitle",d.propTypes={className:a().string,children:a().node};let u=n.forwardRef((e,s)=>{let{className:t,children:n,...l}=e;return(0,r.jsx)("p",{ref:s,className:(0,c.cn)("text-sm text-muted-foreground",t),...l,children:n})});u.displayName="CardDescription",u.propTypes={className:a().string,children:a().node};let h=n.forwardRef((e,s)=>{let{className:t,children:n,...l}=e;return(0,r.jsx)("div",{ref:s,className:(0,c.cn)("p-6 pt-0",t),...l,children:n})});h.displayName="CardContent",h.propTypes={className:a().string,children:a().node};let x=n.forwardRef((e,s)=>{let{className:t,children:n,...l}=e;return(0,r.jsx)("div",{ref:s,className:(0,c.cn)("flex items-center p-6 pt-0",t),...l,children:n})});x.displayName="CardFooter",x.propTypes={className:a().string,children:a().node}},2003:function(e,s,t){t.d(s,{j:function(){return a}});var r=t(512);let n=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,l=r.W,a=(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:a,defaultVariants:c}=s,i=Object.keys(a).map(e=>{let s=null==t?void 0:t[e],r=null==c?void 0:c[e];if(null===s)return null;let l=n(s)||n(r);return a[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,...n}=s;return Object.entries(n).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)}}}]);
|
@@ -0,0 +1,6 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[42,211],{9333:function(e,n,t){t.d(n,{Z:function(){return r}});/**
|
2
|
+
* @license lucide-react v0.407.0 - ISC
|
3
|
+
*
|
4
|
+
* This source code is licensed under the ISC license.
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
6
|
+
*/let r=(0,t(998).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"}]])},4042:function(e,n,t){t.r(n),t.d(n,{Config:function(){return x}});var r=t(5893),a=t(7294),l=t(1163),s=t(803),i=t(7673),o=t(7324),c=t(1812),d=t(8799),u=t(9333),f=t(1272),m=t(6989),h=t(7145);function p(){let[e,n]=(0,a.useState)(null),[t,l]=(0,a.useState)(null),s=async()=>{let e=await h.x.get("/api/health"),t=await e.json();t.version&&n(t.version),t.commit&&l(t.commit)};return((0,a.useEffect)(()=>{s()},[]),e)?(0,r.jsx)(m.Md,{content:t?"Commit: ".concat(t):"Commit information not available",className:"text-sm text-muted-foreground",children:(0,r.jsxs)("div",{className:"text-sm text-gray-500 cursor-help border-b border-dotted border-gray-400 inline-block",children:["Version: ",e]})}):null}function x(){let e=(0,l.useRouter)(),[n,t]=(0,a.useState)(""),[m,x]=(0,a.useState)(!0),[g,y]=(0,a.useState)(!1),[v,b]=(0,a.useState)(null),[j,N]=(0,a.useState)(!1),w=(0,a.useRef)(null);(0,a.useEffect)(()=>{k()},[]),(0,a.useEffect)(()=>()=>{w.current&&clearTimeout(w.current)},[]);let k=async()=>{x(!0),b(null);try{let e=await (0,o.iE)();0===Object.keys(e).length?t(""):t(f.ZP.dump(e,{indent:2}))}catch(e){console.error("Error loading config:",e),b(e)}finally{x(!1)}},R=async()=>{y(!0),b(null),w.current&&(clearTimeout(w.current),w.current=null);try{let e=await h.x.get("/users/role");if(!e.ok){let n=await e.json();throw Error(n.detail||"Failed to get user role")}let t=await e.json(),r=t.role;if("admin"!=r){b(Error("".concat(t.name," is logged in as non-admin and cannot edit config"))),y(!1);return}let a=f.ZP.load(n);if(null==a&&(a={}),"object"!=typeof a||Array.isArray(a)){let e="Invalid config structure: Configuration must be a mapping (key-value pairs) in YAML format.";Array.isArray(a),e="Invalid config structure: Configuration must be a mapping (key-value pairs) in YAML format.",b(Error(e)),y(!1);return}await (0,o.rF)(a),N(!0),w.current=setTimeout(()=>{N(!1),w.current=null},5e3)}catch(e){console.error("Error saving config:",e),b(e)}finally{y(!1)}};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,r.jsx)("div",{className:"text-base flex items-center",children:(0,r.jsx)("span",{className:"text-sky-blue",children:"SkyPilot Configuration"})}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("div",{className:"text-sm flex items-center",children:(m||g)&&(0,r.jsxs)("div",{className:"flex items-center mr-4",children:[(0,r.jsx)(d.Z,{size:15,className:"mt-0"}),(0,r.jsx)("span",{className:"ml-2 text-gray-500",children:g?"Applying...":"Loading..."})]})}),(0,r.jsx)(p,{})]})]}),(0,r.jsxs)(i.Zb,{className:"w-full",children:[(0,r.jsx)(i.Ol,{children:(0,r.jsx)(i.ll,{className:"text-base font-normal flex items-center justify-between",children:(0,r.jsx)("span",{children:"Edit SkyPilot API Server Configuration"})})}),(0,r.jsxs)(i.aY,{className:"space-y-4",children:[(0,r.jsxs)("p",{className:"text-sm text-gray-600 mb-3",children:["Refer to the"," ",(0,r.jsx)("a",{href:"https://docs.skypilot.co/en/latest/reference/config.html",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:"SkyPilot Docs"})," ","for details. The configuration should be in YAML format."]}),j&&(0,r.jsx)("div",{className:"bg-green-50 border border-green-200 rounded p-4 mb-6",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:(0,r.jsx)("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),(0,r.jsx)("div",{className:"ml-3",children:(0,r.jsx)("p",{className:"text-sm font-medium text-green-800",children:"Configuration saved successfully!"})})]}),(0,r.jsx)("div",{className:"ml-auto pl-3",children:(0,r.jsx)("div",{className:"-mx-1.5 -my-1.5",children:(0,r.jsxs)("button",{type:"button",onClick:()=>{N(!1),w.current&&(clearTimeout(w.current),w.current=null)},className:"inline-flex rounded-md bg-green-50 p-1.5 text-green-500 hover:bg-green-100 focus:outline-none focus:ring-2 focus:ring-green-600 focus:ring-offset-2 focus:ring-offset-green-50",children:[(0,r.jsx)("span",{className:"sr-only",children:"Dismiss"}),(0,r.jsx)("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})})]})}),v&&(0,r.jsx)("div",{className:"mb-6",children:(0,r.jsx)(c.X,{error:v,title:"Failed to apply new configuration",onDismiss:()=>b(null)})}),(0,r.jsx)("div",{className:"w-full",children:(0,r.jsx)("textarea",{value:n,onChange:e=>t(e.target.value),className:"w-full h-96 p-3 border border-gray-300 rounded font-mono text-sm resize-vertical focus:outline-none focus:ring-2 focus:ring-blue-500",placeholder:m?"Loading configuration...":"# Enter SkyPilot configuration in YAML format\n# Example:\n# kubernetes:\n# allowed_contexts: [default, my-context]",disabled:m||g})}),(0,r.jsxs)("div",{className:"flex justify-end space-x-3 pt-3",children:[(0,r.jsx)(s.z,{variant:"outline",onClick:()=>{e.push("/workspaces")},disabled:g,children:"Cancel"}),(0,r.jsx)(s.z,{onClick:R,disabled:m||g,className:"inline-flex items-center bg-blue-600 hover:bg-blue-700 text-white",children:g?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d.Z,{size:16,className:"mr-2"}),"Applying..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.Z,{className:"w-4 h-4 mr-1.5"}),"Apply"]})})]})]})]})]})}},1812:function(e,n,t){t.d(n,{X:function(){return s}});var r=t(5893),a=t(7294);let l=e=>{if(!(null==e?void 0:e.message))return"An unexpected error occurred.";let n=e.message;return n.includes("failed:")&&(n=n.split("failed:")[1].trim()),n},s=e=>{let{error:n,title:t="Error",onDismiss:s}=e,[i,o]=(0,a.useState)(!1);if((0,a.useEffect)(()=>{n&&o(!1)},[n]),!n||i)return null;let c="string"==typeof n?n:l(n);return(0,r.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:(0,r.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,r.jsx)("div",{className:"ml-3",children:(0,r.jsxs)("div",{className:"text-sm text-red-800",children:[(0,r.jsxs)("strong",{children:[t,":"]})," ",c]})})]}),(0,r.jsx)("button",{onClick:()=>{o(!0),s&&s()},className:"flex-shrink-0 ml-4 text-red-400 hover:text-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-50 rounded","aria-label":"Dismiss error",children:(0,r.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}},803:function(e,n,t){t.d(n,{z:function(){return c}});var r=t(5893),a=t(7294),l=t(8426),s=t(2003),i=t(2350);let o=(0,s.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=a.forwardRef((e,n)=>{let{className:t,variant:a,size:s,asChild:c=!1,...d}=e,u=c?l.g7:"button";return(0,r.jsx)(u,{className:(0,i.cn)(o({variant:a,size:s,className:t})),ref:n,...d})});c.displayName="Button"},7673:function(e,n,t){t.d(n,{Ol:function(){return c},Zb:function(){return o},aY:function(){return f},eW:function(){return m},ll:function(){return d}});var r=t(5893),a=t(7294),l=t(5697),s=t.n(l),i=t(2350);let o=a.forwardRef((e,n)=>{let{className:t,children:a,...l}=e;return(0,r.jsx)("div",{ref:n,className:(0,i.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...l,children:a})});o.displayName="Card",o.propTypes={className:s().string,children:s().node};let c=a.forwardRef((e,n)=>{let{className:t,children:a,...l}=e;return(0,r.jsx)("div",{ref:n,className:(0,i.cn)("flex flex-col space-y-1.5 p-6",t),...l,children:a})});c.displayName="CardHeader",c.propTypes={className:s().string,children:s().node};let d=a.forwardRef((e,n)=>{let{className:t,children:a,...l}=e;return(0,r.jsx)("h3",{ref:n,className:(0,i.cn)("text-2xl font-semibold leading-none tracking-tight",t),...l,children:a})});d.displayName="CardTitle",d.propTypes={className:s().string,children:s().node};let u=a.forwardRef((e,n)=>{let{className:t,children:a,...l}=e;return(0,r.jsx)("p",{ref:n,className:(0,i.cn)("text-sm text-muted-foreground",t),...l,children:a})});u.displayName="CardDescription",u.propTypes={className:s().string,children:s().node};let f=a.forwardRef((e,n)=>{let{className:t,children:a,...l}=e;return(0,r.jsx)("div",{ref:n,className:(0,i.cn)("p-6 pt-0",t),...l,children:a})});f.displayName="CardContent",f.propTypes={className:s().string,children:s().node};let m=a.forwardRef((e,n)=>{let{className:t,children:a,...l}=e;return(0,r.jsx)("div",{ref:n,className:(0,i.cn)("flex items-center p-6 pt-0",t),...l,children:a})});m.displayName="CardFooter",m.propTypes={className:s().string,children:s().node}},8950:function(e,n,t){t.d(n,{Bw:function(){return p},Ph:function(){return d},Ql:function(){return x},i4:function(){return f},ki:function(){return u}});var r=t(5893),a=t(7294),l=t(2067),s=t(5895),i=t(7242),o=t(282),c=t(2350);let d=l.fC;l.ZA;let u=l.B4,f=a.forwardRef((e,n)=>{let{className:t,children:a,...i}=e;return(0,r.jsxs)(l.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),...i,children:[a,(0,r.jsx)(l.JO,{asChild:!0,children:(0,r.jsx)(s.Z,{className:"h-4 w-4 opacity-50"})})]})});f.displayName=l.xz.displayName;let m=a.forwardRef((e,n)=>{let{className:t,...a}=e;return(0,r.jsx)(l.u_,{ref:n,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",t),...a,children:(0,r.jsx)(i.Z,{className:"h-4 w-4"})})});m.displayName=l.u_.displayName;let h=a.forwardRef((e,n)=>{let{className:t,...a}=e;return(0,r.jsx)(l.$G,{ref:n,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",t),...a,children:(0,r.jsx)(s.Z,{className:"h-4 w-4"})})});h.displayName=l.$G.displayName;let p=a.forwardRef((e,n)=>{let{className:t,children:a,position:s="popper",...i}=e;return(0,r.jsx)(l.h_,{children:(0,r.jsxs)(l.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,...i,children:[(0,r.jsx)(m,{}),(0,r.jsx)(l.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:a}),(0,r.jsx)(h,{})]})})});p.displayName=l.VY.displayName,a.forwardRef((e,n)=>{let{className:t,...a}=e;return(0,r.jsx)(l.__,{ref:n,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...a})}).displayName=l.__.displayName;let x=a.forwardRef((e,n)=>{let{className:t,children:a,...s}=e;return(0,r.jsxs)(l.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)(l.wU,{children:(0,r.jsx)(o.Z,{className:"h-4 w-4"})})}),(0,r.jsx)(l.eT,{children:a})]})});x.displayName=l.ck.displayName,a.forwardRef((e,n)=>{let{className:t,...a}=e;return(0,r.jsx)(l.Z0,{ref:n,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",t),...a})}).displayName=l.Z0.displayName},6989:function(e,n,t){t.d(n,{$B:function(){return g},GV:function(){return d},LU:function(){return p},Md:function(){return h},WH:function(){return m},o0:function(){return u},q8:function(){return x},yc:function(){return o}});var r=t(5893),a=t(7294),l=t(3302),s=t(1886),i=t(8950);let o=t(1214).nb.REFRESH_INTERVAL;function c(e){return e.charAt(0).toUpperCase()+e.slice(1)}function d(e){if(!e)return"N/A";let n=new Date;if(!(7>Math.abs((n-e)/864e5)))return(0,r.jsx)(m,{content:c(u(e)),className:"text-sm text-muted-foreground",children:c(e.toLocaleString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}).replace(",",""))});{let t=function(e){if(!e||"string"!=typeof e)return e;if("just now"===e)return"now";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)(e,n,{addSuffix:!0}));return(0,r.jsx)(m,{content:u(e),className:"capitalize text-sm text-muted-foreground",children:t})}}function u(e){return e.toLocaleString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZoneName:"short"}).replace(",","")}let f={placement:"bottom",color:"default"},m=e=>{let{children:n,...t}=e,a=t.content;return t.content=void 0,(0,r.jsx)(l.e,{...f,...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:a}),children:n})},h=e=>{let{children:n,...t}=e,a=t.content;return t.content=void 0,(0,r.jsx)(l.e,{...f,...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:a}),children:n})};function p(e){if(!e&&0!==e)return"-";let n=e=Math.floor(e),t="",r=0;for(let e of[{value:86400,label:"d"},{value:3600,label:"h"},{value:60,label:"m"},{value:1,label:"s"}])if(n>=e.value&&r<2){let a=Math.floor(n/e.value);t+="".concat(a).concat(e.label," "),n%=e.value,r++}return t.trim()||"0s"}function x(e){return e?(e=e.split("\n").filter(e=>!e.match(/<rich_.*?\[bold cyan\]/)&&!e.match(/<rich_.*>.*<\/rich_.*>/)&&!e.match(/├──/)&&!e.match(/└──/)).join("\n").replace(/\x1b\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGKH]/g,"")).split("\n").map(e=>{let n=e.match(/^([IWED])\s+(\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})\s+([^:]+:\d+\])(.*)/);if(n){let[e,t,r,a,l]=n,s={I:"INFO",W:"WARNING",E:"ERROR",D:"DEBUG"}[t]||"";return'<span class="log-line '.concat(s,'"><span class="level">').concat(t,'</span><span class="timestamp">').concat(r,'</span><span class="location">').concat(a,'</span><span class="message">').concat(l,"</span></span>")}let t=e.match(/^(\([^)]+\))(.*)$/);if(t){let[e,n,r]=t;return'<span class="log-line"><span class="log-prefix">'.concat(n,'</span><span class="log-rest">').concat(r,"</span></span>")}return'<span class="log-line"><span class="message">'.concat(e,"</span></span>")}).join("\n"):""}function g(e){let{logs:n,controller:t=!1}=e,[l,s]=(0,a.useState)("all"),[o,c]=(0,a.useState)(n),[d,u]=(0,a.useState)([]);return(0,a.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,a.useEffect)(()=>{"all"===l?c(n):c(n.split("\n").filter(e=>e.includes("(".concat(l,","))).join("\n"))},[l,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)(i.Ph,{onValueChange:e=>s(e),value:l,children:[(0,r.jsx)(i.i4,{"aria-label":"Node",className:"focus:ring-0 focus:ring-offset-0",children:(0,r.jsx)(i.ki,{placeholder:"Select Node"})}),(0,r.jsxs)(i.Bw,{children:[(0,r.jsx)(i.Ql,{value:"all",children:"All Nodes"}),d.map(e=>(0,r.jsx)(i.Ql,{value:e,children:e},e))]})]})}),(0,r.jsx)("div",{className:"logs-container",dangerouslySetInnerHTML:{__html:o}})]})}},1214:function(e,n,t){t.d(n,{MO:function(){return l},ej:function(){return r},nb:function(){return a}});let r={DEFAULT_TTL:12e4},a={REFRESH_INTERVAL:3e4,GPU_REFRESH_INTERVAL:3e4},l={NAME_TRUNCATE_LENGTH:20}},2003:function(e,n,t){t.d(n,{j:function(){return s}});var r=t(512);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,l=r.W,s=(e,n)=>t=>{var r;if((null==n?void 0:n.variants)==null)return l(e,null==t?void 0:t.class,null==t?void 0:t.className);let{variants:s,defaultVariants:i}=n,o=Object.keys(s).map(e=>{let n=null==t?void 0:t[e],r=null==i?void 0:i[e];if(null===n)return null;let l=a(n)||a(r);return s[e][l]}),c=t&&Object.entries(t).reduce((e,n)=>{let[t,r]=n;return void 0===r||(e[t]=r),e},{});return l(e,o,null==n?void 0:null===(r=n.compoundVariants)||void 0===r?void 0:r.reduce((e,n)=>{let{class:t,className:r,...a}=n;return Object.entries(a).every(e=>{let[n,t]=e;return Array.isArray(t)?t.includes({...i,...c}[n]):({...i,...c})[n]===t})?[...e,t,r]:e},[]),null==t?void 0:t.class,null==t?void 0:t.className)}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[443,211],{1812:function(e,s,r){r.d(s,{X:function(){return a}});var t=r(5893),n=r(7294);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,[i,c]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{s&&c(!1)},[s]),!s||i)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:()=>{c(!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"})})})]})})}},803:function(e,s,r){r.d(s,{z:function(){return o}});var t=r(5893),n=r(7294),l=r(8426),a=r(2003),i=r(2350);let c=(0,a.j)("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),o=n.forwardRef((e,s)=>{let{className:r,variant:n,size:a,asChild:o=!1,...d}=e,u=o?l.g7:"button";return(0,t.jsx)(u,{className:(0,i.cn)(c({variant:n,size:a,className:r})),ref:s,...d})});o.displayName="Button"},7673:function(e,s,r){r.d(s,{Ol:function(){return o},Zb:function(){return c},aY:function(){return m},eW:function(){return x},ll:function(){return d}});var t=r(5893),n=r(7294),l=r(5697),a=r.n(l),i=r(2350);let c=n.forwardRef((e,s)=>{let{className:r,children:n,...l}=e;return(0,t.jsx)("div",{ref:s,className:(0,i.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",r),...l,children:n})});c.displayName="Card",c.propTypes={className:a().string,children:a().node};let o=n.forwardRef((e,s)=>{let{className:r,children:n,...l}=e;return(0,t.jsx)("div",{ref:s,className:(0,i.cn)("flex flex-col space-y-1.5 p-6",r),...l,children:n})});o.displayName="CardHeader",o.propTypes={className:a().string,children:a().node};let d=n.forwardRef((e,s)=>{let{className:r,children:n,...l}=e;return(0,t.jsx)("h3",{ref:s,className:(0,i.cn)("text-2xl font-semibold leading-none tracking-tight",r),...l,children:n})});d.displayName="CardTitle",d.propTypes={className:a().string,children:a().node};let u=n.forwardRef((e,s)=>{let{className:r,children:n,...l}=e;return(0,t.jsx)("p",{ref:s,className:(0,i.cn)("text-sm text-muted-foreground",r),...l,children:n})});u.displayName="CardDescription",u.propTypes={className:a().string,children:a().node};let m=n.forwardRef((e,s)=>{let{className:r,children:n,...l}=e;return(0,t.jsx)("div",{ref:s,className:(0,i.cn)("p-6 pt-0",r),...l,children:n})});m.displayName="CardContent",m.propTypes={className:a().string,children:a().node};let x=n.forwardRef((e,s)=>{let{className:r,children:n,...l}=e;return(0,t.jsx)("div",{ref:s,className:(0,i.cn)("flex items-center p-6 pt-0",r),...l,children:n})});x.displayName="CardFooter",x.propTypes={className:a().string,children:a().node}},5443:function(e,s,r){r.r(s),r.d(s,{Workspaces:function(){return D}});var t=r(5893),n=r(7294),l=r(1163),a=r(3266),i=r(8969),c=r(7324),o=r(7673),d=r(803),u=r(8799),m=r(1272),x=r(326),h=r(3850),f=r(1812),p=r(3626),g=r(3001),j=r(938),v=r(6378),N=r(1214),b=r(6856),y=r(7145);let w=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-amber-100 text-amber-800 border border-amber-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-800 border border-green-300",children:"Public"})},k=e=>{let{workspace:s,onDelete:r,onEdit:n,router:l,rawWorkspacesData:a,checkPermissionAndAct:i,roleLoading:c}=e,m=!0===((null==a?void 0:a[s.name])||{}).private;return(0,t.jsxs)(o.Zb,{children:[(0,t.jsx)(o.Ol,{children:(0,t.jsx)(o.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.name]}),(0,t.jsx)(w,{isPrivate:m})]})})}),(0,t.jsxs)(o.aY,{className:"text-sm pb-2",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)(h.QT,{className:"w-4 h-4 mr-2 text-gray-500"}),(0,t.jsx)("span",{children:"Clusters (Running / Total)"})]}),(0,t.jsxs)("button",{onClick:()=>{l.push({pathname:"/clusters",query:{workspace:s.name}})},className:"font-normal text-blue-600 hover:text-blue-800 hover:underline cursor-pointer",children:[s.runningClusterCount," / ",s.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)(h.Vp,{className:"w-4 h-4 mr-2 text-gray-500"}),(0,t.jsx)("span",{children:"Managed Jobs"})]}),(0,t.jsx)("button",{onClick:()=>{l.push({pathname:"/jobs",query:{workspace:s.name}})},className:"font-normal text-blue-600 hover:text-blue-800 hover:underline cursor-pointer",children:s.managedJobsCount})]})]}),(0,t.jsxs)("div",{className:"px-6 pb-3 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:s.clouds.map(e=>(0,t.jsxs)("div",{className:"flex items-center text-gray-700",children:[(0,t.jsx)(h.Ye,{className:"w-3.5 h-3.5 mr-1.5 text-green-500"}),(0,t.jsx)("span",{children:e})]},e))})]}),(0,t.jsxs)(o.eW,{className:"flex justify-end pt-3 gap-2",children:[(0,t.jsx)(d.z,{variant:"outline",size:"sm",onClick:()=>r(s.name),disabled:"default"===s.name||c,title:"default"===s.name?"Cannot delete default workspace":"Delete workspace",className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:c?(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(u.Z,{size:12,className:"mr-1"}),(0,t.jsx)("span",{children:"Delete"})]}):"Delete"}),(0,t.jsx)(d.z,{variant:"outline",size:"sm",onClick:()=>{i("cannot edit workspace",()=>{n(s.name)})},disabled:c,children:c?(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(u.Z,{size:12,className:"mr-1"}),(0,t.jsx)("span",{children:"Edit"})]}):"Edit"})]})]},s.name)},C=e=>{let{onClick:s,checkPermissionAndAct:r,roleLoading:n}=e;return(0,t.jsx)(o.Zb,{className:"border-2 border-dashed border-sky-300 hover:border-sky-400 cursor-pointer transition-colors flex flex-col",onClick:()=>{r("cannot create workspace",s)},children:(0,t.jsx)("div",{className:"flex-1 flex items-center justify-center p-6",children:(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"w-16 h-16 rounded-full bg-sky-100 flex items-center justify-center mb-4 mx-auto",children:(0,t.jsx)("span",{className:"text-3xl text-sky-600",children:"+"})}),(0,t.jsx)("h3",{className:"text-lg font-medium text-sky-700 mb-2",children:"Create New Workspace"}),(0,t.jsx)("p",{className:"text-sm text-gray-500",children:"Set up a new workspace with custom infrastructure configurations"})]})})},"create-new")},E=e=>{let{workspaceCount:s,runningClusters:r,totalClusters:n,managedJobs:l,router:a}=e;return(0,t.jsx)("div",{className:"bg-sky-50 p-4 rounded-lg shadow mb-6",children:(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row justify-around items-center",children:[(0,t.jsx)("div",{className:"p-2",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(h.E9,{className:"w-5 h-5 mr-2 text-sky-600"}),(0,t.jsx)("span",{className:"text-sm text-gray-600",children:"Workspaces:"}),(0,t.jsx)("span",{className:"ml-1 text-xl font-semibold text-sky-700",children:s})]})}),(0,t.jsx)("div",{className:"p-2",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(h.QT,{className:"w-5 h-5 mr-2 text-sky-600"}),(0,t.jsx)("span",{className:"text-sm text-gray-600",children:"Clusters (Running / Total):"}),(0,t.jsxs)("button",{onClick:()=>a.push("/clusters"),className:"ml-1 text-xl font-semibold text-blue-600 hover:text-blue-800 hover:underline cursor-pointer",children:[r," / ",n]})]})}),(0,t.jsx)("div",{className:"p-2",children:(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(h.Vp,{className:"w-5 h-5 mr-2 text-sky-600"}),(0,t.jsx)("span",{className:"text-sm text-gray-600",children:"Managed Jobs:"}),(0,t.jsx)("button",{onClick:()=>a.push("/jobs"),className:"ml-1 text-xl font-semibold text-blue-600 hover:text-blue-800 hover:underline cursor-pointer",children:l})]})})]})})},z=N.nb.REFRESH_INTERVAL;function D(){let[e,s]=(0,n.useState)([]),[r,o]=(0,n.useState)({runningClusters:0,totalClusters:0,managedJobs:0}),[h,N]=(0,n.useState)(!0),[w,D]=(0,n.useState)(null),[R,T]=(0,n.useState)(!1),[O,S]=(0,n.useState)({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null}),[A,Z]=(0,n.useState)({open:!1,message:"",userName:""}),[L,J]=(0,n.useState)(null),[P,W]=(0,n.useState)(!1),F=(0,l.useRouter)(),V=(0,g.X)(),M=async()=>{if(L&&Date.now()-L.timestamp<3e5)return L;W(!0);try{let e=await y.x.get("/users/role");if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to get user role")}let s=await e.json(),r={role:s.role,name:s.name,timestamp:Date.now()};return J(r),W(!1),r}catch(e){throw W(!1),e}},X=async(e,s)=>{try{let r=await M();if("admin"!==r.role)return Z({open:!0,message:e,userName:r.name.toLowerCase()}),!1;return s(),!0}catch(e){return console.error("Failed to check user role:",e),Z({open:!0,message:"Error: ".concat(e.message),userName:""}),!1}},_=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&N(!0);try{let[e,r,t]=await Promise.all([v.default.get(c.fX),v.default.get(a.getClusters),v.default.get(i.getManagedJobs,[{allUsers:!0}])]);D(e);let n=Object.keys(e),l=await Promise.all(n.map(e=>v.default.get(c.yz,[e]))),d=Object.fromEntries(n.map((e,s)=>[e,l[s]])),u=Object.fromEntries(r.map(e=>[e.cluster,e.workspace||"default"])),m={};n.forEach(e=>{m[e]={name:e,totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:new Set}});let x=0;r.forEach(e=>{let s=e.workspace||"default";m[s]||(m[s]={name:s,totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:new Set}),m[s].totalClusterCount++,("RUNNING"===e.status||"LAUNCHING"===e.status)&&(m[s].runningClusterCount++,x++),e.cloud&&m[s].clouds.add(e.cloud)});let h=t.jobs||[],f=new Set(j.statusGroups.active),p=0;h.forEach(e=>{let s=e.cluster_name||e.resources&&e.resources.cluster_name;if(s){let r=u[s];r&&m[r]&&f.has(e.status)&&m[r].managedJobsCount++}f.has(e.status)&&p++});let g=Object.values(m).filter(e=>n.includes(e.name)).map(e=>({...e,clouds:Array.isArray(d[e.name])?d[e.name]:[]})).sort((e,s)=>e.name.localeCompare(s.name));s(g),o({runningClusters:x,totalClusters:r.length,managedJobs:p})}catch(e){console.error("Error fetching workspace data:",e),s([]),o({runningClusters:0,totalClusters:0,managedJobs:0})}e&&N(!1)};(0,n.useEffect)(()=>{(async()=>{await b.ZP.preloadForPage("workspaces"),_(!0)})();let e=setInterval(()=>{_(!1)},z);return()=>clearInterval(e)},[]);let B=e=>{X("cannot delete workspace",()=>{S({confirmOpen:!0,workspaceToDelete:e,deleting:!1,error:null})})},I=async()=>{if(O.workspaceToDelete){S(e=>({...e,deleting:!0,error:null}));try{await (0,c.zl)(O.workspaceToDelete),S({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null}),v.default.invalidate(c.fX),await _(!0)}catch(e){console.error("Error deleting workspace:",e),S(s=>({...s,deleting:!1,error:e}))}}},q=()=>{S({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null})};return h&&0===e.length?(0,t.jsxs)("div",{className:"flex justify-center items-center h-64",children:[(0,t.jsx)(u.Z,{}),(0,t.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading workspaces..."})]}):(0,t.jsxs)("div",{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)("span",{className:"text-sky-blue leading-none",children:"Workspaces"}),(0,t.jsx)(d.z,{variant:"outline",size:"sm",onClick:()=>{X("cannot edit config",()=>{F.push("/config")})},className:"ml-4 px-2 py-1 text-xs",disabled:h||P||!w||0===Object.keys(w).length,children:P?(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(u.Z,{size:12,className:"mr-1"}),(0,t.jsx)("span",{children:"Edit All Configs"})]}):"Edit All Configs"})]}),(0,t.jsxs)("div",{className:"flex items-center",children:[h&&(0,t.jsxs)("div",{className:"flex items-center mr-2",children:[(0,t.jsx)(u.Z,{size:15,className:"mt-0"}),(0,t.jsx)("span",{className:"ml-2 text-gray-500 text-xs",children:"Refreshing..."})]}),(0,t.jsxs)("button",{onClick:()=>{v.default.invalidate(c.fX),v.default.invalidate(a.getClusters),v.default.invalidate(i.getManagedJobs,[{allUsers:!0}]),v.default.invalidateFunction(c.yz),_(!0)},disabled:h,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,t.jsx)(p.Z,{className:"h-4 w-4 mr-1.5"}),!V&&(0,t.jsx)("span",{children:"Refresh"})]})]})]}),(0,t.jsx)(E,{workspaceCount:e.length,runningClusters:r.runningClusters,totalClusters:r.totalClusters,managedJobs:r.managedJobs,router:F}),0!==e.length||h?(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[e.map(e=>(0,t.jsx)(k,{workspace:e,onDelete:B,onEdit:e=>F.push("/workspaces/".concat(e)),router:F,rawWorkspacesData:w,checkPermissionAndAct:X,roleLoading:P},e.name)),(0,t.jsx)(C,{onClick:()=>F.push("/workspace/new"),checkPermissionAndAct:X,roleLoading:P})]}):(0,t.jsxs)("div",{className:"text-center py-10",children:[(0,t.jsx)("p",{className:"text-lg text-gray-600",children:"No workspaces found."}),(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-2",children:"Create a cluster to see its workspace here."})]}),w&&(0,t.jsx)(x.Vq,{open:R,onOpenChange:T,children:(0,t.jsxs)(x.cZ,{className:"sm:max-w-md md:max-w-lg lg:max-w-xl xl:max-w-2xl w-full max-h-[90vh] flex flex-col",children:[(0,t.jsx)(x.fK,{children:(0,t.jsx)(x.$N,{className:"pr-10",children:"All Workspaces Configuration"})}),(0,t.jsx)("div",{className:"flex-grow overflow-y-auto py-4",children:(0,t.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",overflowX:"auto",whiteSpace:"pre",wordBreak:"normal"},children:m.ZP.dump(w,{indent:2})})})]})}),(0,t.jsx)(x.Vq,{open:A.open,onOpenChange:e=>Z(s=>({...s,open:e})),children:(0,t.jsxs)(x.cZ,{className:"sm:max-w-md transition-all duration-200 ease-in-out",children:[(0,t.jsxs)(x.fK,{children:[(0,t.jsx)(x.$N,{children:"Permission Denied"}),(0,t.jsx)(x.Be,{children:P?(0,t.jsxs)("div",{className:"flex items-center py-2",children:[(0,t.jsx)(u.Z,{size:16,className:"mr-2"}),(0,t.jsx)("span",{children:"Checking permissions..."})]}):(0,t.jsx)(t.Fragment,{children:A.userName?(0,t.jsxs)(t.Fragment,{children:[A.userName," is logged in as non-admin and ",A.message,"."]}):A.message})})]}),(0,t.jsx)(x.cN,{children:(0,t.jsx)(d.z,{variant:"outline",onClick:()=>Z(e=>({...e,open:!1})),disabled:P,children:"OK"})})]})}),(0,t.jsx)(x.Vq,{open:O.confirmOpen,onOpenChange:q,children:(0,t.jsxs)(x.cZ,{className:"sm:max-w-md",children:[(0,t.jsxs)(x.fK,{children:[(0,t.jsx)(x.$N,{children:"Delete Workspace"}),(0,t.jsxs)(x.Be,{children:['Are you sure you want to delete workspace "',O.workspaceToDelete,'"? This action cannot be undone.']})]}),(0,t.jsx)(f.X,{error:O.error,title:"Deletion Failed",onDismiss:()=>S(e=>({...e,error:null}))}),(0,t.jsxs)(x.cN,{children:[(0,t.jsx)(d.z,{variant:"outline",onClick:q,disabled:O.deleting,children:"Cancel"}),(0,t.jsx)(d.z,{variant:"destructive",onClick:I,disabled:O.deleting,children:O.deleting?"Deleting...":"Delete"})]})]})})]})}},2003:function(e,s,r){r.d(s,{j:function(){return a}});var t=r(512);let n=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,l=t.W,a=(e,s)=>r=>{var t;if((null==s?void 0:s.variants)==null)return l(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:a,defaultVariants:i}=s,c=Object.keys(a).map(e=>{let s=null==r?void 0:r[e],t=null==i?void 0:i[e];if(null===s)return null;let l=n(s)||n(t);return a[e][l]}),o=r&&Object.entries(r).reduce((e,s)=>{let[r,t]=s;return void 0===t||(e[r]=t),e},{});return l(e,c,null==s?void 0:null===(t=s.compoundVariants)||void 0===t?void 0:t.reduce((e,s)=>{let{class:r,className:t,...n}=s;return Object.entries(n).every(e=>{let[s,r]=e;return Array.isArray(r)?r.includes({...i,...o}[s]):({...i,...o})[s]===r})?[...e,r,t]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}}}]);
|
@@ -0,0 +1 @@
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[470],{3850:function(e,t,n){n.d(t,{E9:function(){return w},J$:function(){return l},PC:function(){return x},Ps:function(){return i},QT:function(){return u},Vp:function(){return h},W2:function(){return a},Ye:function(){return c},aD:function(){return j},fp:function(){return d},fy:function(){return m},h0:function(){return f},mU:function(){return g},oy:function(){return y},r7:function(){return p}});var r=n(5893);n(7294);var s=n(8507),o=n(8586);function i(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 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:"currentColor",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,r.jsx)("circle",{cx:"10",cy:"10",r:"8"})})}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:"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)("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 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)("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 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)("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 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)("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 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:"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 g(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 w(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=s.Z,y=o.Z},9470:function(e,t,n){n.r(t),n.d(t,{Layout:function(){return y}});var r=n(5893),s=n(7294),o=n(5675),i=n.n(o),a=n(1163),l=n(1664),c=n.n(l),d=n(3850),u=n(355),h=n(6021),x=n(3225),f=n(6989),m=n(3001);let p=(0,s.createContext)(null);function g(e){let{children:t}=e,[n,o]=(0,s.useState)(!0),[i,a]=(0,s.useState)(null),[l,c]=(0,s.useState)(null),d=window.location.origin,u="".concat(d).concat(x.f4);return(0,s.useEffect)(()=>{fetch("".concat(u,"/api/health")).then(e=>e.json()).then(e=>{e.user&&e.user.name&&(a(e.user.name),(async()=>{try{let e=await fetch("".concat(u,"/users/role"));if(e.ok){let t=await e.json();t.role&&c(t.role)}}catch(e){console.log("Could not fetch user role:",e)}})())}).catch(e=>{console.error("Error fetching user data:",e)})},[u]),(0,r.jsx)(p.Provider,{value:{isSidebarOpen:n,toggleSidebar:()=>{o(e=>!e)},userEmail:i,userRole:l},children:t})}function w(){let e,t;let n=(0,a.useRouter)(),o=(0,m.X)(),{userEmail:l,userRole:g}=function(){let e=(0,s.useContext)(p);if(!e)throw Error("useSidebar must be used within a SidebarProvider");return e}(),[w,j]=(0,s.useState)(!1),y=(0,s.useRef)(null);(0,s.useEffect)(()=>{function e(e){y.current&&!y.current.contains(e.target)&&j(!1)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[y]);let v=e=>"/workspaces"===e?n.pathname.startsWith("/workspaces")||n.pathname.startsWith("/workspace"):n.pathname.startsWith(e),b=e=>{let t=v(e);return"inline-flex items-center border-b-2 ".concat(t?"border-transparent text-blue-600":"border-transparent hover:text-blue-600"," ").concat(o?"px-2 py-1":"px-1 pt-1 space-x-2")};return(0,r.jsx)("div",{className:"fixed top-0 left-0 right-0 bg-white z-30 h-14 px-4 border-b border-gray-200 shadow-sm",children:(0,r.jsxs)("div",{className:"flex items-center h-full",children:[(0,r.jsx)("div",{className:"flex items-center ".concat(o?"space-x-2 mr-2":"space-x-4 mr-6"),children:(0,r.jsx)(c(),{href:"/",className:"flex items-center px-1 pt-1 h-full",prefetch:!1,children:(0,r.jsx)("div",{className:"h-20 w-20 flex items-center justify-center",children:(0,r.jsx)(i(),{src:"".concat(x.GW,"/skypilot.svg"),alt:"SkyPilot Logo",width:80,height:80,priority:!0,className:"w-full h-full object-contain"})})})}),(0,r.jsxs)("div",{className:"flex items-center ".concat(o?"space-x-1":"space-x-2 md:space-x-4"," ").concat(o?"mr-2":"mr-6"),children:[(0,r.jsxs)(c(),{href:"/clusters",className:b("/clusters"),prefetch:!1,children:[(0,r.jsx)(d.QT,{className:"w-4 h-4"}),!o&&(0,r.jsx)("span",{children:"Clusters"})]}),(0,r.jsxs)(c(),{href:"/jobs",className:b("/jobs"),prefetch:!1,children:[(0,r.jsx)(d.Vp,{className:"w-4 h-4"}),!o&&(0,r.jsx)("span",{children:"Jobs"})]}),(0,r.jsx)("div",{className:"border-l border-gray-200 h-6 mx-1"}),(0,r.jsxs)(c(),{href:"/infra",className:b("/infra"),prefetch:!1,children:[(0,r.jsx)(d.PC,{className:"w-4 h-4"}),!o&&(0,r.jsx)("span",{children:"Infra"})]}),(0,r.jsxs)(c(),{href:"/workspaces",className:b("/workspaces"),prefetch:!1,children:[(0,r.jsx)(d.E9,{className:"w-4 h-4"}),!o&&(0,r.jsx)("span",{children:"Workspaces"})]}),(0,r.jsxs)(c(),{href:"/users",className:b("/users"),prefetch:!1,children:[(0,r.jsx)(d.oy,{className:"w-4 h-4"}),!o&&(0,r.jsx)("span",{children:"Users"})]})]}),(0,r.jsxs)("div",{className:"flex items-center space-x-1 ".concat(o?"ml-0":"ml-auto"),children:[(0,r.jsx)(f.WH,{content:"Documentation",className:"text-sm text-muted-foreground",children:(0,r.jsxs)("a",{href:"https://skypilot.readthedocs.io/en/latest/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center px-2 py-1 text-gray-600 hover:text-blue-600 transition-colors duration-150 cursor-pointer",title:"Docs",children:[!o&&(0,r.jsx)("span",{className:"mr-1",children:"Docs"}),(0,r.jsx)(d.h0,{className:"".concat(o?"w-4 h-4":"w-3.5 h-3.5")})]})}),(0,r.jsx)(f.WH,{content:"GitHub Repository",className:"text-sm text-muted-foreground",children:(0,r.jsx)("a",{href:"https://github.com/skypilot-org/skypilot",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"GitHub",children:(0,r.jsx)(d.fy,{className:"".concat(o?"w-4 h-4":"w-5 h-5")})})}),(0,r.jsx)(f.WH,{content:"Join Slack",className:"text-sm text-muted-foreground",children:(0,r.jsx)("a",{href:"https://slack.skypilot.co/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"Slack",children:(0,r.jsx)(d.mU,{className:"".concat(o?"w-4 h-4":"w-5 h-5")})})}),(0,r.jsx)(f.WH,{content:"Leave Feedback",className:"text-sm text-muted-foreground",children:(0,r.jsx)("a",{href:"https://github.com/skypilot-org/skypilot/issues/new",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"Leave Feedback",children:(0,r.jsx)(d.aD,{className:"".concat(o?"w-4 h-4":"w-5 h-5")})})}),(0,r.jsx)("div",{className:"border-l border-gray-200 h-6"}),(0,r.jsx)(f.WH,{content:"Configuration",className:"text-sm text-muted-foreground",children:(0,r.jsx)(c(),{href:"/config",className:"inline-flex items-center justify-center p-2 rounded-full transition-colors duration-150 cursor-pointer ".concat(v("/config")?"text-blue-600 hover:bg-gray-100":"text-gray-600 hover:bg-gray-100"),title:"Configuration",prefetch:!1,children:(0,r.jsx)(u.Z,{className:"".concat(o?"w-4 h-4":"w-5 h-5")})})}),l&&(0,r.jsxs)("div",{className:"relative",ref:y,children:[(0,r.jsx)("button",{onClick:()=>j(!w),className:"inline-flex items-center justify-center rounded-full transition-colors duration-150 cursor-pointer hover:ring-2 hover:ring-blue-200",title:"User Profile",children:(0,r.jsx)("div",{className:"".concat(o?"w-6 h-6":"w-7 h-7"," bg-blue-600 text-white rounded-full flex items-center justify-center font-medium ").concat(o?"text-xs":"text-sm"," hover:bg-blue-700 transition-colors"),children:l?l.includes("@")?l.split("@")[0].charAt(0).toUpperCase():l.charAt(0).toUpperCase():"?"})}),w&&(0,r.jsxs)("div",{className:"absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg z-50 border border-gray-200",children:[(e=l,t=null,l&&l.includes("@")&&(e=l.split("@")[0],t=l),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"px-4 pt-2 pb-1 text-sm font-medium text-gray-900",children:e}),t&&(0,r.jsx)("div",{className:"px-4 pt-0 pb-1 text-xs text-gray-500",children:t}),g&&(0,r.jsx)("div",{className:"px-4 pt-0 pb-2 text-xs",children:"admin"===g?(0,r.jsxs)("span",{className:"inline-flex items-center text-blue-600",children:[(0,r.jsx)(d.r7,{className:"w-3 h-3 mr-1"}),"Admin"]}):(0,r.jsxs)("span",{className:"inline-flex items-center text-gray-600",children:[(0,r.jsx)(h.Z,{className:"w-3 h-3 mr-1"}),"User"]})})]})),(0,r.jsx)("div",{className:"border-t border-gray-200 mx-1 my-1"}),(0,r.jsx)(c(),{href:"/users",className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 hover:text-blue-600",onClick:()=>j(!1),prefetch:!1,children:"See all users"})]})]})]})]})})}function j(e){let{children:t,highlighted:n}=e;return(0,m.X)(),(0,r.jsxs)("div",{className:"min-h-screen bg-gray-50",children:[(0,r.jsx)("div",{className:"fixed top-0 left-0 right-0 z-50 shadow-sm",children:(0,r.jsx)(w,{})}),(0,r.jsx)("div",{className:"transition-all duration-200 ease-in-out min-h-screen",style:{paddingTop:"56px"},children:(0,r.jsx)("main",{className:"p-6",children:t})})]})}function y(e){return(0,r.jsx)(g,{children:(0,r.jsx)(j,{...e})})}},8950:function(e,t,n){n.d(t,{Bw:function(){return m},Ph:function(){return d},Ql:function(){return p},i4:function(){return h},ki:function(){return u}});var r=n(5893),s=n(7294),o=n(2067),i=n(5895),a=n(7242),l=n(282),c=n(2350);let d=o.fC;o.ZA;let u=o.B4,h=s.forwardRef((e,t)=>{let{className:n,children:s,...a}=e;return(0,r.jsxs)(o.xz,{ref:t,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",n),...a,children:[s,(0,r.jsx)(o.JO,{asChild:!0,children:(0,r.jsx)(i.Z,{className:"h-4 w-4 opacity-50"})})]})});h.displayName=o.xz.displayName;let x=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,r.jsx)(o.u_,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",n),...s,children:(0,r.jsx)(a.Z,{className:"h-4 w-4"})})});x.displayName=o.u_.displayName;let f=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,r.jsx)(o.$G,{ref:t,className:(0,c.cn)("flex cursor-default items-center justify-center py-1",n),...s,children:(0,r.jsx)(i.Z,{className:"h-4 w-4"})})});f.displayName=o.$G.displayName;let m=s.forwardRef((e,t)=>{let{className:n,children:s,position:i="popper",...a}=e;return(0,r.jsx)(o.h_,{children:(0,r.jsxs)(o.VY,{ref:t,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"===i&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",n),position:i,...a,children:[(0,r.jsx)(x,{}),(0,r.jsx)(o.l_,{className:(0,c.cn)("p-1","popper"===i&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),(0,r.jsx)(f,{})]})})});m.displayName=o.VY.displayName,s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,r.jsx)(o.__,{ref:t,className:(0,c.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",n),...s})}).displayName=o.__.displayName;let p=s.forwardRef((e,t)=>{let{className:n,children:s,...i}=e;return(0,r.jsxs)(o.ck,{ref:t,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",n),...i,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(o.wU,{children:(0,r.jsx)(l.Z,{className:"h-4 w-4"})})}),(0,r.jsx)(o.eT,{children:s})]})});p.displayName=o.ck.displayName,s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,r.jsx)(o.Z0,{ref:t,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",n),...s})}).displayName=o.Z0.displayName},6989:function(e,t,n){n.d(t,{$B:function(){return g},GV:function(){return d},LU:function(){return m},Md:function(){return f},WH:function(){return x},o0:function(){return u},q8:function(){return p},yc:function(){return l}});var r=n(5893),s=n(7294),o=n(3302),i=n(1886),a=n(8950);let l=n(1214).nb.REFRESH_INTERVAL;function c(e){return e.charAt(0).toUpperCase()+e.slice(1)}function d(e){if(!e)return"N/A";let t=new Date;if(!(7>Math.abs((t-e)/864e5)))return(0,r.jsx)(x,{content:c(u(e)),className:"text-sm text-muted-foreground",children:c(e.toLocaleString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit"}).replace(",",""))});{let n=function(e){if(!e||"string"!=typeof e)return e;if("just now"===e)return"now";let t=e.match(/^about\s+(\d+)\s+(\w+)\s+ago$/i);if(t){let e=t[1],n=t[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[n])return"".concat(e).concat(r[n]," ago")}let n=e.match(/^a[n]?\s+(\w+)\s+ago$/i);if(n){let e=n[1],t={second:"s",minute:"m",hour:"h",day:"d",month:"mo",year:"yr"};if(t[e])return"1".concat(t[e]," ago")}let r=e.match(/^(\d+)\s+(\w+)\s+ago$/i);if(r){let e=r[1],t=r[2],n={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(n[t])return"".concat(e).concat(n[t]," ago")}return e}((0,i.B)(e,t,{addSuffix:!0}));return(0,r.jsx)(x,{content:u(e),className:"capitalize text-sm text-muted-foreground",children:n})}}function u(e){return e.toLocaleString("en-CA",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZoneName:"short"}).replace(",","")}let h={placement:"bottom",color:"default"},x=e=>{let{children:t,...n}=e,s=n.content;return n.content=void 0,(0,r.jsx)(o.e,{...h,...n,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:s}),children:t})},f=e=>{let{children:t,...n}=e,s=n.content;return n.content=void 0,(0,r.jsx)(o.e,{...h,...n,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:s}),children:t})};function m(e){if(!e&&0!==e)return"-";let t=e=Math.floor(e),n="",r=0;for(let e of[{value:86400,label:"d"},{value:3600,label:"h"},{value:60,label:"m"},{value:1,label:"s"}])if(t>=e.value&&r<2){let s=Math.floor(t/e.value);n+="".concat(s).concat(e.label," "),t%=e.value,r++}return n.trim()||"0s"}function p(e){return e?(e=e.split("\n").filter(e=>!e.match(/<rich_.*?\[bold cyan\]/)&&!e.match(/<rich_.*>.*<\/rich_.*>/)&&!e.match(/├──/)&&!e.match(/└──/)).join("\n").replace(/\x1b\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGKH]/g,"")).split("\n").map(e=>{let t=e.match(/^([IWED])\s+(\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2})\s+([^:]+:\d+\])(.*)/);if(t){let[e,n,r,s,o]=t,i={I:"INFO",W:"WARNING",E:"ERROR",D:"DEBUG"}[n]||"";return'<span class="log-line '.concat(i,'"><span class="level">').concat(n,'</span><span class="timestamp">').concat(r,'</span><span class="location">').concat(s,'</span><span class="message">').concat(o,"</span></span>")}let n=e.match(/^(\([^)]+\))(.*)$/);if(n){let[e,t,r]=n;return'<span class="log-line"><span class="log-prefix">'.concat(t,'</span><span class="log-rest">').concat(r,"</span></span>")}return'<span class="log-line"><span class="message">'.concat(e,"</span></span>")}).join("\n"):""}function g(e){let{logs:t,controller:n=!1}=e,[o,i]=(0,s.useState)("all"),[l,c]=(0,s.useState)(t),[d,u]=(0,s.useState)([]);return(0,s.useEffect)(()=>{u(function(e){let t;let n=/\((head|worker\d+),/g,r=new Set;for(;null!==(t=n.exec(e));)r.add(t[1]);return Array.from(r).sort((e,t)=>"head"===e?-1:"head"===t?1:e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"}))}(t))},[t]),(0,s.useEffect)(()=>{"all"===o?c(t):c(t.split("\n").filter(e=>e.includes("(".concat(o,","))).join("\n"))},[o,t]),(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'}),!n&&(0,r.jsx)("div",{style:{marginBottom:"1rem"},children:(0,r.jsxs)(a.Ph,{onValueChange:e=>i(e),value:o,children:[(0,r.jsx)(a.i4,{"aria-label":"Node",className:"focus:ring-0 focus:ring-offset-0",children:(0,r.jsx)(a.ki,{placeholder:"Select Node"})}),(0,r.jsxs)(a.Bw,{children:[(0,r.jsx)(a.Ql,{value:"all",children:"All Nodes"}),d.map(e=>(0,r.jsx)(a.Ql,{value:e,children:e},e))]})]})}),(0,r.jsx)("div",{className:"logs-container",dangerouslySetInnerHTML:{__html:l}})]})}},3001:function(e,t,n){n.d(t,{X:function(){return s}});var r=n(7294);function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[t,n]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let t=()=>{n(window.innerWidth<e)};return t(),window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[e]),t}},1214:function(e,t,n){n.d(t,{MO:function(){return o},ej:function(){return r},nb:function(){return s}});let r={DEFAULT_TTL:12e4},s={REFRESH_INTERVAL:3e4,GPU_REFRESH_INTERVAL:3e4},o={NAME_TRUNCATE_LENGTH:20}}}]);
|