-
Notifications
You must be signed in to change notification settings - Fork 428
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(logs): feedback #4 #2269
Merged
Merged
fix(logs): feedback #4 #2269
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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
There are no files selected for viewing
This file contains 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 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 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 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 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 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 |
---|---|---|
|
@@ -19,9 +19,10 @@ import { | |
import type { SyncResponse, RunSyncCommand } from '../../types'; | ||
import type { Connection } from '@nangohq/types'; | ||
import { UserFacingSyncCommand } from '../../types'; | ||
import { formatFrequency, getRunTime, parseLatestSyncResult, formatDateToUSFormat, interpretNextRun, getSimpleDate } from '../../utils/utils'; | ||
import { formatFrequency, getRunTime, parseLatestSyncResult, formatDateToUSFormat, interpretNextRun } from '../../utils/utils'; | ||
import Button from '../../components/ui/button/Button'; | ||
import { useRunSyncAPI } from '../../utils/api'; | ||
import { getLogsUrl } from '../../utils/logs'; | ||
|
||
interface SyncsProps { | ||
syncs: SyncResponse[] | undefined; | ||
|
@@ -120,11 +121,17 @@ export default function Syncs({ syncs, connection, provider, reload, loaded, syn | |
setShowTriggerFullLoader(false); | ||
}; | ||
|
||
const renderBubble = (bubbleType: ReactNode, sync: SyncResponse) => { | ||
const RenderBubble = ({ sync, children }: { sync: SyncResponse; children: ReactNode }) => { | ||
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. Changed that to a proper component for clarification |
||
const hasActivityLogId = sync.latest_sync?.activity_log_id !== null; | ||
const linkPath = `/${env}/activity?activity_log_id=${sync.latest_sync?.activity_log_id}&connection=${connection?.connection_id}&script=${sync.name}&date=${getSimpleDate(sync.latest_sync?.updated_at)}`; | ||
const linkPath = getLogsUrl({ | ||
env, | ||
operationId: sync.latest_sync?.activity_log_id, | ||
connections: connection?.connection_id, | ||
syncs: sync.name, | ||
day: new Date(sync.latest_sync?.updated_at) | ||
}); | ||
|
||
return hasActivityLogId ? <Link to={linkPath}>{bubbleType}</Link> : <div>{bubbleType}</div>; | ||
return hasActivityLogId ? <Link to={linkPath}>{children}</Link> : <div>{children}</div>; | ||
}; | ||
|
||
if (!loaded || !syncLoaded || syncs === null) return <Loading spaceRatio={2.5} className="top-24" />; | ||
|
@@ -199,34 +206,34 @@ export default function Syncs({ syncs, connection, provider, reload, loaded, syn | |
</div> | ||
<div className="flex w-20 -ml-2"> | ||
<span className=""> | ||
{sync.status === 'PAUSED' && | ||
renderBubble( | ||
{sync.status === 'PAUSED' && ( | ||
<RenderBubble sync={sync}> | ||
<Tag bgClassName="bg-yellow-500 bg-opacity-30" textClassName="text-yellow-500"> | ||
Paused | ||
</Tag>, | ||
sync | ||
)} | ||
{(sync?.status === 'ERROR' || sync?.status === 'STOPPED') && | ||
renderBubble( | ||
</Tag> | ||
</RenderBubble> | ||
)} | ||
{(sync?.status === 'ERROR' || sync?.status === 'STOPPED') && ( | ||
<RenderBubble sync={sync}> | ||
<Tag bgClassName="bg-red-base bg-opacity-30" textClassName="text-red-base"> | ||
Failed | ||
</Tag>, | ||
sync | ||
)} | ||
{sync?.status === 'RUNNING' && | ||
renderBubble( | ||
</Tag> | ||
</RenderBubble> | ||
)} | ||
{sync?.status === 'RUNNING' && ( | ||
<RenderBubble sync={sync}> | ||
<Tag bgClassName="bg-blue-base bg-opacity-30" textClassName="text-blue-base"> | ||
Syncing | ||
</Tag>, | ||
sync | ||
)} | ||
{sync?.status === 'SUCCESS' && | ||
renderBubble( | ||
</Tag> | ||
</RenderBubble> | ||
)} | ||
{sync?.status === 'SUCCESS' && ( | ||
<RenderBubble sync={sync}> | ||
<Tag bgClassName="bg-green-base bg-opacity-30" textClassName="text-green-base"> | ||
Success | ||
</Tag>, | ||
sync | ||
)} | ||
</Tag> | ||
</RenderBubble> | ||
)} | ||
</span> | ||
</div> | ||
<div className="flex items-center w-10">{formatFrequency(sync.frequency)}</div> | ||
|
@@ -235,7 +242,13 @@ export default function Syncs({ syncs, connection, provider, reload, loaded, syn | |
<Tooltip text={<pre>{parseLatestSyncResult(sync.latest_sync.result, sync.latest_sync.models)}</pre>} type="dark"> | ||
{sync.latest_sync?.activity_log_id !== null ? ( | ||
<Link | ||
to={`/${env}/activity?activity_log_id=${sync.latest_sync?.activity_log_id}&connection=${connection?.connection_id}&script=${sync.name}&date=${getSimpleDate(sync.latest_sync?.updated_at)}`} | ||
to={getLogsUrl({ | ||
env, | ||
operationId: sync.latest_sync?.activity_log_id, | ||
connections: connection?.connection_id, | ||
syncs: sync.name, | ||
day: new Date(sync.latest_sync?.updated_at) | ||
})} | ||
className="block w-32 ml-1" | ||
> | ||
{formatDateToUSFormat(sync.latest_sync?.updated_at)} | ||
|
@@ -248,7 +261,13 @@ export default function Syncs({ syncs, connection, provider, reload, loaded, syn | |
<> | ||
{sync.latest_sync?.activity_log_id ? ( | ||
<Link | ||
to={`/${env}/activity?activity_log_id=${sync.latest_sync?.activity_log_id}&connection=${connection?.connection_id}&script=${sync.name}&date=${getSimpleDate(sync.latest_sync?.updated_at)}`} | ||
to={getLogsUrl({ | ||
env, | ||
operationId: sync.latest_sync?.activity_log_id, | ||
connections: connection?.connection_id, | ||
syncs: sync.name, | ||
day: new Date(sync.latest_sync?.updated_at) | ||
})} | ||
className="" | ||
> | ||
{formatDateToUSFormat(sync.latest_sync?.updated_at)} | ||
|
@@ -396,7 +415,13 @@ export default function Syncs({ syncs, connection, provider, reload, loaded, syn | |
</span> | ||
</div> | ||
<Link | ||
to={`/${env}/activity?activity_log_id=${sync.latest_sync?.activity_log_id || sync.active_logs?.activity_log_id}&connection=${connection?.connection_id}&script=${sync.name}&date=${getSimpleDate(sync.latest_sync?.updated_at)}`} | ||
to={getLogsUrl({ | ||
env, | ||
operationId: sync.latest_sync?.activity_log_id || sync.active_logs?.activity_log_id, | ||
connections: connection?.connection_id, | ||
syncs: sync.name, | ||
day: new Date(sync.latest_sync?.updated_at) | ||
})} | ||
className={`flex items-center w-full whitespace-nowrap hover:bg-neutral-800 px-4 py-2`} | ||
> | ||
<QueueListIcon className={`flex h-6 w-6 text-gray-400 cursor-pointer`} /> | ||
|
Oops, something went wrong.
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.
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.
When clicking from the connections page I get this
which in of itself the x looks misaligned
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.
bad-link.mov
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.
weird, thanks for testing that looking into it
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.
I don't have any issue on my side, however I noted the Failed state does not appear if the schedule is paused
Screen.Recording.2024-06-06.at.11.36.21.mov