Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

Add tagsearch support for screens and plates #64

Merged
merged 3 commits into from
Jun 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tagsearch/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.1
3.0.2
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,29 @@
background: url('../image/folder_image16.png') no-repeat;
}

.tagnav-screen .tagnav-icon {
background: url('../image/folder_screen16.png') no-repeat;
}

.tagnav-plate .tagnav-icon {
background: url('../image/folder_plate16.png') no-repeat;
}

.tagnav-acquisition .tagnav-icon {
background: url('../image/run16.png') no-repeat;
}

.tagnav-image .tagnav-icon {
background: url('../image/image16.png') no-repeat;
}

.tagnav-project span, .tagnav-dataset span , .tagnav-image span {
width: 25%;
display: inline-block;
.tagnav-project, .tagnav-dataset, .tagnav-screen,
.tagnav-plate, .tagnav-acquisition, .tagnav-image {
color: hsl(210,10%,50%);
font-size: 1.2em;
text-shadow: 0 1px 0 white;
vertical-align: top;
vertical-align: middle;
font-weight: bold;
margin-left: 5px;
margin-top: 2px;
}
margin-top: 10px;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
{% for c in manager.containers.screen %}
<tr id="screen-{{ c.id }}" class="{{ c.getPermsCss }}">
<td class="image">
<img id="{{ c.id }}" src="{% static "webclient/image/folder_screen32.png" %}" alt="screen" title="{{ c.name }}"/>
<img id="{{ c.id }}" src="{% static "webclient/image/folder_screen16.png" %}" alt="screen" title="{{ c.name }}"/>
</td>
<td class="desc"><a>{{ c.name|truncatebefor:"65" }}</a></td>
<td class="date">{{ c.creationEventDate }}</td>
Expand All @@ -160,7 +160,7 @@
{% for c in manager.containers.plate %}
<tr id="plate-{{ c.id }}" class="{{ c.getPermsCss }}">
<td class="image">
<img id="{{ c.id }}" src="{% static "webclient/image/folder_plate32.png" %}" alt="plate" title="{{ c.name }}"/>
<img id="{{ c.id }}" src="{% static "webclient/image/folder_plate16.png" %}" alt="plate" title="{{ c.name }}"/>
</td>
<td class="desc"><a>{{ c.name|truncatebefor:"65" }}</a></td>
<td class="date">{{ c.creationEventDate }}</td>
Expand All @@ -170,6 +170,19 @@
</a></td>
</tr>
{% endfor %}
{% for c in manager.containers.acquisition %}
<tr id="acquisition-{{ c.id }}" class="{{ c.getPermsCss }}">
<td class="image">
<img id="{{ c.id }}" src="{% static "webclient/image/run16.png" %}" alt="acquisition" title="{{ c.name }}"/>
</td>
<td class="desc"><a>{{ c.name|truncatebefor:"65" }}</a></td>
<td class="date">{{ c.creationEventDate }}</td>
<td class="group">{{ c.getDetails.group.name.val }}</td>
<td><a href="{% url 'webindex' %}?show=acquisition-{{ c.id }}" title="{% trans 'Show in hierarchy view' %}">
{% trans "Browse" %}
</a></td>
</tr>
{% endfor %}
{% for c in manager.containers.image %}
<tr id="image-{{ c.id }}" class="{{ c.getPermsCss }}">
<td class="image">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@
$("div#content_details").html(data.html);

if (data.project_count > 0) {
$(".tagnav-project span").html(data.project_count);
$("#tagnav-project span").html(data.project_count);
} else {
$(".tagnav-project span").html('0');
$("#tagnav-project span").html('0');
}

if (data.dataset_count > 0) {
Expand All @@ -84,6 +84,24 @@
$(".tagnav-dataset span").html('0');
}

if (data.screen_count > 0) {
$(".tagnav-screen span").html(data.screen_count);
} else {
$(".tagnav-screen span").html('0');
}

if (data.plate_count > 0) {
$(".tagnav-plate span").html(data.plate_count);
} else {
$(".tagnav-plate span").html('0');
}

if (data.acquisition_count > 0) {
$(".tagnav-acquisition span").html(data.acquisition_count);
} else {
$(".tagnav-acquisition span").html('0');
}

if (data.image_count > 0) {
$(".tagnav-image span").html(data.image_count);
} else {
Expand Down Expand Up @@ -198,9 +216,12 @@ <h2>{% trans "Tag Search" %}</h2>
{{ tagnav_form.results_preview }}
<h2>Results</h2>
<ul>
<li class="tagnav-project"><div class="tagnav-icon">&nbsp;</div><span>0</span></li>
<li class="tagnav-dataset"><div class="tagnav-icon">&nbsp;</div><span>0</span></li>
<li class="tagnav-image"><div class="tagnav-icon">&nbsp;</div><span>0</span></li>
<li class="tagnav-project"><div class="tagnav-icon">&nbsp;</div>Project:&nbsp;<span>0</span></li>
<li class="tagnav-dataset"><div class="tagnav-icon">&nbsp;</div>Dataset:&nbsp;<span>0</span></li>
<li class="tagnav-screen"><div class="tagnav-icon">&nbsp;</div>Screen:&nbsp;<span>0</span></li>
<li class="tagnav-plate"><div class="tagnav-icon">&nbsp;</div>Plate:&nbsp;<span>0</span></li>
<li class="tagnav-acquisition"><div class="tagnav-icon">&nbsp;</div>Plate Acquisition/Run:&nbsp;<span>0</span></li>
<li class="tagnav-image"><div class="tagnav-icon">&nbsp;</div>Image:&nbsp;<span>0</span></li>
</ul>

</div>
Expand Down
51 changes: 50 additions & 1 deletion tagsearch/omero_webtagging_tagsearch/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@ def get_tags(obj):
tags = set(get_tags('Image'))
tags.update(get_tags('Dataset'))
tags.update(get_tags('Project'))
tags.update(get_tags('Plate'))
tags.update(get_tags('PlateAcquisition'))
tags.update(get_tags('Screen'))

# Convert back to an ordered list and sort
tags = list(tags)
Expand Down Expand Up @@ -266,21 +269,41 @@ def getObjectsWithAllAnnotations(obj_type, annids):
preview = False
project_count = 0
dataset_count = 0
screen_count = 0
plate_count = 0
acquisition_count = 0
image_count = 0

if selected_tags:
image_ids = getObjectsWithAllAnnotations('Image', selected_tags)
context['image_count'] = len(image_ids)
image_count = len(image_ids)

dataset_ids = getObjectsWithAllAnnotations('Dataset',
selected_tags)
context['dataset_count'] = len(dataset_ids)
dataset_count = len(dataset_ids)

project_ids = getObjectsWithAllAnnotations('Project',
selected_tags)
context['project_count'] = len(project_ids)
project_count = len(project_ids)

screen_ids = getObjectsWithAllAnnotations('Screen',
selected_tags)
context['screen_count'] = len(screen_ids)
screen_count = len(screen_ids)

plate_ids = getObjectsWithAllAnnotations('Plate',
selected_tags)
context['plate_count'] = len(plate_ids)
plate_count = len(plate_ids)

acquisition_ids = getObjectsWithAllAnnotations('PlateAcquisition',
selected_tags)
context['acquisition_count'] = len(acquisition_ids)
acquisition_count = len(acquisition_ids)

if results_preview:
if image_ids:
images = conn.getObjects('Image', ids=image_ids)
Expand All @@ -294,8 +317,22 @@ def getObjectsWithAllAnnotations(obj_type, annids):
projects = conn.getObjects('Project', ids=project_ids)
manager['containers']['project'] = list(projects)

if screen_ids:
screens = conn.getObjects('Screen', ids=screen_ids)
manager['containers']['screen'] = list(screens)

if plate_ids:
plates = conn.getObjects('Plate', ids=plate_ids)
manager['containers']['plate'] = list(plates)

if acquisition_ids:
acquisitions = conn.getObjects('PlateAcquisition',
ids=acquisition_ids)
manager['containers']['acquisition'] = list(acquisitions)

manager['c_size'] = len(image_ids) + len(dataset_ids) + \
len(project_ids)
len(project_ids) + len(screen_ids) + len(plate_ids) + \
len(acquisition_ids)
if manager['c_size'] > 0:
preview = True

Expand Down Expand Up @@ -345,6 +382,15 @@ def getAnnotationsForObjects(obj_type, oids):
if project_ids:
remaining.update(getAnnotationsForObjects('Project',
project_ids))
if acquisition_ids:
remaining.update(getAnnotationsForObjects('PlateAcquisition',
acquisition_ids))
if plate_ids:
remaining.update(getAnnotationsForObjects('Plate',
plate_ids))
if screen_ids:
remaining.update(getAnnotationsForObjects('Screen',
screen_ids))

end = time.time()
logger.info(
Expand All @@ -359,6 +405,9 @@ def getAnnotationsForObjects(obj_type, oids):
"preview": preview,
"project_count": project_count,
"dataset_count": dataset_count,
"screen_count": screen_count,
"plate_count": plate_count,
"acquisition_count": acquisition_count,
"image_count": image_count,
"html": html_response}),
content_type="application/json")