Skip to content

Commit

Permalink
Merge pull request #555 from chris-allan/archive-status
Browse files Browse the repository at this point in the history
Archive status
  • Loading branch information
knabar authored Jul 29, 2024
2 parents ba8c7e2 + f347f53 commit 0204b31
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 3 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion omeroweb/webclient/static/webclient/javascript/ome.tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,9 @@ $(function() {
rv.children = true;
rv.type = value.set ? 'tagset' : 'tag';
rv.text = value.value;
} else if (type === 'image' && value.archived) {
rv.a_attr = {title: 'Image is archived'};
rv.icon = WEBCLIENT.URLS.static_webclient + 'image/image_locked_slash16.png';
}
return rv;
}
Expand Down Expand Up @@ -1347,4 +1350,4 @@ $(function() {
}
}
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
<th>Import Date:</th>
<td id='import_date' data-isodate='{{ image.creationEventDate|date:"r" }}'></td>
</tr>
{% if image.archived %}
<tr>
<th>Archived:</th>
<td id='is_archived'>{{ image.archived }}</td>
</tr>
{% endif %}
<tr>
<th>Dimensions (XY):</th>
<td id='dims_xy'>{{ image.getSizeX }} x {{ image.getSizeY }}</td>
Expand Down
10 changes: 8 additions & 2 deletions omeroweb/webclient/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ def _marshal_image(
"""Given an Image row (list) marshals it into a dictionary. Order
and type of columns in row is:
* id (rlong)
* archived (boolean)
* name (rstring)
* details.owner.id (rlong)
* details.permissions (dict)
Expand All @@ -549,9 +550,10 @@ def _marshal_image(
@param row_pixels The Image row pixels data to marshal
@type row_pixels L{list}
"""
image_id, name, owner_id, permissions, fileset_id = row
image_id, archived, name, owner_id, permissions, fileset_id = row
image = dict()
image["id"] = unwrap(image_id)
image["archived"] = unwrap(archived) is True
image["name"] = unwrap_to_str(name)
image["ownerId"] = unwrap(owner_id)
image["permsCss"] = parse_permissions_css(permissions, unwrap(owner_id), conn)
Expand Down Expand Up @@ -670,6 +672,7 @@ def marshal_images(
q = (
"""
select new map(image.id as id,
image.archived as archived,
image.name as name,
image.details.owner.id as ownerId,
image as image_details_permissions,
Expand Down Expand Up @@ -753,12 +756,13 @@ def marshal_images(
e = unwrap(e)[0]
d = [
e["id"],
e["archived"],
e["name"],
e["ownerId"],
e["image_details_permissions"],
e["filesetId"],
]
kwargs = {"conn": conn, "row": d[0:5]}
kwargs = {"conn": conn, "row": d[0:6]}
if load_pixels:
d = [e["sizeX"], e["sizeY"], e["sizeZ"], e["sizeT"]]
kwargs["row_pixels"] = d
Expand Down Expand Up @@ -1514,6 +1518,7 @@ def marshal_tagged(

q = """
select distinct new map(obj.id as id,
obj.archived as archived,
obj.name as name,
lower(obj.name) as lowername,
obj.details.owner.id as ownerId,
Expand All @@ -1534,6 +1539,7 @@ def marshal_tagged(
e = unwrap(e)
row = [
e[0]["id"],
e[0]["archived"],
e[0]["name"],
e[0]["ownerId"],
e[0]["image_details_permissions"],
Expand Down
1 change: 1 addition & 0 deletions omeroweb/webgateway/marshal.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def imageMarshal(image, key=None, request=None):
"imageName": image.name or "",
"imageDescription": image.description or "",
"imageAuthor": image.getAuthor(),
"imageArchived": image.archived or False,
"projectName": pr and pr.name or "Multiple",
"projectId": pr and pr.id or None,
"projectDescription": pr and pr.description or "",
Expand Down

0 comments on commit 0204b31

Please sign in to comment.