-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Added next run and last run time to timers display. #4503
Added next run and last run time to timers display. #4503
Conversation
You should rebase this on the latest master. To use moment you should create a link in your directory to the moment.js file in bower_components and then change the makefile to include it in the bundle for this package. You can see an example of this in either the selinux, kubernetes or ostree package. |
a12908c
to
fa4eec5
Compare
@andreasn why does the disabled section has a different style than enabled and static ? |
What do you mean more specifically? |
@andreasn Previous run and next run is what I added extra. Is it okay? Is the repetition of the words next run and last run for each of entry good? |
295b6b9
to
f5f9156
Compare
79791ab
to
c5059eb
Compare
@@ -127,4 +131,4 @@ update-lib:: update-bower | |||
$(JSMODULE) -m -d jquery -o $(srcdir)/pkg/systemd/bootstrap-datepicker.js \ | |||
$(BOWER)/bootstrap-datepicker/dist/js/bootstrap-datepicker.js | |||
$(JSMODULE) -m -d jquery -o $(srcdir)/pkg/systemd/bootstrap-combobox.js \ | |||
$(BOWER)/bootstrap-combobox/js/bootstrap-combobox.js | |||
$(BOWER)/bootstrap-combobox/js/bootstrap-combobox.js |
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.
missing newline
looks good, but there is still some work to be done |
if (name.indexOf("@") != -1) { | ||
|
||
if ( name.slice(-5) == "timer") |
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.
whitespace, better: if (name
c5059eb
to
a879454
Compare
@dperpeet I have changed next run time and last trigger time from relative time to calendar time-stamp. |
next_run_time = timer_unit.NextElapseUSecRealtime; | ||
} | ||
unit.NextRunTime = moment(next_run_time/1000).calendar(); | ||
} |
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 found in init.js that variables are written like next_run_time, active_state, systemd_manager etc while properties of unit are like unit.LoadState, unit.UnitFileState, unit.CombinedState et cetera.
so I think having properties as unit.NextRunTime, unit.LastTriggerTime and variables as next_run_time is better than changing?
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 found in init.js that variables are written like next_run_time, active_state, systemd_manager etc while properties of unit are like unit.LoadState, unit.UnitFileState, unit.CombinedState et cetera.
so I think having properties as unit.NextRunTime, unit.LastTriggerTime and variables as next_run_time is better than changing?
Old cockpit code uses the underscore notation. In newer code, we've switched to the way most of the other js code seems to be written: camelCase.
The exposed DBUS properties (e.g. unit.NextRunTime
) are actually a special case, since that is a DBUS convention. Cockpit API will automatically expose the properties if they begin with a capital letter.
Looking at your code again, I believe you did this right - you can remain consistent with the current code.
378cf80
to
4ba4abd
Compare
b.wait_visible('#services') | ||
m.execute("systemctl start test.timer") | ||
b.wait_in_text(svc_sel('test.timer'), "Today") | ||
b.wait_in_text(svc_sel('test.timer'), "unknown") |
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.
@dperpeet The test checks if test.timer shows "Today" as part of next run and "unknown" in last trigger time.
the labels "Next Run Time" and "Last Trigger Time" sounds a bit off to me. |
0447b9a
to
5b3bd23
Compare
@andreasn removed "Time" from Next Run Time and Last Trigger Time and also added few deleted new lines that was already present in the code. |
Can current state be just "State"? |
@andreasn Corrected |
Looks good to me. |
de38899
to
b4dedaf
Compare
b.click('#services-filter :nth-child(4)') | ||
b.wait_visible('#services') | ||
m.execute("systemctl start test.timer") | ||
b.wait_in_text(svc_sel('test.timer'), "Today") |
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 this is our most common source for race conditions in our tests: before you can wait for the text to be there, you should first wait for the element o be present.
In this case, add a line before: b.wait_present(svc_sel('test.timer'))
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.
also, make sure that svc_sel('test.timer')
is exactly the selector you want to use here
b4dedaf
to
17316ee
Compare
24deff7
to
9575f8d
Compare
There's a merge conflict - can you please rebase on master and squash the commits into one? Thanks! |
@andreasn Right now this code doesn't update the display, it only shows the time differences (e.g. "in 5 seconds") on load. I think this is ok for now. Do you agree? |
@dperpeet yeah, I think it's all right for now, but I would like it to be fixed as a followup. |
9575f8d
to
bc4632d
Compare
@dperpeet @petervo I need moment.js in this. i did like this
selinux/moment
to get moment as of now. Can u tell me how to add moment right way?@andreasn can u look into designs here?
also what should I do when it shows
last run 46 years ago
i.e 1970 ?