Sha256: aee247f0a8400d7384064581ac2bc9e88fec4861bb6e96c2891522fcadb4258d

Contents?: true

Size: 1.36 KB

Versions: 4

Compression:

Stored size: 1.36 KB

Contents

<template>
  <Alert
    v-for="(alert, index) in alerts.alerts"
    :alert="alert"
    :key="index"
    @refresh-page="refreshPage"
    @update-tag="updateTag"
  ></Alert>
  <Pagination
    :total="alerts.total"
    :currentPage="alerts.currentPage"
    :pageSize="alerts.pageSize"
    @update-page="updatePage"
  ></Pagination>
  <p class="help">({{ alerts.total }} results in total, {{ alerts.alerts.length }} shown)</p>
</template>

<script lang="ts">
import { defineComponent, type PropType } from "vue"

import Alert from "@/components/alert/Alert.vue"
import Pagination from "@/components/Pagination.vue"
import type { Alerts } from "@/types"

export default defineComponent({
  name: "AlertsItem",
  components: {
    Alert,
    Pagination
  },
  props: {
    alerts: {
      type: Object as PropType<Alerts>,
      required: true
    }
  },
  emits: ["update-page", "refresh-page", "update-tag"],
  setup(_, context) {
    const scrollToTop = () => {
      window.scrollTo({
        top: 0
      })
    }

    const updatePage = (page: number) => {
      scrollToTop()
      context.emit("update-page", page)
    }

    const refreshPage = () => {
      scrollToTop()
      context.emit("refresh-page")
    }

    const updateTag = (tag: string) => {
      scrollToTop()
      context.emit("update-tag", tag)
    }

    return { updatePage, updateTag, refreshPage }
  }
})
</script>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mihari-5.7.0 frontend/src/components/alert/Alerts.vue
mihari-5.6.2 frontend/src/components/alert/Alerts.vue
mihari-5.6.1 frontend/src/components/alert/Alerts.vue
mihari-5.6.0 frontend/src/components/alert/Alerts.vue