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

ProtectionStatus.vue « components « src - github.com/undo-ransomware/ransomware_detection.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b2524caea1f77c0c6f46701fed583647afd1e0b2 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<template>
    <div class="container" v-bind:class="[protection && !detection? 'good' : 'bad']">
            <h1>
                <span v-if="protection && !detection"><iron-icon icon="ransomware:shield"></iron-icon> Your files are protected against destruction by ransomware.</span>
                <span v-if="!protection"><iron-icon icon="error"></iron-icon> Your files are not protected. One service is not working properly.</span>
                <span v-if="protection && detection"><iron-icon icon="ransomware:locked"></iron-icon> Ransomware attack detected.</span>
            </h1>
            <paper-button class="recover-button" @click="$router.push('recover')" v-if="protection && detection"><iron-icon icon="undo"></iron-icon>Recover</paper-button>
    </div>
</template>

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

export default {
    name: 'ProtectionStatus',
    props: {
        detectionLink: {
			type: String,
			default: '',
			required: true
		}
    },
    created() {
        this.fetchDetectionStatus();
    },
    data() {
        return {
            detection: 0,
            protection: 1
        };
    },
    methods: {
        fetchDetectionStatus() {
            axios({
				method: 'GET',
				url: this.detectionLink
            })
            .then(json => {
                this.detection = 0;
                if (json.data.length > 0) {
                    this.detection = 1;
                }
                this.$emit('protection-state-changed');
            })
            .catch( error => { console.error(error); });
        }
    }
}
</script>

<style lang="scss">
    .container {
        h1 {
            height: calc(100% - 52px);
            color: #fff;
            line-height: 48px;
            display: flex;
            align-items: center;
            font-size: 32px;
            iron-icon {
                width: 48px;
                height: 48px;
            }
            span {
                vertical-align: middle;
            }
            padding: 0px 10px 0px 30px;
        }

        width: 100%;
        height: 100%;
        box-shadow: none;
        color: #fff;
        padding: 0px 10px 0px 10px;
        &.good {
            background-color: #18b977;
        }
        &.bad {
            background-color: #e2523d;
        }
    }
    
    .recover-button {
        display: flex;
        border: 1px solid #fff;
        padding: 0.7em 0.57em;
    }

    .recover-button:hover {
        background-color: #fff;
        color: #c00;
    }
</style>