skypilot-nightly 1.0.0.dev20250610__py3-none-any.whl → 1.0.0.dev20250612__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.
Files changed (51) hide show
  1. sky/__init__.py +2 -2
  2. sky/admin_policy.py +132 -6
  3. sky/benchmark/benchmark_state.py +39 -1
  4. sky/check.py +41 -2
  5. sky/cli.py +1 -1
  6. sky/client/cli.py +1 -1
  7. sky/clouds/kubernetes.py +1 -1
  8. sky/dashboard/out/404.html +1 -1
  9. sky/dashboard/out/_next/static/{4lwUJxN6KwBqUxqO1VccB → G3DXdMFu2Jzd-Dody9iq1}/_buildManifest.js +1 -1
  10. sky/dashboard/out/_next/static/chunks/600.15a0009177e86b86.js +16 -0
  11. sky/dashboard/out/_next/static/chunks/938-ab185187a63f9cdb.js +1 -0
  12. sky/dashboard/out/_next/static/chunks/{webpack-0574a5a4ba3cf0ac.js → webpack-208a9812ab4f61c9.js} +1 -1
  13. sky/dashboard/out/_next/static/css/{8b1c8321d4c02372.css → 5d71bfc09f184bab.css} +1 -1
  14. sky/dashboard/out/clusters/[cluster]/[job].html +1 -1
  15. sky/dashboard/out/clusters/[cluster].html +1 -1
  16. sky/dashboard/out/clusters.html +1 -1
  17. sky/dashboard/out/config.html +1 -1
  18. sky/dashboard/out/index.html +1 -1
  19. sky/dashboard/out/infra/[context].html +1 -1
  20. sky/dashboard/out/infra.html +1 -1
  21. sky/dashboard/out/jobs/[job].html +1 -1
  22. sky/dashboard/out/jobs.html +1 -1
  23. sky/dashboard/out/users.html +1 -1
  24. sky/dashboard/out/workspace/new.html +1 -1
  25. sky/dashboard/out/workspaces/[name].html +1 -1
  26. sky/dashboard/out/workspaces.html +1 -1
  27. sky/global_user_state.py +38 -0
  28. sky/jobs/scheduler.py +4 -5
  29. sky/jobs/server/core.py +1 -68
  30. sky/jobs/state.py +104 -11
  31. sky/jobs/utils.py +5 -5
  32. sky/skylet/job_lib.py +95 -40
  33. sky/templates/jobs-controller.yaml.j2 +0 -23
  34. sky/users/permission.py +34 -17
  35. sky/utils/admin_policy_utils.py +32 -13
  36. sky/utils/controller_utils.py +10 -0
  37. sky/utils/schemas.py +11 -3
  38. {skypilot_nightly-1.0.0.dev20250610.dist-info → skypilot_nightly-1.0.0.dev20250612.dist-info}/METADATA +1 -1
  39. {skypilot_nightly-1.0.0.dev20250610.dist-info → skypilot_nightly-1.0.0.dev20250612.dist-info}/RECORD +45 -49
  40. sky/dashboard/out/_next/static/chunks/600.9cc76ec442b22e10.js +0 -16
  41. sky/dashboard/out/_next/static/chunks/938-a75b7712639298b7.js +0 -1
  42. sky/jobs/dashboard/dashboard.py +0 -223
  43. sky/jobs/dashboard/static/favicon.ico +0 -0
  44. sky/jobs/dashboard/templates/index.html +0 -831
  45. sky/jobs/server/dashboard_utils.py +0 -69
  46. /sky/dashboard/out/_next/static/{4lwUJxN6KwBqUxqO1VccB → G3DXdMFu2Jzd-Dody9iq1}/_ssgManifest.js +0 -0
  47. /sky/dashboard/out/_next/static/chunks/pages/{_app-4768de0aede04dc9.js → _app-7bbd9d39d6f9a98a.js} +0 -0
  48. {skypilot_nightly-1.0.0.dev20250610.dist-info → skypilot_nightly-1.0.0.dev20250612.dist-info}/WHEEL +0 -0
  49. {skypilot_nightly-1.0.0.dev20250610.dist-info → skypilot_nightly-1.0.0.dev20250612.dist-info}/entry_points.txt +0 -0
  50. {skypilot_nightly-1.0.0.dev20250610.dist-info → skypilot_nightly-1.0.0.dev20250612.dist-info}/licenses/LICENSE +0 -0
  51. {skypilot_nightly-1.0.0.dev20250610.dist-info → skypilot_nightly-1.0.0.dev20250612.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 = 'd738e2a04a6185c2c01cb41ad2456cbc964411f0'
8
+ _SKYPILOT_COMMIT_SHA = '88962061c851edfe5dfcfe12a1c3cf63a703dfd8'
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.dev20250610'
38
+ __version__ = '1.0.0.dev20250612'
39
39
  __root_dir__ = os.path.dirname(os.path.abspath(__file__))
40
40
 
41
41
 
sky/admin_policy.py CHANGED
@@ -2,14 +2,23 @@
2
2
  import abc
3
3
  import dataclasses
4
4
  import typing
5
- from typing import Optional
5
+ from typing import Any, Dict, Optional
6
+
7
+ import pydantic
8
+
9
+ import sky
10
+ from sky import exceptions
11
+ from sky.adaptors import common as adaptors_common
12
+ from sky.utils import config_utils
13
+ from sky.utils import ux_utils
6
14
 
7
15
  if typing.TYPE_CHECKING:
8
- import sky
16
+ import requests
17
+ else:
18
+ requests = adaptors_common.LazyImport('requests')
9
19
 
10
20
 
11
- @dataclasses.dataclass
12
- class RequestOptions:
21
+ class RequestOptions(pydantic.BaseModel):
13
22
  """Request options for admin policy.
14
23
 
15
24
  Args:
@@ -29,7 +38,14 @@ class RequestOptions:
29
38
  idle_minutes_to_autostop: Optional[int]
30
39
  down: bool
31
40
  dryrun: bool
32
- is_client_side: bool = False
41
+
42
+
43
+ class _UserRequestBody(pydantic.BaseModel):
44
+ """Auxiliary model to validate and serialize a user request."""
45
+ task: Dict[str, Any]
46
+ skypilot_config: Dict[str, Any]
47
+ request_options: Optional[RequestOptions] = None
48
+ at_client_side: bool = False
33
49
 
34
50
 
35
51
  @dataclasses.dataclass
@@ -58,15 +74,64 @@ class UserRequest:
58
74
  request_options: Optional['RequestOptions'] = None
59
75
  at_client_side: bool = False
60
76
 
77
+ def encode(self) -> str:
78
+ return _UserRequestBody(
79
+ task=self.task.to_yaml_config(),
80
+ skypilot_config=dict(self.skypilot_config),
81
+ request_options=self.request_options,
82
+ at_client_side=self.at_client_side).model_dump_json()
83
+
84
+ @classmethod
85
+ def decode(cls, body: str) -> 'UserRequest':
86
+ user_request_body = _UserRequestBody.model_validate_json(body)
87
+ return cls(task=sky.Task.from_yaml_config(user_request_body.task),
88
+ skypilot_config=config_utils.Config.from_dict(
89
+ user_request_body.skypilot_config),
90
+ request_options=user_request_body.request_options,
91
+ at_client_side=user_request_body.at_client_side)
92
+
93
+
94
+ class _MutatedUserRequestBody(pydantic.BaseModel):
95
+ """Auxiliary model to validate and serialize a user request."""
96
+ task: Dict[str, Any]
97
+ skypilot_config: Dict[str, Any]
98
+
61
99
 
62
100
  @dataclasses.dataclass
63
101
  class MutatedUserRequest:
102
+ """Mutated user request."""
103
+
64
104
  task: 'sky.Task'
65
105
  skypilot_config: 'sky.Config'
66
106
 
107
+ def encode(self) -> str:
108
+ return _MutatedUserRequestBody(
109
+ task=self.task.to_yaml_config(),
110
+ skypilot_config=dict(self.skypilot_config)).model_dump_json()
111
+
112
+ @classmethod
113
+ def decode(cls, mutated_user_request_body: str) -> 'MutatedUserRequest':
114
+ mutated_user_request_body = _MutatedUserRequestBody.model_validate_json(
115
+ mutated_user_request_body)
116
+ return cls(task=sky.Task.from_yaml_config(
117
+ mutated_user_request_body.task),
118
+ skypilot_config=config_utils.Config.from_dict(
119
+ mutated_user_request_body.skypilot_config))
120
+
121
+
122
+ class PolicyInterface:
123
+ """Interface for admin-defined policy for user requests."""
124
+
125
+ @abc.abstractmethod
126
+ def apply(self, user_request: UserRequest) -> MutatedUserRequest:
127
+ """Apply the admin policy to the user request."""
128
+
129
+ def __str__(self):
130
+ return f'{self.__class__.__name__}'
131
+
67
132
 
68
133
  # pylint: disable=line-too-long
69
- class AdminPolicy:
134
+ class AdminPolicy(PolicyInterface):
70
135
  """Abstract interface of an admin-defined policy for all user requests.
71
136
 
72
137
  Admins can implement a subclass of AdminPolicy with the following signature:
@@ -107,3 +172,64 @@ class AdminPolicy:
107
172
  """
108
173
  raise NotImplementedError(
109
174
  'Your policy must implement validate_and_mutate')
175
+
176
+ def apply(self, user_request: UserRequest) -> MutatedUserRequest:
177
+ return self.validate_and_mutate(user_request)
178
+
179
+
180
+ class PolicyTemplate(PolicyInterface):
181
+ """Admin policy template that can be instantiated to create a policy."""
182
+
183
+ @abc.abstractmethod
184
+ def validate_and_mutate(self,
185
+ user_request: UserRequest) -> MutatedUserRequest:
186
+ """Validates and mutates the user request and returns mutated request.
187
+
188
+ Args:
189
+ user_request: The user request to validate and mutate.
190
+ UserRequest contains (sky.Task, sky.Config)
191
+
192
+ Returns:
193
+ MutatedUserRequest: The mutated user request.
194
+
195
+ Raises:
196
+ Exception to throw if the user request failed the validation.
197
+ """
198
+ raise NotImplementedError(
199
+ 'Your policy must implement validate_and_mutate')
200
+
201
+ def apply(self, user_request: UserRequest) -> MutatedUserRequest:
202
+ return self.validate_and_mutate(user_request)
203
+
204
+
205
+ class RestfulAdminPolicy(PolicyTemplate):
206
+ """Admin policy that calls a RESTful API for validation."""
207
+
208
+ def __init__(self, policy_url: str):
209
+ super().__init__()
210
+ self.policy_url = policy_url
211
+
212
+ def validate_and_mutate(self,
213
+ user_request: UserRequest) -> MutatedUserRequest:
214
+ try:
215
+ response = requests.post(
216
+ self.policy_url,
217
+ json=user_request.encode(),
218
+ headers={'Content-Type': 'application/json'},
219
+ # TODO(aylei): make this configurable
220
+ timeout=30)
221
+ response.raise_for_status()
222
+ except requests.exceptions.RequestException as e:
223
+ with ux_utils.print_exception_no_traceback():
224
+ raise exceptions.UserRequestRejectedByPolicy(
225
+ f'Failed to validate request with admin policy URL '
226
+ f'{self.policy_url}: {e}') from e
227
+
228
+ try:
229
+ mutated_user_request = MutatedUserRequest.decode(response.json())
230
+ except Exception as e: # pylint: disable=broad-except
231
+ with ux_utils.print_exception_no_traceback():
232
+ raise exceptions.UserRequestRejectedByPolicy(
233
+ f'Failed to decode response from admin policy URL '
234
+ f'{self.policy_url}: {e}') from e
235
+ return mutated_user_request
@@ -1,5 +1,6 @@
1
1
  """Sky benchmark database, backed by sqlite."""
2
2
  import enum
3
+ import functools
3
4
  import os
4
5
  import pathlib
5
6
  import pickle
@@ -65,7 +66,24 @@ class _BenchmarkSQLiteConn(threading.local):
65
66
  self.conn.commit()
66
67
 
67
68
 
68
- _BENCHMARK_DB = _BenchmarkSQLiteConn()
69
+ _BENCHMARK_DB = None
70
+ _benchmark_db_init_lock = threading.Lock()
71
+
72
+
73
+ def _init_db(func):
74
+ """Initialize the database."""
75
+
76
+ @functools.wraps(func)
77
+ def wrapper(*args, **kwargs):
78
+ global _BENCHMARK_DB
79
+ if _BENCHMARK_DB:
80
+ return func(*args, **kwargs)
81
+ with _benchmark_db_init_lock:
82
+ if not _BENCHMARK_DB:
83
+ _BENCHMARK_DB = _BenchmarkSQLiteConn()
84
+ return func(*args, **kwargs)
85
+
86
+ return wrapper
69
87
 
70
88
 
71
89
  class BenchmarkStatus(enum.Enum):
@@ -121,9 +139,11 @@ class BenchmarkRecord(NamedTuple):
121
139
  estimated_total_seconds: Optional[float] = None
122
140
 
123
141
 
142
+ @_init_db
124
143
  def add_benchmark(benchmark_name: str, task_name: Optional[str],
125
144
  bucket_name: str) -> None:
126
145
  """Add a new benchmark."""
146
+ assert _BENCHMARK_DB is not None
127
147
  launched_at = int(time.time())
128
148
  _BENCHMARK_DB.cursor.execute(
129
149
  'INSERT INTO benchmark'
@@ -133,8 +153,10 @@ def add_benchmark(benchmark_name: str, task_name: Optional[str],
133
153
  _BENCHMARK_DB.conn.commit()
134
154
 
135
155
 
156
+ @_init_db
136
157
  def add_benchmark_result(benchmark_name: str,
137
158
  cluster_handle: 'backend_lib.ResourceHandle') -> None:
159
+ assert _BENCHMARK_DB is not None
138
160
  name = cluster_handle.cluster_name
139
161
  num_nodes = cluster_handle.launched_nodes
140
162
  resources = pickle.dumps(cluster_handle.launched_resources)
@@ -146,10 +168,12 @@ def add_benchmark_result(benchmark_name: str,
146
168
  _BENCHMARK_DB.conn.commit()
147
169
 
148
170
 
171
+ @_init_db
149
172
  def update_benchmark_result(
150
173
  benchmark_name: str, cluster_name: str,
151
174
  benchmark_status: BenchmarkStatus,
152
175
  benchmark_record: Optional[BenchmarkRecord]) -> None:
176
+ assert _BENCHMARK_DB is not None
153
177
  _BENCHMARK_DB.cursor.execute(
154
178
  'UPDATE benchmark_results SET '
155
179
  'status=(?), record=(?) WHERE benchmark=(?) AND cluster=(?)',
@@ -158,8 +182,10 @@ def update_benchmark_result(
158
182
  _BENCHMARK_DB.conn.commit()
159
183
 
160
184
 
185
+ @_init_db
161
186
  def delete_benchmark(benchmark_name: str) -> None:
162
187
  """Delete a benchmark result."""
188
+ assert _BENCHMARK_DB is not None
163
189
  _BENCHMARK_DB.cursor.execute(
164
190
  'DELETE FROM benchmark_results WHERE benchmark=(?)', (benchmark_name,))
165
191
  _BENCHMARK_DB.cursor.execute('DELETE FROM benchmark WHERE name=(?)',
@@ -167,8 +193,10 @@ def delete_benchmark(benchmark_name: str) -> None:
167
193
  _BENCHMARK_DB.conn.commit()
168
194
 
169
195
 
196
+ @_init_db
170
197
  def get_benchmark_from_name(benchmark_name: str) -> Optional[Dict[str, Any]]:
171
198
  """Get a benchmark from its name."""
199
+ assert _BENCHMARK_DB is not None
172
200
  rows = _BENCHMARK_DB.cursor.execute(
173
201
  'SELECT * FROM benchmark WHERE name=(?)', (benchmark_name,))
174
202
  for name, task, bucket, launched_at in rows:
@@ -181,8 +209,10 @@ def get_benchmark_from_name(benchmark_name: str) -> Optional[Dict[str, Any]]:
181
209
  return record
182
210
 
183
211
 
212
+ @_init_db
184
213
  def get_benchmarks() -> List[Dict[str, Any]]:
185
214
  """Get all benchmarks."""
215
+ assert _BENCHMARK_DB is not None
186
216
  rows = _BENCHMARK_DB.cursor.execute('SELECT * FROM benchmark')
187
217
  records = []
188
218
  for name, task, bucket, launched_at in rows:
@@ -196,8 +226,10 @@ def get_benchmarks() -> List[Dict[str, Any]]:
196
226
  return records
197
227
 
198
228
 
229
+ @_init_db
199
230
  def set_benchmark_bucket(bucket_name: str, bucket_type: str) -> None:
200
231
  """Save the benchmark bucket name and type."""
232
+ assert _BENCHMARK_DB is not None
201
233
  _BENCHMARK_DB.cursor.execute(
202
234
  'REPLACE INTO benchmark_config (key, value) VALUES (?, ?)',
203
235
  (_BENCHMARK_BUCKET_NAME_KEY, bucket_name))
@@ -207,8 +239,10 @@ def set_benchmark_bucket(bucket_name: str, bucket_type: str) -> None:
207
239
  _BENCHMARK_DB.conn.commit()
208
240
 
209
241
 
242
+ @_init_db
210
243
  def get_benchmark_bucket() -> Tuple[Optional[str], Optional[str]]:
211
244
  """Get the benchmark bucket name and type."""
245
+ assert _BENCHMARK_DB is not None
212
246
  rows = _BENCHMARK_DB.cursor.execute(
213
247
  'SELECT value FROM benchmark_config WHERE key=(?)',
214
248
  (_BENCHMARK_BUCKET_NAME_KEY,))
@@ -227,15 +261,19 @@ def get_benchmark_bucket() -> Tuple[Optional[str], Optional[str]]:
227
261
  return bucket_name, bucket_type
228
262
 
229
263
 
264
+ @_init_db
230
265
  def get_benchmark_clusters(benchmark_name: str) -> List[str]:
231
266
  """Get all clusters for a benchmark."""
267
+ assert _BENCHMARK_DB is not None
232
268
  rows = _BENCHMARK_DB.cursor.execute(
233
269
  'SELECT cluster FROM benchmark_results WHERE benchmark=(?)',
234
270
  (benchmark_name,))
235
271
  return [row[0] for row in rows]
236
272
 
237
273
 
274
+ @_init_db
238
275
  def get_benchmark_results(benchmark_name: str) -> List[Dict[str, Any]]:
276
+ assert _BENCHMARK_DB is not None
239
277
  rows = _BENCHMARK_DB.cursor.execute(
240
278
  'SELECT * FROM benchmark_results WHERE benchmark=(?)',
241
279
  (benchmark_name,))
sky/check.py CHANGED
@@ -11,6 +11,7 @@ import colorama
11
11
  from sky import clouds as sky_clouds
12
12
  from sky import exceptions
13
13
  from sky import global_user_state
14
+ from sky import sky_logging
14
15
  from sky import skypilot_config
15
16
  from sky.adaptors import cloudflare
16
17
  from sky.clouds import cloud as sky_cloud
@@ -23,6 +24,30 @@ from sky.utils import ux_utils
23
24
  CHECK_MARK_EMOJI = '\U00002714' # Heavy check mark unicode
24
25
  PARTY_POPPER_EMOJI = '\U0001F389' # Party popper unicode
25
26
 
27
+ logger = sky_logging.init_logger(__name__)
28
+
29
+
30
+ def _get_workspace_allowed_clouds(workspace: str) -> List[str]:
31
+ # Use allowed_clouds from config if it exists, otherwise check all
32
+ # clouds. Also validate names with get_cloud_tuple.
33
+ config_allowed_cloud_names = skypilot_config.get_nested(
34
+ ('allowed_clouds',),
35
+ [repr(c) for c in registry.CLOUD_REGISTRY.values()] + [cloudflare.NAME])
36
+ # filter out the clouds that are disabled in the workspace config
37
+ workspace_disabled_clouds = []
38
+ for cloud in config_allowed_cloud_names:
39
+ cloud_config = skypilot_config.get_workspace_cloud(cloud.lower(),
40
+ workspace=workspace)
41
+ cloud_disabled = cloud_config.get('disabled', False)
42
+ if cloud_disabled:
43
+ workspace_disabled_clouds.append(cloud.lower())
44
+
45
+ config_allowed_cloud_names = [
46
+ c for c in config_allowed_cloud_names
47
+ if c.lower() not in workspace_disabled_clouds
48
+ ]
49
+ return config_allowed_cloud_names
50
+
26
51
 
27
52
  def check_capabilities(
28
53
  quiet: bool = False,
@@ -132,6 +157,8 @@ def check_capabilities(
132
157
  c for c in config_allowed_cloud_names
133
158
  if c not in workspace_disabled_clouds
134
159
  ]
160
+ global_user_state.set_allowed_clouds(
161
+ [c for c in config_allowed_cloud_names], current_workspace_name)
135
162
 
136
163
  # Use disallowed_cloud_names for logging the clouds that will be
137
164
  # disabled because they are not included in allowed_clouds in
@@ -341,11 +368,22 @@ def get_cached_enabled_clouds_or_refresh(
341
368
  raise_if_no_cloud_access is set to True.
342
369
  """
343
370
  active_workspace = skypilot_config.get_active_workspace()
371
+ allowed_clouds_changed = False
372
+ cached_allowed_clouds = global_user_state.get_allowed_clouds(
373
+ active_workspace)
374
+ skypilot_config_allowed_clouds = _get_workspace_allowed_clouds(
375
+ active_workspace)
376
+ if sorted(cached_allowed_clouds) != sorted(skypilot_config_allowed_clouds):
377
+ allowed_clouds_changed = True
378
+
344
379
  cached_enabled_clouds = global_user_state.get_cached_enabled_clouds(
345
380
  capability, active_workspace)
346
- if not cached_enabled_clouds:
381
+ if not cached_enabled_clouds or allowed_clouds_changed:
347
382
  try:
348
383
  check_capability(capability, quiet=True, workspace=active_workspace)
384
+ if allowed_clouds_changed:
385
+ global_user_state.set_allowed_clouds(
386
+ skypilot_config_allowed_clouds, active_workspace)
349
387
  except SystemExit:
350
388
  # If no cloud is enabled, check() will raise SystemExit.
351
389
  # Here we catch it and raise the exception later only if
@@ -382,7 +420,8 @@ def get_cloud_credential_file_mounts(
382
420
  cloud_file_mounts = cloud.get_credential_file_mounts()
383
421
  for remote_path, local_path in cloud_file_mounts.items():
384
422
  if os.path.exists(os.path.expanduser(local_path)):
385
- file_mounts[remote_path] = local_path
423
+ file_mounts[remote_path] = os.path.realpath(
424
+ os.path.expanduser(local_path))
386
425
  # Currently, get_cached_enabled_clouds_or_refresh() does not support r2 as
387
426
  # only clouds with computing instances are marked as enabled by skypilot.
388
427
  # This will be removed when cloudflare/r2 is added as a 'cloud'.
sky/cli.py CHANGED
@@ -4199,7 +4199,7 @@ def jobs():
4199
4199
  type=click.IntRange(0, 1000),
4200
4200
  default=None,
4201
4201
  show_default=True,
4202
- help=('Job priority from 0 to 1000. A lower number is higher '
4202
+ help=('Job priority from 0 to 1000. A higher number is higher '
4203
4203
  'priority. Default is 500.'))
4204
4204
  @click.option(
4205
4205
  '--detach-run',
sky/client/cli.py CHANGED
@@ -4199,7 +4199,7 @@ def jobs():
4199
4199
  type=click.IntRange(0, 1000),
4200
4200
  default=None,
4201
4201
  show_default=True,
4202
- help=('Job priority from 0 to 1000. A lower number is higher '
4202
+ help=('Job priority from 0 to 1000. A higher number is higher '
4203
4203
  'priority. Default is 500.'))
4204
4204
  @click.option(
4205
4205
  '--detach-run',
sky/clouds/kubernetes.py CHANGED
@@ -772,7 +772,7 @@ class Kubernetes(clouds.Cloud):
772
772
  """Checks if the user has access credentials to
773
773
  Kubernetes."""
774
774
  # Check for port forward dependencies
775
- logger.info(f'Checking compute credentials for {cls.canonical_name()}')
775
+ logger.debug(f'Checking compute credentials for {cls.canonical_name()}')
776
776
  reasons = kubernetes_utils.check_port_forward_mode_dependencies(False)
777
777
  if reasons is not None:
778
778
  formatted = '\n'.join(
@@ -1 +1 @@
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>
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/5d71bfc09f184bab.css" as="style"/><link rel="stylesheet" href="/dashboard/_next/static/css/5d71bfc09f184bab.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-208a9812ab4f61c9.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-7bbd9d39d6f9a98a.js" defer=""></script><script src="/dashboard/_next/static/chunks/pages/_error-1be831200e60c5c0.js" defer=""></script><script src="/dashboard/_next/static/G3DXdMFu2Jzd-Dody9iq1/_buildManifest.js" defer=""></script><script src="/dashboard/_next/static/G3DXdMFu2Jzd-Dody9iq1/_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":"G3DXdMFu2Jzd-Dody9iq1","assetPrefix":"/dashboard","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
@@ -1 +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();
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-ab185187a63f9cdb.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();
@@ -0,0 +1,16 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[600,211],{3626:function(e,r,t){t.d(r,{Z:function(){return s}});/**
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 s=(0,t(998).Z)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},3767:function(e,r,t){t.d(r,{Z:function(){return s}});/**
7
+ * @license lucide-react v0.407.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */let s=(0,t(998).Z)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])},803:function(e,r,t){t.d(r,{z:function(){return c}});var s=t(5893),a=t(7294),n=t(8426),l=t(2003),i=t(2350);let o=(0,l.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,r)=>{let{className:t,variant:a,size:l,asChild:c=!1,...d}=e,u=c?n.g7:"button";return(0,s.jsx)(u,{className:(0,i.cn)(o({variant:a,size:l,className:t})),ref:r,...d})});c.displayName="Button"},7673:function(e,r,t){t.d(r,{Ol:function(){return c},Zb:function(){return o},aY:function(){return m},eW:function(){return f},ll:function(){return d}});var s=t(5893),a=t(7294),n=t(5697),l=t.n(n),i=t(2350);let o=a.forwardRef((e,r)=>{let{className:t,children:a,...n}=e;return(0,s.jsx)("div",{ref:r,className:(0,i.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...n,children:a})});o.displayName="Card",o.propTypes={className:l().string,children:l().node};let c=a.forwardRef((e,r)=>{let{className:t,children:a,...n}=e;return(0,s.jsx)("div",{ref:r,className:(0,i.cn)("flex flex-col space-y-1.5 p-6",t),...n,children:a})});c.displayName="CardHeader",c.propTypes={className:l().string,children:l().node};let d=a.forwardRef((e,r)=>{let{className:t,children:a,...n}=e;return(0,s.jsx)("h3",{ref:r,className:(0,i.cn)("text-2xl font-semibold leading-none tracking-tight",t),...n,children:a})});d.displayName="CardTitle",d.propTypes={className:l().string,children:l().node};let u=a.forwardRef((e,r)=>{let{className:t,children:a,...n}=e;return(0,s.jsx)("p",{ref:r,className:(0,i.cn)("text-sm text-muted-foreground",t),...n,children:a})});u.displayName="CardDescription",u.propTypes={className:l().string,children:l().node};let m=a.forwardRef((e,r)=>{let{className:t,children:a,...n}=e;return(0,s.jsx)("div",{ref:r,className:(0,i.cn)("p-6 pt-0",t),...n,children:a})});m.displayName="CardContent",m.propTypes={className:l().string,children:l().node};let f=a.forwardRef((e,r)=>{let{className:t,children:a,...n}=e;return(0,s.jsx)("div",{ref:r,className:(0,i.cn)("flex items-center p-6 pt-0",t),...n,children:a})});f.displayName="CardFooter",f.propTypes={className:l().string,children:l().node}},8764:function(e,r,t){t.d(r,{RM:function(){return o},SC:function(){return c},iA:function(){return l},pj:function(){return u},ss:function(){return d},xD:function(){return i}});var s=t(5893),a=t(7294),n=t(2350);let l=a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,s.jsx)("div",{className:"relative w-full overflow-auto",children:(0,s.jsx)("table",{ref:r,className:(0,n.cn)("w-full caption-bottom text-base",t),...a})})});l.displayName="Table";let i=a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,s.jsx)("thead",{ref:r,className:(0,n.cn)("[&_tr]:border-b",t),...a})});i.displayName="TableHeader";let o=a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,s.jsx)("tbody",{ref:r,className:(0,n.cn)("[&_tr:last-child]:border-0",t),...a})});o.displayName="TableBody",a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,s.jsx)("tfoot",{ref:r,className:(0,n.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...a})}).displayName="TableFooter";let c=a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,s.jsx)("tr",{ref:r,className:(0,n.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...a})});c.displayName="TableRow";let d=a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,s.jsx)("th",{ref:r,className:(0,n.cn)("h-12 px-4 text-left align-middle font-medium text-[hsl(var(--text-strong))] [&:has([role=checkbox])]:pr-0",t),...a})});d.displayName="TableHead";let u=a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,s.jsx)("td",{ref:r,className:(0,n.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...a})});u.displayName="TableCell",a.forwardRef((e,r)=>{let{className:t,...a}=e;return(0,s.jsx)("caption",{ref:r,className:(0,n.cn)("mt-4 text-base text-muted-foreground",t),...a})}).displayName="TableCaption"},3600:function(e,r,t){t.r(r),t.d(r,{Users:function(){return D}});var s=t(5893),a=t(7294),n=t(5697),l=t.n(n),i=t(8799),o=t(1664),c=t.n(o);t(803);var d=t(8764),u=t(3081),m=t(3266),f=t(8969),x=t(6378),p=t(6856),h=t(1214),g=t(4545),b=t(3626),y=t(282),j=t(3767);/**
12
+ * @license lucide-react v0.407.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */let N=(0,t(998).Z)("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);t(9470);var v=t(3001),w=t(7673),C=t(7145);let k=(e,r)=>e&&e.includes("@")?e.split("@")[0]:e||"N/A",R=(e,r)=>e&&e.includes("@")?e:r||"-",I=h.nb.REFRESH_INTERVAL;function D(){let[e,r]=(0,a.useState)(!1),t=(0,a.useRef)(null),n=(0,v.X)();return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,s.jsx)("div",{className:"text-base",children:(0,s.jsx)(c(),{href:"/users",className:"text-sky-blue hover:underline leading-none",children:"Users"})}),(0,s.jsxs)("div",{className:"flex items-center",children:[e&&(0,s.jsxs)("div",{className:"flex items-center mr-2",children:[(0,s.jsx)(i.Z,{size:15,className:"mt-0"}),(0,s.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Loading..."})]}),(0,s.jsxs)("button",{onClick:()=>{x.default.invalidate(u.R),x.default.invalidate(m.getClusters),x.default.invalidate(f.getManagedJobs,[{allUsers:!0}]),t.current&&t.current()},disabled:e,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,s.jsx)(b.Z,{className:"h-4 w-4 mr-1.5"}),!n&&(0,s.jsx)("span",{children:"Refresh"})]})]})]}),(0,s.jsx)(E,{refreshInterval:I,setLoading:r,refreshDataRef:t})]})}function E(e){let{refreshInterval:r,setLoading:t,refreshDataRef:n}=e,[l,o]=(0,a.useState)([]),[c,h]=(0,a.useState)(!0),[b,v]=(0,a.useState)(!1),[I,D]=(0,a.useState)({key:"username",direction:"ascending"}),[E,T]=(0,a.useState)(null),[Z,F]=(0,a.useState)(""),S=(0,a.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t&&e&&t(!0),e&&h(!0);try{let r=await x.default.get(u.R),s=(r||[]).map(e=>({...e,usernameDisplay:k(e.username,e.userId),fullEmailID:R(e.username,e.userId),clusterCount:-1,jobCount:-1}));o(s),v(!0),t&&e&&t(!1),e&&h(!1);let[a,n]=await Promise.all([x.default.get(m.getClusters),x.default.get(f.getManagedJobs,[{allUsers:!0}])]),l=n.jobs||[],i=(r||[]).map(e=>{let r=(a||[]).filter(r=>r.user_hash===e.userId),t=(l||[]).filter(r=>r.user_hash===e.userId);return{...e,usernameDisplay:k(e.username,e.userId),fullEmailID:R(e.username,e.userId),clusterCount:r.length,jobCount:t.length}});o(i)}catch(r){console.error("Failed to fetch or process user data:",r),o([]),v(!0),t&&e&&t(!1),e&&h(!1)}},[t]);(0,a.useEffect)(()=>{n&&(n.current=()=>S(!0))},[n,S]),(0,a.useEffect)(()=>{(async()=>{v(!1),h(!0),await p.ZP.preloadForPage("users"),S(!0)})();let e=setInterval(()=>{S(!1)},r);return()=>clearInterval(e)},[S,r]);let _=(0,a.useMemo)(()=>(0,g.R0)(l,I.key,I.direction),[l,I]),L=e=>{let r="ascending";I.key===e&&"ascending"===I.direction&&(r="descending"),D({key:e,direction:r})},M=e=>I.key===e?"ascending"===I.direction?" ↑":" ↓":"",z=async(e,r)=>{try{let t=await C.x.get("/users/role");if(!t.ok){let e=await t.json();throw Error(e.detail||"Failed to get user role")}let s=await t.json();console.log("data",s);let a=s.role;if("admin"!=a){alert("".concat(s.name," is logged in as no admin, cannot edit user role."));return}T(e),F(r)}catch(e){console.error("Failed to check user role:",e),alert("Error: ".concat(e.message))}},U=()=>{T(null),F("")},A=async e=>{if(!e||!Z){console.error("User ID or role is missing."),alert("Error: User ID or role is missing.");return}h(!0);try{let r=await C.x.post("/users/update",{user_id:e,role:Z});if(!r.ok){let e=await r.json();throw Error(e.detail||"Failed to update role")}x.default.invalidate(u.R),await S(!0),U()}catch(e){console.error("Failed to update user role:",e),alert("Error updating role: ".concat(e.message))}finally{h(!1)}};return c&&0===l.length&&!b?(0,s.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,s.jsx)(i.Z,{})}):b?_&&0!==_.length?(0,s.jsx)(w.Zb,{children:(0,s.jsxs)(d.iA,{children:[(0,s.jsx)(d.xD,{children:(0,s.jsxs)(d.SC,{children:[(0,s.jsxs)(d.ss,{onClick:()=>L("usernameDisplay"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/5",children:["Name",M("usernameDisplay")]}),(0,s.jsxs)(d.ss,{onClick:()=>L("fullEmailID"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/5",children:["User ID",M("fullEmailID")]}),(0,s.jsxs)(d.ss,{onClick:()=>L("role"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/5",children:["Role",M("role")]}),(0,s.jsxs)(d.ss,{onClick:()=>L("clusterCount"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/5",children:["Clusters",M("clusterCount")]}),(0,s.jsxs)(d.ss,{onClick:()=>L("jobCount"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/5",children:["Jobs",M("jobCount")]})]})}),(0,s.jsx)(d.RM,{children:_.map(e=>(0,s.jsxs)(d.SC,{children:[(0,s.jsx)(d.pj,{className:"truncate",title:e.username,children:e.usernameDisplay}),(0,s.jsx)(d.pj,{className:"truncate",title:e.fullEmailID,children:e.fullEmailID}),(0,s.jsx)(d.pj,{className:"truncate",title:e.role,children:(0,s.jsx)("div",{className:"flex items-center gap-2",children:E===e.userId?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("select",{value:Z,onChange:e=>F(e.target.value),className:"block w-auto p-1 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-sky-blue focus:border-sky-blue sm:text-sm",children:[(0,s.jsx)("option",{value:"admin",children:"Admin"}),(0,s.jsx)("option",{value:"user",children:"User"})]}),(0,s.jsx)("button",{onClick:()=>A(e.userId),className:"text-green-600 hover:text-green-800 p-1",title:"Save",children:(0,s.jsx)(y.Z,{className:"h-4 w-4"})}),(0,s.jsx)("button",{onClick:U,className:"text-gray-500 hover:text-gray-700 p-1",title:"Cancel",children:(0,s.jsx)(j.Z,{className:"h-4 w-4"})})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"capitalize",children:e.role}),(0,s.jsx)("button",{onClick:()=>z(e.userId,e.role),className:"text-gray-400 hover:text-sky-blue p-1",title:"Edit role",children:(0,s.jsx)(N,{className:"h-3 w-3"})})]})})}),(0,s.jsx)(d.pj,{children:-1===e.clusterCount?(0,s.jsxs)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-400 rounded text-xs font-medium flex items-center",children:[(0,s.jsx)(i.Z,{size:10,className:"mr-1"}),"Loading..."]}):e.clusterCount>0?(0,s.jsx)("span",{className:"px-2 py-0.5 bg-blue-100 text-blue-800 rounded text-xs font-medium",children:e.clusterCount}):(0,s.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"})}),(0,s.jsx)(d.pj,{children:-1===e.jobCount?(0,s.jsxs)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-400 rounded text-xs font-medium flex items-center",children:[(0,s.jsx)(i.Z,{size:10,className:"mr-1"}),"Loading..."]}):e.jobCount>0?(0,s.jsx)("span",{className:"px-2 py-0.5 bg-green-100 text-green-800 rounded text-xs font-medium",children:e.jobCount}):(0,s.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:"0"})})]},e.userId))})]})}):(0,s.jsxs)("div",{className:"text-center py-12",children:[(0,s.jsx)("p",{className:"text-lg font-semibold text-gray-500",children:"No users found."}),(0,s.jsx)("p",{className:"text-sm text-gray-400 mt-1",children:"There are currently no users to display."})]}):(0,s.jsxs)("div",{className:"flex justify-center items-center h-64",children:[(0,s.jsx)(i.Z,{}),(0,s.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading users..."})]})}E.propTypes={refreshInterval:l().number.isRequired,setLoading:l().func.isRequired,refreshDataRef:l().shape({current:l().func}).isRequired}},4545:function(e,r,t){function s(e){return e.startsWith("sky-jobs-controller-")}function a(e,r,t){return null===r?e:[...e].sort((e,s)=>e[r]<s[r]?"ascending"===t?-1:1:e[r]>s[r]?"ascending"===t?1:-1:0)}t.d(r,{R0:function(){return a},Ym:function(){return s}})},2003:function(e,r,t){t.d(r,{j:function(){return l}});var s=t(512);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,n=s.W,l=(e,r)=>t=>{var s;if((null==r?void 0:r.variants)==null)return n(e,null==t?void 0:t.class,null==t?void 0:t.className);let{variants:l,defaultVariants:i}=r,o=Object.keys(l).map(e=>{let r=null==t?void 0:t[e],s=null==i?void 0:i[e];if(null===r)return null;let n=a(r)||a(s);return l[e][n]}),c=t&&Object.entries(t).reduce((e,r)=>{let[t,s]=r;return void 0===s||(e[t]=s),e},{});return n(e,o,null==r?void 0:null===(s=r.compoundVariants)||void 0===s?void 0:s.reduce((e,r)=>{let{class:t,className:s,...a}=r;return Object.entries(a).every(e=>{let[r,t]=e;return Array.isArray(t)?t.includes({...i,...c}[r]):({...i,...c})[r]===t})?[...e,t,s]: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([[938],{938:function(e,s,t){t.r(s),t.d(s,{ClusterJobs:function(){return O},ManagedJobs:function(){return M},ManagedJobsTable:function(){return I},Status2Actions:function(){return D},filterJobsByWorkspace:function(){return R},statusGroups:function(){return E}});var n=t(5893),r=t(7294),a=t(1163),l=t(1664),i=t.n(l),c=t(8799),o=t(803),d=t(7673),h=t(8764),x=t(6989),u=t(8969),m=t(3266),j=t(7324);t(9470);var p=t(3626),f=t(3293),g=t(6521),b=t(3610),w=t(9284),N=t(4545),y=t(9307),v=t(3001),k=t(8950),C=t(6378),S=t(6856);let E={active:["PENDING","RUNNING","RECOVERING","SUBMITTED","STARTING","CANCELLING"],finished:["SUCCEEDED","FAILED","CANCELLED","FAILED_SETUP","FAILED_PRECHECKS","FAILED_NO_RESOURCE","FAILED_CONTROLLER"]},L="__ALL_WORKSPACES__";function R(e,s){return s&&s!==L?e.filter(e=>(e.workspace||"default").toLowerCase()===s.toLowerCase()):e}let _=e=>{if(!e)return"-";let s=e instanceof Date?e:new Date(1e3*e),t=(0,x.GV)(s);if(r.isValidElement(t)&&t.props&&t.props.children&&(t=r.isValidElement(t.props.children)&&t.props.children.props&&t.props.children.props.children?t.props.children.props.children:t.props.children),"string"!=typeof t)return t;let a=function(e){if(!e||"string"!=typeof e)return e;if("just now"===e)return"now";if("less than a minute ago"===e.toLowerCase())return"Less than a minute ago";let s=e.match(/^About\s+(\d+)\s+(\w+)\s+ago$/);if(s){let e=s[1],t=s[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")}let t=e.match(/^a[n]?\s+(\w+)\s+ago$/);if(t){let e=t[1],s={second:"s",minute:"m",hour:"h",day:"d",month:"mo",year:"yr"};if(s[e])return"1".concat(s[e]," ago")}let n=e.match(/^(\d+)\s+(\w+)\s+ago$/);if(n){let e=n[1],s=n[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[s])return"".concat(e).concat(t[s]," ago")}return e}(t);return 7>Math.abs((new Date().getTime()-s.getTime())/864e5)?(0,n.jsx)(x.WH,{content:(0,x.o0)(s),className:"capitalize text-sm text-muted-foreground",children:a}):(0,n.jsx)(x.WH,{content:(0,x.o0)(s),className:"text-sm text-muted-foreground",children:a})};function M(){let e=(0,a.useRouter)(),[s,t]=(0,r.useState)(!1),l=r.useRef(null),[o,d]=(0,r.useState)({isOpen:!1,title:"",message:"",onConfirm:null}),h=(0,v.X)(),[m,f]=(0,r.useState)(L),[g,b]=(0,r.useState)([]);return(0,r.useEffect)(()=>{e.isReady&&e.query.workspace&&f(Array.isArray(e.query.workspace)?e.query.workspace[0]:e.query.workspace)},[e.isReady,e.query.workspace]),(0,r.useEffect)(()=>{(async()=>{try{await S.ZP.preloadForPage("jobs");let e=await C.default.get(j.fX),s=Object.keys(e),t=(await C.default.get(u.getManagedJobs,[{allUsers:!0}])).jobs||[],n=[...new Set(t.map(e=>e.workspace||"default").filter(e=>e))],r=new Set(s);n.forEach(e=>r.add(e)),b(Array.from(r).sort())}catch(e){console.error("Error fetching data for workspace filter:",e),b(["default"])}})()},[]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,n.jsxs)("div",{className:"text-base flex items-center",children:[(0,n.jsx)(i(),{href:"/jobs",className:"text-sky-blue hover:underline leading-none",children:"Managed Jobs"}),(0,n.jsxs)(k.Ph,{value:m,onValueChange:f,children:[(0,n.jsx)(k.i4,{className:"h-8 w-48 ml-4 mr-2 text-sm border-none focus:ring-0 focus:outline-none",children:(0,n.jsx)(k.ki,{placeholder:"Filter by workspace...",children:m===L?"All Workspaces":m})}),(0,n.jsxs)(k.Bw,{children:[(0,n.jsx)(k.Ql,{value:L,children:"All Workspaces"}),g.map(e=>(0,n.jsx)(k.Ql,{value:e,children:e},e))]})]})]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[s&&(0,n.jsxs)("div",{className:"flex items-center mr-2",children:[(0,n.jsx)(c.Z,{size:15,className:"mt-0"}),(0,n.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Loading..."})]}),(0,n.jsxs)("button",{onClick:()=>{C.default.invalidate(u.getManagedJobs,[{allUsers:!0}]),C.default.invalidate(j.fX),l.current&&l.current()},disabled:s,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",title:"Refresh",children:[(0,n.jsx)(p.Z,{className:"h-4 w-4 mr-1.5"}),!h&&(0,n.jsx)("span",{children:"Refresh"})]})]})]}),(0,n.jsx)(I,{refreshInterval:x.yc,setLoading:t,refreshDataRef:l,workspaceFilter:m}),(0,n.jsx)(w.cV,{isOpen:o.isOpen,onClose:()=>d({...o,isOpen:!1}),onConfirm:o.onConfirm,title:o.title,message:o.message})]})}function I(e){let{refreshInterval:s,setLoading:t,refreshDataRef:a,workspaceFilter:l}=e,[j,p]=(0,r.useState)([]),[g,b]=(0,r.useState)({key:null,direction:"ascending"}),[v,k]=(0,r.useState)(!1),[S,L]=(0,r.useState)(!0),[M,I]=(0,r.useState)(1),[O,W]=(0,r.useState)(10),[F,U]=(0,r.useState)(null),P=(0,r.useRef)(null),[J,T]=(0,r.useState)([]),[Z,B]=(0,r.useState)({}),[V,q]=(0,r.useState)(!1),[G,H]=(0,r.useState)(!1),[X,$]=(0,r.useState)(!1),[K,Q]=(0,r.useState)("all"),[Y,ee]=(0,r.useState)(!0),[es,et]=(0,r.useState)({isOpen:!1,title:"",message:"",onConfirm:null}),en=async()=>{et({isOpen:!0,title:"Restart Controller",message:"Are you sure you want to restart the controller?",onConfirm:async()=>{try{$(!0),k(!0),await (0,u.Ce)("restartcontroller"),await er()}catch(e){console.error("Error restarting controller:",e)}finally{$(!1),k(!1)}}})},er=r.useCallback(async()=>{k(!0),t(!0);try{let[e,s]=await Promise.all([C.default.get(u.getManagedJobs,[{allUsers:!0}]),C.default.get(m.getClusters)]),{jobs:t=[],controllerStopped:n=!1}=e||{},r=null==s?void 0:s.find(e=>(0,N.Ym)(e.cluster)),a=r?r.status:"NOT_FOUND",l=!1;"STOPPED"==a&&n&&(l=!0),"LAUNCHING"==a?H(!0):H(!1),p(t),q(l),L(!1)}catch(e){console.error("Error fetching data:",e),p([]),q(!1),L(!1)}finally{k(!1),t(!1)}},[t]);r.useEffect(()=>{a&&(a.current=er)},[a,er]),(0,r.useEffect)(()=>{p([]);let e=!0;er();let t=setInterval(()=>{e&&er()},s);return()=>{e=!1,clearInterval(t)}},[s,er]),(0,r.useEffect)(()=>{I(1)},[K,null==j?void 0:j.length]),(0,r.useEffect)(()=>{T([]),ee(!0)},[K]);let ea=e=>{let s="ascending";g.key===e&&"ascending"===g.direction&&(s="descending"),b({key:e,direction:s})},el=e=>g.key===e?"ascending"===g.direction?" ↑":" ↓":"";r.useMemo(()=>{let e=j||[];return{active:e.filter(e=>E.active.includes(e.status)).length,finished:e.filter(e=>E.finished.includes(e.status)).length}},[j]);let ei=e=>J.length>0?J.includes(e):"all"===K||E[K].includes(e),ec=r.useMemo(()=>{let e=R(j,l);return J.length>0?e.filter(e=>J.includes(e.status)):Y?"all"===K?e:e.filter(e=>E[K].includes(e.status)):[]},[j,K,J,Y,l]),eo=r.useMemo(()=>g.key?[...ec].sort((e,s)=>e[g.key]<s[g.key]?"ascending"===g.direction?-1:1:e[g.key]>s[g.key]?"ascending"===g.direction?1:-1:0):ec,[ec,g]),ed=Math.ceil(eo.length/O),eh=(M-1)*O,ex=eh+O,eu=eo.slice(eh,ex),em=e=>{if(J.includes(e)){let s=J.filter(s=>s!==e);0===s.length?(ee(!0),T([])):(T(s),ee(!1))}else T([...J,e]),ee(!1)};return(0,r.useEffect)(()=>{B((j||[]).reduce((e,s)=>(e[s.status]=(e[s.status]||0)+1,e),{}))},[j]),(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("div",{className:"flex flex-col space-y-1 mb-1",children:(0,n.jsxs)("div",{className:"flex flex-wrap items-center text-sm mb-1",children:[(0,n.jsx)("span",{className:"mr-2 text-sm font-medium",children:"Statuses:"}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-2 items-center",children:[!v&&(!j||0===j.length)&&!S&&(0,n.jsx)("span",{className:"text-gray-500 mr-2",children:"No jobs found"}),Object.entries(Z).map(e=>{let[s,t]=e;return(0,n.jsxs)("button",{onClick:()=>em(s),className:"px-3 py-1 rounded-full flex items-center space-x-2 ".concat(ei(s)||J.includes(s)?(0,y.Cl)(s):"bg-gray-50 text-gray-600 hover:bg-gray-100"),children:[(0,n.jsx)("span",{children:s}),(0,n.jsx)("span",{className:"text-xs ".concat(ei(s)||J.includes(s)?"bg-white/50":"bg-gray-200"," px-1.5 py-0.5 rounded"),children:t})]},s)}),j&&j.length>0&&(0,n.jsxs)("div",{className:"flex items-center ml-2 gap-2",children:[(0,n.jsx)("span",{className:"text-gray-500",children:"("}),(0,n.jsx)("button",{onClick:()=>{Q("all"),T([]),ee(!0)},className:"text-sm font-medium ".concat("all"===K&&Y?"text-purple-700 underline":"text-gray-600 hover:text-purple-700 hover:underline"),children:"show all jobs"}),(0,n.jsx)("span",{className:"text-gray-500 mx-1",children:"|"}),(0,n.jsx)("button",{onClick:()=>{Q("active"),T([]),ee(!0)},className:"text-sm font-medium ".concat("active"===K&&Y?"text-green-700 underline":"text-gray-600 hover:text-green-700 hover:underline"),children:"show all active jobs"}),(0,n.jsx)("span",{className:"text-gray-500 mx-1",children:"|"}),(0,n.jsx)("button",{onClick:()=>{Q("finished"),T([]),ee(!0)},className:"text-sm font-medium ".concat("finished"===K&&Y?"text-blue-700 underline":"text-gray-600 hover:text-blue-700 hover:underline"),children:"show all finished jobs"}),(0,n.jsx)("span",{className:"text-gray-500",children:")"})]})]})]})}),(0,n.jsx)(d.Zb,{children:(0,n.jsxs)(h.iA,{children:[(0,n.jsx)(h.xD,{children:(0,n.jsxs)(h.SC,{children:[(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("id"),children:["ID",el("id")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("name"),children:["Name",el("name")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("user"),children:["User",el("user")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("workspace"),children:["Workspace",el("workspace")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("submitted_at"),children:["Submitted",el("submitted_at")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("job_duration"),children:["Duration",el("job_duration")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("status"),children:["Status",el("status")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("priority"),children:["Priority",el("priority")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("resources_str"),children:["Requested",el("resources_str")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("infra"),children:["Infra",el("infra")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("cluster"),children:["Resources",el("cluster")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>ea("recoveries"),children:["Recoveries",el("recoveries")]}),(0,n.jsx)(h.ss,{children:"Details"}),(0,n.jsx)(h.ss,{children:"Logs"})]})}),(0,n.jsx)(h.RM,{children:v||S?(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:13,className:"text-center py-6 text-gray-500",children:(0,n.jsxs)("div",{className:"flex justify-center items-center",children:[(0,n.jsx)(c.Z,{size:20,className:"mr-2"}),(0,n.jsx)("span",{children:"Loading..."})]})})}):eu.length>0?(0,n.jsx)(n.Fragment,{children:eu.map(e=>(0,n.jsxs)(r.Fragment,{children:[(0,n.jsxs)(h.SC,{children:[(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.id})}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.name})}),(0,n.jsx)(h.pj,{children:e.user}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/workspaces",className:"text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,n.jsx)(h.pj,{children:_(e.submitted_at)}),(0,n.jsx)(h.pj,{children:(0,x.LU)(e.job_duration)}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(y.OE,{status:e.status})}),(0,n.jsx)(h.pj,{children:e.priority}),(0,n.jsx)(h.pj,{children:e.requested_resources}),(0,n.jsx)(h.pj,{children:e.infra&&"-"!==e.infra?(0,n.jsx)(x.Md,{content:e.full_infra||e.infra,className:"text-sm text-muted-foreground",children:(0,n.jsxs)("span",{children:[(0,n.jsx)(i(),{href:"/infra",className:"text-blue-600 hover:underline",children:e.cloud||e.infra.split("(")[0].trim()}),e.infra.includes("(")&&(0,n.jsx)("span",{children:" "+e.infra.substring(e.infra.indexOf("("))})]})}):(0,n.jsx)("span",{children:e.infra||"-"})}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(x.Md,{content:e.resources_str_full||e.resources_str,className:"text-sm text-muted-foreground",children:(0,n.jsx)("span",{children:e.resources_str})})}),(0,n.jsx)(h.pj,{children:e.recoveries}),(0,n.jsx)(h.pj,{children:e.details?(0,n.jsx)(z,{text:e.details,rowId:e.id,expandedRowId:F,setExpandedRowId:U}):"-"}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(D,{jobParent:"/jobs",jobId:e.id,managed:!0})})]}),F===e.id&&(0,n.jsx)(A,{text:e.details,colSpan:13,innerRef:P})]},e.id))}):(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:13,className:"text-center py-6",children:(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-4",children:[G&&(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,n.jsx)("p",{className:"text-gray-700",children:"The managed job controller is launching. It will be ready shortly."}),(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(c.Z,{size:12,className:"mr-2"}),(0,n.jsx)("span",{className:"text-gray-500",children:"Launching..."})]})]}),!V&&!G&&(0,n.jsx)("p",{className:"text-gray-500",children:"No active jobs"}),V&&(0,n.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,n.jsx)("p",{className:"text-gray-700",children:"The managed job controller has been stopped. Restart to check the latest job status."}),(0,n.jsx)(o.z,{variant:"outline",size:"sm",onClick:en,className:"text-sky-blue hover:text-sky-blue-bright",disabled:v||X,children:X?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(c.Z,{size:12,className:"mr-2"}),"Restarting..."]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(f.Z,{className:"h-4 w-4 mr-2"}),"Restart Controller"]})})]})]})})})})]})}),eo&&eo.length>0&&(0,n.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,n.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,n.jsxs)("div",{className:"relative inline-block",children:[(0,n.jsxs)("select",{value:O,onChange:e=>{W(parseInt(e.target.value,10)),I(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,n.jsx)("option",{value:10,children:"10"}),(0,n.jsx)("option",{value:30,children:"30"}),(0,n.jsx)("option",{value:50,children:"50"}),(0,n.jsx)("option",{value:100,children:"100"}),(0,n.jsx)("option",{value:200,children:"200"})]}),(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-gray-500 absolute right-0 top-1/2 transform -translate-y-1/2 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,n.jsxs)("div",{children:[eh+1," – ",Math.min(ex,eo.length)," of"," ",eo.length]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{I(e=>Math.max(e-1,1))},disabled:1===M,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-left",children:(0,n.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{I(e=>Math.min(e+1,ed))},disabled:M===ed||0===ed,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-right",children:(0,n.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})}),(0,n.jsx)(w.cV,{isOpen:es.isOpen,onClose:()=>et({...es,isOpen:!1}),onConfirm:es.onConfirm,title:es.title,message:es.message,confirmClassName:"bg-blue-600 hover:bg-blue-700 text-white"})]})}function D(e){let{withLabel:s=!1,jobParent:t,jobId:r,managed:l}=e,i=(0,a.useRouter)(),c=(e,s)=>{e.preventDefault(),e.stopPropagation(),i.push({pathname:"".concat(t,"/").concat(r),query:{tab:s}})};return(0,n.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,n.jsx)(x.WH,{content:"View Job Logs",className:"capitalize text-sm text-muted-foreground",children:(0,n.jsxs)("button",{onClick:e=>c(e,"logs"),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",children:[(0,n.jsx)(g.Z,{className:"w-4 h-4"}),s&&(0,n.jsx)("span",{className:"ml-1.5",children:"Logs"})]})},"logs"),l&&(0,n.jsx)(x.WH,{content:"View Controller Logs",className:"capitalize text-sm text-muted-foreground",children:(0,n.jsxs)("button",{onClick:e=>c(e,"controllerlogs"),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",children:[(0,n.jsx)(b.Z,{className:"w-4 h-4"}),s&&(0,n.jsx)("span",{className:"ml-2",children:"Controller Logs"})]})},"controllerlogs")]})}function O(e){let{clusterName:s,clusterJobData:t,loading:a,refreshClusterJobsOnly:l}=e,[u,m]=(0,r.useState)(null),[j,f]=(0,r.useState)({key:null,direction:"ascending"}),[g,b]=(0,r.useState)(1),[w,N]=(0,r.useState)(10),v=(0,r.useRef)(null),[k,C]=(0,r.useState)(null);(0,r.useEffect)(()=>{let e=e=>{u&&v.current&&!v.current.contains(e.target)&&m(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[u]);let S=r.useMemo(()=>t||[],[t]);(0,r.useEffect)(()=>{JSON.stringify(t)!==JSON.stringify(k)&&C(t)},[t,k]);let E=r.useMemo(()=>j.key?[...S].sort((e,s)=>e[j.key]<s[j.key]?"ascending"===j.direction?-1:1:e[j.key]>s[j.key]?"ascending"===j.direction?1:-1:0):S,[S,j]),L=e=>{let s="ascending";j.key===e&&"ascending"===j.direction&&(s="descending"),f({key:e,direction:s})},R=e=>j.key===e?"ascending"===j.direction?" ↑":" ↓":"",M=Math.ceil(E.length/w),I=(g-1)*w,O=I+w,W=E.slice(I,O);return(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsxs)(d.Zb,{children:[(0,n.jsxs)("div",{className:"flex items-center justify-between p-4",children:[(0,n.jsx)("h3",{className:"text-lg font-semibold",children:"Cluster Jobs"}),(0,n.jsx)("div",{className:"flex items-center",children:l&&(0,n.jsxs)("button",{onClick:l,disabled:a,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center text-sm ml-2",children:[(0,n.jsx)(p.Z,{className:"w-4 h-4 mr-1"}),"Refresh Jobs"]})})]}),(0,n.jsxs)(h.iA,{children:[(0,n.jsx)(h.xD,{children:(0,n.jsxs)(h.SC,{children:[(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("id"),children:["ID",R("id")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("job"),children:["Name",R("job")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("user"),children:["User",R("user")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("workspace"),children:["Workspace",R("workspace")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("submitted_at"),children:["Submitted",R("submitted_at")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("job_duration"),children:["Duration",R("job_duration")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("status"),children:["Status",R("status")]}),(0,n.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>L("resources"),children:["Resources",R("resources")]}),(0,n.jsx)(h.ss,{className:"whitespace-nowrap",children:"Logs"})]})}),(0,n.jsx)(h.RM,{children:a?(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:9,className:"text-center py-12 text-gray-500",children:(0,n.jsxs)("div",{className:"flex justify-center items-center",children:[(0,n.jsx)(c.Z,{size:24,className:"mr-2"}),(0,n.jsx)("span",{children:"Loading cluster jobs..."})]})})}):W.length>0?W.map(e=>(0,n.jsxs)(r.Fragment,{children:[(0,n.jsxs)(h.SC,{className:u===e.id?"selected-row":"",children:[(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/clusters/".concat(s,"/").concat(e.id),className:"text-blue-600",children:e.id})}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/clusters/".concat(s,"/").concat(e.id),className:"text-blue-600",children:(0,n.jsx)(z,{text:e.job||"Unnamed job",rowId:e.id,expandedRowId:u,setExpandedRowId:m})})}),(0,n.jsx)(h.pj,{children:e.user}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(i(),{href:"/workspaces",className:"text-blue-600 hover:underline",children:e.workspace||"default"})}),(0,n.jsx)(h.pj,{children:_(e.submitted_at)}),(0,n.jsx)(h.pj,{children:(0,x.LU)(e.job_duration)}),(0,n.jsx)(h.pj,{children:(0,n.jsx)(y.OE,{status:e.status})}),(0,n.jsx)(h.pj,{children:e.resources}),(0,n.jsx)(h.pj,{className:"flex content-center items-center",children:(0,n.jsx)(D,{jobParent:"/clusters/".concat(s),jobId:e.id,managed:!1})})]}),u===e.id&&(0,n.jsx)(A,{text:e.job||"Unnamed job",colSpan:9,innerRef:v})]},e.id)):(0,n.jsx)(h.SC,{children:(0,n.jsx)(h.pj,{colSpan:8,className:"text-center py-6 text-gray-500",children:"No jobs found"})})})]})]}),E&&E.length>0&&(0,n.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,n.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,n.jsxs)("div",{className:"relative inline-block",children:[(0,n.jsxs)("select",{value:w,onChange:e=>{N(parseInt(e.target.value,10)),b(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,n.jsx)("option",{value:5,children:"5"}),(0,n.jsx)("option",{value:10,children:"10"}),(0,n.jsx)("option",{value:20,children:"20"}),(0,n.jsx)("option",{value:50,children:"50"})]}),(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-gray-500 absolute right-0 top-1/2 transform -translate-y-1/2 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,n.jsxs)("div",{children:[I+1," – ",Math.min(O,E.length)," of"," ",E.length]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{b(e=>Math.max(e-1,1))},disabled:1===g,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-left",children:(0,n.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{b(e=>Math.min(e+1,M))},disabled:g===M||0===M,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-right",children:(0,n.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})})]})}function A(e){let{text:s,colSpan:t,innerRef:r}=e;return(0,n.jsx)(h.SC,{className:"expanded-details",children:(0,n.jsx)(h.pj,{colSpan:t,children:(0,n.jsx)("div",{className:"p-4 bg-gray-50 rounded-md border border-gray-200",ref:r,children:(0,n.jsx)("div",{className:"flex justify-between items-start",children:(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsx)("p",{className:"text-sm font-medium text-gray-900",children:"Full Details"}),(0,n.jsx)("p",{className:"mt-1 text-sm text-gray-700",style:{whiteSpace:"pre-wrap"},children:s})]})})})})})}function z(e){let{text:s,rowId:t,expandedRowId:a,setExpandedRowId:l}=e,i=s||"",c=i.length>50,o=a===t,d=c?"".concat(i.substring(0,50)):i,h=(0,r.useRef)(null);return(0,n.jsxs)("div",{className:"truncated-details relative max-w-full flex items-center",children:[(0,n.jsx)("span",{className:"truncate",children:d}),c&&(0,n.jsx)("button",{ref:h,type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),l(o?null:t)},className:"text-blue-600 hover:text-blue-800 font-medium ml-1 flex-shrink-0","data-button-type":"show-more-less",children:o?"... show less":"... show more"})]})}}}]);
@@ -1 +1 @@
1
- !function(){"use strict";var e,t,n,r,c,o,u,a,i,f={},s={};function d(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}},r=!0;try{f[e](n,n.exports,d),r=!1}finally{r&&delete s[e]}return n.exports}d.m=f,e=[],d.O=function(t,n,r,c){if(n){c=c||0;for(var o=e.length;o>0&&e[o-1][2]>c;o--)e[o]=e[o-1];e[o]=[n,r,c];return}for(var u=1/0,o=0;o<e.length;o++){for(var n=e[o][0],r=e[o][1],c=e[o][2],a=!0,i=0;i<n.length;i++)u>=c&&Object.keys(d.O).every(function(e){return d.O[e](n[i])})?n.splice(i--,1):(a=!1,c<u&&(u=c));if(a){e.splice(o--,1);var f=r();void 0!==f&&(t=f)}}return t},d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},d.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var c=Object.create(null);d.r(c);var o={};t=t||[null,n({}),n([]),n(n)];for(var u=2&r&&e;"object"==typeof u&&!~t.indexOf(u);u=n(u))Object.getOwnPropertyNames(u).forEach(function(t){o[t]=function(){return e[t]}});return o.default=function(){return e},d.d(c,o),c},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.f={},d.e=function(e){return Promise.all(Object.keys(d.f).reduce(function(t,n){return d.f[n](e,t),t},[]))},d.u=function(e){return 350===e?"static/chunks/350.9e123a4551f68b0d.js":491===e?"static/chunks/491.b3d264269613fe09.js":937===e?"static/chunks/937.3759f538f11a0953.js":42===e?"static/chunks/42.d39e24467181b06b.js":682===e?"static/chunks/682.4dd5dc116f740b5f.js":211===e?"static/chunks/211.692afc57e812ae1a.js":600===e?"static/chunks/600.9cc76ec442b22e10.js":513===e?"static/chunks/513.211357a2914a34b2.js":443===e?"static/chunks/443.b2242d0efcdf5f47.js":"static/chunks/"+e+"-"+({37:"d8aebf1683522a0b",470:"4d1a5dbe58a8a2b9",616:"d6128fa9e7cae6e6",664:"047bc03493fda379",760:"a89d354797ce7af5",798:"c0525dc3f21e488d",799:"3625946b2ec2eb30",804:"4c9fc53aa74bc191",843:"6fcc4bf91ac45b39",856:"0776dc6ed6000c39",901:"b424d293275e1fd7",938:"a75b7712639298b7",947:"6620842ef80ae879",969:"20d54a9d998dc102",973:"c807fc34f09c7df3"})[e]+".js"},d.miniCssF=function(e){},d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},c="_N_E:",d.l=function(e,t,n,o){if(r[e]){r[e].push(t);return}if(void 0!==n)for(var u,a,i=document.getElementsByTagName("script"),f=0;f<i.length;f++){var s=i[f];if(s.getAttribute("src")==e||s.getAttribute("data-webpack")==c+n){u=s;break}}u||(a=!0,(u=document.createElement("script")).charset="utf-8",u.timeout=120,d.nc&&u.setAttribute("nonce",d.nc),u.setAttribute("data-webpack",c+n),u.src=d.tu(e)),r[e]=[t];var l=function(t,n){u.onerror=u.onload=null,clearTimeout(b);var c=r[e];if(delete r[e],u.parentNode&&u.parentNode.removeChild(u),c&&c.forEach(function(e){return e(n)}),t)return t(n)},b=setTimeout(l.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=l.bind(null,u.onerror),u.onload=l.bind(null,u.onload),a&&document.head.appendChild(u)},d.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.tt=function(){return void 0===o&&(o={createScriptURL:function(e){return e}},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(o=trustedTypes.createPolicy("nextjs#bundler",o))),o},d.tu=function(e){return d.tt().createScriptURL(e)},d.p="/dashboard/_next/",u={272:0},d.f.j=function(e,t){var n=d.o(u,e)?u[e]:void 0;if(0!==n){if(n)t.push(n[2]);else if(272!=e){var r=new Promise(function(t,r){n=u[e]=[t,r]});t.push(n[2]=r);var c=d.p+d.u(e),o=Error();d.l(c,function(t){if(d.o(u,e)&&(0!==(n=u[e])&&(u[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),c=t&&t.target&&t.target.src;o.message="Loading chunk "+e+" failed.\n("+r+": "+c+")",o.name="ChunkLoadError",o.type=r,o.request=c,n[1](o)}},"chunk-"+e,e)}else u[e]=0}},d.O.j=function(e){return 0===u[e]},a=function(e,t){var n,r,c=t[0],o=t[1],a=t[2],i=0;if(c.some(function(e){return 0!==u[e]})){for(n in o)d.o(o,n)&&(d.m[n]=o[n]);if(a)var f=a(d)}for(e&&e(t);i<c.length;i++)r=c[i],d.o(u,r)&&u[r]&&u[r][0](),u[r]=0;return d.O(f)},(i=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(a.bind(null,0)),i.push=a.bind(null,i.push.bind(i)),d.nc=void 0}();
1
+ !function(){"use strict";var e,t,n,r,c,o,u,a,i,f={},s={};function d(e){var t=s[e];if(void 0!==t)return t.exports;var n=s[e]={exports:{}},r=!0;try{f[e](n,n.exports,d),r=!1}finally{r&&delete s[e]}return n.exports}d.m=f,e=[],d.O=function(t,n,r,c){if(n){c=c||0;for(var o=e.length;o>0&&e[o-1][2]>c;o--)e[o]=e[o-1];e[o]=[n,r,c];return}for(var u=1/0,o=0;o<e.length;o++){for(var n=e[o][0],r=e[o][1],c=e[o][2],a=!0,i=0;i<n.length;i++)u>=c&&Object.keys(d.O).every(function(e){return d.O[e](n[i])})?n.splice(i--,1):(a=!1,c<u&&(u=c));if(a){e.splice(o--,1);var f=r();void 0!==f&&(t=f)}}return t},d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},n=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},d.t=function(e,r){if(1&r&&(e=this(e)),8&r||"object"==typeof e&&e&&(4&r&&e.__esModule||16&r&&"function"==typeof e.then))return e;var c=Object.create(null);d.r(c);var o={};t=t||[null,n({}),n([]),n(n)];for(var u=2&r&&e;"object"==typeof u&&!~t.indexOf(u);u=n(u))Object.getOwnPropertyNames(u).forEach(function(t){o[t]=function(){return e[t]}});return o.default=function(){return e},d.d(c,o),c},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.f={},d.e=function(e){return Promise.all(Object.keys(d.f).reduce(function(t,n){return d.f[n](e,t),t},[]))},d.u=function(e){return 350===e?"static/chunks/350.9e123a4551f68b0d.js":491===e?"static/chunks/491.b3d264269613fe09.js":937===e?"static/chunks/937.3759f538f11a0953.js":42===e?"static/chunks/42.d39e24467181b06b.js":682===e?"static/chunks/682.4dd5dc116f740b5f.js":211===e?"static/chunks/211.692afc57e812ae1a.js":600===e?"static/chunks/600.15a0009177e86b86.js":513===e?"static/chunks/513.211357a2914a34b2.js":443===e?"static/chunks/443.b2242d0efcdf5f47.js":"static/chunks/"+e+"-"+({37:"d8aebf1683522a0b",470:"4d1a5dbe58a8a2b9",616:"d6128fa9e7cae6e6",664:"047bc03493fda379",760:"a89d354797ce7af5",798:"c0525dc3f21e488d",799:"3625946b2ec2eb30",804:"4c9fc53aa74bc191",843:"6fcc4bf91ac45b39",856:"0776dc6ed6000c39",901:"b424d293275e1fd7",938:"ab185187a63f9cdb",947:"6620842ef80ae879",969:"20d54a9d998dc102",973:"c807fc34f09c7df3"})[e]+".js"},d.miniCssF=function(e){},d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r={},c="_N_E:",d.l=function(e,t,n,o){if(r[e]){r[e].push(t);return}if(void 0!==n)for(var u,a,i=document.getElementsByTagName("script"),f=0;f<i.length;f++){var s=i[f];if(s.getAttribute("src")==e||s.getAttribute("data-webpack")==c+n){u=s;break}}u||(a=!0,(u=document.createElement("script")).charset="utf-8",u.timeout=120,d.nc&&u.setAttribute("nonce",d.nc),u.setAttribute("data-webpack",c+n),u.src=d.tu(e)),r[e]=[t];var l=function(t,n){u.onerror=u.onload=null,clearTimeout(b);var c=r[e];if(delete r[e],u.parentNode&&u.parentNode.removeChild(u),c&&c.forEach(function(e){return e(n)}),t)return t(n)},b=setTimeout(l.bind(null,void 0,{type:"timeout",target:u}),12e4);u.onerror=l.bind(null,u.onerror),u.onload=l.bind(null,u.onload),a&&document.head.appendChild(u)},d.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.tt=function(){return void 0===o&&(o={createScriptURL:function(e){return e}},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(o=trustedTypes.createPolicy("nextjs#bundler",o))),o},d.tu=function(e){return d.tt().createScriptURL(e)},d.p="/dashboard/_next/",u={272:0},d.f.j=function(e,t){var n=d.o(u,e)?u[e]:void 0;if(0!==n){if(n)t.push(n[2]);else if(272!=e){var r=new Promise(function(t,r){n=u[e]=[t,r]});t.push(n[2]=r);var c=d.p+d.u(e),o=Error();d.l(c,function(t){if(d.o(u,e)&&(0!==(n=u[e])&&(u[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),c=t&&t.target&&t.target.src;o.message="Loading chunk "+e+" failed.\n("+r+": "+c+")",o.name="ChunkLoadError",o.type=r,o.request=c,n[1](o)}},"chunk-"+e,e)}else u[e]=0}},d.O.j=function(e){return 0===u[e]},a=function(e,t){var n,r,c=t[0],o=t[1],a=t[2],i=0;if(c.some(function(e){return 0!==u[e]})){for(n in o)d.o(o,n)&&(d.m[n]=o[n]);if(a)var f=a(d)}for(e&&e(t);i<c.length;i++)r=c[i],d.o(u,r)&&u[r]&&u[r][0](),u[r]=0;return d.O(f)},(i=self.webpackChunk_N_E=self.webpackChunk_N_E||[]).forEach(a.bind(null,0)),i.push=a.bind(null,i.push.bind(i)),d.nc=void 0}();