Desktop mode, share button hiding

pull/989/head
Piero Toffanin 2021-05-26 10:55:53 -04:00
rodzic 430f0a1b71
commit 30ae36d91e
7 zmienionych plików z 30 dodań i 13 usunięć

Wyświetl plik

@ -10,14 +10,16 @@ class MapView extends React.Component {
mapItems: [],
selectedMapType: 'orthophoto',
title: "",
public: false
public: false,
shareButtons: true
};
static propTypes = {
mapItems: PropTypes.array.isRequired, // list of dictionaries where each dict is a {mapType: 'orthophoto', url: <tiles.json>},
selectedMapType: PropTypes.oneOf(['orthophoto', 'plant', 'dsm', 'dtm']),
title: PropTypes.string,
public: PropTypes.bool
public: PropTypes.bool,
shareButtons: PropTypes.bool
};
constructor(props){
@ -106,6 +108,7 @@ class MapView extends React.Component {
showBackground={true}
mapType={this.state.selectedMapType}
public={this.props.public}
shareButtons={this.props.shareButtons}
/>
</div>
</div>);

Wyświetl plik

@ -75,12 +75,14 @@ class CamerasMenu extends React.Component{
class ModelView extends React.Component {
static defaultProps = {
task: null,
public: false
public: false,
shareButtons: true
};
static propTypes = {
task: PropTypes.object.isRequired, // The object should contain two keys: {id: <taskId>, project: <projectId>}
public: PropTypes.bool // Is the view being displayed via a shared link?
public: PropTypes.bool, // Is the view being displayed via a shared link?
shareButtons: PropTypes.bool
};
constructor(props){
@ -499,7 +501,7 @@ class ModelView extends React.Component {
direction="up"
showLabel={false}
buttonClass="btn-secondary" />
{(!this.props.public) ?
{(this.props.shareButtons && !this.props.public) ?
<ShareButton
ref={(ref) => { this.shareButton = ref; }}
task={this.props.task}

Wyświetl plik

@ -32,14 +32,16 @@ class Map extends React.Component {
static defaultProps = {
showBackground: false,
mapType: "orthophoto",
public: false
public: false,
shareButtons: true
};
static propTypes = {
showBackground: PropTypes.bool,
tiles: PropTypes.array.isRequired,
mapType: PropTypes.oneOf(['orthophoto', 'plant', 'dsm', 'dtm']),
public: PropTypes.bool
public: PropTypes.bool,
shareButtons: PropTypes.bool
};
constructor(props) {
@ -536,7 +538,7 @@ _('Example:'),
<div className="actionButtons">
{this.state.pluginActionButtons.map((button, i) => <div key={i}>{button}</div>)}
{(!this.props.public && this.state.singleTask !== null) ?
{(this.props.shareButtons && !this.props.public && this.state.singleTask !== null) ?
<ShareButton
ref={(ref) => { this.shareButton = ref; }}
task={this.state.singleTask}

Wyświetl plik

@ -71,7 +71,8 @@ def map(request, project_pk=None, task_pk=None):
'params': {
'map-items': json.dumps(mapItems),
'title': title,
'public': 'false'
'public': 'false',
'share-buttons': 'false' if settings.DESKTOP_MODE else 'true'
}.items()
})
@ -95,7 +96,8 @@ def model_display(request, project_pk=None, task_pk=None):
'title': title,
'params': {
'task': json.dumps(task.get_model_display_params()),
'public': 'false'
'public': 'false',
'share-buttons': 'false' if settings.DESKTOP_MODE else 'true'
}.items()
})

Wyświetl plik

@ -8,6 +8,7 @@ from django.shortcuts import render
from app.api.tasks import TaskSerializer
from app.models import Task
from django.views.decorators.csrf import ensure_csrf_cookie
from webodm import settings
def get_public_task(task_pk):
"""
@ -27,7 +28,8 @@ def handle_map(request, template, task_pk=None, hide_title=False):
'params': {
'map-items': json.dumps([task.get_map_items()]),
'title': task.name if not hide_title else '',
'public': 'true'
'public': 'true',
'share-buttons': 'false' if settings.DESKTOP_MODE else 'true'
}.items()
})
@ -45,7 +47,8 @@ def handle_model_display(request, template, task_pk=None):
'title': task.name,
'params': {
'task': json.dumps(task.get_model_display_params()),
'public': 'true'
'public': 'true',
'share-buttons': 'false' if settings.DESKTOP_MODE else 'true'
}.items()
})

Wyświetl plik

@ -1,6 +1,6 @@
{
"name": "WebODM",
"version": "1.8.3",
"version": "1.8.4",
"description": "User-friendly, extendable application and API for processing aerial imagery.",
"main": "index.js",
"scripts": {

Wyświetl plik

@ -68,6 +68,11 @@ SINGLE_USER_MODE = False
# URL to redirect to if there are no processing nodes when visiting the dashboard
PROCESSING_NODES_ONBOARDING = None
# Enable desktop mode. In desktop mode some styling changes
# are applied to make the application look nicer on desktop
# as well as disabling certain features (e.g. sharing)
DESKTOP_MODE = False
# Default CSS to add to theme
DEFAULT_THEME_CSS = ''