Select a resource or service based on filtering down criteria
This is a resource explorer for interactive selection of a storage, compute, service, or other resource provided by Research Computing. The idea comes by way of the griznoggiest wisdom of @griznog.
The resource-explorer.js starts with variables for questions and resources that drive the logic of the interface. The user will be presented with a series of easy to answer questions, and the selection of resources will be narrowed down based on the answers. Specifically:
Include multiple-choice, single-choice, boolean, and enumerate-choice.
In the above, an enumerate choice implies there is an ordering to the logic. The user might want a minimum or maximum amount of memory, for example. Each question should be under the questions variable (a list), and have a title, description, required (true or false) and then options. For example:
{
"title": "Who is the resource for?",
"id": "q-who",
"description": "Select one or more groups that the resource is needed for.",
"required": false,
"type": "multiple-choice",
"options": [
{
"name": "faculty",
"id": "who-faculty"
},
{
"name": "staff",
"id": "who-staff"
},
{
"name": "student",
"id": "who-student"
}
]
}
For a minimum-* or maximum-* choice, the ids must end in an integer value:
{
"title": "What size of storage are you looking for?",
"id": "q-size",
"description": "If applicable, give an approximate unit of storage.",
"required": false,
"type": "minimum-choice",
"options": [
{
"name": "gigabytes",
"id": "size-gigabytes-1"
},
{
"name": "terabytes",
"id": "size-terabytes-2"
},
{
"name": "petabytes",
"id": "size-petabytes-3"
}
]
},
We do this so we can parse the ids and then rank order them. For a boolean choice, you can just use a single-choice with two choices:
{
"title": "Do you require backup?",
"id": "q-backups",
"description": "Some or all of your files will be copied on a regular basis in case you need restore.",
"required": false,
"type": "single-choice",
"options": [
{
"name": "backups",
"id": "backups-true"
},
{
"name": "no backups",
"id": "backups-false"
}
]
},
Notice that each choice has a unique id associated with it. These will be used as tags associated with each resource to help with the filtering.
A typical resource looks like this:
{
"title": "Nero",
"id": "nero",
"url": "https://nero-docs.stanford.edu",
"attributes": {
"q-kind": ["kind-compute", "kind-cloud"],
"q-service": [],
"q-who": ["who-faculty"], // only faculty allowed
// domain is left out, implying all domains
// size is left out, implying all sizes
"q-framework": ["framework-kubernetes", "framework-containers"],
"q-backups": ["backups-true"]
}
},
Note that we require a title (a user friendly print-able value), an id (for the object in the DOM), a url to link to, and then a list of attributes. For each attribute, the key corresponds to an id for a question, and then the list of values is a list of responses that, if chosen by the user, would make it a valid choice. Specifically:
For the above, this would mean that:
q-service
, the Nero option would be hidden.This repository serves only as an example, and doesn't reflect the actual state of Stanford resources (but we will make one!)