-
Notifications
You must be signed in to change notification settings - Fork 21.6k
Feat/add status filter to workflow runs #26850
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
Merged
crazywoola
merged 10 commits into
langgenius:main
from
twjackysu:feat/add-status-filter-to-workflow-runs
Oct 18, 2025
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ee7ba2f
feat: add status filter for workflow run console API
twjackysu a04ef10
feat: add workflow_run/count API
twjackysu a8f01c2
fix: fix gemini-code-assist suggestion
twjackysu a5a883d
test: add UT
twjackysu 1c52b7f
fix: reformat after fix suggestion & add UI
trend-jacky-su 16a5717
feat: add time_range filter for monitor
twjackysu 79e1e53
fix: fix gemini suggestion
twjackysu 22cc8d9
Merge remote-tracking branch 'remotes/fork/main' into feat/add-status…
twjackysu 7be7165
Merge branch 'main' into feat/add-status-filter-to-workflow-runs
twjackysu a3f7734
Merge branch 'main' into feat/add-status-filter-to-workflow-runs
twjackysu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| """Custom input types for Flask-RESTX request parsing.""" | ||
|
|
||
| import re | ||
|
|
||
|
|
||
| def time_duration(value: str) -> str: | ||
| """ | ||
| Validate and return time duration string. | ||
|
|
||
| Accepts formats: <number>d (days), <number>h (hours), <number>m (minutes), <number>s (seconds) | ||
| Examples: 7d, 4h, 30m, 30s | ||
|
|
||
| Args: | ||
| value: The time duration string | ||
|
|
||
| Returns: | ||
| The validated time duration string | ||
|
|
||
| Raises: | ||
| ValueError: If the format is invalid | ||
| """ | ||
| if not value: | ||
| raise ValueError("Time duration cannot be empty") | ||
|
|
||
| pattern = r"^(\d+)([dhms])$" | ||
| if not re.match(pattern, value.lower()): | ||
| raise ValueError( | ||
| "Invalid time duration format. Use: <number>d (days), <number>h (hours), " | ||
| "<number>m (minutes), or <number>s (seconds). Examples: 7d, 4h, 30m, 30s" | ||
| ) | ||
|
|
||
| return value.lower() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| """Time duration parser utility.""" | ||
|
|
||
| import re | ||
| from datetime import UTC, datetime, timedelta | ||
|
|
||
|
|
||
| def parse_time_duration(duration_str: str) -> timedelta | None: | ||
| """ | ||
| Parse time duration string to timedelta. | ||
|
|
||
| Supported formats: | ||
| - 7d: 7 days | ||
| - 4h: 4 hours | ||
| - 30m: 30 minutes | ||
| - 30s: 30 seconds | ||
|
|
||
| Args: | ||
| duration_str: Duration string (e.g., "7d", "4h", "30m", "30s") | ||
|
|
||
| Returns: | ||
| timedelta object or None if invalid format | ||
| """ | ||
| if not duration_str: | ||
| return None | ||
|
|
||
| # Pattern: number followed by unit (d, h, m, s) | ||
| pattern = r"^(\d+)([dhms])$" | ||
| match = re.match(pattern, duration_str.lower()) | ||
|
|
||
| if not match: | ||
| return None | ||
|
|
||
| value = int(match.group(1)) | ||
| unit = match.group(2) | ||
|
|
||
| if unit == "d": | ||
| return timedelta(days=value) | ||
| elif unit == "h": | ||
| return timedelta(hours=value) | ||
| elif unit == "m": | ||
| return timedelta(minutes=value) | ||
| elif unit == "s": | ||
| return timedelta(seconds=value) | ||
|
|
||
| return None | ||
|
|
||
|
|
||
| def get_time_threshold(duration_str: str | None) -> datetime | None: | ||
| """ | ||
| Get datetime threshold from duration string. | ||
|
|
||
| Calculates the datetime that is duration_str ago from now. | ||
|
|
||
| Args: | ||
| duration_str: Duration string (e.g., "7d", "4h", "30m", "30s") | ||
|
|
||
| Returns: | ||
| datetime object representing the threshold time, or None if no duration | ||
| """ | ||
| if not duration_str: | ||
| return None | ||
|
|
||
| duration = parse_time_duration(duration_str) | ||
| if duration is None: | ||
| return None | ||
|
|
||
| return datetime.now(UTC) - duration |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.