Refactor web #26
@ -5,32 +5,20 @@
|
|||||||
<table class="pure-table" >
|
<table class="pure-table" >
|
||||||
<tr>
|
<tr>
|
||||||
<th>profile</th>
|
<th>profile</th>
|
||||||
<td>
|
<td>{{ .dl.DownloadProfile.Name }}</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>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr><th>current filename</th><td x-text="filename"></td></tr>
|
<tr><th>current filename</th><td x-text="filename"></td></tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>destination</th>
|
<th>destination</th>
|
||||||
<td>
|
<td>
|
||||||
<select x-on:change="update_destination()" class="pure-input-1-2" x-model="destination_chosen">
|
{{ if .dl.Destination }} {{ .dl.Destination.Name }} {{ else }} leave in {{ .config.Server.DownloadPath }} {{ end }}
|
||||||
<option value="-">leave in {{ .config.Server.DownloadPath }}</option>
|
|
||||||
{{ range $i := .config.Destinations }}
|
|
||||||
<option>{{ $i.Name }}</option>
|
|
||||||
{{ end }}
|
|
||||||
</select>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><th>state</th><td x-text="state"></td></tr>
|
<tr><th>state</th><td x-text="state"></td></tr>
|
||||||
<tr x-show="playlist_total > 0"><th>playlist progress</th><td x-text="playlist_current + '/' + playlist_total"></td></tr>
|
<tr x-show="playlist_total > 0"><th>playlist progress</th><td x-text="playlist_current + '/' + playlist_total"></td></tr>
|
||||||
<tr><th>progress</th><td x-text="percent"></td></tr>
|
<tr><th>progress</th><td x-text="percent"></td></tr>
|
||||||
<tr><th>ETA</th><td x-text="eta"></td></tr>
|
<tr><th>ETA</th><td x-text="eta"></td></tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
<p>You can close this window and your download will continue. Check the <a href="/" target="_gropple_status">Status page</a> to see all downloads in progress.</p>
|
<p>You can close this window and your download will continue. Check the <a href="/" target="_gropple_status">Status page</a> to see all downloads in progress.</p>
|
||||||
{{ if .canStop }}
|
{{ if .canStop }}
|
||||||
@ -47,39 +35,9 @@
|
|||||||
<script>
|
<script>
|
||||||
function popup() {
|
function popup() {
|
||||||
history.replaceState(null, '', ['/fetch/{{ .dl.Id }}'])
|
history.replaceState(null, '', ['/fetch/{{ .dl.Id }}'])
|
||||||
return {
|
return {
|
||||||
eta: '', percent: 0.0, state: '??', filename: '', finished: false, log :'',
|
eta: '', percent: 0.0, state: '??', filename: '', finished: false, log :'',
|
||||||
playlist_current: 0, playlist_total: 0,
|
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() {
|
stop() {
|
||||||
let op = {
|
let op = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -101,13 +59,6 @@
|
|||||||
this.state = info.state;
|
this.state = info.state;
|
||||||
this.playlist_current = info.playlist_current;
|
this.playlist_current = info.playlist_current;
|
||||||
this.playlist_total = info.playlist_total;
|
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;
|
this.finished = info.finished;
|
||||||
if (info.files && info.files.length > 0) {
|
if (info.files && info.files.length > 0) {
|
||||||
this.filename = info.files[info.files.length - 1];
|
this.filename = info.files[info.files.length - 1];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user