Skip to content

Commit

Permalink
frontend working
Browse files Browse the repository at this point in the history
  • Loading branch information
puneetkhanduri committed Jun 18, 2023
1 parent 48c8383 commit 2962938
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions frontend/src/features/appbar/AppBarView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ import { openOverrideView } from '../overrides/overrideSlice';
export default function AppBarView(){
const info = fetchinfo();
const excludeNoise = useAppSelector((state) => state.selections.noiseCancellationIsOn);
const [start, end] = useAppSelector((state) => state.selections.dateTimeRange).map(x => new Date(x));
const {start, end} = useAppSelector((state) => state.selections.dateTimeRange);
const dispatch = useAppDispatch();
return <AppBar position='static'>
<Toolbar>
<Typography variant="h6" color="inherit" sx={{ flexGrow: 1 }}>{info.name}</Typography>
<DateTimeRangePicker
onChange={(range) => {
const [s,e] = Array.isArray(range) && range[1] ? range : [Date.now() - 24*3600*1000, Date.now()];
dispatch(setDateTimeRange([s, e]));
const [s, e] = Array.isArray(range) && range[1] ? range : [Date.now() - 24*3600*1000, Date.now()];
dispatch(setDateTimeRange({start: s.getTime(), end: e.getTime()}));
}}
value={[start, end]}
value={[new Date(start), new Date(end)]}
disableClock={true}
/>
<Tooltip title={excludeNoise?"Show Noise":"Hide Noise"}>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/features/differences/DifferencesView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function DifferencesView(){
const excludeNoise = useAppSelector((state) => state.selections.noiseCancellationIsOn);
const selectedEndpoint = useAppSelector((state) => state.selections.endpointName) || 'unknown';
const selectedFieldPrefix = useAppSelector((state) => state.selections.fieldPrefix) || 'unknown';
const [start, end] = useAppSelector((state) => state.selections.dateTimeRange);
const {start, end} = useAppSelector((state) => state.selections.dateTimeRange);
const differenceResults = useFetchDifferencesQuery({excludeNoise, selectedEndpoint, selectedFieldPrefix, includeWeights:true, start, end}).data || {endpoint:'undefined', path:'undefined', requests:[]};
if(!differenceResults.requests.length) {
return <List subheader={<ListSubheader>Differences</ListSubheader>}>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/features/endpoints/EndpointsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function EndpointsView() {
const dispatch = useAppDispatch();
const excludeNoise = useAppSelector((state) => state.selections.noiseCancellationIsOn);
const selectedEndpoint = useAppSelector((state) => state.selections.endpointName) || 'undefined';
const [start, end] = useAppSelector((state) => state.selections.dateTimeRange);
const {start, end} = useAppSelector((state) => state.selections.dateTimeRange);
const noisyFields = useFetchNoiseQuery(selectedEndpoint).data || [];
const endpoints: Map<string, EndpointMeta> = useFetchEndpointsQuery({excludeNoise, start, end}).data || new Map<string, EndpointMeta>();
const entries = Object.entries(endpoints);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/features/fields/FieldsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function FieldsView(){
const dispatch = useAppDispatch();
const excludeNoise = useAppSelector((state) => state.selections.noiseCancellationIsOn);
const selectedEndpoint = useAppSelector((state) => state.selections.endpointName) || 'unknown';
const [start, end] = useAppSelector((state) => state.selections.dateTimeRange);
const {start, end} = useAppSelector((state) => state.selections.dateTimeRange);
const endpoint = useFetchFieldsQuery({selectedEndpoint, excludeNoise, includeWeights: true, start, end}).data || {fields: new Map<string, Metric>()};
const noisyPrefixes = useFetchNoiseQuery(selectedEndpoint).data || [];
const [updateNoise, { isLoading: isUpdating }] = usePostNoiseMutation();
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/features/selections/selectionsSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface Selections {
endpointName: string|undefined, // Selected endpoint from EnpointsView
fieldPrefix: string|undefined, // Selected field prefix from FieldsView
requestId: string|undefined, // Selected request id from DifferencesView
dateTimeRange: Range<number>,
dateTimeRange: {start: number, end: number},
}
const initialState: Selections = {
noiseCancellationIsOn: false,
Expand All @@ -18,7 +18,7 @@ const initialState: Selections = {
infoIsOpen: false,
deleteRequestAlertIsOpen: false,
requestIsOpen: false,
dateTimeRange: [Date.now() - 24*3600*1000, Date.now()]
dateTimeRange: {start: Date.now() - 24*3600*1000, end: Date.now()}
};
const slice = createSlice({
name: 'selections',
Expand Down

0 comments on commit 2962938

Please sign in to comment.