Skip to content

Commit

Permalink
Merge branch 'main' into remove-on-error-continue
Browse files Browse the repository at this point in the history
  • Loading branch information
Amogh-Bharadwaj authored Mar 18, 2024
2 parents d73f8d0 + bb87b15 commit 1c6cc69
Show file tree
Hide file tree
Showing 6 changed files with 2,707 additions and 2,078 deletions.
15 changes: 2 additions & 13 deletions flow/connectors/postgres/qvalue_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,19 +231,8 @@ func parseFieldFromQValueKind(qvalueKind qvalue.QValueKind, value interface{}) (
case qvalue.QValueKindTime:
timeVal := value.(pgtype.Time)
if timeVal.Valid {
var timeValStr any
timeValStr, err := timeVal.Value()
if err != nil {
return qvalue.QValue{}, fmt.Errorf("failed to parse time: %w", err)
}
// edge case, only Postgres supports this extreme value for time
timeValStr = strings.Replace(timeValStr.(string), "24:00:00.000000", "23:59:59.999999", 1)
t, err := time.Parse("15:04:05.999999", timeValStr.(string))
t = t.AddDate(1970, 0, 0)
if err != nil {
return qvalue.QValue{}, fmt.Errorf("failed to parse time: %w", err)
}
val = qvalue.QValue{Kind: qvalue.QValueKindTime, Value: t}
// 86399999999 to prevent 24:00:00
val = qvalue.QValue{Kind: qvalue.QValueKindTime, Value: time.UnixMicro(min(timeVal.Microseconds, 86399999999))}
}
case qvalue.QValueKindTimeTZ:
timeVal := value.(string)
Expand Down
65 changes: 59 additions & 6 deletions ui/app/peers/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,72 @@ export default function Peers() {
>
Peers
</Header>
<Label>
Peers represent a data store. Once you have a couple of peers, you can
start moving data between them through mirrors.
</Label>
</Panel>
<Panel>
{isLoading && (
<div className='h-screen flex items-center justify-center'>
<ProgressCircle variant='determinate_progress_circle' />
</div>
)}
{!isLoading && (
<PeersTable
title='All peers'
peers={peers.map((peer: any) => peer)}
/>
)}
{!isLoading &&
(peers && peers.length == 0 ? (
<div
style={{
display: 'flex',
alignItems: 'center',
columnGap: '1rem',
}}
>
<Button
as={Link}
href={'/peers/create'}
style={{
width: 'fit-content',
boxShadow: '0px 2px 2px rgba(0,0,0,0.1)',
}}
variant='normalSolid'
>
<div
style={{
display: 'flex',
alignItems: 'center',
whiteSpace: 'nowrap',
}}
>
<Icon name='add' />
<Label>Add your first peer</Label>
</div>
</Button>

<Button
as={Link}
href={'https://docs.peerdb.io/features/supported-connectors'}
target={'_blank'}
style={{
width: 'fit-content',
boxShadow: '0px 2px 2px rgba(0,0,0,0.1)',
}}
variant='normal'
>
<div
style={{
display: 'flex',
alignItems: 'center',
whiteSpace: 'nowrap',
}}
>
<Icon name='info' />
<Label>Learn more about peers</Label>
</div>
</Button>
</div>
) : (
<PeersTable peers={peers.map((peer: any) => peer)} />
))}
</Panel>
</LayoutMain>
);
Expand Down
3 changes: 1 addition & 2 deletions ui/app/peers/peersTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function PeerRow({ peer }: { peer: Peer }) {
);
}

function PeersTable({ title, peers }: { title: string; peers: Peer[] }) {
function PeersTable({ peers }: { peers: Peer[] }) {
const [searchQuery, setSearchQuery] = useState<string>('');
const [filteredType, setFilteredType] = useState<DBType | undefined>(
undefined
Expand Down Expand Up @@ -65,7 +65,6 @@ function PeersTable({ title, peers }: { title: string; peers: Peer[] }) {

return (
<Table
title={<Label variant='headline'>{title}</Label>}
toolbar={{
left: <></>,
right: (
Expand Down
9 changes: 9 additions & 0 deletions ui/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ const nextConfig = {
compiler: {
styledComponents: true,
},
async redirects() {
return [
{
source: '/',
destination: '/peers',
permanent: false,
},
];
},
reactStrictMode: true,
swcMinify: true,
output: 'standalone',
Expand Down
Loading

0 comments on commit 1c6cc69

Please sign in to comment.