Project

General

Profile

Cluster-wide favorites » History » Version 4

Tom Morris, 02/25/2019 06:22 PM

1 1 Peter Amstutz
h1. Cluster-wide favorites
2
3 4 Tom Morris
[ written in response to requirements in https://dev.arvados.org/issues/14343 ]
4
5 1 Peter Amstutz
A "favorite" is a link record and is used to represent shortcuts to projects in the user interface (workbench).
6
7
The schema for a "favorite" link is:
8
9
|_. Field|_. Value|_. Description|
10
|owner_uuid|user or group uuid|The user or group that "owns" the favorite|
11
|head_uuid|project uuid|The project being favorited|
12
|link_class|string of value "star"|Indicates this represents a link to a user favorite|
13
14 2 Peter Amstutz
h2. Cluster wide favorites
15
16
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.
17
18 1 Peter Amstutz
h2. Creating a favorite
19
20
  $ arv link create --link '{
21
      "owner_uuid": "c97qk-j7d0g-fffffffffffffff", 
22
      "head_uuid":  "c97qk-j7d0g-khm44br99mz40hk", 
23
      "link_class": "star"}'
24
25
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.:
26
27
  $ arv link create --link '{
28
      "owner_uuid": "c97qk-j7d0g-fffffffffffffff", 
29
      "tail_uuid":  "c97qk-j7d0g-fffffffffffffff", 
30
      "head_uuid":  "c97qk-j7d0g-khm44br99mz40hk", 
31
      "link_class": "star"}'
32
33
Using curl
34
35
<pre>
36
$ echo '{"owner_uuid": "c97qk-j7d0g-fffffffffffffff", 
37
      "head_uuid":  "c97qk-j7d0g-khm44br99mz40hk", 
38
      "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
39
</pre>
40
41
h2. Deleting a favorite
42
43
  $ arv link delete --uuid c97qk-o0j2j-haadun4x0vmpvnd
44
45
Using curl
46
47
  $ curl -X DELETE -H "Authorization: Bearer $ARVADOS_API_TOKEN" https://c97qk.arvadosapi.com/arvados/v1/links/c97qk-o0j2j-vasz95f7f8otj8f
48
49
h2. Listing favorites
50
51
To list all 'star' links readable by the current user
52
53 3 Peter Amstutz
  $ arv link list --filters '[["link_class", "=", "star"]]' --order owner_uuid
54 1 Peter Amstutz
55
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.
56
57
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:
58
59
  $ arv link list --filters '[
60
    ["link_class", "=", "star"], 
61
    ["owner_uuid", "in", ["1b7fr-j7d0g-fffffffffffffff", "1b7fr-tpzed-qmf60jo0vs4ecww"]]]'
62
63
Using curl
64
65 3 Peter Amstutz
  $ 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
66
67
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.