1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
<script>
import {
EVENT_CREATED_I18N,
TARGET_TYPE_DESIGN,
TYPE_FALLBACK,
} from 'ee_else_ce/contribution_events/constants';
import { getValueByEventTarget } from '../../utils';
import ContributionEventBase from './contribution_event_base.vue';
export default {
name: 'ContributionEventCreated',
components: { ContributionEventBase },
props: {
event: {
type: Object,
required: true,
},
},
computed: {
target() {
return this.event.target;
},
resourceParent() {
return this.event.resource_parent;
},
message() {
if (!this.target.type) {
return EVENT_CREATED_I18N[this.resourceParent.type] || EVENT_CREATED_I18N[TYPE_FALLBACK];
}
return getValueByEventTarget(EVENT_CREATED_I18N, this.event);
},
iconName() {
switch (this.target?.type) {
case TARGET_TYPE_DESIGN:
return 'upload';
default:
return 'status_open';
}
},
iconClass() {
switch (this.target?.type) {
case TARGET_TYPE_DESIGN:
return null;
default:
return 'gl-text-green-500';
}
},
},
};
</script>
<template>
<contribution-event-base
:event="event"
:message="message"
:icon-name="iconName"
:icon-class="iconClass"
/>
</template>
|