view client/src/components/importoverview/Filters.vue @ 3802:e8a950cf6c02 yworks-svg2pdf

Move Template loading and Imageprocessing to mixin Rationale: 1) Template loading is a process used by many components. As such it makes sense to parametrize the URL and centralize loading. 2) Imageprocessing has to be done after each template is loaded on the client As such it makes sense to centralize that. To make handling easier, each (1) and (2) is in an independend Promise to make chaining of calls easier to read.
author Thomas Junk <thomas.junk@intevation.de>
date Thu, 04 Jul 2019 10:57:43 +0200
parents 3473f3b72e21
children
line wrap: on
line source

<template>
  <div>
    <button
      @click="setFilter('pending')"
      :class="'mr-1 btn btn-xs btn-' + (this.pending ? 'secondary' : 'light')"
    >
      <translate>pending</translate>
    </button>
    <button
      @click="setFilter('failed')"
      :class="'mr-1 btn btn-xs btn-' + (this.failed ? 'secondary' : 'light')"
    >
      <translate>failed</translate>
    </button>
    <button
      @click="setFilter('accepted')"
      :class="'mr-1 btn btn-xs btn-' + (this.accepted ? 'secondary' : 'light')"
    >
      <translate>accepted</translate>
    </button>
    <button
      @click="setFilter('declined')"
      :class="'mr-1 btn btn-xs btn-' + (this.declined ? 'secondary' : 'light')"
    >
      <translate>declined</translate>
    </button>
    <button
      @click="setFilter('warning')"
      :class="'btn btn-xs btn-' + (this.warning ? 'secondary' : 'light')"
    >
      <translate>warning</translate>
    </button>
  </div>
</template>

<script>
/* This is Free Software under GNU Affero General Public License v >= 3.0
 * without warranty, see README.md and license for details.
 *
 * SPDX-License-Identifier: AGPL-3.0-or-later
 * License-Filename: LICENSES/AGPL-3.0.txt
 *
 * Copyright (C) 2018 by via donau
 *   – Österreichische Wasserstraßen-Gesellschaft mbH
 * Software engineering by Intevation GmbH
 *
 * Author(s):
 * Thomas Junk <thomas.junk@intevation.de>
 */
import { mapState } from "vuex";

export default {
  name: "importfilters",
  methods: {
    setFilter(name) {
      if (this.loading) return;
      this.$store.commit("imports/toggleFilter", name);
    }
  },
  computed: {
    ...mapState("imports", [
      "pending",
      "failed",
      "accepted",
      "warning",
      "declined"
    ])
  }
};
</script>