@datagouv/components-next 1.4.1-dev.1384.gab4fb984 → 1.4.1-dev.1386.g127f07d3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datagouv/components-next",
3
- "version": "1.4.1-dev.1384.gab4fb984",
3
+ "version": "1.4.1-dev.1386.g127f07d3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "engines": {
@@ -5,6 +5,28 @@
5
5
  :size
6
6
  :with-link
7
7
  />
8
+ <!-- What follows the owner is plain text rather than part of a flex box, so that a
9
+ long key or application name wraps with the sentence it belongs to. -->
10
+ <span v-else-if="actor.class === 'ApiToken'">
11
+ <AvatarWithName
12
+ :user="actor.owner"
13
+ :size
14
+ :with-link
15
+ class="mr-1 align-middle"
16
+ />
17
+ <span class="text-gray-medium">
18
+ {{ actor.name ? t('via la clé d\'API « {name} »', { name: actor.name }) : t('via une clé d\'API') }}
19
+ </span>
20
+ </span>
21
+ <span v-else-if="actor.class === 'OAuth2Token'">
22
+ <AvatarWithName
23
+ :user="actor.owner"
24
+ :size
25
+ :with-link
26
+ class="mr-1 align-middle"
27
+ />
28
+ <span class="text-gray-medium">{{ t('via {name}', { name: actor.client.name }) }}</span>
29
+ </span>
8
30
  <span
9
31
  v-else
10
32
  class="inline-flex items-center space-x-1"
@@ -18,12 +40,20 @@
18
40
  aria-hidden="true"
19
41
  />
20
42
  </span>
21
- <span class="truncate font-bold">{{ actor.name }}</span>
43
+ <span
44
+ v-if="actor.name"
45
+ class="truncate font-bold"
46
+ >{{ actor.name }}</span>
47
+ <span
48
+ v-else
49
+ class="rounded bg-gray-some px-1.5 py-0.5 text-[11px] leading-5 text-gray-medium"
50
+ >{{ t('Moissonnage supprimé') }}</span>
22
51
  </span>
23
52
  </template>
24
53
 
25
54
  <script setup lang="ts">
26
55
  import { RiRobot2Line } from '@remixicon/vue'
56
+ import { useTranslation } from '../../composables/useTranslation'
27
57
  import type { ActivityActor } from '../../types/activity'
28
58
  import AvatarWithName from '../AvatarWithName.vue'
29
59
 
@@ -35,4 +65,6 @@ withDefaults(defineProps<{
35
65
  size: 12,
36
66
  withLink: true,
37
67
  })
68
+
69
+ const { t } = useTranslation()
38
70
  </script>
@@ -9,13 +9,31 @@ export type ActivityKey = 'dataset:created' | 'dataset:updated' | 'dataset:delet
9
9
  | 'user:followed' | 'topic:created' | 'topic:updated'
10
10
 
11
11
  /**
12
- * Who an action is attributed to. Not necessarily a person: harvesting and API tokens
13
- * act on their own behalf. `class` is the discriminator every API reference carries.
12
+ * Who an action is attributed to. Not necessarily a person: harvesting acts on its own
13
+ * behalf, an API token or an application's OAuth2 token on behalf of its owner. `class`
14
+ * is the discriminator every API reference carries.
14
15
  */
15
16
  export type ActivityActor
16
17
  = | UserReference
17
- | { class: 'HarvestSource', id: string, name: string }
18
- | { class: 'ApiToken', id: string, name: string }
18
+ | {
19
+ class: 'HarvestSource'
20
+ id: string
21
+ /** Null once the source has been purged. */
22
+ name: string | null
23
+ }
24
+ | {
25
+ class: 'ApiToken'
26
+ id: string
27
+ owner: UserReference
28
+ /** Only sent to the token owner and to sysadmins; a token may also have no name. */
29
+ name: string | null
30
+ }
31
+ | {
32
+ class: 'OAuth2Token'
33
+ id: string
34
+ owner: UserReference
35
+ client: { class: 'OAuth2Client', id: string, name: string }
36
+ }
19
37
 
20
38
  export type ActivityExtras = {
21
39
  /** Set on the `dataset:resource:*` keys. */
@@ -1,7 +1,7 @@
1
1
  import type { Owned, OwnedWithId } from './owned'
2
2
  import type { Dataset, Rel } from './datasets'
3
3
  import type { Badges } from './badges'
4
- import type { Dataservice } from './dataservices'
4
+ import type { DataserviceReference } from './dataservices'
5
5
 
6
6
  export type ReuseReference = {
7
7
  class: 'Reuse'
@@ -29,7 +29,7 @@ export type Reuse = BaseReuse & {
29
29
  badges: Badges
30
30
  created_at: string
31
31
  datasets: Array<Dataset>
32
- dataservices: Array<Dataservice>
32
+ dataservices: Array<DataserviceReference>
33
33
  archived: string | null
34
34
  deleted: string | null
35
35
  extras: Record<string, unknown>