Project

General

Profile

Cluster-wide favorites » History » Revision 3

Revision 2 (Peter Amstutz, 12/06/2018 09:06 PM) → Revision 3/4 (Peter Amstutz, 12/06/2018 09:34 PM)

h1. Cluster-wide favorites 

 A "favorite" is a link record and is used to represent shortcuts to projects in the user interface (workbench). 

 The schema for a "favorite" link is: 

 |_. Field|_. Value|_. Description| 
 |owner_uuid|user or group uuid|The user or group that "owns" the favorite| 
 |head_uuid|project uuid|The project being favorited| 
 |link_class|string of value "star"|Indicates this represents a link to a user favorite| 

 h2. Cluster wide favorites 

 The "All Users" group for a given cluster has the uuid "{prefix}-j7d0g-fffffffffffffff".    Cluster-wide favorites that will show up for all users should belong to the "All Users" group. 

 h2. Creating a favorite 

   $ arv link create --link '{ 
       "owner_uuid": "c97qk-j7d0g-fffffffffffffff",  
       "head_uuid":    "c97qk-j7d0g-khm44br99mz40hk",  
       "link_class": "star"}' 

 Note: historically workbench also set "tail_uuid" to be same as "owner_uuid" and "name" the same as "head_uuid", but these are redundant.    However, for compatibility between workbench1 and workbench2, we still need to set "tail_uuid" e.g.: 

   $ arv link create --link '{ 
       "owner_uuid": "c97qk-j7d0g-fffffffffffffff",  
       "tail_uuid":    "c97qk-j7d0g-fffffffffffffff",  
       "head_uuid":    "c97qk-j7d0g-khm44br99mz40hk",  
       "link_class": "star"}' 

 Using curl 

 <pre> 
 $ echo '{"owner_uuid": "c97qk-j7d0g-fffffffffffffff",  
       "head_uuid":    "c97qk-j7d0g-khm44br99mz40hk",  
       "link_class": "star"}' | curl -X POST --data-binary @- -H "Content-Type: application/json" -H "Authorization: Bearer $ARVADOS_API_TOKEN" https://c97qk.arvadosapi.com/arvados/v1/links 
 </pre> 

 h2. Deleting a favorite 

   $ arv link delete --uuid c97qk-o0j2j-haadun4x0vmpvnd 

 Using curl 

   $ curl -X DELETE -H "Authorization: Bearer $ARVADOS_API_TOKEN" https://c97qk.arvadosapi.com/arvados/v1/links/c97qk-o0j2j-vasz95f7f8otj8f 

 h2. Listing favorites 

 To list all 'star' links readable by the current user 

   $ arv link list --filters '[["link_class", "=", "star"]]' --order owner_uuid 

 However, this will include favorites belonging any group or project that is readable by the user.    The UI could break out groups of favorites by owner_uuid.    This would enable users to share groups of favorites, such as those pertaining to a specific project. 

 Alternately, the query can be restricted to only show favorites belonging to the "All Users" group and the current user by filtering on owner_uuid: 

   $ arv link list --filters '[ 
     ["link_class", "=", "star"],  
     ["owner_uuid", "in", ["1b7fr-j7d0g-fffffffffffffff", "1b7fr-tpzed-qmf60jo0vs4ecww"]]]' 

 Using curl 

   $ curl    --get -H "Authorization: Bearer $ARVADOS_API_TOKEN" --data-urlencode filters='[["link_class", "=", "star"]]' --data-urlencode order=owner_uuid https://c97qk.arvadosapi.com/arvados/v1/links 

 If there are more than 1000 favorites, the response will have a value of "items_available" > 1000.    In this case, use the "offset" query parameter for paging.