forked from cloudforet-io/console
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAlertDetailInfoTableDescription.vue
82 lines (78 loc) · 2.26 KB
/
AlertDetailInfoTableDescription.vue
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<script setup lang="ts">
import {
PTextarea, PButton, PTextBeautifier, PCollapsiblePanel,
} from '@cloudforet/mirinae';
import { useAlertInfoItem } from '@/services/alert-manager/v1/composables/alert-info';
import { EDIT_MODE } from '@/services/alert-manager/v1/constants/alert-constant';
const props = defineProps<{
id?: string;
alertData?: Record<string, any>;
manageDisabled?: boolean;
}>();
const {
state: alertDetailItemState,
cancelEdit,
startEdit,
onClickSave,
} = useAlertInfoItem({
alertId: props.id ?? '',
isEditMode: false,
dataForUpdate: props.alertData?.description,
});
</script>
<template>
<p v-if="!alertDetailItemState.isEditMode"
class="content-wrapper"
>
<p-collapsible-panel :line-clamp="10">
<p-text-beautifier class="description"
:value="props.alertData.description"
/>‌
</p-collapsible-panel>
<p-button style-type="tertiary"
size="sm"
:disabled="props.manageDisabled"
@click="startEdit(props.alertData.description)"
>
{{ $t('IDENTITY.USER.NOTIFICATION.EDIT') }}
</p-button>
</p>
<div v-else
class="content-wrapper"
>
<p-textarea v-model="alertDetailItemState.dataForUpdate"
class="textarea"
/>
<div class="button-group">
<p-button style-type="secondary"
class="text-button mr-2"
size="sm"
@click="cancelEdit(props.alertData.description)"
>
{{ $t('MONITORING.ALERT.DETAIL.INFO.CANCEL') }}
</p-button>
<p-button
style-type="primary"
size="sm"
class="text-button"
@click="onClickSave(EDIT_MODE.DESCRIPTION)"
>
{{ $t('MONITORING.ALERT.DETAIL.INFO.SAVE_CHANGES') }}
</p-button>
</div>
</div>
</template>
<style lang="postcss" scoped>
@import './styles/alertInfoItem.pcss';
.p-collapsible-panel {
padding: 0;
margin-right: 0.5rem;
line-height: 1.5;
}
.description {
white-space: pre-line;
}
.textarea {
min-height: 15rem;
}
</style>