ucb-rit / coldfront

HPC Resource Allocation System
https://coldfront.readthedocs.io
GNU General Public License v3.0
3 stars 3 forks source link

Support CLI and UI validation of LBL Project IDs #626

Closed matthew-li closed 2 weeks ago

matthew-li commented 1 month ago

There is currently no convenient way to check whether an arbitrary LBL Project ID (docs) is currently "valid".

Add the following:

  1. A subcommand of the billing_ids command named validate that takes a billing ID as input and prints out "Valid" or "Invalid".
  2. A view at the URL /billing/validate/ that takes a billing ID as input and returns in some way whether it is valid.
    • In the billing ID usages page (Admin > LBL Project IDs), add a "Validate" button next to "Create" that links to this view.
    • It should have the same permissions as the other billing views.

To check validity, call coldfront.core.billing.utils.validation.is_billing_id_valid.

Enforce that the billing ID is "well-formed" before bothering to check for validity.

(Optional) To improve UX, take as input a list of billing IDs and return whether they are individually valid/invalid. For the UI, this could be a text area that takes a newline-separated list. For the CLI, this could be given as an arbitrary number of arguments (search for nargs='+' in management commands).

Add tests.

matthew-li commented 1 month ago

Another relevant article: https://github.com/ucb-rit/mybrc-mylrc-docs/blob/main/docs/how-to-guides/lrc-only/how-to-manage-billing-ids.md