jenkinsci / lockable-resources-plugin

Lock resources against concurrent use
https://plugins.jenkins.io/lockable-resources
MIT License
87 stars 182 forks source link

DataTables local-storage issue prevents restore of lockable resources overview table preferences #567

Closed PayBas closed 1 year ago

PayBas commented 1 year ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.414.2 OS: Linux - 6.4.13-100.fc37.x86_64 Java: 11.0.20 - Red Hat, Inc. (OpenJDK 64-Bit Server VM) --- active-directory:2.33 allure-jenkins-plugin:2.30.3 ansicolor:1.0.4 antisamy-markup-formatter:162.v0e6ec0fcfcf6 apache-httpcomponents-client-4-api:4.5.14-208.v438351942757 audit-trail:347.v1fc515cc462b_ authentication-tokens:1.53.v1c90fd9191a_b_ blueocean:1.27.8 blueocean-autofavorite:1.2.5 blueocean-bitbucket-pipeline:1.27.8 blueocean-commons:1.27.8 blueocean-config:1.27.8 blueocean-core-js:1.27.8 blueocean-dashboard:1.27.8 blueocean-display-url:2.4.2 blueocean-events:1.27.8 blueocean-git-pipeline:1.27.8 blueocean-github-pipeline:1.27.8 blueocean-i18n:1.27.8 blueocean-jira:1.27.8 blueocean-jwt:1.27.8 blueocean-personalization:1.27.8 blueocean-pipeline-api-impl:1.27.8 blueocean-pipeline-editor:1.27.8 blueocean-pipeline-scm-api:1.27.8 blueocean-rest:1.27.8 blueocean-rest-impl:1.27.8 blueocean-web:1.27.8 bootstrap5-api:5.3.2-1 bouncycastle-api:2.29 branch-api:2.1128.v717130d4f816 build-failure-analyzer:2.4.2 build-monitor-plugin:1.14-745.ve2023a_305f40 caffeine-api:3.1.8-133.v17b_1ff2e0599 checks-api:2.0.2 cloudbees-bitbucket-branch-source:845.v27a_d5823911b_ cloudbees-disk-usage-simple:182.v62ca_0c992a_f3 cloudbees-folder:6.848.ve3b_fd7839a_81 command-launcher:107.v773860566e2e commons-lang3-api:3.13.0-62.v7d18e55f51e2 commons-text-api:1.10.0-78.v3e7b_ea_d5a_fe1 credentials:1271.v54b_1c2c6388a_ credentials-binding:636.v55f1275c7b_27 custom-folder-icon:2.9 dark-theme:336.v02165cd8c2ee data-tables-api:1.13.6-4 dependency-check-jenkins-plugin:5.4.3 display-url-api:2.200.vb_9327d658781 docker-commons:439.va_3cb_0a_6a_fb_29 docker-workflow:572.v950f58993843 durable-task:523.va_a_22cf15d5e0 echarts-api:5.4.0-6 email-ext:2.102 extended-read-permission:53.v6499940139e5 favorite:2.4.3 font-awesome-api:6.4.2-1 git:5.2.0 git-client:4.5.0 git-server:99.va_0826a_b_cdfa_d github:1.37.3 github-api:1.316-451.v15738eef3414 github-branch-source:1741.va_3028eb_9fd21 groovy:457.v99900cb_85593 handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953 htmlpublisher:1.32 http_request:1.18 instance-identity:173.va_37c494ec4e5 ionicons-api:56.v1b_1c8c49374e jackson2-api:2.15.2-350.v0c2f3f8fc595 jakarta-activation-api:2.0.1-3 jakarta-mail-api:2.0.1-3 javadoc:243.vb_b_503b_b_45537 javax-activation-api:1.2.0-6 javax-mail-api:1.6.2-9 jaxb:2.3.8-1 jdk-tool:73.vddf737284550 jenkins-design-language:1.27.8 jersey2-api:2.40-1 jira:3.11 jjwt-api:0.11.5-77.v646c772fddb_0 jquery3-api:3.7.1-1 jsch:0.2.8-65.v052c39de79b_2 junit:1240.vf9529b_881428 kubernetes:4029.v5712230ccb_f8 kubernetes-client-api:6.8.1-224.vd388fca_4db_3b_ kubernetes-credentials:0.11 lockable-resources:1185.v0c528656ce04 logstash:2.5.0218.v0a_ff8fefc12b_ mailer:463.vedf8358e006b_ matrix-auth:3.2.1 matrix-project:808.v5a_b_5f56d6966 metrics:4.2.18-442.v02e107157925 mina-sshd-api-common:2.10.0-69.v28e3e36d18eb_ mina-sshd-api-core:2.10.0-69.v28e3e36d18eb_ nexus-jenkins-plugin:3.16.510.v4d23e22cf563 okhttp-api:4.11.0-157.v6852a_a_fa_ec11 openshift-client:1.1.0.420.v8817277c1990 pipeline-build-step:505.v5f0844d8d126 pipeline-graph-analysis:202.va_d268e64deb_3 pipeline-groovy-lib:689.veec561a_dee13 pipeline-input-step:477.v339683a_8d55e pipeline-milestone-step:111.v449306f708b_7 pipeline-model-api:2.2144.v077a_d1928a_40 pipeline-model-definition:2.2144.v077a_d1928a_40 pipeline-model-extensions:2.2144.v077a_d1928a_40 pipeline-rest-api:2.33 pipeline-stage-step:305.ve96d0205c1c6 pipeline-stage-tags-metadata:2.2144.v077a_d1928a_40 pipeline-stage-view:2.33 pipeline-utility-steps:2.16.0 plain-credentials:143.v1b_df8b_d3b_e48 plugin-util-api:3.3.0 prometheus:2.3.3 prometheus-lockable-resources:1.0.0 pubsub-light:1.17 resource-disposer:0.23 scm-api:676.v886669a_199a_a_ script-security:1275.v23895f409fb_d simple-theme-plugin:160.vb_76454b_67900 snakeyaml-api:2.2-111.vc6598e30cc65 sonar:2.16 sse-gateway:1.26 ssh-agent:333.v878b_53c89511 ssh-credentials:308.ve4497b_ccd8f4 sshd:3.312.v1c601b_c83b_0e structs:325.vcb_307d2a_2782 testcafe:1.0 theme-manager:211.vef2a_42c645a_b_ timestamper:1.26 token-macro:384.vf35b_f26814ec trilead-api:2.84.v72119de229b_7 variant:60.v7290fc0eb_b_cd workflow-aggregator:596.v8c21c963d92d workflow-api:1281.vca_5fddb_3fceb_ workflow-basic-steps:1042.ve7b_140c4a_e0c workflow-cps:3793.v65dec41c3a_c3 workflow-durable-task-step:1289.v4d3e7b_01546b_ workflow-job:1348.v32a_a_f150910e workflow-multibranch:756.v891d88f2cd46 workflow-scm-step:415.v434365564324 workflow-step-api:639.v6eca_cd8c04a_a_ workflow-support:865.v43e78cc44e0d ws-cleanup:0.45 ```

What Operating System are you using (both controller, and any agents involved in the problem)?

Fedora 37 for the Jenkins server macOS 13.6 for the browsers (Chrome & Firefox both display the same behavior)

Reproduction steps

  1. Browse to https://my.jenkins/lockable-resources/
  2. Open the browser's developer tools.
  3. Clear the browser "local storage" for the site/domain.
  4. Change the sort column/direction or the number of rows to show of the lockable-resources overview table.
  5. Observe the local storage getting set.
  6. Refresh the page

Expected Results

The DataTables settings should be retrieved from local storage and the table should render the same

Actual Results

The DataTables reset to some weird (but consistent) setting of:

lockable-resources#orderBy:"1"
lockable-resources#orderDirection:"asc"
DataTables_lockable-resources_/lockable-resources/:"{"time":1696513093971,"start":0,"length":10,"order":"[[1, \"asc\"]]","search":{"search":"","smart":true,"regex":false,"caseInsensitive":true},"columns":"[{\"visible\": true, \"search\": {\"search\": \"\", \"smart\": true, \"regex\": false, \"caseInsensitive\": true}}, {\"visible\": true, \"search\": {\"search\": \"\", \"smart\": true, \"regex\": false, \"caseInsensitive\": true}}, {\"visible\": true, \"search\": {\"search\": \"\", \"smart\": true, \"regex\": false, \"caseInsensitive\": true}}, {\"visible\": true, \"search\": {\"search\": \"\", \"smart\": true, \"regex\": false, \"caseInsensitive\": true}}, {\"visible\": true, \"search\": {\"search\": \"\", \"smart\": true, \"regex\": false, \"caseInsensitive\": true}}, {\"visible\": false, \"search\": {\"search\": \"\", \"smart\": true, \"regex\": false, \"caseInsensitive\": true}}, {\"visible\": true, \"search\": {\"search\": \"\", \"smart\": true, \"regex\": false, \"caseInsensitive\": true}}]","childRows":"[]"}"

I think there might be some conflict happening between these settings.

Anything else?

Perhaps related to the jQuery/DataTables errors which can be seen when interacting with the table:

Uncaught TypeError: table.rows is not a function
    bindTables https://my.jenkins/static/5dabc8f4/plugin/data-tables-api/js/table.js:145
    jQuery 14
    bindTables https://my.jenkins/static/5dabc8f4/plugin/data-tables-api/js/table.js:183
    jQuery 2
    bindTables https://my.jenkins/static/5dabc8f4/plugin/data-tables-api/js/table.js:108
    <anonymous> https://my.jenkins/static/5dabc8f4/plugin/data-tables-api/js/table.js:219
    <anonymous> https://my.jenkins/static/5dabc8f4/plugin/data-tables-api/js/table.js:220
    jQuery 13
PayBas commented 1 year ago

Upon closer inspection, this issue was introduced in https://plugins.jenkins.io/data-tables-api/releases/#version_1.13.6-4

Downgrading to https://plugins.jenkins.io/data-tables-api/releases/#version_1.13.6-3 solved the issue.

mPokornyETM commented 1 year ago

@uhafner pls inform me when it is fixed in the DataTable plugin. Then I will retest it here and close the issue

uhafner commented 1 year ago

Fixed by https://github.com/jenkinsci/data-tables-api-plugin/releases/tag/v1.13.6-5

mPokornyETM commented 1 year ago

Fixed by https://github.com/jenkinsci/data-tables-api-plugin/releases/tag/v1.13.6-5

Great I will eait for next POM update and test it, Thx too much.

PayBas commented 1 year ago

Can confirm that updating to https://github.com/jenkinsci/data-tables-api-plugin/releases/tag/v1.13.6-5 fixed the issue.

mPokornyETM commented 1 year ago

Great, thx for feadback, I will close this issue now.