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

Add UI controls for developer session #1691

Merged
merged 48 commits into from
Jun 29, 2018

Conversation

Martchus
Copy link
Contributor

screenshot_20180614_113001

screenshot_20180614_113134

@codecov
Copy link

codecov bot commented Jun 15, 2018

Codecov Report

Merging #1691 into master will increase coverage by 0.32%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1691      +/-   ##
==========================================
+ Coverage   89.54%   89.87%   +0.32%     
==========================================
  Files         137      137              
  Lines        9537     9616      +79     
==========================================
+ Hits         8540     8642     +102     
+ Misses        997      974      -23
Impacted Files Coverage Δ
lib/OpenQA/WebAPI/Controller/LiveViewHandler.pm 97.66% <100%> (+1.33%) ⬆️
lib/OpenQA/Utils.pm 93.69% <100%> (+0.05%) ⬆️
lib/OpenQA/WebAPI/Controller/Test.pm 96.66% <100%> (+0.12%) ⬆️
lib/OpenQA/WebAPI/Controller/Developer.pm 100% <100%> (ø) ⬆️
lib/OpenQA/WebAPI.pm 93.77% <100%> (+0.02%) ⬆️
lib/OpenQA/Schema/ResultSet/DeveloperSessions.pm 100% <100%> (ø) ⬆️
lib/OpenQA/LiveHandler.pm 94.28% <100%> (+0.73%) ⬆️
lib/OpenQA/Schema/Result/Jobs.pm 91.63% <0%> (+0.13%) ⬆️
lib/OpenQA/Worker/Jobs.pm 81.73% <0%> (+0.68%) ⬆️
lib/OpenQA/Scheduler/Scheduler.pm 90.43% <0%> (+1.59%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 74e1224...1066d02. Read the comment docs.

@Martchus Martchus force-pushed the enhance_live_devel_ui branch 6 times, most recently from 28307f2 to 5e897ad Compare June 19, 2018 15:34
@Martchus
Copy link
Contributor Author

Martchus commented Jun 19, 2018

I adapted the existing tests for the new UI. Let's see whether everythingIt actually passes now.

@foursixnine When cherry-picking your commit, I made the host in the assertion variable instead of expecting localhost.

So far, this PR will allow any admin to start the development session just by clicking on the panel header in the live view tab. As discussed, I'll try to make it 'more difficult' to create the development session. Maybe I'll actually add a 'Create developer session to apply selection' at the bottom of the form?

When that is done, I'll continue with extending the tests.

@foursixnine
Copy link
Member

@Martchus,What does Create developer session to apply selection :P

@Martchus
Copy link
Contributor Author

Martchus commented Jun 20, 2018

@foursixnine This button would be under the controls where you select what you actually want to do (e.g. pause at a specific module). So 'selection' refers to the form elements above the button. And it would lock those controls for other users by creating the developer session.

Copy link
Member

@foursixnine foursixnine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There will be some technical debt after this but looks good so far.

@@ -103,3 +103,32 @@ function alignBuildLabels() {
var max = Math.max.apply(null, values);
$('.build-label').css('min-width', max + 'px');
}

// returns an absolute "ws://" URL for the specified URL which might be relative
function makeWsUrlAbsolute(url, servicePortDelta) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not call it getabsolutewsurl? (It's just cosmetic I know ;))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it doesn't just return a value which is already stored somewhere. It actually computes the value (though this is not very expensive).

if (toPauseAtIndex < 0) {
toPauseAtIndex = 0;
}
var moduleToPauseAtStillAhead = developerMode.moduleToPauseAt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would enclose this inside ( )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll change that to make it less ambiguous.

@@ -0,0 +1,18 @@
<select class="custom-select" name="pause-at-module" id="developer-pause-at-module">
<option selected style="font-style: italic;">Don't pause at a module</option>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change it to 'Do not pause'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok - so far there are no other ways to pause anyways.

# define global variable to store ws connections (tx) to JavaScript clients for each job
my %java_script_transactions_by_job;
# define global variable to store development session ws connections (tx) to JavaScript clients for each job
my %devel_java_script_transactions_by_job;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be easily converted to a property of the controller via has: has blah => sub { {} };

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it can't. Properties via has are non-static members. This has to be a static member variable. (To use sane C++ terms here.)

The reason is that Mojo will instantiate a separate controller object for each request it serves. At least in my tests it creates multiple controller objects. However, the transactions are shared by all requests to be able to broadcast.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if you want to refactor this, the property must be on the application. But for now I would say there are more important things to adjust.

@foursixnine
Copy link
Member

So 'selection' refers to the form elements above the button. And it would lock those controls for other users by creating the developer session.

Ah cool

@Martchus
Copy link
Contributor Author

@coolo I've just mocked a possible workflow (imagine that the form will contain more elements later):

  1. No developer session opened in the first place: screenshot_20180620_172526
  2. After clicking the panel header, the user can select but the session is not immediately started: screenshot_20180620_174058
  3. After clicking confirm: screenshot_20180620_172454

Ok for you?

@coolo
Copy link
Contributor

coolo commented Jun 20, 2018

There seems to be a confusion here, because 'Developer mode' to me means the job is bound to a developer. Jobs not bound to a specific developer shouldn't even pause. If that developer has currently a session open or not is for sure interesting information because if not, another operator should at least have the option to cancel the job.

As such a "Developer session" to me is having a tab open while you're the developer. You don't start the session as such - you become the developer and happen to have a tab open.

@Martchus Martchus force-pushed the enhance_live_devel_ui branch 8 times, most recently from 393b7d8 to e246fe8 Compare June 25, 2018 12:51
@Martchus Martchus changed the title WIP: Add UI controls for developer session FEEDBACK: Add UI controls for developer session Jun 26, 2018
<div class="card-body">
<form action="#" method="get" id="developer-form" class="developer-mode-element" data-hidden-on="lockedByOtherDeveloper">
<p class="developer-mode-element" data-hidden-on="ownSession">
Select what you want to do and confirm using the button below. This will start a developer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cyntss Can you give your blessing here on the UI/UX side of things? :). There are some screenshots attached, but you can always do your own run. /me wonders if mail would work better :P

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! I think it looks good. I would only make the upper corners rounded as well in the blue header here (although im judging based on the screenshots you put, so maybe im missing something else below):

image

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, what would "unknown status" mean to the user? can we give some information under a (?) icon that once clicked opens a popover or modal with more information?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it makes sense now that I see it in openQA.

<div class="card-header-appendix" id="developer-session-info">
% if (my $developer_session = $job->developer_session) {
% my $tab_count = $developer_session->ws_connection_count;
opened by <%= $developer_session->user->name %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

owned by

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

</a>
<a href="#" onclick="quitDeveloperSession(); return false;"
class="btn btn-danger developer-mode-element" data-visible-on="ownSession">
<i class="far fa-stop-circle"></i> Cancel job
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clicking on Cancel Job, will simply cancel the developer session. Better rename it to cancel developer session, and cancel the job. unless @coolo has a different opinion. But for me a test that was paused and likely touched, is tainted.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still find the phrase 'developer session' pretty rather vague. To me a 'developer session' is the time between cigarettes - but we are looking for something more long term :)

</a>
<a href="<%= url_for('developer_ws_console')->query({proxy => 1}) %>" target="blank"
class="btn btn-secondary developer-mode-element" data-visible-on="ownSession">
<i class="fas fa-terminal"></i> Open console
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm I think it's safe to hide the console.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'll get rid of the console button. Or maybe I show it only when launching the Mojo app in development mode? Because when developing (the developer mode) it can still be useful to open that console.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 with the development mode of the Mojo app

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implemented

@@ -0,0 +1,18 @@
<select class="custom-select" name="pause-at-module" id="developer-pause-at-module">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a follow up, we can set to disabled the options that are no longer available.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, would be quite easy I guess.

if (developerMode.currentModule && !moduleToPauseAtStillAhead) {
statusInfo += ', at ' + developerMode.currentModule;
}
$('#developer-status-info').text(statusInfo);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would actually put the name of the module in bold when the test execution is set to be paused.

@Martchus
Copy link
Contributor Author

@cyntss Here's a more recent screenshot: screenshot_20180626_160012

Taken from http://e212.suse.de/tests/12263 where you can also play around.

@coolo
Copy link
Contributor

coolo commented Jun 27, 2018

I think 'cancelled' or 'incomplete' is good enough for now - I was actually quite suprised when I controlled a circleci.com job through ssh that it ended passing even though I was debugging a failure :)
Possibly even autorestart?

And about the MAX_JOB_TIME: I would prefer to enlarge it, but that requires a call into the worker.

@foursixnine
Copy link
Member

@coolo that was exactly my point :P, autorestart sounds good.

Let's add a ticket for the enlargement of the MAX_JOB_TIME. no pun intended.

@foursixnine
Copy link
Member

@cyntss the first part of your comment has the image twice :P. But i'll send you a mail in any case :)

@Martchus
Copy link
Contributor Author

Martchus commented Jun 28, 2018

Ok, this contains now replacements suggested by @foursixnine and no more 'developer session'. I didn't change the case (eg. 'pause' => 'Pause') because this would be inconsistent with the other panels of the kind. If we want to capitalize everything, then we should it consistently (and not within this PR).

@Martchus Martchus changed the title FEEDBACK: Add UI controls for developer session Add UI controls for developer session Jun 28, 2018
@Martchus
Copy link
Contributor Author

I fixed some more bugs in the JavaScript. Likely not the last ones, but still I'd like to merge this until the PR grows too big. Let's see whether it still passes the checks.

* Prevent overriding existing values with form
  defaults
* Prevent updating form controls when the test
  hasn't been locked by anybody and the form is
  just shown initially
* Don't submit any changes unless testStatus.running
@Martchus
Copy link
Contributor Author

The tests pass now again. If there are no more objections, I'd like to merge this before continuing. The PR is big enough already.

@coolo
Copy link
Contributor

coolo commented Jun 29, 2018

Well, time to do some user testing with colleagues I'd say

@Martchus
Copy link
Contributor Author

Ok, so I'll deploy the latest version on e212 and try to find some victims :-)

@okurz
Copy link
Member

okurz commented Jun 29, 2018

/me sneakingly trying it out on e212 in parallel.

  • Q1: I would like to pause the test at the bootloader. How to do that?
  • Q2: "openqaworker12 at port 112 with Shared mode (otherwise the job might be cancelled)". In old versions on hover the VNC port would be shown. I assume "port 112" should actually say "display 112" or "VNC port 6012". Ok the "assigned worker" already tells it. I guess somehow the information is a bit redundant

@Martchus
Copy link
Contributor Author

I summarize the feedback we've got so far:

  1. The info for connecting via VNC is confusing. Especially the part that the job might be cancelled.
  2. It basically seems to work. No critical bugs so far.
  3. The "ownership" should be explained further.
  4. People are already asking for further features like pausing in the current state.

So nothing which prevents merging this from my point of view. I think @foursixnine can take care about 1. since he wrote that message. I will do 3. in some follow-up (likely with some more adjustments). 4. is out of the scope of this PR anyways.

@Martchus
Copy link
Contributor Author

Martchus commented Jun 29, 2018

@okurz I over-read your comment.

Q1: You start the test with the setting PAUSE_AT=bootloader (possible without that PR). This job setting should be documented somewhere like all of this when it is in a stable state.
Q2: I already noted that we need to improve those instructions.

@coolo coolo merged commit 86bc960 into os-autoinst:master Jun 29, 2018
@Martchus Martchus deleted the enhance_live_devel_ui branch June 29, 2018 15:06
@okurz
Copy link
Member

okurz commented Jun 29, 2018

awesome!

@foursixnine
Copy link
Member

@okurz let's make it "VNC port 6012" instead. @coolo already pointed that out too

@foursixnine
Copy link
Member

PR open: #1702

@okurz
Copy link
Member

okurz commented Jul 2, 2018 via email

@foursixnine
Copy link
Member

foursixnine commented Jul 2, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants