Browse Source

Canceled movies are remove from the dashboard

dev
David Ludwig 4 years ago
parent
commit
d40d46eed4
2 changed files with 7 additions and 2 deletions
  1. +1
    -0
      services/webui/src/app/components/modals/MovieModal.vue
  2. +6
    -2
      services/webui/src/app/views/Dashboard.vue

+ 1
- 0
services/webui/src/app/components/modals/MovieModal.vue View File

@ -189,6 +189,7 @@ export default defineComponent({
} }
this.movie.ticketId = null; this.movie.ticketId = null;
this.movie.requestedBy = null; this.movie.requestedBy = null;
this.$emit("onCancel", this.movie);
}, },
async request() { async request() {
if (this.isRequesting || this.movie == null || this.movie.tmdbId == null) { if (this.isRequesting || this.movie == null || this.movie.tmdbId == null) {


+ 6
- 2
services/webui/src/app/views/Dashboard.vue View File

@ -3,11 +3,11 @@
<h1 class="">Active Requests</h1> <h1 class="">Active Requests</h1>
</div> </div>
<movie-list :movies="activeRequests" @onClickMovie="displayMovie"/> <movie-list :movies="activeRequests" @onClickMovie="displayMovie"/>
<movie-modal :tmdb-id="activeTmdb" @onClose="activeTmdb = undefined"/>
<movie-modal :tmdb-id="activeTmdb" @onClose="activeTmdb = undefined" @onCancel="removeMovieRequest"/>
</template> </template>
<script lang="ts"> <script lang="ts">
import type { IMovie } from "@autoplex-api/request";
import type { IMovie, IMovieDetails } from "@autoplex-api/request";
import { Status } from "@autoplex/restful"; import { Status } from "@autoplex/restful";
import { Action } from "../store"; import { Action } from "../store";
import { defineComponent } from "vue"; import { defineComponent } from "vue";
@ -29,6 +29,10 @@ export default defineComponent({
displayMovie(movie: IMovie, index: number) { displayMovie(movie: IMovie, index: number) {
this.activeTmdb = movie.tmdbId; this.activeTmdb = movie.tmdbId;
}, },
removeMovieRequest(movie: IMovieDetails) {
let index = this.activeRequests.findIndex(request => request.tmdbId == movie.tmdbId);
this.activeRequests.splice(index, 1);
},
async fetchRequests() { async fetchRequests() {
try { try {
let [status, response] = await this.$store.dispatch(Action.ActiveMovieRequests, undefined); let [status, response] = await this.$store.dispatch(Action.ActiveMovieRequests, undefined);


Loading…
Cancel
Save