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

Support non-numeric values for Usage chart filter parameters #716

Merged
merged 14 commits into from
Dec 10, 2018

Commits on Dec 10, 2018

  1. Add new functionality to Usage chart requests

    Added the ability for Usage chart requests to provide non-numeric values for
    '_filter' parameters. The new feature will attempt to translate these
    non-numeric values into appropriate id values that can be used during chart
    generation. Specifically this new feature is to support integration w/
    Coldfront.
    ryanrath committed Dec 10, 2018
    Configuration menu
    Copy the full SHA
    876fd88 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e0ad5c2 View commit details
    Browse the repository at this point in the history
  3. Style fix

    ryanrath committed Dec 10, 2018
    Configuration menu
    Copy the full SHA
    bfd9fcd View commit details
    Browse the repository at this point in the history
  4. Updating documentation

    ryanrath committed Dec 10, 2018
    Configuration menu
    Copy the full SHA
    152dbb1 View commit details
    Browse the repository at this point in the history
  5. Simplification of the translateValue function per @jpwhite4

    Per code review comments I've simplified this function.
      - Moved the `is_numeric` check to the top of the function and used it as a
        short circuit.
      - Removed the anonymous function and moved the code it contained to the bottom
        of the function, executed contingent on which `case`, if any, is hit.
    ryanrath committed Dec 10, 2018
    Configuration menu
    Copy the full SHA
    45a6454 View commit details
    Browse the repository at this point in the history
  6. New integration tests for the newly added Usage functionality

    This new test checks that the `_filter` variables accept non-id
    values (optionally, multiple comma delimited values). The test data includes the
    following:
      - Tests run as all users ( pub, cd, cs, pi, usr )
      - Multiple Realms ( Jobs, Cloud )
      - For the Jobs realm, all combinations of: ( including single, multiple,
        numeric & non-numeric values )
        - 'resource', 'resource_filter'
        - 'pi', 'pi_filter'
      - For the Cloud realm: ( including single, multiple, numeric, and non-numeric
        values )
        - 'project', 'project_filter'
    ryanrath committed Dec 10, 2018
    Configuration menu
    Copy the full SHA
    607dc71 View commit details
    Browse the repository at this point in the history
  7. Style Fix

    ryanrath committed Dec 10, 2018
    Configuration menu
    Copy the full SHA
    20926ef View commit details
    Browse the repository at this point in the history
  8. Updates per @jpwhite4 comment

    As this function should only ever return one value the code has been updated so
    that this is the case.
    ryanrath committed Dec 10, 2018
    Configuration menu
    Copy the full SHA
    9f1e4d2 View commit details
    Browse the repository at this point in the history
  9. Updates per convo w/ @smgallo

    - Updated `translateFilterValue` to return an array of values and the calling code
    to work with an array as opposed to a single value. This is to support the use
    case of a system account being associated with more than one person.
    
    - Updated `translateFilterValue` to only interpret `$usageFilterValue` as a
      string if it contains quotes ( single or double ). This allows us to identify
      when the calling code is passing us a value that is intended to be
      interpreted as a string not a number.
    
    - Updated Test Cases so that string values are quoted with both single / double
      quotes.
    
    - Added additional test cases that test what happens when a string value is
      provided that is not found in the db.
    ryanrath committed Dec 10, 2018
    Configuration menu
    Copy the full SHA
    e20cc9d View commit details
    Browse the repository at this point in the history
  10. Refactor / Simplification of Usage Filter generation

    Refactored a portion of the `convertChartRequest` function and combined the two
    `for-each` loops that were populating the `$meFilters` variable. Now we have one
    loop that has the same functionality.
    
    Also a tiny comment update in the `translateFilterValue` function for the
    'pi' filter type. Now that we always return an array the previous comment didn't
    really make sense anymore.
    ryanrath committed Dec 10, 2018
    Configuration menu
    Copy the full SHA
    ab8932b View commit details
    Browse the repository at this point in the history
  11. Simplified translateFilterValue

    Now that we have a reliable test for what constitutes a "string" ( i.e. must be
    quoted ) we can simplify the internals of `translateFilterValue` by removing the
    vast majority of the if/elseif block. Also added a few comments to help provide
    context.
    ryanrath committed Dec 10, 2018
    Configuration menu
    Copy the full SHA
    f149e41 View commit details
    Browse the repository at this point in the history
  12. Providing more informative exception info

    Added `$usageFilterType` to the message for the exception thrown in
    `translateFilterValue`.
    ryanrath committed Dec 10, 2018
    Configuration menu
    Copy the full SHA
    e5d01de View commit details
    Browse the repository at this point in the history
  13. Updating the translateFilterValue exception message

    Added the invalid `$usageFilterValue` to the exception message and updated the
    section in the tests that handled detecting when exceptions are thrown to handle
    this update.
    ryanrath committed Dec 10, 2018
    Configuration menu
    Copy the full SHA
    fb095a8 View commit details
    Browse the repository at this point in the history
  14. Update classes/DataWarehouse/Access/Usage.php

    Co-Authored-By: ryanrath <ryanrath@buffalo.edu>
    smgallo and ryanrath committed Dec 10, 2018
    Configuration menu
    Copy the full SHA
    0f83768 View commit details
    Browse the repository at this point in the history