Changeset 2927


Ignore:
Timestamp:
Nov 16, 2006, 1:28:58 PM (16 years ago)
Author:
Nicklas Nordborg
Message:

References #298: Add administrator page for viewing disk usage statistics

First version for getting an overview. Should add pages for getting more detailed info
as well.

Location:
trunk
Files:
6 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/common-queries.xml

    r2899 r2927  
    551551  </query>
    552552
     553  <query id="GET_TOTAL_DISKUSAGE_SUMMARY" type="HQL">
     554    <sql>
     555      SELECT SUM(du.bytes), du.location, du.quotaType.systemId
     556      FROM DiskUsageData du
     557      GROUP BY du.location, du.quotaType.systemId
     558    </sql>
     559    <description>
     560      A Hibernate query that returns the total disk usage grouped
     561      by location and quota type system id.
     562    </description>
     563  </query>
     564
     565  <query id="GET_DISKUSAGE_SUMMARY_FOR_USER" type="HQL">
     566    <sql>
     567      SELECT SUM(du.bytes), du.location, du.quotaType.systemId
     568      FROM DiskUsageData du
     569      WHERE du.user = :user
     570      GROUP BY du.location, du.quotaType.systemId
     571    </sql>
     572    <description>
     573      A Hibernate query that returns the disk usage for a user grouped
     574      by location and quota type system id.
     575    </description>
     576  </query>
     577
     578  <query id="GET_DISKUSAGE_SUMMARY_FOR_GROUP" type="HQL">
     579    <sql>
     580      SELECT SUM(du.bytes), du.location, du.quotaType.systemId
     581      FROM DiskUsageData du
     582      WHERE du.group = :group
     583      GROUP BY du.location, du.quotaType.systemId
     584    </sql>
     585    <description>
     586      A Hibernate query that returns the disk usage for a group grouped
     587      by location and quota type system id.
     588    </description>
     589  </query>
     590 
    553591  <query id="GET_FILES_IN_DIRECTORY" type="HQL">
    554592    <sql>
  • trunk/src/core/net/sf/basedb/core/DiskUsage.java

    r2898 r2927  
    8282  }
    8383 
     84  public static DiskUsageStatistics getStatistics(DbControl dc)
     85  {
     86    return new DiskUsageStatistics(dc);
     87  }
     88 
    8489  /**
    8590    Create a new <code>DiskUsage</code> item.
  • trunk/www/include/menu.jsp

    r2912 r2927  
    642642    final boolean hasClients = sc.hasPermission(Permission.READ, Item.CLIENT);
    643643    final boolean hasNews = sc.hasPermission(Permission.READ, Item.NEWS);
    644     Client currentClient = Client.getById(dc, sc.getClientId());
     644    final boolean hasDiskUsage = sc.hasPermission(Permission.READ, Item.DISKUSAGE);
     645    final Client currentClient = Client.getById(dc, sc.getClientId());
    645646    final boolean hasServer = currentClient.hasPermission(Permission.WRITE);
    646647
    647648    final boolean hasAdministrate =
    648649      hasUsers || hasGroups || hasRoles || hasQuota || hasTypes || hasPlugins ||
    649       hasSoftware || hasHardware || hasProtocols || hasClients || hasNews || hasServer;
     650      hasSoftware || hasHardware || hasProtocols || hasClients || hasNews ||
     651      hasDiskUsage || hasServer;
    650652
    651653    if (hasAdministrate)
     
    726728        />
    727729        <m:menuseparator />
     730        <m:menuitem
     731          title="Disk usage"
     732          onclick="<%="Menu.openUrl('"+root+"admin/diskusage/index.jsp?ID="+ID+"')"%>"
     733          tooltip="<%=hasDiskUsage ? "Check disk usage" : "You do not have permission to check disk usage"%>"
     734          enabled="<%=hasDiskUsage%>"
     735        />
    728736        <m:menuitem
    729737          title="Server settings&hellip;"
Note: See TracChangeset for help on using the changeset viewer.