Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Action.vue « components « src - github.com/undo-ransomware/ransomware_detection.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2cf87660fa4c0de20ffef259dd99aa699df28e6d (plain)
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
<template>
	<button class="action-button pull-right"
		:data-type="type" :data-href="link" @click="onClickActionButton">
		<iron-icon icon="undo"></iron-icon> {{ label }}
	</button>
</template>

<script>
import axios from 'nextcloud-axios'
import '@polymer/iron-icon/iron-icon.js';
import '@polymer/iron-icons/iron-icons.js';

export default {
	name: 'Action',

	props: {
		label: {
			type: String,
			default: '',
			required: true
		},
		link: {
			type: String,
			default: '',
			required: true
		},
		type: {
			type: String,
			default: '',
			required: true
		},
		data: {
			type: Object,
			default: {},
			required: false
		}
	},

	methods: {
		onClickActionButton: function() {
			axios({
				method: this.type || 'GET',
				url: this.link
			})
				.then(() => {
					this.$parent._$el.fadeOut(OC.menuSpeed)
					this.$parent.$emit('remove')
					$('body').trigger(new $.Event('OCA.Notification.Action', {
						notification: this.$parent,
						action: {
							url: this.link,
							type: this.type || 'GET'
						}
					}))
				})
				.catch(() => {
					OC.Notification.showTemporary(t('notifications', 'Failed to perform action'))
				});
		}
	}
}
</script>