Cluster-wide favorites » History » Version 1
Peter Amstutz, 12/06/2018 08:49 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 | h2. Creating a favorite |
||
13 | |||
14 | $ arv link create --link '{ |
||
15 | "owner_uuid": "c97qk-j7d0g-fffffffffffffff", |
||
16 | "head_uuid": "c97qk-j7d0g-khm44br99mz40hk", |
||
17 | "link_class": "star"}' |
||
18 | |||
19 | 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.: |
||
20 | |||
21 | $ arv link create --link '{ |
||
22 | "owner_uuid": "c97qk-j7d0g-fffffffffffffff", |
||
23 | "tail_uuid": "c97qk-j7d0g-fffffffffffffff", |
||
24 | "head_uuid": "c97qk-j7d0g-khm44br99mz40hk", |
||
25 | "link_class": "star"}' |
||
26 | |||
27 | Using curl |
||
28 | |||
29 | <pre> |
||
30 | $ echo '{"owner_uuid": "c97qk-j7d0g-fffffffffffffff", |
||
31 | "head_uuid": "c97qk-j7d0g-khm44br99mz40hk", |
||
32 | "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 |
||
33 | </pre> |
||
34 | |||
35 | h2. Deleting a favorite |
||
36 | |||
37 | $ arv link delete --uuid c97qk-o0j2j-haadun4x0vmpvnd |
||
38 | |||
39 | Using curl |
||
40 | |||
41 | $ curl -X DELETE -H "Authorization: Bearer $ARVADOS_API_TOKEN" https://c97qk.arvadosapi.com/arvados/v1/links/c97qk-o0j2j-vasz95f7f8otj8f |
||
42 | |||
43 | h2. Listing favorites |
||
44 | |||
45 | To list all 'star' links readable by the current user |
||
46 | |||
47 | $ arv link list --filters '[["link_class", "=", "star"]]' |
||
48 | |||
49 | 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. |
||
50 | |||
51 | 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: |
||
52 | |||
53 | $ arv link list --filters '[ |
||
54 | ["link_class", "=", "star"], |
||
55 | ["owner_uuid", "in", ["1b7fr-j7d0g-fffffffffffffff", "1b7fr-tpzed-qmf60jo0vs4ecww"]]]' |
||
56 | |||
57 | Using curl |
||
58 | |||
59 | $ curl --get -H "Authorization: Bearer $ARVADOS_API_TOKEN" --data-urlencode filters='[["link_class", "=", "star"]]' https://c97qk.arvadosapi.com/arvados/v1/links |