FileManager.vue 2.6 KB
Newer Older
1
<template>
2
  <b-container>
3
4
5
6
    <show-selector
      title="Files &amp; playlists"
      :callback="showHasSwitched"
    />
7
    <hr>
8

9
    <jumbotron />
10

11
12
    <!-- All the UI for uploading and editing files is only shown if the user
    choose to edit files in the jumbotron above -->
13
    <div v-if="mode === 'files'">
14
      <files />
15
16
    </div>

17
18
    <!-- All the UI for creating and editing playlists is only shown if the user
    choose to edit playlists in the jumbotron above -->
19
    <div v-if="mode === 'playlists'">
20
      <playlists />
21
    </div>
22
  </b-container>
23
24
25
</template>

<script>
26
import { mapGetters } from 'vuex'
27
28
import showSelector from './ShowSelector.vue'
import jumbotron from './filemanager/Jumbotron.vue'
29
import files from './filemanager/Files.vue'
30
import playlists from './filemanager/Playlists.vue'
31
32

export default {
33
  components: {
34
35
    'show-selector': showSelector,
    'jumbotron': jumbotron,
36
    'files': files,
37
    'playlists': playlists,
38
39
  },

40
41
  // the data this component will be handling: mostly flags and local versions
  // of the data fetched from the AuRa tank API
42
43
  data () {
    return {
44
      // for formatting the buttons - this way we could customize it later
45
46
47
      button: {
        files: 'info',
        playlists: 'outline-info'
48
      },
49

50
51
    }
  },
52

53
54
55
  computed: {
    ...mapGetters({
      selectedShow: 'shows/selectedShow',
56
      mode: 'fileManagerMode'
57
58
59
    })
  },

60
61
62
63
  // Right after this component is set up, we want to fetch all available shows
  // from the AuRa tank module. This works quite similar to the ShowManager.
  // We also want to load the files and playlists as soon as the shows are
  // loaded.
64
  created () {
65
66
    this.$store.dispatch('shows/fetchShows', {
      callback: () => { this.showHasSwitched() }
67
68
    })
  },
69
70
71

  // Now for our hotchpotch of methods, mostly for fetching data from and
  // posting/updating data to the AuRa tank API
72
  methods: {
73
74
75

    // This switches the UI elements to reflect another show and fetches all
    // relevent data from the tank API.
76
77
78
79
    showHasSwitched () {
      this.$log.debug('show has switched to')
      this.$store.dispatch('files/fetchFiles', {
        slug: this.selectedShow.slug
80
      })
81
82
83
      this.$store.dispatch('playlists/fetch', {
        slug: this.selectedShow.slug
      })
84
    },
85

86
87
  }
}
88
89
90
</script>

<style>
91
92
93
94
95
div.filelistbox {
  border: 1px solid #e9ecef;
  border-radius: 0.3rem;
  padding: 1rem 2rem;
}
96
97
98
99
100
101
102
103
104
105
106
.stateNew {
  color: red;
  font-weight: bold;
}
.stateRunning {
  color: darkgreen;
}
.stateUndefined {
  color: orange;
  font-weight: bold;
}
107
108
109
110
111
112
.upDownArrows {
  font-size: 1.15rem;
}
.modalPlaylistRows {
  padding: 0.2rem 0;
}
113
</style>