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

[ZEPPELIN-1745] View revisions in non-editable mode #1775

Closed
wants to merge 31 commits into from

Conversation

khalidhuseynov
Copy link
Contributor

@khalidhuseynov khalidhuseynov commented Dec 16, 2016

What is this PR for?

This is to make view of revisions non-editable

What type of PR is it?

Improvement

Todos

  • - disable action bar buttons
  • - disable per paragraph editing actions
  • - disable hotkeys

What is the Jira issue?

ZEPPELIN-1745

How should this be tested?

  1. initialize GitNotebookRepo by adding
export ZEPPELIN_NOTEBOOK_STORAGE="org.apache.zeppelin.notebook.repo.GitNotebookRepo"

in your conf/zeppelin-env.sh
2. go to any note and create few revisions using commit menu
3. then switch between revisions, during which you shouldn't be able to modify note

Screenshots (if appropriate)

revision_view

Questions:

  • Does the licenses files need update? no
  • Is there breaking changes for older versions? no
  • Does this needs documentation? no

@bzz
Copy link
Member

bzz commented Dec 20, 2016

@khalidhuseynov Is it WIP?

Then please feel free to add WIP in PR title and ping back, when it's ready for reviews. Otherwise, as for any GUI changes, it would be nice to have screenshots and some docs.

@khalidhuseynov
Copy link
Contributor Author

@bzz it's ready now, also /cc @cloverhearts @1ambda to help review

@1ambda
Copy link
Member

1ambda commented Dec 20, 2016

Glad to help reviewing this PR :)
Let me check and then give you feedbacks :)

@cloverhearts
Copy link
Member

good feature!

@1ambda
Copy link
Member

1ambda commented Dec 21, 2016

For other reviewers

  • If you are using git 2.10+, Notebook revision feature will not work. Checkout ZEPPELIN-1737

@khalidhuseynov
Copy link
Contributor Author

@1ambda actually i've tried to reproduce ZEPPELIN-1737 and even with git 2.11.0 wasn't able to do it. also from documentation here only from 2.11.0 --allow-empty commits was introduced, meaning only git versions 2.11+ could be a problem which is the most recent version and can be built from the source only for now. So I think reviewing this PR wouldn't much depend on git version, and ZEPPELIN-1737 will be addressed separately.

@1ambda
Copy link
Member

1ambda commented Dec 23, 2016

FYI - you can install 2.11.0 using brew.

@khalidhuseynov is right, that should be handled in the separate issue. Let's talk about it on ZEPPELIN-1737.

@1ambda
Copy link
Member

1ambda commented Dec 23, 2016

Works well as described. Here are few things to consider.

  • It would be great if there is a signal (whatever) so let user know that this is committed version of note. It's confusing at first for me. (Assume that someone get the link for a commited note. He might wonder why he can not modify this note)
  • Enabling and modifying committed notes affects on the HEAD note. What about disabling double click to committed paragraphs (you can check this in screenshot below)

pr1775

  • the last one is not directly related with this issue. But It would be good to hide git notebook icons if we are other notebook repo rather than GitNotebookRepo

screen shot 2016-12-23 at 6 50 35 pm

Thanks for implementing great feature.

@khalidhuseynov
Copy link
Contributor Author

@1ambda thanks for review. answers in order:

It would be great if there is a signal (whatever) so let user know that this is committed version of note. It's confusing at first for me. (Assume that someone get the link for a committed note. He might wonder why he can not modify this note)

yeah that's good point, do you have something in mind regarding it? i was thinking whether it should be more of a mode switch (say different mode added in addition to report mode, etc) or just represent visually (say gray out editor background like when running note), or something else.

Enabling and modifying committed notes affects on the HEAD note. What about disabling double click to committed paragraphs (you can check this in screenshot below)

thanks for testing, addressed under 50e1472. please check it out.

the last one is not directly related with this issue. But It would be good to hide git notebook icons if we are other notebook repo rather than GitNotebookRepo.

actually we have issue regarding this one to have GitNotebookRepo as default repo, in that case we don't need to hide it i believe.

@@ -23,17 +23,17 @@
</span>

<!-- Run / Cancel button -->
<span class="icon-control-play" style="cursor:pointer;color:#3071A9" tooltip-placement="top" tooltip="Run this paragraph (Shift+Enter)"
<span ng-if="!revisionView" class="icon-control-play" style="cursor:pointer;color:#3071A9" tooltip-placement="top" tooltip="Run this paragraph (Shift+Enter)"
Copy link
Member

Choose a reason for hiding this comment

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

I think iterate condition case to group is better.

  <span ng-if="!revisionView" class="icon-control-play" style="cursor:pointer;color:#3071A9" tooltip-placement="top" tooltip="Run this paragraph (Shift+Enter)"
        ng-click="runParagraph(getEditorValue())"
        ng-show="paragraph.status!='RUNNING' && paragraph.status!='PENDING' && paragraph.config.enabled"></span>
  <span ng-if="!revisionView" class="icon-control-pause" style="cursor:pointer;color:#CD5C5C" tooltip-placement="top" tooltip="Cancel"
        ng-click="cancelParagraph(paragraph)"
        ng-show="paragraph.status=='RUNNING' || paragraph.status=='PENDING'"></span>
  <span ng-if="!revisionView" class="{{paragraph.config.editorHide ? 'icon-size-fullscreen' : 'icon-size-actual'}}" style="cursor:pointer;" tooltip-placement="top" tooltip="{{(paragraph.config.editorHide ? 'Show' : 'Hide') + ' editor'}}"
        ng-click="toggleEditor(paragraph)"></span>
  <span ng-if="!revisionView" class="{{paragraph.config.tableHide ? 'icon-notebook' : 'icon-book-open'}}" style="cursor:pointer;" tooltip-placement="top" tooltip="{{(paragraph.config.tableHide ? 'Show' : 'Hide') + ' output'}}"
        ng-click="toggleOutput(paragraph)"></span>
  <span ng-if="!revisionView" class="dropdown navbar-right">

better

<span ng-if="!revisionView">
  <span class="icon-control-play" style="cursor:pointer;color:#3071A9" tooltip-placement="top" tooltip="Run this paragraph (Shift+Enter)"
        ng-click="runParagraph(getEditorValue())"
        ng-show="paragraph.status!='RUNNING' && paragraph.status!='PENDING' && paragraph.config.enabled"></span>
  <span class="icon-control-pause" style="cursor:pointer;color:#CD5C5C" tooltip-placement="top" tooltip="Cancel"
        ng-click="cancelParagraph(paragraph)"
        ng-show="paragraph.status=='RUNNING' || paragraph.status=='PENDING'"></span>
  <span class="{{paragraph.config.editorHide ? 'icon-size-fullscreen' : 'icon-size-actual'}}" style="cursor:pointer;" tooltip-placement="top" tooltip="{{(paragraph.config.editorHide ? 'Show' : 'Hide') + ' editor'}}"
        ng-click="toggleEditor(paragraph)"></span>
  <span class="{{paragraph.config.tableHide ? 'icon-notebook' : 'icon-book-open'}}" style="cursor:pointer;" tooltip-placement="top" tooltip="{{(paragraph.config.tableHide ? 'Show' : 'Hide') + ' output'}}"
        ng-click="toggleOutput(paragraph)"></span>
  <span class="dropdown navbar-right">

};

$scope.$watch($scope.getEditor, function(newValue, oldValue) {
if (newValue === null) {
Copy link
Member

Choose a reason for hiding this comment

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

Newvalue Sometimes value is undefined.
In js, both undefined and null should be checked.
So I think this is better.
` If (newvalue) // check to undefined and null `

@khalidhuseynov
Copy link
Contributor Author

@Leemoonsoo @cloverhearts @1ambda thanks for the review! I addressed all your comments and updated the screenshot above. Please check it out and let me know what you think.

Also CI logs seems to be failing only in selenium profile with flaky test from ZEPPELIN-1836.

@AhyoungRyu
Copy link
Contributor

@khalidhuseynov How about disable "Interpreter binding" & "Note permission" buttons as well? Currently I can change the bound interpreters and note permission for the readonly-mode note.

@khalidhuseynov
Copy link
Contributor Author

@AhyoungRyu actually i thought about it and couldn't find a reason why not let user change "Interpreter bindings" and "Note permissions" even in read-only mode, since they're still not able to run or edit. Do you think it's not common sense and confusing? Let me know what you think and we can change that easily. I wasn't also sure about it

@AhyoungRyu
Copy link
Contributor

AhyoungRyu commented Dec 30, 2016

@khalidhuseynov

since they're still not able to run or edit

Yes you're right. I just thought it's not common sense as you told. Even though the user can't run or edit anyway, but he can do sth in interpreter binding page and note permission setting page. That's why I suggested to block those features by disabling the icon buttons.

@khalidhuseynov
Copy link
Contributor Author

@AhyoungRyu I think it makes sense and addressed your feedback. please check it out and let me know if it's fine.

@AhyoungRyu
Copy link
Contributor

@khalidhuseynov Thanks for your consideration! Tested again and it works well as we said :)
And there is one minor thing in lookandfeel setting menu. Is this intended behavior?

  • Head

before

  • Read-only mode

screen shot 2016-12-31 at 3 49 53 pm

@khalidhuseynov
Copy link
Contributor Author

@AhyoungRyu thanks for review, it wasn't intended behaviour actually, fixed in bbaf286

@AhyoungRyu
Copy link
Contributor

Tested again and now I can see the text in the looknfeel dropdown menu of non-editable mode note. LGTM

@khalidhuseynov
Copy link
Contributor Author

merged master and finally CI is green. @Leemoonsoo ready for final check

@Leemoonsoo
Copy link
Member

Tested and LGTM. Thanks @khalidhuseynov for the improvement.
Merge to master if there're no more discussions.

@asfgit asfgit closed this in d9a11a9 Jan 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants