Skip to content

Commit

Permalink
Add configurable docs/task options links
Browse files Browse the repository at this point in the history
  • Loading branch information
pierotofy committed Nov 6, 2023
1 parent 58dcc46 commit ce9cd0a
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 5 deletions.
9 changes: 8 additions & 1 deletion app/static/app/js/components/ProcessingNodeOption.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ class ProcessingNodeOption extends React.Component {
}
}

handleHelp = e => {
e.preventDefault();
if (window.__taskOptionsDocsLink){
window.open(window.__taskOptionsDocsLink + "#" + encodeURIComponent(this.props.name), "task-options")
}
}

render() {
let inputControl = "";
let warningMsg = "";
Expand Down Expand Up @@ -168,7 +175,7 @@ class ProcessingNodeOption extends React.Component {

return (
<div className="processing-node-option form-inline form-group form-horizontal" ref={this.setTooltips}>
<label>{this.props.name} {(!this.isEnumType() && this.props.domain ? `(${this.props.domain})` : "")} <i data-toggle="tooltip" data-placement="bottom" title={this.props.help} onClick={e => e.preventDefault()} className="fa fa-info-circle info-button"></i></label><br/>
<label>{this.props.name} {(!this.isEnumType() && this.props.domain ? `(${this.props.domain})` : "")} <i data-toggle="tooltip" data-placement="bottom" title={this.props.help} onClick={this.handleHelp} className="fa fa-info-circle info-button help-button"></i></label><br/>
{inputControl}
{loadFileControl}

Expand Down
4 changes: 2 additions & 2 deletions app/static/app/js/components/TaskListItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -605,14 +605,14 @@ class TaskListItem extends React.Component {
<div className="task-warning"><i className="fa fa-warning"></i> <span>{_("An orthophoto could not be generated. To generate one, make sure GPS information is embedded in the EXIF tags of your images, or use a Ground Control Points (GCP) file.")}</span></div> : ""}

{showMemoryErrorWarning ?
<div className="task-warning"><i className="fa fa-support"></i> <Trans params={{ memlink: `<a href="${memoryErrorLink}" target='_blank'>${_("enough RAM allocated")}</a>`, cloudlink: `<a href='https://www.opendronemap.org/webodm/lightning/' target='_blank'>${_("cloud processing node")}</a>` }}>{_("It looks like your processing node ran out of memory. If you are using docker, make sure that your docker environment has %(memlink)s. Alternatively, make sure you have enough physical RAM, reduce the number of images, make your images smaller, or reduce the max-concurrency parameter from the task's options. You can also try to use a %(cloudlink)s.")}</Trans></div> : ""}
<div className="task-warning"><i className="fa fa-support"></i> <Trans params={{ memlink: `<a href="${memoryErrorLink}" target='_blank'>${_("enough RAM allocated")}</a>`, cloudlink: `<a href='https://webodm.net' target='_blank'>${_("cloud processing node")}</a>` }}>{_("It looks like your processing node ran out of memory. If you are using docker, make sure that your docker environment has %(memlink)s. Alternatively, make sure you have enough physical RAM, reduce the number of images, make your images smaller, or reduce the max-concurrency parameter from the task's options. You can also try to use a %(cloudlink)s.")}</Trans></div> : ""}

{showTaskWarning ?
<div className="task-warning"><i className="fa fa-support"></i> <span dangerouslySetInnerHTML={{__html: this.state.friendlyTaskError}} /></div> : ""}

{showExitedWithCodeOneHints ?
<div className="task-warning"><i className="fa fa-info-circle"></i> <div className="inline">
<Trans params={{link: `<a href="https://docs.opendronemap.org" target="_blank">docs.opendronemap.org</a>` }}>{_("\"Process exited with code 1\" means that part of the processing failed. Sometimes it's a problem with the dataset, sometimes it can be solved by tweaking the Task Options. Check the documentation at %(link)")}</Trans>
<Trans params={{link: `<a href="${window.__taskOptionsDocsLink}" target="_blank">${window.__taskOptionsDocsLink.replace("https://", "")}</a>` }}>{_("\"Process exited with code 1\" means that part of the processing failed. Sometimes it's a problem with the dataset, sometimes it can be solved by tweaking the Task Options. Check the documentation at %(link)s")}</Trans>
</div>
</div>
: ""}
Expand Down
4 changes: 4 additions & 0 deletions app/static/app/js/css/ProcessingNodeOption.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,8 @@
padding: 2px 4px 2px 4px;
margin-top: 12px;
}

.help-button:hover{
cursor: pointer;
}
}
3 changes: 3 additions & 0 deletions app/templates/app/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@
</body>
<script src="{% static 'app/js/vendor/metisMenu.min.js' %}"></script>
<script>
{% task_options_docs_link as to_link %}
window.__taskOptionsDocsLink = "{{ to_link|safe }}";

$(function(){
$('#side-menu').metisMenu();

Expand Down
2 changes: 1 addition & 1 deletion app/templates/app/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ <h3>{% trans 'Welcome!' %} ☺</h3>
<li>{% trans 'You need at least 5 images, but 16-32 is typically the minimum.' %}</li>
<li>{% trans 'Images must overlap by 65% or more. Aim for 70-72%' %}</li>
<li>{% trans 'For great 3D, images must overlap by 83%' %}</li>
<li>{% blocktrans with link_start='<a href="https://github.com/OpenDroneMap/OpenDroneMap/wiki/Running-OpenDroneMap#running-odm-with-ground-control" target="_blank">' link_end='</a>' %}A {{link_start}}GCP File{{link_end}} is optional, but can increase georeferencing accuracy{% endblocktrans %}</li>
<li>{% gcp_docs_link as gcp_link %}{% blocktrans with link_start=gcp_link|safe link_end='</a>' %}A {{link_start}}GCP File{{link_end}} is optional, but can increase georeferencing accuracy{% endblocktrans %}</li>
</ul>
</p>
{% endif %}
Expand Down
8 changes: 8 additions & 0 deletions app/templatetags/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
register = template.Library()
logger = logging.getLogger('app.logger')

@register.simple_tag
def task_options_docs_link():
return settings.TASK_OPTIONS_DOCS_LINK

@register.simple_tag
def gcp_docs_link():
return '<a href="%s" target="_blank">' % settings.GCP_DOCS_LINK

@register.simple_tag
def reset_password_link():
return settings.RESET_PASSWORD_LINK
Expand Down
2 changes: 1 addition & 1 deletion app/views/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def dashboard(request):

no_tasks = Task.objects.filter(project__owner=request.user).count() == 0
no_projects = Project.objects.filter(owner=request.user).count() == 0

# Create first project automatically
if no_projects and request.user.has_perm('app.add_project'):
Project.objects.create(owner=request.user, name=_("First Project"))
Expand Down
9 changes: 9 additions & 0 deletions webodm/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,15 @@ def scalebyiv(color, n):
# are removed (or None to disable)
CLEANUP_PARTIAL_TASKS = 72

# Link to GCP docs
GCP_DOCS_LINK = "https://docs.opendronemap.org/gcp/#gcp-file-format"

# Link to general docs
DOCS_LINK = "https://docs.opendronemap.org"

# Link to task options docs
TASK_OPTIONS_DOCS_LINK = "https://docs.opendronemap.org/arguments/"

if TESTING or FLUSHING:
CELERY_TASK_ALWAYS_EAGER = True
EXTERNAL_AUTH_ENDPOINT = 'http://0.0.0.0:5555/auth'
Expand Down

0 comments on commit ce9cd0a

Please sign in to comment.