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

systemd create timer option #4645

Closed

Conversation

Projects
None yet
5 participants
@harishanand95
Copy link
Contributor

commented Jun 28, 2016

Work left to complete :

  • Invalid input message shown for inputs.
  • Repeat Hourly, Daily, Weekly, Monthly, Yearly and dont repeat option works.
  • Tests cases

Fixes left:

  • Create Timer button shown in all services tab than just timer (will be fixed when #4503 merges).
  • Repeat Yearly's datepicker is positioned incorrectly.
  • “Invalid input” message causes change of position of boot timer’s elements.
@andreasn

This comment has been minimized.

Copy link
Contributor

commented Jul 1, 2016

Good start!
There is a couple of styling and spacing errors, but those should be quick and easy to fix.

screenshot from 2016-07-01 16-39-42

Compare with
screenshot from 2016-07-01 16-39-12

  • The spacing between the rows is too large.
  • The labels are black instead of gray.
  • The spacing between the labels on the left and the inputs on the right is too big.
@andreasn

This comment has been minimized.

Copy link
Contributor

commented Jul 1, 2016

Should "Service file name" be "Service name" perhaps?

@andreasn

This comment has been minimized.

Copy link
Contributor

commented Jul 1, 2016

Mockup for comparison.
Mockup

@andreasn

This comment has been minimized.

Copy link
Contributor

commented Jul 1, 2016

Instead of putting "At" on it's own row, I think it would work better to put it on the same line as the dropdown.

@harishanand95 harishanand95 force-pushed the harishanand95:systemd-timers branch from 0b4233d to 38bafd2 Jul 4, 2016

@harishanand95

This comment has been minimized.

Copy link
Contributor Author

commented Jul 4, 2016

Updated design changes (I think now it more follows the mock-ups) :
screenshot from 2016-07-04 16-25-37
screenshot from 2016-07-04 16-25-43
screenshot from 2016-07-04 16-25-53
screenshot from 2016-07-04 16-25-58
@andreasn in mockups, why do we have multiple number of "+" button, instead of just a single one? ( located after repeat options in mockups)

@andreasn

This comment has been minimized.

Copy link
Contributor

commented Jul 5, 2016

Good improvements. This is starting to shape up really well!

A couple of minor issues:

  • "Run after system boot at X seconds" doesn't sound quite right. I think "Run after system boot after X seconds" would work better.
  • It would look a bit nicer if the "at/after" label, the box and the seconds dropdown would be right aligned.
  • If the "at/after" box is left empty, does that mean the delay is zero? It would be good to fill the input with that number in that case.
  • Could the + for adding another case be on the same row as the x that removes it? That would make it consistent with how it works in the Container Run dialog.

@harishanand95 harishanand95 force-pushed the harishanand95:systemd-timers branch 3 times, most recently from 6183471 to fec5e2f Jul 6, 2016

@harishanand95

This comment has been minimized.

Copy link
Contributor Author

commented Jul 6, 2016

@andreasn fixed all the issues you have mentioned.
other fixes in the commit are :

  • Create Timer button is shown in timer tab only.
  • “Invalid input” message doesnt change of position of boot_time elements.

fixes still left :

  • Repeat Yearly's datepicker menu is positioned incorrectly.
    screenshot from 2016-07-06 15-18-11

@harishanand95 harishanand95 force-pushed the harishanand95:systemd-timers branch from e7a168f to 19ae643 Jul 6, 2016

@harishanand95

This comment has been minimized.

Copy link
Contributor Author

commented Jul 6, 2016

@andreasn I have corrected the position of datepicker in repeat yearly option.
screenshot from 2016-07-06 17-16-31

@dperpeet

This comment has been minimized.

Copy link
Member

commented Jul 7, 2016

"Run after system boot after X seconds" would work better.

How about "run X seconds after system boot"?

@andreasn

This comment has been minimized.

Copy link
Contributor

commented Jul 7, 2016

How about "run X seconds after system boot"?

Even though it forms a better sentence, it would make the dropdown jump around.

@andreasn

This comment has been minimized.

Copy link
Contributor

commented Jul 7, 2016

If I first create one timer, then decides to create another, the values from the old timer is still present in the timer creation dialog. It needs to be cleared out on exit.

@andreasn

This comment has been minimized.

Copy link
Contributor

commented Jul 7, 2016

The error message "within 0-59" sounds a bit odd. Maybe "Needs to be between 0-59"
Or is that too long of a string to fit?

@andreasn

This comment has been minimized.

Copy link
Contributor

commented Jul 7, 2016

Maybe this is a limitation of the calendar widget, but it feels a bit strange to be able to run a timer in the past. Not a biggie though.

@andreasn

This comment has been minimized.

Copy link
Contributor

commented Jul 7, 2016

screenshot from 2016-07-07 19-11-49

@andreasn

This comment has been minimized.

Copy link
Contributor

commented Jul 7, 2016

Maybe the time errors could be displayed like this instead:
screenshot from 2016-07-07 19-11-49

@harishanand95

This comment has been minimized.

Copy link
Contributor Author

commented Jul 11, 2016

@andreasn I have updated the error messages. Bootstrap datepicker is difficult to work with! I needed a hack to get its position correct. :( Give a close look at boot-strap datepickers behaviour.
Here are the screen shots:
screenshot from 2016-07-11 11-36-09
screenshot from 2016-07-11 15-08-19

@harishanand95 harishanand95 force-pushed the harishanand95:systemd-timers branch 2 times, most recently from ba00bca to 1d74998 Jul 11, 2016

@andreasn

This comment has been minimized.

Copy link
Contributor

commented Jul 11, 2016

It seems the alignment for the labels for "Service name", "Description" and "Command" gets off once they get a error message. They get pushed too far down.

screenshot from 2016-07-11 17-08-40

Filling an entry has the opposite effect. The labels end up too far up.
screenshot from 2016-07-11 17-11-31

@andreasn

This comment has been minimized.

Copy link
Contributor

commented Jul 11, 2016

I wonder if it makes sense to spread the Repeat dropdown all across to line it up with the elements below better. Should be just a matter of removing the div#drop_repeat css

@harishanand95 harishanand95 force-pushed the harishanand95:systemd-timers branch 4 times, most recently from 0eb557c to f2d8b36 Jul 17, 2016

@@ -194,6 +195,9 @@ WantedBy=default.target

def svc_sel(service):
return 'tr[data-goto-unit="%s"]' % service
def wait_systemctl_timer(time):
with testvm.Timeout(seconds=10, error_message="Timeout while waiting for systemctl list-timers"):
m.execute("cmd='systemctl list-timers'; until $cmd | grep -m 1 '%s'; do sleep 1; done" % time)

This comment has been minimized.

Copy link
@harishanand95

harishanand95 Aug 8, 2016

Author Contributor

m.execute("cmd='systemctl list-timers'; until $cmd | grep -m 1 '%s'; do sleep 1; done" % time) would loop and check if systemctl list-timers has the updated results. This keeps checking every second for a total of 10sec after which timeout occurs.
@dperpeet which is better sleep 1 or sleep 0.5, here?

This comment has been minimized.

Copy link
@dperpeet

dperpeet Aug 10, 2016

Member

@dperpeet which is better sleep 1 or sleep 0.5, here?

1 is fine

# checks if timer runs on next hour at 5 min and 26 min
self.assertIn("Fri 2020-04-10 04:05", m.execute("LC_ALL=C systemctl list-timers"))
m.execute("timedatectl set-time '2020-04-10 04:10:00'")
b.wait_present(svc_sel('hourly_timer.timer'))
wait_systemctl_timer("Fri 2020-04-10 04:26")

This comment has been minimized.

Copy link
@harishanand95

harishanand95 Aug 8, 2016

Author Contributor

b.wait_present(svc_sel('hourly_timer.timer')) was removed because I thought they would solve the race issue here. Since they didn't, I'm removing all such checks we had.

Reason why b.wait_present(svc_sel('hourly_timer.timer')) could solve race was based on the idea that cockpit timer page refreshes after changing time using timedatectl.

@dperpeet

This comment has been minimized.

Copy link
Member

commented Aug 10, 2016

debian tests fail - needs fix from #4857

@dperpeet dperpeet removed the needswork label Aug 11, 2016

@stefwalter stefwalter changed the title WIP systemd create timer option systemd create timer option Aug 11, 2016

@harishanand95 harishanand95 force-pushed the harishanand95:systemd-timers branch from c39c986 to 0b590f4 Aug 12, 2016

return 'tr[data-goto-unit="%s"]' % service
def wait_systemctl_timer(time):
with testvm.Timeout(seconds=20, error_message="Timeout while waiting for systemctl list-timers"):
m.execute("sleep 1")

This comment has been minimized.

Copy link
@dperpeet

dperpeet Aug 12, 2016

Member

why do you need to sleep here? the next loops does that

This comment has been minimized.

Copy link
@harishanand95

harishanand95 Aug 12, 2016

Author Contributor

I thought if we called systemctl list-timer in next line after 1 sec, then it can have the updated values. Let me test it locally in centos and fedora-atomic without the 1 sec and see if it works.

This comment has been minimized.

Copy link
@harishanand95

harishanand95 Aug 12, 2016

Author Contributor

Tests passed on centos and fedora-atomic locally.

def svc_sel(service):
return 'tr[data-goto-unit="%s"]' % service
def wait_systemctl_timer(time):
with testvm.Timeout(seconds=20, error_message="Timeout while waiting for systemctl list-timers"):

This comment has been minimized.

Copy link
@dperpeet

dperpeet Aug 12, 2016

Member

Timeout is patched now, you can add machine=m to make sure it actually works with the ssh command

m.spawn("sync && sync && sync && sleep 0.1 && reboot", "reboot")
m.wait_reboot()
m.start_cockpit()
with testvm.Timeout(seconds=15, error_message="Timeout while waiting for boot timer to run"):

This comment has been minimized.

Copy link
@dperpeet

dperpeet Aug 12, 2016

Member

here you can also add machine=m

fail(function(error) {
console.log(error);
});
console.log("#Timer file#\n" + timer_file);

This comment has been minimized.

Copy link
@harishanand95

harishanand95 Aug 14, 2016

Author Contributor

@dperpeet before we merge this, we should remove these console.log() lines. They give the contents of .service and .timer files.

This comment has been minimized.

Copy link
@dperpeet

dperpeet Aug 14, 2016

Member

good point, I will do this during merge

@dperpeet dperpeet closed this in 5e171d1 Aug 14, 2016

@dperpeet

This comment has been minimized.

Copy link
Member

commented Aug 14, 2016

nice job, this will be part of Cockpit 0.118

@harishanand95

This comment has been minimized.

Copy link
Contributor Author

commented Aug 14, 2016

great! thanks everyone!

@harishanand95 harishanand95 deleted the harishanand95:systemd-timers branch Aug 14, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.