Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions frontend/src/pages/Events/List/hooks/useColumnDefinitions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,19 @@ export const useColumnsDefinitions = () => {
</div>
);

case 'gateway-replica':
return (
<div>
Gateway replica{' '}
{target.project_name && (
<NavigateLink href={ROUTES.PROJECT.DETAILS.FORMAT(target.project_name)}>
{target.project_name}
</NavigateLink>
)}
/{target.name}
</div>
);

case 'secret':
return (
<div>
Expand Down
18 changes: 18 additions & 0 deletions frontend/src/pages/Events/List/hooks/useFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ const filterKeys: Record<string, RequestParamsKeys> = {
TARGET_JOBS: 'target_jobs',
TARGET_VOLUMES: 'target_volumes',
TARGET_GATEWAYS: 'target_gateways',
TARGET_GATEWAY_REPLICAS: 'target_gateway_replicas',
TARGET_SECRETS: 'target_secrets',
TARGET_PRESETS: 'target_presets',
WITHIN_PROJECTS: 'within_projects',
WITHIN_FLEETS: 'within_fleets',
WITHIN_RUNS: 'within_runs',
WITHIN_GATEWAYS: 'within_gateways',
INCLUDE_TARGET_TYPES: 'include_target_types',
ACTORS: 'actors',
};
Expand All @@ -47,11 +49,13 @@ const multipleChoiseKeys: RequestParamsKeys[] = [
'target_jobs',
'target_volumes',
'target_gateways',
'target_gateway_replicas',
'target_secrets',
'target_presets',
'within_projects',
'within_fleets',
'within_runs',
'within_gateways',
'include_target_types',
'actors',
];
Expand All @@ -65,6 +69,7 @@ const targetTypes = [
{ label: 'Job', value: 'job' },
{ label: 'Volume', value: 'volume' },
{ label: 'Gateway', value: 'gateway' },
{ label: 'Gateway replica', value: 'gateway-replica' },
{ label: 'Secret', value: 'secret' },
{ label: 'Preset', value: 'preset' },
];
Expand Down Expand Up @@ -118,6 +123,12 @@ const baseFilteringProperties = [
propertyLabel: 'Target gateway IDs',
groupValuesLabel: 'Gateway ids',
},
{
key: filterKeys.TARGET_GATEWAY_REPLICAS,
operators: ['='],
propertyLabel: 'Target gateway replica IDs',
groupValuesLabel: 'Gateway replica ids',
},
{
key: filterKeys.TARGET_SECRETS,
operators: ['='],
Expand Down Expand Up @@ -152,6 +163,13 @@ const baseFilteringProperties = [
groupValuesLabel: 'Run ids',
},

{
key: filterKeys.WITHIN_GATEWAYS,
operators: ['='],
propertyLabel: 'Within gateway IDs',
groupValuesLabel: 'Gateway ids',
},

{
key: filterKeys.INCLUDE_TARGET_TYPES,
operators: ['='],
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/types/event.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ declare type TEventTargetType =
| 'job'
| 'volume'
| 'gateway'
| 'gateway-replica'
| 'secret'
| 'preset';

Expand All @@ -20,11 +21,13 @@ declare type TEventListFilters = {
target_jobs?: string[];
target_volumes?: string[];
target_gateways?: string[];
target_gateway_replicas?: string[];
target_secrets?: string[];
target_presets?: string[];
within_projects?: string[];
within_fleets?: string[];
within_runs?: string[];
within_gateways?: string[];
include_target_types?: TEventTargetType[];
actors?: string[];
};
Expand Down
13 changes: 13 additions & 0 deletions src/dstack/_internal/cli/commands/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ def _register(self):
dest="within_runs",
help="Only show events that target the specified runs or jobs within those runs",
)
within_filters_group.add_argument(
"--within-gateway",
action="append",
metavar="NAME",
dest="within_gateways",
type=EntityReference.parse,
help="Only show events that target the specified gateways or replicas within those gateways",
)
parser.add_argument(
"--include-target-type",
action="append",
Expand Down Expand Up @@ -175,6 +183,11 @@ def _build_filters(args: argparse.Namespace, api: Client) -> EventListFilters:
filters.within_runs = [
api.client.runs.get(api.project, name).id for name in args.within_runs
]
elif args.within_gateways:
filters.within_gateways = [
api.client.gateways.get(ref.project or api.project, ref.name).id
for ref in args.within_gateways
]
elif not has_target_filters:
# default - limit to current project,
# unless there are more specific filters (e.g., for imported entities)
Expand Down
1 change: 1 addition & 0 deletions src/dstack/_internal/cli/services/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class EventListFilters:
within_projects: Optional[list[uuid.UUID]] = None
within_fleets: Optional[list[uuid.UUID]] = None
within_runs: Optional[list[uuid.UUID]] = None
within_gateways: Optional[list[uuid.UUID]] = None
include_target_types: Optional[list[EventTargetType]] = None


Expand Down
4 changes: 4 additions & 0 deletions src/dstack/_internal/core/compatibility/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ def get_list_events_excludes(request: ListEventsRequest) -> IncludeExcludeDictTy
list_events_excludes: IncludeExcludeDictType = {}
if request.target_presets is None:
list_events_excludes["target_presets"] = True
if request.target_gateway_replicas is None:
list_events_excludes["target_gateway_replicas"] = True
if request.within_gateways is None:
list_events_excludes["within_gateways"] = True
return list_events_excludes
1 change: 1 addition & 0 deletions src/dstack/_internal/core/models/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class EventTargetType(str, Enum):
JOB = "job"
VOLUME = "volume"
GATEWAY = "gateway"
GATEWAY_REPLICA = "gateway-replica"
SECRET = "secret"
PRESET = "preset"

Expand Down
Loading
Loading