pull/1009/head
Piero Toffanin 2021-07-01 20:11:33 -04:00
rodzic f58e0b2acc
commit a79c61bfa7
7 zmienionych plików z 27 dodań i 12 usunięć

Wyświetl plik

@ -149,7 +149,9 @@ class PluginAdmin(admin.ModelAdmin):
def plugin_disable(self, request, plugin_name, *args, **kwargs):
try:
disable_plugin(plugin_name)
p = disable_plugin(plugin_name)
if p.requires_restart():
messages.warning(request, _("Restart required. Please restart WebODM to fully disable %(plugin)s") % {'plugin': plugin_name})
except Exception as e:
messages.warning(request, _("Cannot disable plugin %(plugin)s: %(message)s") % {'plugin': plugin_name, 'message': str(e)})

Wyświetl plik

@ -328,7 +328,9 @@ def enable_plugin(plugin_name):
return p
def disable_plugin(plugin_name):
p = get_plugin_by_name(plugin_name, only_active=False)
Plugin.objects.get(pk=plugin_name).disable()
return p
def delete_plugin(plugin_name):
Plugin.objects.get(pk=plugin_name).delete()

Wyświetl plik

@ -30,6 +30,7 @@ class ClipboardInput extends React.Component{
<input
{...this.props}
ref={(domNode) => { this.dom = domNode; }}
title={this.props.value || ""}
onBlur={() => { this.setState({showCopied: false}); }}
/>
<div style={{position: 'relative', 'width': '100%'}}>

Wyświetl plik

@ -3,11 +3,16 @@ import math
from rest_framework import status
from rest_framework.response import Response
from app.plugins.views import TaskView
from app.plugins import get_current_plugin
from app.plugins import get_current_plugin, signals as plugin_signals
from django.dispatch import receiver
from app.plugins import GlobalDataStore
from django.http import Http404
from django.shortcuts import redirect
import logging
logger = logging.getLogger('app.logger')
ds = GlobalDataStore('shortlinks')
def gen_short_string(num):
@ -55,4 +60,12 @@ def HandleShortLink(request, view_type, short_id):
return redirect('/public/task/{}/{}/'.format(task_id, v))
else:
raise Http404()
raise Http404()
@receiver(plugin_signals.task_removed, dispatch_uid="shortlinks_on_task_removed")
def shortlinks_cleanup(sender, task_id, **kwargs):
short_id = ds.get_string(task_id)
if short_id:
logger.info("Cleaning up shortlinks datastore for task {}".format(str(task_id)))
ds.del_key(task_id)
ds.del_key(short_id)

Wyświetl plik

@ -10,7 +10,7 @@ class Plugin(PluginBase):
def include_js_files(self):
return ['main.js']
def root_mount_points(self):
return [
MountPoint(r'^s(?P<view_type>[m3])(?P<short_id>[a-z0-9]+)/?$', HandleShortLink)

Wyświetl plik

@ -63,17 +63,13 @@ export default class SLCheckbox extends React.Component{
if (error) return (<ErrorMessage bind={[this, "error"]} />);
return (<label className="slcheckbox">
{loading ?
<i className="fa fa-sync fa-spin fa-fw"></i>
: ""}
return (<label className="slcheckbox" >
<input
className={this.props.sharePopup.state.togglingShare ? "hide" : ""}
type="checkbox"
type="checkbox"
disabled={loading}
checked={useShortLink}
onChange={this.toggleShortLinks}
/> {_("Use Short Link")}
/> {_("Short Link")}
</label>);
}
}

Wyświetl plik

@ -1,4 +1,5 @@
.slcheckbox{
font-weight: normal;
font-size: 90%;
width: 100%;
}