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