#1820 [web] human-friendly file sizes in taskinfo page
Merged 2 years ago by tkopecek. Opened 2 years ago by tkopecek.
tkopecek/koji issue1819  into  master

file modified
+3 -3
@@ -59,7 +59,7 @@ 

      </tr>

      #end if

      <tr>

-       <th>Size</th><td>$rpm.size</td>

+       <th>Size</th><td>$util.formatThousands($rpm.size)</td>

      </tr>

      <tr>

        <th><label title="The MD5 digest of the combined header and payload contents. You can query it by `rpmkeys -Kv foo.rpm`">SIGMD5</label></th><td>$rpm.payloadhash</td>
@@ -236,11 +236,11 @@ 

            </tr>

            <tr class="list-header">

              <th><a href="rpminfo?fileOrder=$util.toggleOrder($self, 'name', 'fileOrder')$util.passthrough_except($self, 'fileOrder', 'fileStart')#filelist">Name</a> $util.sortImage($self, 'name', 'fileOrder')</th>

-             <th><a href="rpminfo?fileOrder=$util.toggleOrder($self, 'size', 'fileOrder')$util.passthrough_except($self, 'fileOrder', 'fileStart')#filelist">Size</a> $util.sortImage($self, 'size', 'fileOrder')</th>

+             <th align="right"><a href="rpminfo?fileOrder=$util.toggleOrder($self, 'size', 'fileOrder')$util.passthrough_except($self, 'fileOrder', 'fileStart')#filelist">Size</a> $util.sortImage($self, 'size', 'fileOrder')</th>

            </tr>

            #for $file in $files

            <tr class="$util.rowToggle($self)">

-             <td><a href="fileinfo?rpmID=$rpm.id&amp;filename=$quote($file.name)">$util.escapeHTML($file.name)</a></td><td>$file.size</td>

+             <td><a href="fileinfo?rpmID=$rpm.id&amp;filename=$quote($file.name)">$util.escapeHTML($file.name)</a></td><td align="right">$util.formatThousands($file.size)</td>

            </tr>

            #end for

          </table>

file modified
+3
@@ -486,6 +486,9 @@ 

  

      return result

  

+ def formatThousands(value):

+     return '{:,}'.format(value)

+ 

  def rowToggle(template):

      """If the value of template._rowNum is even, return 'row-even';

      if it is odd, return 'row-odd'.  Increment the value before checking it.

+1

Though, it would be nice to convert them to megabytes/gigabytes/etc.

I was thinking about that, but wouldn't it be more confusing?

Please add align="right" for this <th> Size header also.

I tested this locally and I think this is a great improvement. Thanks.

Now that the numbers are right-aligned, the "Size" column header doesn't look like it relates to these numbers any more. When I set align="right" on the , it looks better to me.

rebased onto 29fd8d4c7ba36620fbbe004ce0a1f6089e372c4b

2 years ago

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

2 years ago

rebased onto 555abdd

2 years ago

Metadata Update from @jcupova:
- Pull-request tagged with: testing-done

2 years ago

Commit e5ac490 fixes this pull-request

Pull-Request has been merged by tkopecek

2 years ago