<commit_before><!--右上角的通知-->
<style rel="styleesheet" lang="scss">
    .index-component__right-notification {
        .header {
            cursor: pointer;
            &:hover {
                background: #f8f8f8;
            }
        }
        .notification-item {
            &.notification-item_reded {
                h4 {
                    color: #999 !important;
                }
            }
            h4 {
                font-size: 14px !important;
                margin-bottom: 3px !important;
            }

        }
    }
</style>

<template>
    <li class="index-component__right-notification">
        <a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" role="button">
            <i class="material-icons">notifications</i>
            <span class="label-count">{{notRead}}</span>
        </a>
        <ul class="dropdown-menu">
            <li class="header" @click.stop="setAllReaded">
                {{L('SetAllAsRead')}}
            </li>
            <li class="body">
                <ul class="menu">
                    <li v-for="item in data" :key="item.id" class="notification-item"
                        :class="{'notification-item_reded': item.state == 1}">
                        <a href="javascript:void(0);">
                            <div class="icon-circle" :class="{'bg-light-green': item.notification.severity == 1, 'bg-orange':item.notification.severity == 2,
                            'bg-purple':item.notification.severity == 4, 'bg-blue-grey':item.notification.severity == 0, 'bg-red':item.notification.severity == 3}">
                                <!--info-->
                                <i class="material-icons" v-if="item.notification.severity == 0">info</i>
                                <!--success-->
                                <i class="material-icons" v-if="item.notification.severity == 1">done</i>
                                <!--warn-->
                                <i class="material-icons" v-if="item.notification.severity == 2">warning</i>
                                <!--error-->
                                <i class="material-icons" v-if="item.notification.severity == 3">cancel</i>
                                <!--fatal-->
                                <i class="material-icons" v-if="item.notification.severity == 4">do_not_disturb_on</i>
                            </div>
                            <div class="menu-info">
                                <h4>{{item.notification.data.message}}</h4>
                                <p>
                                    <i class="material-icons">access_time</i>
                                    {{item.notification.creationTime | date2calendar}}

                                    <el-button @click.stop="setReaded(item)" v-if="item.state == 0" type="text"
                                               style="font-size: 12px" size="tiny">
                                        {{L('SetAsRead')}}
                                    </el-button>
                                </p>
                            </div>
                        </a>
                    </li>
                </ul>
            </li>
            <li class="footer">
                <a href="javascript:void(0);">View All Notifications</a>
            </li>
        </ul>
    </li>
</template>

<script>
    import notificationService from '../../services/administration/notificationService'
    export default {
        data() {
            return {
                data: this.$store.state.index.notifications,
                notRead: this.$store.state.index.unReadNotification, // 未读数量
            }
        },
        watch: {
            '$store.state.index.notifications'(val) {
                this.data = val
                this.$nextTick(() => {
                    window.initAdminJs && window.initAdminJs()
                })
            },
            '$store.state.index.unReadNotification'(val) {
                this.notRead = val
            }
        },
        async created() {<commit_msg>修复重复初始化的bug<commit_after><!--右上角的通知-->
<style rel="styleesheet" lang="scss">
    .index-component__right-notification {
        .header {
            cursor: pointer;
            &:hover {
                background: #f8f8f8;
            }
        }
        .notification-item {
            &.notification-item_reded {
                h4 {
                    color: #999 !important;
                }
            }
            h4 {
                font-size: 14px !important;
                margin-bottom: 3px !important;
            }

        }
    }
</style>

<template>
    <li class="index-component__right-notification">
        <a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" role="button">
            <i class="material-icons">notifications</i>
            <span class="label-count">{{notRead}}</span>
        </a>
        <ul class="dropdown-menu">
            <li class="header" @click.stop="setAllReaded">
                {{L('SetAllAsRead')}}
            </li>
            <li class="body">
                <ul class="menu">
                    <li v-for="item in data" :key="item.id" class="notification-item"
                        :class="{'notification-item_reded': item.state == 1}">
                        <a href="javascript:void(0);">
                            <div class="icon-circle" :class="{'bg-light-green': item.notification.severity == 1, 'bg-orange':item.notification.severity == 2,
                            'bg-purple':item.notification.severity == 4, 'bg-blue-grey':item.notification.severity == 0, 'bg-red':item.notification.severity == 3}">
                                <!--info-->
                                <i class="material-icons" v-if="item.notification.severity == 0">info</i>
                                <!--success-->
                                <i class="material-icons" v-if="item.notification.severity == 1">done</i>
                                <!--warn-->
                                <i class="material-icons" v-if="item.notification.severity == 2">warning</i>
                                <!--error-->
                                <i class="material-icons" v-if="item.notification.severity == 3">cancel</i>
                                <!--fatal-->
                                <i class="material-icons" v-if="item.notification.severity == 4">do_not_disturb_on</i>
                            </div>
                            <div class="menu-info">
                                <h4>{{item.notification.data.message}}</h4>
                                <p>
                                    <i class="material-icons">access_time</i>
                                    {{item.notification.creationTime | date2calendar}}

                                    <el-button @click.stop="setReaded(item)" v-if="item.state == 0" type="text"
                                               style="font-size: 12px" size="tiny">
                                        {{L('SetAsRead')}}
                                    </el-button>
                                </p>
                            </div>
                        </a>
                    </li>
                </ul>
            </li>
            <li class="footer">
                <a href="javascript:void(0);">View All Notifications</a>
            </li>
        </ul>
    </li>
</template>

<script>
    import notificationService from '../../services/administration/notificationService'
    export default {
        data() {
            return {
                data: this.$store.state.index.notifications,
                notRead: this.$store.state.index.unReadNotification, // 未读数量
            }
        },
        watch: {
            '$store.state.index.notifications'(val) {
                this.data = val
                this.$nextTick(() => {
//                    window.initAdminJs && window.initAdminJs()
                    $.AdminBSB && $.AdminBSB.dropdownMenu && $.AdminBSB.dropdownMenu.activate()
                })
            },
            '$store.state.index.unReadNotification'(val) {
                this.notRead = val
            }
        },
        async created() {
{'fraction_non_alphanumeric': 0.1421485603677716, 'fraction_numerical': 0.007500604887490926, 'mean_word_length': 1.1350723140495869, 'pattern_counts': {'":': 0, '<': 117, '<?xml version=': 0, '>': 119, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2146979', 'n_tokens_mistral': 2212, 'n_tokens_neox': 2067, 'n_words': 321}