{$layout}
{$template "menu"}

<p class="ui message" v-if="autoDeleted">已自动删除没有关联对象的事件。</p>

<b-empty v-if="logs.length == 0">暂时还没有事件。</b-empty>

<second-menu v-if="logs.length > 0">
    <a href="" class="item" @click.prevent="updatePageRead()">[本页已读]</a>
    <a href="" class="item" @click.prevent="updateAllRead()">[全部已读]</a>
</second-menu>

<table class="ui table selectable celled" v-if="logs.length > 0">
    <thead>
    <tr>
        <th nowrap="">节点类型</th>
        <th nowrap="">集群</th>
        <th nowrap="">节点</th>
        <th>信息</th>
        <th class="one op">操作</th>
    </tr>
    </thead>
    <tr v-for="log in logs">
        <td>
            <node-role-name :v-role="log.role"></node-role-name>
        </td>
        <td nowrap="">
            <span v-if="log.role == 'node'">
                <link-icon :href="'/clusters/cluster?clusterId=' + log.node.cluster.id">{{log.node.cluster.name}}</link-icon>
            </span>
            <span v-else-if="log.role == 'dns'">
                <link-icon :href="'/ns/clusters/cluster?clusterId=' + log.node.cluster.id">{{log.node.cluster.name}}</link-icon>
            </span>
            <span v-else class="disabled">-</span>
        </td>
        <td nowrap="">
            <span v-if="log.role == 'node'">
                <link-icon :href="'/clusters/cluster/node?clusterId=' + log.node.cluster.id + '&nodeId=' + log.node.id">{{log.node.name}}</link-icon>
            </span>
            <span v-if="log.role == 'api'">
                <link-icon :href="'/settings/api/node?nodeId=' + log.node.id">{{log.node.name}}</link-icon>
            </span>
            <span v-if="log.role == 'dns'">
                <link-icon :href="'/ns/clusters/cluster/node?clusterId=' + log.node.cluster.id + '&nodeId=' + log.node.id">{{log.node.name}}</link-icon>
            </span>
            <span v-if="log.role == 'database'">
                <link-icon :href="'/settings/db/node?nodeId=' + log.node.id">{{log.node.name}}</link-icon>
            </span>
            <span v-if="log.role == 'admin'">管理平台</span>
            <span v-if="log.role == 'user'">
                <link-icon :href="'/settings/userNodes/node?nodeId=' + log.node.id">{{log.node.name}}</link-icon>
            </span>
            <span v-if="log.role == 'monitor'">
                <link-icon :href="'/settings/monitorNodes/node?nodeId=' + log.node.id">{{log.node.name}}</link-icon>
            </span>
            <span v-if="log.role == 'report'">
                <link-icon :href="'/clusters/monitors/reporters/reporter?reporterId=' + log.node.id">{{log.node.name}}</link-icon>
            </span>
        </td>
        <td>
            <node-log-row :v-log="log" :v-keyword="keyword"></node-log-row>
        </td>
        <td>
            <a href="" @click.prevent="updateRead(log.id)">已读</a>
        </td>
    </tr>
</table>

<div class="page" v-html="filterPageContent(page)" v-if="logs.length > 0"></div>