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

UI: Persist timezone, fix snapshot param #931

Merged
merged 3 commits into from
Dec 29, 2023
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
13 changes: 0 additions & 13 deletions ui/app/globalstate/time.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion ui/app/mirrors/create/helpers/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const blankCDCSetting: FlowConnectionConfigs = {
publicationName: '',
snapshotNumRowsPerPartition: 500000,
snapshotMaxParallelWorkers: 1,
snapshotNumTablesInParallel: 1,
snapshotNumTablesInParallel: 4,
snapshotSyncMode: 0,
cdcSyncMode: 0,
snapshotStagingPath: '',
Expand Down
8 changes: 3 additions & 5 deletions ui/components/SidebarComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use client';

import { UVersionResponse } from '@/app/dto/VersionDTO';
import useTZStore from '@/app/globalstate/time';
import Logout from '@/components/Logout';
import { BrandLogo } from '@/lib/BrandLogo';
import { Icon } from '@/lib/Icon';
Expand All @@ -10,7 +9,7 @@ import { RowWithSelect } from '@/lib/Layout';
import { Sidebar, SidebarItem } from '@/lib/Sidebar';
import Link from 'next/link';
import useSWR from 'swr';

import { useLocalStorage } from 'usehooks-ts';
const centerFlexStyle = {
display: 'flex',
justifyContent: 'center',
Expand All @@ -21,8 +20,7 @@ const centerFlexStyle = {
const fetcher = (...args: [any]) => fetch(...args).then((res) => res.json());
export default function SidebarComponent(props: { logout?: boolean }) {
const timezones = ['UTC', 'Local', 'Relative'];
const setZone = useTZStore((state) => state.setZone);
const zone = useTZStore((state) => state.timezone);
const [zone, setZone] = useLocalStorage('timezone-ui', '');

const {
data: version,
Expand Down Expand Up @@ -56,7 +54,7 @@ export default function SidebarComponent(props: { logout?: boolean }) {
backgroundColor: 'transparent',
boxShadow: '0px 2px 4px rgba(0,0,0,0.1)',
}}
defaultValue={zone}
value={zone}
id='timeselect'
onChange={(e) => setZone(e.target.value)}
>
Expand Down
4 changes: 2 additions & 2 deletions ui/components/TimeComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';
import useTZStore from '@/app/globalstate/time';
import { Label } from '@/lib/Label';
import moment from 'moment-timezone';
import { useLocalStorage } from 'usehooks-ts';

const TimeLabel = ({
timeVal,
Expand All @@ -10,7 +10,7 @@ const TimeLabel = ({
timeVal: Date | string;
fontSize?: number;
}) => {
const timezone = useTZStore((state) => state.timezone);
const [timezone] = useLocalStorage('timezone-ui', 'UTC'); // ['UTC', 'Local', 'Relative']
const formattedTimestamp = (zone: string) => {
switch (zone) {
case 'Local':
Expand Down
44 changes: 15 additions & 29 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"react-toastify": "^9.1.3",
"styled-components": "^6.1.3",
"swr": "^2.2.4",
"zod": "^3.22.4",
"zustand": "^4.4.7"
"usehooks-ts": "^2.9.1",
"zod": "^3.22.4"
},
"devDependencies": {
"@storybook/addon-essentials": "^7.6.6",
Expand Down
Loading