Refactor web #26
@ -5,25 +5,13 @@
|
||||
<table class="pure-table" >
|
||||
<tr>
|
||||
<th>profile</th>
|
||||
<td>
|
||||
<select x-bind:disabled="profile_chosen" x-on:change="update_profile()" class="pure-input-1-2" x-model="profile_chosen">
|
||||
<option value="">choose a profile to start</option>
|
||||
{{ range $i := .config.DownloadProfiles }}
|
||||
<option>{{ $i.Name }}</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
</td>
|
||||
<td>{{ .dl.DownloadProfile.Name }}</td>
|
||||
</tr>
|
||||
<tr><th>current filename</th><td x-text="filename"></td></tr>
|
||||
<tr>
|
||||
<th>destination</th>
|
||||
<td>
|
||||
<select x-on:change="update_destination()" class="pure-input-1-2" x-model="destination_chosen">
|
||||
<option value="-">leave in {{ .config.Server.DownloadPath }}</option>
|
||||
{{ range $i := .config.Destinations }}
|
||||
<option>{{ $i.Name }}</option>
|
||||
{{ end }}
|
||||
</select>
|
||||
{{ if .dl.Destination }} {{ .dl.Destination.Name }} {{ else }} leave in {{ .config.Server.DownloadPath }} {{ end }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr><th>state</th><td x-text="state"></td></tr>
|
||||
@ -50,36 +38,6 @@
|
||||
return {
|
||||
eta: '', percent: 0.0, state: '??', filename: '', finished: false, log :'',
|
||||
playlist_current: 0, playlist_total: 0,
|
||||
profile_chosen: null,
|
||||
destination_chosen: null,
|
||||
watch_profile() {
|
||||
this.$watch('profile_chosen', value => this.profile_chosen(value))
|
||||
},
|
||||
update_profile(name) {
|
||||
console.log('you chose name', this.profile_chosen);
|
||||
let op = {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({action: 'start', profile: this.profile_chosen}),
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
};
|
||||
fetch('/rest/fetch/{{ .dl.Id }}', op)
|
||||
.then(response => response.json())
|
||||
.then(info => {
|
||||
console.log(info)
|
||||
})
|
||||
},
|
||||
update_destination(name) {
|
||||
let op = {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({action: 'change_destination', destination: this.destination_chosen}),
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
};
|
||||
fetch('/rest/fetch/{{ .dl.Id }}', op)
|
||||
.then(response => response.json())
|
||||
.then(info => {
|
||||
console.log(info)
|
||||
})
|
||||
},
|
||||
stop() {
|
||||
let op = {
|
||||
method: 'POST',
|
||||
@ -101,13 +59,6 @@
|
||||
this.state = info.state;
|
||||
this.playlist_current = info.playlist_current;
|
||||
this.playlist_total = info.playlist_total;
|
||||
this.destination_chosen = null;
|
||||
if (info.destination) {
|
||||
this.destination_chosen = info.destination.name;
|
||||
}
|
||||
if (this.state != 'Choose Profile') {
|
||||
this.profile_chosen = true;
|
||||
}
|
||||
this.finished = info.finished;
|
||||
if (info.files && info.files.length > 0) {
|
||||
this.filename = info.files[info.files.length - 1];
|
||||
|
Loading…
x
Reference in New Issue
Block a user