-
Notifications
You must be signed in to change notification settings - Fork 14
Feat: Active presets init #806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
688a943
efd87c8
f968560
60ce48b
7b14b6c
0cb523a
d20fa57
ea1c314
594a16f
4e85b64
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,24 +21,28 @@ class FilterPreset(BaseDTO): | |
last_updated_at: Optional[datetime] = Field(default=None, alias="lastUpdatedAt") | ||
|
||
|
||
class GetProjectFilterPresetParams(BaseDTO): | ||
preset_uuids: Optional[List[uuid.UUID]] = Field(default=[]) | ||
page_token: Optional[str] = Field(default=None) | ||
page_size: Optional[int] = Field(default=None) | ||
|
||
|
||
class ProjectFilterPreset(BaseDTO): | ||
preset_uuid: uuid.UUID = Field(alias="presetUuid") | ||
name: str | ||
created_at: Optional[datetime] = Field(default=None) | ||
updated_at: Optional[datetime] = Field(default=None) | ||
|
||
|
||
class FilterDefinition(BaseDTO): | ||
filters: List[Dict] = Field(default_factory=list) | ||
|
||
|
||
class FilterPresetDefinition(BaseDTO): | ||
local_filters: Dict[str, FilterDefinition] = Field( | ||
default_factory=lambda: {str(uuid.UUID(int=0)): FilterDefinition()}, alias="local_filters" | ||
default_factory=lambda: {str(uuid.UUID(int=0)): FilterDefinition()}, | ||
) | ||
global_filters: FilterDefinition = Field(default_factory=FilterDefinition, alias="global_filters") | ||
|
||
@dto_validator(mode="after") | ||
def check_not_empty(cls, self): | ||
if len(self.global_filters.filters) == 0 and all( | ||
[len(value.filters) == 0 for value in self.local_filters.values()] | ||
): | ||
raise ValueError("FilterPresetDefinition definition must contain at least one global or local filter.") | ||
|
||
return self | ||
global_filters: FilterDefinition = Field(default_factory=FilterDefinition) | ||
|
||
|
||
class GetPresetsResponse(BaseDTO): | ||
|
@@ -51,11 +55,9 @@ class CreatePresetParams(BaseDTO): | |
|
||
class CreatePresetPayload(BaseDTO): | ||
name: str | ||
description: Optional[str] = "" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not a real parameter There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is emblematic of Active/ Index being a bad overload of two very similiar functionalitys branching at random points. For some reason, we do have a description that we don't render |
||
filter_preset_json: Dict | ||
|
||
|
||
class UpdatePresetPayload(BaseDTO): | ||
name: Optional[str] = None | ||
description: Optional[str] = None | ||
filter_preset: Optional[FilterPresetDefinition] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lengthy commit message describing why this had to go