mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 09:22:31 -06:00
more precise volume state in admin panel
This commit is contained in:
parent
271096874a
commit
e5f34042f9
|
@ -1311,20 +1311,23 @@ class HttpCli(object):
|
||||||
|
|
||||||
def tx_mounts(self):
|
def tx_mounts(self):
|
||||||
suf = self.urlq(rm=["h"])
|
suf = self.urlq(rm=["h"])
|
||||||
rvol = [x + "/" if x else x for x in self.rvol]
|
rvol, wvol, avol = [
|
||||||
wvol = [x + "/" if x else x for x in self.wvol]
|
[("/" + x).rstrip("/") + "/" for x in y]
|
||||||
|
for y in [self.rvol, self.wvol, self.avol]
|
||||||
|
]
|
||||||
|
|
||||||
vstate = {}
|
vstate = {}
|
||||||
if self.avol and not self.args.no_rescan:
|
if self.avol and not self.args.no_rescan:
|
||||||
x = self.conn.hsrv.broker.put(True, "up2k.get_volstate")
|
x = self.conn.hsrv.broker.put(True, "up2k.get_volstate")
|
||||||
vstate = json.loads(x.get())
|
vstate = json.loads(x.get())
|
||||||
|
vstate = {("/" + k).rstrip("/") + "/": v for k, v in vstate.items()}
|
||||||
|
|
||||||
html = self.j2(
|
html = self.j2(
|
||||||
"splash",
|
"splash",
|
||||||
this=self,
|
this=self,
|
||||||
rvol=rvol,
|
rvol=rvol,
|
||||||
wvol=wvol,
|
wvol=wvol,
|
||||||
avol=self.avol,
|
avol=avol,
|
||||||
vstate=vstate,
|
vstate=vstate,
|
||||||
url_suf=suf,
|
url_suf=suf,
|
||||||
)
|
)
|
||||||
|
|
|
@ -181,17 +181,20 @@ class Up2k(object):
|
||||||
for vol in vols:
|
for vol in vols:
|
||||||
try:
|
try:
|
||||||
os.listdir(vol.realpath)
|
os.listdir(vol.realpath)
|
||||||
if not self.register_vpath(vol.realpath, vol.flags):
|
|
||||||
raise Exception()
|
|
||||||
|
|
||||||
if vol.vpath in scan_vols or not scan_vols:
|
|
||||||
live_vols.append(vol)
|
|
||||||
|
|
||||||
if vol.vpath not in self.volstate:
|
|
||||||
self.volstate[vol.vpath] = "OFFLINE (not initialized)"
|
|
||||||
except:
|
except:
|
||||||
|
self.volstate[vol.vpath] = "OFFLINE (cannot access folder)"
|
||||||
|
self.log("cannot access " + vol.realpath, c=1)
|
||||||
|
continue
|
||||||
|
|
||||||
|
if not self.register_vpath(vol.realpath, vol.flags):
|
||||||
# self.log("db not enabled for {}".format(m, vol.realpath))
|
# self.log("db not enabled for {}".format(m, vol.realpath))
|
||||||
pass
|
continue
|
||||||
|
|
||||||
|
if vol.vpath in scan_vols or not scan_vols:
|
||||||
|
live_vols.append(vol)
|
||||||
|
|
||||||
|
if vol.vpath not in self.volstate:
|
||||||
|
self.volstate[vol.vpath] = "OFFLINE (pending initialization)"
|
||||||
|
|
||||||
vols = live_vols
|
vols = live_vols
|
||||||
need_vac = {}
|
need_vac = {}
|
||||||
|
@ -585,7 +588,8 @@ class Up2k(object):
|
||||||
|
|
||||||
del self.pp
|
del self.pp
|
||||||
for k in list(self.volstate.keys()):
|
for k in list(self.volstate.keys()):
|
||||||
self.volstate[k] = "online, idle"
|
if "OFFLINE" not in self.volstate[k]:
|
||||||
|
self.volstate[k] = "online, idle"
|
||||||
|
|
||||||
def _run_one_mtp(self, ptop):
|
def _run_one_mtp(self, ptop):
|
||||||
entags = self.entags[ptop]
|
entags = self.entags[ptop]
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for mp in avol %}
|
{% for mp in avol %}
|
||||||
{%- if mp in vstate and vstate[mp] %}
|
{%- if mp in vstate and vstate[mp] %}
|
||||||
<tr><td>/{{ mp }}</td><td><a href="/{{ mp }}?scan">rescan</a></td><td>{{ vstate[mp] }}</td></tr>
|
<tr><td><a href="{{ mp }}{{ url_suf }}">{{ mp }}</a></td><td><a href="{{ mp }}?scan">rescan</a></td><td>{{ vstate[mp] }}</td></tr>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div class="btns">
|
<div class="btns">
|
||||||
<a href="/{{ avol[0] }}?stack">dump stack</a>
|
<a href="{{ avol[0] }}?stack">dump stack</a>
|
||||||
</div>
|
</div>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
<h1>you can browse these:</h1>
|
<h1>you can browse these:</h1>
|
||||||
<ul>
|
<ul>
|
||||||
{% for mp in rvol %}
|
{% for mp in rvol %}
|
||||||
<li><a href="/{{ mp }}{{ url_suf }}">/{{ mp }}</a></li>
|
<li><a href="{{ mp }}{{ url_suf }}">{{ mp }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
<h1>you can upload to:</h1>
|
<h1>you can upload to:</h1>
|
||||||
<ul>
|
<ul>
|
||||||
{% for mp in wvol %}
|
{% for mp in wvol %}
|
||||||
<li><a href="/{{ mp }}{{ url_suf }}">/{{ mp }}</a></li>
|
<li><a href="{{ mp }}{{ url_suf }}">{{ mp }}</a></li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
Loading…
Reference in a new issue