<template>
  <div>
    <gz-data-table
      form-key="adm-history"
      data-list-key="EventDataList"
      :show-select="false"
      :single-select="false"
      :reload="reload"
      @selection-change="handleSelected"
      data-cy="historyTable"
    >
    </gz-data-table>
  </div>
</template>

<script>
const FORM_KEY = "adm-history";
export default {
  async created() {
    this.rights = window.$gz.role.getRights(window.$gz.type.Global);
    window.$gz.eventBus.$on("menu-click", clickHandler);
    generateMenu(this);
  },
  beforeDestroy() {
    window.$gz.eventBus.$off("menu-click", clickHandler);
  },
  data() {
    return {
      uploadFiles: [],
      rights: window.$gz.role.defaultRightsObject(),
      reload: false,
      uploading: false
    };
  },
  methods: {
    handleSelected(selectedItems) {}
  }
};
/////////////////////////////
//
//
function clickHandler(menuItem) {
  if (!menuItem) {
    return;
  }
  const m = window.$gz.menu.parseMenuItem(menuItem);
  if (m.owner == FORM_KEY && !m.disabled) {
    switch (m.key) {
      default:
        window.$gz.eventBus.$emit(
          "notify-warning",
          FORM_KEY + "::context click: [" + m.key + "]"
        );
    }
  }
}
//////////////////////
//
//
function generateMenu(vm) {
  const menuOptions = {
    isMain: true,
    icon: "$ayiHistory",
    title: "History",
    helpUrl: "adm-history",
    hideSearch: true,
    menuItems: []
  };

  window.$gz.eventBus.$emit("menu-change", menuOptions);
}
</script>
