Verified Commit 3c263a26 authored by Grégor JOUET's avatar Grégor JOUET 🔧
Browse files

Show cancel option on queue

parent cc0704c0
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -102,7 +102,8 @@ def get_queue_elements_list(qid):
    for ql in PrintRequest.select().join(QueueElement).where((QueueElement.queue == qid and QueueElement.state == QUEUE_ELEMENT_STATE_INQUEUE)).order_by(QueueElement.id):
       elems.append({
            "id": ql.id,
            "author": ql.author.username,
            "author": ql.author.fullname,
            "username": ql.author.username,
            "title": ql.title
        })
    return elems
+22 −2
Original line number Diff line number Diff line
@@ -27,7 +27,15 @@
              <v-card-subtitle align="left">
                Printers: 
                <div v-for="printer in item.printers" :key="printer">
                  <div>{{ printer.name }}</div>
                  <div>- {{ printer.name }}</div>
                </div>
              </v-card-subtitle>
              <v-card-subtitle align="left">
                In Queue: 
                <div v-for="elem in item.elements" :key="elem.id">
                  <div><v-icon>mdi-folder-cog</v-icon> {{ elem.title }} <v-icon>mdi-account</v-icon> {{ elem.author }}
                  <v-btn @click="dequeue(elem.id)"><v-icon color="red">mdi-close-octagon</v-icon></v-btn>
                  </div>
                </div>
              </v-card-subtitle>
            </v-card>
@@ -67,6 +75,15 @@ export default {
            this.$stire.dispatch("display_error", err)
        })
      },
      dequeue(id) {
        axios.get("/requests/" + id + "/dequeue")
        .then((resp) => {
          this.reload()
        }).catch((error) => {
          console.log("[DEBUG] Could not dequue, ignoring")
          this.reload()
        })
      },
      alert_type(item) {
        return item.enabled? 'info':'error'
      },
@@ -102,9 +119,12 @@ export default {
          })
      }
    },
    mounted() {
    reload() {
      this.$store.dispatch("load_queues")
    },
    mounted() {
      this.reload()
    },
    computed: {
        queues() {
            return this.$store.state.queues