Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-6214

Provide the current width of a portlet as a variable to a plug-in that provides a portlet

    Details

    • Similar Issues:

      Description

      The analysis plug-ins provides several portlets with user configurable width and height. Since the width of a portlet depends on the screen resolution and the number of columns it would be nice if the default width for a portlet graph would be available as a variable in the jelly scripts (at least a default width for single or double column display would be nice).

      (The same would be good for the height, too. Here at least a default height would be nice to have.)

        Attachments

          Activity

          drulli Ulli Hafner created issue -
          drulli Ulli Hafner made changes -
          Field Original Value New Value
          Description I'm currently adding some portlets that render the trend graphs for my static analysis plug-ins. Since the width of a portlet depends on the screen resolution and the number of columns it would be nice if the default width for a portlet graph would be available as a variable in the jelly scripts (at least a default width for single or double column display would be nice). The same would be good for the height, here at least a default height would be nice to have.

          Currently, the width and height is hardwired:

          {code}
          <div align="center">
            <img id="graph" src="${it.url}warningsGraph/png?width=600&amp;height=450" lazymap="${it.url}warningsGraph/map" alt="${it.description}"/>
          </div>
          {code}

          What I would like to have is something like

          {code}
          <div align="center">
            <img id="graph" src="${it.url}warningsGraph/png?width=${it.width};height=${it.height}" lazymap="${it.url}warningsGraph/map" alt="${it.description}"/>
          </div>
          {code}

          I'm currently adding some portlets that render the trend graphs for my static analysis plug-ins. Since the width of a portlet depends on the screen resolution and the number of columns it would be nice if the default width for a portlet graph would be available as a variable in the jelly scripts (at least a default width for single or double column display would be nice).

          (The same would be good for the height, too. Here at least a default height would be nice to have. However, the actual height should be overwritable by the user in the portlet configuration.)

          Currently, the width and height is hardwired:

          {code}
          <div align="center">
            <img id="graph" src="${it.url}warningsGraph/png?width=600&amp;height=450" lazymap="${it.url}warningsGraph/map" alt="${it.description}"/>
          </div>
          {code}

          What I would like to have is something like

          {code}
          <div align="center">
            <img id="graph" src="${it.url}warningsGraph/png?width=${it.width};height=${it.height}" lazymap="${it.url}warningsGraph/map" alt="${it.description}"/>
          </div>
          {code}

          Hide
          mambu Marco Ambu added a comment -

          To add some extra parameters to your DashboardPortlet you need to implement your own config.jelly (you can make a copy of one config.jelly in the dashboard-view plugin source code).
          Then add your parameters to you ctor and that's it.
          See issue 6811 and dashboard-view wiki (I have just updated it with the instructions).

          Show
          mambu Marco Ambu added a comment - To add some extra parameters to your DashboardPortlet you need to implement your own config.jelly (you can make a copy of one config.jelly in the dashboard-view plugin source code). Then add your parameters to you ctor and that's it. See issue 6811 and dashboard-view wiki (I have just updated it with the instructions).
          Hide
          mambu Marco Ambu added a comment -

          Please use graphWidth and graphHeight as variable names for the 'graph', anyway do not use width and height, because looking at the several issues for the dashboard-view plugin maybe we will insert width (and height???) as the dimension of the portlet (the entire portlet, not only the graph inside). So we can avoid conflicts later. Thanks.

          Show
          mambu Marco Ambu added a comment - Please use graphWidth and graphHeight as variable names for the 'graph', anyway do not use width and height, because looking at the several issues for the dashboard-view plugin maybe we will insert width (and height???) as the dimension of the portlet (the entire portlet, not only the graph inside). So we can avoid conflicts later. Thanks.
          drulli Ulli Hafner made changes -
          Summary Provide the width of the portlet as a variable Provide the current width of a portlet as a variable to a plug-in that provides a portlet
          Description I'm currently adding some portlets that render the trend graphs for my static analysis plug-ins. Since the width of a portlet depends on the screen resolution and the number of columns it would be nice if the default width for a portlet graph would be available as a variable in the jelly scripts (at least a default width for single or double column display would be nice).

          (The same would be good for the height, too. Here at least a default height would be nice to have. However, the actual height should be overwritable by the user in the portlet configuration.)

          Currently, the width and height is hardwired:

          {code}
          <div align="center">
            <img id="graph" src="${it.url}warningsGraph/png?width=600&amp;height=450" lazymap="${it.url}warningsGraph/map" alt="${it.description}"/>
          </div>
          {code}

          What I would like to have is something like

          {code}
          <div align="center">
            <img id="graph" src="${it.url}warningsGraph/png?width=${it.width};height=${it.height}" lazymap="${it.url}warningsGraph/map" alt="${it.description}"/>
          </div>
          {code}

          The analysis plug-ins provides several portlets with user configurable width and height. Since the width of a portlet depends on the screen resolution and the number of columns it would be nice if the default width for a portlet graph would be available as a variable in the jelly scripts (at least a default width for single or double column display would be nice).

          (The same would be good for the height, too. Here at least a default height would be nice to have. However, the actual height should be overwritable by the user in the portlet configuration.)
          Hide
          drulli Ulli Hafner added a comment -

          Updated the description since it was misleading. The width and height already is configurable, what is missing are defaults for width and height.

          Show
          drulli Ulli Hafner added a comment - Updated the description since it was misleading. The width and height already is configurable, what is missing are defaults for width and height.
          drulli Ulli Hafner made changes -
          Description The analysis plug-ins provides several portlets with user configurable width and height. Since the width of a portlet depends on the screen resolution and the number of columns it would be nice if the default width for a portlet graph would be available as a variable in the jelly scripts (at least a default width for single or double column display would be nice).

          (The same would be good for the height, too. Here at least a default height would be nice to have. However, the actual height should be overwritable by the user in the portlet configuration.)
          The analysis plug-ins provides several portlets with user configurable width and height. Since the width of a portlet depends on the screen resolution and the number of columns it would be nice if the default width for a portlet graph would be available as a variable in the jelly scripts (at least a default width for single or double column display would be nice).

          (The same would be good for the height, too. Here at least a default height would be nice to have.)
          Hide
          mambu Marco Ambu added a comment -

          Do you mean that when a portlet is displayed it gets the width of the 'frame' which it is going to be shown in?
          I don't know how to get this value (in pixels) because in the dashboard it is expressed in percentage (50% for 2 columns, 100% for 1 columns).

          Show
          mambu Marco Ambu added a comment - Do you mean that when a portlet is displayed it gets the width of the 'frame' which it is going to be shown in? I don't know how to get this value (in pixels) because in the dashboard it is expressed in percentage (50% for 2 columns, 100% for 1 columns).
          Hide
          drulli Ulli Hafner added a comment -

          Yes, I mean the width of the frame. Couldn't that be done with some javascript?

          Maybe the width of a portlet should be kind of 'auto-resizable', i.e. if the user changes the size of the frame (e.g., by shrinking the browser window), then the portlet automatically fills the available space. I don't know if that is possible, maybe someone on the dev list knows how to do that?

          Show
          drulli Ulli Hafner added a comment - Yes, I mean the width of the frame. Couldn't that be done with some javascript? Maybe the width of a portlet should be kind of 'auto-resizable', i.e. if the user changes the size of the frame (e.g., by shrinking the browser window), then the portlet automatically fills the available space. I don't know if that is possible, maybe someone on the dev list knows how to do that?
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 136307 ] JNJira + In-Review [ 174482 ]

            People

            • Assignee:
              petehayes Peter Hayes
              Reporter:
              drulli Ulli Hafner
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: