Skip to content

Commit

Permalink
Release 0.9.0.post5 fixes (HumanSignal#561)
Browse files Browse the repository at this point in the history
* Remove hostname prefix for upload files in case of localhost

* Update misc.py (HumanSignal#560)

Add timeout to version check

* Update requests dependency

* Add task patch

* Fix task patch docs

* Add list to Image in validation

* Change attrs version to >=19.1.0

* Main page mock-up fixes

Gaps and overlays
Outliers on mobile screens
Simplify sliders and fix console error about missing one
Fix github stars rounding
Add new release with github link

* Add INIT_COMMAND to run.sh

* Update DM build

* Add editor version to hash

* Fix misspell

* Change LS version

* Fix misspell

Co-authored-by: LamDang <[email protected]>
Co-authored-by: hlomzik <[email protected]>
  • Loading branch information
3 people committed Jan 22, 2021
1 parent 4f8c68c commit 571ef26
Show file tree
Hide file tree
Showing 21 changed files with 142 additions and 216 deletions.
6 changes: 3 additions & 3 deletions docs/source/guide/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ After the project setup is finished you can import this task (just copy this rig
},
{
"id": "result3",
"type": "choices",
"type": "choices",
"from_name": "choice", "to_name": "image",
"value": {
"value": {
"choices": ["Airbus"]
}
}
Expand Down Expand Up @@ -243,4 +243,4 @@ print(pixel_x, pixel_y, pixel_width, pixel_height)
# convert back to LS
x, y, width, height = convert_to_ls(pixel_x, pixel_y, pixel_width, pixel_height, 600, 403)
print(x, y, width, height)
```
```
2 changes: 1 addition & 1 deletion docs/source/guide/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ The `format` parameters could be found on the Export page in the dropdown (`JSON
| /api/project-switch | `GET` switch to specified project by project UUID in multi-session mode |
| **Tasks** |
| /api/tasks | `GET` retrieve all tasks from project <br> `DELETE` delete all tasks from project |
| /api/tasks/\<task_id> | `GET` retrieve specific task <br> `DELETE` delete specific task |
| /api/tasks/\<task_id> | `GET` retrieve specific task <br> `DELETE` delete specific task <br> `PATCH \| POST` rewrite task with data, completions and predictions (it's very helpful for changing data in time and prediction updates) |
| /api/tasks/\<task_id>/completions | `POST` create a new completion <br> `DELETE` delete all task completions |
| /api/tasks/\<task_id>/completions/\<completion_id> | `PATCH` update completion <br> `DELETE` delete completion |
| /api/completions | `GET` returns all completion ids <br> `DELETE` delete all project completions |
Expand Down
7 changes: 4 additions & 3 deletions docs/themes/htx/layout/partials/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ menu && menu.classList.add('main__page__header')
function nice_format(n) {
const prefixes = ['', 'k', 'M']
const level = Math.floor(Math.floor(Math.log10(n)) / 3)
const short = (n / Math.pow(10, 3 * level))
.toPrecision(3)
.replace(/\.?0+$|(\.\d)\d+$/g, '$1') // leave max one digit after dot
const thousands = n / Math.pow(10, 3 * level)
const short = thousands
.toPrecision(thousands > 99 ? 3 : 2)
.replace(/\.0+$|(\.\d)\d+$/g, '$1') // leave max one digit after dot
return short + prefixes[level]
}
const star_counter = document.querySelector('.star__counter')
Expand Down
41 changes: 26 additions & 15 deletions docs/themes/htx/source/css/new-index.css
Original file line number Diff line number Diff line change
Expand Up @@ -459,13 +459,13 @@ div.container{
.outer__label>.left__overlay{
position: absolute;
left:-15px;
bottom:-15px;
bottom:-40px;
z-index: 5;
}
.outer__label>.right__overlay{
position: absolute;
right:-15px;
bottom:-15px;
bottom:-40px;
z-index: 5;
}
.author__image>img{
Expand Down Expand Up @@ -612,7 +612,7 @@ div.container{
}
.community__block{
margin-bottom:0px;
margin-top:-90px;
margin-top:-60px;
position: relative;
background-color:#FAFAF9;
}
Expand Down Expand Up @@ -651,14 +651,14 @@ div.container{
.lf__overlay{
position: absolute;
left: 0px;
bottom: 150px;
bottom: 130px;
z-index: 3;
height:150px;
}
.rg__overlay{
position: absolute;
right: 0px;
bottom: 150px;
bottom: 130px;
z-index: 3;
height:150px;
}
Expand Down Expand Up @@ -1119,7 +1119,15 @@ footer{
.inner__articles{
grid-template-columns:repeat(3 , minmax(300px , 300px));
overflow-x: auto;
width:calc(100% + 15px);
width:calc(100% + 30px);
margin-left:-15px;
padding-left:15px;
}
/* padding-right doesn't work in scrollable flex block */
.inner__articles::after{
content:"";
flex: 1px 0 0;
margin-left: -1px;
}
.inner__articles::-webkit-scrollbar {
width: 0px; /* Remove scrollbar space */
Expand Down Expand Up @@ -1313,8 +1321,7 @@ footer{
z-index: 6;
}
.lf__overlay{
width:120px;
bottom:120px;
bottom:100px;
}
.community__spacer{
min-width:50px;
Expand All @@ -1323,9 +1330,7 @@ footer{
padding-left:35px;
}
.rg__overlay{
right: -30px;
width:120px;
bottom:120px;
bottom:100px;
}
.inner__community{
width:calc(100% + 30px);
Expand All @@ -1350,6 +1355,9 @@ footer{
.inner__community .info__community{
margin-bottom:20px;
}
.community__block{
margin-top: 0;
}
.community__block .head__community>h2{
text-align:left;
font-size:20px;
Expand All @@ -1358,8 +1366,11 @@ footer{
.community__block .head__community{
margin-bottom:15px;
}
.community__block .outer__community{
top:60px;
}
.community__block .opossum__image{
top:90px;
top:60px;
right: 15px;
max-width:115px;
}
Expand Down Expand Up @@ -1398,7 +1409,7 @@ footer{
line-height:28px;
}
.date__type .head__date--type .switcher__inner{
width:calc(100% + 20px);
width:100%;
}
.main__content .left__content>p{
font-size:16px;
Expand Down Expand Up @@ -1437,11 +1448,11 @@ footer{
}
.outer__label>.left__overlay{
max-width:100px;
bottom:-20px;
bottom:-30px;
}
.outer__label>.right__overlay{
max-width:100px;
bottom:-20px;
bottom:-30px;
}
.date__type{
margin-bottom:-250px;
Expand Down
99 changes: 30 additions & 69 deletions docs/themes/htx/source/js/new-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,76 +56,37 @@ $(document).ready(function(){
}
});

const slider = document.querySelector('.content__label');
let isDown = false;
let startX;
let scrollLeft;
function activateSlider(slider) {
if (!slider) return;

slider.addEventListener('mousedown', (e) => {
isDown = true;
slider.classList.add('active');
startX = e.pageX - slider.offsetLeft;
scrollLeft = slider.scrollLeft;
});
slider.addEventListener('mouseleave', () => {
isDown = false;
slider.classList.remove('active');
});
slider.addEventListener('mouseup', () => {
isDown = false;
slider.classList.remove('active');
});
slider.addEventListener('mousemove', (e) => {
if(!isDown) return;
e.preventDefault();
const x = e.pageX - slider.offsetLeft;
const walk = (x - startX) * 3; //scroll-fast
slider.scrollLeft = scrollLeft - walk;
});
const slider2 = document.querySelector(".community__wrapper");
slider2.addEventListener('mousedown', (e) => {
isDown = true;
slider2.classList.add('active');
startX = e.pageX - slider2.offsetLeft;
scrollLeft = slider2.scrollLeft;
});
slider2.addEventListener('mouseleave', () => {
isDown = false;
slider2.classList.remove('active');
});
slider2.addEventListener('mouseup', () => {
isDown = false;
slider2.classList.remove('active');
});
slider2.addEventListener('mousemove', (e) => {
if(!isDown) return;
e.preventDefault();
const x = e.pageX - slider2.offsetLeft;
const walk = (x - startX) * 3; //scroll-fast
slider2.scrollLeft = scrollLeft - walk;
});
let isDown = false;
let startX;
let scrollLeft;

slider.addEventListener('mousedown', (e) => {
isDown = true;
slider.classList.add('active');
startX = e.pageX - slider.offsetLeft;
scrollLeft = slider.scrollLeft;
});
slider.addEventListener('mouseleave', () => {
isDown = false;
slider.classList.remove('active');
});
slider.addEventListener('mouseup', () => {
isDown = false;
slider.classList.remove('active');
});
slider.addEventListener('mousemove', (e) => {
if(!isDown) return;
e.preventDefault();
const x = e.pageX - slider.offsetLeft;
const walk = (x - startX) * 3; //scroll-fast
slider.scrollLeft = scrollLeft - walk;
});
}

const slider3 = document.querySelector(".content__video");
slider3.addEventListener('mousedown', (e) => {
isDown = true;
slider3.classList.add('active');
startX = e.pageX - slider3.offsetLeft;
scrollLeft = slider3.scrollLeft;
});
slider3.addEventListener('mouseleave', () => {
isDown = false;
slider3.classList.remove('active');
});
slider3.addEventListener('mouseup', () => {
isDown = false;
slider3.classList.remove('active');
});
slider3.addEventListener('mousemove', (e) => {
if(!isDown) return;
e.preventDefault();
const x = e.pageX - slider3.offsetLeft;
const walk = (x - startX) * 3; //scroll-fast
slider3.scrollLeft = scrollLeft - walk;
});
activateSlider(document.querySelector('.content__label'));
activateSlider(document.querySelector(".community__wrapper"));
activateSlider(document.querySelector(".content__video"));
});
2 changes: 1 addition & 1 deletion label_studio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
package_name = 'label-studio'

# Package version
__version__ = '0.9.0.post4'
__version__ = '0.9.0.post5'
11 changes: 9 additions & 2 deletions label_studio/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ def labeling_page():
label_config_line=g.project.label_config_line,
task_id=task_id,
task_data=task_data,
version=label_studio.__version__,
**find_editor_files()
)

Expand Down Expand Up @@ -693,7 +694,7 @@ def api_all_tasks():
return make_response(jsonify({'detail': 'deleted'}), 204)


@blueprint.route('/api/tasks/<task_id>', methods=['GET', 'DELETE'])
@blueprint.route('/api/tasks/<task_id>', methods=['GET', 'DELETE', 'PATCH', 'POST'])
@requires_auth
@exception_handler
def api_task_by_id(task_id):
Expand All @@ -717,10 +718,16 @@ def api_task_by_id(task_id):
)
return make_response(response, 200)

if request.method == 'PATCH' or request.method == 'POST':
data = request.json
g.project.source_storage._validate_task(task_id, data)
g.project.source_storage.set(task_id, data)
return make_response({'detail': 'Task patched', 'data': data}, 200)

# delete task
elif request.method == 'DELETE':
g.project.delete_task(task_id)
return make_response(jsonify({'detal': 'Task deleted'}), 204)
return make_response(jsonify({'detail': 'Task deleted'}), 204)


@blueprint.route('/api/tasks/<task_id>/completions', methods=['POST', 'DELETE'])
Expand Down
7 changes: 6 additions & 1 deletion label_studio/data_import/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ def read_task_from_hypertext_body(self, filename, file):

def read_task_from_uploaded_file(self, filename, file):
logger.debug('Read 1 task from uploaded file {}'.format(filename))
path = get_external_hostname() + '/data/upload/' + filename
# remove hostname if it's localhost and use absolute path
hostname = get_external_hostname()
if 'localhost' in hostname:
hostname = ''
# make path with hostname
path = hostname + '/data/upload/' + filename
tasks = [{'data': {settings.UPLOAD_DATA_UNDEFINED_NAME: path}}]
return tasks

Expand Down
13 changes: 12 additions & 1 deletion label_studio/data_manager/templates/tasks.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@
<center><br><br><br>Loading ...<br></center>
</div>

<script src="static/js/build/index.js?version="{{ version }}></script>
<!-- Editor CSS -->
{% for css in editor_css %}
<link href="{{ css }}?version={{ version }}" rel="stylesheet">
{% endfor %}

<!-- Editor JS -->
{% for js in editor_js %}
<script src="{{ js }}?version={{ version }}"></script>
{% endfor %}

<!-- Data manager JS -->
<script src="static/js/build/index.js?version={{ version }}"></script>

{% endblock %}
15 changes: 13 additions & 2 deletions label_studio/data_manager/templates/tasks_old.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
{% extends 'base.html' %}
{% block body %}

<!-- Editor JS -->
{% for js in editor_js %}
<script src="{{ js }}?version={{ version }}"></script>
{% endfor %}

<!-- Editor CSS -->
{% for css in editor_css %}
<link href="{{ css }}?version={{ version }}" rel="stylesheet">
{% endfor %}

{% raw %}
<script src="static/js/polyfill.min.js"></script>
<script src="static/js/vue.js"></script>
Expand Down Expand Up @@ -113,7 +124,7 @@
</span>
</span>
<!-- Start labeling -->
<a class="ui button positive" href=".">Start Labeling</a>
<a class="ui button positive" href="./label-old">Start Labeling</a>
</div>
</div>
</div>
Expand All @@ -122,7 +133,7 @@

<!-- Critical error -->
<div v-if="error">
<div class="ui hidden divier"></div>
<div class="ui hidden divider"></div>
<div class="ui error message">
<div class="header">{{ error.header }}</div>
<div class="content">{{ error.message }}</div>
Expand Down
1 change: 1 addition & 0 deletions label_studio/data_manager/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ def tasks_old_page():
config=g.project.config,
project=g.project,
serialized_project=serialized_project,
version=label_studio.__version__,
**find_editor_files()
)
Loading

0 comments on commit 571ef26

Please sign in to comment.