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

Using localStorage to save the state of the Designer #15398

Open
wants to merge 3 commits into
base: master
from

Conversation

@Bournvita1998
Copy link
Contributor

commented Jul 22, 2019

Signed-off-by: Mohit Kuri mohit.kuri@research.iiit.ac.in

Description

Right now, this won't work. I debugged and checked a lot of things and according to me, this should work. Not sure what's the problem here, still trying to figure out.

Fixes #12286

Before submitting pull request, please review the following checklist:

  • Make sure you have read our CONTRIBUTING.md document.
  • Make sure you are making a pull request against the correct branch. For example, for bug fixes in a released version use the corresponding QA branch and for new features use the master branch. If you have a doubt, you can ask as a comment in the bug report or on the mailing list.
  • Every commit has proper Signed-off-by line as described in our DCO. This ensures that the work you're submitting is your own creation.
  • Every commit has a descriptive commit message.
  • Every commit is needed on its own, if you have just minor fixes to previous commits, you can squash them.
  • Any new functionality is covered by tests.
Used localStorage to save the state
Signed-off-by: Mohit Kuri <mohit.kuri@research.iiit.ac.in>

@Bournvita1998 Bournvita1998 changed the title Used localStorage to save the state Using localStorage to save the state of the Designer Jul 22, 2019

@shucon

This comment has been minimized.

Copy link
Contributor

commented Jul 28, 2019

@sudo-bot Deploy PR

@sudo-bot

This comment has been minimized.

Copy link

commented Jul 28, 2019

Deployed (phpmyadmin-pr-15398): localStorage commit: 54927de35cbbcc350f93515c773e3b8250ca2f1a

url: https://phpmyadmin-pr-15398.wdes.eu.org
user: public
user: public


Deploy finished

1 similar comment
@sudo-bot

This comment has been minimized.

Copy link

commented Jul 28, 2019

Deployed (phpmyadmin-pr-15398): localStorage commit: 54927de35cbbcc350f93515c773e3b8250ca2f1a

url: https://phpmyadmin-pr-15398.wdes.eu.org
user: public
user: public


Deploy finished

@shucon

This comment has been minimized.

Copy link
Contributor

commented Jul 29, 2019

Your code is not saving variables properly in localStorage and thus not able to restore the state of the Designer.

@Bournvita1998

This comment has been minimized.

Copy link
Contributor Author

commented Aug 2, 2019

@shucon Yes you were right, its not storing values and the data assocated with the tables is also not poping shoehow. Thus while debugging, rather than considering all the tables at once, I have looked at the changes for one of the tables first. Here are the changes made:
Selection_061

Selection_060

Corresponding output associated to this is:

Selection_062

i.e. the values which are being SET and GET are both the same.

@Bournvita1998

This comment has been minimized.

Copy link
Contributor Author

commented Aug 2, 2019

Code associated with the above screen shots is:

var key = $('.designer_tab')[0].id;
if((localStorage.getItem('id_tbody_' + key) !== null) && (localStorage.getItem('id_hide_tbody_' + key) !== null)) {
    document.getElementById('id_tbody_' + key).innerHTML = localStorage.getItem('id_tbody_' + key);
    document.getElementById('id_hide_tbody_' + key).innerHTML = localStorage.getItem('id_hide_tbody_' + key);
    console.log('GET1 key = ' + 'id_tbody_' + key + '------ with value = ' + document.getElementById('id_tbody_' + key).innerHTML);
    console.log('GET1 key = ' + 'id_hide_tbody_' + key + '------ with value = ' + document.getElementById('id_hide_tbody_' + key).innerHTML);
}
console.log('GET2 key = ' + 'id_tbody_' + key + '------ with value = ' + localStorage.getItem('id_tbody_' + key));
console.log('GET2 key = ' + 'id_hide_tbody_' + key + '------ with value = ' + localStorage.getItem('id_hide_tbody_' + key));

AND

$('.designer_tab').on('click', '.small_tab,.small_tab2', function () {
    DesignerMove.smallTab($(this).attr('table_name'), 1);
    var t = $(this).attr('table_name');
    var id      = document.getElementById('id_tbody_' + t);
    var idThis = document.getElementById('id_hide_tbody_' + t);
    localStorage.setItem('id_tbody_' + t, id.innerHTML);
    localStorage.setItem('id_hide_tbody_' + t, idThis.innerHTML);
    console.log('SET key = ' + 'id_tbody_' + t + '...... with value = ' + id.innerHTML);
    console.log('SET key = ' + 'id_hide_tbody_' + t + '...... with value = ' + idThis.innerHTML);
});

Bournvita1998 added some commits Aug 3, 2019

Saving changes on temporary basis
Signed-off-by: Bournvita1998 <mohit.kuri@research.iiit.ac.in>
Made changes as per the comment but for all the table rather than jus…
…t for one table

Signed-off-by: Bournvita1998 <mohit.kuri@research.iiit.ac.in>
@phpmyadmin-bot

This comment has been minimized.

Copy link

commented on c1be9bb Aug 13, 2019

This commit has an invalid Signed-Off-By line, please use your full name for legal compliance reasons.
Please check Developer's Certificate of Origin
Here is a valid example: Signed-off-by: Jane Smith <jane.smith@example.org>

@phpmyadmin-bot

This comment has been minimized.

Copy link

commented on df2e43d Aug 13, 2019

This commit has an invalid Signed-Off-By line, please use your full name for legal compliance reasons.
Please check Developer's Certificate of Origin
Here is a valid example: Signed-off-by: Jane Smith <jane.smith@example.org>

@Bournvita1998

This comment has been minimized.

Copy link
Contributor Author

commented Aug 13, 2019

Committed the changes as per the comment message but the committed code is for all the tables(not just for one table as shown here in the comment)

@williamdes williamdes added this to To do in pull-requests Aug 20, 2019

@williamdes williamdes moved this from To do to In progress in pull-requests Aug 20, 2019

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