-
Notifications
You must be signed in to change notification settings - Fork 2
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
Updated time filter to use gemstone version #97
base: master
Are you sure you want to change the base?
Conversation
e3adc0e
to
258ae81
Compare
8f1966b
to
2b90980
Compare
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 think you are being a little over-zealous on what formating constants you replace. I don't think you can use one global constant everywhere since different components expect different formats and different formats make sense in different places. I left some comments on some places where I saw this done but I know for sure I didn't comment on everything. Can you go through and only replace where it makes sense for the setting? What is the setting meant to unifiy? The server format we get back from the controllers? That we send to the controllers? Clarification on this would assist me in reviewing this PR.
@@ -376,7 +375,7 @@ const TrendPlot: React.FunctionComponent<IContainerProps> = (props: IContainerPr | |||
}).done((data: any[]) => { | |||
setEventMarkers(data.map(datum => { | |||
const meterID = props.Plot.Channels.find(channel => channel.MeterKey === datum["Meter Key"]).MeterID; | |||
return { value: moment.utc(datum.Time, eventFormat).valueOf(), meterID: meterID, eventID: datum["EventID"]} | |||
return { value: moment.utc(datum.Time, dateTimeFormat).valueOf(), meterID: meterID, eventID: datum["EventID"] } |
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.
Event format is different than date time
const startMoment: moment.Moment = moment.utc(props.TimeFilter.start, dateTimeFormat); | ||
const endMoment: moment.Moment = moment.utc(props.TimeFilter.end, dateTimeFormat); | ||
|
||
const startTime: number = startMoment.valueOf(); | ||
const endTime: number = endMoment.valueOf(); |
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.
const startMoment: moment.Moment = moment.utc(props.TimeFilter.start, dateTimeFormat); | |
const endMoment: moment.Moment = moment.utc(props.TimeFilter.end, dateTimeFormat); | |
const startTime: number = startMoment.valueOf(); | |
const endTime: number = endMoment.valueOf(); | |
const startTime: number = moment.utc(props.TimeFilter.start, dateTimeFormat).valueOf(); | |
const endTime: number = moment.utc(props.TimeFilter.end, dateTimeFormat).valueOf(); |
No need to have this assignment, it makes it a little more hard to read in my opinion.
const [trendMarkers, setTrendMarkers] = React.useState<TrendSearch.IMarker[]>([]); | ||
const [sortField, setSortField] = React.useState<string>('MeterName'); | ||
const [ascending, setAscending] = React.useState<boolean>(true); | ||
const momentFormat = "DD HH:mm:ss.SSS"; |
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.
This replacement doesn't work, moment format isn't the same as datetimeformat from settings.
@@ -134,8 +146,9 @@ const PlotSettingsTab = React.memo((props: IProps) => { | |||
props.SetPlot({ ...props.Plot, PlotFilter: options }); | |||
}} | |||
/> | |||
<ReportTimeFilter filter={props.Plot.TimeFilter} showQuickSelect={false} | |||
setFilter={newFilter => props.SetPlot({ ...props.Plot, TimeFilter: newFilter })} /> | |||
<TimeFilter filter={props.Plot.TimeFilter/* convertTimeFilter(props.Plot.TimeFilter) */} showQuickSelect={false} |
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.
What's with this commented out code?
@@ -148,6 +157,44 @@ const TrendSearchNavbar = React.memo((props: IProps) => { | |||
}); | |||
}, [channelGroupStatus, phaseStatus]); | |||
|
|||
React.useEffect(() => { | |||
let range = ""; | |||
const startMoment = moment(timeFilter.start); // These default to the date+time format |
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.
Please don't use default moment formats, it can lead to unexpected bugs. Be explicit
{ | ||
Value: 'center', | ||
Label: 'Center Date/Time and Window', | ||
}, |
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.
Why are we dropping support for centered time window format?
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 believe that was the main update I was doing to this branch. Christoph said to do away with it, and just handle its conversion to the back end. (If it's still using that format in the back end)
96f0333
to
ab73e5d
Compare
Removes 'center' time setting and standardizes date time format in SettingSlice. Cleaned up TimeFilter and date and time usage throughout.
Depends on GridProtectionAlliance/gpa-gemstone#321