-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fdf4f01
Showing
20 changed files
with
1,110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Install and test and OMERO plugin e.g. a Web app, a CLI plugin or a library | ||
# | ||
# This workflow will install omero-test-infra, start an OMERO environment | ||
# including database, server and web deployment, configure the OMERO plugin | ||
# and run integration tests. | ||
# | ||
# 1. Set up the stage variable depending on the plugin. Supported stages | ||
# are: app, cli, scripts, lib, srv | ||
# | ||
# 2. Adjust the cron schedule as necessary | ||
|
||
name: OMERO | ||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: '0 0 * * 0' | ||
|
||
jobs: | ||
test: | ||
name: Run integration tests against OMERO | ||
runs-on: ubuntu-22.04 | ||
env: | ||
STAGE: app | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Checkout omero-test-infra | ||
uses: actions/checkout@master | ||
with: | ||
repository: ome/omero-test-infra | ||
path: .omero | ||
ref: master | ||
- name: Build and run OMERO tests | ||
run: .omero/docker $STAGE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
name: PyPI | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
build-n-publish: | ||
name: Build and publish Python distribution to PyPI | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
- name: Build a binary wheel and a source tarball | ||
run: | | ||
python -mpip install build | ||
python -m build | ||
- name: Publish distribution to PyPI | ||
if: startsWith(github.ref, 'refs/tags') | ||
uses: pypa/gh-action-pypi-publish@v1.8.14 | ||
with: | ||
password: ${{ secrets.PYPI_PASSWORD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
build | ||
node_modules | ||
*.pyc | ||
*.DS_Store |
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
include *.md | ||
include LICENSE | ||
prune dist | ||
prune build | ||
recursive-include omero_script_ui * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
|
||
[![Actions Status](https://github.com/will-moore/omero-script-ui/workflows/OMERO/badge.svg)](https://github.com/will-moore/omero-script-ui/actions) | ||
|
||
|
||
OMERO.omero_script_ui | ||
================================== | ||
|
||
Experimental app to add custom UIs for OMERO scripts. | ||
|
||
Installation | ||
============ | ||
|
||
This section assumes that an OMERO.web is already installed. | ||
|
||
Installing from Pypi | ||
-------------------- | ||
|
||
Install the app using [pip](<https://pip.pypa.io/en/stable/>) . | ||
|
||
Ensure that you are running ``pip`` from the Python environment | ||
where ``omero-web`` is installed. Depending on your install, you may need to | ||
call ``pip`` with, for example: ``/path/to_web_venv/venv/bin/pip install ...`` | ||
|
||
:: | ||
|
||
$ pip install -U omero-script-ui | ||
|
||
|
||
Development mode | ||
---------------- | ||
|
||
Install `omero-script-ui` in development mode as follows: | ||
|
||
# within your python venv: | ||
$ cd omero-script-ui | ||
$ pip install -e . | ||
|
||
After installation either from [Pypi](https://pypi.org/) or in development mode, you need to configure the application. | ||
To add the application to the `omero.web.apps` settings, run the following command: | ||
|
||
Note the usage of single quotes around double quotes: | ||
|
||
$ omero config append omero.web.apps '"omero_script_ui"' | ||
|
||
Optionally, add a link "Script UI" at the top of the webclient to | ||
open the index page of this app: | ||
|
||
$ omero config append omero.web.ui.top_links '["Script UI", "omero_script_ui_index", {"title": "Open Script UI in new tab", "target": "_blank"}]' | ||
|
||
|
||
Now restart your `omero-web` server and go to | ||
<http://localhost:4080/omero_script_ui/> in your browser. | ||
|
||
|
||
Further Info | ||
============ | ||
|
||
1. This app was derived from [cookiecutter-omero-webapp](https://github.com/ome/cookiecutter-omero-webapp). | ||
2. For further info on deployment, see [Deployment](https://docs.openmicroscopy.org/latest/omero/developers/Web/Deployment.html) | ||
|
||
|
||
License | ||
======= | ||
|
||
This project, similar to many Open Microscopy Environment (OME) projects, is | ||
licensed under the terms of the AGPL v3. | ||
|
||
|
||
Copyright | ||
========= | ||
|
||
2024 University of Dundee | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Metadata-Version: 2.1 | ||
Name: omero-script-ui | ||
Version: 0.1.0.dev0 | ||
Summary: Experimental app to add custom UIs for OMERO scripts | ||
Home-page: https://github.com/will-moore/omero-script-ui | ||
Download-URL: https://github.com/will-moore/omero-script-ui/v0.1.0.dev0.tar.gz | ||
Author: Will Moore | ||
Author-email: w.moore@dundee.ac.uk | ||
License: AGPLv3 | ||
Keywords: omero | ||
Classifier: Development Status :: 2 - Pre-Alpha | ||
Classifier: Environment :: Plugins | ||
Classifier: Intended Audience :: Developers | ||
Classifier: Intended Audience :: End Users/Desktop | ||
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 | ||
Classifier: Natural Language :: English | ||
Classifier: Operating System :: OS Independent | ||
Classifier: Programming Language :: Python :: 3 | ||
Classifier: Topic :: Software Development :: Libraries :: Python Modules | ||
License-File: LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
CHANGELOG.md | ||
LICENSE | ||
MANIFEST.in | ||
README.md | ||
setup.py | ||
omero_script_ui/__init__.py | ||
omero_script_ui/urls.py | ||
omero_script_ui/views.py | ||
omero_script_ui.egg-info/PKG-INFO | ||
omero_script_ui.egg-info/SOURCES.txt | ||
omero_script_ui.egg-info/dependency_links.txt | ||
omero_script_ui.egg-info/not-zip-safe | ||
omero_script_ui.egg-info/top_level.txt | ||
omero_script_ui/static/omero_script_ui/app.css | ||
omero_script_ui/static/omero_script_ui/app.js | ||
omero_script_ui/templates/omero_script_ui/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
omero_script_ui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env python | ||
# | ||
# Copyright (c) 2024 University of Dundee. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
body { | ||
font-family: Arial, Helvetica, sans-serif; | ||
margin: 20px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
|
||
// Construct the API projects URL | ||
var projectsUrl = PARAMS.API_BASE_URL + 'm/projects/'; | ||
|
||
// Filter projects by Owner to only show 'your' projects | ||
projectsUrl += '?owner=' + PARAMS.EXP_ID; | ||
|
||
fetch(projectsUrl).then(rsp => rsp.json()) | ||
.then(data => { | ||
let projectCount = data.meta.totalCount; | ||
let projects = data.data; | ||
|
||
// Render html... | ||
let html = ` | ||
<div>Total: ${projectCount} projects...</div> | ||
<ul> | ||
${projects.map(p => `<li>${p.Name} (ID: ${p['@id']})</li>`).join("")} | ||
</ul>`; | ||
|
||
document.getElementById('projects').innerHTML = html; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!-- | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as | ||
published by the Free Software Foundation, either version 3 of the | ||
License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>OMERO Script UI</title> | ||
|
||
<!-- Include static css --> | ||
<link rel="stylesheet" type="text/css" href="{% static 'omero_script_ui/app.css' %}" /> | ||
|
||
<script type="text/javascript"> | ||
// Global variables, used by JavaScript code. | ||
window.PARAMS = {}; | ||
window.PARAMS.EXP_ID = {{ experimenterId }}; | ||
|
||
// Render a URL to the /api/v0/ URL for loading JSON data | ||
window.PARAMS.API_BASE_URL = "{% url 'api_base' 0 %}"; | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<h1>Welcome to Script UI</h1> | ||
|
||
<p> | ||
Logged in as: | ||
<!-- Django template renders values from context --> | ||
<strong>{{ firstName }} {{ lastName }}</strong> | ||
</p> | ||
|
||
<p id="projects"> | ||
Loading Projects... | ||
</p> | ||
|
||
<!-- Include the static JavaScript --> | ||
<script src="{% static 'omero_script_ui/app.js' %}"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env python | ||
# | ||
# Copyright (c) 2024 University of Dundee. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
|
||
from django.urls import re_path | ||
|
||
from . import views | ||
|
||
urlpatterns = [ | ||
# index 'home page' of the app | ||
re_path(r"^$", views.index, name="omero_script_ui_index"), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env python | ||
# | ||
# Copyright (c) 2024 University of Dundee. | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU Affero General Public License as | ||
# published by the Free Software Foundation, either version 3 of the | ||
# License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Affero General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU Affero General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
|
||
from django.shortcuts import render | ||
|
||
from omeroweb.decorators import login_required | ||
|
||
|
||
# login_required: if not logged-in, will redirect to webclient | ||
# login page. Then back to here, passing in the 'conn' connection | ||
# and other arguments **kwargs. | ||
@login_required() | ||
def index(request, conn=None, **kwargs): | ||
# We can load data from OMERO via Blitz Gateway connection. | ||
# See https://docs.openmicroscopy.org/latest/omero/developers/Python.html | ||
experimenter = conn.getUser() | ||
|
||
# A dictionary of data to pass to the html template | ||
context = { | ||
"firstName": experimenter.firstName, | ||
"lastName": experimenter.lastName, | ||
"experimenterId": experimenter.id, | ||
} | ||
# print can be useful for debugging, but remove in production | ||
# print('context', context) | ||
|
||
# Render the html template and return the http response | ||
return render(request, "omero_script_ui/index.html", context) |
Oops, something went wrong.