Skip to content

Commit

Permalink
ISSUE-205 fixed empty placeholder not showing when no streams availab…
Browse files Browse the repository at this point in the history
…le (#210)

also set default time range with minute precision, so seconds and milliseconds are 
always set to zero.

fixes #205
  • Loading branch information
balaji-jr authored Mar 5, 2024
1 parent c89c24a commit 5c27078
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/layouts/MainLayout/Context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Context = createContext({});

const { Provider } = Context;

const now = dayjs();
const now = dayjs().startOf('minute');

export const DEFAULT_FIXED_DURATIONS = FIXED_DURATIONS[0];

Expand Down Expand Up @@ -181,7 +181,7 @@ const MainLayoutPageProvider: FC<HeaderProviderProps> = ({ children }) => {
}, []);

const streamChangeCleanup = useCallback((stream: string) => {
const now = dayjs();
const now = dayjs().startOf('minute');
subLogQuery.set((state) => {
state.streamName = stream;
state.startTime = now.subtract(DEFAULT_FIXED_DURATIONS.milliseconds, 'milliseconds').toDate();
Expand Down
3 changes: 2 additions & 1 deletion src/pages/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ const Home: FC = () => {
navigate(`/${stream}/logs`);
}, []);

if (Array.isArray(userSpecficStreams) && userSpecficStreams.length === 0) return <EmptyStreamsView />;
if ((Array.isArray(userSpecficStreams) && userSpecficStreams.length === 0) || userSpecficStreams === null)
return <EmptyStreamsView />;

return (
<Box className={container} style={{ display: 'flex', flex: 1, marginTop: '1rem' }}>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Logs/LogTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ const LogTable: FC = () => {
if (subRefreshInterval.get()) {
const interval = setInterval(() => {
if (subLogSelectedTimeRange.get().state === 'fixed') {
const now = dayjs();
const now = dayjs().startOf('minute');
const timeDiff = subLogQuery.get().endTime.getTime() - subLogQuery.get().startTime.getTime();
subLogQuery.set((state) => {
state.startTime = now.subtract(timeDiff).toDate();
Expand Down

0 comments on commit 5c27078

Please sign in to comment.