Skip to content
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

fix(ui): assignee to show on hover #3352

Merged
merged 4 commits into from
Feb 9, 2025
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
24 changes: 24 additions & 0 deletions examples/workflows/opsgenie-create-alert.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
id: opsgenie-create-alert
description: Create an alert in OpsGenie
triggers:
- type: manual
- type: alert
filters:
- key: source
value: coralogix
- key: severity
value: critical
actions:
- name: create-alert
provider:
config: "{{ providers.opsgenie }}"
type: opsgenie
if: "not '{{ alert.opsgenie_alert_id }}'"
with:
message: "{{ alert.name }}"
responders:
- name: "{{ alert.team }}"
type: team
enrich_alert:
- key: opsgenie_alert_id
value: results.alertId
5 changes: 4 additions & 1 deletion keep-ui/components/navbar/UserAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ interface Props {
image: string | null | undefined;
name: string;
size?: "sm" | "xs";
email?: string;
}

export const getInitials = (name: string) =>
((name.match(/(^\S\S?|\b\S)?/g) ?? []).join("").match(/(^\S|\S$)?/g) ?? [])
.join("")
.toUpperCase();

export default function UserAvatar({ image, name, size = "sm" }: Props) {
export default function UserAvatar({ image, name, size = "sm", email }: Props) {
const sizeClass = (function (size: "sm" | "xs") {
if (size === "sm") return "w-7 h-7";
if (size === "xs") return "w-5 h-5";
Expand All @@ -28,13 +29,15 @@ export default function UserAvatar({ image, name, size = "sm" }: Props) {
alt="user avatar"
width={sizeValue}
height={sizeValue}
title={email ?? name}
/>
) : (
<span
className={clsx(
"relative inline-flex items-center justify-center overflow-hidden bg-orange-400 rounded-full dark:bg-gray-600",
sizeClass
)}
title={email ?? name}
>
<span className="font-medium text-white text-xs">
{getInitials(name)}
Expand Down
9 changes: 8 additions & 1 deletion keep-ui/entities/users/ui/UserStatefulAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,12 @@ export function UserStatefulAvatar({
/>
);
}
return <UserAvatar name={user?.name} image={user?.picture} size={size} />;
return (
<UserAvatar
name={user?.name}
image={user?.picture}
size={size}
email={email}
/>
);
}
4 changes: 2 additions & 2 deletions keep/providers/coralogix_provider/coralogix_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _format_alert(
fields_list = event["fields"] if "fields" in event else []
fields = {item["key"]: item["value"] for item in fields_list}

labels = fields.get("text", fields.get("labels"))
labels = fields.get("text", fields.get("labels", {}))
if isinstance(labels, str):
try:
labels = json.loads(labels)
Expand Down Expand Up @@ -97,7 +97,7 @@ def _format_alert(
priority=fields.get("priority"),
computer=fields.get("computer"),
fields=fields,
labels=labels,
labels=labels if isinstance(labels, dict) else {},
source=["coralogix"],
)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_workflow_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -934,14 +934,14 @@ def test_workflow_execution_logs(
assert workflow_execution.status == "success"

# Get logs from DB
db_session.expire_all()
logs = (
db_session.query(WorkflowExecutionLog)
.filter(WorkflowExecutionLog.workflow_execution_id == workflow_execution.id)
.all()
)

# Since we're using a filter now, verify that all logs have workflow_execution_id
time.sleep(2)
assert len(logs) > 0 # We should have some logs
for log in logs:
assert log.workflow_execution_id == workflow_execution.id
Expand Down
Loading