forked from enviPath/enviPy
Compare commits
1 Commits
develop
...
feature/le
| Author | SHA1 | Date | |
|---|---|---|---|
| 95d16690ef |
@ -8,7 +8,6 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
if: ${{ !contains(gitea.event.pull_request.title, 'WIP') }}
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
services:
|
services:
|
||||||
@ -100,18 +99,6 @@ jobs:
|
|||||||
- name: Setup venv
|
- name: Setup venv
|
||||||
run: |
|
run: |
|
||||||
uv sync --locked --all-extras --dev
|
uv sync --locked --all-extras --dev
|
||||||
source .venv/bin/activate
|
|
||||||
playwright install --with-deps
|
|
||||||
|
|
||||||
- name: Run PNPM Commands
|
|
||||||
run: |
|
|
||||||
uv run python scripts/pnpm_wrapper.py install
|
|
||||||
cat << 'EOF' > pnpm-workspace.yaml
|
|
||||||
onlyBuiltDependencies:
|
|
||||||
- '@parcel/watcher'
|
|
||||||
- '@tailwindcss/oxide'
|
|
||||||
EOF
|
|
||||||
uv run python scripts/pnpm_wrapper.py run build
|
|
||||||
|
|
||||||
- name: Wait for services
|
- name: Wait for services
|
||||||
run: |
|
run: |
|
||||||
@ -123,12 +110,7 @@ jobs:
|
|||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
python manage.py migrate --noinput
|
python manage.py migrate --noinput
|
||||||
|
|
||||||
- name: Run frontend tests
|
|
||||||
run: |
|
|
||||||
source .venv/bin/activate
|
|
||||||
python manage.py test --tag frontend
|
|
||||||
|
|
||||||
- name: Run Django tests
|
- name: Run Django tests
|
||||||
run: |
|
run: |
|
||||||
source .venv/bin/activate
|
source .venv/bin/activate
|
||||||
python manage.py test tests --exclude-tag slow --exclude-tag frontend
|
python manage.py test tests --exclude-tag slow
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,7 +6,6 @@ static/django_extensions/
|
|||||||
.env
|
.env
|
||||||
debug.log
|
debug.log
|
||||||
scratches/
|
scratches/
|
||||||
test-results/
|
|
||||||
|
|
||||||
data/
|
data/
|
||||||
|
|
||||||
|
|||||||
@ -49,23 +49,9 @@ INSTALLED_APPS = [
|
|||||||
"oauth2_provider",
|
"oauth2_provider",
|
||||||
# Custom
|
# Custom
|
||||||
"epdb",
|
"epdb",
|
||||||
# "migration",
|
"migration",
|
||||||
]
|
]
|
||||||
|
|
||||||
TENANT = os.environ.get("TENANT", "public")
|
|
||||||
|
|
||||||
if TENANT != "public":
|
|
||||||
INSTALLED_APPS.append(TENANT)
|
|
||||||
|
|
||||||
EPDB_PACKAGE_MODEL = os.environ.get("EPDB_PACKAGE_MODEL", "epdb.Package")
|
|
||||||
|
|
||||||
|
|
||||||
def GET_PACKAGE_MODEL():
|
|
||||||
from django.apps import apps
|
|
||||||
|
|
||||||
return apps.get_model(EPDB_PACKAGE_MODEL)
|
|
||||||
|
|
||||||
|
|
||||||
AUTHENTICATION_BACKENDS = [
|
AUTHENTICATION_BACKENDS = [
|
||||||
"django.contrib.auth.backends.ModelBackend",
|
"django.contrib.auth.backends.ModelBackend",
|
||||||
]
|
]
|
||||||
|
|||||||
@ -23,20 +23,12 @@ from .api import api_v1, api_legacy
|
|||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", include("epdb.urls")),
|
path("", include("epdb.urls")),
|
||||||
|
path("", include("migration.urls")),
|
||||||
path("admin/", admin.site.urls),
|
path("admin/", admin.site.urls),
|
||||||
path("api/v1/", api_v1.urls),
|
path("api/v1/", api_v1.urls),
|
||||||
path("api/legacy/", api_legacy.urls),
|
path("api/legacy/", api_legacy.urls),
|
||||||
path("o/", include("oauth2_provider.urls", namespace="oauth2_provider")),
|
path("o/", include("oauth2_provider.urls", namespace="oauth2_provider")),
|
||||||
]
|
]
|
||||||
|
|
||||||
if "migration" in s.INSTALLED_APPS:
|
|
||||||
urlpatterns.append(path("", include("migration.urls")))
|
|
||||||
|
|
||||||
if s.MS_ENTRA_ENABLED:
|
if s.MS_ENTRA_ENABLED:
|
||||||
urlpatterns.append(path("", include("epauth.urls")))
|
urlpatterns.append(path("", include("epauth.urls")))
|
||||||
|
|
||||||
# Custom error handlers
|
|
||||||
handler400 = "epdb.views.handler400"
|
|
||||||
handler403 = "epdb.views.handler403"
|
|
||||||
handler404 = "epdb.views.handler404"
|
|
||||||
handler500 = "epdb.views.handler500"
|
|
||||||
|
|||||||
@ -1,31 +1,29 @@
|
|||||||
from django.conf import settings as s
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from .models import (
|
from .models import (
|
||||||
Compound,
|
|
||||||
CompoundStructure,
|
|
||||||
Edge,
|
|
||||||
EnviFormer,
|
|
||||||
ExternalDatabase,
|
|
||||||
ExternalIdentifier,
|
|
||||||
Group,
|
|
||||||
GroupPackagePermission,
|
|
||||||
JobLog,
|
|
||||||
License,
|
|
||||||
MLRelativeReasoning,
|
|
||||||
Node,
|
|
||||||
ParallelRule,
|
|
||||||
Pathway,
|
|
||||||
Reaction,
|
|
||||||
Scenario,
|
|
||||||
Setting,
|
|
||||||
SimpleAmbitRule,
|
|
||||||
User,
|
User,
|
||||||
UserPackagePermission,
|
UserPackagePermission,
|
||||||
|
Group,
|
||||||
|
GroupPackagePermission,
|
||||||
|
Package,
|
||||||
|
MLRelativeReasoning,
|
||||||
|
EnviFormer,
|
||||||
|
Compound,
|
||||||
|
CompoundStructure,
|
||||||
|
SimpleAmbitRule,
|
||||||
|
ParallelRule,
|
||||||
|
Reaction,
|
||||||
|
Pathway,
|
||||||
|
Node,
|
||||||
|
Edge,
|
||||||
|
Scenario,
|
||||||
|
Setting,
|
||||||
|
ExternalDatabase,
|
||||||
|
ExternalIdentifier,
|
||||||
|
JobLog,
|
||||||
|
License,
|
||||||
)
|
)
|
||||||
|
|
||||||
Package = s.GET_PACKAGE_MODEL()
|
|
||||||
|
|
||||||
|
|
||||||
class UserAdmin(admin.ModelAdmin):
|
class UserAdmin(admin.ModelAdmin):
|
||||||
list_display = ["username", "email", "is_active"]
|
list_display = ["username", "email", "is_active"]
|
||||||
|
|||||||
@ -1,9 +1,4 @@
|
|||||||
import logging
|
|
||||||
|
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class EPDBConfig(AppConfig):
|
class EPDBConfig(AppConfig):
|
||||||
@ -12,6 +7,3 @@ class EPDBConfig(AppConfig):
|
|||||||
|
|
||||||
def ready(self):
|
def ready(self):
|
||||||
import epdb.signals # noqa: F401
|
import epdb.signals # noqa: F401
|
||||||
|
|
||||||
model_name = getattr(settings, "EPDB_PACKAGE_MODEL", "epdb.Package")
|
|
||||||
logger.info(f"Using Package model: {model_name}")
|
|
||||||
|
|||||||
@ -5,7 +5,7 @@ Context processors automatically make variables available to all templates.
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from .logic import PackageManager
|
from .logic import PackageManager
|
||||||
from django.conf import settings as s
|
from .models import Package
|
||||||
|
|
||||||
|
|
||||||
def package_context(request):
|
def package_context(request):
|
||||||
@ -20,7 +20,7 @@ def package_context(request):
|
|||||||
|
|
||||||
reviewed_package_qs = PackageManager.get_reviewed_packages()
|
reviewed_package_qs = PackageManager.get_reviewed_packages()
|
||||||
|
|
||||||
unreviewed_package_qs = s.GET_PACKAGE_MODEL().objects.none()
|
unreviewed_package_qs = Package.objects.none()
|
||||||
|
|
||||||
# Only get user-specific packages if user is authenticated
|
# Only get user-specific packages if user is authenticated
|
||||||
if current_user.is_authenticated:
|
if current_user.is_authenticated:
|
||||||
|
|||||||
@ -1,35 +1,27 @@
|
|||||||
from typing import Any, Dict, List, Optional
|
from typing import List, Dict, Optional, Any
|
||||||
|
|
||||||
import nh3
|
|
||||||
from django.conf import settings as s
|
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from ninja import Field, Form, Router, Schema, Query
|
from ninja import Router, Schema, Field, Form
|
||||||
from ninja.security import SessionAuth
|
|
||||||
|
|
||||||
from utilities.chem import FormatConverter
|
from utilities.chem import FormatConverter
|
||||||
from utilities.misc import PackageExporter
|
from .logic import PackageManager, UserManager, SettingManager
|
||||||
|
|
||||||
from .logic import GroupManager, PackageManager, SettingManager, UserManager, SearchManager
|
|
||||||
from .models import (
|
from .models import (
|
||||||
Compound,
|
Compound,
|
||||||
CompoundStructure,
|
CompoundStructure,
|
||||||
Edge,
|
Package,
|
||||||
EPModel,
|
|
||||||
Node,
|
|
||||||
Pathway,
|
|
||||||
Reaction,
|
|
||||||
Rule,
|
|
||||||
Scenario,
|
|
||||||
SimpleAmbitRule,
|
|
||||||
User,
|
User,
|
||||||
UserPackagePermission,
|
UserPackagePermission,
|
||||||
ParallelRule,
|
Rule,
|
||||||
|
Reaction,
|
||||||
|
Scenario,
|
||||||
|
Pathway,
|
||||||
|
Node,
|
||||||
|
Edge,
|
||||||
|
SimpleAmbitRule,
|
||||||
)
|
)
|
||||||
|
|
||||||
Package = s.GET_PACKAGE_MODEL()
|
|
||||||
|
|
||||||
|
|
||||||
def _anonymous_or_real(request):
|
def _anonymous_or_real(request):
|
||||||
if request.user.is_authenticated and not request.user.is_anonymous:
|
if request.user.is_authenticated and not request.user.is_anonymous:
|
||||||
@ -37,7 +29,8 @@ def _anonymous_or_real(request):
|
|||||||
return get_user_model().objects.get(username="anonymous")
|
return get_user_model().objects.get(username="anonymous")
|
||||||
|
|
||||||
|
|
||||||
router = Router(auth=SessionAuth(csrf=False))
|
# router = Router(auth=SessionAuth())
|
||||||
|
router = Router()
|
||||||
|
|
||||||
|
|
||||||
class Error(Schema):
|
class Error(Schema):
|
||||||
@ -125,16 +118,13 @@ class SimpleEdge(SimpleObject):
|
|||||||
identifier: str = "edge"
|
identifier: str = "edge"
|
||||||
|
|
||||||
|
|
||||||
class SimpleModel(SimpleObject):
|
|
||||||
identifier: str = "relative-reasoning"
|
|
||||||
|
|
||||||
|
|
||||||
################
|
################
|
||||||
# Login/Logout #
|
# Login/Logout #
|
||||||
################
|
################
|
||||||
@router.post("/", response={200: SimpleUser, 403: Error}, auth=None)
|
@router.post("/", response={200: SimpleUser, 403: Error})
|
||||||
def login(request, loginusername: Form[str], loginpassword: Form[str]):
|
def login(request, loginusername: Form[str], loginpassword: Form[str]):
|
||||||
from django.contrib.auth import authenticate, login
|
from django.contrib.auth import authenticate
|
||||||
|
from django.contrib.auth import login
|
||||||
|
|
||||||
email = User.objects.get(username=loginusername).email
|
email = User.objects.get(username=loginusername).email
|
||||||
user = authenticate(username=email, password=loginpassword)
|
user = authenticate(username=email, password=loginpassword)
|
||||||
@ -177,13 +167,9 @@ class UserSchema(Schema):
|
|||||||
return SettingManager.get_all_settings(obj)
|
return SettingManager.get_all_settings(obj)
|
||||||
|
|
||||||
|
|
||||||
class Me(Schema):
|
|
||||||
whoami: str | None = None
|
|
||||||
|
|
||||||
|
|
||||||
@router.get("/user", response={200: UserWrapper, 403: Error})
|
@router.get("/user", response={200: UserWrapper, 403: Error})
|
||||||
def get_users(request, me: Query[Me]):
|
def get_users(request, whoami: str = None):
|
||||||
if me.whoami:
|
if whoami:
|
||||||
return {"user": [request.user]}
|
return {"user": [request.user]}
|
||||||
else:
|
else:
|
||||||
return {"user": User.objects.all()}
|
return {"user": User.objects.all()}
|
||||||
@ -200,61 +186,6 @@ def get_user(request, user_uuid):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class Search(Schema):
|
|
||||||
packages: List[str] = Field(alias="packages[]")
|
|
||||||
search: str
|
|
||||||
method: str
|
|
||||||
|
|
||||||
|
|
||||||
@router.get("/search", response={200: Any, 403: Error})
|
|
||||||
def search(request, search: Query[Search]):
|
|
||||||
try:
|
|
||||||
packs = []
|
|
||||||
for package in search.packages:
|
|
||||||
packs.append(PackageManager.get_package_by_url(request.user, package))
|
|
||||||
|
|
||||||
method = None
|
|
||||||
|
|
||||||
if search.method == "text":
|
|
||||||
method = "text"
|
|
||||||
elif search.method == "inchikey":
|
|
||||||
method = "inchikey"
|
|
||||||
elif search.method == "defaultSmiles":
|
|
||||||
method = "default"
|
|
||||||
elif search.method == "canonicalSmiles":
|
|
||||||
method = "canonical"
|
|
||||||
elif search.method == "exactSmiles":
|
|
||||||
method = "exact"
|
|
||||||
|
|
||||||
if method is None:
|
|
||||||
raise ValueError(f"Search method {search.method} is not supported!")
|
|
||||||
|
|
||||||
search_res = SearchManager.search(packs, search.search, method)
|
|
||||||
res = {}
|
|
||||||
if "Compounds" in search_res:
|
|
||||||
res["compound"] = search_res["Compounds"]
|
|
||||||
|
|
||||||
if "Compound Structures" in search_res:
|
|
||||||
res["structure"] = search_res["Compound Structures"]
|
|
||||||
|
|
||||||
if "Reaction" in search_res:
|
|
||||||
res["reaction"] = search_res["Reaction"]
|
|
||||||
|
|
||||||
if "Pathway" in search_res:
|
|
||||||
res["pathway"] = search_res["Pathway"]
|
|
||||||
|
|
||||||
if "Rules" in search_res:
|
|
||||||
res["rule"] = search_res["Rules"]
|
|
||||||
|
|
||||||
for key in res:
|
|
||||||
for v in res[key]:
|
|
||||||
v["id"] = v["url"].replace("simple-ambit-rule", "simple-rule")
|
|
||||||
|
|
||||||
return res
|
|
||||||
except ValueError as e:
|
|
||||||
return 403, {"message": f"Search failed due to {e}"}
|
|
||||||
|
|
||||||
|
|
||||||
###########
|
###########
|
||||||
# Package #
|
# Package #
|
||||||
###########
|
###########
|
||||||
@ -320,110 +251,67 @@ def get_packages(request):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class GetPackage(Schema):
|
@router.get("/package/{uuid:package_uuid}", response={200: PackageSchema, 403: Error})
|
||||||
exportAsJson: str | None = None
|
def get_package(request, package_uuid):
|
||||||
|
|
||||||
|
|
||||||
@router.get("/package/{uuid:package_uuid}", response={200: PackageSchema | Any, 403: Error})
|
|
||||||
def get_package(request, package_uuid, gp: Query[GetPackage]):
|
|
||||||
try:
|
try:
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
return PackageManager.get_package_by_id(request.user, package_uuid)
|
||||||
|
|
||||||
if gp.exportAsJson and gp.exportAsJson.strip() == "true":
|
|
||||||
return PackageExporter(p).do_export()
|
|
||||||
|
|
||||||
return p
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return 403, {
|
return 403, {
|
||||||
"message": f"Getting Package with id {package_uuid} failed due to insufficient rights!"
|
"message": f"Getting Package with id {package_uuid} failed due to insufficient rights!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CreatePackage(Schema):
|
|
||||||
packageName: str
|
|
||||||
packageDescription: str | None = None
|
|
||||||
|
|
||||||
|
|
||||||
@router.post("/package")
|
@router.post("/package")
|
||||||
def create_packages(
|
def create_packages(
|
||||||
request,
|
request, packageName: Form[str], packageDescription: Optional[str] = Form(None)
|
||||||
p: Form[CreatePackage],
|
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
if p.packageName.strip() == "":
|
if packageName.strip() == "":
|
||||||
raise ValueError("Package name cannot be empty!")
|
raise ValueError("Package name cannot be empty!")
|
||||||
|
|
||||||
new_pacakge = PackageManager.create_package(
|
new_pacakge = PackageManager.create_package(request.user, packageName, packageDescription)
|
||||||
request.user, p.packageName, p.packageDescription
|
|
||||||
)
|
|
||||||
return redirect(new_pacakge.url)
|
return redirect(new_pacakge.url)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
return 400, {"message": str(e)}
|
return 400, {"message": str(e)}
|
||||||
|
|
||||||
|
|
||||||
class UpdatePackage(Schema):
|
|
||||||
packageDescription: str | None = None
|
|
||||||
hiddenMethod: str | None = None
|
|
||||||
permissions: str | None = None
|
|
||||||
ppsURI: str | None = None
|
|
||||||
read: str | None = None
|
|
||||||
write: str | None = None
|
|
||||||
|
|
||||||
|
|
||||||
@router.post("/package/{uuid:package_uuid}", response={200: PackageSchema | Any, 400: Error})
|
@router.post("/package/{uuid:package_uuid}", response={200: PackageSchema | Any, 400: Error})
|
||||||
def update_package(request, package_uuid, pack: Form[UpdatePackage]):
|
def update_package(
|
||||||
|
request,
|
||||||
|
package_uuid,
|
||||||
|
packageDescription: Optional[str] = Form(None),
|
||||||
|
hiddenMethod: Optional[str] = Form(None),
|
||||||
|
exportAsJson: Optional[str] = Form(None),
|
||||||
|
permissions: Optional[str] = Form(None),
|
||||||
|
ppsURI: Optional[str] = Form(None),
|
||||||
|
read: Optional[str] = Form(None),
|
||||||
|
write: Optional[str] = Form(None),
|
||||||
|
):
|
||||||
try:
|
try:
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
||||||
|
|
||||||
if pack.hiddenMethod:
|
if hiddenMethod:
|
||||||
if pack.hiddenMethod == "DELETE":
|
if hiddenMethod == "DELETE":
|
||||||
p.delete()
|
p.delete()
|
||||||
|
|
||||||
elif pack.packageDescription is not None:
|
elif packageDescription and packageDescription.strip() != "":
|
||||||
description = nh3.clean(pack.packageDescription, tags=s.ALLOWED_HTML_TAGS).strip()
|
p.description = packageDescription
|
||||||
|
|
||||||
if description:
|
|
||||||
p.description = description
|
|
||||||
p.save()
|
p.save()
|
||||||
return HttpResponse(status=200)
|
return
|
||||||
else:
|
elif exportAsJson == "true":
|
||||||
raise ValueError("Package description cannot be empty!")
|
pack_json = PackageManager.export_package(
|
||||||
elif all([pack.permissions, pack.ppsURI, pack.read]):
|
p, include_models=False, include_external_identifiers=False
|
||||||
if "group" in pack.ppsURI:
|
)
|
||||||
grantee = GroupManager.get_group_lp(pack.ppsURI)
|
return pack_json
|
||||||
else:
|
elif all([permissions, ppsURI, read]):
|
||||||
grantee = UserManager.get_user_lp(pack.ppsURI)
|
PackageManager.update_permissions
|
||||||
|
elif all([permissions, ppsURI, write]):
|
||||||
|
pass
|
||||||
|
|
||||||
PackageManager.grant_read(request.user, p, grantee)
|
|
||||||
return HttpResponse(status=200)
|
|
||||||
elif all([pack.permissions, pack.ppsURI, pack.write]):
|
|
||||||
if "group" in pack.ppsURI:
|
|
||||||
grantee = GroupManager.get_group_lp(pack.ppsURI)
|
|
||||||
else:
|
|
||||||
grantee = UserManager.get_user_lp(pack.ppsURI)
|
|
||||||
|
|
||||||
PackageManager.grant_write(request.user, p, grantee)
|
|
||||||
return HttpResponse(status=200)
|
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
return 400, {"message": str(e)}
|
return 400, {"message": str(e)}
|
||||||
|
|
||||||
|
|
||||||
@router.delete("/package/{uuid:package_uuid}")
|
|
||||||
def delete_package(request, package_uuid):
|
|
||||||
try:
|
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
|
||||||
|
|
||||||
if PackageManager.administrable(request.user, p):
|
|
||||||
p.delete()
|
|
||||||
return redirect(f"{s.SERVER_URL}/package")
|
|
||||||
else:
|
|
||||||
raise ValueError("You do not have the rights to delete this Package!")
|
|
||||||
except ValueError:
|
|
||||||
return 403, {
|
|
||||||
"message": f"Deleting Package with id {package_uuid} failed due to insufficient rights!"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
################################
|
################################
|
||||||
# Compound / CompoundStructure #
|
# Compound / CompoundStructure #
|
||||||
################################
|
################################
|
||||||
@ -621,83 +509,6 @@ def get_package_compound_structure(request, package_uuid, compound_uuid, structu
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CreateCompound(Schema):
|
|
||||||
compoundSmiles: str
|
|
||||||
compoundName: str | None = None
|
|
||||||
compoundDescription: str | None = None
|
|
||||||
inchi: str | None = None
|
|
||||||
|
|
||||||
|
|
||||||
@router.post("/package/{uuid:package_uuid}/compound")
|
|
||||||
def create_package_compound(
|
|
||||||
request,
|
|
||||||
package_uuid,
|
|
||||||
c: Form[CreateCompound],
|
|
||||||
):
|
|
||||||
try:
|
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
|
||||||
# inchi is not used atm
|
|
||||||
c = Compound.create(
|
|
||||||
p, c.compoundSmiles, c.compoundName, c.compoundDescription, inchi=c.inchi
|
|
||||||
)
|
|
||||||
return redirect(c.url)
|
|
||||||
except ValueError as e:
|
|
||||||
return 400, {"message": str(e)}
|
|
||||||
|
|
||||||
|
|
||||||
@router.delete("/package/{uuid:package_uuid}/compound/{uuid:compound_uuid}")
|
|
||||||
def delete_compound(request, package_uuid, compound_uuid):
|
|
||||||
try:
|
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
|
||||||
|
|
||||||
if PackageManager.writable(request.user, p):
|
|
||||||
c = Compound.objects.get(package=p, uuid=compound_uuid)
|
|
||||||
c.delete()
|
|
||||||
return redirect(f"{p.url}/compound")
|
|
||||||
else:
|
|
||||||
raise ValueError("You do not have the rights to delete this Compound!")
|
|
||||||
except ValueError:
|
|
||||||
return 403, {
|
|
||||||
"message": f"Deleting Compound with id {compound_uuid} failed due to insufficient rights!"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@router.delete(
|
|
||||||
"/package/{uuid:package_uuid}/compound/{uuid:compound_uuid}/structure/{uuid:structure_uuid}"
|
|
||||||
)
|
|
||||||
def delete_compound_structure(request, package_uuid, compound_uuid, structure_uuid):
|
|
||||||
try:
|
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
|
||||||
|
|
||||||
if PackageManager.writable(request.user, p):
|
|
||||||
c = Compound.objects.get(package=p, uuid=compound_uuid)
|
|
||||||
cs = CompoundStructure.objects.get(compound=c, uuid=structure_uuid)
|
|
||||||
|
|
||||||
# Check if we have to delete the compound as no structure is left
|
|
||||||
if len(cs.compound.structures.all()) == 1:
|
|
||||||
# This will delete the structure as well
|
|
||||||
c.delete()
|
|
||||||
return redirect(p.url + "/compound")
|
|
||||||
else:
|
|
||||||
if cs.normalized_structure:
|
|
||||||
c.delete()
|
|
||||||
return redirect(p.url + "/compound")
|
|
||||||
else:
|
|
||||||
if c.default_structure == cs:
|
|
||||||
cs.delete()
|
|
||||||
c.default_structure = c.structures.all().first()
|
|
||||||
return redirect(c.url + "/structure")
|
|
||||||
else:
|
|
||||||
cs.delete()
|
|
||||||
return redirect(c.url + "/structure")
|
|
||||||
else:
|
|
||||||
raise ValueError("You do not have the rights to delete this CompoundStructure!")
|
|
||||||
except ValueError:
|
|
||||||
return 403, {
|
|
||||||
"message": f"Deleting CompoundStructure with id {compound_uuid} failed due to insufficient rights!"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#########
|
#########
|
||||||
# Rules #
|
# Rules #
|
||||||
#########
|
#########
|
||||||
@ -861,73 +672,6 @@ def _get_package_rule(request, package_uuid, rule_uuid):
|
|||||||
|
|
||||||
|
|
||||||
# POST
|
# POST
|
||||||
class CreateSimpleRule(Schema):
|
|
||||||
smirks: str
|
|
||||||
name: str | None = None
|
|
||||||
description: str | None = None
|
|
||||||
reactantFilterSmarts: str | None = None
|
|
||||||
productFilterSmarts: str | None = None
|
|
||||||
immediate: str | None = None
|
|
||||||
rdkitrule: str | None = None
|
|
||||||
|
|
||||||
|
|
||||||
@router.post("/package/{uuid:package_uuid}/simple-rule")
|
|
||||||
def create_package_simple_rule(
|
|
||||||
request,
|
|
||||||
package_uuid,
|
|
||||||
r: Form[CreateSimpleRule],
|
|
||||||
):
|
|
||||||
try:
|
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
|
||||||
|
|
||||||
if r.rdkitrule and r.rdkitrule.strip() == "true":
|
|
||||||
raise ValueError("Not yet implemented!")
|
|
||||||
else:
|
|
||||||
sr = SimpleAmbitRule.create(
|
|
||||||
p, r.name, r.description, r.smirks, r.reactantFilterSmarts, r.productFilterSmarts
|
|
||||||
)
|
|
||||||
|
|
||||||
return redirect(sr.url)
|
|
||||||
|
|
||||||
except ValueError as e:
|
|
||||||
return 400, {"message": str(e)}
|
|
||||||
|
|
||||||
|
|
||||||
class CreateParallelRule(Schema):
|
|
||||||
simpleRules: str
|
|
||||||
name: str | None = None
|
|
||||||
description: str | None = None
|
|
||||||
reactantFilterSmarts: str | None = None
|
|
||||||
productFilterSmarts: str | None = None
|
|
||||||
immediate: str | None = None
|
|
||||||
|
|
||||||
|
|
||||||
@router.post("/package/{uuid:package_uuid}/parallel-rule")
|
|
||||||
def create_package_parallel_rule(
|
|
||||||
request,
|
|
||||||
package_uuid,
|
|
||||||
r: Form[CreateParallelRule],
|
|
||||||
):
|
|
||||||
try:
|
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
|
||||||
|
|
||||||
srs = SimpleRule.objects.filter(package=p, url__in=r.simpleRules)
|
|
||||||
|
|
||||||
if srs.count() != len(r.simpleRules):
|
|
||||||
raise ValueError(
|
|
||||||
f"Not all SimpleRules could be found in Package with id {package_uuid}!"
|
|
||||||
)
|
|
||||||
|
|
||||||
sr = ParallelRule.create(
|
|
||||||
p, list(srs), r.name, r.description, r.reactantFilterSmarts, r.productFilterSmarts
|
|
||||||
)
|
|
||||||
|
|
||||||
return redirect(sr.url)
|
|
||||||
|
|
||||||
except ValueError as e:
|
|
||||||
return 400, {"message": str(e)}
|
|
||||||
|
|
||||||
|
|
||||||
@router.post(
|
@router.post(
|
||||||
"/package/{uuid:package_uuid}/rule/{uuid:rule_uuid}", response={200: str | Any, 403: Error}
|
"/package/{uuid:package_uuid}/rule/{uuid:rule_uuid}", response={200: str | Any, 403: Error}
|
||||||
)
|
)
|
||||||
@ -977,41 +721,6 @@ def _post_package_rule(request, package_uuid, rule_uuid, compound: Form[str]):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@router.delete("/package/{uuid:package_uuid}/rule/{uuid:rule_uuid}")
|
|
||||||
def delete_rule(request, package_uuid, rule_uuid):
|
|
||||||
return _delete_rule(request, package_uuid, rule_uuid)
|
|
||||||
|
|
||||||
|
|
||||||
@router.delete(
|
|
||||||
"/package/{uuid:package_uuid}/simple-rule/{uuid:rule_uuid}",
|
|
||||||
)
|
|
||||||
def delete_simple_rule(request, package_uuid, rule_uuid):
|
|
||||||
return _delete_rule(request, package_uuid, rule_uuid)
|
|
||||||
|
|
||||||
|
|
||||||
@router.delete(
|
|
||||||
"/package/{uuid:package_uuid}/parallel-rule/{uuid:rule_uuid}",
|
|
||||||
)
|
|
||||||
def delete_parallel_rule(request, package_uuid, rule_uuid):
|
|
||||||
return _delete_rule(request, package_uuid, rule_uuid)
|
|
||||||
|
|
||||||
|
|
||||||
def _delete_rule(request, package_uuid, rule_uuid):
|
|
||||||
try:
|
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
|
||||||
|
|
||||||
if PackageManager.writable(request.user, p):
|
|
||||||
r = Rule.objects.get(package=p, uuid=rule_uuid)
|
|
||||||
r.delete()
|
|
||||||
return redirect(f"{p.url}/rule")
|
|
||||||
else:
|
|
||||||
raise ValueError("You do not have the rights to delete this Rule!")
|
|
||||||
except ValueError:
|
|
||||||
return 403, {
|
|
||||||
"message": f"Deleting Rule with id {rule_uuid} failed due to insufficient rights!"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
############
|
############
|
||||||
# Reaction #
|
# Reaction #
|
||||||
############
|
############
|
||||||
@ -1100,82 +809,6 @@ def get_package_reaction(request, package_uuid, reaction_uuid):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CreateReaction(Schema):
|
|
||||||
reactionName: str | None = None
|
|
||||||
reactionDescription: str | None = None
|
|
||||||
smirks: str | None = None
|
|
||||||
educt: str | None = None
|
|
||||||
product: str | None = None
|
|
||||||
rule: str | None = None
|
|
||||||
|
|
||||||
|
|
||||||
@router.post("/package/{uuid:package_uuid}/reaction")
|
|
||||||
def create_package_reaction(
|
|
||||||
request,
|
|
||||||
package_uuid,
|
|
||||||
r: Form[CreateReaction],
|
|
||||||
):
|
|
||||||
try:
|
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
|
||||||
|
|
||||||
if r.smirks is None and (r.educt is None or r.product is None):
|
|
||||||
raise ValueError("Either SMIRKS or educt/product must be provided")
|
|
||||||
|
|
||||||
if r.smirks is not None and (r.educt is not None and r.product is not None):
|
|
||||||
raise ValueError("SMIRKS and educt/product provided!")
|
|
||||||
|
|
||||||
rule = None
|
|
||||||
if r.rule:
|
|
||||||
try:
|
|
||||||
rule = Rule.objects.get(package=p, url=r.rule)
|
|
||||||
except Rule.DoesNotExist:
|
|
||||||
raise ValueError(f"Rule with id {r.rule} does not exist!")
|
|
||||||
|
|
||||||
if r.educt is not None:
|
|
||||||
try:
|
|
||||||
educt_cs = CompoundStructure.objects.get(compound__package=p, url=r.educt)
|
|
||||||
except CompoundStructure.DoesNotExist:
|
|
||||||
raise ValueError(f"Compound with id {r.educt} does not exist!")
|
|
||||||
|
|
||||||
try:
|
|
||||||
product_cs = CompoundStructure.objects.get(compound__package=p, url=r.product)
|
|
||||||
except CompoundStructure.DoesNotExist:
|
|
||||||
raise ValueError(f"Compound with id {r.product} does not exist!")
|
|
||||||
|
|
||||||
new_r = Reaction.create(
|
|
||||||
p, r.reactionName, r.reactionDescription, [educt_cs], [product_cs], rule
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
educts = r.smirks.split(">>")[0].split("\\.")
|
|
||||||
products = r.smirks.split(">>")[1].split("\\.")
|
|
||||||
|
|
||||||
new_r = Reaction.create(
|
|
||||||
p, r.reactionName, r.reactionDescription, educts, products, rule
|
|
||||||
)
|
|
||||||
|
|
||||||
return redirect(new_r.url)
|
|
||||||
|
|
||||||
except ValueError as e:
|
|
||||||
return 400, {"message": str(e)}
|
|
||||||
|
|
||||||
|
|
||||||
@router.delete("/package/{uuid:package_uuid}/reaction/{uuid:reaction_uuid}")
|
|
||||||
def delete_reaction(request, package_uuid, reaction_uuid):
|
|
||||||
try:
|
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
|
||||||
|
|
||||||
if PackageManager.writable(request.user, p):
|
|
||||||
r = Reaction.objects.get(package=p, uuid=reaction_uuid)
|
|
||||||
r.delete()
|
|
||||||
return redirect(f"{p.url}/reaction")
|
|
||||||
else:
|
|
||||||
raise ValueError("You do not have the rights to delete this Reaction!")
|
|
||||||
except ValueError:
|
|
||||||
return 403, {
|
|
||||||
"message": f"Deleting Reaction with id {reaction_uuid} failed due to insufficient rights!"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
############
|
############
|
||||||
# Scenario #
|
# Scenario #
|
||||||
############
|
############
|
||||||
@ -1190,7 +823,7 @@ class ScenarioSchema(Schema):
|
|||||||
description: str = Field(None, alias="description")
|
description: str = Field(None, alias="description")
|
||||||
id: str = Field(None, alias="url")
|
id: str = Field(None, alias="url")
|
||||||
identifier: str = "scenario"
|
identifier: str = "scenario"
|
||||||
linkedTo: List[Dict[str, str]] = Field([], alias="linked_to")
|
linkedTo: List[Dict[str, str]] = Field({}, alias="linked_to")
|
||||||
name: str = Field(None, alias="name")
|
name: str = Field(None, alias="name")
|
||||||
pathways: List["SimplePathway"] = Field([], alias="related_pathways")
|
pathways: List["SimplePathway"] = Field([], alias="related_pathways")
|
||||||
relatedScenarios: List[Dict[str, str]] = Field([], alias="related_scenarios")
|
relatedScenarios: List[Dict[str, str]] = Field([], alias="related_scenarios")
|
||||||
@ -1241,38 +874,6 @@ def get_package_scenario(request, package_uuid, scenario_uuid):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@router.delete("/package/{uuid:package_uuid}/scenario")
|
|
||||||
def delete_scenarios(request, package_uuid, scenario_uuid):
|
|
||||||
try:
|
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
|
||||||
|
|
||||||
if PackageManager.writable(request.user, p):
|
|
||||||
scens = Scenario.objects.filter(package=p)
|
|
||||||
scens.delete()
|
|
||||||
return redirect(f"{p.url}/scenario")
|
|
||||||
else:
|
|
||||||
raise ValueError("You do not have the rights to delete Scenarios!")
|
|
||||||
except ValueError:
|
|
||||||
return 403, {"message": "Deleting Scenarios failed due to insufficient rights!"}
|
|
||||||
|
|
||||||
|
|
||||||
@router.delete("/package/{uuid:package_uuid}/scenario/{uuid:scenario_uuid}")
|
|
||||||
def delete_scenario(request, package_uuid, scenario_uuid):
|
|
||||||
try:
|
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
|
||||||
|
|
||||||
if PackageManager.writable(request.user, p):
|
|
||||||
scen = Scenario.objects.get(package=p, uuid=scenario_uuid)
|
|
||||||
scen.delete()
|
|
||||||
return redirect(f"{p.url}/scenario")
|
|
||||||
else:
|
|
||||||
raise ValueError("You do not have the rights to delete this Scenario!")
|
|
||||||
except ValueError:
|
|
||||||
return 403, {
|
|
||||||
"message": f"Deleting Scenario with id {scenario_uuid} failed due to insufficient rights!"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
###########
|
###########
|
||||||
# Pathway #
|
# Pathway #
|
||||||
###########
|
###########
|
||||||
@ -1412,67 +1013,46 @@ def get_package_pathway(request, package_uuid, pathway_uuid):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CreatePathway(Schema):
|
|
||||||
smilesinput: str
|
|
||||||
name: str | None = None
|
|
||||||
description: str | None = None
|
|
||||||
rootOnly: str | None = None
|
|
||||||
selectedSetting: str | None = None
|
|
||||||
|
|
||||||
|
|
||||||
@router.post("/package/{uuid:package_uuid}/pathway")
|
@router.post("/package/{uuid:package_uuid}/pathway")
|
||||||
def create_pathway(
|
def create_pathway(
|
||||||
request,
|
request,
|
||||||
package_uuid,
|
package_uuid,
|
||||||
pw: Form[CreatePathway],
|
smilesinput: Form[str],
|
||||||
|
name: Optional[str] = Form(None),
|
||||||
|
description: Optional[str] = Form(None),
|
||||||
|
rootOnly: Optional[str] = Form(None),
|
||||||
|
selectedSetting: Optional[str] = Form(None),
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
||||||
|
|
||||||
stand_smiles = FormatConverter.standardize(pw.smilesinput.strip())
|
stand_smiles = FormatConverter.standardize(smilesinput.strip())
|
||||||
|
|
||||||
new_pw = Pathway.create(p, stand_smiles, name=pw.name, description=pw.description)
|
pw = Pathway.create(p, stand_smiles, name=name, description=description)
|
||||||
|
|
||||||
pw_mode = "predict"
|
pw_mode = "predict"
|
||||||
if pw.rootOnly and pw.rootOnly.strip() == "true":
|
if rootOnly and rootOnly == "true":
|
||||||
pw_mode = "build"
|
pw_mode = "build"
|
||||||
|
|
||||||
new_pw.kv.update({"mode": pw_mode})
|
pw.kv.update({"mode": pw_mode})
|
||||||
new_pw.save()
|
pw.save()
|
||||||
|
|
||||||
if pw_mode == "predict":
|
if pw_mode == "predict":
|
||||||
setting = request.user.prediction_settings()
|
setting = request.user.prediction_settings()
|
||||||
|
|
||||||
if pw.selectedSetting:
|
if selectedSetting:
|
||||||
setting = SettingManager.get_setting_by_url(request.user, pw.selectedSetting)
|
setting = SettingManager.get_setting_by_url(request.user, selectedSetting)
|
||||||
|
|
||||||
new_pw.setting = setting
|
pw.setting = setting
|
||||||
new_pw.save()
|
pw.save()
|
||||||
|
|
||||||
from .tasks import dispatch, predict
|
from .tasks import predict
|
||||||
|
|
||||||
dispatch(request.user, predict, new_pw.pk, setting.pk, limit=-1)
|
predict.delay(pw.pk, setting.pk, limit=-1)
|
||||||
|
|
||||||
return redirect(new_pw.url)
|
return redirect(pw.url)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
return 400, {"message": str(e)}
|
print(e)
|
||||||
|
|
||||||
|
|
||||||
@router.delete("/package/{uuid:package_uuid}/pathway/{uuid:pathway_uuid}")
|
|
||||||
def delete_pathway(request, package_uuid, pathway_uuid):
|
|
||||||
try:
|
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
|
||||||
|
|
||||||
if PackageManager.writable(request.user, p):
|
|
||||||
pw = Pathway.objects.get(package=p, uuid=pathway_uuid)
|
|
||||||
pw.delete()
|
|
||||||
return redirect(f"{p.url}/pathway")
|
|
||||||
else:
|
|
||||||
raise ValueError("You do not have the rights to delete this pathway!")
|
|
||||||
except ValueError:
|
|
||||||
return 403, {
|
|
||||||
"message": f"Deleting Pathway with id {pathway_uuid} failed due to insufficient rights!"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
########
|
########
|
||||||
@ -1563,52 +1143,6 @@ def get_package_pathway_node(request, package_uuid, pathway_uuid, node_uuid):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CreateNode(Schema):
|
|
||||||
nodeAsSmiles: str
|
|
||||||
nodeName: str | None = None
|
|
||||||
nodeReason: str | None = None
|
|
||||||
nodeDepth: str | None = None
|
|
||||||
|
|
||||||
|
|
||||||
@router.post(
|
|
||||||
"/package/{uuid:package_uuid}/pathway/{uuid:pathway_uuid}/node",
|
|
||||||
response={200: str | Any, 403: Error},
|
|
||||||
)
|
|
||||||
def add_pathway_node(request, package_uuid, pathway_uuid, n: Form[CreateNode]):
|
|
||||||
try:
|
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
|
||||||
pw = Pathway.objects.get(package=p, uuid=pathway_uuid)
|
|
||||||
|
|
||||||
if n.nodeDepth is not None and n.nodeDepth.strip() != "":
|
|
||||||
node_depth = int(n.nodeDepth)
|
|
||||||
else:
|
|
||||||
node_depth = -1
|
|
||||||
|
|
||||||
n = Node.create(pw, n.nodeAsSmiles, node_depth, n.nodeName, n.nodeReason)
|
|
||||||
|
|
||||||
return redirect(n.url)
|
|
||||||
except ValueError:
|
|
||||||
return 403, {"message": "Adding node failed!"}
|
|
||||||
|
|
||||||
|
|
||||||
@router.delete("/package/{uuid:package_uuid}/pathway/{uuid:pathway_uuid}/node/{uuid:node_uuid}")
|
|
||||||
def delete_node(request, package_uuid, pathway_uuid, node_uuid):
|
|
||||||
try:
|
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
|
||||||
|
|
||||||
if PackageManager.writable(request.user, p):
|
|
||||||
pw = Pathway.objects.get(package=p, uuid=pathway_uuid)
|
|
||||||
n = Node.objects.get(pathway=pw, uuid=node_uuid)
|
|
||||||
n.delete()
|
|
||||||
return redirect(f"{pw.url}/node")
|
|
||||||
else:
|
|
||||||
raise ValueError("You do not have the rights to delete this Node!")
|
|
||||||
except ValueError:
|
|
||||||
return 403, {
|
|
||||||
"message": f"Deleting Node with id {node_uuid} failed due to insufficient rights!"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
########
|
########
|
||||||
# Edge #
|
# Edge #
|
||||||
########
|
########
|
||||||
@ -1672,200 +1206,6 @@ def get_package_pathway_edge(request, package_uuid, pathway_uuid, edge_uuid):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CreateEdge(Schema):
|
|
||||||
edgeAsSmirks: str | None = None
|
|
||||||
educts: str | None = None # Node URIs comma sep
|
|
||||||
products: str | None = None # Node URIs comma sep
|
|
||||||
multistep: str | None = None
|
|
||||||
edgeReason: str | None = None
|
|
||||||
|
|
||||||
|
|
||||||
@router.post(
|
|
||||||
"/package/{uuid:package_uuid}/üathway/{uuid:pathway_uuid}/edge",
|
|
||||||
response={200: str | Any, 403: Error},
|
|
||||||
)
|
|
||||||
def add_pathway_edge(request, package_uuid, pathway_uuid, e: Form[CreateEdge]):
|
|
||||||
try:
|
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
|
||||||
pw = Pathway.objects.get(package=p, uuid=pathway_uuid)
|
|
||||||
|
|
||||||
if e.edgeAsSmirks is None and (e.educts is None or e.products is None):
|
|
||||||
raise ValueError("Either SMIRKS or educt/product must be provided")
|
|
||||||
|
|
||||||
if e.edgeAsSmirks is not None and (e.educts is not None and e.products is not None):
|
|
||||||
raise ValueError("SMIRKS and educt/product provided!")
|
|
||||||
|
|
||||||
educts = []
|
|
||||||
products = []
|
|
||||||
|
|
||||||
if e.edgeAsSmirks:
|
|
||||||
for ed in e.edgeAsSmirks.split(">>")[0].split("\\."):
|
|
||||||
educts.append(Node.objects.get(pathway=pw, default_node_label__smiles=ed))
|
|
||||||
|
|
||||||
for pr in e.edgeAsSmirks.split(">>")[1].split("\\."):
|
|
||||||
products.append(Node.objects.get(pathway=pw, default_node_label__smiles=pr))
|
|
||||||
else:
|
|
||||||
for ed in e.educts.split(","):
|
|
||||||
educts.append(Node.objects.get(pathway=pw, url=ed.strip()))
|
|
||||||
|
|
||||||
for pr in e.products.split(","):
|
|
||||||
products.append(Node.objects.get(pathway=pw, url=pr.strip()))
|
|
||||||
|
|
||||||
new_e = Edge.create(
|
|
||||||
pathway=pw,
|
|
||||||
start_nodes=educts,
|
|
||||||
end_nodes=products,
|
|
||||||
rule=None,
|
|
||||||
name=e.name,
|
|
||||||
description=e.edgeReason,
|
|
||||||
)
|
|
||||||
|
|
||||||
return redirect(new_e.url)
|
|
||||||
except ValueError:
|
|
||||||
return 403, {"message": "Adding node failed!"}
|
|
||||||
|
|
||||||
|
|
||||||
@router.delete("/package/{uuid:package_uuid}/pathway/{uuid:pathway_uuid}/edge/{uuid:edge_uuid}")
|
|
||||||
def delete_edge(request, package_uuid, pathway_uuid, edge_uuid):
|
|
||||||
try:
|
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
|
||||||
|
|
||||||
if PackageManager.writable(request.user, p):
|
|
||||||
pw = Pathway.objects.get(package=p, uuid=pathway_uuid)
|
|
||||||
e = Edge.objects.get(pathway=pw, uuid=edge_uuid)
|
|
||||||
e.delete()
|
|
||||||
return redirect(f"{pw.url}/edge")
|
|
||||||
else:
|
|
||||||
raise ValueError("You do not have the rights to delete this Edge!")
|
|
||||||
except ValueError:
|
|
||||||
return 403, {
|
|
||||||
"message": f"Deleting Edge with id {edge_uuid} failed due to insufficient rights!"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#########
|
|
||||||
# Model #
|
|
||||||
#########
|
|
||||||
class ModelWrapper(Schema):
|
|
||||||
relative_reasoning: List["SimpleModel"] = Field(..., alias="relative-reasoning")
|
|
||||||
|
|
||||||
|
|
||||||
class ModelSchema(Schema):
|
|
||||||
aliases: List[str] = Field([], alias="aliases")
|
|
||||||
description: str = Field(None, alias="description")
|
|
||||||
evalPackages: List["SimplePackage"] = Field([])
|
|
||||||
id: str = Field(None, alias="url")
|
|
||||||
identifier: str = "relative-reasoning"
|
|
||||||
# "info" : {
|
|
||||||
# "Accuracy (Single-Gen)" : "0.5932962678936605" ,
|
|
||||||
# "Area under PR-Curve (Single-Gen)" : "0.5654653182134282" ,
|
|
||||||
# "Area under ROC-Curve (Single-Gen)" : "0.8178302405034772" ,
|
|
||||||
# "Precision (Single-Gen)" : "0.6978730822873083" ,
|
|
||||||
# "Probability Threshold" : "0.5" ,
|
|
||||||
# "Recall/Sensitivity (Single-Gen)" : "0.4484149210261006"
|
|
||||||
# } ,
|
|
||||||
name: str = Field(None, alias="name")
|
|
||||||
pathwayPackages: List["SimplePackage"] = Field([])
|
|
||||||
reviewStatus: str = Field(None, alias="review_status")
|
|
||||||
rulePackages: List["SimplePackage"] = Field([])
|
|
||||||
scenarios: List["SimpleScenario"] = Field([], alias="scenarios")
|
|
||||||
status: str
|
|
||||||
statusMessage: str
|
|
||||||
threshold: str
|
|
||||||
type: str
|
|
||||||
|
|
||||||
|
|
||||||
@router.get("/model", response={200: ModelWrapper, 403: Error})
|
|
||||||
def get_models(request):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
@router.get("/package/{uuid:package_uuid}/model", response={200: ModelWrapper, 403: Error})
|
|
||||||
def get_package_models(request, package_uuid, model_uuid):
|
|
||||||
try:
|
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
|
||||||
return EPModel.objects.filter(package=p)
|
|
||||||
except ValueError:
|
|
||||||
return 403, {
|
|
||||||
"message": f"Getting Reaction with id {model_uuid} failed due to insufficient rights!"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class Classify(Schema):
|
|
||||||
smiles: str | None = None
|
|
||||||
|
|
||||||
|
|
||||||
@router.get(
|
|
||||||
"/package/{uuid:package_uuid}/model/{uuid:model_uuid}",
|
|
||||||
response={200: ModelSchema | Any, 403: Error, 400: Error},
|
|
||||||
)
|
|
||||||
def get_model(request, package_uuid, model_uuid, c: Query[Classify]):
|
|
||||||
try:
|
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
|
||||||
mod = EPModel.objects.get(package=p, uuid=model_uuid)
|
|
||||||
|
|
||||||
if c.smiles:
|
|
||||||
if c.smiles == "":
|
|
||||||
return 400, {"message": "Received empty SMILES"}
|
|
||||||
|
|
||||||
try:
|
|
||||||
stand_smiles = FormatConverter.standardize(c.smiles)
|
|
||||||
except ValueError:
|
|
||||||
return 400, {"message": f'"{c.smiles}" is not a valid SMILES'}
|
|
||||||
|
|
||||||
from epdb.tasks import dispatch_eager, predict_simple
|
|
||||||
|
|
||||||
pred_res = dispatch_eager(request.user, predict_simple, mod.pk, stand_smiles)
|
|
||||||
|
|
||||||
result = []
|
|
||||||
|
|
||||||
for pr in pred_res:
|
|
||||||
if len(pr) > 0:
|
|
||||||
products = []
|
|
||||||
for prod_set in pr.product_sets:
|
|
||||||
products.append(tuple([x for x in prod_set]))
|
|
||||||
|
|
||||||
res = {
|
|
||||||
"probability": pr.probability,
|
|
||||||
"products": list(set(products)),
|
|
||||||
}
|
|
||||||
|
|
||||||
if pr.rule:
|
|
||||||
res["id"] = pr.rule.url
|
|
||||||
res["identifier"] = pr.rule.get_rule_identifier()
|
|
||||||
res["name"] = pr.rule.name
|
|
||||||
res["reviewStatus"] = (
|
|
||||||
"reviewed" if pr.rule.package.reviewed else "unreviewed"
|
|
||||||
)
|
|
||||||
|
|
||||||
result.append(res)
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
return mod
|
|
||||||
except ValueError:
|
|
||||||
return 403, {
|
|
||||||
"message": f"Getting Reaction with id {model_uuid} failed due to insufficient rights!"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@router.delete("/package/{uuid:package_uuid}/model/{uuid:model_uuid}")
|
|
||||||
def delete_model(request, package_uuid, model_uuid):
|
|
||||||
try:
|
|
||||||
p = PackageManager.get_package_by_id(request.user, package_uuid)
|
|
||||||
|
|
||||||
if PackageManager.writable(request.user, p):
|
|
||||||
m = EPModel.objects.get(package=p, uuid=model_uuid)
|
|
||||||
m.delete()
|
|
||||||
return redirect(f"{p.url}/model")
|
|
||||||
else:
|
|
||||||
raise ValueError("You do not have the rights to delete this Model!")
|
|
||||||
except ValueError:
|
|
||||||
return 403, {
|
|
||||||
"message": f"Deleting Model with id {model_uuid} failed due to insufficient rights!"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
###########
|
###########
|
||||||
# Setting #
|
# Setting #
|
||||||
###########
|
###########
|
||||||
|
|||||||
@ -1,40 +1,39 @@
|
|||||||
import json
|
|
||||||
import logging
|
|
||||||
import re
|
import re
|
||||||
from typing import Any, Dict, List, Optional, Set, Union
|
import logging
|
||||||
|
import json
|
||||||
|
from typing import Union, List, Optional, Set, Dict, Any
|
||||||
from uuid import UUID
|
from uuid import UUID
|
||||||
|
|
||||||
import nh3
|
import nh3
|
||||||
from django.conf import settings as s
|
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
from django.conf import settings as s
|
||||||
from pydantic import ValidationError
|
from pydantic import ValidationError
|
||||||
|
|
||||||
from epdb.models import (
|
from epdb.models import (
|
||||||
Compound,
|
|
||||||
CompoundStructure,
|
|
||||||
Edge,
|
|
||||||
EnzymeLink,
|
|
||||||
EPModel,
|
|
||||||
Group,
|
|
||||||
GroupPackagePermission,
|
|
||||||
Node,
|
|
||||||
Pathway,
|
|
||||||
Permission,
|
|
||||||
Reaction,
|
|
||||||
Rule,
|
|
||||||
Setting,
|
|
||||||
User,
|
User,
|
||||||
|
Package,
|
||||||
UserPackagePermission,
|
UserPackagePermission,
|
||||||
|
GroupPackagePermission,
|
||||||
|
Permission,
|
||||||
|
Group,
|
||||||
|
Setting,
|
||||||
|
EPModel,
|
||||||
UserSettingPermission,
|
UserSettingPermission,
|
||||||
|
Rule,
|
||||||
|
Pathway,
|
||||||
|
Node,
|
||||||
|
Edge,
|
||||||
|
Compound,
|
||||||
|
Reaction,
|
||||||
|
CompoundStructure,
|
||||||
|
EnzymeLink,
|
||||||
)
|
)
|
||||||
from utilities.chem import FormatConverter
|
from utilities.chem import FormatConverter
|
||||||
from utilities.misc import PackageExporter, PackageImporter
|
from utilities.misc import PackageImporter, PackageExporter
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
Package = s.GET_PACKAGE_MODEL()
|
|
||||||
|
|
||||||
|
|
||||||
class EPDBURLParser:
|
class EPDBURLParser:
|
||||||
UUID_PATTERN = r"[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"
|
UUID_PATTERN = r"[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"
|
||||||
@ -579,39 +578,30 @@ class PackageManager(object):
|
|||||||
else:
|
else:
|
||||||
_ = perm_cls.objects.update_or_create(defaults={"permission": new_perm}, **data)
|
_ = perm_cls.objects.update_or_create(defaults={"permission": new_perm}, **data)
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def grant_read(caller: User, package: Package, grantee: Union[User, Group]):
|
|
||||||
PackageManager.update_permissions(caller, package, grantee, Permission.READ[0])
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def grant_write(caller: User, package: Package, grantee: Union[User, Group]):
|
|
||||||
PackageManager.update_permissions(caller, package, grantee, Permission.WRITE[0])
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def import_legacy_package(
|
def import_legacy_package(
|
||||||
data: dict, owner: User, keep_ids=False, add_import_timestamp=True, trust_reviewed=False
|
data: dict, owner: User, keep_ids=False, add_import_timestamp=True, trust_reviewed=False
|
||||||
):
|
):
|
||||||
from collections import defaultdict
|
|
||||||
from datetime import datetime
|
|
||||||
from uuid import UUID, uuid4
|
from uuid import UUID, uuid4
|
||||||
|
from datetime import datetime
|
||||||
from envipy_additional_information import AdditionalInformationConverter
|
from collections import defaultdict
|
||||||
|
|
||||||
from .models import (
|
from .models import (
|
||||||
|
Package,
|
||||||
Compound,
|
Compound,
|
||||||
CompoundStructure,
|
CompoundStructure,
|
||||||
Edge,
|
SimpleRule,
|
||||||
Node,
|
SimpleAmbitRule,
|
||||||
ParallelRule,
|
ParallelRule,
|
||||||
Pathway,
|
|
||||||
Reaction,
|
|
||||||
Scenario,
|
|
||||||
SequentialRule,
|
SequentialRule,
|
||||||
SequentialRuleOrdering,
|
SequentialRuleOrdering,
|
||||||
SimpleAmbitRule,
|
Reaction,
|
||||||
SimpleRule,
|
Pathway,
|
||||||
|
Node,
|
||||||
|
Edge,
|
||||||
|
Scenario,
|
||||||
)
|
)
|
||||||
|
from envipy_additional_information import AdditionalInformationConverter
|
||||||
|
|
||||||
pack = Package()
|
pack = Package()
|
||||||
pack.uuid = UUID(data["id"].split("/")[-1]) if keep_ids else uuid4()
|
pack.uuid = UUID(data["id"].split("/")[-1]) if keep_ids else uuid4()
|
||||||
|
|||||||
@ -2,9 +2,7 @@ from django.conf import settings as s
|
|||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
|
||||||
from epdb.models import EnviFormer, MLRelativeReasoning
|
from epdb.models import MLRelativeReasoning, EnviFormer, Package
|
||||||
|
|
||||||
Package = s.GET_PACKAGE_MODEL()
|
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
@ -77,13 +75,11 @@ class Command(BaseCommand):
|
|||||||
return packages
|
return packages
|
||||||
|
|
||||||
# Iteratively create models in options["model_names"]
|
# Iteratively create models in options["model_names"]
|
||||||
print(
|
print(f"Creating models: {options['model_names']}\n"
|
||||||
f"Creating models: {options['model_names']}\n"
|
|
||||||
f"Data packages: {options['data_packages']}\n"
|
f"Data packages: {options['data_packages']}\n"
|
||||||
f"Rule Packages (only for MLRR): {options['rule_packages']}\n"
|
f"Rule Packages (only for MLRR): {options['rule_packages']}\n"
|
||||||
f"Eval Packages: {options['eval_packages']}\n"
|
f"Eval Packages: {options['eval_packages']}\n"
|
||||||
f"Threshold: {options['threshold']:.2f}"
|
f"Threshold: {options['threshold']:.2f}")
|
||||||
)
|
|
||||||
data_packages = decode_packages(options["data_packages"])
|
data_packages = decode_packages(options["data_packages"])
|
||||||
eval_packages = decode_packages(options["eval_packages"])
|
eval_packages = decode_packages(options["eval_packages"])
|
||||||
rule_packages = decode_packages(options["rule_packages"])
|
rule_packages = decode_packages(options["rule_packages"])
|
||||||
@ -94,7 +90,7 @@ class Command(BaseCommand):
|
|||||||
pack,
|
pack,
|
||||||
data_packages=data_packages,
|
data_packages=data_packages,
|
||||||
eval_packages=eval_packages,
|
eval_packages=eval_packages,
|
||||||
threshold=options["threshold"],
|
threshold=options['threshold'],
|
||||||
name=f"EnviFormer - {', '.join(options['data_packages'])} - T{options['threshold']:.2f}",
|
name=f"EnviFormer - {', '.join(options['data_packages'])} - T{options['threshold']:.2f}",
|
||||||
description=f"EnviFormer transformer trained on {options['data_packages']} "
|
description=f"EnviFormer transformer trained on {options['data_packages']} "
|
||||||
f"evaluated on {options['eval_packages']}.",
|
f"evaluated on {options['eval_packages']}.",
|
||||||
@ -105,7 +101,7 @@ class Command(BaseCommand):
|
|||||||
rule_packages=rule_packages,
|
rule_packages=rule_packages,
|
||||||
data_packages=data_packages,
|
data_packages=data_packages,
|
||||||
eval_packages=eval_packages,
|
eval_packages=eval_packages,
|
||||||
threshold=options["threshold"],
|
threshold=options['threshold'],
|
||||||
name=f"ECC - {', '.join(options['data_packages'])} - T{options['threshold']:.2f}",
|
name=f"ECC - {', '.join(options['data_packages'])} - T{options['threshold']:.2f}",
|
||||||
description=f"ML Relative Reasoning trained on {options['data_packages']} with rules from "
|
description=f"ML Relative Reasoning trained on {options['data_packages']} with rules from "
|
||||||
f"{options['rule_packages']} and evaluated on {options['eval_packages']}.",
|
f"{options['rule_packages']} and evaluated on {options['eval_packages']}.",
|
||||||
|
|||||||
@ -8,9 +8,7 @@ from django.conf import settings as s
|
|||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
|
||||||
from epdb.models import EnviFormer
|
from epdb.models import EnviFormer, Package
|
||||||
|
|
||||||
Package = s.GET_PACKAGE_MODEL()
|
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
from django.conf import settings as s
|
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.db.models import F, JSONField, TextField, Value
|
|
||||||
from django.db.models.functions import Cast, Replace
|
from django.db.models import F, Value, TextField, JSONField
|
||||||
|
from django.db.models.functions import Replace, Cast
|
||||||
|
|
||||||
from epdb.models import EnviPathModel
|
from epdb.models import EnviPathModel
|
||||||
|
|
||||||
@ -23,13 +23,10 @@ class Command(BaseCommand):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
Package = s.GET_PACKAGE_MODEL()
|
|
||||||
print("Localizing urls for Package")
|
|
||||||
Package.objects.update(url=Replace(F("url"), Value(options["old"]), Value(options["new"])))
|
|
||||||
|
|
||||||
MODELS = [
|
MODELS = [
|
||||||
"User",
|
"User",
|
||||||
"Group",
|
"Group",
|
||||||
|
"Package",
|
||||||
"Compound",
|
"Compound",
|
||||||
"CompoundStructure",
|
"CompoundStructure",
|
||||||
"Pathway",
|
"Pathway",
|
||||||
|
|||||||
129
epdb/models.py
129
epdb/models.py
@ -2,41 +2,40 @@ import abc
|
|||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import math
|
|
||||||
import os
|
import os
|
||||||
import secrets
|
import secrets
|
||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Any, Dict, List, Optional, Set, Tuple, Union
|
from typing import Union, List, Optional, Dict, Tuple, Set, Any
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
import math
|
||||||
import joblib
|
import joblib
|
||||||
import nh3
|
import nh3
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from django.conf import settings as s
|
from django.conf import settings as s
|
||||||
from django.contrib.auth.models import AbstractUser
|
from django.contrib.auth.models import AbstractUser
|
||||||
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
|
from django.contrib.contenttypes.fields import GenericRelation, GenericForeignKey
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.contrib.postgres.fields import ArrayField
|
from django.contrib.postgres.fields import ArrayField
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
from django.db.models import Count, JSONField, Q, QuerySet
|
from django.db.models import JSONField, Count, Q, QuerySet
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.functional import cached_property
|
from django.utils.functional import cached_property
|
||||||
from envipy_additional_information import EnviPyModel
|
from envipy_additional_information import EnviPyModel
|
||||||
from model_utils.models import TimeStampedModel
|
from model_utils.models import TimeStampedModel
|
||||||
from polymorphic.models import PolymorphicModel
|
from polymorphic.models import PolymorphicModel
|
||||||
from sklearn.metrics import jaccard_score, precision_score, recall_score
|
from sklearn.metrics import precision_score, recall_score, jaccard_score
|
||||||
from sklearn.model_selection import ShuffleSplit
|
from sklearn.model_selection import ShuffleSplit
|
||||||
|
|
||||||
from utilities.chem import FormatConverter, IndigoUtils, PredictionResult, ProductSet
|
from utilities.chem import FormatConverter, ProductSet, PredictionResult, IndigoUtils
|
||||||
from utilities.ml import (
|
from utilities.ml import (
|
||||||
ApplicabilityDomainPCA,
|
|
||||||
Dataset,
|
|
||||||
EnsembleClassifierChain,
|
|
||||||
EnviFormerDataset,
|
|
||||||
RelativeReasoning,
|
|
||||||
RuleBasedDataset,
|
RuleBasedDataset,
|
||||||
|
ApplicabilityDomainPCA,
|
||||||
|
EnsembleClassifierChain,
|
||||||
|
RelativeReasoning,
|
||||||
|
EnviFormerDataset,
|
||||||
|
Dataset,
|
||||||
)
|
)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -45,6 +44,8 @@ logger = logging.getLogger(__name__)
|
|||||||
##########################
|
##########################
|
||||||
# User/Groups/Permission #
|
# User/Groups/Permission #
|
||||||
##########################
|
##########################
|
||||||
|
|
||||||
|
|
||||||
class User(AbstractUser):
|
class User(AbstractUser):
|
||||||
email = models.EmailField(unique=True)
|
email = models.EmailField(unique=True)
|
||||||
uuid = models.UUIDField(
|
uuid = models.UUIDField(
|
||||||
@ -52,10 +53,7 @@ class User(AbstractUser):
|
|||||||
)
|
)
|
||||||
url = models.TextField(blank=False, null=True, verbose_name="URL", unique=True)
|
url = models.TextField(blank=False, null=True, verbose_name="URL", unique=True)
|
||||||
default_package = models.ForeignKey(
|
default_package = models.ForeignKey(
|
||||||
s.EPDB_PACKAGE_MODEL,
|
"epdb.Package", verbose_name="Default Package", null=True, on_delete=models.SET_NULL
|
||||||
verbose_name="Default Package",
|
|
||||||
null=True,
|
|
||||||
on_delete=models.SET_NULL,
|
|
||||||
)
|
)
|
||||||
default_group = models.ForeignKey(
|
default_group = models.ForeignKey(
|
||||||
"Group",
|
"Group",
|
||||||
@ -245,7 +243,7 @@ class UserPackagePermission(Permission):
|
|||||||
)
|
)
|
||||||
user = models.ForeignKey("User", verbose_name="Permission to", on_delete=models.CASCADE)
|
user = models.ForeignKey("User", verbose_name="Permission to", on_delete=models.CASCADE)
|
||||||
package = models.ForeignKey(
|
package = models.ForeignKey(
|
||||||
s.EPDB_PACKAGE_MODEL, verbose_name="Permission on", on_delete=models.CASCADE
|
"epdb.Package", verbose_name="Permission on", on_delete=models.CASCADE
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@ -261,7 +259,7 @@ class GroupPackagePermission(Permission):
|
|||||||
)
|
)
|
||||||
group = models.ForeignKey("Group", verbose_name="Permission to", on_delete=models.CASCADE)
|
group = models.ForeignKey("Group", verbose_name="Permission to", on_delete=models.CASCADE)
|
||||||
package = models.ForeignKey(
|
package = models.ForeignKey(
|
||||||
s.EPDB_PACKAGE_MODEL, verbose_name="Permission on", on_delete=models.CASCADE
|
"epdb.Package", verbose_name="Permission on", on_delete=models.CASCADE
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@ -730,13 +728,10 @@ class Package(EnviPathModel):
|
|||||||
rules = sorted(rules, key=lambda x: x.url)
|
rules = sorted(rules, key=lambda x: x.url)
|
||||||
return rules
|
return rules
|
||||||
|
|
||||||
class Meta:
|
|
||||||
swappable = "EPDB_PACKAGE_MODEL"
|
|
||||||
|
|
||||||
|
|
||||||
class Compound(EnviPathModel, AliasMixin, ScenarioMixin, ChemicalIdentifierMixin):
|
class Compound(EnviPathModel, AliasMixin, ScenarioMixin, ChemicalIdentifierMixin):
|
||||||
package = models.ForeignKey(
|
package = models.ForeignKey(
|
||||||
s.EPDB_PACKAGE_MODEL, verbose_name="Package", on_delete=models.CASCADE, db_index=True
|
"epdb.Package", verbose_name="Package", on_delete=models.CASCADE, db_index=True
|
||||||
)
|
)
|
||||||
default_structure = models.ForeignKey(
|
default_structure = models.ForeignKey(
|
||||||
"CompoundStructure",
|
"CompoundStructure",
|
||||||
@ -786,7 +781,7 @@ class Compound(EnviPathModel, AliasMixin, ScenarioMixin, ChemicalIdentifierMixin
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def create(
|
def create(
|
||||||
package: "Package", smiles: str, name: str = None, description: str = None, *args, **kwargs
|
package: Package, smiles: str, name: str = None, description: str = None, *args, **kwargs
|
||||||
) -> "Compound":
|
) -> "Compound":
|
||||||
if smiles is None or smiles.strip() == "":
|
if smiles is None or smiles.strip() == "":
|
||||||
raise ValueError("SMILES is required")
|
raise ValueError("SMILES is required")
|
||||||
@ -1066,7 +1061,7 @@ class EnzymeLink(EnviPathModel, KEGGIdentifierMixin):
|
|||||||
|
|
||||||
class Rule(PolymorphicModel, EnviPathModel, AliasMixin, ScenarioMixin):
|
class Rule(PolymorphicModel, EnviPathModel, AliasMixin, ScenarioMixin):
|
||||||
package = models.ForeignKey(
|
package = models.ForeignKey(
|
||||||
s.EPDB_PACKAGE_MODEL, verbose_name="Package", on_delete=models.CASCADE, db_index=True
|
"epdb.Package", verbose_name="Package", on_delete=models.CASCADE, db_index=True
|
||||||
)
|
)
|
||||||
|
|
||||||
# # https://github.com/django-polymorphic/django-polymorphic/issues/229
|
# # https://github.com/django-polymorphic/django-polymorphic/issues/229
|
||||||
@ -1079,10 +1074,6 @@ class Rule(PolymorphicModel, EnviPathModel, AliasMixin, ScenarioMixin):
|
|||||||
def apply(self, *args, **kwargs):
|
def apply(self, *args, **kwargs):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@abc.abstractmethod
|
|
||||||
def get_rule_identifier(self) -> str:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def cls_for_type(rule_type: str):
|
def cls_for_type(rule_type: str):
|
||||||
if rule_type == "SimpleAmbitRule":
|
if rule_type == "SimpleAmbitRule":
|
||||||
@ -1176,7 +1167,7 @@ class SimpleAmbitRule(SimpleRule):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def create(
|
def create(
|
||||||
package: "Package",
|
package: Package,
|
||||||
name: str = None,
|
name: str = None,
|
||||||
description: str = None,
|
description: str = None,
|
||||||
smirks: str = None,
|
smirks: str = None,
|
||||||
@ -1237,9 +1228,6 @@ class SimpleAmbitRule(SimpleRule):
|
|||||||
def _url(self):
|
def _url(self):
|
||||||
return "{}/simple-ambit-rule/{}".format(self.package.url, self.uuid)
|
return "{}/simple-ambit-rule/{}".format(self.package.url, self.uuid)
|
||||||
|
|
||||||
def get_rule_identifier(self) -> str:
|
|
||||||
return "simple-rule"
|
|
||||||
|
|
||||||
def apply(self, smiles):
|
def apply(self, smiles):
|
||||||
return FormatConverter.apply(smiles, self.smirks)
|
return FormatConverter.apply(smiles, self.smirks)
|
||||||
|
|
||||||
@ -1253,7 +1241,7 @@ class SimpleAmbitRule(SimpleRule):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def related_reactions(self):
|
def related_reactions(self):
|
||||||
qs = s.GET_PACKAGE_MODEL().objects.filter(reviewed=True)
|
qs = Package.objects.filter(reviewed=True)
|
||||||
return self.reaction_rule.filter(package__in=qs).order_by("name")
|
return self.reaction_rule.filter(package__in=qs).order_by("name")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -1285,9 +1273,6 @@ class ParallelRule(Rule):
|
|||||||
def _url(self):
|
def _url(self):
|
||||||
return "{}/parallel-rule/{}".format(self.package.url, self.uuid)
|
return "{}/parallel-rule/{}".format(self.package.url, self.uuid)
|
||||||
|
|
||||||
def get_rule_identifier(self) -> str:
|
|
||||||
return "parallel-rule"
|
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def srs(self) -> QuerySet:
|
def srs(self) -> QuerySet:
|
||||||
return self.simple_rules.all()
|
return self.simple_rules.all()
|
||||||
@ -1319,57 +1304,6 @@ class ParallelRule(Rule):
|
|||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
@transaction.atomic
|
|
||||||
def create(
|
|
||||||
package: "Package",
|
|
||||||
simple_rules: List["SimpleRule"],
|
|
||||||
name: str = None,
|
|
||||||
description: str = None,
|
|
||||||
reactant_filter_smarts: str = None,
|
|
||||||
product_filter_smarts: str = None,
|
|
||||||
):
|
|
||||||
if len(simple_rules) == 0:
|
|
||||||
raise ValueError("At least one simple rule is required!")
|
|
||||||
|
|
||||||
for sr in simple_rules:
|
|
||||||
if sr.package != package:
|
|
||||||
raise ValueError(
|
|
||||||
f"Simple rule {sr.uuid} does not belong to package {package.uuid}!"
|
|
||||||
)
|
|
||||||
|
|
||||||
r = ParallelRule()
|
|
||||||
r.package = package
|
|
||||||
|
|
||||||
if name is not None:
|
|
||||||
name = nh3.clean(name, tags=s.ALLOWED_HTML_TAGS).strip()
|
|
||||||
|
|
||||||
if name is None or name == "":
|
|
||||||
name = f"Rule {Rule.objects.filter(package=package).count() + 1}"
|
|
||||||
|
|
||||||
r.name = name
|
|
||||||
if description is not None and description.strip() != "":
|
|
||||||
r.description = nh3.clean(description, tags=s.ALLOWED_HTML_TAGS).strip()
|
|
||||||
|
|
||||||
if reactant_filter_smarts is not None and reactant_filter_smarts.strip() != "":
|
|
||||||
if not FormatConverter.is_valid_smarts(reactant_filter_smarts.strip()):
|
|
||||||
raise ValueError(f'Reactant Filter SMARTS "{reactant_filter_smarts}" is invalid!')
|
|
||||||
else:
|
|
||||||
r.reactant_filter_smarts = reactant_filter_smarts.strip()
|
|
||||||
|
|
||||||
if product_filter_smarts is not None and product_filter_smarts.strip() != "":
|
|
||||||
if not FormatConverter.is_valid_smarts(product_filter_smarts.strip()):
|
|
||||||
raise ValueError(f'Product Filter SMARTS "{product_filter_smarts}" is invalid!')
|
|
||||||
else:
|
|
||||||
r.product_filter_smarts = product_filter_smarts.strip()
|
|
||||||
|
|
||||||
r.save()
|
|
||||||
|
|
||||||
for sr in simple_rules:
|
|
||||||
r.simple_rules.add(sr)
|
|
||||||
|
|
||||||
return r
|
|
||||||
|
|
||||||
|
|
||||||
class SequentialRule(Rule):
|
class SequentialRule(Rule):
|
||||||
simple_rules = models.ManyToManyField(
|
simple_rules = models.ManyToManyField(
|
||||||
@ -1379,9 +1313,6 @@ class SequentialRule(Rule):
|
|||||||
def _url(self):
|
def _url(self):
|
||||||
return "{}/sequential-rule/{}".format(self.compound.url, self.uuid)
|
return "{}/sequential-rule/{}".format(self.compound.url, self.uuid)
|
||||||
|
|
||||||
def get_rule_identifier(self) -> str:
|
|
||||||
return "sequential-rule"
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def srs(self):
|
def srs(self):
|
||||||
return self.simple_rules.all()
|
return self.simple_rules.all()
|
||||||
@ -1402,7 +1333,7 @@ class SequentialRuleOrdering(models.Model):
|
|||||||
|
|
||||||
class Reaction(EnviPathModel, AliasMixin, ScenarioMixin, ReactionIdentifierMixin):
|
class Reaction(EnviPathModel, AliasMixin, ScenarioMixin, ReactionIdentifierMixin):
|
||||||
package = models.ForeignKey(
|
package = models.ForeignKey(
|
||||||
s.EPDB_PACKAGE_MODEL, verbose_name="Package", on_delete=models.CASCADE, db_index=True
|
"epdb.Package", verbose_name="Package", on_delete=models.CASCADE, db_index=True
|
||||||
)
|
)
|
||||||
educts = models.ManyToManyField(
|
educts = models.ManyToManyField(
|
||||||
"epdb.CompoundStructure", verbose_name="Educts", related_name="reaction_educts"
|
"epdb.CompoundStructure", verbose_name="Educts", related_name="reaction_educts"
|
||||||
@ -1424,7 +1355,7 @@ class Reaction(EnviPathModel, AliasMixin, ScenarioMixin, ReactionIdentifierMixin
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def create(
|
def create(
|
||||||
package: "Package",
|
package: Package,
|
||||||
name: str = None,
|
name: str = None,
|
||||||
description: str = None,
|
description: str = None,
|
||||||
educts: Union[List[str], List[CompoundStructure]] = None,
|
educts: Union[List[str], List[CompoundStructure]] = None,
|
||||||
@ -1583,7 +1514,7 @@ class Reaction(EnviPathModel, AliasMixin, ScenarioMixin, ReactionIdentifierMixin
|
|||||||
|
|
||||||
class Pathway(EnviPathModel, AliasMixin, ScenarioMixin):
|
class Pathway(EnviPathModel, AliasMixin, ScenarioMixin):
|
||||||
package = models.ForeignKey(
|
package = models.ForeignKey(
|
||||||
s.EPDB_PACKAGE_MODEL, verbose_name="Package", on_delete=models.CASCADE, db_index=True
|
"epdb.Package", verbose_name="Package", on_delete=models.CASCADE, db_index=True
|
||||||
)
|
)
|
||||||
setting = models.ForeignKey(
|
setting = models.ForeignKey(
|
||||||
"epdb.Setting", verbose_name="Setting", on_delete=models.CASCADE, null=True, blank=True
|
"epdb.Setting", verbose_name="Setting", on_delete=models.CASCADE, null=True, blank=True
|
||||||
@ -2145,7 +2076,7 @@ class Edge(EnviPathModel, AliasMixin, ScenarioMixin):
|
|||||||
|
|
||||||
class EPModel(PolymorphicModel, EnviPathModel):
|
class EPModel(PolymorphicModel, EnviPathModel):
|
||||||
package = models.ForeignKey(
|
package = models.ForeignKey(
|
||||||
s.EPDB_PACKAGE_MODEL, verbose_name="Package", on_delete=models.CASCADE, db_index=True
|
"epdb.Package", verbose_name="Package", on_delete=models.CASCADE, db_index=True
|
||||||
)
|
)
|
||||||
|
|
||||||
def _url(self):
|
def _url(self):
|
||||||
@ -2154,17 +2085,17 @@ class EPModel(PolymorphicModel, EnviPathModel):
|
|||||||
|
|
||||||
class PackageBasedModel(EPModel):
|
class PackageBasedModel(EPModel):
|
||||||
rule_packages = models.ManyToManyField(
|
rule_packages = models.ManyToManyField(
|
||||||
s.EPDB_PACKAGE_MODEL,
|
"Package",
|
||||||
verbose_name="Rule Packages",
|
verbose_name="Rule Packages",
|
||||||
related_name="%(app_label)s_%(class)s_rule_packages",
|
related_name="%(app_label)s_%(class)s_rule_packages",
|
||||||
)
|
)
|
||||||
data_packages = models.ManyToManyField(
|
data_packages = models.ManyToManyField(
|
||||||
s.EPDB_PACKAGE_MODEL,
|
"Package",
|
||||||
verbose_name="Data Packages",
|
verbose_name="Data Packages",
|
||||||
related_name="%(app_label)s_%(class)s_data_packages",
|
related_name="%(app_label)s_%(class)s_data_packages",
|
||||||
)
|
)
|
||||||
eval_packages = models.ManyToManyField(
|
eval_packages = models.ManyToManyField(
|
||||||
s.EPDB_PACKAGE_MODEL,
|
"Package",
|
||||||
verbose_name="Evaluation Packages",
|
verbose_name="Evaluation Packages",
|
||||||
related_name="%(app_label)s_%(class)s_eval_packages",
|
related_name="%(app_label)s_%(class)s_eval_packages",
|
||||||
)
|
)
|
||||||
@ -3469,7 +3400,7 @@ class PluginModel(EPModel):
|
|||||||
|
|
||||||
class Scenario(EnviPathModel):
|
class Scenario(EnviPathModel):
|
||||||
package = models.ForeignKey(
|
package = models.ForeignKey(
|
||||||
s.EPDB_PACKAGE_MODEL, verbose_name="Package", on_delete=models.CASCADE, db_index=True
|
"epdb.Package", verbose_name="Package", on_delete=models.CASCADE, db_index=True
|
||||||
)
|
)
|
||||||
scenario_date = models.CharField(max_length=256, null=False, blank=False, default="No date")
|
scenario_date = models.CharField(max_length=256, null=False, blank=False, default="No date")
|
||||||
scenario_type = models.CharField(
|
scenario_type = models.CharField(
|
||||||
@ -3624,7 +3555,7 @@ class Setting(EnviPathModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
rule_packages = models.ManyToManyField(
|
rule_packages = models.ManyToManyField(
|
||||||
s.EPDB_PACKAGE_MODEL,
|
"Package",
|
||||||
verbose_name="Setting Rule Packages",
|
verbose_name="Setting Rule Packages",
|
||||||
related_name="setting_rule_packages",
|
related_name="setting_rule_packages",
|
||||||
blank=True,
|
blank=True,
|
||||||
|
|||||||
@ -1,22 +1,19 @@
|
|||||||
import csv
|
import csv
|
||||||
import io
|
import io
|
||||||
import logging
|
import logging
|
||||||
|
from datetime import datetime
|
||||||
from typing import Any, Callable, List, Optional
|
from typing import Any, Callable, List, Optional
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
from celery import shared_task
|
from celery import shared_task
|
||||||
from celery.utils.functional import LRUCache
|
from celery.utils.functional import LRUCache
|
||||||
from django.conf import settings as s
|
|
||||||
from django.utils import timezone
|
|
||||||
|
|
||||||
from epdb.logic import SPathway
|
from epdb.logic import SPathway
|
||||||
from epdb.models import Edge, EPModel, JobLog, Node, Pathway, Rule, Setting, User
|
from epdb.models import EPModel, JobLog, Node, Package, Pathway, Rule, Setting, User, Edge
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
ML_CACHE = LRUCache(3) # Cache the three most recent ML models to reduce load times.
|
ML_CACHE = LRUCache(3) # Cache the three most recent ML models to reduce load times.
|
||||||
|
|
||||||
Package = s.GET_PACKAGE_MODEL()
|
|
||||||
|
|
||||||
|
|
||||||
def get_ml_model(model_pk: int):
|
def get_ml_model(model_pk: int):
|
||||||
if model_pk not in ML_CACHE:
|
if model_pk not in ML_CACHE:
|
||||||
@ -32,7 +29,7 @@ def dispatch_eager(user: "User", job: Callable, *args, **kwargs):
|
|||||||
log.task_id = uuid4()
|
log.task_id = uuid4()
|
||||||
log.job_name = job.__name__
|
log.job_name = job.__name__
|
||||||
log.status = "SUCCESS"
|
log.status = "SUCCESS"
|
||||||
log.done_at = timezone.now()
|
log.done_at = datetime.now()
|
||||||
log.task_result = str(x) if x else None
|
log.task_result = str(x) if x else None
|
||||||
log.save()
|
log.save()
|
||||||
|
|
||||||
|
|||||||
@ -142,11 +142,6 @@ urlpatterns = [
|
|||||||
v.package_pathway,
|
v.package_pathway,
|
||||||
name="package pathway detail",
|
name="package pathway detail",
|
||||||
),
|
),
|
||||||
re_path(
|
|
||||||
rf"^package/(?P<package_uuid>{UUID})/predict$",
|
|
||||||
v.package_predict_pathway,
|
|
||||||
name="package predict pathway",
|
|
||||||
),
|
|
||||||
# Pathway Nodes
|
# Pathway Nodes
|
||||||
re_path(
|
re_path(
|
||||||
rf"^package/(?P<package_uuid>{UUID})/pathway/(?P<pathway_uuid>{UUID})/node$",
|
rf"^package/(?P<package_uuid>{UUID})/pathway/(?P<pathway_uuid>{UUID})/node$",
|
||||||
|
|||||||
150
epdb/views.py
150
epdb/views.py
@ -1,60 +1,58 @@
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, Dict, List
|
from typing import List, Dict, Any
|
||||||
|
|
||||||
import nh3
|
|
||||||
from django.conf import settings as s
|
from django.conf import settings as s
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.http import HttpResponse, HttpResponseBadRequest, HttpResponseNotAllowed, JsonResponse
|
from django.http import JsonResponse, HttpResponse, HttpResponseNotAllowed, HttpResponseBadRequest
|
||||||
from django.shortcuts import redirect, render
|
from django.shortcuts import render, redirect
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from envipy_additional_information import NAME_MAPPING
|
from envipy_additional_information import NAME_MAPPING
|
||||||
from oauth2_provider.decorators import protected_resource
|
from oauth2_provider.decorators import protected_resource
|
||||||
|
import nh3
|
||||||
|
|
||||||
from utilities.chem import FormatConverter, IndigoUtils
|
from utilities.chem import FormatConverter, IndigoUtils
|
||||||
from utilities.decorators import package_permission_required
|
from utilities.decorators import package_permission_required
|
||||||
from utilities.misc import HTMLGenerator
|
from utilities.misc import HTMLGenerator
|
||||||
|
|
||||||
from .logic import (
|
from .logic import (
|
||||||
EPDBURLParser,
|
|
||||||
GroupManager,
|
GroupManager,
|
||||||
PackageManager,
|
PackageManager,
|
||||||
SearchManager,
|
|
||||||
SettingManager,
|
|
||||||
UserManager,
|
UserManager,
|
||||||
|
SettingManager,
|
||||||
|
SearchManager,
|
||||||
|
EPDBURLParser,
|
||||||
)
|
)
|
||||||
from .models import (
|
from .models import (
|
||||||
APIToken,
|
Package,
|
||||||
Compound,
|
|
||||||
CompoundStructure,
|
|
||||||
Edge,
|
|
||||||
EnviFormer,
|
|
||||||
EnzymeLink,
|
|
||||||
EPModel,
|
|
||||||
ExternalDatabase,
|
|
||||||
ExternalIdentifier,
|
|
||||||
Group,
|
|
||||||
GroupPackagePermission,
|
GroupPackagePermission,
|
||||||
JobLog,
|
Group,
|
||||||
License,
|
CompoundStructure,
|
||||||
MLRelativeReasoning,
|
Compound,
|
||||||
Node,
|
|
||||||
Pathway,
|
|
||||||
Permission,
|
|
||||||
Reaction,
|
Reaction,
|
||||||
Rule,
|
Rule,
|
||||||
|
Pathway,
|
||||||
|
Node,
|
||||||
|
EPModel,
|
||||||
|
EnviFormer,
|
||||||
|
MLRelativeReasoning,
|
||||||
RuleBasedRelativeReasoning,
|
RuleBasedRelativeReasoning,
|
||||||
Scenario,
|
Scenario,
|
||||||
SimpleAmbitRule,
|
SimpleAmbitRule,
|
||||||
User,
|
APIToken,
|
||||||
UserPackagePermission,
|
UserPackagePermission,
|
||||||
|
Permission,
|
||||||
|
License,
|
||||||
|
User,
|
||||||
|
Edge,
|
||||||
|
ExternalDatabase,
|
||||||
|
ExternalIdentifier,
|
||||||
|
EnzymeLink,
|
||||||
|
JobLog,
|
||||||
)
|
)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
Package = s.GET_PACKAGE_MODEL()
|
|
||||||
|
|
||||||
|
|
||||||
def log_post_params(request):
|
def log_post_params(request):
|
||||||
if s.DEBUG:
|
if s.DEBUG:
|
||||||
@ -62,26 +60,6 @@ def log_post_params(request):
|
|||||||
logger.debug(f"{k}\t{v}")
|
logger.debug(f"{k}\t{v}")
|
||||||
|
|
||||||
|
|
||||||
def get_error_handler_context(request, for_user=None) -> Dict[str, Any]:
|
|
||||||
current_user = _anonymous_or_real(request)
|
|
||||||
|
|
||||||
if for_user:
|
|
||||||
current_user = for_user
|
|
||||||
|
|
||||||
ctx = {
|
|
||||||
"title": "enviPath",
|
|
||||||
"meta": {
|
|
||||||
"site_id": s.MATOMO_SITE_ID,
|
|
||||||
"version": "0.0.1",
|
|
||||||
"server_url": s.SERVER_URL,
|
|
||||||
"user": current_user,
|
|
||||||
"enabled_features": s.FLAGS,
|
|
||||||
"debug": s.DEBUG,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return ctx
|
|
||||||
|
|
||||||
|
|
||||||
def error(request, message: str, detail: str, code: int = 400):
|
def error(request, message: str, detail: str, code: int = 400):
|
||||||
context = get_base_context(request)
|
context = get_base_context(request)
|
||||||
error_context = {
|
error_context = {
|
||||||
@ -96,48 +74,6 @@ def error(request, message: str, detail: str, code: int = 400):
|
|||||||
return render(request, "errors/error.html", context, status=code)
|
return render(request, "errors/error.html", context, status=code)
|
||||||
|
|
||||||
|
|
||||||
def handler400(request, exception):
|
|
||||||
"""Custom 400 Bad Request error handler"""
|
|
||||||
context = get_error_handler_context(request)
|
|
||||||
context["public_mode"] = True
|
|
||||||
return render(request, "errors/400_bad_request.html", context, status=400)
|
|
||||||
|
|
||||||
|
|
||||||
def handler403(request, exception):
|
|
||||||
"""Custom 403 Forbidden error handler"""
|
|
||||||
context = get_error_handler_context(request)
|
|
||||||
context["public_mode"] = True
|
|
||||||
return render(request, "errors/403_access_denied.html", context, status=403)
|
|
||||||
|
|
||||||
|
|
||||||
def handler404(request, exception):
|
|
||||||
"""Custom 404 Not Found error handler"""
|
|
||||||
context = get_error_handler_context(request)
|
|
||||||
context["public_mode"] = True
|
|
||||||
return render(request, "errors/404_not_found.html", context, status=404)
|
|
||||||
|
|
||||||
|
|
||||||
def handler500(request):
|
|
||||||
"""Custom 500 Internal Server Error handler"""
|
|
||||||
context = get_error_handler_context(request)
|
|
||||||
|
|
||||||
error_context = {}
|
|
||||||
error_context["error_message"] = "Internal Server Error"
|
|
||||||
error_context["error_detail"] = "An unexpected error occurred. Please try again later."
|
|
||||||
|
|
||||||
if request.headers.get("Accept") == "application/json":
|
|
||||||
return JsonResponse(error_context, status=500)
|
|
||||||
|
|
||||||
context["public_mode"] = True
|
|
||||||
context["error_code"] = 500
|
|
||||||
context["error_description"] = (
|
|
||||||
"We encountered an unexpected error while processing your request. Our team has been notified and is working to resolve the issue."
|
|
||||||
)
|
|
||||||
context.update(**error_context)
|
|
||||||
|
|
||||||
return render(request, "errors/error.html", context, status=500)
|
|
||||||
|
|
||||||
|
|
||||||
def login(request):
|
def login(request):
|
||||||
context = get_base_context(request)
|
context = get_base_context(request)
|
||||||
|
|
||||||
@ -147,7 +83,8 @@ def login(request):
|
|||||||
return render(request, "static/login.html", context)
|
return render(request, "static/login.html", context)
|
||||||
|
|
||||||
elif request.method == "POST":
|
elif request.method == "POST":
|
||||||
from django.contrib.auth import authenticate, login
|
from django.contrib.auth import authenticate
|
||||||
|
from django.contrib.auth import login
|
||||||
|
|
||||||
username = request.POST.get("username").strip()
|
username = request.POST.get("username").strip()
|
||||||
if username != request.POST.get("username"):
|
if username != request.POST.get("username"):
|
||||||
@ -254,8 +191,8 @@ def register(request):
|
|||||||
|
|
||||||
|
|
||||||
def editable(request, user):
|
def editable(request, user):
|
||||||
# if user.is_superuser:
|
if user.is_superuser:
|
||||||
# return True
|
return True
|
||||||
|
|
||||||
url = request.build_absolute_uri(request.path)
|
url = request.build_absolute_uri(request.path)
|
||||||
if PackageManager.is_package_url(url):
|
if PackageManager.is_package_url(url):
|
||||||
@ -437,22 +374,6 @@ def predict_pathway(request):
|
|||||||
return render(request, "predict_pathway.html", context)
|
return render(request, "predict_pathway.html", context)
|
||||||
|
|
||||||
|
|
||||||
@package_permission_required()
|
|
||||||
def package_predict_pathway(request, package_uuid):
|
|
||||||
"""Package-specific predict pathway view."""
|
|
||||||
if request.method != "GET":
|
|
||||||
return HttpResponseNotAllowed(["GET"])
|
|
||||||
|
|
||||||
current_user = _anonymous_or_real(request)
|
|
||||||
current_package = PackageManager.get_package_by_id(current_user, package_uuid)
|
|
||||||
|
|
||||||
context = get_base_context(request)
|
|
||||||
context["title"] = f"enviPath - {current_package.name} - Predict Pathway"
|
|
||||||
context["meta"]["current_package"] = current_package
|
|
||||||
|
|
||||||
return render(request, "predict_pathway.html", context)
|
|
||||||
|
|
||||||
|
|
||||||
def packages(request):
|
def packages(request):
|
||||||
current_user = _anonymous_or_real(request)
|
current_user = _anonymous_or_real(request)
|
||||||
|
|
||||||
@ -935,7 +856,7 @@ def package_models(request, package_uuid):
|
|||||||
request, "Invalid model type.", f'Model type "{model_type}" is not supported."'
|
request, "Invalid model type.", f'Model type "{model_type}" is not supported."'
|
||||||
)
|
)
|
||||||
|
|
||||||
from .tasks import build_model, dispatch
|
from .tasks import dispatch, build_model
|
||||||
|
|
||||||
dispatch(current_user, build_model, mod.pk)
|
dispatch(current_user, build_model, mod.pk)
|
||||||
|
|
||||||
@ -969,10 +890,9 @@ def package_model(request, package_uuid, model_uuid):
|
|||||||
if classify:
|
if classify:
|
||||||
from epdb.tasks import dispatch_eager, predict_simple
|
from epdb.tasks import dispatch_eager, predict_simple
|
||||||
|
|
||||||
pred_res = dispatch_eager(
|
res = dispatch_eager(current_user, predict_simple, current_model.pk, stand_smiles)
|
||||||
current_user, predict_simple, current_model.pk, stand_smiles
|
|
||||||
)
|
|
||||||
|
|
||||||
|
pred_res = current_model.predict(stand_smiles)
|
||||||
res = []
|
res = []
|
||||||
|
|
||||||
for pr in pred_res:
|
for pr in pred_res:
|
||||||
@ -1132,7 +1052,9 @@ def package(request, package_uuid):
|
|||||||
return redirect(s.SERVER_URL + "/package")
|
return redirect(s.SERVER_URL + "/package")
|
||||||
elif hidden == "publish-package":
|
elif hidden == "publish-package":
|
||||||
for g in Group.objects.filter(public=True):
|
for g in Group.objects.filter(public=True):
|
||||||
PackageManager.grant_read(current_user, current_package, g)
|
PackageManager.update_permissions(
|
||||||
|
current_user, current_package, g, Permission.READ[0]
|
||||||
|
)
|
||||||
return redirect(current_package.url)
|
return redirect(current_package.url)
|
||||||
elif hidden == "copy":
|
elif hidden == "copy":
|
||||||
object_to_copy = request.POST.get("object_to_copy")
|
object_to_copy = request.POST.get("object_to_copy")
|
||||||
@ -2471,9 +2393,9 @@ def package_scenarios(request, package_uuid):
|
|||||||
context["unreviewed_objects"] = unreviewed_scenario_qs
|
context["unreviewed_objects"] = unreviewed_scenario_qs
|
||||||
|
|
||||||
from envipy_additional_information import (
|
from envipy_additional_information import (
|
||||||
SEDIMENT_ADDITIONAL_INFORMATION,
|
|
||||||
SLUDGE_ADDITIONAL_INFORMATION,
|
SLUDGE_ADDITIONAL_INFORMATION,
|
||||||
SOIL_ADDITIONAL_INFORMATION,
|
SOIL_ADDITIONAL_INFORMATION,
|
||||||
|
SEDIMENT_ADDITIONAL_INFORMATION,
|
||||||
)
|
)
|
||||||
|
|
||||||
context["scenario_types"] = {
|
context["scenario_types"] = {
|
||||||
|
|||||||
@ -1,21 +1,24 @@
|
|||||||
|
import gzip
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os.path
|
import os.path
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
from django.conf import settings as s
|
from django.conf import settings as s
|
||||||
from django.http import HttpResponseNotAllowed
|
from django.http import HttpResponseNotAllowed
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
from epdb.logic import PackageManager
|
||||||
|
from epdb.models import Rule, SimpleAmbitRule, Package, CompoundStructure
|
||||||
|
from epdb.views import get_base_context, _anonymous_or_real
|
||||||
|
from utilities.chem import FormatConverter
|
||||||
|
|
||||||
|
|
||||||
from rdkit import Chem
|
from rdkit import Chem
|
||||||
from rdkit.Chem.MolStandardize import rdMolStandardize
|
from rdkit.Chem.MolStandardize import rdMolStandardize
|
||||||
|
|
||||||
from epdb.models import CompoundStructure, Rule, SimpleAmbitRule
|
|
||||||
from epdb.views import get_base_context
|
|
||||||
from utilities.chem import FormatConverter
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
Package = s.GET_PACKAGE_MODEL()
|
|
||||||
|
|
||||||
|
|
||||||
def normalize_smiles(smiles):
|
def normalize_smiles(smiles):
|
||||||
m1 = Chem.MolFromSmiles(smiles)
|
m1 = Chem.MolFromSmiles(smiles)
|
||||||
@ -56,7 +59,9 @@ def run_both_engines(SMILES, SMIRKS):
|
|||||||
set(
|
set(
|
||||||
[
|
[
|
||||||
normalize_smiles(str(x))
|
normalize_smiles(str(x))
|
||||||
for x in FormatConverter.sanitize_smiles([str(s) for s in all_rdkit_prods])[0]
|
for x in FormatConverter.sanitize_smiles(
|
||||||
|
[str(s) for s in all_rdkit_prods]
|
||||||
|
)[0]
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -80,7 +85,8 @@ def migration(request):
|
|||||||
url="http://localhost:8000/package/32de3cf4-e3e6-4168-956e-32fa5ddb0ce1"
|
url="http://localhost:8000/package/32de3cf4-e3e6-4168-956e-32fa5ddb0ce1"
|
||||||
)
|
)
|
||||||
ALL_SMILES = [
|
ALL_SMILES = [
|
||||||
cs.smiles for cs in CompoundStructure.objects.filter(compound__package=BBD)
|
cs.smiles
|
||||||
|
for cs in CompoundStructure.objects.filter(compound__package=BBD)
|
||||||
]
|
]
|
||||||
RULES = SimpleAmbitRule.objects.filter(package=BBD)
|
RULES = SimpleAmbitRule.objects.filter(package=BBD)
|
||||||
|
|
||||||
@ -136,7 +142,9 @@ def migration(request):
|
|||||||
)
|
)
|
||||||
|
|
||||||
for r in migration_status["results"]:
|
for r in migration_status["results"]:
|
||||||
r["detail_url"] = r["detail_url"].replace("http://localhost:8000", s.SERVER_URL)
|
r["detail_url"] = r["detail_url"].replace(
|
||||||
|
"http://localhost:8000", s.SERVER_URL
|
||||||
|
)
|
||||||
|
|
||||||
context.update(**migration_status)
|
context.update(**migration_status)
|
||||||
|
|
||||||
@ -144,6 +152,8 @@ def migration(request):
|
|||||||
|
|
||||||
|
|
||||||
def migration_detail(request, package_uuid, rule_uuid):
|
def migration_detail(request, package_uuid, rule_uuid):
|
||||||
|
current_user = _anonymous_or_real(request)
|
||||||
|
|
||||||
if request.method == "GET":
|
if request.method == "GET":
|
||||||
context = get_base_context(request)
|
context = get_base_context(request)
|
||||||
|
|
||||||
@ -225,7 +235,9 @@ def compare(request):
|
|||||||
context["smirks"] = (
|
context["smirks"] = (
|
||||||
"[#1,#6:6][#7;X3;!$(NC1CC1)!$([N][C]=O)!$([!#8]CNC=O):1]([#1,#6:7])[#6;A;X4:2][H:3]>>[#1,#6:6][#7;X3:1]([#1,#6:7])[H:3].[#6;A:2]=O"
|
"[#1,#6:6][#7;X3;!$(NC1CC1)!$([N][C]=O)!$([!#8]CNC=O):1]([#1,#6:7])[#6;A;X4:2][H:3]>>[#1,#6:6][#7;X3:1]([#1,#6:7])[H:3].[#6;A:2]=O"
|
||||||
)
|
)
|
||||||
context["smiles"] = "C(CC(=O)N[C@@H](CS[Se-])C(=O)NCC(=O)[O-])[C@@H](C(=O)[O-])N"
|
context["smiles"] = (
|
||||||
|
"C(CC(=O)N[C@@H](CS[Se-])C(=O)NCC(=O)[O-])[C@@H](C(=O)[O-])N"
|
||||||
|
)
|
||||||
return render(request, "compare.html", context)
|
return render(request, "compare.html", context)
|
||||||
|
|
||||||
elif request.method == "POST":
|
elif request.method == "POST":
|
||||||
|
|||||||
@ -45,8 +45,6 @@ dev = [
|
|||||||
"poethepoet>=0.37.0",
|
"poethepoet>=0.37.0",
|
||||||
"pre-commit>=4.3.0",
|
"pre-commit>=4.3.0",
|
||||||
"ruff>=0.13.3",
|
"ruff>=0.13.3",
|
||||||
"pytest-playwright>=0.7.1",
|
|
||||||
"pytest-django>=4.11.1",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
@ -68,31 +66,47 @@ docstring-code-format = true
|
|||||||
|
|
||||||
[tool.poe.tasks]
|
[tool.poe.tasks]
|
||||||
# Main tasks
|
# Main tasks
|
||||||
setup = { sequence = [
|
setup = { sequence = ["db-up", "migrate", "bootstrap"], help = "Complete setup: start database, run migrations, and bootstrap data" }
|
||||||
"db-up",
|
dev = { shell = """
|
||||||
"migrate",
|
# Start pnpm CSS watcher in background
|
||||||
"bootstrap",
|
pnpm run dev &
|
||||||
], help = "Complete setup: start database, run migrations, and bootstrap data" }
|
PNPM_PID=$!
|
||||||
dev = { cmd = "uv run python scripts/dev_server.py", help = "Start the development server with CSS watcher", deps = [
|
echo "Started CSS watcher (PID: $PNPM_PID)"
|
||||||
"db-up",
|
|
||||||
"js-deps",
|
# Cleanup function
|
||||||
] }
|
cleanup() {
|
||||||
build = { sequence = [
|
echo "\nShutting down..."
|
||||||
"build-frontend",
|
if kill -0 $PNPM_PID 2>/dev/null; then
|
||||||
"collectstatic",
|
kill $PNPM_PID
|
||||||
], help = "Build frontend assets and collect static files" }
|
echo "✓ CSS watcher stopped"
|
||||||
|
fi
|
||||||
|
if [ ! -z "${DJ_PID:-}" ] && kill -0 $DJ_PID 2>/dev/null; then
|
||||||
|
kill $DJ_PID
|
||||||
|
echo "✓ Django server stopped"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set trap for cleanup
|
||||||
|
trap cleanup EXIT INT TERM
|
||||||
|
|
||||||
|
# Start Django dev server in background
|
||||||
|
uv run python manage.py runserver &
|
||||||
|
DJ_PID=$!
|
||||||
|
|
||||||
|
# Wait for Django to finish
|
||||||
|
wait $DJ_PID
|
||||||
|
""", help = "Start the development server with CSS watcher", deps = ["db-up", "js-deps"] }
|
||||||
|
build = { sequence = ["build-frontend", "collectstatic"], help = "Build frontend assets and collect static files" }
|
||||||
|
|
||||||
# Database tasks
|
# Database tasks
|
||||||
db-up = { cmd = "docker compose -f docker-compose.dev.yml up -d", help = "Start PostgreSQL database using Docker Compose" }
|
db-up = { cmd = "docker compose -f docker-compose.dev.yml up -d", help = "Start PostgreSQL database using Docker Compose" }
|
||||||
db-down = { cmd = "docker compose -f docker-compose.dev.yml down", help = "Stop PostgreSQL database" }
|
db-down = { cmd = "docker compose -f docker-compose.dev.yml down", help = "Stop PostgreSQL database" }
|
||||||
|
|
||||||
# Frontend tasks
|
# Frontend tasks
|
||||||
js-deps = { cmd = "uv run python scripts/pnpm_wrapper.py install", help = "Install frontend dependencies" }
|
js-deps = { cmd = "pnpm install", help = "Install frontend dependencies" }
|
||||||
|
|
||||||
# Full cleanup tasks
|
# Full cleanup tasks
|
||||||
clean = { sequence = [
|
clean = { sequence = ["clean-db"], help = "Remove model files and database volumes (WARNING: destroys all data!)" }
|
||||||
"clean-db",
|
|
||||||
], help = "Remove model files and database volumes (WARNING: destroys all data!)" }
|
|
||||||
clean-db = { cmd = "docker compose -f docker-compose.dev.yml down -v", help = "Removes the database container and volume." }
|
clean-db = { cmd = "docker compose -f docker-compose.dev.yml down -v", help = "Removes the database container and volume." }
|
||||||
|
|
||||||
# Django tasks
|
# Django tasks
|
||||||
@ -110,14 +124,6 @@ echo " Password: SuperSafe"
|
|||||||
""", help = "Bootstrap initial data (anonymous user, packages, models)" }
|
""", help = "Bootstrap initial data (anonymous user, packages, models)" }
|
||||||
shell = { cmd = "uv run python manage.py shell", help = "Open Django shell" }
|
shell = { cmd = "uv run python manage.py shell", help = "Open Django shell" }
|
||||||
|
|
||||||
|
# Build tasks
|
||||||
build-frontend = { cmd = "uv run python scripts/pnpm_wrapper.py run build", help = "Build frontend assets using pnpm", deps = [
|
build-frontend = { cmd = "pnpm run build", help = "Build frontend assets using pnpm", deps = ["js-deps"] }
|
||||||
"js-deps",
|
collectstatic = { cmd = "uv run python manage.py collectstatic --noinput", help = "Collect static files for production", deps = ["build-frontend"] }
|
||||||
] } # Build tasks
|
|
||||||
|
|
||||||
|
|
||||||
collectstatic = { cmd = "uv run python manage.py collectstatic --noinput", help = "Collect static files for production", deps = [
|
|
||||||
"build-frontend",
|
|
||||||
] }
|
|
||||||
|
|
||||||
frontend-test-setup = { cmd = "playwright install", help = "Install the browsers required for frontend testing" }
|
|
||||||
|
|||||||
@ -1,201 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""
|
|
||||||
Cross-platform development server script.
|
|
||||||
Starts pnpm CSS watcher and Django dev server, handling cleanup on exit.
|
|
||||||
Works on both Windows and Unix systems.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import atexit
|
|
||||||
import shutil
|
|
||||||
import signal
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
|
|
||||||
|
|
||||||
def find_pnpm():
|
|
||||||
"""
|
|
||||||
Find pnpm executable on the system.
|
|
||||||
Returns the path to pnpm or None if not found.
|
|
||||||
"""
|
|
||||||
# Try to find pnpm using shutil.which
|
|
||||||
# On Windows, this will find pnpm.cmd if it's in PATH
|
|
||||||
pnpm_path = shutil.which("pnpm")
|
|
||||||
|
|
||||||
if pnpm_path:
|
|
||||||
return pnpm_path
|
|
||||||
|
|
||||||
# On Windows, also try pnpm.cmd explicitly
|
|
||||||
if sys.platform == "win32":
|
|
||||||
pnpm_cmd = shutil.which("pnpm.cmd")
|
|
||||||
if pnpm_cmd:
|
|
||||||
return pnpm_cmd
|
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
class DevServerManager:
|
|
||||||
"""Manages background processes for development server."""
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
self.processes = []
|
|
||||||
self._cleanup_registered = False
|
|
||||||
|
|
||||||
def start_process(self, command, description, shell=False):
|
|
||||||
"""Start a background process and return the process object."""
|
|
||||||
print(f"Starting {description}...")
|
|
||||||
try:
|
|
||||||
if shell:
|
|
||||||
# Use shell=True for commands that need shell interpretation
|
|
||||||
process = subprocess.Popen(
|
|
||||||
command,
|
|
||||||
shell=True,
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.STDOUT,
|
|
||||||
text=True,
|
|
||||||
bufsize=1,
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
# Split command into list for subprocess
|
|
||||||
process = subprocess.Popen(
|
|
||||||
command,
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.STDOUT,
|
|
||||||
text=True,
|
|
||||||
bufsize=1,
|
|
||||||
)
|
|
||||||
self.processes.append((process, description))
|
|
||||||
print(f"✓ Started {description} (PID: {process.pid})")
|
|
||||||
return process
|
|
||||||
except Exception as e:
|
|
||||||
print(f"✗ Failed to start {description}: {e}", file=sys.stderr)
|
|
||||||
self.cleanup()
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
def cleanup(self):
|
|
||||||
"""Terminate all running processes."""
|
|
||||||
if not self.processes:
|
|
||||||
return
|
|
||||||
|
|
||||||
print("\nShutting down...")
|
|
||||||
for process, description in self.processes:
|
|
||||||
if process.poll() is None: # Process is still running
|
|
||||||
try:
|
|
||||||
# Try graceful termination first
|
|
||||||
if sys.platform == "win32":
|
|
||||||
process.terminate()
|
|
||||||
else:
|
|
||||||
process.send_signal(signal.SIGTERM)
|
|
||||||
|
|
||||||
# Wait up to 5 seconds for graceful shutdown
|
|
||||||
try:
|
|
||||||
process.wait(timeout=5)
|
|
||||||
except subprocess.TimeoutExpired:
|
|
||||||
# Force kill if graceful shutdown failed
|
|
||||||
if sys.platform == "win32":
|
|
||||||
process.kill()
|
|
||||||
else:
|
|
||||||
process.send_signal(signal.SIGKILL)
|
|
||||||
process.wait()
|
|
||||||
|
|
||||||
print(f"✓ {description} stopped")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"✗ Error stopping {description}: {e}", file=sys.stderr)
|
|
||||||
|
|
||||||
self.processes.clear()
|
|
||||||
|
|
||||||
def register_cleanup(self):
|
|
||||||
"""Register cleanup handlers for various exit scenarios."""
|
|
||||||
if self._cleanup_registered:
|
|
||||||
return
|
|
||||||
|
|
||||||
self._cleanup_registered = True
|
|
||||||
|
|
||||||
# Register atexit handler (works on all platforms)
|
|
||||||
atexit.register(self.cleanup)
|
|
||||||
|
|
||||||
# Register signal handlers (Unix only)
|
|
||||||
if sys.platform != "win32":
|
|
||||||
signal.signal(signal.SIGINT, self._signal_handler)
|
|
||||||
signal.signal(signal.SIGTERM, self._signal_handler)
|
|
||||||
|
|
||||||
def _signal_handler(self, signum, frame):
|
|
||||||
"""Handle Unix signals."""
|
|
||||||
self.cleanup()
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
def wait_for_process(self, process, description):
|
|
||||||
"""Wait for a process to finish and handle its output."""
|
|
||||||
try:
|
|
||||||
# Stream output from the process
|
|
||||||
for line in iter(process.stdout.readline, ""):
|
|
||||||
if line:
|
|
||||||
print(f"[{description}] {line.rstrip()}")
|
|
||||||
|
|
||||||
process.wait()
|
|
||||||
return process.returncode
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
# Handle Ctrl+C
|
|
||||||
self.cleanup()
|
|
||||||
sys.exit(0)
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error waiting for {description}: {e}", file=sys.stderr)
|
|
||||||
self.cleanup()
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""Main entry point."""
|
|
||||||
manager = DevServerManager()
|
|
||||||
manager.register_cleanup()
|
|
||||||
|
|
||||||
# Find pnpm executable
|
|
||||||
pnpm_path = find_pnpm()
|
|
||||||
if not pnpm_path:
|
|
||||||
print("Error: pnpm not found in PATH.", file=sys.stderr)
|
|
||||||
print("\nPlease install pnpm:", file=sys.stderr)
|
|
||||||
print(" Windows: https://pnpm.io/installation#on-windows", file=sys.stderr)
|
|
||||||
print(" Unix: https://pnpm.io/installation#on-posix-systems", file=sys.stderr)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
# Determine shell usage based on platform
|
|
||||||
use_shell = sys.platform == "win32"
|
|
||||||
|
|
||||||
# Start pnpm CSS watcher
|
|
||||||
# Use the found pnpm path to ensure it works on Windows
|
|
||||||
pnpm_command = f'"{pnpm_path}" run dev' if use_shell else [pnpm_path, "run", "dev"]
|
|
||||||
manager.start_process(
|
|
||||||
pnpm_command,
|
|
||||||
"CSS watcher",
|
|
||||||
shell=use_shell,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Give pnpm a moment to start
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
# Start Django dev server
|
|
||||||
django_process = manager.start_process(
|
|
||||||
["uv", "run", "python", "manage.py", "runserver"],
|
|
||||||
"Django server",
|
|
||||||
shell=False,
|
|
||||||
)
|
|
||||||
|
|
||||||
print("\nDevelopment servers are running. Press Ctrl+C to stop.\n")
|
|
||||||
|
|
||||||
try:
|
|
||||||
# Wait for Django server (main process)
|
|
||||||
# If Django exits, we should clean up everything
|
|
||||||
return_code = manager.wait_for_process(django_process, "Django")
|
|
||||||
|
|
||||||
# If Django exited unexpectedly, clean up and exit
|
|
||||||
if return_code != 0:
|
|
||||||
manager.cleanup()
|
|
||||||
sys.exit(return_code)
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
# Ctrl+C was pressed
|
|
||||||
manager.cleanup()
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@ -1,59 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""
|
|
||||||
Cross-platform pnpm command wrapper.
|
|
||||||
Finds pnpm correctly on Windows (handles pnpm.cmd) and Unix systems.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import shutil
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
|
|
||||||
|
|
||||||
def find_pnpm():
|
|
||||||
"""
|
|
||||||
Find pnpm executable on the system.
|
|
||||||
Returns the path to pnpm or None if not found.
|
|
||||||
"""
|
|
||||||
# Try to find pnpm using shutil.which
|
|
||||||
# On Windows, this will find pnpm.cmd if it's in PATH
|
|
||||||
pnpm_path = shutil.which("pnpm")
|
|
||||||
|
|
||||||
if pnpm_path:
|
|
||||||
return pnpm_path
|
|
||||||
|
|
||||||
# On Windows, also try pnpm.cmd explicitly
|
|
||||||
if sys.platform == "win32":
|
|
||||||
pnpm_cmd = shutil.which("pnpm.cmd")
|
|
||||||
if pnpm_cmd:
|
|
||||||
return pnpm_cmd
|
|
||||||
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
"""Main entry point - execute pnpm with provided arguments."""
|
|
||||||
pnpm_path = find_pnpm()
|
|
||||||
|
|
||||||
if not pnpm_path:
|
|
||||||
print("Error: pnpm not found in PATH.", file=sys.stderr)
|
|
||||||
print("\nPlease install pnpm:", file=sys.stderr)
|
|
||||||
print(" Windows: https://pnpm.io/installation#on-windows", file=sys.stderr)
|
|
||||||
print(" Unix: https://pnpm.io/installation#on-posix-systems", file=sys.stderr)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
# Get all arguments passed to this script
|
|
||||||
args = sys.argv[1:]
|
|
||||||
|
|
||||||
# Execute pnpm with the provided arguments
|
|
||||||
try:
|
|
||||||
sys.exit(subprocess.call([pnpm_path] + args))
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
# Handle Ctrl+C gracefully
|
|
||||||
sys.exit(130)
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error executing pnpm: {e}", file=sys.stderr)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@ -34,30 +34,3 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@import "./daisyui-theme.css";
|
@import "./daisyui-theme.css";
|
||||||
|
|
||||||
/* Loading Spinner - Benzene Ring */
|
|
||||||
.loading-spinner {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading-spinner svg {
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
animation: spin 2s linear infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading-spinner .hexagon,
|
|
||||||
.loading-spinner .double-bonds {
|
|
||||||
fill: none;
|
|
||||||
stroke: currentColor;
|
|
||||||
stroke-width: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes spin {
|
|
||||||
100% {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
BIN
static/images/wait.gif
Normal file
BIN
static/images/wait.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 814 B |
@ -1,265 +0,0 @@
|
|||||||
/**
|
|
||||||
* Alpine.js Components for enviPath
|
|
||||||
*
|
|
||||||
* This module provides reusable Alpine.js data components for modals,
|
|
||||||
* form validation, and form submission.
|
|
||||||
*/
|
|
||||||
|
|
||||||
document.addEventListener('alpine:init', () => {
|
|
||||||
/**
|
|
||||||
* Modal Form Component
|
|
||||||
*
|
|
||||||
* Provides form validation using HTML5 Constraint Validation API,
|
|
||||||
* loading states for submission, and error message management.
|
|
||||||
*
|
|
||||||
* Basic Usage:
|
|
||||||
* <dialog x-data="modalForm()" @close="reset()">
|
|
||||||
* <form id="my-form">
|
|
||||||
* <input name="field" required>
|
|
||||||
* </form>
|
|
||||||
* <button @click="submit('my-form')" :disabled="isSubmitting">Submit</button>
|
|
||||||
* </dialog>
|
|
||||||
*
|
|
||||||
* With Custom State:
|
|
||||||
* <dialog x-data="modalForm({ state: { selectedItem: '', imageUrl: '' } })" @close="reset()">
|
|
||||||
* <select x-model="selectedItem" @change="updateImagePreview(selectedItem + '?image=svg')">
|
|
||||||
* <img :src="imageUrl" x-show="imageUrl">
|
|
||||||
* </dialog>
|
|
||||||
*
|
|
||||||
* With AJAX:
|
|
||||||
* <button @click="submitAsync('my-form', { onSuccess: (data) => console.log(data) })">
|
|
||||||
*/
|
|
||||||
Alpine.data('modalForm', (options = {}) => ({
|
|
||||||
isSubmitting: false,
|
|
||||||
errors: {},
|
|
||||||
// Spread custom initial state from options
|
|
||||||
...(options.state || {}),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate a single field using HTML5 Constraint Validation API
|
|
||||||
* @param {HTMLElement} field - The input/select/textarea element
|
|
||||||
*/
|
|
||||||
validateField(field) {
|
|
||||||
const name = field.name || field.id;
|
|
||||||
if (!name) return;
|
|
||||||
|
|
||||||
if (!field.validity.valid) {
|
|
||||||
this.errors[name] = field.validationMessage;
|
|
||||||
} else {
|
|
||||||
delete this.errors[name];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clear error for a field (call on input)
|
|
||||||
* @param {HTMLElement} field - The input element
|
|
||||||
*/
|
|
||||||
clearError(field) {
|
|
||||||
const name = field.name || field.id;
|
|
||||||
if (name && this.errors[name]) {
|
|
||||||
delete this.errors[name];
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get error message for a field
|
|
||||||
* @param {string} name - Field name
|
|
||||||
* @returns {string|undefined} Error message or undefined
|
|
||||||
*/
|
|
||||||
getError(name) {
|
|
||||||
return this.errors[name];
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if form has any errors
|
|
||||||
* @returns {boolean} True if there are errors
|
|
||||||
*/
|
|
||||||
hasErrors() {
|
|
||||||
return Object.keys(this.errors).length > 0;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate all fields in a form
|
|
||||||
* @param {string} formId - The form element ID
|
|
||||||
* @returns {boolean} True if form is valid
|
|
||||||
*/
|
|
||||||
validateAll(formId) {
|
|
||||||
const form = document.getElementById(formId);
|
|
||||||
if (!form) return false;
|
|
||||||
|
|
||||||
this.errors = {};
|
|
||||||
const fields = form.querySelectorAll('input, select, textarea');
|
|
||||||
|
|
||||||
fields.forEach(field => {
|
|
||||||
if (field.name && !field.validity.valid) {
|
|
||||||
this.errors[field.name] = field.validationMessage;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return !this.hasErrors();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Validate that two password fields match
|
|
||||||
* @param {string} password1Id - ID of first password field
|
|
||||||
* @param {string} password2Id - ID of second password field
|
|
||||||
* @returns {boolean} True if passwords match
|
|
||||||
*/
|
|
||||||
validatePasswordMatch(password1Id, password2Id) {
|
|
||||||
const pw1 = document.getElementById(password1Id);
|
|
||||||
const pw2 = document.getElementById(password2Id);
|
|
||||||
|
|
||||||
if (!pw1 || !pw2) return false;
|
|
||||||
|
|
||||||
if (pw1.value !== pw2.value) {
|
|
||||||
this.errors[pw2.name || password2Id] = 'Passwords do not match';
|
|
||||||
pw2.setCustomValidity('Passwords do not match');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
delete this.errors[pw2.name || password2Id];
|
|
||||||
pw2.setCustomValidity('');
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Submit a form with loading state
|
|
||||||
* @param {string} formId - The form element ID
|
|
||||||
*/
|
|
||||||
submit(formId) {
|
|
||||||
const form = document.getElementById(formId);
|
|
||||||
if (!form) return;
|
|
||||||
|
|
||||||
// Validate before submit
|
|
||||||
if (!form.checkValidity()) {
|
|
||||||
form.reportValidity();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set action to current URL if empty
|
|
||||||
if (!form.action || form.action === window.location.href + '#') {
|
|
||||||
form.action = window.location.href;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set loading state and submit
|
|
||||||
this.isSubmitting = true;
|
|
||||||
form.submit();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Submit form via AJAX (fetch)
|
|
||||||
* @param {string} formId - The form element ID
|
|
||||||
* @param {Object} options - Options { onSuccess, onError, closeOnSuccess }
|
|
||||||
*/
|
|
||||||
async submitAsync(formId, options = {}) {
|
|
||||||
const form = document.getElementById(formId);
|
|
||||||
if (!form) return;
|
|
||||||
|
|
||||||
// Validate before submit
|
|
||||||
if (!form.checkValidity()) {
|
|
||||||
form.reportValidity();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.isSubmitting = true;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const formData = new FormData(form);
|
|
||||||
const response = await fetch(form.action || window.location.href, {
|
|
||||||
method: form.method || 'POST',
|
|
||||||
body: formData,
|
|
||||||
headers: {
|
|
||||||
'X-Requested-With': 'XMLHttpRequest',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const data = await response.json().catch(() => ({}));
|
|
||||||
|
|
||||||
if (response.ok) {
|
|
||||||
if (options.onSuccess) {
|
|
||||||
options.onSuccess(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.redirect || data.success) {
|
|
||||||
window.location.href = data.redirect || data.success;
|
|
||||||
} else if (options.closeOnSuccess) {
|
|
||||||
this.$el.closest('dialog')?.close();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
const errorMsg = data.error || data.message || `Error: ${response.status}`;
|
|
||||||
this.errors['_form'] = errorMsg;
|
|
||||||
|
|
||||||
if (options.onError) {
|
|
||||||
options.onError(errorMsg, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
this.errors['_form'] = error.message;
|
|
||||||
|
|
||||||
if (options.onError) {
|
|
||||||
options.onError(error.message);
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
this.isSubmitting = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set form action URL dynamically
|
|
||||||
* @param {string} formId - The form element ID
|
|
||||||
* @param {string} url - The URL to set as action
|
|
||||||
*/
|
|
||||||
setFormAction(formId, url) {
|
|
||||||
const form = document.getElementById(formId);
|
|
||||||
if (form) {
|
|
||||||
form.action = url;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update image preview
|
|
||||||
* @param {string} url - Image URL (with query params)
|
|
||||||
* @param {string} targetId - Target element ID for the image
|
|
||||||
*/
|
|
||||||
updateImagePreview(url) {
|
|
||||||
// Store URL for reactive binding with :src
|
|
||||||
this.imageUrl = url;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset form state (call on modal close)
|
|
||||||
* Resets to initial state from options
|
|
||||||
*/
|
|
||||||
reset() {
|
|
||||||
this.isSubmitting = false;
|
|
||||||
this.errors = {};
|
|
||||||
this.imageUrl = '';
|
|
||||||
|
|
||||||
// Reset custom state to initial values
|
|
||||||
if (options.state) {
|
|
||||||
Object.keys(options.state).forEach(key => {
|
|
||||||
this[key] = options.state[key];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call custom reset handler if provided
|
|
||||||
if (options.onReset) {
|
|
||||||
options.onReset.call(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Simple Modal Component (no form)
|
|
||||||
*
|
|
||||||
* For modals that don't need form validation.
|
|
||||||
*
|
|
||||||
* Usage:
|
|
||||||
* <dialog x-data="modal()">
|
|
||||||
* <button @click="$el.closest('dialog').close()">Close</button>
|
|
||||||
* </dialog>
|
|
||||||
*/
|
|
||||||
Alpine.data('modal', () => ({
|
|
||||||
// Placeholder for simple modals that may need state later
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
@ -1,133 +0,0 @@
|
|||||||
/**
|
|
||||||
* Alpine.js Pagination Component
|
|
||||||
*
|
|
||||||
* Provides client-side pagination for large lists.
|
|
||||||
*/
|
|
||||||
|
|
||||||
document.addEventListener('alpine:init', () => {
|
|
||||||
Alpine.data('paginatedList', (initialItems = [], options = {}) => ({
|
|
||||||
allItems: initialItems,
|
|
||||||
filteredItems: [],
|
|
||||||
currentPage: 1,
|
|
||||||
perPage: options.perPage || 50,
|
|
||||||
searchQuery: '',
|
|
||||||
isReviewed: options.isReviewed || false,
|
|
||||||
instanceId: options.instanceId || Math.random().toString(36).substring(2, 9),
|
|
||||||
|
|
||||||
init() {
|
|
||||||
this.filteredItems = this.allItems;
|
|
||||||
},
|
|
||||||
|
|
||||||
get totalPages() {
|
|
||||||
return Math.ceil(this.filteredItems.length / this.perPage);
|
|
||||||
},
|
|
||||||
|
|
||||||
get paginatedItems() {
|
|
||||||
const start = (this.currentPage - 1) * this.perPage;
|
|
||||||
const end = start + this.perPage;
|
|
||||||
return this.filteredItems.slice(start, end);
|
|
||||||
},
|
|
||||||
|
|
||||||
get totalItems() {
|
|
||||||
return this.filteredItems.length;
|
|
||||||
},
|
|
||||||
|
|
||||||
get showingStart() {
|
|
||||||
if (this.totalItems === 0) return 0;
|
|
||||||
return (this.currentPage - 1) * this.perPage + 1;
|
|
||||||
},
|
|
||||||
|
|
||||||
get showingEnd() {
|
|
||||||
return Math.min(this.currentPage * this.perPage, this.totalItems);
|
|
||||||
},
|
|
||||||
|
|
||||||
search(query) {
|
|
||||||
this.searchQuery = query.toLowerCase();
|
|
||||||
if (this.searchQuery === '') {
|
|
||||||
this.filteredItems = this.allItems;
|
|
||||||
} else {
|
|
||||||
this.filteredItems = this.allItems.filter(item =>
|
|
||||||
item.name.toLowerCase().includes(this.searchQuery)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
this.currentPage = 1;
|
|
||||||
},
|
|
||||||
|
|
||||||
nextPage() {
|
|
||||||
if (this.currentPage < this.totalPages) {
|
|
||||||
this.currentPage++;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
prevPage() {
|
|
||||||
if (this.currentPage > 1) {
|
|
||||||
this.currentPage--;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
goToPage(page) {
|
|
||||||
if (page >= 1 && page <= this.totalPages) {
|
|
||||||
this.currentPage = page;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
get pageNumbers() {
|
|
||||||
const pages = [];
|
|
||||||
const total = this.totalPages;
|
|
||||||
const current = this.currentPage;
|
|
||||||
|
|
||||||
// Handle empty case
|
|
||||||
if (total === 0) {
|
|
||||||
return pages;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (total <= 7) {
|
|
||||||
// Show all pages if 7 or fewer
|
|
||||||
for (let i = 1; i <= total; i++) {
|
|
||||||
pages.push({ page: i, isEllipsis: false, key: `${this.instanceId}-page-${i}` });
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// More than 7 pages - show first, last, and sliding window around current
|
|
||||||
// Always show first page
|
|
||||||
pages.push({ page: 1, isEllipsis: false, key: `${this.instanceId}-page-1` });
|
|
||||||
|
|
||||||
// Determine the start and end of the middle range
|
|
||||||
let rangeStart, rangeEnd;
|
|
||||||
|
|
||||||
if (current <= 4) {
|
|
||||||
// Near the beginning: show pages 2-5
|
|
||||||
rangeStart = 2;
|
|
||||||
rangeEnd = 5;
|
|
||||||
} else if (current >= total - 3) {
|
|
||||||
// Near the end: show last 4 pages before the last page
|
|
||||||
rangeStart = total - 4;
|
|
||||||
rangeEnd = total - 1;
|
|
||||||
} else {
|
|
||||||
// In the middle: show current page and one on each side
|
|
||||||
rangeStart = current - 1;
|
|
||||||
rangeEnd = current + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add ellipsis before range if there's a gap
|
|
||||||
if (rangeStart > 2) {
|
|
||||||
pages.push({ page: '...', isEllipsis: true, key: `${this.instanceId}-ellipsis-start` });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add pages in the range
|
|
||||||
for (let i = rangeStart; i <= rangeEnd; i++) {
|
|
||||||
pages.push({ page: i, isEllipsis: false, key: `${this.instanceId}-page-${i}` });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add ellipsis after range if there's a gap
|
|
||||||
if (rangeEnd < total - 1) {
|
|
||||||
pages.push({ page: '...', isEllipsis: true, key: `${this.instanceId}-ellipsis-end` });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Always show last page
|
|
||||||
pages.push({ page: total, isEllipsis: false, key: `${this.instanceId}-page-${total}` });
|
|
||||||
}
|
|
||||||
|
|
||||||
return pages;
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
@ -1,145 +0,0 @@
|
|||||||
/**
|
|
||||||
* Search Modal Alpine.js Component
|
|
||||||
*
|
|
||||||
* Provides package selection, search mode switching, and results display
|
|
||||||
* for the search modal.
|
|
||||||
*/
|
|
||||||
|
|
||||||
document.addEventListener('alpine:init', () => {
|
|
||||||
/**
|
|
||||||
* Search Modal Component
|
|
||||||
*
|
|
||||||
* Usage:
|
|
||||||
* <dialog x-data="searchModal()" @close="reset()">
|
|
||||||
* ...
|
|
||||||
* </dialog>
|
|
||||||
*/
|
|
||||||
Alpine.data('searchModal', () => ({
|
|
||||||
// Package selector state
|
|
||||||
selectedPackages: [],
|
|
||||||
|
|
||||||
// Search state
|
|
||||||
searchMode: 'text',
|
|
||||||
searchModeLabel: 'Text',
|
|
||||||
query: '',
|
|
||||||
|
|
||||||
// Results state
|
|
||||||
results: null,
|
|
||||||
isSearching: false,
|
|
||||||
error: null,
|
|
||||||
|
|
||||||
// Initialize on modal open
|
|
||||||
init() {
|
|
||||||
// Load reviewed packages by default
|
|
||||||
this.loadInitialSelection();
|
|
||||||
|
|
||||||
// Watch for modal open to focus searchbar
|
|
||||||
this.$watch('$el.open', (open) => {
|
|
||||||
if (open) {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.$refs.searchbar.focus();
|
|
||||||
}, 320);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
loadInitialSelection() {
|
|
||||||
// Select all reviewed packages by default
|
|
||||||
const menuItems = this.$refs.packageDropdown.querySelectorAll('li');
|
|
||||||
|
|
||||||
for (const item of menuItems) {
|
|
||||||
// Stop at 'Unreviewed Packages' section
|
|
||||||
if (item.classList.contains('menu-title') &&
|
|
||||||
item.textContent.trim() === 'Unreviewed Packages') {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const packageOption = item.querySelector('.package-option');
|
|
||||||
if (packageOption) {
|
|
||||||
this.selectedPackages.push({
|
|
||||||
url: packageOption.dataset.packageUrl,
|
|
||||||
name: packageOption.dataset.packageName
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
togglePackage(url, name) {
|
|
||||||
const index = this.selectedPackages.findIndex(pkg => pkg.url === url);
|
|
||||||
|
|
||||||
if (index !== -1) {
|
|
||||||
this.selectedPackages.splice(index, 1);
|
|
||||||
} else {
|
|
||||||
this.selectedPackages.push({ url, name });
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
removePackage(url) {
|
|
||||||
const index = this.selectedPackages.findIndex(pkg => pkg.url === url);
|
|
||||||
if (index !== -1) {
|
|
||||||
this.selectedPackages.splice(index, 1);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
isPackageSelected(url) {
|
|
||||||
return this.selectedPackages.some(pkg => pkg.url === url);
|
|
||||||
},
|
|
||||||
|
|
||||||
setSearchMode(mode, label) {
|
|
||||||
this.searchMode = mode;
|
|
||||||
this.searchModeLabel = label;
|
|
||||||
this.$refs.modeDropdown.hidePopover();
|
|
||||||
},
|
|
||||||
|
|
||||||
async performSearch(serverBase) {
|
|
||||||
if (!this.query.trim()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.selectedPackages.length < 1) {
|
|
||||||
this.results = { error: 'no_packages' };
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const params = new URLSearchParams();
|
|
||||||
this.selectedPackages.forEach(pkg => params.append('packages', pkg.url));
|
|
||||||
params.append('search', this.query.trim());
|
|
||||||
params.append('mode', this.searchModeLabel.toLowerCase());
|
|
||||||
|
|
||||||
this.isSearching = true;
|
|
||||||
this.results = null;
|
|
||||||
this.error = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await fetch(`${serverBase}/search?${params.toString()}`, {
|
|
||||||
method: 'GET',
|
|
||||||
headers: { 'Accept': 'application/json' }
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error('Search request failed');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.results = await response.json();
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Search error:', err);
|
|
||||||
this.error = 'Search failed. Please try again.';
|
|
||||||
} finally {
|
|
||||||
this.isSearching = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
hasResults() {
|
|
||||||
if (!this.results || this.results.error) return false;
|
|
||||||
const categories = ['Compounds', 'Compound Structures', 'Rules', 'Reactions', 'Pathways'];
|
|
||||||
return categories.some(cat => this.results[cat] && this.results[cat].length > 0);
|
|
||||||
},
|
|
||||||
|
|
||||||
reset() {
|
|
||||||
this.query = '';
|
|
||||||
this.results = null;
|
|
||||||
this.error = null;
|
|
||||||
this.isSearching = false;
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
});
|
|
||||||
@ -63,20 +63,17 @@ class DiscourseAPI {
|
|||||||
* @returns {string} Cleaned excerpt
|
* @returns {string} Cleaned excerpt
|
||||||
*/
|
*/
|
||||||
extractExcerpt(excerpt) {
|
extractExcerpt(excerpt) {
|
||||||
if (!excerpt) return 'No preview available yet';
|
if (!excerpt) return 'Click to read more';
|
||||||
|
|
||||||
// Remove HTML tags and clean up; collapse whitespace; do not add manual ellipsis
|
// Remove HTML tags and clean up; collapse whitespace; do not add manual ellipsis
|
||||||
const cleaned = excerpt
|
return excerpt
|
||||||
.replace(/<[^>]*>/g, '') // Remove HTML tags
|
.replace(/<[^>]*>/g, '') // Remove HTML tags
|
||||||
.replace(/ /g, ' ') // Replace with spaces
|
.replace(/ /g, ' ') // Replace with spaces
|
||||||
.replace(/&/g, '&') // Replace & with &
|
.replace(/&/g, '&') // Replace & with &
|
||||||
.replace(/</g, '<') // Replace < with <
|
.replace(/</g, '<') // Replace < with <
|
||||||
.replace(/>/g, '>') // Replace > with >
|
.replace(/>/g, '>') // Replace > with >
|
||||||
.replace(/\s+/g, ' ') // Collapse all whitespace/newlines
|
.replace(/\s+/g, ' ') // Collapse all whitespace/newlines
|
||||||
.trim();
|
.trim()
|
||||||
|
|
||||||
// Check if excerpt is empty after cleaning
|
|
||||||
return cleaned || 'No preview available yet';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
1147
static/js/pps.js
1147
static/js/pps.js
File diff suppressed because it is too large
Load Diff
229
static/js/pw.js
229
static/js/pw.js
@ -1,21 +1,14 @@
|
|||||||
console.log("loaded pw.js")
|
console.log("loaded pw.js")
|
||||||
|
|
||||||
function predictFromNode(url) {
|
function predictFromNode(url) {
|
||||||
fetch("", {
|
$.post("", {node: url})
|
||||||
method: "POST",
|
.done(function (data) {
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
|
||||||
"X-CSRFToken": document.querySelector('[name=csrfmiddlewaretoken]')?.value || ''
|
|
||||||
},
|
|
||||||
body: new URLSearchParams({node: url})
|
|
||||||
})
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
console.log("Success:", data);
|
console.log("Success:", data);
|
||||||
window.location.href = data.success;
|
window.location.href = data.success;
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.fail(function (xhr, status, error) {
|
||||||
console.error("Error:", error);
|
console.error("Error:", xhr.status, xhr.responseText);
|
||||||
|
// show user-friendly message or log error
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,9 +103,6 @@ function draw(pathway, elem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function dragstarted(event, d) {
|
function dragstarted(event, d) {
|
||||||
// Prevent zoom pan when dragging nodes
|
|
||||||
event.sourceEvent.stopPropagation();
|
|
||||||
|
|
||||||
if (!event.active) simulation.alphaTarget(0.3).restart();
|
if (!event.active) simulation.alphaTarget(0.3).restart();
|
||||||
d.fx = d.x;
|
d.fx = d.x;
|
||||||
d.fy = d.y;
|
d.fy = d.y;
|
||||||
@ -127,9 +117,6 @@ function draw(pathway, elem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function dragged(event, d) {
|
function dragged(event, d) {
|
||||||
// Prevent zoom pan when dragging nodes
|
|
||||||
event.sourceEvent.stopPropagation();
|
|
||||||
|
|
||||||
d.fx = event.x;
|
d.fx = event.x;
|
||||||
d.fy = event.y;
|
d.fy = event.y;
|
||||||
|
|
||||||
@ -140,9 +127,6 @@ function draw(pathway, elem) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function dragended(event, d) {
|
function dragended(event, d) {
|
||||||
// Prevent zoom pan when dragging nodes
|
|
||||||
event.sourceEvent.stopPropagation();
|
|
||||||
|
|
||||||
if (!event.active) simulation.alphaTarget(0);
|
if (!event.active) simulation.alphaTarget(0);
|
||||||
|
|
||||||
// Mark that dragging has ended
|
// Mark that dragging has ended
|
||||||
@ -208,153 +192,52 @@ function draw(pathway, elem) {
|
|||||||
d3.select(t).select("circle").classed("highlighted", !d3.select(t).select("circle").classed("highlighted"));
|
d3.select(t).select("circle").classed("highlighted", !d3.select(t).select("circle").classed("highlighted"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait before showing popup (ms)
|
// Wait one second before showing popup
|
||||||
var popupWaitBeforeShow = 1000;
|
var popupWaitBeforeShow = 1000;
|
||||||
|
// Keep Popup at least for one second
|
||||||
|
var popushowAtLeast = 1000;
|
||||||
|
|
||||||
// Custom popover element
|
function pop_show_e(element) {
|
||||||
let popoverTimeout = null;
|
var e = element;
|
||||||
|
setTimeout(function () {
|
||||||
|
if ($(e).is(':hover')) { // if element is still hovered
|
||||||
|
$(e).popover("show");
|
||||||
|
|
||||||
function createPopover() {
|
// workaround to set fixed positions
|
||||||
const popover = document.createElement('div');
|
pop = $(e).attr("aria-describedby")
|
||||||
popover.id = 'custom-popover';
|
h = $('#' + pop).height();
|
||||||
popover.className = 'fixed z-50';
|
$('#' + pop).attr("style", `position: fixed; top: ${clientY - (h / 2.0)}px; left: ${clientX + 10}px; margin: 0px; max-width: 1000px; display: block;`)
|
||||||
popover.style.cssText = `
|
setTimeout(function () {
|
||||||
background: #ffffff;
|
var close = setInterval(function () {
|
||||||
border: 1px solid #d1d5db;
|
if (!$(".popover:hover").length // mouse outside popover
|
||||||
box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
|
&& !$(e).is(':hover')) { // mouse outside element
|
||||||
max-width: 320px;
|
$(e).popover('hide');
|
||||||
padding: 0.75rem;
|
clearInterval(close);
|
||||||
border-radius: 0.5rem;
|
|
||||||
opacity: 0;
|
|
||||||
visibility: hidden;
|
|
||||||
transition: opacity 150ms ease-in-out, visibility 150ms ease-in-out;
|
|
||||||
pointer-events: auto;
|
|
||||||
`;
|
|
||||||
popover.setAttribute('role', 'tooltip');
|
|
||||||
popover.innerHTML = `
|
|
||||||
<div class="font-semibold mb-2 popover-title" style="font-weight: 600; margin-bottom: 0.5rem;"></div>
|
|
||||||
<div class="text-sm popover-content" style="font-size: 0.875rem;"></div>
|
|
||||||
`;
|
|
||||||
|
|
||||||
// Add styles for content images
|
|
||||||
const style = document.createElement('style');
|
|
||||||
style.textContent = `
|
|
||||||
#custom-popover img {
|
|
||||||
max-width: 100%;
|
|
||||||
height: auto;
|
|
||||||
display: block;
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
}
|
}
|
||||||
#custom-popover a {
|
}, 100);
|
||||||
color: #2563eb;
|
}, popushowAtLeast);
|
||||||
text-decoration: none;
|
|
||||||
}
|
}
|
||||||
#custom-popover a:hover {
|
}, popupWaitBeforeShow);
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
if (!document.getElementById('popover-styles')) {
|
|
||||||
style.id = 'popover-styles';
|
|
||||||
document.head.appendChild(style);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Keep popover open when hovering over it
|
|
||||||
popover.addEventListener('mouseenter', () => {
|
|
||||||
if (popoverTimeout) {
|
|
||||||
clearTimeout(popoverTimeout);
|
|
||||||
popoverTimeout = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
popover.addEventListener('mouseleave', () => {
|
|
||||||
hidePopover();
|
|
||||||
});
|
|
||||||
|
|
||||||
document.body.appendChild(popover);
|
|
||||||
return popover;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPopover() {
|
|
||||||
return document.getElementById('custom-popover') || createPopover();
|
|
||||||
}
|
|
||||||
|
|
||||||
function showPopover(element, title, content) {
|
|
||||||
const popover = getPopover();
|
|
||||||
popover.querySelector('.popover-title').textContent = title;
|
|
||||||
popover.querySelector('.popover-content').innerHTML = content;
|
|
||||||
|
|
||||||
// Make visible to measure
|
|
||||||
popover.style.visibility = 'hidden';
|
|
||||||
popover.style.opacity = '0';
|
|
||||||
popover.style.display = 'block';
|
|
||||||
|
|
||||||
// Smart positioning - avoid viewport overflow
|
|
||||||
const padding = 10;
|
|
||||||
const popoverRect = popover.getBoundingClientRect();
|
|
||||||
const viewportWidth = window.innerWidth;
|
|
||||||
const viewportHeight = window.innerHeight;
|
|
||||||
|
|
||||||
let left = clientX + 15;
|
|
||||||
let top = clientY - (popoverRect.height / 2);
|
|
||||||
|
|
||||||
// Prevent right overflow
|
|
||||||
if (left + popoverRect.width > viewportWidth - padding) {
|
|
||||||
left = clientX - popoverRect.width - 15;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prevent bottom overflow
|
|
||||||
if (top + popoverRect.height > viewportHeight - padding) {
|
|
||||||
top = viewportHeight - popoverRect.height - padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prevent top overflow
|
|
||||||
if (top < padding) {
|
|
||||||
top = padding;
|
|
||||||
}
|
|
||||||
|
|
||||||
popover.style.top = `${top}px`;
|
|
||||||
popover.style.left = `${left}px`;
|
|
||||||
popover.style.visibility = 'visible';
|
|
||||||
popover.style.opacity = '1';
|
|
||||||
|
|
||||||
currentElement = element;
|
|
||||||
}
|
|
||||||
|
|
||||||
function hidePopover() {
|
|
||||||
const popover = getPopover();
|
|
||||||
popover.style.opacity = '0';
|
|
||||||
popover.style.visibility = 'hidden';
|
|
||||||
currentElement = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function pop_add(objects, title, contentFunction) {
|
function pop_add(objects, title, contentFunction) {
|
||||||
objects.each(function (d) {
|
objects.attr("id", "pop")
|
||||||
const element = this;
|
.attr("data-container", "body")
|
||||||
|
.attr("data-toggle", "popover")
|
||||||
|
.attr("data-placement", "right")
|
||||||
|
.attr("title", title);
|
||||||
|
|
||||||
element.addEventListener('mouseenter', () => {
|
objects.each(function (d, i) {
|
||||||
if (popoverTimeout) clearTimeout(popoverTimeout);
|
options = {trigger: "manual", html: true, animation: false};
|
||||||
|
this_ = this;
|
||||||
popoverTimeout = setTimeout(() => {
|
var p = $(this).popover(options).on("mouseenter", function () {
|
||||||
if (element.matches(':hover')) {
|
pop_show_e(this);
|
||||||
const content = contentFunction(d);
|
|
||||||
showPopover(element, title, content);
|
|
||||||
}
|
|
||||||
}, popupWaitBeforeShow);
|
|
||||||
});
|
});
|
||||||
|
p.on("show.bs.popover", function (e) {
|
||||||
element.addEventListener('mouseleave', () => {
|
// this is to dynamically ajdust the content and bounds of the popup
|
||||||
if (popoverTimeout) {
|
p.attr('data-content', contentFunction(d));
|
||||||
clearTimeout(popoverTimeout);
|
p.data("bs.popover").setContent();
|
||||||
popoverTimeout = null;
|
p.data("bs.popover").tip().css({"max-width": "1000px"});
|
||||||
}
|
|
||||||
|
|
||||||
// Delay hide to allow moving to popover
|
|
||||||
setTimeout(() => {
|
|
||||||
const popover = getPopover();
|
|
||||||
if (!popover.matches(':hover') && !element.matches(':hover')) {
|
|
||||||
hidePopover();
|
|
||||||
}
|
|
||||||
}, 100);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -372,7 +255,7 @@ function draw(pathway, elem) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
popupContent += "<img src='" + n.image + "'><br>"
|
popupContent += "<img src='" + n.image + "' width='" + 20 * nodeRadius + "'><br>"
|
||||||
if (n.scenarios.length > 0) {
|
if (n.scenarios.length > 0) {
|
||||||
popupContent += '<b>Half-lives and related scenarios:</b><br>'
|
popupContent += '<b>Half-lives and related scenarios:</b><br>'
|
||||||
for (var s of n.scenarios) {
|
for (var s of n.scenarios) {
|
||||||
@ -382,7 +265,7 @@ function draw(pathway, elem) {
|
|||||||
|
|
||||||
var isLeaf = pathway.links.filter(obj => obj.source.id === n.id).length === 0;
|
var isLeaf = pathway.links.filter(obj => obj.source.id === n.id).length === 0;
|
||||||
if (pathway.isIncremental && isLeaf) {
|
if (pathway.isIncremental && isLeaf) {
|
||||||
popupContent += '<br><a class="btn btn-primary btn-sm mt-2" onclick="predictFromNode(\'' + n.url + '\')" href="#">Predict from here</a><br>';
|
popupContent += '<br><a class="btn btn-primary" onclick="predictFromNode(\'' + n.url + '\')" href="#">Predict from here</a><br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return popupContent;
|
return popupContent;
|
||||||
@ -402,7 +285,7 @@ function draw(pathway, elem) {
|
|||||||
popupContent += adcontent;
|
popupContent += adcontent;
|
||||||
}
|
}
|
||||||
|
|
||||||
popupContent += "<img src='" + e.image + "'><br>"
|
popupContent += "<img src='" + e.image + "' width='" + 20 * nodeRadius + "'><br>"
|
||||||
if (e.reaction_probability) {
|
if (e.reaction_probability) {
|
||||||
popupContent += '<b>Probability:</b><br>' + e.reaction_probability.toFixed(3) + '<br>';
|
popupContent += '<b>Probability:</b><br>' + e.reaction_probability.toFixed(3) + '<br>';
|
||||||
}
|
}
|
||||||
@ -425,23 +308,6 @@ function draw(pathway, elem) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const zoomable = d3.select("#zoomable");
|
const zoomable = d3.select("#zoomable");
|
||||||
const svg = d3.select("#pwsvg");
|
|
||||||
const container = d3.select("#vizdiv");
|
|
||||||
|
|
||||||
// Set explicit SVG dimensions for proper zoom behavior
|
|
||||||
svg.attr("width", width)
|
|
||||||
.attr("height", height);
|
|
||||||
|
|
||||||
// Add background rectangle FIRST to enable pan/zoom on empty space
|
|
||||||
// This must be inserted before zoomable group so it's behind everything
|
|
||||||
svg.insert("rect", "#zoomable")
|
|
||||||
.attr("x", 0)
|
|
||||||
.attr("y", 0)
|
|
||||||
.attr("width", width)
|
|
||||||
.attr("height", height)
|
|
||||||
.attr("fill", "transparent")
|
|
||||||
.attr("pointer-events", "all")
|
|
||||||
.style("cursor", "grab");
|
|
||||||
|
|
||||||
// Zoom Funktion aktivieren
|
// Zoom Funktion aktivieren
|
||||||
const zoom = d3.zoom()
|
const zoom = d3.zoom()
|
||||||
@ -450,12 +316,7 @@ function draw(pathway, elem) {
|
|||||||
zoomable.attr("transform", event.transform);
|
zoomable.attr("transform", event.transform);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Apply zoom to the SVG element - this enables wheel zoom
|
d3.select("svg").call(zoom);
|
||||||
svg.call(zoom);
|
|
||||||
|
|
||||||
// Also apply zoom to container to catch events that might not reach SVG
|
|
||||||
// This ensures drag-to-pan works even when clicking on empty space
|
|
||||||
container.call(zoom);
|
|
||||||
|
|
||||||
nodes = pathway['nodes'];
|
nodes = pathway['nodes'];
|
||||||
links = pathway['links'];
|
links = pathway['links'];
|
||||||
|
|||||||
@ -1,10 +1,6 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#new_compound_modal">
|
||||||
role="button"
|
<span class="glyphicon glyphicon-plus"></span> New Compound</a>
|
||||||
onclick="document.getElementById('new_compound_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<span class="glyphicon glyphicon-plus"></span> New Compound</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -1,10 +1,6 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#new_compound_structure_modal">
|
||||||
role="button"
|
<span class="glyphicon glyphicon-plus"></span> New Compound Structure</a>
|
||||||
onclick="document.getElementById('new_compound_structure_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<span class="glyphicon glyphicon-plus"></span> New Compound Structure</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -1,10 +1,6 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#new_edge_modal">
|
||||||
role="button"
|
<span class="glyphicon glyphicon-plus"></span> New Edge</a>
|
||||||
onclick="document.getElementById('new_edge_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<span class="glyphicon glyphicon-plus"></span> New Edge</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -1,8 +1,4 @@
|
|||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#new_group_modal">
|
||||||
role="button"
|
<span class="glyphicon glyphicon-plus"></span> New Group</a>
|
||||||
onclick="document.getElementById('new_group_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<span class="glyphicon glyphicon-plus"></span> New Group</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@ -1,10 +1,6 @@
|
|||||||
{% if meta.can_edit and meta.enabled_features.MODEL_BUILDING %}
|
{% if meta.can_edit and meta.enabled_features.MODEL_BUILDING %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#new_model_modal">
|
||||||
role="button"
|
<span class="glyphicon glyphicon-plus"></span> New Model</a>
|
||||||
onclick="document.getElementById('new_model_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<span class="glyphicon glyphicon-plus"></span> New Model</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@ -1,10 +1,6 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#new_node_modal">
|
||||||
role="button"
|
<span class="glyphicon glyphicon-plus"></span> New Node</a>
|
||||||
onclick="document.getElementById('new_node_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<span class="glyphicon glyphicon-plus"></span> New Node</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -1,25 +1,12 @@
|
|||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#new_package_modal">
|
||||||
role="button"
|
<span class="glyphicon glyphicon-plus"></span> New Package</a>
|
||||||
onclick="document.getElementById('new_package_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<span class="glyphicon glyphicon-plus"></span> New Package</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#import_package_modal">
|
||||||
role="button"
|
<span class="glyphicon glyphicon-import"></span> Import Package from JSON</a>
|
||||||
onclick="document.getElementById('import_package_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<span class="glyphicon glyphicon-import"></span> Import Package from JSON</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#import_legacy_package_modal">
|
||||||
role="button"
|
<span class="glyphicon glyphicon-import"></span> Import Package from legacy JSON</a>
|
||||||
onclick="document.getElementById('import_legacy_package_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<span class="glyphicon glyphicon-import"></span> Import Package from legacy
|
|
||||||
JSON</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
@ -1,9 +1,6 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a href="{{ meta.server_url }}/predict">
|
||||||
href="{% if meta.current_package %}{{ meta.current_package.url }}/predict{% else %}{{ meta.server_url }}/predict{% endif %}"
|
<span class="glyphicon glyphicon-plus"></span> New Pathway</a>
|
||||||
>
|
|
||||||
<span class="glyphicon glyphicon-plus"></span> New Pathway</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@ -1,10 +1,6 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#new_reaction_modal">
|
||||||
role="button"
|
<span class="glyphicon glyphicon-plus"></span> New Reaction</a>
|
||||||
onclick="document.getElementById('new_reaction_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<span class="glyphicon glyphicon-plus"></span> New Reaction</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -1,10 +1,6 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#new_rule_modal">
|
||||||
role="button"
|
<span class="glyphicon glyphicon-plus"></span> New Rule</a>
|
||||||
onclick="document.getElementById('new_rule_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<span class="glyphicon glyphicon-plus"></span> New Rule</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@ -1,10 +1,6 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#new_scenario_modal">
|
||||||
role="button"
|
<span class="glyphicon glyphicon-plus"></span> New Scenario</a>
|
||||||
onclick="document.getElementById('new_scenario_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<span class="glyphicon glyphicon-plus"></span> New Scenario</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -1,10 +1,6 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#new_setting_modal">
|
||||||
role="button"
|
<span class="glyphicon glyphicon-plus"></span>New Setting</a>
|
||||||
onclick="document.getElementById('new_setting_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<span class="glyphicon glyphicon-plus"></span>New Setting</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -1,60 +1,32 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#edit_compound_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-edit"></i> Edit Compound</a>
|
||||||
onclick="document.getElementById('edit_compound_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-edit"></i> Edit Compound</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#set_aliases_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a>
|
||||||
onclick="document.getElementById('set_aliases_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#add_structure_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-plus"></i> Add Structure</a>
|
||||||
onclick="document.getElementById('add_structure_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> Add Structure</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#set_scenario_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a>
|
||||||
onclick="document.getElementById('set_scenario_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#generic_set_external_reference_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-plus"></i> Set External Reference</a>
|
||||||
onclick="document.getElementById('generic_set_external_reference_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> Set External Reference</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#generic_copy_object_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-duplicate"></i> Copy</a>
|
||||||
onclick="document.getElementById('generic_copy_object_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-duplicate"></i> Copy</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="button" data-toggle="modal" data-target="#generic_delete_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-trash"></i> Delete Compound</a>
|
||||||
onclick="document.getElementById('generic_delete_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-trash"></i> Delete Compound</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@ -1,42 +1,22 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#edit_compound_structure_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-edit"></i> Edit Compound Structure</a>
|
||||||
onclick="document.getElementById('edit_compound_structure_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-edit"></i> Edit Compound Structure</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#set_aliases_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a>
|
||||||
onclick="document.getElementById('set_aliases_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#set_scenario_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a>
|
||||||
onclick="document.getElementById('set_scenario_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#generic_set_external_reference_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-plus"></i> Set External Reference</a>
|
||||||
onclick="document.getElementById('generic_set_external_reference_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> Set External Reference</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="button" data-toggle="modal" data-target="#generic_delete_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-trash"></i> Delete Compound Structure</a>
|
||||||
onclick="document.getElementById('generic_delete_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-trash"></i> Delete Compound Structure</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@ -1,26 +1,14 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#set_aliases_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a>
|
||||||
onclick="document.getElementById('set_aliases_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#set_scenario_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a>
|
||||||
onclick="document.getElementById('set_scenario_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="button" data-toggle="modal" data-target="#generic_delete_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-trash"></i> Delete Edge</a>
|
||||||
onclick="document.getElementById('generic_delete_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-trash"></i> Delete Edge</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@ -1,18 +1,10 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#edit_group_member_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-trash"></i> Add/Remove Member</a>
|
||||||
onclick="document.getElementById('edit_group_member_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-trash"></i> Add/Remove Member</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#generic_delete_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-trash"></i> Delete Group</a>
|
||||||
onclick="document.getElementById('generic_delete_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-trash"></i> Delete Group</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -1,34 +1,18 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#edit_model_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-edit"></i> Edit Model</a>
|
||||||
onclick="document.getElementById('edit_model_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-edit"></i> Edit Model</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#evaluate_model_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-ok"></i> Evaluate Model</a>
|
||||||
onclick="document.getElementById('evaluate_model_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-ok"></i> Evaluate Model</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#retrain_model_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-repeat"></i> Retrain Model</a>
|
||||||
onclick="document.getElementById('retrain_model_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-repeat"></i> Retrain Model</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="button" data-toggle="modal" data-target="#generic_delete_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-trash"></i> Delete Model</a>
|
||||||
onclick="document.getElementById('generic_delete_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-trash"></i> Delete Model</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -1,34 +1,18 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#edit_node_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-edit"></i> Edit Node</a>
|
||||||
onclick="document.getElementById('edit_node_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-edit"></i> Edit Node</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#set_aliases_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a>
|
||||||
onclick="document.getElementById('set_aliases_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#set_scenario_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a>
|
||||||
onclick="document.getElementById('set_scenario_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="button" data-toggle="modal" data-target="#generic_delete_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-trash"></i> Delete Node</a>
|
||||||
onclick="document.getElementById('generic_delete_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-trash"></i> Delete Node</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@ -1,50 +1,26 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#edit_package_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-edit"></i> Edit Package</a>
|
||||||
onclick="document.getElementById('edit_package_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-edit"></i> Edit Package</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#edit_package_permissions_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-user"></i> Edit Permissions</a>
|
||||||
onclick="document.getElementById('edit_package_permissions_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-user"></i> Edit Permissions</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#publish_package_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-bullhorn"></i> Publish Package</a>
|
||||||
onclick="document.getElementById('publish_package_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-bullhorn"></i> Publish Package</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#export_package_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-bullhorn"></i> Export Package as JSON</a>
|
||||||
onclick="document.getElementById('export_package_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-bullhorn"></i> Export Package as JSON</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#set_license_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-duplicate"></i> License</a>
|
||||||
onclick="document.getElementById('set_license_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-duplicate"></i> License</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="button" data-toggle="modal" data-target="#generic_delete_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-trash"></i> Delete Package</a>
|
||||||
onclick="document.getElementById('generic_delete_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-trash"></i> Delete Package</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -1,104 +1,59 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="button" data-toggle="modal" data-target="#add_pathway_node_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-plus"></i> Add Compound</a>
|
||||||
onclick="document.getElementById('add_pathway_node_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> Add Compound</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="button" data-toggle="modal" data-target="#add_pathway_edge_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-plus"></i> Add Reaction</a>
|
||||||
onclick="document.getElementById('add_pathway_edge_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> Add Reaction</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li role="separator" class="divider"></li>
|
<li role="separator" class="divider"></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#generic_copy_object_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-duplicate"></i> Copy</a>
|
||||||
onclick="document.getElementById('generic_copy_object_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-duplicate"></i> Copy</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="button" data-toggle="modal" data-target="#download_pathway_csv_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-floppy-save"></i> Download Pathway as CSV</a>
|
||||||
onclick="document.getElementById('download_pathway_csv_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-floppy-save"></i> Download Pathway as CSV</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="button" data-toggle="modal" data-target="#download_pathway_image_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-floppy-save"></i> Download Pathway as Image</a>
|
||||||
onclick="document.getElementById('download_pathway_image_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-floppy-save"></i> Download Pathway as Image</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="button" data-toggle="modal" data-target="#identify_missing_rules_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-question-sign"></i> Identify Missing Rules</a>
|
||||||
onclick="document.getElementById('identify_missing_rules_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-question-sign"></i> Identify Missing
|
|
||||||
Rules</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li role="separator" class="divider"></li>
|
<li role="separator" class="divider"></li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="button" data-toggle="modal" data-target="#edit_pathway_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-edit"></i> Edit Pathway</a>
|
||||||
onclick="document.getElementById('edit_pathway_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-edit"></i> Edit Pathway</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#set_scenario_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a>
|
||||||
onclick="document.getElementById('set_scenario_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#set_aliases_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a>
|
||||||
onclick="document.getElementById('set_aliases_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
|
{# <li>#}
|
||||||
|
{# <a class="button" data-toggle="modal" data-target="#add_pathway_edge_modal">#}
|
||||||
|
{# <i class="glyphicon glyphicon-plus"></i> Calculate Compound Properties</a>#}
|
||||||
|
{# </li>#}
|
||||||
<li role="separator" class="divider"></li>
|
<li role="separator" class="divider"></li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="button" data-toggle="modal" data-target="#delete_pathway_node_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-trash"></i> Delete Compound</a>
|
||||||
onclick="document.getElementById('delete_pathway_node_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-trash"></i> Delete Compound</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="button" data-toggle="modal" data-target="#delete_pathway_edge_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-trash"></i> Delete Reaction</a>
|
||||||
onclick="document.getElementById('delete_pathway_edge_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-trash"></i> Delete Reaction</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="button" data-toggle="modal" data-target="#generic_delete_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-trash"></i> Delete Pathway</a>
|
||||||
onclick="document.getElementById('generic_delete_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-trash"></i> Delete Pathway</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@ -1,52 +1,28 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#edit_reaction_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-edit"></i> Edit Reaction</a>
|
||||||
onclick="document.getElementById('edit_reaction_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-edit"></i> Edit Reaction</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#set_aliases_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a>
|
||||||
onclick="document.getElementById('set_aliases_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#set_scenario_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a>
|
||||||
onclick="document.getElementById('set_scenario_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#generic_set_external_reference_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-plus"></i> Set External Reference</a>
|
||||||
onclick="document.getElementById('generic_set_external_reference_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> Set External Reference</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#generic_copy_object_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-duplicate"></i> Copy</a>
|
||||||
onclick="document.getElementById('generic_copy_object_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-duplicate"></i> Copy</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="button" data-toggle="modal" data-target="#generic_delete_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-trash"></i> Delete Reaction</a>
|
||||||
onclick="document.getElementById('generic_delete_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-trash"></i> Delete Reaction</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@ -1,44 +1,24 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#edit_rule_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-edit"></i> Edit Rule</a>
|
||||||
onclick="document.getElementById('edit_rule_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-edit"></i> Edit Rule</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#set_aliases_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a>
|
||||||
onclick="document.getElementById('set_aliases_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> Set Aliases</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#set_scenario_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a>
|
||||||
onclick="document.getElementById('set_scenario_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> Set Scenarios</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#generic_copy_object_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-duplicate"></i> Copy</a>
|
||||||
onclick="document.getElementById('generic_copy_object_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-duplicate"></i> Copy</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="button" data-toggle="modal" data-target="#generic_delete_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-trash"></i> Delete Rule</a>
|
||||||
onclick="document.getElementById('generic_delete_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-trash"></i> Delete Rule</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@ -1,26 +1,14 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="button" data-toggle="modal" data-target="#add_additional_information_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-trash"></i> Add Additional Information</a>
|
||||||
onclick="document.getElementById('add_additional_information_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-trash"></i> Add Additional Information</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="button" data-toggle="modal" data-target="#update_scenario_additional_information_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-trash"></i> Set Additional Information</a>
|
||||||
onclick="document.getElementById('update_scenario_additional_information_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-trash"></i> Set Additional Information</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a class="button" data-toggle="modal" data-target="#generic_delete_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-trash"></i> Delete Scenario</a>
|
||||||
onclick="document.getElementById('generic_delete_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-trash"></i> Delete Scenario</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -1,38 +1,22 @@
|
|||||||
{% if meta.can_edit %}
|
{% if meta.can_edit %}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#edit_user_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-edit"></i> Update</a>
|
||||||
onclick="document.getElementById('edit_user_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-edit"></i> Update</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#edit_password_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-lock"></i> Update Password</a>
|
||||||
onclick="document.getElementById('edit_password_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-lock"></i> Update Password</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#new_prediction_setting_modal">
|
||||||
role="button"
|
<i class="glyphicon glyphicon-plus"></i> New Prediction Setting</a>
|
||||||
onclick="document.getElementById('new_prediction_setting_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-plus"></i> New Prediction Setting</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{# <li>#}
|
{# <li>#}
|
||||||
{# <a role="button" data-toggle="modal" data-target="#manage_api_token_modal">#}
|
{# <a role="button" data-toggle="modal" data-target="#manage_api_token_modal">#}
|
||||||
{# <i class="glyphicon glyphicon-console"></i> Manage API Token</a>#}
|
{# <i class="glyphicon glyphicon-console"></i> Manage API Token</a>#}
|
||||||
{# </li>#}
|
{# </li>#}
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a role="button" data-toggle="modal" data-target="#generic_delete_modal">
|
||||||
class="button"
|
<i class="glyphicon glyphicon-trash"></i> Delete Account</a>
|
||||||
onclick="document.getElementById('generic_delete_modal').showModal(); return false;"
|
|
||||||
>
|
|
||||||
<i class="glyphicon glyphicon-trash"></i> Delete Account</a
|
|
||||||
>
|
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -1,17 +1,12 @@
|
|||||||
{% extends "framework.html" %}
|
{% extends "framework.html" %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="searchContent">
|
|
||||||
|
<div id=searchContent>
|
||||||
<form id="admin-form" action="{{ SERVER_BASE }}/admin" method="post">
|
<form id="admin-form" action="{{ SERVER_BASE }}/admin" method="post">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="textarea">Query</label>
|
<label for="textarea">Query</label>
|
||||||
<textarea
|
<textarea id="textarea" class="form-control" rows="10" placeholder="Paste query here" required>
|
||||||
id="textarea"
|
|
||||||
class="form-control"
|
|
||||||
rows="10"
|
|
||||||
placeholder="Paste query here"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
PREFIX pps: <http://localhost:8080/vocabulary#>
|
PREFIX pps: <http://localhost:8080/vocabulary#>
|
||||||
SELECT ?name (count(?objId) as ?xcnt)
|
SELECT ?name (count(?objId) as ?xcnt)
|
||||||
WHERE {
|
WHERE {
|
||||||
@ -20,29 +15,32 @@ WHERE {
|
|||||||
?packageId pps:reviewStatus 'reviewed' .
|
?packageId pps:reviewStatus 'reviewed' .
|
||||||
?packageId pps:pathway ?objId .
|
?packageId pps:pathway ?objId .
|
||||||
} GROUP BY ?name
|
} GROUP BY ?name
|
||||||
</textarea
|
</textarea>
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
<button id="submit" type="button" class="btn btn-primary">Submit</button>
|
<button id="submit" type="button" class="btn btn-primary">Submit</button>
|
||||||
</form>
|
</form>
|
||||||
<p></p>
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
<div id="results"></div>
|
<div id="results">
|
||||||
|
</div>
|
||||||
<div id="loading"></div>
|
<div id="loading"></div>
|
||||||
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
$("#submit").on("click", function () {
|
$('#submit').on('click', function() {
|
||||||
|
|
||||||
makeLoadingGif("#loading", "{% static '/images/wait.gif' %}");
|
makeLoadingGif("#loading", "{% static '/images/wait.gif' %}");
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
query: $("#textarea").val(),
|
"query": $("#textarea").val()
|
||||||
};
|
}
|
||||||
|
|
||||||
$.post("{{ SERVER_BASE }}/expire", data, function(result) {
|
$.post("{{ SERVER_BASE }}/expire", data, function(result) {
|
||||||
$("#loading").empty();
|
$("#loading").empty();
|
||||||
queryResultToTable("results", result);
|
queryResultToTable("results", result);
|
||||||
|
})
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|||||||
@ -1,52 +1,48 @@
|
|||||||
{% extends "framework_modern.html" %}
|
{% extends "framework.html" %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% load envipytags %}
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="space-y-2 p-4">
|
|
||||||
<!-- Header Section -->
|
<div class="panel-group" id="reviewListAccordion">
|
||||||
<div class="card bg-base-100">
|
<div class="panel panel-default">
|
||||||
<div class="card-body">
|
<div class="panel-heading" id="headingPanel" style="font-size:2rem;height: 46px">
|
||||||
<h2 class="card-title text-2xl">User Prediction Jobs</h2>
|
Jobs
|
||||||
<p class="mt-2">Job Logs Desc</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<p>
|
||||||
|
Job Logs Desc
|
||||||
|
</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Jobs -->
|
<div class="panel panel-default panel-heading list-group-item" style="background-color:silver">
|
||||||
<div class="collapse-arrow bg-base-200 collapse">
|
<h4 class="panel-title">
|
||||||
<input type="checkbox" checked />
|
<a id="job-accordion-link" data-toggle="collapse" data-parent="#job-accordion" href="#jobs">
|
||||||
<div class="collapse-title text-xl font-medium">Recent Jobs</div>
|
Jobs
|
||||||
<div class="collapse-content" id="job-content">
|
</a>
|
||||||
<div class="overflow-x-auto">
|
</h4>
|
||||||
<table class="table-zebra table">
|
</div>
|
||||||
<thead>
|
<div id="jobs"
|
||||||
<tr>
|
class="panel-collapse collapse in">
|
||||||
<th>ID</th>
|
<div class="panel-body list-group-item" id="job-content">
|
||||||
<th>Name</th>
|
<table class="table table-bordered table-hover">
|
||||||
<th>Status</th>
|
<tr style="background-color: rgba(0, 0, 0, 0.08);">
|
||||||
<th>Queued</th>
|
<th scope="col">ID</th>
|
||||||
<th>Done</th>
|
<th scope="col">Name</th>
|
||||||
<th>Result</th>
|
<th scope="col">Status</th>
|
||||||
|
<th scope="col">Queued</th>
|
||||||
|
<th scope="col">Done</th>
|
||||||
|
<th scope="col">Result</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for job in jobs %}
|
{% for job in jobs %}
|
||||||
<tr>
|
<tr>
|
||||||
{% if meta.user.is_superuser %}
|
|
||||||
<td>
|
|
||||||
<a href="{{ job.user.url }}">{{ job.user.username }}</a>
|
|
||||||
</td>
|
|
||||||
{% endif %}
|
|
||||||
<td>{{ job.task_id }}</td>
|
<td>{{ job.task_id }}</td>
|
||||||
<td>{{ job.job_name }}</td>
|
<td>{{ job.job_name }}</td>
|
||||||
<td>{{ job.status }}</td>
|
<td>{{ job.status }}</td>
|
||||||
<td>{{ job.created }}</td>
|
<td>{{ job.created }}</td>
|
||||||
<td>{{ job.done_at }}</td>
|
<td>{{ job.done_at }}</td>
|
||||||
{% if job.task_result and job.task_result|is_url == True %}
|
{% if job.task_result and job.task_result|is_url == True %}
|
||||||
<td>
|
<td><a href="{{ job.task_result }}">Result</a></td>
|
||||||
<a href="{{ job.task_result }}" class="link link-primary"
|
|
||||||
>Result</a
|
|
||||||
>
|
|
||||||
</td>
|
|
||||||
{% elif job.task_result %}
|
{% elif job.task_result %}
|
||||||
<td>{{ job.task_result|slice:"40" }}...</td>
|
<td>{{ job.task_result|slice:"40" }}...</td>
|
||||||
{% else %}
|
{% else %}
|
||||||
@ -58,31 +54,17 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
{% if objects %}
|
|
||||||
<!-- Unreviewable objects such as User / Group / Setting -->
|
<!-- Unreviewable objects such as User / Group / Setting -->
|
||||||
<div class="card bg-base-100 shadow-xl">
|
<ul class='list-group'>
|
||||||
<div class="card-body">
|
|
||||||
<ul class="menu bg-base-200 rounded-box">
|
|
||||||
{% for obj in objects %}
|
{% for obj in objects %}
|
||||||
{% if object_type == 'user' %}
|
{% if object_type == 'user' %}
|
||||||
<li>
|
<a class="list-group-item" href="{{ obj.url }}">{{ obj.username }}</a>
|
||||||
<a href="{{ obj.url }}" class="hover:bg-base-300"
|
|
||||||
>{{ obj.username }}</a
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<li>
|
<a class="list-group-item" href="{{ obj.url }}">{{ obj.name }}</a>
|
||||||
<a href="{{ obj.url }}" class="hover:bg-base-300"
|
|
||||||
>{{ obj.name }}</a
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|||||||
@ -1,32 +1,20 @@
|
|||||||
{% extends "framework_modern.html" %}
|
{% extends "framework.html" %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{# Serialize objects data for Alpine pagination #}
|
|
||||||
{# prettier-ignore-start #}
|
|
||||||
{# FIXME: This is a hack to get the objects data into the JavaScript code. #}
|
|
||||||
<script>
|
|
||||||
window.reviewedObjects = [
|
|
||||||
{% for obj in reviewed_objects %}
|
|
||||||
{ "name": "{{ obj.name|escapejs }}", "url": "{{ obj.url }}" }{% if not forloop.last %},{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
];
|
|
||||||
window.unreviewedObjects = [
|
|
||||||
{% for obj in unreviewed_objects %}
|
|
||||||
{ "name": "{{ obj.name|escapejs }}", "url": "{{ obj.url }}" }{% if not forloop.last %},{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
];
|
|
||||||
</script>
|
|
||||||
{# prettier-ignore-end #}
|
|
||||||
|
|
||||||
{% if object_type != 'package' %}
|
{% if object_type != 'package' %}
|
||||||
<div class="px-8 py-4">
|
<div>
|
||||||
<input
|
<div id="load-all-error" style="display: none;">
|
||||||
type="text"
|
<div class="alert alert-danger" role="alert">
|
||||||
id="object-search"
|
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
|
||||||
class="input input-bordered hidden w-full max-w-xs"
|
<span class="sr-only">Error:</span>
|
||||||
placeholder="Search by name"
|
Getting objects failed!
|
||||||
/>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="text" id="object-search" class="form-control" placeholder="Search by name"
|
||||||
|
style="display: none;">
|
||||||
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@ -60,12 +48,9 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock action_modals %}
|
{% endblock action_modals %}
|
||||||
|
|
||||||
<div class="px-8 py-4">
|
<div class="panel-group" id="reviewListAccordion">
|
||||||
<!-- Header Section -->
|
<div class="panel panel-default">
|
||||||
<div class="card bg-base-100">
|
<div class="panel-heading" id="headingPanel" style="font-size:2rem;height: 46px">
|
||||||
<div class="card-body px-0 py-4">
|
|
||||||
<div class="flex items-center justify-between">
|
|
||||||
<h2 class="card-title text-2xl">
|
|
||||||
{% if object_type == 'package' %}
|
{% if object_type == 'package' %}
|
||||||
Packages
|
Packages
|
||||||
{% elif object_type == 'compound' %}
|
{% elif object_type == 'compound' %}
|
||||||
@ -93,31 +78,13 @@
|
|||||||
{% elif object_type == 'group' %}
|
{% elif object_type == 'group' %}
|
||||||
Groups
|
Groups
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</h2>
|
<div id="actionsButton"
|
||||||
<div id="actionsButton" class="dropdown dropdown-end hidden">
|
style="float: right;font-weight: normal;font-size: medium;position: relative; top: 50%; transform: translateY(-50%);z-index:100;display: none;"
|
||||||
<div tabindex="0" role="button" class="btn btn-ghost btn-sm">
|
class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
|
||||||
<svg
|
aria-haspopup="true" aria-expanded="false"><span
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
class="glyphicon glyphicon-wrench"></span> Actions <span class="caret"></span><span
|
||||||
width="16"
|
style="padding-right:1em"></span></a>
|
||||||
height="16"
|
<ul id="actionsList" class="dropdown-menu">
|
||||||
viewBox="0 0 24 24"
|
|
||||||
fill="none"
|
|
||||||
stroke="currentColor"
|
|
||||||
stroke-width="2"
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
class="lucide lucide-wrench"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
Actions
|
|
||||||
</div>
|
|
||||||
<ul
|
|
||||||
tabindex="-1"
|
|
||||||
class="dropdown-content menu bg-base-100 rounded-box z-50 w-52 p-2"
|
|
||||||
>
|
|
||||||
{% block actions %}
|
{% block actions %}
|
||||||
{% if object_type == 'package' %}
|
{% if object_type == 'package' %}
|
||||||
{% include "actions/collections/package.html" %}
|
{% include "actions/collections/package.html" %}
|
||||||
@ -148,386 +115,205 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-2">
|
<div class="panel-body">
|
||||||
<!-- Set Text above links -->
|
<!-- Set Text above links -->
|
||||||
{% if object_type == 'package' %}
|
{% if object_type == 'package' %}
|
||||||
<p>
|
<p>A package contains pathways, rules, etc. and can reflect specific experimental
|
||||||
A package contains pathways, rules, etc. and can reflect specific
|
conditions. <a target="_blank" href="https://wiki.envipath.org/index.php/packages" role="button">Learn
|
||||||
experimental conditions.
|
more >></a></p>
|
||||||
<a
|
|
||||||
target="_blank"
|
|
||||||
href="https://wiki.envipath.org/index.php/packages"
|
|
||||||
class="link link-primary"
|
|
||||||
>Learn more >></a
|
|
||||||
>
|
|
||||||
</p>
|
|
||||||
{% elif object_type == 'compound' %}
|
{% elif object_type == 'compound' %}
|
||||||
<p>
|
<p>A compound stores the structure of a molecule and can include meta-information.
|
||||||
A compound stores the structure of a molecule and can include
|
<a target="_blank" href="https://wiki.envipath.org/index.php/compounds" role="button">Learn more
|
||||||
meta-information.
|
>></a></p>
|
||||||
<a
|
|
||||||
target="_blank"
|
|
||||||
href="https://wiki.envipath.org/index.php/compounds"
|
|
||||||
class="link link-primary"
|
|
||||||
>Learn more >></a
|
|
||||||
>
|
|
||||||
</p>
|
|
||||||
{% elif object_type == 'structure' %}
|
{% elif object_type == 'structure' %}
|
||||||
<p>
|
<p>The structures stored in this compound
|
||||||
The structures stored in this compound
|
<a target="_blank" href="https://wiki.envipath.org/index.php/compounds" role="button">Learn more
|
||||||
<a
|
>></a></p>
|
||||||
target="_blank"
|
|
||||||
href="https://wiki.envipath.org/index.php/compounds"
|
|
||||||
class="link link-primary"
|
|
||||||
>Learn more >></a
|
|
||||||
>
|
|
||||||
</p>
|
|
||||||
{% elif object_type == 'rule' %}
|
{% elif object_type == 'rule' %}
|
||||||
<p>
|
<p>A rule describes a biotransformation reaction template that is defined as SMIRKS.
|
||||||
A rule describes a biotransformation reaction template that is
|
<a target="_blank" href="https://wiki.envipath.org/index.php/Rules" role="button">Learn more
|
||||||
defined as SMIRKS.
|
>></a></p>
|
||||||
<a
|
|
||||||
target="_blank"
|
|
||||||
href="https://wiki.envipath.org/index.php/Rules"
|
|
||||||
class="link link-primary"
|
|
||||||
>Learn more >></a
|
|
||||||
>
|
|
||||||
</p>
|
|
||||||
{% elif object_type == 'reaction' %}
|
{% elif object_type == 'reaction' %}
|
||||||
<p>
|
<p>A reaction is a specific biotransformation from educt compounds to product compounds.
|
||||||
A reaction is a specific biotransformation from educt compounds to
|
<a target="_blank" href="https://wiki.envipath.org/index.php/reactions" role="button">Learn more
|
||||||
product compounds.
|
>></a></p>
|
||||||
<a
|
|
||||||
target="_blank"
|
|
||||||
href="https://wiki.envipath.org/index.php/reactions"
|
|
||||||
class="link link-primary"
|
|
||||||
>Learn more >></a
|
|
||||||
>
|
|
||||||
</p>
|
|
||||||
{% elif object_type == 'pathway' %}
|
{% elif object_type == 'pathway' %}
|
||||||
<p>
|
<p>A pathway displays the (predicted) biodegradation of a compound as graph.
|
||||||
A pathway displays the (predicted) biodegradation of a compound as
|
<a target="_blank" href="https://wiki.envipath.org/index.php/pathways" role="button">Learn more
|
||||||
graph.
|
>></a></p>
|
||||||
<a
|
|
||||||
target="_blank"
|
|
||||||
href="https://wiki.envipath.org/index.php/pathways"
|
|
||||||
class="link link-primary"
|
|
||||||
>Learn more >></a
|
|
||||||
>
|
|
||||||
</p>
|
|
||||||
{% elif object_type == 'node' %}
|
{% elif object_type == 'node' %}
|
||||||
<p>
|
<p>Nodes represent the (predicted) compounds in a graph.
|
||||||
Nodes represent the (predicted) compounds in a graph.
|
<a target="_blank" href="https://wiki.envipath.org/index.php/nodes" role="button">Learn more
|
||||||
<a
|
>></a></p>
|
||||||
target="_blank"
|
|
||||||
href="https://wiki.envipath.org/index.php/nodes"
|
|
||||||
class="link link-primary"
|
|
||||||
>Learn more >></a
|
|
||||||
>
|
|
||||||
</p>
|
|
||||||
{% elif object_type == 'edge' %}
|
{% elif object_type == 'edge' %}
|
||||||
<p>
|
<p>Edges represent the links between Nodes in a graph
|
||||||
Edges represent the links between Nodes in a graph
|
<a target="_blank" href="https://wiki.envipath.org/index.php/edges" role="button">Learn more
|
||||||
<a
|
>></a></p>
|
||||||
target="_blank"
|
|
||||||
href="https://wiki.envipath.org/index.php/edges"
|
|
||||||
class="link link-primary"
|
|
||||||
>Learn more >></a
|
|
||||||
>
|
|
||||||
</p>
|
|
||||||
{% elif object_type == 'scenario' %}
|
{% elif object_type == 'scenario' %}
|
||||||
<p>
|
<p>A scenario contains meta-information that can be attached to other data (compounds, rules, ..).
|
||||||
A scenario contains meta-information that can be attached to other
|
<a target="_blank" href="https://wiki.envipath.org/index.php/scenarios" role="button">Learn more
|
||||||
data (compounds, rules, ..).
|
>></a></p>
|
||||||
<a
|
|
||||||
target="_blank"
|
|
||||||
href="https://wiki.envipath.org/index.php/scenarios"
|
|
||||||
class="link link-primary"
|
|
||||||
>Learn more >></a
|
|
||||||
>
|
|
||||||
</p>
|
|
||||||
{% elif object_type == 'model' %}
|
{% elif object_type == 'model' %}
|
||||||
<p>
|
<p>A model applies machine learning to limit the combinatorial explosion.
|
||||||
A model applies machine learning to limit the combinatorial
|
<a target="_blank" href="https://wiki.envipath.org/index.php/relative_reasoning" role="button">Learn
|
||||||
explosion.
|
more
|
||||||
<a
|
>></a></p>
|
||||||
target="_blank"
|
|
||||||
href="https://wiki.envipath.org/index.php/relative_reasoning"
|
|
||||||
class="link link-primary"
|
|
||||||
>Learn more >></a
|
|
||||||
>
|
|
||||||
</p>
|
|
||||||
{% elif object_type == 'setting' %}
|
{% elif object_type == 'setting' %}
|
||||||
<p>
|
<p>A setting includes configuration parameters for pathway predictions.
|
||||||
A setting includes configuration parameters for pathway
|
<a target="_blank" href="https://wiki.envipath.org/index.php/settings" role="button">Learn more
|
||||||
predictions.
|
>></a></p>
|
||||||
<a
|
|
||||||
target="_blank"
|
|
||||||
href="https://wiki.envipath.org/index.php/settings"
|
|
||||||
class="link link-primary"
|
|
||||||
>Learn more >></a
|
|
||||||
>
|
|
||||||
</p>
|
|
||||||
{% elif object_type == 'user' %}
|
{% elif object_type == 'user' %}
|
||||||
<p>
|
<p>Register now to create own packages and to submit and manage your data.
|
||||||
Register now to create own packages and to submit and manage your
|
<a target="_blank" href="https://wiki.envipath.org/index.php/users" role="button">Learn more
|
||||||
data.
|
>></a></p>
|
||||||
<a
|
|
||||||
target="_blank"
|
|
||||||
href="https://wiki.envipath.org/index.php/users"
|
|
||||||
class="link link-primary"
|
|
||||||
>Learn more >></a
|
|
||||||
>
|
|
||||||
</p>
|
|
||||||
{% elif object_type == 'group' %}
|
{% elif object_type == 'group' %}
|
||||||
<p>
|
<p>Users can team up in groups to share packages.
|
||||||
Users can team up in groups to share packages.
|
<a target="_blank" href="https://wiki.envipath.org/index.php/groups" role="button">Learn more
|
||||||
<a
|
>></a></p>
|
||||||
target="_blank"
|
|
||||||
href="https://wiki.envipath.org/index.php/groups"
|
|
||||||
class="link link-primary"
|
|
||||||
>Learn more >></a
|
|
||||||
>
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- If theres nothing to show extend the text above -->
|
<!-- If theres nothing to show extend the text above -->
|
||||||
{% if reviewed_objects and unreviewed_objects %}
|
{% if reviewed_objects and unreviewed_objects %}
|
||||||
{% if reviewed_objects|length == 0 and unreviewed_objects|length == 0 %}
|
{% if reviewed_objects|length == 0 and unreviewed_objects|length == 0 %}
|
||||||
<p class="mt-4">
|
<p>Nothing found. There are two possible reasons: <br><br>1. There is no content yet.<br>2. You have no
|
||||||
Nothing found. There are two possible reasons: <br /><br />1.
|
reading permissions.<br><br>Please be sure you have at least reading permissions.</p>
|
||||||
There is no content yet.<br />2. You have no reading
|
|
||||||
permissions.<br /><br />Please be sure you have at least reading
|
|
||||||
permissions.
|
|
||||||
</p>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Lists Container - Full Width with Reviewed on Right -->
|
|
||||||
<div class="w-full">
|
|
||||||
{% if reviewed_objects %}
|
{% if reviewed_objects %}
|
||||||
{% if reviewed_objects|length > 0 %}
|
{% if reviewed_objects|length > 0 %}
|
||||||
<!-- Reviewed -->
|
<div class="panel panel-default panel-heading list-group-item" style="background-color:silver">
|
||||||
<div
|
<h4 class="panel-title">
|
||||||
class="collapse-arrow bg-base-200 collapse order-2 w-full"
|
<a id="ReviewedLink" data-toggle="collapse" data-parent="#reviewListAccordion"
|
||||||
x-data="paginatedList(window.reviewedObjects || [], { isReviewed: true, instanceId: 'reviewed' })"
|
href="#Reviewed">Reviewed</a>
|
||||||
>
|
</h4>
|
||||||
<input type="checkbox" checked />
|
|
||||||
<div class="collapse-title text-xl font-medium">
|
|
||||||
Reviewed
|
|
||||||
<span
|
|
||||||
class="badge badge-sm badge-neutral ml-2"
|
|
||||||
x-text="totalItems"
|
|
||||||
></span>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="collapse-content w-full">
|
<div id="Reviewed" class="panel-collapse collapse in">
|
||||||
<ul class="menu bg-base-100 rounded-box w-full">
|
<div class="panel-body list-group-item" id="ReviewedContent">
|
||||||
<template x-for="obj in paginatedItems" :key="obj.url">
|
{% if object_type == 'package' %}
|
||||||
<li>
|
{% for obj in reviewed_objects %}
|
||||||
<a :href="obj.url" class="hover:bg-base-200">
|
<a class="list-group-item" href="{{ obj.url }}">{{ obj.name|safe }}
|
||||||
<span x-text="obj.name"></span>
|
<span class="glyphicon glyphicon-star" aria-hidden="true"
|
||||||
<span
|
style="float:right" data-toggle="tooltip"
|
||||||
class="tooltip tooltip-left ml-auto"
|
data-placement="top" title="" data-original-title="Reviewed">
|
||||||
data-tip="Reviewed"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
width="16"
|
|
||||||
height="16"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
fill="none"
|
|
||||||
stroke="currentColor"
|
|
||||||
stroke-width="2"
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
class="lucide lucide-star"
|
|
||||||
>
|
|
||||||
<polygon
|
|
||||||
points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
{% endfor %}
|
||||||
</template>
|
{% else %}
|
||||||
</ul>
|
{% for obj in reviewed_objects|slice:":50" %}
|
||||||
<!-- Pagination Controls -->
|
<a class="list-group-item" href="{{ obj.url }}">{{ obj.name|safe }}{# <i>({{ obj.package.name }})</i> #}
|
||||||
<div
|
<span class="glyphicon glyphicon-star" aria-hidden="true"
|
||||||
x-show="totalPages > 1"
|
style="float:right" data-toggle="tooltip"
|
||||||
class="mt-4 flex items-center justify-between px-2"
|
data-placement="top" title="" data-original-title="Reviewed">
|
||||||
>
|
|
||||||
<span class="text-base-content/70 text-sm">
|
|
||||||
Showing <span x-text="showingStart"></span>-<span
|
|
||||||
x-text="showingEnd"
|
|
||||||
></span>
|
|
||||||
of <span x-text="totalItems"></span>
|
|
||||||
</span>
|
</span>
|
||||||
<div class="join">
|
</a>
|
||||||
<button
|
{% endfor %}
|
||||||
class="join-item btn btn-sm"
|
{% endif %}
|
||||||
:disabled="currentPage === 1"
|
|
||||||
@click="prevPage()"
|
|
||||||
>
|
|
||||||
«
|
|
||||||
</button>
|
|
||||||
<template x-for="item in pageNumbers" :key="item.key">
|
|
||||||
<button
|
|
||||||
class="join-item btn btn-sm"
|
|
||||||
:class="{ 'btn-active': item.page === currentPage }"
|
|
||||||
:disabled="item.isEllipsis"
|
|
||||||
@click="!item.isEllipsis && goToPage(item.page)"
|
|
||||||
x-text="item.page"
|
|
||||||
></button>
|
|
||||||
</template>
|
|
||||||
<button
|
|
||||||
class="join-item btn btn-sm"
|
|
||||||
:disabled="currentPage === totalPages"
|
|
||||||
@click="nextPage()"
|
|
||||||
>
|
|
||||||
»
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if unreviewed_objects %}
|
{% if unreviewed_objects %}
|
||||||
<!-- Unreviewed -->
|
<div class="panel panel-default panel-heading list-group-item" style="background-color:silver"><h4
|
||||||
<div
|
class="panel-title"><a id="UnreviewedLink" data-toggle="collapse" data-parent="#unReviewListAccordion"
|
||||||
class="collapse-arrow bg-base-200 collapse order-1 w-full"
|
href="#Unreviewed">Unreviewed</a></h4></div>
|
||||||
x-data="paginatedList(window.unreviewedObjects || [], { isReviewed: false, instanceId: 'unreviewed' })"
|
<div id="Unreviewed" class="panel-collapse collapse {% if reviewed_objects|length == 0 or object_type == 'package' %}in{% endif %}">
|
||||||
>
|
<div class="panel-body list-group-item" id="UnreviewedContent">
|
||||||
<input
|
{% if object_type == 'package' %}
|
||||||
type="checkbox"
|
{% for obj in unreviewed_objects %}
|
||||||
{% if reviewed_objects|length == 0 or object_type == 'package' %}checked{% endif %}
|
<a class="list-group-item" href="{{ obj.url }}">{{ obj.name|safe }}</a>
|
||||||
/>
|
{% endfor %}
|
||||||
<div class="collapse-title text-xl font-medium">
|
{% else %}
|
||||||
Unreviewed
|
{% for obj in unreviewed_objects|slice:":50" %}
|
||||||
<span
|
<a class="list-group-item" href="{{ obj.url }}">{{ obj.name|safe }}</a>
|
||||||
class="badge badge-sm badge-neutral ml-2"
|
{% endfor %}
|
||||||
x-text="totalItems"
|
{% endif %}
|
||||||
></span>
|
|
||||||
</div>
|
|
||||||
<div class="collapse-content w-full">
|
|
||||||
<ul class="menu bg-base-100 rounded-box w-full">
|
|
||||||
<template x-for="obj in paginatedItems" :key="obj.url">
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
:href="obj.url"
|
|
||||||
class="hover:bg-base-200"
|
|
||||||
x-text="obj.name"
|
|
||||||
></a>
|
|
||||||
</li>
|
|
||||||
</template>
|
|
||||||
</ul>
|
|
||||||
<!-- Pagination Controls -->
|
|
||||||
<div
|
|
||||||
x-show="totalPages > 1"
|
|
||||||
class="mt-4 flex items-center justify-between px-2"
|
|
||||||
>
|
|
||||||
<span class="text-base-content/70 text-sm">
|
|
||||||
Showing <span x-text="showingStart"></span>-<span
|
|
||||||
x-text="showingEnd"
|
|
||||||
></span>
|
|
||||||
of <span x-text="totalItems"></span>
|
|
||||||
</span>
|
|
||||||
<div class="join">
|
|
||||||
<button
|
|
||||||
class="join-item btn btn-sm"
|
|
||||||
:disabled="currentPage === 1"
|
|
||||||
@click="prevPage()"
|
|
||||||
>
|
|
||||||
«
|
|
||||||
</button>
|
|
||||||
<template x-for="item in pageNumbers" :key="item.key">
|
|
||||||
<button
|
|
||||||
class="join-item btn btn-sm"
|
|
||||||
:class="{ 'btn-active': item.page === currentPage }"
|
|
||||||
:disabled="item.isEllipsis"
|
|
||||||
@click="!item.isEllipsis && goToPage(item.page)"
|
|
||||||
x-text="item.page"
|
|
||||||
></button>
|
|
||||||
</template>
|
|
||||||
<button
|
|
||||||
class="join-item btn btn-sm"
|
|
||||||
:disabled="currentPage === totalPages"
|
|
||||||
@click="nextPage()"
|
|
||||||
>
|
|
||||||
»
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
|
||||||
|
|
||||||
{% if objects %}
|
{% if objects %}
|
||||||
<!-- Unreviewable objects such as User / Group / Setting -->
|
<!-- Unreviewable objects such as User / Group / Setting -->
|
||||||
<div class="card bg-base-100">
|
<ul class='list-group'>
|
||||||
<div class="card-body">
|
|
||||||
<ul class="menu bg-base-200 rounded-box">
|
|
||||||
{% for obj in objects %}
|
{% for obj in objects %}
|
||||||
{% if object_type == 'user' %}
|
{% if object_type == 'user' %}
|
||||||
<li>
|
<a class="list-group-item" href="{{ obj.url }}">{{ obj.username|safe }}</a>
|
||||||
<a href="{{ obj.url }}" class="hover:bg-base-300"
|
|
||||||
>{{ obj.username }}</a
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<li>
|
<a class="list-group-item" href="{{ obj.url }}">{{ obj.name|safe }}</a>
|
||||||
<a href="{{ obj.url }}" class="hover:bg-base-300"
|
|
||||||
>{{ obj.name }}</a
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
<style>
|
||||||
|
.spinner-widget {
|
||||||
|
position: fixed; /* stays in place on scroll */
|
||||||
|
bottom: 20px; /* distance from bottom */
|
||||||
|
right: 20px; /* distance from right */
|
||||||
|
z-index: 9999; /* above most elements */
|
||||||
|
width: 60px; /* adjust to gif size */
|
||||||
|
height: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.spinner-widget img {
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div id="load-all-loading" class="spinner-widget" style="display: none">
|
||||||
|
<img id="loading-gif" src="{% static '/images/wait.gif' %}" alt="Loading...">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
$(function () {
|
||||||
// Show actions button if there are actions
|
|
||||||
const actionsButton = document.getElementById("actionsButton");
|
$('#object-search').show();
|
||||||
const actionsList = actionsButton?.querySelector("ul");
|
|
||||||
if (actionsList && actionsList.children.length > 0) {
|
{% if object_type != 'package' and object_type != 'user' and object_type != 'group' %}
|
||||||
actionsButton?.classList.remove("hidden");
|
{% if reviewed_objects|length > 50 or unreviewed_objects|length > 50 %}
|
||||||
|
$('#load-all-loading').show()
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
$('#load-all-error').hide();
|
||||||
|
|
||||||
|
$.getJSON('?all=true', function (resp) {
|
||||||
|
$('#ReviewedContent').empty();
|
||||||
|
$('#UnreviewedContent').empty();
|
||||||
|
|
||||||
|
for (o in resp.objects) {
|
||||||
|
obj = resp.objects[o];
|
||||||
|
if (obj.reviewed) {
|
||||||
|
$('#ReviewedContent').append('<a class="list-group-item" href="' + obj.url + '">' + obj.name + ' <span class="glyphicon glyphicon-star" aria-hidden="true" style="float:right" data-toggle="tooltip" data-placement="top" title="" data-original-title="Reviewed"></span></a>');
|
||||||
|
} else {
|
||||||
|
$('#UnreviewedContent').append('<a class="list-group-item" href="' + obj.url + '">' + obj.name + '</a>');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show search input and connect to Alpine pagination
|
$('#load-all-loading').hide();
|
||||||
const objectSearch = document.getElementById("object-search");
|
$('#load-remaining').hide();
|
||||||
if (objectSearch) {
|
}).fail(function (resp) {
|
||||||
objectSearch.classList.remove("hidden");
|
$('#load-all-loading').hide();
|
||||||
objectSearch.addEventListener("input", function () {
|
$('#load-all-error').show();
|
||||||
const query = this.value;
|
|
||||||
// Dispatch search to all paginatedList components
|
|
||||||
document
|
|
||||||
.querySelectorAll('[x-data*="paginatedList"]')
|
|
||||||
.forEach((el) => {
|
|
||||||
if (el._x_dataStack && el._x_dataStack[0]) {
|
|
||||||
el._x_dataStack[0].search(query);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete form submit handler
|
}, 2500);
|
||||||
const deleteSubmit = document.getElementById("modal-form-delete-submit");
|
{% endif %}
|
||||||
const deleteForm = document.getElementById("modal-form-delete");
|
{% endif %}
|
||||||
if (deleteSubmit && deleteForm) {
|
|
||||||
deleteSubmit.addEventListener("click", function (e) {
|
$('#modal-form-delete-submit').on('click', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
deleteForm.submit();
|
$('#modal-form-delete').submit();
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
$('#object-search').on('keyup', function () {
|
||||||
|
let query = $(this).val().toLowerCase();
|
||||||
|
$('a.list-group-item').each(function () {
|
||||||
|
let text = $(this).text().toLowerCase();
|
||||||
|
$(this).toggle(text.indexOf(query) !== -1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|||||||
@ -4,32 +4,16 @@
|
|||||||
<div>
|
<div>
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input
|
<input type="text" class="form-control" id="smiles" name="smiles" placeholder="SMILES"
|
||||||
type="text"
|
value="{{ smiles }}"/>
|
||||||
class="form-control"
|
<input type="text" class="form-control" id="smiles" name="smirks" placeholder="SMIRKS"
|
||||||
id="smiles"
|
value="{{ smirks }}"/>
|
||||||
name="smiles"
|
|
||||||
placeholder="SMILES"
|
|
||||||
value="{{ smiles }}"
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
class="form-control"
|
|
||||||
id="smiles"
|
|
||||||
name="smirks"
|
|
||||||
placeholder="SMIRKS"
|
|
||||||
value="{{ smirks }}"
|
|
||||||
/>
|
|
||||||
<button type="submit" class="btn btn-primary">Test</button>
|
<button type="submit" class="btn btn-primary">Test</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% if result %}
|
{% if result %}
|
||||||
{{ smiles }}
|
{{ smiles }}<p></p>
|
||||||
<p></p>
|
<img width='400' src='{% url 'depict' %}?smiles={{ smiles|urlencode }}'><br>
|
||||||
<img
|
|
||||||
width="400"
|
|
||||||
src="{% url 'depict' %}?smiles={{ smiles|urlencode }}"
|
|
||||||
/><br />
|
|
||||||
<p></p>
|
<p></p>
|
||||||
{% if rule %}
|
{% if rule %}
|
||||||
{{ smirks }}
|
{{ smirks }}
|
||||||
@ -38,7 +22,9 @@
|
|||||||
<p></p>
|
<p></p>
|
||||||
{{ rule.products_smarts }}
|
{{ rule.products_smarts }}
|
||||||
<p></p>
|
<p></p>
|
||||||
<div>{{ rule.as_svg|safe }}</div>
|
<div>
|
||||||
|
{{ rule.as_svg|safe }}
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h2>Diff</h2>
|
<h2>Diff</h2>
|
||||||
{% if diff %}
|
{% if diff %}
|
||||||
@ -52,22 +38,16 @@
|
|||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<h2>Ambit</h2>
|
<h2>Ambit</h2>
|
||||||
{% for p in ambit_res %}
|
{% for p in ambit_res %}
|
||||||
{{ p }}<br />
|
{{ p }}<br>
|
||||||
<img
|
<img width='400' src='{% url 'depict' %}?smiles={{ p|urlencode }}'><br>
|
||||||
width="400"
|
|
||||||
src="{% url 'depict' %}?smiles={{ p|urlencode }}"
|
|
||||||
/><br />
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<h2>RDKit</h2>
|
<h2>RDKit</h2>
|
||||||
{% for p in rdkit_res %}
|
{% for p in rdkit_res %}
|
||||||
{{ p }}<br />
|
{{ p }}<br>
|
||||||
<img
|
<img width='400' src='{% url 'depict' %}?smiles={{ p|urlencode }}'><br>
|
||||||
width="400"
|
|
||||||
src="{% url 'depict' %}?smiles={{ p|urlencode }}"
|
|
||||||
/><br />
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,77 +1,15 @@
|
|||||||
{% extends "framework_modern.html" %}
|
{% extends "framework.html" %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="flex min-h-[60vh] flex-col items-center justify-center p-8">
|
|
||||||
<div class="w-full max-w-2xl">
|
<div class="alert alert-error" role="alert">
|
||||||
<div class="alert alert-error mb-6 shadow-lg">
|
<h4 class="alert-heading">Bad Request!</h4>
|
||||||
<svg
|
<p>Lorem</p>
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
<hr>
|
||||||
class="h-8 w-8 shrink-0 stroke-current"
|
<p class="mb-0">
|
||||||
fill="none"
|
You can find out more about permissions in our <a target="_blank"
|
||||||
viewBox="0 0 24 24"
|
href="https://wiki.envipath.org/index.php/packages"
|
||||||
>
|
role="button">Wiki >></a></p>
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<div class="flex flex-col">
|
|
||||||
<h3 class="text-lg font-bold">Bad Request</h3>
|
|
||||||
<p class="text-sm">The request you sent was invalid or malformed.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card bg-base-100 shadow-xl">
|
|
||||||
<div class="card-body">
|
|
||||||
<h2 class="card-title mb-4 text-2xl">What happened?</h2>
|
|
||||||
<p class="text-base-content/70 mb-4">
|
|
||||||
The server couldn't process your request because it contains invalid
|
|
||||||
data or parameters.
|
|
||||||
</p>
|
|
||||||
<div class="card-actions mt-6 justify-end">
|
|
||||||
<a href="/" class="btn btn-primary">
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="mr-2 h-5 w-5"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke="currentColor"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
Go Home
|
|
||||||
</a>
|
|
||||||
<a
|
|
||||||
href="https://wiki.envipath.org/index.php/packages"
|
|
||||||
target="_blank"
|
|
||||||
class="btn btn-outline"
|
|
||||||
>
|
|
||||||
Learn More
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="ml-2 h-5 w-5"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke="currentColor"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|||||||
@ -1,80 +1,15 @@
|
|||||||
{% extends "framework_modern.html" %}
|
{% extends "framework.html" %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="flex min-h-[60vh] flex-col items-center justify-center p-8">
|
|
||||||
<div class="w-full max-w-2xl">
|
<div class="alert alert-error" role="alert">
|
||||||
<div class="alert alert-warning mb-6 shadow-lg">
|
<h4 class="alert-heading">Access Denied!</h4>
|
||||||
<svg
|
<p>Access to X denied. </p>
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
<hr>
|
||||||
class="h-8 w-8 shrink-0 stroke-current"
|
<p class="mb-0">
|
||||||
fill="none"
|
You can find out more about permissions in our <a target="_blank"
|
||||||
viewBox="0 0 24 24"
|
href="https://wiki.envipath.org/index.php/packages"
|
||||||
>
|
role="button">Wiki >></a></p>
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<div class="flex flex-col">
|
|
||||||
<h3 class="text-lg font-bold">Access Denied</h3>
|
|
||||||
<p class="text-sm">
|
|
||||||
You don't have permission to access this resource.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card bg-base-100 shadow-xl">
|
|
||||||
<div class="card-body">
|
|
||||||
<h2 class="card-title mb-4 text-2xl">Permission Required</h2>
|
|
||||||
<p class="text-base-content/70 mb-4">
|
|
||||||
You need the appropriate permissions to access this content. If you
|
|
||||||
believe this is an error, please contact the package owner or
|
|
||||||
administrator.
|
|
||||||
</p>
|
|
||||||
<div class="card-actions mt-6 justify-end">
|
|
||||||
<a href="/" class="btn btn-primary">
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="mr-2 h-5 w-5"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke="currentColor"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
Go Home
|
|
||||||
</a>
|
|
||||||
<a
|
|
||||||
href="https://wiki.envipath.org/index.php/packages"
|
|
||||||
target="_blank"
|
|
||||||
class="btn btn-outline"
|
|
||||||
>
|
|
||||||
Learn More
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="ml-2 h-5 w-5"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke="currentColor"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|||||||
@ -1,77 +1,15 @@
|
|||||||
{% extends "framework_modern.html" %}
|
{% extends "framework.html" %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="flex min-h-[60vh] flex-col items-center justify-center p-8">
|
|
||||||
<div class="w-full max-w-2xl">
|
<div class="alert alert-error" role="alert">
|
||||||
<div class="alert alert-info mb-6 shadow-lg">
|
<h4 class="alert-heading">Not Found!</h4>
|
||||||
<svg
|
<p>Does not exist</p>
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
<hr>
|
||||||
class="h-8 w-8 shrink-0 stroke-current"
|
<p class="mb-0">
|
||||||
fill="none"
|
You can find out more about permissions in our <a target="_blank"
|
||||||
viewBox="0 0 24 24"
|
href="https://wiki.envipath.org/index.php/packages"
|
||||||
>
|
role="button">Wiki >></a></p>
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<div class="flex flex-col">
|
|
||||||
<h3 class="text-lg font-bold">Page Not Found</h3>
|
|
||||||
<p class="text-sm">The page you're looking for doesn't exist.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card bg-base-100 shadow-xl">
|
|
||||||
<div class="card-body">
|
|
||||||
<h2 class="card-title mb-4 text-2xl">404 Error</h2>
|
|
||||||
<p class="text-base-content/70 mb-4">
|
|
||||||
The page or resource you requested could not be found. It may have
|
|
||||||
been moved, deleted, or the URL might be incorrect.
|
|
||||||
</p>
|
|
||||||
<div class="card-actions mt-6 justify-end">
|
|
||||||
<a href="/" class="btn btn-primary">
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="mr-2 h-5 w-5"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke="currentColor"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
Go Home
|
|
||||||
</a>
|
|
||||||
<a
|
|
||||||
href="https://wiki.envipath.org/index.php/packages"
|
|
||||||
target="_blank"
|
|
||||||
class="btn btn-outline"
|
|
||||||
>
|
|
||||||
Learn More
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="ml-2 h-5 w-5"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke="currentColor"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|||||||
@ -1,76 +1,13 @@
|
|||||||
{% extends "framework_modern.html" %}
|
{% extends "framework.html" %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="flex min-h-[60vh] flex-col items-center justify-center p-8">
|
|
||||||
<div class="w-full max-w-2xl">
|
<div class="alert alert-danger" role="alert">
|
||||||
<div class="alert alert-error mb-6 shadow-lg">
|
<h4 class="alert-heading">{{ error_message }}</h4>
|
||||||
<svg
|
<hr>
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
<p class="mb-0">
|
||||||
class="h-8 w-8 shrink-0 stroke-current"
|
{{ error_detail }}
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<div class="flex flex-col">
|
|
||||||
<h3 class="text-lg font-bold">
|
|
||||||
{{ error_message|default:"An Error Occurred" }}
|
|
||||||
</h3>
|
|
||||||
<p class="text-sm">
|
|
||||||
{{ error_detail|default:"Something went wrong. Please try again later." }}
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="card bg-base-100 shadow-xl">
|
|
||||||
<div class="card-body">
|
|
||||||
<h2 class="card-title mb-4 text-2xl">Oops! Something went wrong</h2>
|
|
||||||
<p class="text-base-content/70 mb-4">
|
|
||||||
{{ error_description|default:"We encountered an unexpected error while processing your request. Our team has been notified and is working to resolve the issue." }}
|
|
||||||
</p>
|
|
||||||
<div class="card-actions mt-6 justify-end">
|
|
||||||
<a href="/" class="btn btn-primary">
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="mr-2 h-5 w-5"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke="currentColor"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
Go Home
|
|
||||||
</a>
|
|
||||||
<button onclick="window.history.back()" class="btn btn-outline">
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="mr-2 h-5 w-5"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke="currentColor"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M10 19l-7-7m0 0l7-7m-7 7h18"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
Go Back
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|||||||
@ -1,81 +1,12 @@
|
|||||||
{% extends "framework_modern.html" %}
|
{% extends "framework.html" %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="flex min-h-[60vh] flex-col items-center justify-center p-8">
|
|
||||||
<div class="w-full max-w-2xl">
|
<div class="alert alert-danger" role="alert">
|
||||||
<div class="alert alert-warning mb-6 shadow-lg">
|
<h4 class="alert-heading">Your account has not been activated yet!</h4>
|
||||||
<svg
|
<p>Your account has not been activated yet. If you have questions <a href="mailto:admin@envipath.org">contact
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
us.</a>
|
||||||
class="h-8 w-8 shrink-0 stroke-current"
|
</p>
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
<div class="flex flex-col">
|
|
||||||
<h3 class="text-lg font-bold">Account Not Activated</h3>
|
|
||||||
<p class="text-sm">Your account is pending activation.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card bg-base-100 shadow-xl">
|
|
||||||
<div class="card-body">
|
|
||||||
<h2 class="card-title mb-4 text-2xl">Account Activation Required</h2>
|
|
||||||
<p class="text-base-content/70 mb-4">
|
|
||||||
Your account has not been activated yet. An administrator needs to
|
|
||||||
approve your account before you can access all features. This
|
|
||||||
process typically takes 24-48 hours.
|
|
||||||
</p>
|
|
||||||
<div class="divider"></div>
|
|
||||||
<p class="text-base-content/70 mb-4">
|
|
||||||
If you have questions or believe this is an error, please
|
|
||||||
<a href="mailto:admin@envipath.org" class="link link-primary"
|
|
||||||
>contact us</a
|
|
||||||
>.
|
|
||||||
</p>
|
|
||||||
<div class="card-actions mt-6 justify-end">
|
|
||||||
<a href="/" class="btn btn-primary">
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="mr-2 h-5 w-5"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke="currentColor"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
Go Home
|
|
||||||
</a>
|
|
||||||
<a href="mailto:admin@envipath.org" class="btn btn-outline">
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="mr-2 h-5 w-5"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke="currentColor"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
Contact Admin
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|||||||
@ -124,7 +124,7 @@
|
|||||||
|
|
||||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||||
<div
|
<div
|
||||||
class="navbar-collapse collapse-framework navbar-collapse-framework collapse"
|
class="collapse navbar-collapse collapse-framework navbar-collapse-framework"
|
||||||
id="navbarCollapse"
|
id="navbarCollapse"
|
||||||
>
|
>
|
||||||
<ul class="nav navbar-nav navbar-nav-framework">
|
<ul class="nav navbar-nav navbar-nav-framework">
|
||||||
@ -151,6 +151,11 @@
|
|||||||
>Package</a
|
>Package</a
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="{{ meta.server_url }}/search" id="searchLink"
|
||||||
|
>Search</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ meta.server_url }}/model" id="modelLink"
|
<a href="{{ meta.server_url }}/model" id="modelLink"
|
||||||
>Modelling</a
|
>Modelling</a
|
||||||
@ -228,7 +233,15 @@
|
|||||||
>Documentation Wiki</a
|
>Documentation Wiki</a
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a
|
||||||
|
href="#"
|
||||||
|
id="citeButton"
|
||||||
|
data-toggle="modal"
|
||||||
|
data-target="#citemodal"
|
||||||
|
>How to cite enviPath</a
|
||||||
|
>
|
||||||
|
</li>
|
||||||
<li class="divider"></li>
|
<li class="divider"></li>
|
||||||
<li><a>Version: {{ meta.version }}</a></li>
|
<li><a>Version: {{ meta.version }}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -325,7 +338,7 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="license" class="panel-collapse in collapse">
|
<div id="license" class="panel-collapse collapse in">
|
||||||
<div class="panel-body list-group-item">
|
<div class="panel-body list-group-item">
|
||||||
<a target="_blank" href="{{ meta.current_package.license.link }}">
|
<a target="_blank" href="{{ meta.current_package.license.link }}">
|
||||||
<img src="{{ meta.current_package.license.image_link }}" />
|
<img src="{{ meta.current_package.license.image_link }}" />
|
||||||
@ -400,5 +413,10 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
{% block modals %}
|
||||||
|
{% include "modals/cite_modal.html" %}
|
||||||
|
{% include "modals/predict_modal.html" %}
|
||||||
|
{% include "modals/batch_predict_modal.html" %}
|
||||||
|
{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -21,14 +21,8 @@
|
|||||||
type="text/css"
|
type="text/css"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{# Alpine.js - For reactive components #}
|
{# jQuery - Keep for compatibility with existing JS #}
|
||||||
<script
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
|
||||||
defer
|
|
||||||
src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"
|
|
||||||
></script>
|
|
||||||
<script src="{% static 'js/alpine/index.js' %}"></script>
|
|
||||||
<script src="{% static 'js/alpine/search.js' %}"></script>
|
|
||||||
<script src="{% static 'js/alpine/pagination.js' %}"></script>
|
|
||||||
|
|
||||||
{# Font Awesome #}
|
{# Font Awesome #}
|
||||||
<link
|
<link
|
||||||
@ -41,10 +35,21 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
const csrftoken = document.querySelector("[name=csrf-token]").content;
|
const csrftoken = document.querySelector("[name=csrf-token]").content;
|
||||||
|
|
||||||
|
// Setup CSRF header for all jQuery AJAX requests
|
||||||
|
$.ajaxSetup({
|
||||||
|
beforeSend: function (xhr, settings) {
|
||||||
|
if (!/^(GET|HEAD|OPTIONS|TRACE)$/i.test(settings.type)) {
|
||||||
|
xhr.setRequestHeader("X-CSRFToken", csrftoken);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{# General EP JS #}
|
{# General EP JS #}
|
||||||
<script src="{% static 'js/pps.js' %}"></script>
|
<script src="{% static 'js/pps.js' %}"></script>
|
||||||
|
{# Modal Steps for Stepwise Modal Wizards #}
|
||||||
|
<script src="{% static 'js/jquery-bootstrap-modal-steps.js' %}"></script>
|
||||||
|
|
||||||
{% if not debug %}
|
{% if not debug %}
|
||||||
<!-- Matomo -->
|
<!-- Matomo -->
|
||||||
@ -75,7 +80,7 @@
|
|||||||
{% block main_content %}
|
{% block main_content %}
|
||||||
{# Breadcrumbs - outside main content, optional #}
|
{# Breadcrumbs - outside main content, optional #}
|
||||||
{% if breadcrumbs %}
|
{% if breadcrumbs %}
|
||||||
<div id="bread" class="mx-auto max-w-7xl px-4 py-4">
|
<div id="bread" class="max-w-7xl mx-auto px-4 py-4">
|
||||||
<div class="breadcrumbs text-sm">
|
<div class="breadcrumbs text-sm">
|
||||||
<ul>
|
<ul>
|
||||||
{% for elem in breadcrumbs %}
|
{% for elem in breadcrumbs %}
|
||||||
@ -108,7 +113,7 @@
|
|||||||
|
|
||||||
{# License - inside paper if present #}
|
{# License - inside paper if present #}
|
||||||
{% if meta.url_contains_package and meta.current_package.license %}
|
{% if meta.url_contains_package and meta.current_package.license %}
|
||||||
<div class="collapse-arrow bg-base-200 collapse p-8">
|
<div class="collapse collapse-arrow bg-base-200 m-8">
|
||||||
<input type="checkbox" checked />
|
<input type="checkbox" checked />
|
||||||
<div class="collapse-title text-xl font-medium">License</div>
|
<div class="collapse-title text-xl font-medium">License</div>
|
||||||
<div class="collapse-content">
|
<div class="collapse-content">
|
||||||
@ -132,7 +137,7 @@
|
|||||||
|
|
||||||
{# Floating Help Tab #}
|
{# Floating Help Tab #}
|
||||||
{% if not public_mode %}
|
{% if not public_mode %}
|
||||||
<div class="fixed top-1/2 right-0 z-50 -translate-y-1/2">
|
<div class="fixed right-0 top-1/2 -translate-y-1/2 z-50">
|
||||||
<a
|
<a
|
||||||
href="https://community.envipath.org/"
|
href="https://community.envipath.org/"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
@ -166,31 +171,13 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
$(function () {
|
||||||
// Show actions button if there are actions defined
|
// Hide actionsbutton if there's no action defined
|
||||||
const actionsButtonUl = document.querySelector("#actionsButton ul");
|
if ($("#actionsButton ul").children().length > 0) {
|
||||||
if (actionsButtonUl && actionsButtonUl.children.length > 0) {
|
$("#actionsButton").show();
|
||||||
document.getElementById("actionsButton").style.display = "";
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Open search modal function
|
|
||||||
function openSearchModal() {
|
|
||||||
const searchModal = document.getElementById("search_modal");
|
|
||||||
if (searchModal) {
|
|
||||||
searchModal.showModal();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Click handler for search badge
|
|
||||||
const searchTrigger = document.getElementById("search-trigger");
|
|
||||||
if (searchTrigger) {
|
|
||||||
searchTrigger.addEventListener("click", function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
openSearchModal();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Global keyboard shortcut for search (Cmd+K on Mac, Ctrl+K on Windows/Linux)
|
// Global keyboard shortcut for search (Cmd+K on Mac, Ctrl+K on Windows/Linux)
|
||||||
document.addEventListener("keydown", function (event) {
|
document.addEventListener("keydown", function (event) {
|
||||||
// Check if user is typing in an input field
|
// Check if user is typing in an input field
|
||||||
@ -211,7 +198,7 @@
|
|||||||
|
|
||||||
if (isCorrectModifier && event.key === "k") {
|
if (isCorrectModifier && event.key === "k") {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
openSearchModal();
|
search_modal.showModal();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -1,20 +1,17 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
<div class="bg-base-300 text-base-content mx-auto mt-10 lg:max-w-5xl">
|
<div class="lg:max-w-5xl mt-10 mx-auto bg-base-300 text-base-content">
|
||||||
|
|
||||||
<footer class="footer sm:footer-horizontal p-10">
|
<footer class="footer sm:footer-horizontal p-10">
|
||||||
{% if not public_mode %}
|
{% if not public_mode %}
|
||||||
<nav>
|
<nav>
|
||||||
<h6 class="footer-title">Services</h6>
|
<h6 class="footer-title">Services</h6>
|
||||||
<a class="link link-hover" href="/predict">Predict</a>
|
<a class="link link-hover" href="/">Predict</a>
|
||||||
<a class="link link-hover" href="/package">Packages</a>
|
<a class="link link-hover" href="/search">Search</a>
|
||||||
|
<a class="link link-hover" href="/package">Browse</a>
|
||||||
{% if user.is_authenticated %}
|
{% if user.is_authenticated %}
|
||||||
<a class="link link-hover" href="/model">Your Collections</a>
|
<a class="link link-hover" href="/model">Your Collections</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a
|
<a href="https://wiki.envipath.org/" target="_blank" class="link link-hover">Documentation</a>
|
||||||
href="https://wiki.envipath.org/"
|
|
||||||
target="_blank"
|
|
||||||
class="link link-hover"
|
|
||||||
>Documentation</a
|
|
||||||
>
|
|
||||||
</nav>
|
</nav>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<nav>
|
<nav>
|
||||||
@ -32,61 +29,39 @@
|
|||||||
<a class="link link-hover" href="/cite">Cite enviPath</a>
|
<a class="link link-hover" href="/cite">Cite enviPath</a>
|
||||||
</nav>
|
</nav>
|
||||||
</footer>
|
</footer>
|
||||||
<footer class="footer border-t-2 border-neutral-300 px-10 py-4">
|
<footer class="footer border-neutral-300 border-t-2 px-10 py-4">
|
||||||
<div class="flex w-full flex-row items-start justify-between">
|
<div class="flex flex-row justify-between w-full items-start">
|
||||||
<aside class="grid-flow-col items-center">
|
<aside class="grid-flow-col items-center">
|
||||||
<svg
|
<svg class="fill-neutral-content flex-shrink-0 h-14 m-2" viewbox="0 0 65 65" >
|
||||||
class="fill-neutral-content m-2 h-14 flex-shrink-0"
|
|
||||||
viewbox="0 0 65 65"
|
|
||||||
>
|
|
||||||
<use
|
<use
|
||||||
href="{% static "/images/logo-square.svg" %}#ep-logo-square"
|
href="{% static "/images/logo-square.svg" %}#ep-logo-square"
|
||||||
></use>
|
>
|
||||||
|
</use>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
enviPath Ltd.
|
enviPath Ltd.
|
||||||
<br />
|
<br />
|
||||||
Biodegredation prediction since 2015.
|
Biodegredation prediction since 2015.
|
||||||
|
</p>
|
||||||
</aside>
|
</aside>
|
||||||
<aside class="text-base-200 mt-2 text-sm">
|
<aside class="text-sm text-base-200 mt-2"><span class="text-xs tracking-tight">Version</span> <span class="text-base font-bold">{{ meta.version }}</span></aside>
|
||||||
<span class="text-xs tracking-tight">Version</span>
|
|
||||||
<span class="text-base font-bold">{{ meta.version }}</span>
|
|
||||||
</aside>
|
|
||||||
</div>
|
</div>
|
||||||
<nav class="md:place-self-center md:justify-self-end">
|
<nav class="md:place-self-center md:justify-self-end">
|
||||||
<div class="grid grid-flow-col gap-4">
|
<div class="grid grid-flow-col gap-4">
|
||||||
<a href="https://www.youtube.com/@envipath7231" target="_blank">
|
<a href="https://www.youtube.com/@envipath7231" target="_blank">
|
||||||
<svg
|
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 fill-current">
|
||||||
role="img"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="h-6 w-6 fill-current"
|
|
||||||
>
|
|
||||||
<title>YouTube</title>
|
<title>YouTube</title>
|
||||||
<path
|
<path d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"/>
|
||||||
d="M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"
|
|
||||||
/>
|
|
||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://community.envipath.org/" target="_blank">
|
<a href="https://community.envipath.org/" target="_blank">
|
||||||
<svg
|
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 fill-current">
|
||||||
role="img"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="h-6 w-6 fill-current"
|
|
||||||
>
|
|
||||||
<title>Discourse</title>
|
<title>Discourse</title>
|
||||||
<path
|
<path d="M12.103 0C18.666 0 24 5.485 24 11.997c0 6.51-5.33 11.99-11.9 11.99L0 24V11.79C0 5.28 5.532 0 12.103 0zm.116 4.563c-2.593-.003-4.996 1.352-6.337 3.57-1.33 2.208-1.387 4.957-.148 7.22L4.4 19.61l4.794-1.074c2.745 1.225 5.965.676 8.136-1.39 2.17-2.054 2.86-5.228 1.737-7.997-1.135-2.778-3.84-4.59-6.84-4.585h-.008z"/>
|
||||||
d="M12.103 0C18.666 0 24 5.485 24 11.997c0 6.51-5.33 11.99-11.9 11.99L0 24V11.79C0 5.28 5.532 0 12.103 0zm.116 4.563c-2.593-.003-4.996 1.352-6.337 3.57-1.33 2.208-1.387 4.957-.148 7.22L4.4 19.61l4.794-1.074c2.745 1.225 5.965.676 8.136-1.39 2.17-2.054 2.86-5.228 1.737-7.997-1.135-2.778-3.84-4.59-6.84-4.585h-.008z"
|
|
||||||
/>
|
|
||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://www.linkedin.com/company/envipath/" target="_blank">
|
<a href="https://www.linkedin.com/company/envipath/" target="_blank">
|
||||||
<img
|
<img src="{% static "/images/linkedin.png" %}" alt="LinkedIn" class="w-6 h-6">
|
||||||
src="{% static "/images/linkedin.png" %}"
|
|
||||||
alt="LinkedIn"
|
|
||||||
class="h-6 w-6"
|
|
||||||
/>
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@ -1,44 +1,15 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
{# Modern DaisyUI Navbar with Mobile Drawer Menu #}
|
{# Modern DaisyUI Navbar #}
|
||||||
<div class="drawer drawer-mobile">
|
<div class="navbar bg-neutral-50 text-neutral-950 shadow-lg x-50">
|
||||||
<input id="drawer-toggle" type="checkbox" class="drawer-toggle" />
|
|
||||||
<div class="drawer-content flex flex-col">
|
|
||||||
{# Navbar #}
|
|
||||||
<div class="navbar x-50 bg-neutral-50 text-neutral-950 shadow-lg">
|
|
||||||
<div class="navbar-start">
|
<div class="navbar-start">
|
||||||
{# Hamburger menu button - visible on mobile, hidden on desktop #}
|
<a href="{{ meta.server_url }}" class="btn btn-ghost normal-case text-xl">
|
||||||
{% if not public_mode %}
|
<svg class="h-8 fill-base-content" viewBox="0 0 104 26" role="img">
|
||||||
<label
|
|
||||||
for="drawer-toggle"
|
|
||||||
class="btn btn-square btn-ghost drawer-button lg:hidden"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
class="inline-block h-5 w-5 stroke-current"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M4 6h16M4 12h16M4 18h16"
|
|
||||||
></path>
|
|
||||||
</svg>
|
|
||||||
</label>
|
|
||||||
{% endif %}
|
|
||||||
<a
|
|
||||||
href="{{ meta.server_url }}"
|
|
||||||
class="btn btn-ghost text-xl normal-case"
|
|
||||||
>
|
|
||||||
<svg class="fill-base-content h-8" viewBox="0 0 104 26" role="img">
|
|
||||||
<use href="{% static "/images/logo-name.svg" %}#ep-logo-name" />
|
<use href="{% static "/images/logo-name.svg" %}#ep-logo-name" />
|
||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if not public_mode %}
|
{% if not public_mode %}
|
||||||
{# Desktop menu - hidden on mobile, visible on desktop #}
|
|
||||||
<div class="navbar-center hidden lg:flex">
|
<div class="navbar-center hidden lg:flex">
|
||||||
<a
|
<a
|
||||||
href="{{ meta.server_url }}/predict"
|
href="{{ meta.server_url }}/predict"
|
||||||
@ -47,6 +18,8 @@
|
|||||||
id="predictLink"
|
id="predictLink"
|
||||||
>Predict</a
|
>Predict</a
|
||||||
>
|
>
|
||||||
|
<!-- <li><a href="{{ meta.server_url }}/package" id="packageLink">Package</a></li> -->
|
||||||
|
<!--<li><a href="{{ meta.server_url }}/browse" id="browseLink">Browse</a></li>-->
|
||||||
<div class="dropdown dropdown-center">
|
<div class="dropdown dropdown-center">
|
||||||
<div tabindex="0" role="button" class="btn btn-ghost">Browse</div>
|
<div tabindex="0" role="button" class="btn btn-ghost">Browse</div>
|
||||||
<ul
|
<ul
|
||||||
@ -54,18 +27,9 @@
|
|||||||
class="dropdown-content menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"
|
class="dropdown-content menu bg-base-100 rounded-box z-1 w-52 p-2 shadow-sm"
|
||||||
>
|
>
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ meta.server_url }}/package" id="packageLink"
|
<a href="{{ meta.server_url }}/pathway" id="pathwayLink">Pathway</a>
|
||||||
>Package</a
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ meta.server_url }}/pathway" id="pathwayLink"
|
|
||||||
>Pathway</a
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ meta.server_url }}/rule" id="ruleLink">Rule</a>
|
|
||||||
</li>
|
</li>
|
||||||
|
<li><a href="{{ meta.server_url }}/rule" id="ruleLink">Rule</a></li>
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ meta.server_url }}/compound" id="compoundLink"
|
<a href="{{ meta.server_url }}/compound" id="compoundLink"
|
||||||
>Compound</a
|
>Compound</a
|
||||||
@ -77,9 +41,7 @@
|
|||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a
|
<a href="{{ meta.server_url }}/model" id="relative-reasoningLink"
|
||||||
href="{{ meta.server_url }}/model"
|
|
||||||
id="relative-reasoningLink"
|
|
||||||
>Model</a
|
>Model</a
|
||||||
>
|
>
|
||||||
</li>
|
</li>
|
||||||
@ -95,9 +57,9 @@
|
|||||||
|
|
||||||
<div class="navbar-end">
|
<div class="navbar-end">
|
||||||
{% if not public_mode %}
|
{% if not public_mode %}
|
||||||
<a id="search-trigger" role="button" class="cursor-pointer">
|
<a href="/search" role="button">
|
||||||
<div
|
<div
|
||||||
class="badge badge-dash bg-base-200 text-base-content/50 m-1 flex items-center space-x-1 p-2"
|
class="flex items-center badge badge-dash space-x-1 bg-base-200 text-base-content/50 p-2 m-1"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
@ -125,7 +87,7 @@
|
|||||||
<div
|
<div
|
||||||
tabindex="0"
|
tabindex="0"
|
||||||
role="button"
|
role="button"
|
||||||
class="btn btn-ghost btn-circle m-1"
|
class="btn btn-ghost m-1 btn-circle"
|
||||||
id="loggedInButton"
|
id="loggedInButton"
|
||||||
>
|
>
|
||||||
<svg
|
<svg
|
||||||
@ -149,9 +111,7 @@
|
|||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
class="dropdown-content menu bg-base-100 rounded-box z-50 w-52 p-2 shadow-sm"
|
class="dropdown-content menu bg-base-100 rounded-box z-50 w-52 p-2 shadow-sm"
|
||||||
>
|
>
|
||||||
<li>
|
<li><a href="{{ meta.user.url }}" id="accountbutton">Settings</a></li>
|
||||||
<a href="{{ meta.user.url }}" id="accountbutton">Settings</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<form
|
<form
|
||||||
id="logoutForm"
|
id="logoutForm"
|
||||||
@ -174,96 +134,6 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
{# Mobile drawer menu - slides in from the left #}
|
|
||||||
<div class="drawer-side">
|
|
||||||
<label for="drawer-toggle" class="drawer-overlay"></label>
|
|
||||||
<ul class="menu min-h-full w-80 bg-base-200 p-4 text-base-content">
|
|
||||||
{# Drawer header with close button #}
|
|
||||||
<li class="mb-4">
|
|
||||||
<div class="flex items-center justify-between">
|
|
||||||
<span class="font-bold text-lg">Menu</span>
|
|
||||||
<label
|
|
||||||
for="drawer-toggle"
|
|
||||||
class="btn btn-sm btn-circle btn-ghost"
|
|
||||||
aria-label="Close menu"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="h-6 w-6"
|
|
||||||
fill="none"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke="currentColor"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
d="M6 18L18 6M6 6l12 12"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
{% if not public_mode %}
|
|
||||||
{# Predict link #}
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="{{ meta.server_url }}/predict"
|
|
||||||
class="text-lg"
|
|
||||||
id="predictLinkMobile"
|
|
||||||
>Predict</a
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
{# Browse menu with submenu #}
|
|
||||||
<li>
|
|
||||||
<details>
|
|
||||||
<summary class="text-lg">Browse</summary>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<a href="{{ meta.server_url }}/package" id="packageLinkMobile"
|
|
||||||
>Package</a
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ meta.server_url }}/pathway" id="pathwayLinkMobile"
|
|
||||||
>Pathway</a
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ meta.server_url }}/rule" id="ruleLinkMobile"
|
|
||||||
>Rule</a
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ meta.server_url }}/compound" id="compoundLinkMobile"
|
|
||||||
>Compound</a
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ meta.server_url }}/reaction" id="reactionLinkMobile"
|
|
||||||
>Reaction</a
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a
|
|
||||||
href="{{ meta.server_url }}/model"
|
|
||||||
id="relative-reasoningLinkMobile"
|
|
||||||
>Model</a
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a href="{{ meta.server_url }}/scenario" id="scenarioLinkMobile"
|
|
||||||
>Scenario</a
|
|
||||||
>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</details>
|
|
||||||
</li>
|
|
||||||
{% endif %}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// OS-aware search shortcut display
|
// OS-aware search shortcut display
|
||||||
|
|||||||
@ -2,90 +2,36 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
{% block main_content %}
|
{% block main_content %}
|
||||||
<!-- Hero Section with Logo and Search -->
|
<!-- Hero Section with Logo and Search -->
|
||||||
<section class="hero relative mx-auto h-fit w-full max-w-5xl shadow-none">
|
<section class="hero h-fit max-w-5xl w-full shadow-none mx-auto relative">
|
||||||
<div
|
<div
|
||||||
class="hero from-primary-800 to-primary-600 min-h-[calc(100vh*0.4)] bg-gradient-to-br"
|
class="hero min-h-[calc(100vh*0.4)] bg-gradient-to-br from-primary-800 to-primary-600"
|
||||||
style="background-image: url('{% static "/images/hero.png" %}'); background-size: cover; background-position: center;"
|
style="background-image: url('{% static "/images/hero.png" %}'); background-size: cover; background-position: center;"
|
||||||
>
|
>
|
||||||
<div class="hero-overlay"></div>
|
<div class="hero-overlay"></div>
|
||||||
<!-- Predict Pathway text over the image -->
|
<!-- Predict Pathway text over the image -->
|
||||||
<div class="absolute bottom-40 left-1/8 -translate-x-8">
|
<div class="absolute bottom-40 left-1/8 -translate-x-8 z-10">
|
||||||
<h2 class="text-base-100 text-left text-3xl text-shadow-lg">
|
<h2 class="text-3xl text-base-100 text-shadow-lg text-left">
|
||||||
Predict Your Pathway
|
Predict Your Pathway
|
||||||
</h2>
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<div class="bg-base-200 mx-auto max-w-5xl shadow-md">
|
<div class="shadow-md max-w-5xl mx-auto bg-base-200">
|
||||||
<!-- Predict Pathway Section -->
|
<!-- Predict Pathway Section -->
|
||||||
<div
|
<div
|
||||||
class="relative mx-auto -mt-32 mb-10 w-full flex-col lg:flex-row-reverse"
|
class="flex-col lg:flex-row-reverse w-full mx-auto -mt-32 relative z-20 mb-10 "
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="card bg-base-100 mx-auto w-3/4 shrink-0 shadow-xl transition-all duration-300 ease-in-out"
|
class="card bg-base-100 shrink-0 shadow-xl w-3/4 mx-auto transition-all duration-300 ease-in-out"
|
||||||
x-data="{
|
|
||||||
drawMode: false,
|
|
||||||
smiles: '',
|
|
||||||
loadExample(smilesStr, linkEl) {
|
|
||||||
if (this.drawMode && window.indexKetcher && window.indexKetcher.setMolecule) {
|
|
||||||
window.indexKetcher.setMolecule(smilesStr);
|
|
||||||
} else {
|
|
||||||
this.smiles = smilesStr;
|
|
||||||
}
|
|
||||||
const original = linkEl.textContent;
|
|
||||||
linkEl.textContent = 'loaded!';
|
|
||||||
setTimeout(() => linkEl.textContent = original, 1000);
|
|
||||||
},
|
|
||||||
syncFromKetcher() {
|
|
||||||
const ketcher = getKetcherInstance('index-ketcher');
|
|
||||||
if (ketcher && ketcher.getSmiles) {
|
|
||||||
try {
|
|
||||||
const s = ketcher.getSmiles();
|
|
||||||
if (s && s.trim()) this.smiles = s;
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Failed to sync from Ketcher:', err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
submitForm() {
|
|
||||||
let finalSmiles = '';
|
|
||||||
if (this.drawMode) {
|
|
||||||
const ketcher = getKetcherInstance('index-ketcher');
|
|
||||||
if (ketcher && ketcher.getSmiles) {
|
|
||||||
try {
|
|
||||||
finalSmiles = ketcher.getSmiles().trim();
|
|
||||||
} catch (err) {
|
|
||||||
console.error('Failed to get SMILES from Ketcher:', err);
|
|
||||||
alert('Unable to extract structure. Please try again or switch to SMILES input.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
alert('The drawing editor is still loading. Please wait and try again.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
finalSmiles = this.smiles.trim();
|
|
||||||
}
|
|
||||||
if (!finalSmiles) {
|
|
||||||
alert('Please enter a SMILES string or draw a structure.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
document.getElementById('index-form-smiles').value = finalSmiles;
|
|
||||||
document.getElementById('index-form').submit();
|
|
||||||
}
|
|
||||||
}"
|
|
||||||
x-init="$watch('drawMode', value => { if (!value) syncFromKetcher(); })"
|
|
||||||
>
|
>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="my-4 ml-8 flex h-fit flex-row items-center justify-start">
|
<!-- Input Mode Toggle - Fixed position outside fieldset -->
|
||||||
<div class="flex items-center gap-1">
|
<div class="flex flex-row justify-start items-center h-fit ml-8 my-4">
|
||||||
<label class="swap btn btn-ghost btn-sm p-1" title="Input Mode">
|
<div class="flex items-center gap-2">
|
||||||
<input type="checkbox" x-model="drawMode" />
|
<!-- <span class="text-sm text-neutral-500">Input Mode:</span> -->
|
||||||
<span class="swap-on flex items-center gap-1">
|
<label class="toggle text-base-content toggle-md">
|
||||||
<div
|
<input type="checkbox" />
|
||||||
class="bg-neutral/50 text-neutral-content flex items-center justify-center rounded-full p-1"
|
|
||||||
>
|
|
||||||
<svg
|
<svg
|
||||||
aria-label="smiles mode"
|
aria-label="smiles mode"
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
@ -106,13 +52,6 @@
|
|||||||
/>
|
/>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
|
||||||
<span class="ext-xs">SMILES</span>
|
|
||||||
</span>
|
|
||||||
<span class="swap-off flex items-center gap-1">
|
|
||||||
<div
|
|
||||||
class="bg-neutral/50 text-neutral-content flex items-center justify-center rounded-full p-1"
|
|
||||||
>
|
|
||||||
<svg
|
<svg
|
||||||
aria-label="draw mode"
|
aria-label="draw mode"
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
@ -125,78 +64,57 @@
|
|||||||
d="m2.695 14.762-1.262 3.155a.5.5 0 0 0 .65.65l3.155-1.262a4 4 0 0 0 1.343-.886L17.5 5.501a2.121 2.121 0 0 0-3-3L3.58 13.419a4 4 0 0 0-.885 1.343Z"
|
d="m2.695 14.762-1.262 3.155a.5.5 0 0 0 .65.65l3.155-1.262a4 4 0 0 0 1.343-.886L17.5 5.501a2.121 2.121 0 0 0-3-3L3.58 13.419a4 4 0 0 0-.885 1.343Z"
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
|
||||||
<span class="text-base/50 text-xs">Draw</span>
|
|
||||||
</span>
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<fieldset
|
<fieldset
|
||||||
class="fieldset overflow-hidden transition-all duration-300 ease-in-out"
|
class="fieldset transition-all duration-300 ease-in-out overflow-hidden"
|
||||||
:class="drawMode ? 'p-4' : 'p-8'"
|
|
||||||
>
|
>
|
||||||
<form
|
<form
|
||||||
id="index-form"
|
id="index-form"
|
||||||
action="{{ meta.current_package.url }}/pathway"
|
action="{{ meta.current_package.url }}/pathway"
|
||||||
method="POST"
|
method="POST"
|
||||||
@submit.prevent="submitForm()"
|
|
||||||
>
|
>
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div
|
<div
|
||||||
id="text-input-container"
|
id="text-input-container"
|
||||||
x-show="!drawMode"
|
class="transition-all duration-300 ease-in-out opacity-100 transform scale-100"
|
||||||
x-transition:enter="transition ease-out duration-300"
|
|
||||||
x-transition:enter-start="opacity-0 scale-95"
|
|
||||||
x-transition:enter-end="opacity-100 scale-100"
|
|
||||||
x-transition:leave="transition ease-in duration-300"
|
|
||||||
x-transition:leave-start="opacity-100 scale-100"
|
|
||||||
x-transition:leave-end="opacity-0 scale-95"
|
|
||||||
>
|
>
|
||||||
<div class="join mx-auto w-full">
|
<div class="join w-full mx-auto">
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
id="index-form-text-input"
|
id="index-form-text-input"
|
||||||
placeholder="canonical SMILES string"
|
placeholder="canonical SMILES string"
|
||||||
class="input input-md join-item grow"
|
class="input grow input-md join-item"
|
||||||
x-model="smiles"
|
|
||||||
/>
|
/>
|
||||||
<button class="btn btn-neutral join-item">Predict!</button>
|
<button class="btn btn-neutral join-item">Predict!</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="label relative mt-1 w-full">
|
<div class="label relative w-full mt-1">
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
<a
|
<a
|
||||||
href="#"
|
href="#"
|
||||||
class="example-link hover:text-primary cursor-pointer"
|
class="example-link cursor-pointer hover:text-primary"
|
||||||
|
data-smiles="CN1C=NC2=C1C(=O)N(C(=O)N2C)C"
|
||||||
title="load example"
|
title="load example"
|
||||||
@click.prevent="loadExample('CN1C=NC2=C1C(=O)N(C(=O)N2C)C', $el)"
|
|
||||||
>Caffeine</a
|
>Caffeine</a
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
href="#"
|
href="#"
|
||||||
class="example-link hover:text-primary cursor-pointer"
|
class="example-link cursor-pointer hover:text-primary"
|
||||||
|
data-smiles="CC(C)CC1=CC=C(C=C1)C(C)C(=O)O"
|
||||||
title="load example"
|
title="load example"
|
||||||
@click.prevent="loadExample('CC(C)CC1=CC=C(C=C1)C(C)C(=O)O', $el)"
|
|
||||||
>Ibuprofen</a
|
>Ibuprofen</a
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<a
|
<a class="absolute top-0 left-[calc(100%-5.4rem)]" href="#"
|
||||||
class="absolute top-0 left-[calc(100%-5.4rem)]"
|
|
||||||
href="/predict"
|
|
||||||
>Advanced</a
|
>Advanced</a
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
id="ketcher-container"
|
id="ketcher-container"
|
||||||
x-show="drawMode"
|
class="hidden w-full transition-all duration-300 ease-in-out opacity-0 transform scale-95"
|
||||||
x-transition:enter="transition ease-out duration-300"
|
|
||||||
x-transition:enter-start="opacity-0 scale-95"
|
|
||||||
x-transition:enter-end="opacity-100 scale-100"
|
|
||||||
x-transition:leave="transition ease-in duration-300"
|
|
||||||
x-transition:leave-start="opacity-100 scale-100"
|
|
||||||
x-transition:leave-end="opacity-0 scale-95"
|
|
||||||
class="w-full"
|
|
||||||
>
|
>
|
||||||
<iframe
|
<iframe
|
||||||
id="index-ketcher"
|
id="index-ketcher"
|
||||||
@ -206,13 +124,11 @@
|
|||||||
class="rounded-lg"
|
class="rounded-lg"
|
||||||
></iframe>
|
></iframe>
|
||||||
<button
|
<button
|
||||||
class="btn btn-lg bg-primary-950 text-primary-50 join-item mt-2 w-full"
|
class="btn btn-lg bg-primary-950 text-primary-50 join-item w-full mt-2"
|
||||||
>
|
>
|
||||||
Predict!
|
Predict!
|
||||||
</button>
|
</button>
|
||||||
<div class="mt-1 flex w-full justify-end">
|
<a class="label mx-auto w-full mt-1" href="#">Advanced</a>
|
||||||
<a class="label justify-end" href="/predict">Advanced</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<input
|
<input
|
||||||
type="hidden"
|
type="hidden"
|
||||||
@ -234,18 +150,18 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Community News Section -->
|
<!-- Community News Section -->
|
||||||
<section class="bg-base-200 z-10 mx-8 py-16">
|
<section class="py-16 bg-base-200 z-10 mx-8">
|
||||||
<div class="mx-auto max-w-7xl px-4">
|
<div class="max-w-7xl mx-auto px-4">
|
||||||
<h2 class="h2 mb-8 text-left font-bold">Community Updates</h2>
|
<h2 class="h2 font-bold text-left mb-8">Community Updates</h2>
|
||||||
|
|
||||||
<div id="community-news-container" class="flex justify-center gap-4">
|
<div id="community-news-container" class="flex gap-4 justify-center">
|
||||||
<!-- News cards will be populated here -->
|
<!-- News cards will be populated here -->
|
||||||
<div id="loading" class="flex w-full justify-center">
|
<div id="loading" class="flex justify-center w-full">
|
||||||
<span class="loading loading-spinner loading-lg"></span>
|
<span class="loading loading-spinner loading-lg"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-6 text-right">
|
<div class="text-right mt-6">
|
||||||
<a
|
<a
|
||||||
href="https://community.envipath.org/c/announcements/10"
|
href="https://community.envipath.org/c/announcements/10"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
@ -261,18 +177,18 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- Mission Statement Section -->
|
<!-- Mission Statement Section -->
|
||||||
<section class="from-base-200 to-base-100 bg-gradient-to-b py-16">
|
<section class="py-16 from-base-200 to-base-100 bg-gradient-to-b">
|
||||||
<div class="mx-auto px-8 md:px-12">
|
<div class="mx-auto px-8 md:px-12">
|
||||||
<div class="flex flex-row gap-4">
|
<div class="flex flex-row gap-4">
|
||||||
<div class="w-1/3">
|
<div class="w-1/3">
|
||||||
<img
|
<img
|
||||||
src="{% static "/images/ep-rule-artwork.png" %}"
|
src="{% static "/images/ep-rule-artwork.png" %}"
|
||||||
alt="rule-based iterative tree greneration"
|
alt="rule-based iterative tree greneration"
|
||||||
class="h-full w-full object-contain"
|
class="w-full h-full object-contain"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="mr-8 w-2/3 space-y-4 text-left">
|
<div class="space-y-4 text-left w-2/3 mr-8">
|
||||||
<h2 class="h2 mb-8 font-bold">About enviPath</h2>
|
<h2 class="h2 font-bold mb-8">About enviPath</h2>
|
||||||
<p class="">
|
<p class="">
|
||||||
enviPath is a database and prediction system for the microbial
|
enviPath is a database and prediction system for the microbial
|
||||||
biotransformation of organic environmental contaminants. The
|
biotransformation of organic environmental contaminants. The
|
||||||
@ -285,7 +201,7 @@
|
|||||||
products. Explore our tools and contribute to advancing
|
products. Explore our tools and contribute to advancing
|
||||||
environmental biotransformation research.
|
environmental biotransformation research.
|
||||||
</p>
|
</p>
|
||||||
<div class="float-right flex flex-row gap-4">
|
<div class="flex flex-row gap-4 float-right">
|
||||||
<a href="/about" class="btn btn-ghost-neutral">Read More</a>
|
<a href="/about" class="btn btn-ghost-neutral">Read More</a>
|
||||||
<a href="/about" class="btn btn-neutral">Publications</a>
|
<a href="/about" class="btn btn-neutral">Publications</a>
|
||||||
</div>
|
</div>
|
||||||
@ -295,7 +211,7 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- Partners Section -->
|
<!-- Partners Section -->
|
||||||
<section class="bg-base-100 py-14 sm:py-12">
|
<section class="py-14 sm:py-12 bg-base-100">
|
||||||
<div class="mx-auto px-6 lg:px-8">
|
<div class="mx-auto px-6 lg:px-8">
|
||||||
<div class="divider">
|
<div class="divider">
|
||||||
<h2 class="text-center text-lg/8 font-semibold">Backed by Science</h2>
|
<h2 class="text-center text-lg/8 font-semibold">Backed by Science</h2>
|
||||||
@ -326,31 +242,6 @@
|
|||||||
<script language="javascript">
|
<script language="javascript">
|
||||||
var currentPackage = "{{ meta.current_package.url }}";
|
var currentPackage = "{{ meta.current_package.url }}";
|
||||||
|
|
||||||
// Helper function to safely get Ketcher instance from iframe
|
|
||||||
function getKetcherInstance(iframeId) {
|
|
||||||
const ketcherFrame = document.getElementById(iframeId);
|
|
||||||
if (!ketcherFrame) {
|
|
||||||
console.error("Ketcher iframe not found:", iframeId);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (
|
|
||||||
"contentWindow" in ketcherFrame &&
|
|
||||||
ketcherFrame.contentWindow.ketcher
|
|
||||||
) {
|
|
||||||
return ketcherFrame.contentWindow.ketcher;
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
console.error(
|
|
||||||
"Cannot access Ketcher iframe - possible CORS issue:",
|
|
||||||
err,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Discourse API integration is now handled by discourse-api.js
|
// Discourse API integration is now handled by discourse-api.js
|
||||||
|
|
||||||
// Function to render Discourse topics into cards
|
// Function to render Discourse topics into cards
|
||||||
@ -373,13 +264,16 @@
|
|||||||
const date = new Date(topic.created_at).toLocaleDateString();
|
const date = new Date(topic.created_at).toLocaleDateString();
|
||||||
|
|
||||||
return `
|
return `
|
||||||
<div class="card bg-white shadow-sm hover:shadow-lg transition-shadow duration-300 h-52 w-75 flex-shrink-0">
|
<div class="card bg-white shadow-xs hover:shadow-lg transition-shadow duration-300 h-64 w-75 flex-shrink-0">
|
||||||
<div class="card-body flex flex-col h-full justify-between">
|
<div class="card-body flex flex-col h-full">
|
||||||
<h3 class="card-title leading-tight font-normal tracking-tight mb-2 line-clamp-5 overflow-hidden">
|
<h3 class="card-title leading-tight font-normal tracking-tight h-12 mb-2 line-clamp-2 text-ellipsis wrap-break-word overflow-hidden">
|
||||||
<a href="${topic.url}" target="_blank" class="hover:text-primary">
|
<a href="${topic.url}" target="_blank" class="hover:text-primary">
|
||||||
${topic.title}
|
${topic.title}
|
||||||
</a>
|
</a>
|
||||||
</h3>
|
</h3>
|
||||||
|
<div class="text-sm line-clamp-4 break-words" >
|
||||||
|
${topic.excerpt}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-row items-center justify-between">
|
<div class="flex flex-row items-center justify-between">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
@ -405,20 +299,141 @@
|
|||||||
// Make render function globally available
|
// Make render function globally available
|
||||||
window.renderDiscourseTopics = renderDiscourseTopics;
|
window.renderDiscourseTopics = renderDiscourseTopics;
|
||||||
|
|
||||||
// Ketcher iframe load handler - set up change event to sync SMILES
|
// Toggle functionality with smooth animations
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
function toggleInputMode() {
|
||||||
const indexKetcher = document.getElementById("index-ketcher");
|
const toggle = $('input[type="checkbox"]');
|
||||||
indexKetcher.addEventListener("load", function () {
|
const textContainer = $("#text-input-container");
|
||||||
|
const ketcherContainer = $("#ketcher-container");
|
||||||
|
const formCard = $(".card");
|
||||||
|
const fieldset = $(".fieldset");
|
||||||
|
|
||||||
|
if (toggle.is(":checked")) {
|
||||||
|
// Draw mode - show Ketcher, hide text input
|
||||||
|
textContainer.addClass("opacity-0 transform scale-95");
|
||||||
|
textContainer.removeClass("opacity-100 transform scale-100");
|
||||||
|
|
||||||
|
// Adjust fieldset padding for Ketcher mode - reduce padding and make more compact
|
||||||
|
fieldset.removeClass("p-8");
|
||||||
|
fieldset.addClass("p-4");
|
||||||
|
|
||||||
|
// Wait for fade out to complete, then hide and show new content
|
||||||
|
setTimeout(() => {
|
||||||
|
textContainer.addClass("hidden");
|
||||||
|
ketcherContainer.removeClass("hidden opacity-0 transform scale-95");
|
||||||
|
ketcherContainer.addClass("opacity-100 transform scale-100");
|
||||||
|
|
||||||
|
// Force re-evaluation of iframe size
|
||||||
|
const iframe = document.getElementById("index-ketcher");
|
||||||
|
if (iframe) {
|
||||||
|
iframe.style.height = "400px";
|
||||||
|
}
|
||||||
|
}, 300);
|
||||||
|
} else {
|
||||||
|
// SMILES mode - show text input, hide Ketcher
|
||||||
|
ketcherContainer.addClass("opacity-0 transform scale-95");
|
||||||
|
ketcherContainer.removeClass("opacity-100 transform scale-100");
|
||||||
|
|
||||||
|
// Restore fieldset padding for text input mode
|
||||||
|
fieldset.removeClass("p-4");
|
||||||
|
fieldset.addClass("p-8");
|
||||||
|
|
||||||
|
// Wait for fade out to complete, then hide and show new content
|
||||||
|
setTimeout(() => {
|
||||||
|
ketcherContainer.addClass("hidden");
|
||||||
|
textContainer.removeClass("hidden opacity-0 transform scale-95");
|
||||||
|
textContainer.addClass("opacity-100 transform scale-100");
|
||||||
|
}, 300);
|
||||||
|
|
||||||
|
// Transfer SMILES from Ketcher to text input if available
|
||||||
|
if (window.indexKetcher && window.indexKetcher.getSmiles) {
|
||||||
|
const smiles = window.indexKetcher.getSmiles();
|
||||||
|
if (smiles && smiles.trim() !== "") {
|
||||||
|
$("#index-form-text-input").val(smiles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ketcher integration
|
||||||
|
function indexKetcherToTextInput() {
|
||||||
|
$("#index-form-smiles").val(this.ketcher.getSmiles());
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
// Initialize fieldset with proper padding
|
||||||
|
$(".fieldset").addClass("p-8");
|
||||||
|
|
||||||
|
// Toggle event listener
|
||||||
|
$('input[type="checkbox"]').on("change", toggleInputMode);
|
||||||
|
|
||||||
|
// Ketcher iframe load handler
|
||||||
|
$("#index-ketcher").on("load", function () {
|
||||||
const checkKetcherReady = () => {
|
const checkKetcherReady = () => {
|
||||||
const win = this.contentWindow;
|
const win = this.contentWindow;
|
||||||
if (win.ketcher && "editor" in win.ketcher) {
|
if (win.ketcher && "editor" in win.ketcher) {
|
||||||
window.indexKetcher = win.ketcher;
|
window.indexKetcher = win.ketcher;
|
||||||
|
win.ketcher.editor.event.change.handlers.push({
|
||||||
|
once: false,
|
||||||
|
priority: 0,
|
||||||
|
f: indexKetcherToTextInput,
|
||||||
|
ketcher: win.ketcher,
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
setTimeout(checkKetcherReady, 100);
|
setTimeout(checkKetcherReady, 100);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
checkKetcherReady();
|
checkKetcherReady();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Handle example link clicks
|
||||||
|
$(".example-link").on("click", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
const smiles = $(this).data("smiles");
|
||||||
|
const title = $(this).attr("title");
|
||||||
|
|
||||||
|
// Check if we're in Ketcher mode or text input mode
|
||||||
|
if ($('input[type="checkbox"]').is(":checked")) {
|
||||||
|
// In Ketcher mode - set the SMILES in Ketcher
|
||||||
|
if (window.indexKetcher && window.indexKetcher.setMolecule) {
|
||||||
|
window.indexKetcher.setMolecule(smiles);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// In text input mode - set the SMILES in the text input
|
||||||
|
$("#index-form-text-input").val(smiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show a brief feedback
|
||||||
|
const originalText = $(this).text();
|
||||||
|
$(this).text(`loaded!`);
|
||||||
|
setTimeout(() => {
|
||||||
|
$(this).text(originalText);
|
||||||
|
}, 1000);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle form submission on Enter
|
||||||
|
$("#index-form").on("submit", function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
var textSmiles = "";
|
||||||
|
|
||||||
|
// Check if we're in Ketcher mode and extract SMILES
|
||||||
|
if ($('input[type="checkbox"]').is(":checked") && window.indexKetcher) {
|
||||||
|
textSmiles = window.indexKetcher.getSmiles().trim();
|
||||||
|
} else {
|
||||||
|
textSmiles = $("#index-form-text-input").val().trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (textSmiles === "") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#index-form-smiles").val(textSmiles);
|
||||||
|
$("#index-form").attr("action", currentPackage + "/pathway");
|
||||||
|
$("#index-form").attr("method", "POST");
|
||||||
|
this.submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Discourse topics are now loaded automatically by discourse-api.js
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock main_content %}
|
{% endblock main_content %}
|
||||||
|
|||||||
@ -3,11 +3,7 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="panel-group" id="migration-detail">
|
<div class="panel-group" id="migration-detail">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div
|
<div class="panel-heading" id="headingPanel" style="font-size:2rem;height: 46px">
|
||||||
class="panel-heading"
|
|
||||||
id="headingPanel"
|
|
||||||
style="font-size:2rem;height: 46px"
|
|
||||||
>
|
|
||||||
Migration Status BT Rules
|
Migration Status BT Rules
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
@ -16,56 +12,33 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% for obj in results %}
|
{% for obj in results %}
|
||||||
<div
|
<div class="panel panel-default panel-heading list-group-item" style="background-color:silver">
|
||||||
class="panel panel-default panel-heading list-group-item"
|
|
||||||
style="background-color:silver"
|
|
||||||
>
|
|
||||||
{% if obj.status %}
|
{% if obj.status %}
|
||||||
<span
|
<span class="glyphicon glyphicon-ok" aria-hidden="true"
|
||||||
class="glyphicon glyphicon-ok"
|
style="float:right" data-toggle="tooltip"
|
||||||
aria-hidden="true"
|
data-placement="top" title="" data-original-title="Reviewed">
|
||||||
style="float:right"
|
|
||||||
data-toggle="tooltip"
|
|
||||||
data-placement="top"
|
|
||||||
title=""
|
|
||||||
data-original-title="Reviewed"
|
|
||||||
>
|
|
||||||
</span>
|
</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<span
|
<span class="glyphicon glyphicon-remove" aria-hidden="true"
|
||||||
class="glyphicon glyphicon-remove"
|
style="float:right" data-toggle="tooltip"
|
||||||
aria-hidden="true"
|
data-placement="top" title="" data-original-title="Reviewed">
|
||||||
style="float:right"
|
|
||||||
data-toggle="tooltip"
|
|
||||||
data-placement="top"
|
|
||||||
title=""
|
|
||||||
data-original-title="Reviewed"
|
|
||||||
>
|
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h4 class="panel-title">
|
<h4 class="panel-title">
|
||||||
<a
|
<a id="{{ obj.id }}-link" data-toggle="collapse" data-parent="#migration-detail"
|
||||||
id="{{ obj.id }}-link"
|
href="#{{ obj.id }}">{{ obj.name|safe }}</a>
|
||||||
data-toggle="collapse"
|
|
||||||
data-parent="#migration-detail"
|
|
||||||
href="#{{ obj.id }}"
|
|
||||||
>{{ obj.name|safe }}</a
|
|
||||||
>
|
|
||||||
</h4>
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div id="{{ obj.id }}" class="panel-collapse collapse {% if not obj.status %}in{% endif %}">
|
||||||
id="{{ obj.id }}"
|
|
||||||
class="panel-collapse {% if not obj.status %}in{% endif %} collapse"
|
|
||||||
>
|
|
||||||
<div class="panel-body list-group-item">
|
<div class="panel-body list-group-item">
|
||||||
<a class="list-group-item" href="{{ obj.detail_url }}"
|
<a class="list-group-item" href="{{ obj.detail_url }}">{{ obj.name|safe }} Migration Detail Page</a>
|
||||||
>{{ obj.name|safe }} Migration Detail Page</a
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script></script>
|
<script>
|
||||||
|
|
||||||
|
</script>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|||||||
@ -3,68 +3,34 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="panel-group" id="migration-detail">
|
<div class="panel-group" id="migration-detail">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div
|
<div class="panel-heading" id="headingPanel" style="font-size:2rem;height: 46px">
|
||||||
class="panel-heading"
|
|
||||||
id="headingPanel"
|
|
||||||
style="font-size:2rem;height: 46px"
|
|
||||||
>
|
|
||||||
Migration Status for {{ bt_rule_name }}
|
Migration Status for {{ bt_rule_name }}
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<p>
|
<p>A package contains pathways, rules, etc. and can reflect specific experimental
|
||||||
A package contains pathways, rules, etc. and can reflect specific
|
conditions. <a target="_blank" href="https://wiki.envipath.org/index.php/packages" role="button">Learn
|
||||||
experimental conditions.
|
more >></a></p>
|
||||||
<a
|
|
||||||
target="_blank"
|
|
||||||
href="https://wiki.envipath.org/index.php/packages"
|
|
||||||
role="button"
|
|
||||||
>Learn more >></a
|
|
||||||
>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% for obj in results %}
|
{% for obj in results %}
|
||||||
<div
|
<div class="panel panel-default panel-heading list-group-item" style="background-color:silver">
|
||||||
class="panel panel-default panel-heading list-group-item"
|
|
||||||
style="background-color:silver"
|
|
||||||
>
|
|
||||||
{% if obj.status %}
|
{% if obj.status %}
|
||||||
<span
|
<span class="glyphicon glyphicon-ok" aria-hidden="true"
|
||||||
class="glyphicon glyphicon-ok"
|
style="float:right" data-toggle="tooltip"
|
||||||
aria-hidden="true"
|
data-placement="top" title="" data-original-title="Reviewed">
|
||||||
style="float:right"
|
|
||||||
data-toggle="tooltip"
|
|
||||||
data-placement="top"
|
|
||||||
title=""
|
|
||||||
data-original-title="Reviewed"
|
|
||||||
>
|
|
||||||
</span>
|
</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<span
|
<span class="glyphicon glyphicon-remove" aria-hidden="true"
|
||||||
class="glyphicon glyphicon-remove"
|
style="float:right" data-toggle="tooltip"
|
||||||
aria-hidden="true"
|
data-placement="top" title="" data-original-title="Reviewed">
|
||||||
style="float:right"
|
|
||||||
data-toggle="tooltip"
|
|
||||||
data-placement="top"
|
|
||||||
title=""
|
|
||||||
data-original-title="Reviewed"
|
|
||||||
>
|
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h4 class="panel-title">
|
<h4 class="panel-title">
|
||||||
<a
|
<a id="{{ obj.id }}-link" data-toggle="collapse" data-parent="#migration-detail"
|
||||||
id="{{ obj.id }}-link"
|
href="#{{ obj.id }}">{{ obj.name|safe }}</a>
|
||||||
data-toggle="collapse"
|
|
||||||
data-parent="#migration-detail"
|
|
||||||
href="#{{ obj.id }}"
|
|
||||||
>{{ obj.name|safe }}</a
|
|
||||||
>
|
|
||||||
</h4>
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div id="{{ obj.id }}" class="panel-collapse collapse {% if not obj.status %}in{% endif %}">
|
||||||
id="{{ obj.id }}"
|
|
||||||
class="panel-collapse {% if not obj.status %}in{% endif %} collapse"
|
|
||||||
>
|
|
||||||
<div class="panel-body list-group-item">
|
<div class="panel-body list-group-item">
|
||||||
<pre>{{ obj.detail }}</pre>
|
<pre>{{ obj.detail }}</pre>
|
||||||
</div>
|
</div>
|
||||||
@ -73,5 +39,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script></script>
|
<script>
|
||||||
|
|
||||||
|
</script>
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|||||||
31
templates/modals/cite_modal.html
Normal file
31
templates/modals/cite_modal.html
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<div class="modal fade bs-modal-lg" id="citemodal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
|
||||||
|
aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3>How to cite enviPath</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<ol class="list-group list-group-numbered">
|
||||||
|
<li class="list-group-item">
|
||||||
|
Hafner, J., Lorsbach, T., Schmidt, S. <em>et al.</em>
|
||||||
|
<cite>Advancements in biotransformation pathway prediction: enhancements, datasets, and novel
|
||||||
|
functionalities in enviPath.</cite>
|
||||||
|
<a href="https://doi.org/10.1186/s13321-024-00881-6" target="_blank">J Cheminform 16, 93
|
||||||
|
(2024)</a>
|
||||||
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
Wicker, J., Lorsbach, T., Gütlein, M., Schmid, E., Latino, D., Kramer, S., Fenner, K.
|
||||||
|
<cite>enviPath - The environmental contaminant biotransformation pathway resource</cite>
|
||||||
|
<a href="https://doi.org/10.1093/nar/gkv1229" target="_blank">
|
||||||
|
Nucleic Acids Research, Volume 44, Issue D1, 4 January 2016, Pages D502-D508
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -1,85 +1,42 @@
|
|||||||
<dialog
|
<div class="modal fade" tabindex="-1" id="import_legacy_package_modal" role="dialog"
|
||||||
id="import_legacy_package_modal"
|
aria-labelledby="import_legacy_package_modal" aria-hidden="true">
|
||||||
class="modal"
|
<div class="modal-dialog">
|
||||||
x-data="modalForm()"
|
<div class="modal-content">
|
||||||
@close="reset()"
|
<div class="modal-header">
|
||||||
>
|
<button type="button" class="close" data-dismiss="modal">
|
||||||
<div class="modal-box">
|
<span aria-hidden="true">×</span>
|
||||||
<!-- Header -->
|
<span class="sr-only">Close</span>
|
||||||
<h3 class="text-lg font-bold">Import Package from Legacy System</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
<h4 class="modal-title">Import Package from legacy System</h4>
|
||||||
|
</div>
|
||||||
<!-- Body -->
|
<div class="modal-body">
|
||||||
<div class="py-4">
|
<p>Create a Package based on the JSON Export of the legacy system.</p>
|
||||||
<p class="mb-4">
|
<form id="import-legacy-package-modal-form" accept-charset="UTF-8" data-remote="true" method="post"
|
||||||
Create a Package based on the JSON Export of the legacy system.
|
enctype="multipart/form-data">
|
||||||
</p>
|
|
||||||
<form
|
|
||||||
id="import-legacy-package-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
method="post"
|
|
||||||
enctype="multipart/form-data"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="form-control">
|
<p>
|
||||||
<label class="label">
|
<label class="btn btn-primary" for="legacyJsonFile">
|
||||||
<span class="label-text">Legacy JSON File</span>
|
<input id="legacyJsonFile" name="file" type="file" style="display:none;"
|
||||||
|
onchange="$('#upload-legacy-file-info').html(this.files[0].name)">
|
||||||
|
Choose JSON File
|
||||||
</label>
|
</label>
|
||||||
<input
|
<span class="label label-info" id="upload-legacy-file-info"></span>
|
||||||
type="file"
|
<input type="hidden" value="import-legacy-package-json" name="hidden" readonly="">
|
||||||
id="legacyJsonFile"
|
</p>
|
||||||
name="file"
|
|
||||||
class="file-input file-input-bordered w-full"
|
|
||||||
accept=".json"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<input
|
|
||||||
type="hidden"
|
|
||||||
value="import-legacy-package-json"
|
|
||||||
name="hidden"
|
|
||||||
readonly
|
|
||||||
/>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<a id="import-legacy-package-modal-form-submit" class="btn btn-primary" href="#">Submit</a>
|
||||||
<div class="modal-action">
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Cancel
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit('import-legacy-package-modal-form')"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Submit</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Importing...</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<!-- Backdrop -->
|
</div>
|
||||||
<form method="dialog" class="modal-backdrop">
|
<script>
|
||||||
<button :disabled="isSubmitting">close</button>
|
$(function () {
|
||||||
</form>
|
$('#import-legacy-package-modal-form-submit').on('click', function (e) {
|
||||||
</dialog>
|
e.preventDefault();
|
||||||
|
$('#import-legacy-package-modal-form').submit();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,83 +1,42 @@
|
|||||||
<dialog
|
<div class="modal fade" tabindex="-1" id="import_package_modal" role="dialog"
|
||||||
id="import_package_modal"
|
aria-labelledby="import_package_modal" aria-hidden="true">
|
||||||
class="modal"
|
<div class="modal-dialog">
|
||||||
x-data="modalForm()"
|
<div class="modal-content">
|
||||||
@close="reset()"
|
<div class="modal-header">
|
||||||
>
|
<button type="button" class="close" data-dismiss="modal">
|
||||||
<div class="modal-box">
|
<span aria-hidden="true">×</span>
|
||||||
<!-- Header -->
|
<span class="sr-only">Close</span>
|
||||||
<h3 class="text-lg font-bold">Import Package</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
<h4 class="modal-title">Import Package</h4>
|
||||||
|
</div>
|
||||||
<!-- Body -->
|
<div class="modal-body">
|
||||||
<div class="py-4">
|
<p>Create a Package based on a JSON Export.</p>
|
||||||
<p class="mb-4">Create a Package based on a JSON Export.</p>
|
<form id="import-package-modal-form" accept-charset="UTF-8" data-remote="true" method="post"
|
||||||
<form
|
enctype="multipart/form-data">
|
||||||
id="import-package-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
method="post"
|
|
||||||
enctype="multipart/form-data"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="form-control">
|
<p>
|
||||||
<label class="label">
|
<label class="btn btn-primary" for="jsonFile">
|
||||||
<span class="label-text">JSON File</span>
|
<input id="jsonFile" name="file" type="file" style="display:none;"
|
||||||
|
onchange="$('#upload-file-info').html(this.files[0].name)">
|
||||||
|
Choose JSON File
|
||||||
</label>
|
</label>
|
||||||
<input
|
<span class="label label-info" id="upload-file-info"></span>
|
||||||
type="file"
|
<input type="hidden" value="import-package-json" name="hidden" readonly="">
|
||||||
id="jsonFile"
|
</p>
|
||||||
name="file"
|
|
||||||
class="file-input file-input-bordered w-full"
|
|
||||||
accept=".json"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<input
|
|
||||||
type="hidden"
|
|
||||||
value="import-package-json"
|
|
||||||
name="hidden"
|
|
||||||
readonly
|
|
||||||
/>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<a id="import-package-modal-form-submit" class="btn btn-primary" href="#">Submit</a>
|
||||||
<div class="modal-action">
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Cancel
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit('import-package-modal-form')"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Submit</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Importing...</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<!-- Backdrop -->
|
</div>
|
||||||
<form method="dialog" class="modal-backdrop">
|
<script>
|
||||||
<button :disabled="isSubmitting">close</button>
|
$(function () {
|
||||||
</form>
|
$('#import-package-modal-form-submit').on('click', function (e) {
|
||||||
</dialog>
|
e.preventDefault();
|
||||||
|
$('#import-package-modal-form').submit();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,137 +1,78 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
|
<div class="modal fade bs-modal-lg" id="new_compound_modal" tabindex="-1" aria-labelledby="new_compound_modal" aria-modal="true"
|
||||||
<dialog
|
role="dialog">
|
||||||
id="new_compound_modal"
|
<div class="modal-dialog modal-lg">
|
||||||
class="modal"
|
<div class="modal-content">
|
||||||
x-data="modalForm()"
|
<div class="modal-header">
|
||||||
@close="reset()"
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
>
|
<span aria-hidden="true">×</span>
|
||||||
<div class="modal-box max-w-3xl">
|
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="text-lg font-bold">Create a new Compound</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
<h4 class="modal-title">Create a new Compound</h4>
|
||||||
|
</div>
|
||||||
<!-- Body -->
|
<div class="modal-body">
|
||||||
<div class="py-4">
|
<form id="new_compound_modal_form" accept-charset="UTF-8" action="{% url 'package compound list' meta.current_package.uuid %}" data-remote="true" method="post">
|
||||||
<form
|
|
||||||
id="new-compound-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action="{% url 'package compound list' meta.current_package.uuid %}"
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
<label for="compound-name">Name</label>
|
||||||
<div class="form-control mb-3">
|
<input id="compound-name" class="form-control" name="compound-name" placeholder="Name"/>
|
||||||
<label class="label" for="compound-name">
|
<label for="compound-description">Description</label>
|
||||||
<span class="label-text">Name</span>
|
<input id="compound-description" class="form-control" name="compound-description" placeholder="Description"/>
|
||||||
</label>
|
<label for="compound-smiles">SMILES</label>
|
||||||
<input
|
<input type="text" class="form-control" name="compound-smiles" placeholder="SMILES" id="compound-smiles">
|
||||||
id="compound-name"
|
<p></p>
|
||||||
class="input input-bordered w-full"
|
<div>
|
||||||
name="compound-name"
|
<iframe id="new_compound_ketcher" src="{% static '/js/ketcher2/ketcher.html' %}" width="100%"
|
||||||
placeholder="Name"
|
height="510"></iframe>
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="compound-description">
|
|
||||||
<span class="label-text">Description</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="compound-description"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="compound-description"
|
|
||||||
placeholder="Description"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="compound-smiles">
|
|
||||||
<span class="label-text">SMILES</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="compound-smiles"
|
|
||||||
placeholder="SMILES"
|
|
||||||
id="compound-smiles"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
<iframe
|
|
||||||
id="new_compound_ketcher"
|
|
||||||
src="{% static '/js/ketcher2/ketcher.html' %}"
|
|
||||||
width="100%"
|
|
||||||
height="510"
|
|
||||||
></iframe>
|
|
||||||
</div>
|
</div>
|
||||||
|
<p></p>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<button type="button" class="btn btn-secondary pull-left" data-dismiss="modal">Close
|
||||||
<div class="modal-action">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit('new-compound-modal-form')"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Submit</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Creating...</span>
|
|
||||||
</button>
|
</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="new_compound_modal_form_submit">Submit</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Backdrop -->
|
</div>
|
||||||
<form method="dialog" class="modal-backdrop">
|
|
||||||
<button :disabled="isSubmitting">close</button>
|
|
||||||
</form>
|
|
||||||
</dialog>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document
|
|
||||||
.getElementById("new_compound_ketcher")
|
function newCompoundModalketcherToNewCompoundModalTextInput() {
|
||||||
.addEventListener("load", function () {
|
$('#compound-smiles').val(this.ketcher.getSmiles());
|
||||||
const iframe = this;
|
}
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
|
||||||
|
$('#new_compound_ketcher').on('load', function() {
|
||||||
const checkKetcherReady = () => {
|
const checkKetcherReady = () => {
|
||||||
const win = iframe.contentWindow;
|
win = this.contentWindow
|
||||||
if (win.ketcher && "editor" in win.ketcher) {
|
if (win.ketcher && 'editor' in win.ketcher) {
|
||||||
win.ketcher.editor.event.change.handlers.push({
|
win.ketcher.editor.event.change.handlers.push({
|
||||||
once: false,
|
once: false,
|
||||||
priority: 0,
|
priority: 0,
|
||||||
f: function () {
|
f: newCompoundModalketcherToNewCompoundModalTextInput,
|
||||||
document.getElementById("compound-smiles").value =
|
ketcher: win.ketcher
|
||||||
this.ketcher.getSmiles();
|
|
||||||
},
|
|
||||||
ketcher: win.ketcher,
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setTimeout(checkKetcherReady, 100);
|
setTimeout(checkKetcherReady, 100);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
checkKetcherReady();
|
checkKetcherReady();
|
||||||
|
})
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
$('#new_compound_modal_form_submit').on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$(this).prop("disabled",true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// submit form
|
||||||
|
$('#new_compound_modal_form').submit();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -1,96 +1,45 @@
|
|||||||
{% load static %}
|
<div class="modal fade" tabindex="-1" id="new_group_modal" role="dialog" aria-labelledby="new_group_modal"
|
||||||
|
aria-hidden="true">
|
||||||
<dialog
|
<div class="modal-dialog">
|
||||||
id="new_group_modal"
|
<div class="modal-content">
|
||||||
class="modal"
|
<div class="modal-header">
|
||||||
x-data="modalForm()"
|
<button type="button" class="close" data-dismiss="modal">
|
||||||
@close="reset()"
|
<span aria-hidden="true">×</span>
|
||||||
>
|
<span class="sr-only">Close</span>
|
||||||
<div class="modal-box">
|
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="font-bold text-lg">New Group</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
<h4 class="modal-title">New Group</h4>
|
||||||
|
</div>
|
||||||
<!-- Body -->
|
<div class="modal-body">
|
||||||
<div class="py-4">
|
<p>Create new Group. You can assign users to the group once
|
||||||
<p class="mb-4">
|
it is created. Description can be changed after creation.</p>
|
||||||
Create new Group. You can assign users to the group once it is created.
|
<form id="new_group_modal_form" accept-charset="UTF-8" action="{{ SERVER_BASE }}/group"
|
||||||
Description can be changed after creation.
|
data-remote="true"
|
||||||
</p>
|
method="post">
|
||||||
|
|
||||||
<form
|
|
||||||
id="new-group-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action="{{ SERVER_BASE }}/group"
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
<p>
|
||||||
<div class="form-control mb-3">
|
<label for="name">Name</label>
|
||||||
<label class="label" for="group-name">
|
<input id="name" type="text" name="group-name" class="form-control" placeholder="Name"/>
|
||||||
<span class="label-text">Name</span>
|
</p>
|
||||||
</label>
|
<p>
|
||||||
<input
|
<label for="description">Description</label>
|
||||||
id="group-name"
|
<input id="description" type="text" class="form-control" placeholder="Description..."
|
||||||
class="input input-bordered w-full"
|
name="group-description"/>
|
||||||
name="group-name"
|
</p>
|
||||||
placeholder="Name"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="group-description">
|
|
||||||
<span class="label-text">Description</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="group-description"
|
|
||||||
type="text"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
placeholder="Description..."
|
|
||||||
name="group-description"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<a id="new_group_modal_form_submit" class="btn btn-primary" href="#">Submit</a>
|
||||||
<div class="modal-action">
|
<button type="button" class="btn btn-default" data-dismiss="modal">
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Cancel
|
Cancel
|
||||||
</button>
|
</button>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit('new-group-modal-form')"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Submit</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Creating...</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<!-- Backdrop -->
|
</div>
|
||||||
<form method="dialog" class="modal-backdrop">
|
<script>
|
||||||
<button :disabled="isSubmitting">close</button>
|
$(function() {
|
||||||
</form>
|
$('#new_group_modal_form_submit').on('click', function() {
|
||||||
</dialog>
|
$('#new_group_modal_form').submit();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,337 +1,188 @@
|
|||||||
<dialog
|
|
||||||
id="new_model_modal"
|
|
||||||
class="modal"
|
|
||||||
x-data="{
|
|
||||||
isSubmitting: false,
|
|
||||||
modelType: '',
|
|
||||||
buildAppDomain: false,
|
|
||||||
|
|
||||||
reset() {
|
<div class="modal fade" tabindex="-1" id="new_model_modal" role="dialog" aria-labelledby="new_model_modal"
|
||||||
this.isSubmitting = false;
|
aria-hidden="true">
|
||||||
this.modelType = '';
|
<div class="modal-dialog modal-lg">
|
||||||
this.buildAppDomain = false;
|
<div class="modal-content">
|
||||||
},
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">
|
||||||
get showMlrr() {
|
<span aria-hidden="true">×</span>
|
||||||
return this.modelType === 'mlrr';
|
<span class="sr-only">Close</span>
|
||||||
},
|
|
||||||
|
|
||||||
get showRbrr() {
|
|
||||||
return this.modelType === 'rbrr';
|
|
||||||
},
|
|
||||||
|
|
||||||
get showEnviformer() {
|
|
||||||
return this.modelType === 'enviformer';
|
|
||||||
},
|
|
||||||
|
|
||||||
submit(formId) {
|
|
||||||
const form = document.getElementById(formId);
|
|
||||||
if (form && form.checkValidity()) {
|
|
||||||
this.isSubmitting = true;
|
|
||||||
form.submit();
|
|
||||||
} else if (form) {
|
|
||||||
form.reportValidity();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}"
|
|
||||||
@close="reset()"
|
|
||||||
>
|
|
||||||
<div class="modal-box max-w-3xl">
|
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="text-lg font-bold">New Model</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
<h4 class="modal-title">New Model</h4>
|
||||||
|
</div>
|
||||||
<!-- Body -->
|
<div class="modal-body">
|
||||||
<div class="py-4">
|
<form id="new_model_form" accept-charset="UTF-8" action="{{ meta.current_package.url }}/model"
|
||||||
<form
|
data-remote="true" method="post">
|
||||||
id="new_model_form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action="{{ meta.current_package.url }}/model"
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="alert alert-info mb-4">
|
<div class="jumbotron">Create a new Model to
|
||||||
<span>
|
limit the number of degradation products in the
|
||||||
Create a new Model to limit the number of degradation products in
|
prediction. You just need to set a name and the packages
|
||||||
the prediction. You just need to set a name and the packages you
|
you want the object to be based on. There are multiple types of models available.
|
||||||
want the object to be based on. There are multiple types of models
|
For additional information have a look at our
|
||||||
available. For additional information have a look at our
|
<a target="_blank" href="https://wiki.envipath.org/index.php/relative-reasoning" role="button">wiki
|
||||||
<a
|
>></a>
|
||||||
target="_blank"
|
|
||||||
href="https://wiki.envipath.org/index.php/relative-reasoning"
|
|
||||||
class="link"
|
|
||||||
>wiki >></a
|
|
||||||
>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Name -->
|
<!-- Name -->
|
||||||
<div class="form-control mb-3">
|
<label for="model-name">Name</label>
|
||||||
<label class="label" for="model-name">
|
<input id="model-name" name="model-name" class="form-control" placeholder="Name"/>
|
||||||
<span class="label-text">Name</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="model-name"
|
|
||||||
name="model-name"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
placeholder="Name"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Description -->
|
<!-- Description -->
|
||||||
<div class="form-control mb-3">
|
<label for="model-description">Description</label>
|
||||||
<label class="label" for="model-description">
|
<input id="model-description" name="model-description" class="form-control"
|
||||||
<span class="label-text">Description</span>
|
placeholder="Description"/>
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="model-description"
|
|
||||||
name="model-description"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
placeholder="Description"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Model Type -->
|
<!-- Model Type -->
|
||||||
<div class="form-control mb-3">
|
<label for="model-type">Model Type</label>
|
||||||
<label class="label" for="model-type">
|
<select id="model-type" name="model-type" class="form-control" data-width='100%'>
|
||||||
<span class="label-text">Model Type</span>
|
<option disabled selected>Select Model Type</option>
|
||||||
</label>
|
|
||||||
<select
|
|
||||||
id="model-type"
|
|
||||||
name="model-type"
|
|
||||||
class="select select-bordered w-full"
|
|
||||||
x-model="modelType"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
<option value="" disabled selected>Select Model Type</option>
|
|
||||||
{% for k, v in model_types.items %}
|
{% for k, v in model_types.items %}
|
||||||
<option value="{{ v }}">{{ k }}</option>
|
<option value="{{ v }}">{{ k }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Rule Packages (MLRR, RBRR) -->
|
<!-- Rule Packages -->
|
||||||
<div class="form-control mb-3" x-show="showMlrr || showRbrr" x-cloak>
|
<div id="rule-packages" class="ep-model-param mlrr rbrr">
|
||||||
<label class="label" for="model-rule-packages">
|
<label for="model-rule-packages">Rule Packages</label>
|
||||||
<span class="label-text">Rule Packages</span>
|
<select id="model-rule-packages" name="model-rule-packages" data-actions-box='true'
|
||||||
</label>
|
class="form-control" multiple data-width='100%'>
|
||||||
<select
|
<option disabled>Reviewed Packages</option>
|
||||||
id="model-rule-packages"
|
|
||||||
name="model-rule-packages"
|
|
||||||
class="select select-bordered w-full h-32"
|
|
||||||
multiple
|
|
||||||
>
|
|
||||||
<optgroup label="Reviewed Packages">
|
|
||||||
{% for obj in meta.readable_packages %}
|
{% for obj in meta.readable_packages %}
|
||||||
{% if obj.reviewed %}
|
{% if obj.reviewed %}
|
||||||
<option value="{{ obj.url }}">{{ obj.name|safe }}</option>
|
<option value="{{ obj.url }}">{{ obj.name|safe }}</option>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</optgroup>
|
|
||||||
<optgroup label="Unreviewed Packages">
|
<option disabled>Unreviewed Packages</option>
|
||||||
{% for obj in meta.readable_packages %}
|
{% for obj in meta.readable_packages %}
|
||||||
{% if not obj.reviewed %}
|
{% if not obj.reviewed %}
|
||||||
<option value="{{ obj.url }}">{{ obj.name|safe }}</option>
|
<option value="{{ obj.url }}">{{ obj.name|safe }}</option>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</optgroup>
|
|
||||||
</select>
|
</select>
|
||||||
<label class="label">
|
|
||||||
<span class="label-text-alt">Hold Ctrl/Cmd to select multiple</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Data Packages (MLRR, RBRR, Enviformer) -->
|
<!-- Data Packages -->
|
||||||
<div
|
<div id="data-packages" class="ep-model-param mlrr rbrr enviformer">
|
||||||
class="form-control mb-3"
|
<label for="model-data-packages">Data Packages</label>
|
||||||
x-show="showMlrr || showRbrr || showEnviformer"
|
<select id="model-data-packages" name="model-data-packages" data-actions-box='true'
|
||||||
x-cloak
|
class="form-control" multiple data-width='100%'>
|
||||||
>
|
<option disabled>Reviewed Packages</option>
|
||||||
<label class="label" for="model-data-packages">
|
|
||||||
<span class="label-text">Data Packages</span>
|
|
||||||
</label>
|
|
||||||
<select
|
|
||||||
id="model-data-packages"
|
|
||||||
name="model-data-packages"
|
|
||||||
class="select select-bordered w-full h-32"
|
|
||||||
multiple
|
|
||||||
>
|
|
||||||
<optgroup label="Reviewed Packages">
|
|
||||||
{% for obj in meta.readable_packages %}
|
{% for obj in meta.readable_packages %}
|
||||||
{% if obj.reviewed %}
|
{% if obj.reviewed %}
|
||||||
<option value="{{ obj.url }}">{{ obj.name|safe }}</option>
|
<option value="{{ obj.url }}">{{ obj.name|safe }}</option>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</optgroup>
|
|
||||||
<optgroup label="Unreviewed Packages">
|
<option disabled>Unreviewed Packages</option>
|
||||||
{% for obj in meta.readable_packages %}
|
{% for obj in meta.readable_packages %}
|
||||||
{% if not obj.reviewed %}
|
{% if not obj.reviewed %}
|
||||||
<option value="{{ obj.url }}">{{ obj.name|safe }}</option>
|
<option value="{{ obj.url }}">{{ obj.name|safe }}</option>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</optgroup>
|
|
||||||
</select>
|
</select>
|
||||||
<label class="label">
|
|
||||||
<span class="label-text-alt">Hold Ctrl/Cmd to select multiple</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Fingerprinter (MLRR) -->
|
<!-- Fingerprinter -->
|
||||||
<div class="form-control mb-3" x-show="showMlrr" x-cloak>
|
<div id="fingerprinter" class="ep-model-param mlrr">
|
||||||
<label class="label" for="model-fingerprinter">
|
<label for="model-fingerprinter">Fingerprinter</label>
|
||||||
<span class="label-text">Fingerprinter</span>
|
<select id="model-fingerprinter" name="model-fingerprinter" data-actions-box='true'
|
||||||
</label>
|
class="form-control" multiple data-width='100%'>
|
||||||
<select
|
|
||||||
id="model-fingerprinter"
|
|
||||||
name="model-fingerprinter"
|
|
||||||
class="select select-bordered w-full h-32"
|
|
||||||
multiple
|
|
||||||
>
|
|
||||||
<option value="MACCS" selected>MACCS Fingerprinter</option>
|
<option value="MACCS" selected>MACCS Fingerprinter</option>
|
||||||
{% if meta.enabled_features.PLUGINS and additional_descriptors %}
|
{% if meta.enabled_features.PLUGINS and additional_descriptors %}
|
||||||
<optgroup label="Additional Fingerprinter / Descriptor">
|
<option disabled selected>Select Additional Fingerprinter / Descriptor</option>
|
||||||
{% for k, v in additional_descriptors.items %}
|
{% for k, v in additional_descriptors.items %}
|
||||||
<option value="{{ v }}">{{ k }}</option>
|
<option value="{{ v }}">{{ k }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</optgroup>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</select>
|
</select>
|
||||||
<label class="label">
|
|
||||||
<span class="label-text-alt">Hold Ctrl/Cmd to select multiple</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Threshold (MLRR, Enviformer) -->
|
<!-- Threshold -->
|
||||||
<div
|
<div id="threshold" class="ep-model-param mlrr enviformer">
|
||||||
class="form-control mb-3"
|
<label for="model-threshold">Threshold</label>
|
||||||
x-show="showMlrr || showEnviformer"
|
<input type="number" min="0" max="1" step="0.05" value="0.5" id="model-threshold"
|
||||||
x-cloak
|
name="model-threshold" class="form-control">
|
||||||
>
|
|
||||||
<label class="label" for="model-threshold">
|
|
||||||
<span class="label-text">Threshold</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
min="0"
|
|
||||||
max="1"
|
|
||||||
step="0.05"
|
|
||||||
value="0.5"
|
|
||||||
id="model-threshold"
|
|
||||||
name="model-threshold"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Applicability Domain (MLRR) -->
|
<div id="appdomain" class="ep-model-param mlrr">
|
||||||
{% if meta.enabled_features.APPLICABILITY_DOMAIN %}
|
{% if meta.enabled_features.APPLICABILITY_DOMAIN %}
|
||||||
<div x-show="showMlrr" x-cloak>
|
<!-- Build AD? -->
|
||||||
<div class="form-control mb-3">
|
<div class="checkbox">
|
||||||
<label class="label cursor-pointer justify-start gap-3">
|
<label>
|
||||||
<input
|
<input type="checkbox" id="build-app-domain" name="build-app-domain">Also build an
|
||||||
type="checkbox"
|
Applicability Domain?
|
||||||
id="build-app-domain"
|
|
||||||
name="build-app-domain"
|
|
||||||
class="checkbox"
|
|
||||||
x-model="buildAppDomain"
|
|
||||||
/>
|
|
||||||
<span class="label-text"
|
|
||||||
>Also build an Applicability Domain?</span
|
|
||||||
>
|
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="ad-params" style="display:none">
|
||||||
<div x-show="buildAppDomain" x-cloak class="ml-4 space-y-3">
|
<!-- Num Neighbors -->
|
||||||
<div class="form-control">
|
<label for="num-neighbors">Number of Neighbors</label>
|
||||||
<label class="label" for="num-neighbors">
|
<input id="num-neighbors" name="num-neighbors" type="number" class="form-control"
|
||||||
<span class="label-text">Number of Neighbors</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="num-neighbors"
|
|
||||||
name="num-neighbors"
|
|
||||||
type="number"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
value="5"
|
value="5"
|
||||||
step="1"
|
step="1" min="0" max="10">
|
||||||
min="0"
|
<!-- Local Compatibility -->
|
||||||
max="10"
|
<label for="local-compatibility-threshold">Local Compatibility Threshold</label>
|
||||||
/>
|
<input id="local-compatibility-threshold" name="local-compatibility-threshold"
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control">
|
|
||||||
<label class="label" for="local-compatibility-threshold">
|
|
||||||
<span class="label-text">Local Compatibility Threshold</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="local-compatibility-threshold"
|
|
||||||
name="local-compatibility-threshold"
|
|
||||||
type="number"
|
type="number"
|
||||||
class="input input-bordered w-full"
|
class="form-control" value="0.5" step="0.01" min="0" max="1">
|
||||||
value="0.5"
|
<!-- Reliability -->
|
||||||
step="0.01"
|
<label for="reliability-threshold">Reliability Threshold</label>
|
||||||
min="0"
|
<input id="reliability-threshold" name="reliability-threshold" type="number"
|
||||||
max="1"
|
class="form-control" value="0.5" step="0.01" min="0" max="1">
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control">
|
|
||||||
<label class="label" for="reliability-threshold">
|
|
||||||
<span class="label-text">Reliability Threshold</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="reliability-threshold"
|
|
||||||
name="reliability-threshold"
|
|
||||||
type="number"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
value="0.5"
|
|
||||||
step="0.01"
|
|
||||||
min="0"
|
|
||||||
max="1"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<a id="new_model_modal_form_submit" class="btn btn-primary" href="#">Submit</a>
|
||||||
<div class="modal-action">
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||||
<button
|
</div>
|
||||||
type="button"
|
</div>
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Cancel
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit('new_model_form')"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Submit</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Creating...</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Backdrop -->
|
<script>
|
||||||
<form method="dialog" class="modal-backdrop">
|
$(function () {
|
||||||
<button :disabled="isSubmitting">close</button>
|
// Built in Model Types
|
||||||
</form>
|
var nativeModelTypes = [
|
||||||
</dialog>
|
"mlrr",
|
||||||
|
"rbrr",
|
||||||
|
"enviformer",
|
||||||
|
]
|
||||||
|
|
||||||
|
// Initially hide all "specific" forms
|
||||||
|
$(".ep-model-param").each(function () {
|
||||||
|
$(this).hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#model-type').selectpicker();
|
||||||
|
$("#model-fingerprinter").selectpicker();
|
||||||
|
$("#model-rule-packages").selectpicker();
|
||||||
|
$("#model-data-packages").selectpicker();
|
||||||
|
|
||||||
|
$("#build-app-domain").change(function () {
|
||||||
|
if ($(this).is(":checked")) {
|
||||||
|
$('#ad-params').show();
|
||||||
|
} else {
|
||||||
|
$('#ad-params').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// On change hide all and show only selected
|
||||||
|
$("#model-type").change(function () {
|
||||||
|
$('.ep-model-param').hide();
|
||||||
|
var modelType = $('#model-type').val();
|
||||||
|
if (nativeModelTypes.indexOf(modelType) !== -1) {
|
||||||
|
$('.' + modelType).show();
|
||||||
|
} else {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#new_model_modal_form_submit').on('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$('#new_model_form').submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,93 +1,62 @@
|
|||||||
{% load static %}
|
<div class="modal fade"
|
||||||
|
tabindex="-1"
|
||||||
<dialog
|
|
||||||
id="new_package_modal"
|
id="new_package_modal"
|
||||||
class="modal"
|
role="dialog"
|
||||||
x-data="modalForm()"
|
aria-labelledby="new_package_modal"
|
||||||
@close="reset()"
|
aria-hidden="true">
|
||||||
>
|
<div class="modal-dialog">
|
||||||
<div class="modal-box">
|
<div class="modal-content">
|
||||||
<!-- Header -->
|
<div class="modal-header">
|
||||||
<h3 class="font-bold text-lg">New Package</h3>
|
<button type="button"
|
||||||
|
class="close"
|
||||||
<!-- Close button (X) -->
|
data-dismiss="modal">
|
||||||
<form method="dialog">
|
<span aria-hidden="true">×</span>
|
||||||
<button
|
<span class="sr-only">Close</span>
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
<h4 class="modal-title">New Package</h4>
|
||||||
|
</div>
|
||||||
<!-- Body -->
|
<div class="modal-body">
|
||||||
<div class="py-4">
|
<p>Create new package. Description can be changed later.</p>
|
||||||
<p class="mb-4">Create new package. Description can be changed later.</p>
|
<form id="new_package_modal_form"
|
||||||
|
|
||||||
<form
|
|
||||||
id="new-package-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
accept-charset="UTF-8"
|
||||||
action=""
|
action=""
|
||||||
method="post"
|
data-remote="true"
|
||||||
>
|
method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
<p>
|
||||||
<div class="form-control mb-3">
|
<label for="name">Name</label>
|
||||||
<label class="label" for="package-name">
|
<input id="name" class="form-control"
|
||||||
<span class="label-text">Name</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="package-name"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="package-name"
|
name="package-name"
|
||||||
placeholder="Name"
|
placeholder="Name"/>
|
||||||
required
|
</p>
|
||||||
/>
|
<p>
|
||||||
</div>
|
<label for="description">Description</label>
|
||||||
|
<input id="description"
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="package-description">
|
|
||||||
<span class="label-text">Description</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="package-description"
|
|
||||||
type="text"
|
type="text"
|
||||||
class="input input-bordered w-full"
|
rows="3"
|
||||||
|
class="form-control"
|
||||||
placeholder="Description..."
|
placeholder="Description..."
|
||||||
name="package-description"
|
name="package-description"/>
|
||||||
/>
|
</p>
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<a id="new_package_modal_form_submit"
|
||||||
<div class="modal-action">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Cancel
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
class="btn btn-primary"
|
||||||
@click="submit('new-package-modal-form')"
|
href="#">Submit</a>
|
||||||
:disabled="isSubmitting"
|
<button type="button"
|
||||||
>
|
class="btn btn-default"
|
||||||
<span x-show="!isSubmitting">Submit</span>
|
data-dismiss="modal">Cancel
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Creating...</span>
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<!-- Backdrop -->
|
</div>
|
||||||
<form method="dialog" class="modal-backdrop">
|
<script>
|
||||||
<button :disabled="isSubmitting">close</button>
|
$(function() {
|
||||||
</form>
|
$('#new_package_modal_form_submit').on('click', function (e) {
|
||||||
</dialog>
|
e.preventDefault();
|
||||||
|
$('#new_package_modal_form').submit();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|||||||
302
templates/modals/collections/new_pathway_modal.html
Normal file
302
templates/modals/collections/new_pathway_modal.html
Normal file
@ -0,0 +1,302 @@
|
|||||||
|
|
||||||
|
{% load static %}
|
||||||
|
<div class="modal fade" tabindex="-1" id="new_pathway_modal" role="dialog" aria-labelledby="new_pathway_modal"
|
||||||
|
aria-hidden="true" style="overflow-y: auto;">
|
||||||
|
<!-- FIXME: make width dynamic-->
|
||||||
|
<div class="modal-dialog" id="new_pathway_modal_dialog" style="width:900px">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">
|
||||||
|
<span aria-hidden="true">×</span> <span class="sr-only">Close</span>
|
||||||
|
</button>
|
||||||
|
<h4 class="js-title-step"></h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body hide" data-step="1" data-title="New Pathway">
|
||||||
|
<div class="jumbotron">Create a new pathway by entering
|
||||||
|
the root compound and a name. Then select if you want to
|
||||||
|
use the prediction engine to generate a predicted pathway or
|
||||||
|
create an empty pathway that you fill in by yourself. If
|
||||||
|
you choose to predict a pathway, you can modify the
|
||||||
|
settings for the prediction, or use the default settings
|
||||||
|
and just click Submit.
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
{% if current_user.name == 'anonymous' %}
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
You are currently logged in as Anonymous. Please note:
|
||||||
|
Pathways entered or predicted as anonymous user will be deleted after 30 days.
|
||||||
|
Please log in to save your results.
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label for="name">Name</label>
|
||||||
|
<input id="name" class="form-control" name="name" placeholder="Name"/>
|
||||||
|
<label for="description">Description</label>
|
||||||
|
<input id="description" class="form-control" name="description" placeholder="no description"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label for="predict">Predict pathway or build yourself?</label>
|
||||||
|
<div class="radio" id="predict">
|
||||||
|
<p>
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="predict" id="radioPredict" value="predict" checked/>Predict pathway
|
||||||
|
</label>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="predict" id="radioIncremental"value="incremental"/>Incremental prediction
|
||||||
|
</label>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="predict" id="radioBuild" value="build"/>Build pathway
|
||||||
|
</label>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<label for="smilesinput">SMILES</label>
|
||||||
|
<table style="width: 100%">
|
||||||
|
<colgroup>
|
||||||
|
<col span="1" style="width: 90%;">
|
||||||
|
<col span="1" style="width: 10%;">
|
||||||
|
</colgroup>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input id="smilesinput" class="form-control" name="smilesinput" placeholder="C1CCCCC1"
|
||||||
|
autocapitalize="none"/>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<button type="button" class="btn btn-default" id="render-button">
|
||||||
|
Render
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<p id="ketcher_container"></p>
|
||||||
|
<div>
|
||||||
|
<iframe id="ifKetcher" src="{% static '/js/ketcher/ketcher.html' %}" width="850"
|
||||||
|
height="510"></iframe>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body hide" data-step="2" data-title="New Pathway - Advanced Settings">
|
||||||
|
<div class="jumbotron">Choose if you want to use an existing
|
||||||
|
setting, or create a new one for this pathway
|
||||||
|
prediction. Then click Submit to use the specified setting,
|
||||||
|
or click next to set the parameters.
|
||||||
|
</div>
|
||||||
|
<div id="settings">
|
||||||
|
<div class="radio" id="settingRadio">
|
||||||
|
<p>
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="existing" id="radioDefault" value="exisiting" checked/>
|
||||||
|
Use Default
|
||||||
|
</label>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="existing" id="radioExists" value="exisiting"/>
|
||||||
|
Select Existing
|
||||||
|
</label>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<label>
|
||||||
|
<input type="radio" name="existing" id="radioNew" value="temporary"/>
|
||||||
|
Create New
|
||||||
|
</label>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<select id="settingSelect" name="settingSelect" class="form-control">
|
||||||
|
{% for setting in available_settings %}
|
||||||
|
<option value="{{ setting.id }}">{{ setting.name|safe }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
<p></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% with step_offset=1 %}
|
||||||
|
{% include "templates/modals/collections/new_setting_modal_body.html" %}
|
||||||
|
{% endwith %}
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default js-btn-step pull-left" data-orientation="cancel"
|
||||||
|
onclick="reset()" data-dismiss="modal"></button>
|
||||||
|
<button type="button" class="btn btn-default js-btn-step" data-orientation="previous"
|
||||||
|
id="backbutton"></button>
|
||||||
|
<button type="button" class="btn btn-default js-btn-step" data-orientation="next"
|
||||||
|
id="nextbutton"></button>
|
||||||
|
<a id="modal-form-submit" class="btn btn-primary" href="#">Submit</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
s = new Setting(
|
||||||
|
'settingName',
|
||||||
|
'package_multi_select',
|
||||||
|
'modelSelect',
|
||||||
|
'cutoff',
|
||||||
|
'evalType',
|
||||||
|
'availableTS',
|
||||||
|
'forms',
|
||||||
|
'truncatorTable',
|
||||||
|
'summaryTable',
|
||||||
|
);
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
// hide all forms
|
||||||
|
$('#forms').children().hide()
|
||||||
|
|
||||||
|
$("#render-button").on("click", function() {
|
||||||
|
syncKetcherAndTextInput('text', "ifKetcher", "smilesinput");
|
||||||
|
});
|
||||||
|
|
||||||
|
// If theres a change in the in '#smilesinput' sync the value to ketcher
|
||||||
|
$('#smilesinput').on('input', function() {
|
||||||
|
syncKetcherAndTextInput('text', 'ifKetcher', 'smilesinput');
|
||||||
|
});
|
||||||
|
|
||||||
|
// If theres an update in ketcher sync it to textinput
|
||||||
|
setInterval(function() {
|
||||||
|
syncKetcherAndTextInput('ketcher', 'ifKetcher', 'smilesinput');
|
||||||
|
}, 250);
|
||||||
|
|
||||||
|
$("#smilesinput").on("blur", function() {
|
||||||
|
syncKetcherAndTextInput('text', 'ifKetcher', 'smilesinput');
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#smilesinput").on("keypress", function(event) {
|
||||||
|
if (event.keyCode == 13) {
|
||||||
|
syncKetcherAndTextInput('text', 'ifKetcher', 'smilesinput');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Show forms depending on the selected TS
|
||||||
|
$('#availableTS').on('change', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
var type = $(this).val();
|
||||||
|
// hide current content
|
||||||
|
$('#forms').children().hide()
|
||||||
|
|
||||||
|
if(type === '') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#' + type + '_form').show()
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#modelSelect").on("change", function() {
|
||||||
|
setCutoff = function (thresh) {
|
||||||
|
$("#cutoff").val(thresh);
|
||||||
|
}
|
||||||
|
|
||||||
|
var modelUri = $("#modelSelect :selected").val();
|
||||||
|
fillPRCurve(modelUri, setCutoff);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add a TS to the setting
|
||||||
|
$('#add-ts-button').on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
s.addTruncator();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('input[type=radio][name=predict]').change(function() {
|
||||||
|
if (this.id == 'radioBuild') {
|
||||||
|
$("#nextbutton").prop("disabled", true);
|
||||||
|
} else {
|
||||||
|
$("#nextbutton").prop("disabled", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('input[type=radio][name=existing]').change(function() {
|
||||||
|
if (this.id == 'radioDefault' || this.id == 'radioExists') {
|
||||||
|
if(this.id == 'radioDefault') {
|
||||||
|
$("#settingSelect").prop("disabled", true);
|
||||||
|
} else {
|
||||||
|
$("#settingSelect").prop("disabled", false);
|
||||||
|
}
|
||||||
|
$("#nextbutton").prop("disabled", true);
|
||||||
|
} else {
|
||||||
|
// build...
|
||||||
|
$("#settingSelect").prop("disabled", true);
|
||||||
|
$("#nextbutton").prop("disabled", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var pwStep1 = function() {
|
||||||
|
console.log("pw step 1");
|
||||||
|
// Make "Next" to "Advanced"
|
||||||
|
$('#nextbutton').val("Advanced");
|
||||||
|
}
|
||||||
|
|
||||||
|
var pwStep2 = function() {
|
||||||
|
console.log("pw step 2");
|
||||||
|
// Make "Advanced" to "Next"
|
||||||
|
$('#nextbutton').val("Next");
|
||||||
|
// As "Use default is preselected" disable "Next" button
|
||||||
|
$("#nextbutton").prop("disabled",true);
|
||||||
|
// Disable setting dropdown as long as the correspndonding radio isnt checked
|
||||||
|
$("#settingSelect").prop("disabled",true);
|
||||||
|
// Show submit button
|
||||||
|
$("#modal-form-submit").show();
|
||||||
|
}
|
||||||
|
|
||||||
|
var settingStep1 = function (){
|
||||||
|
// First step sets name and packages
|
||||||
|
s.extractName();
|
||||||
|
s.extractSelectedPackages();
|
||||||
|
}
|
||||||
|
|
||||||
|
var settingStep2 = function (){
|
||||||
|
// Seconds step gathers relative reasoning params
|
||||||
|
s.extractRelativeReasoning();
|
||||||
|
s.extractCutoff();
|
||||||
|
s.extractEvaluationType();
|
||||||
|
}
|
||||||
|
|
||||||
|
var settingStep3 = function() {
|
||||||
|
s.updateTable();
|
||||||
|
s.updateSummaryTable();
|
||||||
|
// hide duplicate submit...
|
||||||
|
$("#nextbutton").hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
var postPathway = function(){
|
||||||
|
console.log("Complete!");
|
||||||
|
console.log(s.tsParams);
|
||||||
|
console.log("Getting SMILES");
|
||||||
|
}
|
||||||
|
|
||||||
|
function dummy() {
|
||||||
|
console.log("dummy");
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#new_pathway_modal').modalSteps({
|
||||||
|
btnCancelHtml: 'Cancel',
|
||||||
|
btnPreviousHtml: 'Back',
|
||||||
|
btnNextHtml: 'Next',
|
||||||
|
btnLastStepHtml: 'Submit',
|
||||||
|
disableNextButton: false,
|
||||||
|
completeCallback: postPathway,
|
||||||
|
callbacks: {
|
||||||
|
'1': pwStep1,
|
||||||
|
'2' : pwStep2,
|
||||||
|
'3' : dummy,
|
||||||
|
'4' : settingStep1,
|
||||||
|
'5' : settingStep2,
|
||||||
|
'6' : settingStep3,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#modal-form-submit').on('click', function() {
|
||||||
|
e.preventDefault();
|
||||||
|
postPathway();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
@ -1,260 +1,109 @@
|
|||||||
|
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
<dialog
|
<div id="new_prediction_setting_modal" class="modal" tabindex="-1">
|
||||||
id="new_prediction_setting_modal"
|
<div class="modal-dialog">
|
||||||
class="modal"
|
<div class="modal-content">
|
||||||
x-data="{
|
<div class="modal-header">
|
||||||
isSubmitting: false,
|
<h5 class="modal-title">Create a Prediction Setting</h5>
|
||||||
tpMethod: '',
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
reset() {
|
|
||||||
this.isSubmitting = false;
|
|
||||||
this.tpMethod = '';
|
|
||||||
},
|
|
||||||
|
|
||||||
async submit() {
|
|
||||||
const form = document.getElementById('new-prediction-setting-modal-form');
|
|
||||||
if (!form.checkValidity()) {
|
|
||||||
form.reportValidity();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.isSubmitting = true;
|
|
||||||
const formData = new FormData(form);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await fetch('/setting', {
|
|
||||||
method: 'POST',
|
|
||||||
body: new URLSearchParams(formData)
|
|
||||||
});
|
|
||||||
if (response.ok) {
|
|
||||||
location.reload();
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error creating setting:', error);
|
|
||||||
} finally {
|
|
||||||
this.isSubmitting = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}"
|
|
||||||
@close="reset()"
|
|
||||||
>
|
|
||||||
<div class="modal-box max-w-2xl">
|
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="text-lg font-bold">Create a Prediction Setting</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
<!-- Body -->
|
<p>To create a Prediction Setting fill the form below and click "Create"</p>
|
||||||
<div class="py-4">
|
<form id="new-prediction-setting-modal-form" accept-charset="UTF-8" action="" data-remote="true"
|
||||||
<p class="mb-4">
|
method="post">
|
||||||
To create a Prediction Setting fill the form below and click "Create"
|
|
||||||
</p>
|
|
||||||
<form
|
|
||||||
id="new-prediction-setting-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action=""
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
<label for="prediction-setting-name">Name</label>
|
||||||
<label class="label" for="prediction-setting-name">
|
<input id="prediction-setting-name" name="prediction-setting-name" class="form-control" placeholder="Name"/>
|
||||||
<span class="label-text">Name</span>
|
<label for="prediction-setting-description">Description</label>
|
||||||
</label>
|
<input id="prediction-setting-description" name="prediction-setting-description" class="form-control"
|
||||||
<input
|
placeholder="Description"/>
|
||||||
id="prediction-setting-name"
|
|
||||||
name="prediction-setting-name"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
placeholder="Name"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
<label for="prediction-setting-max-nodes">Max #Nodes</label>
|
||||||
<label class="label" for="prediction-setting-description">
|
<input id="prediction-setting-max-nodes" type="number" class="form-control" name="prediction-setting-max-nodes" value="30" min="1" max="50" step="1">
|
||||||
<span class="label-text">Description</span>
|
<label for="prediction-setting-max-depth">Max Depth</label>
|
||||||
</label>
|
<input id="prediction-setting-max-depth" type="number" class="form-control" name="prediction-setting-max-depth" value="5" min="1" max="8" step="1">
|
||||||
<input
|
|
||||||
id="prediction-setting-description"
|
|
||||||
name="prediction-setting-description"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
placeholder="Description"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
<label for="tp-generation-method">TP Generation Method</label>
|
||||||
<label class="label" for="prediction-setting-max-nodes">
|
<select id="tp-generation-method" name="tp-generation-method" class="form-control" data-width='100%'>
|
||||||
<span class="label-text">Max #Nodes</span>
|
<option disabled selected>Select how TPs are generated</option>
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="prediction-setting-max-nodes"
|
|
||||||
type="number"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="prediction-setting-max-nodes"
|
|
||||||
value="30"
|
|
||||||
min="1"
|
|
||||||
max="50"
|
|
||||||
step="1"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="prediction-setting-max-depth">
|
|
||||||
<span class="label-text">Max Depth</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="prediction-setting-max-depth"
|
|
||||||
type="number"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="prediction-setting-max-depth"
|
|
||||||
value="5"
|
|
||||||
min="1"
|
|
||||||
max="8"
|
|
||||||
step="1"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="tp-generation-method">
|
|
||||||
<span class="label-text">TP Generation Method</span>
|
|
||||||
</label>
|
|
||||||
<select
|
|
||||||
id="tp-generation-method"
|
|
||||||
name="tp-generation-method"
|
|
||||||
class="select select-bordered w-full"
|
|
||||||
x-model="tpMethod"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
<option value="" disabled selected>
|
|
||||||
Select how TPs are generated
|
|
||||||
</option>
|
|
||||||
<option value="rule-based-prediction-setting">Rule Based</option>
|
<option value="rule-based-prediction-setting">Rule Based</option>
|
||||||
<option value="model-based-prediction-setting">Model Based</option>
|
<option value="model-based-prediction-setting">Model Based</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
<div id="rule-based-prediction-setting-specific-form">
|
||||||
|
<!-- Rule Packages -->
|
||||||
<!-- Rule Based Settings -->
|
<label>Rule Packages</label><br>
|
||||||
<div x-show="tpMethod === 'rule-based-prediction-setting'" x-cloak>
|
<select id="rule-based-prediction-setting-packages" name="rule-based-prediction-setting-packages"
|
||||||
<div class="form-control mb-3">
|
data-actions-box='true' class="form-control" multiple data-width='100%'>
|
||||||
<label class="label">
|
<option disabled>Reviewed Packages</option>
|
||||||
<span class="label-text">Rule Packages</span>
|
|
||||||
</label>
|
|
||||||
<select
|
|
||||||
id="rule-based-prediction-setting-packages"
|
|
||||||
name="rule-based-prediction-setting-packages"
|
|
||||||
class="select select-bordered w-full h-32"
|
|
||||||
multiple
|
|
||||||
>
|
|
||||||
<optgroup label="Reviewed Packages">
|
|
||||||
{% for obj in meta.readable_packages %}
|
{% for obj in meta.readable_packages %}
|
||||||
{% if obj.reviewed %}
|
{% if obj.reviewed %}
|
||||||
<option value="{{ obj.url }}">{{ obj.name|safe }}</option>
|
<option value="{{ obj.url }}">{{ obj.name|safe }}</option>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</optgroup>
|
|
||||||
<optgroup label="Unreviewed Packages">
|
<option disabled>Unreviewed Packages</option>
|
||||||
{% for obj in meta.readable_packages %}
|
{% for obj in meta.readable_packages %}
|
||||||
{% if not obj.reviewed %}
|
{% if not obj.reviewed %}
|
||||||
<option value="{{ obj.url }}">{{ obj.name|safe }}</option>
|
<option value="{{ obj.url }}">{{ obj.name|safe }}</option>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</optgroup>
|
|
||||||
</select>
|
</select>
|
||||||
<label class="label">
|
|
||||||
<span class="label-text-alt"
|
|
||||||
>Hold Ctrl/Cmd to select multiple</span
|
|
||||||
>
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div id="model-based-prediction-setting-specific-form">
|
||||||
|
<label>Select Model</label><br>
|
||||||
<!-- Model Based Settings -->
|
<select id="model-based-prediction-setting-model" name="model-based-prediction-setting-model" class="form-control" data-width='100%'>
|
||||||
<div x-show="tpMethod === 'model-based-prediction-setting'" x-cloak>
|
<option disabled selected>Select the model</option>
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="model-based-prediction-setting-model">
|
|
||||||
<span class="label-text">Select Model</span>
|
|
||||||
</label>
|
|
||||||
<select
|
|
||||||
id="model-based-prediction-setting-model"
|
|
||||||
name="model-based-prediction-setting-model"
|
|
||||||
class="select select-bordered w-full"
|
|
||||||
>
|
|
||||||
<option value="" disabled selected>Select the model</option>
|
|
||||||
{% for m in models %}
|
{% for m in models %}
|
||||||
<option value="{{ m.url }}">{{ m.name|safe }}</option>
|
<option value="{{ m.url }}">{{ m.name|safe }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
|
<label for="model-based-prediction-setting-threshold">Threshold</label>
|
||||||
|
<input id="model-based-prediction-setting-threshold" name="model-based-prediction-setting-threshold" class="form-control" placeholder="0.25" type="number"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
<input class="form-check-input" type="checkbox" value="on" id="prediction-setting-new-default" name="prediction-setting-new-default">
|
||||||
<label class="label" for="model-based-prediction-setting-threshold">
|
<label class="form-check-label" for="prediction-setting-new-default">Set this setting as new default</label>
|
||||||
<span class="label-text">Threshold</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="model-based-prediction-setting-threshold"
|
|
||||||
name="model-based-prediction-setting-threshold"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
placeholder="0.25"
|
|
||||||
type="number"
|
|
||||||
min="0"
|
|
||||||
max="1"
|
|
||||||
step="0.05"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control">
|
|
||||||
<label class="label cursor-pointer justify-start gap-3">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
class="checkbox"
|
|
||||||
value="on"
|
|
||||||
id="prediction-setting-new-default"
|
|
||||||
name="prediction-setting-new-default"
|
|
||||||
/>
|
|
||||||
<span class="label-text">Set this setting as new default</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
<div class="modal-action">
|
<button type="button" class="btn btn-primary" id="new-prediction-setting-modal-submit">Create</button>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Create</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Creating...</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
|
||||||
<!-- Backdrop -->
|
// Initially hide all "specific" forms
|
||||||
<form method="dialog" class="modal-backdrop">
|
$("div[id$='-specific-form']").each( function() {
|
||||||
<button :disabled="isSubmitting">close</button>
|
$(this).hide();
|
||||||
</form>
|
});
|
||||||
</dialog>
|
|
||||||
|
$("#rule-based-prediction-setting-packages").selectpicker();
|
||||||
|
|
||||||
|
// On change hide all and show only selected
|
||||||
|
$("#tp-generation-method").change(function() {
|
||||||
|
$("div[id$='-specific-form']").each( function() {
|
||||||
|
$(this).hide();
|
||||||
|
});
|
||||||
|
val = $('option:selected', this).val();
|
||||||
|
$("#" + val + "-specific-form").show();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#new-prediction-setting-modal-submit').click(function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
// $('#new-prediction-setting-modal-form').submit();
|
||||||
|
|
||||||
|
const formData = $('#new-prediction-setting-modal-form').serialize();
|
||||||
|
$.post('/setting', formData, function(response) {
|
||||||
|
location.reload();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,105 +1,50 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
|
<div class="modal fade bs-modal-lg" id="new_reaction_modal" tabindex="-1" aria-labelledby="new_reaction_modal" aria-modal="true"
|
||||||
<dialog
|
role="dialog">
|
||||||
id="new_reaction_modal"
|
<div class="modal-dialog modal-lg">
|
||||||
class="modal"
|
<div class="modal-content">
|
||||||
x-data="modalForm()"
|
<div class="modal-header">
|
||||||
@close="reset()"
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
>
|
<span aria-hidden="true">×</span>
|
||||||
<div class="modal-box max-w-3xl">
|
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="font-bold text-lg">Create a new Reaction</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
<h4 class="modal-title">Create a new Reaction</h4>
|
||||||
|
</div>
|
||||||
<!-- Body -->
|
<div class="modal-body">
|
||||||
<div class="py-4">
|
<form id="new_reaction_modal_form" accept-charset="UTF-8" action="{% url 'package reaction list' meta.current_package.uuid %}" data-remote="true" method="post">
|
||||||
<form
|
|
||||||
id="new-reaction-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action="{% url 'package reaction list' meta.current_package.uuid %}"
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
<label for="reaction-name">Name</label>
|
||||||
<div class="form-control mb-3">
|
<input id="reaction-name" class="form-control" name="reaction-name" placeholder="Name"/>
|
||||||
<label class="label" for="reaction-name">
|
<label for="reaction-description">Description</label>
|
||||||
<span class="label-text">Name</span>
|
<input id="reaction-description" class="form-control" name="reaction-description" placeholder="Description"/>
|
||||||
</label>
|
<p></p>
|
||||||
<input
|
<div>
|
||||||
id="reaction-name"
|
<iframe id="new_reaction_ketcher" src="{% static '/js/ketcher2/ketcher.html' %}" width="100%"
|
||||||
class="input input-bordered w-full"
|
height="510"></iframe>
|
||||||
name="reaction-name"
|
|
||||||
placeholder="Name"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
|
<input type="hidden" name="reaction-smirks" id="reaction-smirks">
|
||||||
<div class="form-control mb-3">
|
<p></p>
|
||||||
<label class="label" for="reaction-description">
|
|
||||||
<span class="label-text">Description</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="reaction-description"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="reaction-description"
|
|
||||||
placeholder="Description"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
<iframe
|
|
||||||
id="new_reaction_ketcher"
|
|
||||||
src="{% static '/js/ketcher2/ketcher.html' %}"
|
|
||||||
width="100%"
|
|
||||||
height="510"
|
|
||||||
></iframe>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<input type="hidden" name="reaction-smirks" id="reaction-smirks" />
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<button type="button" class="btn btn-secondary pull-left" data-dismiss="modal">Close
|
||||||
<div class="modal-action">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="
|
|
||||||
const k = getKetcher('new_reaction_ketcher');
|
|
||||||
document.getElementById('reaction-smirks').value = k.getSmiles();
|
|
||||||
submit('new-reaction-modal-form');
|
|
||||||
"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Submit</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Creating...</span>
|
|
||||||
</button>
|
</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="new_reaction_modal_form_submit">Submit</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Backdrop -->
|
</div>
|
||||||
<form method="dialog" class="modal-backdrop">
|
<script>
|
||||||
<button :disabled="isSubmitting">close</button>
|
$(function() {
|
||||||
</form>
|
$('#new_reaction_modal_form_submit').on('click', function(e) {
|
||||||
</dialog>
|
e.preventDefault();
|
||||||
|
$(this).prop("disabled",true);
|
||||||
|
|
||||||
|
k = getKetcher('new_reaction_ketcher');
|
||||||
|
$('#reaction-smirks').val(k.getSmiles());
|
||||||
|
|
||||||
|
// submit form
|
||||||
|
$('#new_reaction_modal_form').submit();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,140 +1,72 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
|
<div class="modal fade bs-modal-lg" id="new_rule_modal" tabindex="-1" aria-labelledby="new_rule_modal" aria-modal="true"
|
||||||
|
role="dialog">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
<h4 class="modal-title">Create a new Rule</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form id="new_rule_modal_form" accept-charset="UTF-8" action="{% url 'package rule list' meta.current_package.uuid %}" data-remote="true" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<label for="rule-name">Name</label>
|
||||||
|
<input id="rule-name" class="form-control" name="rule-name" placeholder="Name"/>
|
||||||
|
<label for="rule-description">Description</label>
|
||||||
|
<input id="rule-description" class="form-control" name="rule-description" placeholder="Description"/>
|
||||||
|
<label for="rule-smirks">SMIRKS</label>
|
||||||
|
<input id="rule-smirks" class="form-control" name="rule-smirks" placeholder="SMIRKS"/>
|
||||||
|
<p></p>
|
||||||
|
<div id="rule-smirks-viz"></div>
|
||||||
|
<input type="hidden" name="rule-type" id="rule-type" value="SimpleAmbitRule">
|
||||||
|
<p></p>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary pull-left" data-dismiss="modal">Close
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="new_rule_modal_form_submit">Submit</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<dialog
|
</div>
|
||||||
id="new_rule_modal"
|
<script>
|
||||||
class="modal"
|
$(function() {
|
||||||
x-data="{
|
|
||||||
...modalForm(),
|
$('#rule-smirks').on('input', function(e) {
|
||||||
smirksVizHtml: '',
|
$('#rule-smirks-viz').empty()
|
||||||
updateSmirksViz() {
|
|
||||||
const smirks = document.getElementById('rule-smirks').value;
|
smirks = $('#rule-smirks').val()
|
||||||
if (!smirks) {
|
|
||||||
this.smirksVizHtml = '';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const img = new Image();
|
const img = new Image();
|
||||||
img.src = '{% url 'depict' %}?is_query_smirks=true&smirks=' + encodeURIComponent(smirks);
|
img.src = "{% url 'depict' %}?is_query_smirks=true&smirks=" + encodeURIComponent(smirks);
|
||||||
img.style.width = '100%';
|
img.style.width = '100%';
|
||||||
img.style.height = '100%';
|
img.style.height = '100%';
|
||||||
img.style.objectFit = 'cover';
|
img.style.objectFit = 'cover';
|
||||||
|
|
||||||
img.onload = () => {
|
img.onload = function () {
|
||||||
this.smirksVizHtml = img.outerHTML;
|
$('#rule-smirks-viz').append(img);
|
||||||
};
|
};
|
||||||
|
|
||||||
img.onerror = () => {
|
img.onerror = function () {
|
||||||
this.smirksVizHtml = `
|
error_tpl = `
|
||||||
<div class='alert alert-error' role='alert'>
|
<div class="alert alert-error" role="alert">
|
||||||
<h4 class='alert-heading'>Could not render SMIRKS!</h4>
|
<h4 class="alert-heading">Could not render SMIRKS!</h4>
|
||||||
<p>Could not render SMIRKS - Have you entered a valid SMIRKS?</p>
|
<p>Could not render SMIRKS - Have you entered a valid SMIRKS?</a>
|
||||||
</div>`;
|
</p>
|
||||||
|
</div>`
|
||||||
|
$('#rule-smirks-viz').append(error_tpl);
|
||||||
};
|
};
|
||||||
}
|
});
|
||||||
}"
|
|
||||||
@close="reset(); smirksVizHtml = ''"
|
|
||||||
>
|
|
||||||
<div class="modal-box max-w-3xl">
|
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="font-bold text-lg">Create a new Rule</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
$('#new_rule_modal_form_submit').on('click', function(e) {
|
||||||
<form method="dialog">
|
e.preventDefault();
|
||||||
<button
|
$(this).prop("disabled",true);
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
|
// submit form
|
||||||
:disabled="isSubmitting"
|
$('#new_rule_modal_form').submit();
|
||||||
>
|
});
|
||||||
✕
|
});
|
||||||
</button>
|
</script>
|
||||||
</form>
|
|
||||||
|
|
||||||
<!-- Body -->
|
|
||||||
<div class="py-4">
|
|
||||||
<form
|
|
||||||
id="new-rule-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action="{% url 'package rule list' meta.current_package.uuid %}"
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="rule-name">
|
|
||||||
<span class="label-text">Name</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="rule-name"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="rule-name"
|
|
||||||
placeholder="Name"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="rule-description">
|
|
||||||
<span class="label-text">Description</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="rule-description"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="rule-description"
|
|
||||||
placeholder="Description"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="rule-smirks">
|
|
||||||
<span class="label-text">SMIRKS</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="rule-smirks"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="rule-smirks"
|
|
||||||
placeholder="SMIRKS"
|
|
||||||
@input="updateSmirksViz()"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="rule-smirks-viz" class="mb-3" x-html="smirksVizHtml"></div>
|
|
||||||
|
|
||||||
<input
|
|
||||||
type="hidden"
|
|
||||||
name="rule-type"
|
|
||||||
id="rule-type"
|
|
||||||
value="SimpleAmbitRule"
|
|
||||||
/>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Footer -->
|
|
||||||
<div class="modal-action">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit('new-rule-modal-form')"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Submit</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Creating...</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Backdrop -->
|
|
||||||
<form method="dialog" class="modal-backdrop">
|
|
||||||
<button :disabled="isSubmitting">close</button>
|
|
||||||
</form>
|
|
||||||
</dialog>
|
|
||||||
|
|||||||
@ -1,177 +1,102 @@
|
|||||||
{% load static %}
|
<div class="modal fade" tabindex="-1" id="new_scenario_modal" role="dialog" aria-labelledby="new_scenario_modal"
|
||||||
|
aria-hidden="true">
|
||||||
<dialog
|
<div class="modal-dialog modal-lg">
|
||||||
id="new_scenario_modal"
|
<div class="modal-content">
|
||||||
class="modal"
|
<div class="modal-header">
|
||||||
x-data="{
|
<button type="button" class="close" data-dismiss="modal">
|
||||||
...modalForm(),
|
<span aria-hidden="true">×</span>
|
||||||
scenarioType: 'empty',
|
<span class="sr-only">Close</span>
|
||||||
validateYear(el) {
|
|
||||||
if (el.value && el.value.length < 4) {
|
|
||||||
el.value = new Date().getFullYear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}"
|
|
||||||
@close="reset()"
|
|
||||||
>
|
|
||||||
<div class="modal-box max-w-3xl">
|
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="font-bold text-lg">New Scenario</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
<h4 class="modal-title">New Scenario</h4>
|
||||||
|
</div>
|
||||||
<!-- Body -->
|
<div class="modal-body">
|
||||||
<div class="py-4">
|
<form id="new_scenario_form" accept-charset="UTF-8" action="{{ meta.current_package.url }}/scenario"
|
||||||
<form
|
data-remote="true" method="post">
|
||||||
id="new-scenario-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action="{{ meta.current_package.url }}/scenario"
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
<div class="jumbotron">Please enter name, description, and date of scenario. Date should be
|
||||||
<div class="alert alert-info mb-4">
|
associated to the data, not the current date. For example, this could reflect the publishing
|
||||||
<span>
|
date of a study. You can leave all fields but the name empty and fill them in later.
|
||||||
Please enter name, description, and date of scenario. Date should be
|
<a target="_blank" href="https://wiki.envipath.org/index.php/scenario" role="button">wiki
|
||||||
associated to the data, not the current date. For example, this
|
>></a>
|
||||||
could reflect the publishing date of a study. You can leave all
|
|
||||||
fields but the name empty and fill them in later.
|
|
||||||
<a
|
|
||||||
target="_blank"
|
|
||||||
href="https://wiki.envipath.org/index.php/scenario"
|
|
||||||
class="link"
|
|
||||||
>wiki >></a
|
|
||||||
>
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
<label for="scenario-name">Name</label>
|
||||||
<div class="form-control mb-3">
|
<input id="scenario-name" name="scenario-name" class="form-control" placeholder="Name"/>
|
||||||
<label class="label" for="scenario-name">
|
<label for="scenario-description">Description</label>
|
||||||
<span class="label-text">Name</span>
|
<input id="scenario-description" name="scenario-description" class="form-control"
|
||||||
</label>
|
placeholder="Description"/>
|
||||||
<input
|
<label id="dateField" for="dateYear">Date</label>
|
||||||
id="scenario-name"
|
<table>
|
||||||
name="scenario-name"
|
<tr>
|
||||||
class="input input-bordered w-full"
|
<th>
|
||||||
placeholder="Name"
|
<input type="number" id="dateYear" name="scenario-date-year" class="form-control"
|
||||||
required
|
placeholder="YYYY" max="{% now "Y" %}">
|
||||||
/>
|
</th>
|
||||||
</div>
|
<th>
|
||||||
|
<input type="number" id="dateMonth" name="scenario-date-month" min="1" max="12"
|
||||||
<div class="form-control mb-3">
|
class="form-control" placeholder="MM" >
|
||||||
<label class="label" for="scenario-description">
|
</th>
|
||||||
<span class="label-text">Description</span>
|
<th>
|
||||||
</label>
|
<input type="number" id="dateDay" name="scenario-date-day" min="1" max="31" class="form-control"
|
||||||
<input
|
placeholder="DD">
|
||||||
id="scenario-description"
|
</th>
|
||||||
name="scenario-description"
|
</tr>
|
||||||
class="input input-bordered w-full"
|
</table>
|
||||||
placeholder="Description"
|
<label for="scenario-type">Scenario Type</label>
|
||||||
/>
|
<select id="scenario-type" name="scenario-type" class="form-control" data-width='100%'>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label">
|
|
||||||
<span class="label-text">Date</span>
|
|
||||||
</label>
|
|
||||||
<div class="flex gap-2">
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
id="dateYear"
|
|
||||||
name="scenario-date-year"
|
|
||||||
class="input input-bordered w-24"
|
|
||||||
placeholder="YYYY"
|
|
||||||
max="{% now 'Y' %}"
|
|
||||||
@blur="validateYear($el)"
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
id="dateMonth"
|
|
||||||
name="scenario-date-month"
|
|
||||||
min="1"
|
|
||||||
max="12"
|
|
||||||
class="input input-bordered w-20"
|
|
||||||
placeholder="MM"
|
|
||||||
/>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
id="dateDay"
|
|
||||||
name="scenario-date-day"
|
|
||||||
min="1"
|
|
||||||
max="31"
|
|
||||||
class="input input-bordered w-20"
|
|
||||||
placeholder="DD"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="scenario-type">
|
|
||||||
<span class="label-text">Scenario Type</span>
|
|
||||||
</label>
|
|
||||||
<select
|
|
||||||
id="scenario-type"
|
|
||||||
name="scenario-type"
|
|
||||||
class="select select-bordered w-full"
|
|
||||||
x-model="scenarioType"
|
|
||||||
>
|
|
||||||
<option value="empty" selected>Empty Scenario</option>
|
<option value="empty" selected>Empty Scenario</option>
|
||||||
{% for k, v in scenario_types.items %}
|
{% for k, v in scenario_types.items %}
|
||||||
<option value="{{ v.name }}">{{ k }}</option>
|
<option value="{{ v.name }}">{{ k }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
|
||||||
|
|
||||||
{% for type in scenario_types.values %}
|
{% for type in scenario_types.values %}
|
||||||
<div
|
<div id="{{ type.name }}-specific-inputs">
|
||||||
id="{{ type.name }}-specific-inputs"
|
|
||||||
x-show="scenarioType === '{{ type.name }}'"
|
|
||||||
x-cloak
|
|
||||||
>
|
|
||||||
{% for widget in type.widgets %}
|
{% for widget in type.widgets %}
|
||||||
{{ widget|safe }}
|
{{ widget|safe }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<a id="new_scenario_modal_form_submit" class="btn btn-primary" href="#">Submit</a>
|
||||||
<div class="modal-action">
|
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||||
<button
|
</div>
|
||||||
type="button"
|
</div>
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Cancel
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit('new-scenario-modal-form')"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Submit</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Creating...</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Backdrop -->
|
<script>
|
||||||
<form method="dialog" class="modal-backdrop">
|
$(function () {
|
||||||
<button :disabled="isSubmitting">close</button>
|
// Initially hide all "specific" forms
|
||||||
</form>
|
$("div[id$='-specific-inputs']").each(function () {
|
||||||
</dialog>
|
$(this).hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
// On change hide all and show only selected
|
||||||
|
$("#scenario-type").change(function () {
|
||||||
|
$("div[id$='-specific-inputs']").each(function () {
|
||||||
|
$(this).hide();
|
||||||
|
});
|
||||||
|
val = $('option:selected', this).val();
|
||||||
|
$("#" + val + "-specific-inputs").show();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#new_scenario_modal_form_submit').on('click', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$('#new_scenario_form').submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
var dateYear = document.getElementById("dateYear");
|
||||||
|
dateYear.addEventListener("change", () => {
|
||||||
|
console.log("Final value after editing:", dateYear.value);
|
||||||
|
if (dateYear.value.length < 4) {
|
||||||
|
dateYear.value = {% now "Y" %};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|||||||
@ -1,117 +1,61 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
<!-- Add Additional Information-->
|
<!-- Add Additional Information-->
|
||||||
<dialog
|
<div id="add_additional_information_modal" class="modal" tabindex="-1">
|
||||||
id="add_additional_information_modal"
|
<div class="modal-dialog">
|
||||||
class="modal"
|
<div class="modal-content">
|
||||||
x-data="{
|
<div class="modal-header">
|
||||||
isSubmitting: false,
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
selectedType: '',
|
<span aria-hidden="true">×</span>
|
||||||
|
|
||||||
reset() {
|
|
||||||
this.isSubmitting = false;
|
|
||||||
this.selectedType = '';
|
|
||||||
},
|
|
||||||
|
|
||||||
submit() {
|
|
||||||
if (!this.selectedType) return;
|
|
||||||
|
|
||||||
const form = document.getElementById('add_' + this.selectedType + '_add-additional-information-modal-form');
|
|
||||||
if (form && form.checkValidity()) {
|
|
||||||
this.isSubmitting = true;
|
|
||||||
form.submit();
|
|
||||||
} else if (form) {
|
|
||||||
form.reportValidity();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}"
|
|
||||||
@close="reset()"
|
|
||||||
>
|
|
||||||
<div class="modal-box">
|
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="text-lg font-bold">Add Additional Information</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
<h3 class="modal-title">Add Additional Information</h3>
|
||||||
|
</div>
|
||||||
<!-- Body -->
|
<div class="modal-body">
|
||||||
<div class="py-4">
|
<select id="select-additional-information-type" data-actions-box='true' class="form-control" data-width='100%'>
|
||||||
<div class="form-control">
|
<option selected disabled>Select the type to add</option>
|
||||||
<label class="label" for="select-additional-information-type">
|
|
||||||
<span class="label-text">Select the type to add</span>
|
|
||||||
</label>
|
|
||||||
<select
|
|
||||||
id="select-additional-information-type"
|
|
||||||
class="select select-bordered w-full"
|
|
||||||
x-model="selectedType"
|
|
||||||
>
|
|
||||||
<option value="" selected disabled>Select the type to add</option>
|
|
||||||
{% for add_inf in available_additional_information %}
|
{% for add_inf in available_additional_information %}
|
||||||
<option value="{{ add_inf.name }}">
|
<option value="{{ add_inf.name }}">{{ add_inf.display_name }}</option>
|
||||||
{{ add_inf.display_name }}
|
|
||||||
</option>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
|
||||||
|
|
||||||
{% for add_inf in available_additional_information %}
|
{% for add_inf in available_additional_information %}
|
||||||
<div
|
<div class="aiform {{ add_inf.name }}" style="display: none;">
|
||||||
class="mt-4"
|
<form id="add_{{ add_inf.name }}_add-additional-information-modal-form" accept-charset="UTF-8"
|
||||||
x-show="selectedType === '{{ add_inf.name }}'"
|
action="" data-remote="true" method="post">
|
||||||
x-cloak
|
|
||||||
>
|
|
||||||
<form
|
|
||||||
id="add_{{ add_inf.name }}_add-additional-information-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action=""
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ add_inf.widget|safe }}
|
{{ add_inf.widget|safe }}
|
||||||
<input
|
<input type="hidden" name="hidden" value="add-additional-information">
|
||||||
type="hidden"
|
|
||||||
name="hidden"
|
|
||||||
value="add-additional-information"
|
|
||||||
/>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
<div class="modal-action">
|
<button type="button" class="btn btn-primary" id="add-additional-information-modal-submit">Add
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit()"
|
|
||||||
:disabled="isSubmitting || !selectedType"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Add</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Adding...</span>
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
|
||||||
<!-- Backdrop -->
|
$('#select-additional-information-type').change(function(e){
|
||||||
<form method="dialog" class="modal-backdrop">
|
var selectedType = $("#select-additional-information-type :selected").val();
|
||||||
<button :disabled="isSubmitting">close</button>
|
$('.aiform').hide();
|
||||||
</form>
|
$('.' + selectedType).show();
|
||||||
</dialog>
|
})
|
||||||
|
|
||||||
|
$('#add-additional-information-modal-submit').click(function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
var selectedType = $("#select-additional-information-type :selected").val();
|
||||||
|
console.log(selectedType);
|
||||||
|
if (selectedType !== null && selectedType !== undefined && selectedType !== '') {
|
||||||
|
$('.' + selectedType + ' >form').submit();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,181 +1,127 @@
|
|||||||
|
|
||||||
{% load static %}
|
{% load static %}
|
||||||
<dialog
|
<div class="modal fade bs-modal-lg" id="add_pathway_edge_modal" tabindex="-1" aria-labelledby="add_pathway_edge_modal"
|
||||||
id="add_pathway_edge_modal"
|
aria-modal="true"
|
||||||
class="modal"
|
role="dialog">
|
||||||
x-data="{
|
<div class="modal-dialog modal-lg">
|
||||||
isSubmitting: false,
|
<div class="modal-content">
|
||||||
reactionImageUrl: '',
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
<h4 class="modal-title">Add a Reaction</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<form id="add_pathway_edge_modal_form" accept-charset="UTF-8"
|
||||||
|
action="{% url 'package pathway edge list' meta.current_package.uuid pathway.uuid %}"
|
||||||
|
data-remote="true" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<label for="edge-name">Name</label>
|
||||||
|
<input id="edge-name" class="form-control" name="edge-name" placeholder="Name"/>
|
||||||
|
<label for="edge-description">Description</label>
|
||||||
|
<input id="edge-description" class="form-control" name="edge-description" placeholder="Description"/>
|
||||||
|
<p></p>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-5">
|
||||||
|
<legend>Substrate(s)</legend>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
|
||||||
reset() {
|
</div>
|
||||||
this.isSubmitting = false;
|
<div class="col-xs-5">
|
||||||
this.reactionImageUrl = '';
|
<legend>Product(s)</legend>
|
||||||
},
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-5">
|
||||||
|
<select id="add_pathway_edge_substrates" name="edge-substrates"
|
||||||
|
data-actions-box='true' class="form-control" multiple data-width='100%'>
|
||||||
|
{% for n in pathway.nodes %}
|
||||||
|
<option data-smiles="{{ n.default_node_label.smiles }}" value="{{ n.url }}">{{ n.default_node_label.name|safe }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-2" style="display: flex; justify-content: center; align-items: center;">
|
||||||
|
<i class="glyphicon glyphicon-arrow-right"></i>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-5">
|
||||||
|
<select id="add_pathway_edge_products" name="edge-products"
|
||||||
|
data-actions-box='true' class="form-control" multiple data-width='100%'>
|
||||||
|
{% for n in pathway.nodes %}
|
||||||
|
<option data-smiles="{{ n.default_node_label.smiles }}" value="{{ n.url }}">{{ n.default_node_label.name|safe }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<p></p>
|
||||||
|
<div class="col-xs-12" id="reaction_image">
|
||||||
|
|
||||||
updateReactionImage() {
|
</div>
|
||||||
const substratesSelect = document.getElementById('add_pathway_edge_substrates');
|
</div>
|
||||||
const productsSelect = document.getElementById('add_pathway_edge_products');
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary pull-left" data-dismiss="modal">Close
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="add_pathway_edge_modal_form_submit">Submit</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
const substrates = [];
|
</div>
|
||||||
for (const option of substratesSelect.selectedOptions) {
|
<script>
|
||||||
substrates.push(option.dataset.smiles);
|
|
||||||
}
|
|
||||||
|
|
||||||
const products = [];
|
function reactionImage() {
|
||||||
for (const option of productsSelect.selectedOptions) {
|
var substrates = [];
|
||||||
products.push(option.dataset.smiles);
|
$('#add_pathway_edge_substrates option:selected').each(function () {
|
||||||
}
|
var smiles = $(this).data('smiles'); // read data-smiles attribute
|
||||||
|
substrates.push(smiles);
|
||||||
|
});
|
||||||
|
|
||||||
|
var products = []
|
||||||
|
$('#add_pathway_edge_products option:selected').each(function () {
|
||||||
|
var smiles = $(this).data('smiles'); // read data-smiles attribute
|
||||||
|
products.push(smiles);
|
||||||
|
});
|
||||||
|
|
||||||
if (substrates.length > 0 && products.length > 0) {
|
if (substrates.length > 0 && products.length > 0) {
|
||||||
const reaction = substrates.join('.') + '>>' + products.join('.');
|
reaction = substrates.join('.') + ">>" + products.join('.');
|
||||||
this.reactionImageUrl = '{% url "depict" %}?smirks=' + encodeURIComponent(reaction);
|
$('#reaction_image').empty();
|
||||||
} else {
|
$('#reaction_image').append(
|
||||||
this.reactionImageUrl = '';
|
"<img width='100%' src='{% url 'depict' %}?smirks=" + encodeURIComponent(reaction) +"'>"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
submit() {
|
|
||||||
this.isSubmitting = true;
|
|
||||||
document.getElementById('add_pathway_edge_modal_form').submit();
|
|
||||||
}
|
}
|
||||||
}"
|
|
||||||
@close="reset()"
|
|
||||||
>
|
|
||||||
<div class="modal-box max-w-4xl">
|
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="text-lg font-bold">Add a Reaction</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
$(function () {
|
||||||
<form method="dialog">
|
$("#add_pathway_edge_substrates").selectpicker();
|
||||||
<button
|
$("#add_pathway_edge_products").selectpicker();
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<!-- Body -->
|
$("#add_pathway_edge_substrates").on('change', function (e) {
|
||||||
<div class="py-4">
|
reactionImage();
|
||||||
<form
|
})
|
||||||
id="add_pathway_edge_modal_form"
|
|
||||||
accept-charset="UTF-8"
|
$("#add_pathway_edge_products").on('change', function (e) {
|
||||||
action="{% url 'package pathway edge list' meta.current_package.uuid pathway.uuid %}"
|
reactionImage();
|
||||||
data-remote="true"
|
})
|
||||||
method="post"
|
|
||||||
>
|
$(function () {
|
||||||
{% csrf_token %}
|
$('#add_pathway_edge_modal_form_submit').on('click', function (e) {
|
||||||
<div class="form-control mb-3">
|
e.preventDefault();
|
||||||
<label class="label" for="edge-name">
|
$(this).prop("disabled", true);
|
||||||
<span class="label-text">Name</span>
|
|
||||||
</label>
|
|
||||||
<input
|
// submit form
|
||||||
id="edge-name"
|
$('#add_pathway_edge_modal_form').submit();
|
||||||
type="text"
|
});
|
||||||
class="input input-bordered w-full"
|
});
|
||||||
name="edge-name"
|
|
||||||
placeholder="Name"
|
});
|
||||||
/>
|
|
||||||
</div>
|
</script>
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="edge-description">
|
|
||||||
<span class="label-text">Description</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="edge-description"
|
|
||||||
type="text"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="edge-description"
|
|
||||||
placeholder="Description"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3 grid grid-cols-11 gap-2">
|
|
||||||
<div class="col-span-5">
|
|
||||||
<div class="form-control">
|
|
||||||
<label class="label">
|
|
||||||
<span class="label-text font-semibold">Substrate(s)</span>
|
|
||||||
</label>
|
|
||||||
<select
|
|
||||||
id="add_pathway_edge_substrates"
|
|
||||||
name="edge-substrates"
|
|
||||||
class="select select-bordered h-32 w-full"
|
|
||||||
multiple
|
|
||||||
@change="updateReactionImage()"
|
|
||||||
>
|
|
||||||
{% for n in pathway.nodes %}
|
|
||||||
<option
|
|
||||||
data-smiles="{{ n.default_node_label.smiles }}"
|
|
||||||
value="{{ n.url }}"
|
|
||||||
>
|
|
||||||
{{ n.default_node_label.name|safe }}
|
|
||||||
</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-span-1 flex items-center justify-center">
|
|
||||||
<span class="text-2xl">→</span>
|
|
||||||
</div>
|
|
||||||
<div class="col-span-5">
|
|
||||||
<div class="form-control">
|
|
||||||
<label class="label">
|
|
||||||
<span class="label-text font-semibold">Product(s)</span>
|
|
||||||
</label>
|
|
||||||
<select
|
|
||||||
id="add_pathway_edge_products"
|
|
||||||
name="edge-products"
|
|
||||||
class="select select-bordered h-32 w-full"
|
|
||||||
multiple
|
|
||||||
@change="updateReactionImage()"
|
|
||||||
>
|
|
||||||
{% for n in pathway.nodes %}
|
|
||||||
<option
|
|
||||||
data-smiles="{{ n.default_node_label.smiles }}"
|
|
||||||
value="{{ n.url }}"
|
|
||||||
>
|
|
||||||
{{ n.default_node_label.name|safe }}
|
|
||||||
</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3" x-show="reactionImageUrl" x-cloak>
|
|
||||||
<img :src="reactionImageUrl" class="w-full" alt="Reaction preview" />
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Footer -->
|
|
||||||
<div class="modal-action">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Submit</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Submitting...</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Backdrop -->
|
|
||||||
<form method="dialog" class="modal-backdrop">
|
|
||||||
<button :disabled="isSubmitting">close</button>
|
|
||||||
</form>
|
|
||||||
</dialog>
|
|
||||||
|
|||||||
@ -1,137 +1,78 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
<dialog
|
<div class="modal fade bs-modal-lg" id="add_pathway_node_modal" tabindex="-1" aria-labelledby="add_pathway_node_modal" aria-modal="true"
|
||||||
id="add_pathway_node_modal"
|
role="dialog">
|
||||||
class="modal"
|
<div class="modal-dialog modal-lg">
|
||||||
x-data="modalForm()"
|
<div class="modal-content">
|
||||||
@close="reset()"
|
<div class="modal-header">
|
||||||
>
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
<div class="modal-box max-w-4xl">
|
<span aria-hidden="true">×</span>
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="text-lg font-bold">Add a Node</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
<h4 class="modal-title">Add a Node</h4>
|
||||||
|
</div>
|
||||||
<!-- Body -->
|
<div class="modal-body">
|
||||||
<div class="py-4">
|
<form id="add_pathway_node_modal_form" accept-charset="UTF-8" action="{% url 'package pathway node list' meta.current_package.uuid pathway.uuid %}" data-remote="true" method="post">
|
||||||
<form
|
|
||||||
id="add_pathway_node_modal_form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action="{% url 'package pathway node list' meta.current_package.uuid pathway.uuid %}"
|
|
||||||
data-remote="true"
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="form-control mb-3">
|
<label for="node-name">Name</label>
|
||||||
<label class="label" for="node-name">
|
<input id="node-name" class="form-control" name="node-name" placeholder="Name"/>
|
||||||
<span class="label-text">Name</span>
|
<label for="node-description">Description</label>
|
||||||
</label>
|
<input id="node-description" class="form-control" name="node-description" placeholder="Description"/>
|
||||||
<input
|
<label for="node-smiles">SMILES</label>
|
||||||
id="node-name"
|
<input type="text" class="form-control" name="node-smiles" placeholder="SMILES" id="node-smiles">
|
||||||
type="text"
|
<p></p>
|
||||||
class="input input-bordered w-full"
|
<div>
|
||||||
name="node-name"
|
<iframe id="add_node_ketcher" src="{% static '/js/ketcher2/ketcher.html' %}" width="100%"
|
||||||
placeholder="Name"
|
height="510"></iframe>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="node-description">
|
|
||||||
<span class="label-text">Description</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="node-description"
|
|
||||||
type="text"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="node-description"
|
|
||||||
placeholder="Description"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="node-smiles">
|
|
||||||
<span class="label-text">SMILES</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="node-smiles"
|
|
||||||
placeholder="SMILES"
|
|
||||||
id="node-smiles"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
<iframe
|
|
||||||
id="add_node_ketcher"
|
|
||||||
src="{% static '/js/ketcher2/ketcher.html' %}"
|
|
||||||
width="100%"
|
|
||||||
height="510"
|
|
||||||
></iframe>
|
|
||||||
</div>
|
</div>
|
||||||
|
<p></p>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<button type="button" class="btn btn-secondary pull-left" data-dismiss="modal">Close
|
||||||
<div class="modal-action">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit('add_pathway_node_modal_form')"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Submit</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Submitting...</span>
|
|
||||||
</button>
|
</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="add_pathway_node_modal_form_submit">Submit</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Backdrop -->
|
</div>
|
||||||
<form method="dialog" class="modal-backdrop">
|
|
||||||
<button :disabled="isSubmitting">close</button>
|
|
||||||
</form>
|
|
||||||
</dialog>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document
|
|
||||||
.getElementById("add_node_ketcher")
|
function newStructureModalketcherToNewStructureModalTextInput() {
|
||||||
.addEventListener("load", function () {
|
$('#node-smiles').val(this.ketcher.getSmiles());
|
||||||
const iframe = this;
|
}
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
|
||||||
|
$('#add_node_ketcher').on('load', function() {
|
||||||
const checkKetcherReady = () => {
|
const checkKetcherReady = () => {
|
||||||
const win = iframe.contentWindow;
|
win = this.contentWindow
|
||||||
if (win.ketcher && "editor" in win.ketcher) {
|
if (win.ketcher && 'editor' in win.ketcher) {
|
||||||
win.ketcher.editor.event.change.handlers.push({
|
win.ketcher.editor.event.change.handlers.push({
|
||||||
once: false,
|
once: false,
|
||||||
priority: 0,
|
priority: 0,
|
||||||
f: function () {
|
f: newStructureModalketcherToNewStructureModalTextInput,
|
||||||
document.getElementById("node-smiles").value =
|
ketcher: win.ketcher
|
||||||
this.ketcher.getSmiles();
|
|
||||||
},
|
|
||||||
ketcher: win.ketcher,
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setTimeout(checkKetcherReady, 100);
|
setTimeout(checkKetcherReady, 100);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
checkKetcherReady();
|
checkKetcherReady();
|
||||||
|
})
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
$('#add_pathway_node_modal_form_submit').on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$(this).prop("disabled",true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// submit form
|
||||||
|
$('#add_pathway_node_modal_form').submit();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -1,137 +1,78 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
<dialog
|
<div class="modal fade bs-modal-lg" id="add_structure_modal" tabindex="-1" aria-labelledby="add_structure_modal" aria-modal="true"
|
||||||
id="add_structure_modal"
|
role="dialog">
|
||||||
class="modal"
|
<div class="modal-dialog modal-lg">
|
||||||
x-data="modalForm()"
|
<div class="modal-content">
|
||||||
@close="reset()"
|
<div class="modal-header">
|
||||||
>
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
<div class="modal-box max-w-4xl">
|
<span aria-hidden="true">×</span>
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="text-lg font-bold">Create a new Structure</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
<h4 class="modal-title">Create a new Structure</h4>
|
||||||
|
</div>
|
||||||
<!-- Body -->
|
<div class="modal-body">
|
||||||
<div class="py-4">
|
<form id="add_structure_modal_form" accept-charset="UTF-8" action="{% url 'package compound structure list' meta.current_package.uuid compound.uuid %}" data-remote="true" method="post">
|
||||||
<form
|
|
||||||
id="add_structure_modal_form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action="{% url 'package compound structure list' meta.current_package.uuid compound.uuid %}"
|
|
||||||
data-remote="true"
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="form-control mb-3">
|
<label for="structure-name">Name</label>
|
||||||
<label class="label" for="structure-name">
|
<input id="structure-name" class="form-control" name="structure-name" placeholder="Name"/>
|
||||||
<span class="label-text">Name</span>
|
<label for="structure-description">Description</label>
|
||||||
</label>
|
<input id="structure-description" class="form-control" name="structure-description" placeholder="Description"/>
|
||||||
<input
|
<label for="structure-smiles">SMILES</label>
|
||||||
id="structure-name"
|
<input type="text" class="form-control" name="structure-smiles" placeholder="SMILES" id="structure-smiles">
|
||||||
type="text"
|
<p></p>
|
||||||
class="input input-bordered w-full"
|
<div>
|
||||||
name="structure-name"
|
<iframe id="add_structure_ketcher" src="{% static '/js/ketcher2/ketcher.html' %}" width="100%"
|
||||||
placeholder="Name"
|
height="510"></iframe>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="structure-description">
|
|
||||||
<span class="label-text">Description</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="structure-description"
|
|
||||||
type="text"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="structure-description"
|
|
||||||
placeholder="Description"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="structure-smiles">
|
|
||||||
<span class="label-text">SMILES</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
type="text"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="structure-smiles"
|
|
||||||
placeholder="SMILES"
|
|
||||||
id="structure-smiles"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mb-3">
|
|
||||||
<iframe
|
|
||||||
id="add_structure_ketcher"
|
|
||||||
src="{% static '/js/ketcher2/ketcher.html' %}"
|
|
||||||
width="100%"
|
|
||||||
height="510"
|
|
||||||
></iframe>
|
|
||||||
</div>
|
</div>
|
||||||
|
<p></p>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<button type="button" class="btn btn-secondary pull-left" data-dismiss="modal">Close
|
||||||
<div class="modal-action">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit('add_structure_modal_form')"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Submit</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Submitting...</span>
|
|
||||||
</button>
|
</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="add_structure_modal_form_submit">Submit</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Backdrop -->
|
</div>
|
||||||
<form method="dialog" class="modal-backdrop">
|
|
||||||
<button :disabled="isSubmitting">close</button>
|
|
||||||
</form>
|
|
||||||
</dialog>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document
|
|
||||||
.getElementById("add_structure_ketcher")
|
function newStructureModalketcherToNewStructureModalTextInput() {
|
||||||
.addEventListener("load", function () {
|
$('#structure-smiles').val(this.ketcher.getSmiles());
|
||||||
const iframe = this;
|
}
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
|
||||||
|
$('#add_structure_ketcher').on('load', function() {
|
||||||
const checkKetcherReady = () => {
|
const checkKetcherReady = () => {
|
||||||
const win = iframe.contentWindow;
|
win = this.contentWindow
|
||||||
if (win.ketcher && "editor" in win.ketcher) {
|
if (win.ketcher && 'editor' in win.ketcher) {
|
||||||
win.ketcher.editor.event.change.handlers.push({
|
win.ketcher.editor.event.change.handlers.push({
|
||||||
once: false,
|
once: false,
|
||||||
priority: 0,
|
priority: 0,
|
||||||
f: function () {
|
f: newStructureModalketcherToNewStructureModalTextInput,
|
||||||
document.getElementById("structure-smiles").value =
|
ketcher: win.ketcher
|
||||||
this.ketcher.getSmiles();
|
|
||||||
},
|
|
||||||
ketcher: win.ketcher,
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setTimeout(checkKetcherReady, 100);
|
setTimeout(checkKetcherReady, 100);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
checkKetcherReady();
|
checkKetcherReady();
|
||||||
|
})
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
$('#add_structure_modal_form_submit').on('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
$(this).prop("disabled",true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// submit form
|
||||||
|
$('#add_structure_modal_form').submit();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -1,94 +1,66 @@
|
|||||||
|
|
||||||
{% load static %}
|
{% load static %}
|
||||||
<!-- Delete Edge -->
|
<!-- Delete Edge -->
|
||||||
<dialog
|
<div id="delete_pathway_edge_modal" class="modal" tabindex="-1">
|
||||||
id="delete_pathway_edge_modal"
|
<div class="modal-dialog">
|
||||||
class="modal"
|
<div class="modal-content">
|
||||||
x-data="modalForm({ state: { selectedEdge: '', imageUrl: '' } })"
|
<div class="modal-header">
|
||||||
@close="reset()"
|
<h3 class="modal-title">Delete Edge</h3>
|
||||||
>
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
<div class="modal-box">
|
<span aria-hidden="true">×</span>
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="text-lg font-bold">Delete Edge</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
<!-- Body -->
|
|
||||||
<div class="py-4">
|
|
||||||
<p class="mb-4">
|
|
||||||
Deletes the Edge. Nodes referenced by this edge will remain.
|
Deletes the Edge. Nodes referenced by this edge will remain.
|
||||||
</p>
|
<p></p>
|
||||||
<form
|
<form id="delete-pathway-edge-modal-form" accept-charset="UTF-8" action="" data-remote="true"
|
||||||
id="delete-pathway-edge-modal-form"
|
method="post">
|
||||||
accept-charset="UTF-8"
|
|
||||||
action=""
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="form-control">
|
<select id="delete_pathway_edge_edges" name="edge-url"
|
||||||
<label class="label" for="delete_pathway_edge_edges">
|
data-actions-box='true' class="form-control" data-width='100%'>
|
||||||
<span class="label-text">Select Reaction to delete</span>
|
<option value="" disabled selected>Select Reaction to delete</option>
|
||||||
</label>
|
|
||||||
<select
|
|
||||||
id="delete_pathway_edge_edges"
|
|
||||||
name="edge-url"
|
|
||||||
class="select select-bordered w-full"
|
|
||||||
x-model="selectedEdge"
|
|
||||||
@change="imageUrl = selectedEdge ? selectedEdge + '?image=svg' : ''"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
<option value="" disabled selected>
|
|
||||||
Select Reaction to delete
|
|
||||||
</option>
|
|
||||||
{% for e in pathway.edges %}
|
{% for e in pathway.edges %}
|
||||||
<option value="{{ e.url }}">{{ e.edge_label.name|safe }}</option>
|
<option value="{{ e.url }}">{{ e.edge_label.name|safe }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
|
||||||
<input type="hidden" id="hidden" name="hidden" value="delete"/>
|
<input type="hidden" id="hidden" name="hidden" value="delete"/>
|
||||||
</form>
|
</form>
|
||||||
|
<p></p>
|
||||||
|
<div id="delete_pathway_edge_image"></div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="delete-pathway-edge-modal-submit">Delete</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(function () {
|
||||||
|
$("#delete_pathway_edge_edges").selectpicker();
|
||||||
|
|
||||||
<!-- Image Preview -->
|
$("#delete_pathway_edge_edges").on('change', function (e) {
|
||||||
<div class="mt-4" x-show="imageUrl" x-cloak>
|
edge_url = $('#delete_pathway_edge_edges option:selected').val()
|
||||||
<img :src="imageUrl" class="w-full" alt="Edge preview" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Footer -->
|
if (edge_url !== "") {
|
||||||
<div class="modal-action">
|
$('#delete_pathway_edge_image').empty();
|
||||||
<button
|
$('#delete_pathway_edge_image').append(
|
||||||
type="button"
|
"<img width='100%' src='" + edge_url + "?image=svg'>"
|
||||||
class="btn"
|
);
|
||||||
onclick="this.closest('dialog').close()"
|
}
|
||||||
:disabled="isSubmitting"
|
})
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-error"
|
|
||||||
@click="setFormAction('delete-pathway-edge-modal-form', selectedEdge); submit('delete-pathway-edge-modal-form')"
|
|
||||||
:disabled="isSubmitting || !selectedEdge"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Delete</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Deleting...</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Backdrop -->
|
$('#delete-pathway-edge-modal-submit').click(function (e) {
|
||||||
<form method="dialog" class="modal-backdrop">
|
e.preventDefault();
|
||||||
<button :disabled="isSubmitting">close</button>
|
edge_url = $('#delete_pathway_edge_edges option:selected').val()
|
||||||
</form>
|
|
||||||
</dialog>
|
if (edge_url === "") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#delete-pathway-edge-modal-form').attr('action', edge_url)
|
||||||
|
$('#delete-pathway-edge-modal-form').submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,97 +1,66 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
<!-- Delete Node -->
|
<!-- Delete Node -->
|
||||||
<dialog
|
<div id="delete_pathway_node_modal" class="modal" tabindex="-1">
|
||||||
id="delete_pathway_node_modal"
|
<div class="modal-dialog">
|
||||||
class="modal"
|
<div class="modal-content">
|
||||||
x-data="modalForm({ state: { selectedNode: '', imageUrl: '' } })"
|
<div class="modal-header">
|
||||||
@close="reset()"
|
<h3 class="modal-title">Delete Node</h3>
|
||||||
>
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
<div class="modal-box">
|
<span aria-hidden="true">×</span>
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="text-lg font-bold">Delete Node</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
<!-- Body -->
|
Deletes the Node. Edges having this Node as Substrate or Product will be removed as well.
|
||||||
<div class="py-4">
|
<p></p>
|
||||||
<p class="mb-4">
|
<form id="delete-pathway-node-modal-form" accept-charset="UTF-8" action="" data-remote="true"
|
||||||
Deletes the Node. Edges having this Node as Substrate or Product will be
|
method="post">
|
||||||
removed as well.
|
|
||||||
</p>
|
|
||||||
<form
|
|
||||||
id="delete-pathway-node-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action=""
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="form-control">
|
<select id="delete_pathway_node_nodes" name="node-url"
|
||||||
<label class="label" for="delete_pathway_node_nodes">
|
data-actions-box='true' class="form-control" data-width='100%'>
|
||||||
<span class="label-text">Select Compound to delete</span>
|
<option value="" disabled selected>Select Compound to delete</option>
|
||||||
</label>
|
|
||||||
<select
|
|
||||||
id="delete_pathway_node_nodes"
|
|
||||||
name="node-url"
|
|
||||||
class="select select-bordered w-full"
|
|
||||||
x-model="selectedNode"
|
|
||||||
@change="imageUrl = selectedNode ? selectedNode + '?image=svg' : ''"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
<option value="" disabled selected>
|
|
||||||
Select Compound to delete
|
|
||||||
</option>
|
|
||||||
{% for n in pathway.nodes %}
|
{% for n in pathway.nodes %}
|
||||||
<option value="{{ n.url }}">
|
<option value="{{ n.url }}">{{ n.default_node_label.name|safe }}</option>
|
||||||
{{ n.default_node_label.name|safe }}
|
|
||||||
</option>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
|
||||||
<input type="hidden" id="hidden" name="hidden" value="delete"/>
|
<input type="hidden" id="hidden" name="hidden" value="delete"/>
|
||||||
</form>
|
</form>
|
||||||
|
<p></p>
|
||||||
|
<div id="delete_pathway_node_image"></div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="delete-pathway-node-modal-submit">Delete</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(function () {
|
||||||
|
$("#delete_pathway_node_nodes").selectpicker();
|
||||||
|
|
||||||
<!-- Image Preview -->
|
$("#delete_pathway_node_nodes").on('change', function (e) {
|
||||||
<div class="mt-4" x-show="imageUrl" x-cloak>
|
node_url = $('#delete_pathway_node_nodes option:selected').val()
|
||||||
<img :src="imageUrl" class="w-full" alt="Node preview" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Footer -->
|
if (node_url !== "") {
|
||||||
<div class="modal-action">
|
$('#delete_pathway_node_image').empty();
|
||||||
<button
|
$('#delete_pathway_node_image').append(
|
||||||
type="button"
|
"<img width='100%' src='" + node_url + "?image=svg'>"
|
||||||
class="btn"
|
);
|
||||||
onclick="this.closest('dialog').close()"
|
}
|
||||||
:disabled="isSubmitting"
|
})
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-error"
|
|
||||||
@click="setFormAction('delete-pathway-node-modal-form', selectedNode); submit('delete-pathway-node-modal-form')"
|
|
||||||
:disabled="isSubmitting || !selectedNode"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Delete</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Deleting...</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Backdrop -->
|
$('#delete-pathway-node-modal-submit').click(function (e) {
|
||||||
<form method="dialog" class="modal-backdrop">
|
e.preventDefault();
|
||||||
<button :disabled="isSubmitting">close</button>
|
node_url = $('#delete_pathway_node_nodes option:selected').val()
|
||||||
</form>
|
|
||||||
</dialog>
|
if (node_url === "") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#delete-pathway-node-modal-form').attr('action', node_url)
|
||||||
|
$('#delete-pathway-node-modal-form').submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,69 +1,36 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
|
<!-- Download Pathway -->
|
||||||
<dialog
|
<div id="download_pathway_csv_modal" class="modal" tabindex="-1">
|
||||||
id="download_pathway_csv_modal"
|
<div class="modal-dialog">
|
||||||
class="modal"
|
<div class="modal-content">
|
||||||
x-data="modalForm()"
|
<div class="modal-header">
|
||||||
@close="reset()"
|
<h3 class="modal-title">Download Pathway as CSV</h3>
|
||||||
>
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
<div class="modal-box">
|
<span aria-hidden="true">×</span>
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="font-bold text-lg">Download Pathway as CSV</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
<!-- Body -->
|
By clicking on Download the Pathway will be converted into a CSV and directly downloaded.
|
||||||
<div class="py-4">
|
<form id="download-pathway-csv-modal-form" accept-charset="UTF-8" action="{{ pathway.url }}"
|
||||||
<p>
|
data-remote="true" method="GET">
|
||||||
By clicking on Download the Pathway will be converted into a CSV and
|
|
||||||
directly downloaded.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<form
|
|
||||||
id="download-pathway-csv-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action="{{ pathway.url }}"
|
|
||||||
method="GET"
|
|
||||||
>
|
|
||||||
<input type="hidden" name="download" value="true"/>
|
<input type="hidden" name="download" value="true"/>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
<div class="modal-action">
|
<button type="button" class="btn btn-primary" id="download-pathway-csv-modal-submit">Download</button>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit('download-pathway-csv-modal-form'); $el.closest('dialog').close();"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Download</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(function () {
|
||||||
|
|
||||||
<!-- Backdrop -->
|
$('#download-pathway-csv-modal-submit').click(function (e) {
|
||||||
<form method="dialog" class="modal-backdrop">
|
e.preventDefault();
|
||||||
<button :disabled="isSubmitting">close</button>
|
$('#download-pathway-csv-modal-form').submit();
|
||||||
</form>
|
$('#download_pathway_csv_modal').modal('hide');
|
||||||
</dialog>
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,57 +1,32 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
|
<!-- Download Pathway -->
|
||||||
<dialog
|
<div id="download_pathway_image_modal" class="modal" tabindex="-1">
|
||||||
id="download_pathway_image_modal"
|
<div class="modal-dialog">
|
||||||
class="modal"
|
<div class="modal-content">
|
||||||
x-data="modalForm()"
|
<div class="modal-header">
|
||||||
@close="reset()"
|
<h3 class="modal-title">Download Pathway as Image</h3>
|
||||||
>
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
<div class="modal-box">
|
<span aria-hidden="true">×</span>
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="font-bold text-lg">Download Pathway as Image</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<!-- Body -->
|
|
||||||
<div class="py-4">
|
|
||||||
<p>By clicking on Download the Pathway will be saved as SVG.</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Footer -->
|
|
||||||
<div class="modal-action">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="isSubmitting = true; downloadSVG(document.getElementById('pwsvg'), '{{ pathway.name.split|join:'_' }}.svg'); $el.closest('dialog').close();"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Download</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
By clicking on Download the Pathway will be saved as SVG.
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="download-pathway-image-modal-submit">Download</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(function () {
|
||||||
|
|
||||||
<!-- Backdrop -->
|
$('#download-pathway-image-modal-submit').click(function (e) {
|
||||||
<form method="dialog" class="modal-backdrop">
|
e.preventDefault();
|
||||||
<button :disabled="isSubmitting">close</button>
|
downloadSVG($('#pwsvg')[0], '{{ pathway.name.split|join:"_" }}.svg')
|
||||||
</form>
|
$('#download_pathway_image_modal').modal('hide');
|
||||||
</dialog>
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,91 +1,47 @@
|
|||||||
|
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
<!-- Edit Compound -->
|
||||||
<dialog
|
<div id="edit_compound_modal" class="modal" tabindex="-1">
|
||||||
id="edit_compound_modal"
|
<div class="modal-dialog">
|
||||||
class="modal"
|
<div class="modal-content">
|
||||||
x-data="modalForm()"
|
<div class="modal-header">
|
||||||
@close="reset()"
|
<h5 class="modal-title">Edit Compound</h5>
|
||||||
>
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
<div class="modal-box">
|
<span aria-hidden="true">×</span>
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="font-bold text-lg">Edit Compound</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
<!-- Body -->
|
<p>Edit Compound.</p>
|
||||||
<div class="py-4">
|
<form id="edit-compound-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||||
<form
|
|
||||||
id="edit-compound-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action=""
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
<p>
|
||||||
<div class="form-control mb-3">
|
<label for="compound-name">Name</label>
|
||||||
<label class="label" for="compound-name">
|
<input id="compound-name" class="form-control" name="compound-name" value="{{ compound.name|safe}}">
|
||||||
<span class="label-text">Name</span>
|
</p>
|
||||||
</label>
|
<p>
|
||||||
<input
|
<label for="compound-description">Description</label>
|
||||||
id="compound-name"
|
<input id="compound-description" type="text" class="form-control"
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="compound-name"
|
|
||||||
value="{{ compound.name|safe }}"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="compound-description">
|
|
||||||
<span class="label-text">Description</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="compound-description"
|
|
||||||
type="text"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
value="{{ compound.description|safe }}"
|
value="{{ compound.description|safe }}"
|
||||||
name="compound-description"
|
name="compound-description">
|
||||||
/>
|
</p>
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
<div class="modal-action">
|
<button type="button" class="btn btn-primary" id="edit-compound-modal-submit">Update</button>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit('edit-compound-modal-form')"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Update</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Updating...</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
|
||||||
<!-- Backdrop -->
|
$('#edit-compound-modal-submit').click(function(e){
|
||||||
<form method="dialog" class="modal-backdrop">
|
e.preventDefault();
|
||||||
<button :disabled="isSubmitting">close</button>
|
$('#edit-compound-modal-form').submit();
|
||||||
</form>
|
});
|
||||||
</dialog>
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
@ -1,91 +1,46 @@
|
|||||||
|
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
<!-- Edit Compound -->
|
||||||
<dialog
|
<div id="edit_compound_structure_modal" class="modal" tabindex="-1">
|
||||||
id="edit_compound_structure_modal"
|
<div class="modal-dialog">
|
||||||
class="modal"
|
<div class="modal-content">
|
||||||
x-data="modalForm()"
|
<div class="modal-header">
|
||||||
@close="reset()"
|
<h5 class="modal-title">Create a Compound</h5>
|
||||||
>
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
<div class="modal-box">
|
<span aria-hidden="true">×</span>
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="font-bold text-lg">Edit Compound Structure</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
<!-- Body -->
|
<p>Edit a Compound Structure.</p>
|
||||||
<div class="py-4">
|
<form id="edit-compound-structure-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||||
<form
|
|
||||||
id="edit-compound-structure-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action=""
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
<p>
|
||||||
<div class="form-control mb-3">
|
<label for="compound-structure-name">Name</label>
|
||||||
<label class="label" for="compound-structure-name">
|
<input id="compound-structure-name" class="form-control" name="compound-structure-name" value="{{ compound_structure.name|safe }}">
|
||||||
<span class="label-text">Name</span>
|
</p>
|
||||||
</label>
|
<p>
|
||||||
<input
|
<label for="compound-structure-description">Description</label>
|
||||||
id="compound-structure-name"
|
<input id="compound-structure-description" type="text" class="form-control"
|
||||||
class="input input-bordered w-full"
|
value="{{ compound_structure.description|safe }}" name="compound-structure-description">
|
||||||
name="compound-structure-name"
|
</p>
|
||||||
value="{{ compound_structure.name|safe }}"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="compound-structure-description">
|
|
||||||
<span class="label-text">Description</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="compound-structure-description"
|
|
||||||
type="text"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
value="{{ compound_structure.description|safe }}"
|
|
||||||
name="compound-structure-description"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
<div class="modal-action">
|
<button type="button" class="btn btn-primary" id="edit-compound-structure-modal-submit">Create</button>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit('edit-compound-structure-modal-form')"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Update</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Updating...</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
|
||||||
<!-- Backdrop -->
|
$('#edit-compound-structure-modal-submit').click(function(e){
|
||||||
<form method="dialog" class="modal-backdrop">
|
e.preventDefault();
|
||||||
<button :disabled="isSubmitting">close</button>
|
$('#edit-compound-structure-modal-form').submit();
|
||||||
</form>
|
});
|
||||||
</dialog>
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,150 +1,121 @@
|
|||||||
|
|
||||||
{% load static %}
|
{% load static %}
|
||||||
<!-- Edit Group Member -->
|
<!-- Edit Package Permission -->
|
||||||
<dialog
|
<div id="edit_group_member_modal" class="modal" tabindex="-1">
|
||||||
id="edit_group_member_modal"
|
<div class="modal-dialog">
|
||||||
class="modal"
|
<div class="modal-content">
|
||||||
x-data="{
|
<div class="modal-header">
|
||||||
isSubmitting: false,
|
<h5 class="modal-title">Add or Remove Group Member</h5>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
reset() {
|
<span aria-hidden="true">×</span>
|
||||||
this.isSubmitting = false;
|
|
||||||
},
|
|
||||||
|
|
||||||
submitForm(form) {
|
|
||||||
if (form && form.checkValidity()) {
|
|
||||||
form.submit();
|
|
||||||
} else if (form) {
|
|
||||||
form.reportValidity();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}"
|
|
||||||
@close="reset()"
|
|
||||||
>
|
|
||||||
<div class="modal-box">
|
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="text-lg font-bold">Add or Remove Group Member</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
<!-- Body -->
|
<p>
|
||||||
<div class="py-4">
|
To add member (either User or entire Groups) to this group select the entity you want to add below
|
||||||
<p class="mb-4">
|
and click the check mark.
|
||||||
To add member (either User or entire Groups) to this group select the
|
<br>
|
||||||
entity you want to add below and click the check mark.
|
To remove member simply click the <code>X</code> next to the member.
|
||||||
<br />
|
|
||||||
To remove member simply click the X button next to the member.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<!-- Add Member Form -->
|
<div class="row">
|
||||||
<form
|
<div class="col-xs-8">
|
||||||
id="modal-form-group-member"
|
<legend>User or Group</legend>
|
||||||
accept-charset="UTF-8"
|
</div>
|
||||||
action=""
|
<div class="col-xs-4">
|
||||||
method="post"
|
<legend>Add/Remove</legend>
|
||||||
class="mb-4"
|
</div>
|
||||||
>
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<form id="modal-form-group-member" class="form-inline" role="form" accept-charset="UTF-8" action=""
|
||||||
|
data-remote="true" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="flex gap-2 items-end">
|
<div class="col-xs-8">
|
||||||
<div class="form-control flex-1">
|
<select id="select_member" name="member" data-actions-box='true'
|
||||||
<label class="label">
|
class="selPackages" data-width='100%'>
|
||||||
<span class="label-text">User or Group</span>
|
<option disabled selected>User</option>
|
||||||
</label>
|
|
||||||
<select
|
|
||||||
id="select_member"
|
|
||||||
name="member"
|
|
||||||
class="select select-bordered w-full"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
<optgroup label="Users">
|
|
||||||
{% for u in users %}
|
{% for u in users %}
|
||||||
<option value="{{ u.url }}">{{ u.username }}</option>
|
<option value="{{ u.url }}">{{ u.username }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</optgroup>
|
<option disabled>Groups</option>
|
||||||
<optgroup label="Groups">
|
|
||||||
{% for g in groups %}
|
{% for g in groups %}
|
||||||
<option value="{{ g.url }}">{{ g.name|safe }}</option>
|
<option value="{{ g.url }}">{{ g.name|safe }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</optgroup>
|
|
||||||
</select>
|
</select>
|
||||||
<input type="hidden" name="action" value="add" />
|
<input type="hidden" name="action" value="add">
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary">Add</button>
|
<div class="col-xs-2">
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<button type="submit" style="width:60%;" class="btn col-xs-2">
|
||||||
|
<span class="glyphicon glyphicon-ok"></span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
<!-- User Members -->
|
<p></p>
|
||||||
{% if group.user_member.all %}
|
|
||||||
<div class="divider">User Members</div>
|
|
||||||
<div class="space-y-2">
|
|
||||||
{% for u in group.user_member.all %}
|
{% for u in group.user_member.all %}
|
||||||
<form
|
<div class="row">
|
||||||
id="modal-form-group-member_{{ u.uuid }}"
|
<form id="modal-form-group-member_{{ u.uuid }}" class="form-inline" role="form"
|
||||||
accept-charset="UTF-8"
|
accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||||
action=""
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="flex items-center gap-2">
|
<div class="col-xs-8">
|
||||||
<span class="flex-1">{{ u.username }}</span>
|
{{ u.username }}
|
||||||
<input type="hidden" name="member" value="{{ u.url }}"/>
|
<input type="hidden" name="member" value="{{ u.url }}"/>
|
||||||
<input type="hidden" name="action" value="remove" />
|
<input type="hidden" name="action" value="remove">
|
||||||
<button type="submit" class="btn btn-error btn-sm">
|
</div>
|
||||||
Remove
|
<div class="col-xs-2">
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<button type="submit" style="width:60%;" class="btn col-xs-2">
|
||||||
|
<span class="glyphicon glyphicon-trash"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{% endfor %}
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endfor %}
|
||||||
|
<p></p>
|
||||||
<!-- Group Members -->
|
|
||||||
{% if group.group_member.all %}
|
|
||||||
<div class="divider">Group Members</div>
|
|
||||||
<div class="space-y-2">
|
|
||||||
{% for g in group.group_member.all %}
|
{% for g in group.group_member.all %}
|
||||||
<form
|
<div class="row">
|
||||||
id="modal-form-group-member_{{ g.uuid }}"
|
<form id="modal-form-group-member_{{ g.uuid }}" class="form-inline" role="form"
|
||||||
accept-charset="UTF-8"
|
accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||||
action=""
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="flex items-center gap-2">
|
<div class="col-xs-8">
|
||||||
<span class="flex-1">{{ g.name|safe }}</span>
|
{{ g.name|safe }}
|
||||||
<input type="hidden" name="member" value="{{ g.url }}"/>
|
<input type="hidden" name="member" value="{{ g.url }}"/>
|
||||||
<input type="hidden" name="action" value="remove" />
|
<input type="hidden" name="action" value="remove">
|
||||||
<button type="submit" class="btn btn-error btn-sm">
|
</div>
|
||||||
Remove
|
<div class="col-xs-2">
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<button type="submit" style="width:60%;" class="btn col-xs-2">
|
||||||
|
<span class="glyphicon glyphicon-trash"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Footer -->
|
</div>
|
||||||
<div class="modal-action">
|
<div class="modal-footer">
|
||||||
<button
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
type="button"
|
<button type="button" class="btn btn-primary" id="edit-package-modal-submit">Update</button>
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
|
||||||
<!-- Backdrop -->
|
|
||||||
<form method="dialog" class="modal-backdrop">
|
$(function() {
|
||||||
<button>close</button>
|
|
||||||
</form>
|
$('#edit-package-modal-submit').click(function(e){
|
||||||
</dialog>
|
e.preventDefault();
|
||||||
|
$('#edit-package-modal-form').submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#select_member").selectpicker();
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,94 +1,45 @@
|
|||||||
|
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
<!-- Edit Model -->
|
||||||
<dialog
|
<div id="edit_model_modal" class="modal" tabindex="-1">
|
||||||
id="edit_model_modal"
|
<div class="modal-dialog">
|
||||||
class="modal"
|
<div class="modal-content">
|
||||||
x-data="modalForm()"
|
<div class="modal-header">
|
||||||
@close="reset()"
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
>
|
<span aria-hidden="true">×</span>
|
||||||
<div class="modal-box">
|
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="font-bold text-lg">Update Model</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
<h3 class="modal-title">Update Model</h3>
|
||||||
|
</div>
|
||||||
<!-- Body -->
|
<div class="modal-body">
|
||||||
<div class="py-4">
|
<p>Alter Name and Description of the Model.</p>
|
||||||
<p class="mb-4">Alter Name and Description of the Model.</p>
|
<form id="edit-model-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||||
|
|
||||||
<form
|
|
||||||
id="edit-model-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action=""
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
<p>
|
||||||
<div class="form-control mb-3">
|
<label for="model-name">Name</label>
|
||||||
<label class="label" for="model-name">
|
<input id="model-name" type="text" class="form-control" name="model-name"
|
||||||
<span class="label-text">Name</span>
|
value="{{ model.name|safe }}">
|
||||||
</label>
|
</p>
|
||||||
<input
|
<p>
|
||||||
id="model-name"
|
<label for="model-description">Description</label>
|
||||||
type="text"
|
<input id="model-description" type="text" class="form-control" name="model-description"
|
||||||
class="input input-bordered w-full"
|
value="{{ model.description|safe }}">
|
||||||
name="model-name"
|
</p>
|
||||||
value="{{ model.name|safe }}"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="model-description">
|
|
||||||
<span class="label-text">Description</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="model-description"
|
|
||||||
type="text"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="model-description"
|
|
||||||
value="{{ model.description|safe }}"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
<div class="modal-action">
|
<button type="button" class="btn btn-primary" id="edit-model-modal-submit">Update</button>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit('edit-model-modal-form')"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Update</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Updating...</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(function () {
|
||||||
|
|
||||||
<!-- Backdrop -->
|
$('#edit-model-modal-submit').click(function (e) {
|
||||||
<form method="dialog" class="modal-backdrop">
|
e.preventDefault();
|
||||||
<button :disabled="isSubmitting">close</button>
|
$('#edit-model-modal-form').submit();
|
||||||
</form>
|
});
|
||||||
</dialog>
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,91 +1,47 @@
|
|||||||
|
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
<!-- Edit Node -->
|
||||||
<dialog
|
<div id="edit_node_modal" class="modal" tabindex="-1">
|
||||||
id="edit_node_modal"
|
<div class="modal-dialog">
|
||||||
class="modal"
|
<div class="modal-content">
|
||||||
x-data="modalForm()"
|
<div class="modal-header">
|
||||||
@close="reset()"
|
<h5 class="modal-title">Edit Node</h5>
|
||||||
>
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
<div class="modal-box">
|
<span aria-hidden="true">×</span>
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="font-bold text-lg">Edit Node</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
<!-- Body -->
|
<p>Edit Node.</p>
|
||||||
<div class="py-4">
|
<form id="edit-node-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||||
<form
|
|
||||||
id="edit-node-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action=""
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
<p>
|
||||||
<div class="form-control mb-3">
|
<label for="node-name">Name</label>
|
||||||
<label class="label" for="node-name">
|
<input id="node-name" class="form-control" name="node-name" value="{{ node.name|safe}}">
|
||||||
<span class="label-text">Name</span>
|
</p>
|
||||||
</label>
|
<p>
|
||||||
<input
|
<label for="node-description">Description</label>
|
||||||
id="node-name"
|
<input id="node-description" type="text" class="form-control"
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="node-name"
|
|
||||||
value="{{ node.name|safe }}"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="node-description">
|
|
||||||
<span class="label-text">Description</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="node-description"
|
|
||||||
type="text"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
value="{{ node.description|safe }}"
|
value="{{ node.description|safe }}"
|
||||||
name="node-description"
|
name="node-description">
|
||||||
/>
|
</p>
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
<div class="modal-action">
|
<button type="button" class="btn btn-primary" id="edit-node-modal-submit">Create</button>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit('edit-node-modal-form')"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Update</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Updating...</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
|
||||||
<!-- Backdrop -->
|
$('#edit-node-modal-submit').click(function(e){
|
||||||
<form method="dialog" class="modal-backdrop">
|
e.preventDefault();
|
||||||
<button :disabled="isSubmitting">close</button>
|
$('#edit-node-modal-form').submit();
|
||||||
</form>
|
});
|
||||||
</dialog>
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
@ -1,91 +1,45 @@
|
|||||||
|
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
<!-- Edit Package -->
|
||||||
<dialog
|
<div id="edit_package_modal" class="modal" tabindex="-1">
|
||||||
id="edit_package_modal"
|
<div class="modal-dialog">
|
||||||
class="modal"
|
<div class="modal-content">
|
||||||
x-data="modalForm()"
|
<div class="modal-header">
|
||||||
@close="reset()"
|
<h5 class="modal-title">Update Package</h5>
|
||||||
>
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
<div class="modal-box">
|
<span aria-hidden="true">×</span>
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="font-bold text-lg">Update Package</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
<!-- Body -->
|
<p>Edit a Package.</p>
|
||||||
<div class="py-4">
|
<form id="edit-package-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||||
<form
|
|
||||||
id="edit-package-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action=""
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
<p>
|
||||||
<div class="form-control mb-3">
|
<label for="package-name">Name</label>
|
||||||
<label class="label" for="package-name">
|
<input id="package-name" class="form-control" name="package-name" value="{{ package.name|safe}}">
|
||||||
<span class="label-text">Name</span>
|
</p>
|
||||||
</label>
|
<p>
|
||||||
<input
|
<label for="package-description">Description</label>
|
||||||
id="package-name"
|
<input id="package-description" type="text" class="form-control"
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="package-name"
|
|
||||||
value="{{ package.name|safe }}"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="package-description">
|
|
||||||
<span class="label-text">Description</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="package-description"
|
|
||||||
type="text"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
value="{{ package.description|safe }}"
|
value="{{ package.description|safe }}"
|
||||||
name="package-description"
|
name="package-description">
|
||||||
/>
|
</p>
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
<div class="modal-action">
|
<button type="button" class="btn btn-primary" id="edit-package-modal-submit">Update</button>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit('edit-package-modal-form')"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Update</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Updating...</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
|
||||||
<!-- Backdrop -->
|
$('#edit-package-modal-submit').click(function(e){
|
||||||
<form method="dialog" class="modal-backdrop">
|
e.preventDefault();
|
||||||
<button :disabled="isSubmitting">close</button>
|
$('#edit-package-modal-form').submit();
|
||||||
</form>
|
});
|
||||||
</dialog>
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,271 +1,183 @@
|
|||||||
|
|
||||||
{% load static %}
|
{% load static %}
|
||||||
<!-- Edit Package Permissions -->
|
<!-- Edit Package Permission -->
|
||||||
<dialog
|
<div id="edit_package_permissions_modal" class="modal" tabindex="-1">
|
||||||
id="edit_package_permissions_modal"
|
<div class="modal-dialog">
|
||||||
class="modal"
|
<div class="modal-content">
|
||||||
x-data="{
|
<div class="modal-header">
|
||||||
updatePermissions(checkbox) {
|
<h5 class="modal-title">Grant or Revoke Permissions</h5>
|
||||||
const parts = checkbox.id.split('_');
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
const perm = parts[0];
|
<span aria-hidden="true">×</span>
|
||||||
const id = parts[1];
|
|
||||||
|
|
||||||
const readBox = document.getElementById('read_' + id);
|
|
||||||
const writeBox = document.getElementById('write_' + id);
|
|
||||||
const ownerBox = document.getElementById('owner_' + id);
|
|
||||||
|
|
||||||
if (perm === 'read' && !readBox.checked) {
|
|
||||||
writeBox.checked = false;
|
|
||||||
ownerBox.checked = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (perm === 'write') {
|
|
||||||
if (writeBox.checked) {
|
|
||||||
readBox.checked = true;
|
|
||||||
} else {
|
|
||||||
ownerBox.checked = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (perm === 'owner' && ownerBox.checked) {
|
|
||||||
readBox.checked = true;
|
|
||||||
writeBox.checked = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}"
|
|
||||||
>
|
|
||||||
<div class="modal-box max-w-2xl">
|
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="text-lg font-bold">Grant or Revoke Permissions</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2">
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
<!-- Body -->
|
<p>
|
||||||
<div class="py-4">
|
Modify permissions for this package. Note that if you give <code>write</code>
|
||||||
<p class="mb-4">
|
permissions to a user or group, <code>read</code> permissions will be granted automatically.
|
||||||
Modify permissions for this package. Note that if you give
|
<br>
|
||||||
<code class="badge badge-ghost">write</code> permissions to a user or
|
To allow users to perform destructive actions, such as deleting the package, <code>owner</code>
|
||||||
group, <code class="badge badge-ghost">read</code> permissions will be
|
permissions must be granted.
|
||||||
granted automatically.
|
|
||||||
<br />
|
|
||||||
To allow users to perform destructive actions, such as deleting the
|
|
||||||
package, <code class="badge badge-ghost">owner</code> permissions must
|
|
||||||
be granted.
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<!-- Add New Permission -->
|
<div class="row">
|
||||||
<form
|
<div class="col-xs-4">
|
||||||
id="modal-form-permissions"
|
<legend>User or Group</legend>
|
||||||
accept-charset="UTF-8"
|
</div>
|
||||||
action=""
|
<div class="col-xs-2">
|
||||||
method="post"
|
<legend>Read</legend>
|
||||||
class="mb-4"
|
</div>
|
||||||
>
|
<div class="col-xs-2">
|
||||||
|
<legend>Write</legend>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<legend>Owner</legend>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<form id="modal-form-permissions" class="form-inline" role="form" accept-charset="UTF-8" action=""
|
||||||
|
data-remote="true" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="grid grid-cols-12 gap-2 items-end">
|
<div class="col-xs-4">
|
||||||
<div class="col-span-5">
|
<select id="select_grantee" name="grantee" data-actions-box='true'
|
||||||
<label class="label">
|
class="selPackages" data-width='100%'>
|
||||||
<span class="label-text">User or Group</span>
|
<option disabled selected>User</option>
|
||||||
</label>
|
|
||||||
<select
|
|
||||||
id="select_grantee"
|
|
||||||
name="grantee"
|
|
||||||
class="select select-bordered w-full select-sm"
|
|
||||||
required
|
|
||||||
>
|
|
||||||
<optgroup label="Users">
|
|
||||||
{% for u in users %}
|
{% for u in users %}
|
||||||
<option value="{{ u.url }}">{{ u.username }}</option>
|
<option value="{{ u.url }}">{{ u.username }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</optgroup>
|
<option disabled>Groups</option>
|
||||||
<optgroup label="Groups">
|
|
||||||
{% for g in groups %}
|
{% for g in groups %}
|
||||||
<option value="{{ g.url }}">{{ g.name|safe }}</option>
|
<option value="{{ g.url }}">{{ g.name|safe }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</optgroup>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-span-2 text-center">
|
<div class="col-xs-2">
|
||||||
<label class="label justify-center">
|
<input type="checkbox" name="read" id="read_new"/>
|
||||||
<span class="label-text">Read</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
name="read"
|
|
||||||
id="read_new"
|
|
||||||
class="checkbox"
|
|
||||||
@click="updatePermissions($el)"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-span-2 text-center">
|
<div class="col-xs-2">
|
||||||
<label class="label justify-center">
|
<input type="checkbox" name="write" id="write_new"/>
|
||||||
<span class="label-text">Write</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
name="write"
|
|
||||||
id="write_new"
|
|
||||||
class="checkbox"
|
|
||||||
@click="updatePermissions($el)"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-span-2 text-center">
|
<div class="col-xs-2">
|
||||||
<label class="label justify-center">
|
<input type="checkbox" name="owner" id="owner_new"/>
|
||||||
<span class="label-text">Owner</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
name="owner"
|
|
||||||
id="owner_new"
|
|
||||||
class="checkbox"
|
|
||||||
@click="updatePermissions($el)"
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-span-1">
|
<div class="col-xs-2">
|
||||||
<button type="submit" class="btn btn-primary btn-sm">+</button>
|
<button type="submit" style="width:60%;" class="btn col-xs-2 modify-perm-button">
|
||||||
</div>
|
<span class="glyphicon glyphicon-plus"></span>
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<!-- User Permissions -->
|
|
||||||
{% if user_permissions %}
|
|
||||||
<div class="divider">User Permissions</div>
|
|
||||||
<div class="space-y-2">
|
|
||||||
{% for up in user_permissions %}
|
|
||||||
<form
|
|
||||||
id="modal-form-permissions_{{ up.user.uuid }}"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action=""
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
|
||||||
<div class="grid grid-cols-12 gap-2 items-center">
|
|
||||||
<div class="col-span-5 truncate">
|
|
||||||
{{ up.user.username }}
|
|
||||||
<input
|
|
||||||
type="hidden"
|
|
||||||
name="grantee"
|
|
||||||
value="{{ up.user.url }}"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="col-span-2 text-center">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
name="read"
|
|
||||||
id="read_{{ up.user.uuid }}"
|
|
||||||
class="checkbox"
|
|
||||||
{% if up.has_read %}checked{% endif %}
|
|
||||||
@click="updatePermissions($el)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="col-span-2 text-center">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
name="write"
|
|
||||||
id="write_{{ up.user.uuid }}"
|
|
||||||
class="checkbox"
|
|
||||||
{% if up.has_write %}checked{% endif %}
|
|
||||||
@click="updatePermissions($el)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="col-span-2 text-center">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
name="owner"
|
|
||||||
id="owner_{{ up.user.uuid }}"
|
|
||||||
class="checkbox"
|
|
||||||
{% if up.has_all %}checked{% endif %}
|
|
||||||
@click="updatePermissions($el)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="col-span-1">
|
|
||||||
<button type="submit" class="btn btn-sm btn-ghost">✓</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<!-- Group Permissions -->
|
|
||||||
{% if group_permissions %}
|
|
||||||
<div class="divider">Group Permissions</div>
|
|
||||||
<div class="space-y-2">
|
|
||||||
{% for gp in group_permissions %}
|
|
||||||
<form
|
|
||||||
id="modal-form-permissions_{{ gp.group.uuid }}"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action=""
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
|
||||||
<div class="grid grid-cols-12 gap-2 items-center">
|
|
||||||
<div class="col-span-5 truncate">
|
|
||||||
{{ gp.group.name|safe }}
|
|
||||||
<input
|
|
||||||
type="hidden"
|
|
||||||
name="grantee"
|
|
||||||
value="{{ gp.group.url }}"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="col-span-2 text-center">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
name="read"
|
|
||||||
id="read_{{ gp.group.uuid }}"
|
|
||||||
class="checkbox"
|
|
||||||
{% if gp.has_read %}checked{% endif %}
|
|
||||||
@click="updatePermissions($el)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="col-span-2 text-center">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
name="write"
|
|
||||||
id="write_{{ gp.group.uuid }}"
|
|
||||||
class="checkbox"
|
|
||||||
{% if gp.has_write %}checked{% endif %}
|
|
||||||
@click="updatePermissions($el)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="col-span-2 text-center">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
name="owner"
|
|
||||||
id="owner_{{ gp.group.uuid }}"
|
|
||||||
class="checkbox"
|
|
||||||
{% if gp.has_all %}checked{% endif %}
|
|
||||||
@click="updatePermissions($el)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div class="col-span-1">
|
|
||||||
<button type="submit" class="btn btn-sm btn-ghost">✓</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Footer -->
|
|
||||||
<div class="modal-action">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Backdrop -->
|
|
||||||
<form method="dialog" class="modal-backdrop">
|
|
||||||
<button>close</button>
|
|
||||||
</form>
|
</form>
|
||||||
</dialog>
|
</div>
|
||||||
|
<p></p>
|
||||||
|
{% for up in user_permissions %}
|
||||||
|
<div class="row">
|
||||||
|
<form id="modal-form-permissions_{{ up.user.uuid }}" class="form-inline" role="form"
|
||||||
|
accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="col-xs-4">
|
||||||
|
{{ up.user.username }}
|
||||||
|
<input type="hidden" name="grantee" value="{{ up.user.url }}"/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<input type="checkbox" name="read" id="read_{{ up.user.uuid }}" {% if up.has_read %} checked {% endif %}/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<input type="checkbox" name="write" id="write_{{ up.user.uuid }}" {% if up.has_write %} checked {% endif %}/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<input type="checkbox" name="owner" id="owner_{{ up.user.uuid }}" {% if up.has_all %} checked {% endif %}/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<button type="submit" style="width:60%;" class="btn col-xs-2 modify-perm-button">
|
||||||
|
<span class="glyphicon glyphicon-ok"></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
<p></p>
|
||||||
|
{% for gp in group_permissions %}
|
||||||
|
<div class="row">
|
||||||
|
<form id="modal-form-permissions_{{ gp.user.uuid }}" class="form-inline" role="form"
|
||||||
|
accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<div class="col-xs-4">
|
||||||
|
{{ gp.group.name|safe }}
|
||||||
|
<input type="hidden" name="grantee" value="{{ gp.group.url }}"/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<input type="checkbox" name="read" id="read_{{ gp.group.uuid }}" {% if gp.has_read %} checked {% endif %}/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<input type="checkbox" name="write" id="write_{{ gp.group.uuid }}" {% if gp.has_write %} checked {% endif %}/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<input type="checkbox" name="owner" id="owner_{{ gp.group.uuid }}" {% if gp.has_all %} checked {% endif %}/>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-2">
|
||||||
|
<button type="submit" style="width:60%;" class="btn col-xs-2 modify-perm-button">
|
||||||
|
<span class="glyphicon glyphicon-ok"></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="edit-package-modal-submit">Update</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function checkboxClick() {
|
||||||
|
// id looks like read_3cadef24-220e-4587-9fa5-0e9a17aca2da
|
||||||
|
parts = this.id.split('_');
|
||||||
|
perm = parts[0];
|
||||||
|
id = parts[1];
|
||||||
|
|
||||||
|
readbox = '#read_' + id;
|
||||||
|
writebox = '#write_' + id;
|
||||||
|
ownerbox = '#owner_' + id;
|
||||||
|
|
||||||
|
|
||||||
|
if (perm == 'read' && !$(readbox).prop("checked")) {
|
||||||
|
$(writebox).prop("checked", false);
|
||||||
|
$(ownerbox).prop("checked", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (perm == 'write') {
|
||||||
|
if ($(writebox).prop("checked")) {
|
||||||
|
$(readbox).prop("checked", true);
|
||||||
|
}
|
||||||
|
if (!$(writebox).prop("checked")) {
|
||||||
|
$(ownerbox).prop("checked", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (perm == 'owner') {
|
||||||
|
if ($(ownerbox).prop("checked")) {
|
||||||
|
$(readbox).prop("checked", true);
|
||||||
|
$(writebox).prop("checked", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(function() {
|
||||||
|
|
||||||
|
$('#edit-package-modal-submit').click(function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
$('#edit-package-modal-form').submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#select_grantee").selectpicker();
|
||||||
|
|
||||||
|
// Add click functions to permission checkboxes
|
||||||
|
$('[id^="read_"]').on('click', checkboxClick);
|
||||||
|
$('[id^="write_"]').on('click', checkboxClick);
|
||||||
|
$('[id^="owner_"]').on('click', checkboxClick);
|
||||||
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,119 +1,46 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
|
<!-- Edit Package -->
|
||||||
<dialog
|
<div id="edit_password_modal" class="modal" tabindex="-1">
|
||||||
id="edit_password_modal"
|
<div class="modal-dialog">
|
||||||
class="modal"
|
<div class="modal-content">
|
||||||
x-data="modalForm()"
|
<div class="modal-header">
|
||||||
@close="reset()"
|
<h5 class="modal-title">Update your Password</h5>
|
||||||
>
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
<div class="modal-box">
|
<span aria-hidden="true">×</span>
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="font-bold text-lg">Update your Password</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
<!-- Body -->
|
<p>To change your password please fill out the following inputs</p>
|
||||||
<div class="py-4">
|
<form id="edit-password-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||||
<p class="mb-4">
|
|
||||||
To change your password please fill out the following inputs
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<form
|
|
||||||
id="edit-password-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action=""
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="hidden" name="hidden" value="update-password" />
|
<p>
|
||||||
|
<label for="old-password">Old Password</label>
|
||||||
<div class="form-control mb-3">
|
<input id="old-password" class="form-control" name="old-password" type="password" autocomplete="current-password">
|
||||||
<label class="label" for="old-password">
|
</p>
|
||||||
<span class="label-text">Old Password</span>
|
<p>
|
||||||
</label>
|
<label for="new-password">New Password</label>
|
||||||
<input
|
<input id="new-password" class="form-control" name="new-password" type="password", autocomplete="new-password">
|
||||||
id="old-password"
|
</p>
|
||||||
class="input input-bordered w-full"
|
<p>
|
||||||
name="old-password"
|
<label for="new-password-repeat">Repeat New Password</label>
|
||||||
type="password"
|
<input id="new-password-repeat" class="form-control" name="new-password-repeat" type="password" autocomplete="new-password">
|
||||||
autocomplete="current-password"
|
</p>
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="new-password">
|
|
||||||
<span class="label-text">New Password</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="new-password"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="new-password"
|
|
||||||
type="password"
|
|
||||||
autocomplete="new-password"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="new-password-repeat">
|
|
||||||
<span class="label-text">Repeat New Password</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="new-password-repeat"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="new-password-repeat"
|
|
||||||
type="password"
|
|
||||||
autocomplete="new-password"
|
|
||||||
required
|
|
||||||
@input="validatePasswordMatch('new-password', 'new-password-repeat')"
|
|
||||||
/>
|
|
||||||
<label class="label" x-show="errors['new-password-repeat']">
|
|
||||||
<span
|
|
||||||
class="label-text-alt text-error"
|
|
||||||
x-text="errors['new-password-repeat']"
|
|
||||||
></span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
<div class="modal-action">
|
<button type="button" class="btn btn-primary" id="edit-password-modal-submit">Update</button>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="if (validatePasswordMatch('new-password', 'new-password-repeat')) submit('edit-password-modal-form')"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Update</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Updating...</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
|
||||||
<!-- Backdrop -->
|
$('#edit-password-modal-submit').click(function(e){
|
||||||
<form method="dialog" class="modal-backdrop">
|
e.preventDefault();
|
||||||
<button :disabled="isSubmitting">close</button>
|
$('#edit-password-modal-form').submit();
|
||||||
</form>
|
});
|
||||||
</dialog>
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,92 +1,44 @@
|
|||||||
|
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
<!-- Edit Pathway -->
|
||||||
<dialog
|
<div id="edit_pathway_modal" class="modal" tabindex="-1">
|
||||||
id="edit_pathway_modal"
|
<div class="modal-dialog">
|
||||||
class="modal"
|
<div class="modal-content">
|
||||||
x-data="modalForm()"
|
<div class="modal-header">
|
||||||
@close="reset()"
|
<h5 class="modal-title">Edit Pathway</h5>
|
||||||
>
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
<div class="modal-box">
|
<span aria-hidden="true">×</span>
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="font-bold text-lg">Edit Pathway</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
<!-- Body -->
|
<p>Edit Pathway.</p>
|
||||||
<div class="py-4">
|
<form id="edit-pathway-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||||
<form
|
|
||||||
id="edit-pathway-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action=""
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
<p>
|
||||||
<div class="form-control mb-3">
|
<label for="pathway-name">Name</label>
|
||||||
<label class="label" for="pathway-name">
|
<input id="pathway-name" class="form-control" name="pathway-name" value="{{ pathway.name|safe }}">
|
||||||
<span class="label-text">Name</span>
|
</p>
|
||||||
</label>
|
<p>
|
||||||
<input
|
<label for="pathway-description">Description</label>
|
||||||
id="pathway-name"
|
<textarea id="pathway-description" type="text" class="form-control" name="pathway-description"
|
||||||
class="input input-bordered w-full"
|
rows="10">{{ pathway.description|safe }}</textarea>
|
||||||
name="pathway-name"
|
</p>
|
||||||
value="{{ pathway.name|safe }}"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="pathway-description">
|
|
||||||
<span class="label-text">Description</span>
|
|
||||||
</label>
|
|
||||||
<textarea
|
|
||||||
id="pathway-description"
|
|
||||||
class="textarea textarea-bordered w-full"
|
|
||||||
name="pathway-description"
|
|
||||||
rows="10"
|
|
||||||
>
|
|
||||||
{{ pathway.description|safe }}</textarea
|
|
||||||
>
|
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
<div class="modal-action">
|
<button type="button" class="btn btn-primary" id="edit-pathway-modal-submit">Update</button>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit('edit-pathway-modal-form')"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Update</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Updating...</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
|
||||||
<!-- Backdrop -->
|
$('#edit-pathway-modal-submit').click(function(e){
|
||||||
<form method="dialog" class="modal-backdrop">
|
e.preventDefault();
|
||||||
<button :disabled="isSubmitting">close</button>
|
$('#edit-pathway-modal-form').submit();
|
||||||
</form>
|
});
|
||||||
</dialog>
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,156 +1,106 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
<!-- Edit Prediction Setting -->
|
<!-- Edit Package -->
|
||||||
<dialog
|
<div id="update_prediction_settings_modal" class="modal" tabindex="-1">
|
||||||
id="update_prediction_settings_modal"
|
<div class="modal-dialog">
|
||||||
class="modal"
|
<div class="modal-content">
|
||||||
x-data="modalForm()"
|
<div class="modal-header">
|
||||||
@close="reset()"
|
<h5 class="modal-title">Update Prediction Setting</h5>
|
||||||
>
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
<div class="modal-box max-w-3xl">
|
<span aria-hidden="true">×</span>
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="text-lg font-bold">Update Prediction Setting</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute top-2 right-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
<!-- Body -->
|
<p>To update your prediction setting modify parameters in the form below und click "Update"</p>
|
||||||
<div class="py-4">
|
<form id="edit-prediction-setting-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||||
<p class="mb-4">
|
|
||||||
To update your prediction setting modify parameters in the form below
|
|
||||||
and click "Update"
|
|
||||||
</p>
|
|
||||||
<form
|
|
||||||
id="edit-prediction-setting-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action=""
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="overflow-x-auto">
|
<div id="prediction-setting" class="panel-collapse collapse in">
|
||||||
<table class="table table-zebra w-full">
|
<div class="panel-body list-group-item">
|
||||||
<thead>
|
|
||||||
<tr>
|
<table class="table table-bordered table-hover">
|
||||||
<th class="w-1/5">Parameter</th>
|
<tr style="background-color: rgba(0, 0, 0, 0.08);">
|
||||||
<th class="w-4/5">Value</th>
|
<th scope="col" width="20%">Parameter</th>
|
||||||
|
<th scope="col" width="80%">Value</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
|
||||||
<tbody>
|
<tbody>
|
||||||
{% if 'model' in user.prediction_settings %}
|
{% if 'model' in user.prediction_settings %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>Model</td>
|
<td width="20%">Model</td>
|
||||||
<td>
|
<td width="80%">
|
||||||
<div class="form-control">
|
<table width="100%" class="table table-bordered table-hover">
|
||||||
<select
|
<tbody>
|
||||||
id="model"
|
<tr>
|
||||||
name="model"
|
<td colspan="2">
|
||||||
class="select select-bordered w-full"
|
<select id="model" name="model" class="form-control" data-width='100%'>
|
||||||
>
|
|
||||||
{% for m in models %}
|
{% for m in models %}
|
||||||
<option
|
<option value="{{ m.id }}" {% if user.prediction_settings.model.url == m.url %}selected{% endif %}>{{ m.name|safe }}</option>
|
||||||
value="{{ m.id }}"
|
|
||||||
{% if user.prediction_settings.model.url == m.url %}selected{% endif %}
|
|
||||||
>
|
|
||||||
{{ m.name|safe }}
|
|
||||||
</option>
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
|
||||||
{% for k, v in user.prediction_settings.model_parameters.items %}
|
|
||||||
{% if k == 'threshold' %}
|
|
||||||
<div class="form-control mt-2">
|
|
||||||
<label class="label">
|
|
||||||
<span class="label-text">Threshold</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="{{ k }}"
|
|
||||||
value="{{ v }}"
|
|
||||||
min="0"
|
|
||||||
max="1"
|
|
||||||
step="0.05"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% for k, v in user.prediction_settings.model_parameters.items %}
|
||||||
{% for k, v in user.prediction_settings.truncator.items %}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<th width="20%">Model Parameter</th>
|
||||||
{% if k == 'max_nodes' %}
|
<th width="80%">Parameter Value</th>
|
||||||
Max Nodes
|
</tr>
|
||||||
{% elif k == 'max_depth' %}
|
<tr>
|
||||||
Max Depth
|
<td width="20%">
|
||||||
|
{% if k == 'threshold' %}
|
||||||
|
Threshold
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td width="80%">
|
||||||
{% if k == 'max_nodes' %}
|
{% if k == 'threshold' %}
|
||||||
<input
|
<input type="number" class="form-control" name="{{k}}" value="{{v}}"
|
||||||
type="number"
|
min="0" max="1" step="0.05">
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="{{ k }}"
|
|
||||||
value="{{ v }}"
|
|
||||||
min="1"
|
|
||||||
max="50"
|
|
||||||
step="1"
|
|
||||||
/>
|
|
||||||
{% elif k == 'max_depth' %}
|
|
||||||
<input
|
|
||||||
type="number"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
name="{{ k }}"
|
|
||||||
value="{{ v }}"
|
|
||||||
min="1"
|
|
||||||
max="8"
|
|
||||||
step="1"
|
|
||||||
/>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
|
{% for k, v in user.prediction_settings.truncator.items %}
|
||||||
|
<tr>
|
||||||
|
<td><p>
|
||||||
|
{% if k == 'max_nodes' %}
|
||||||
|
Max Nodes
|
||||||
|
{% elif k == 'max_depth' %}
|
||||||
|
Max Depth
|
||||||
|
{% endif %}
|
||||||
|
</p></td>
|
||||||
|
<td><p>
|
||||||
|
{% if k == 'max_nodes' %}
|
||||||
|
<input type="number" class="form-control" name="{{k}}" value="{{v}}" min="1"
|
||||||
|
max="50" step="1">
|
||||||
|
{% elif k == 'max_depth' %}
|
||||||
|
<input type="number" class="form-control" name="{{k}}" value="{{v}}" min="1"
|
||||||
|
max="8" step="1">
|
||||||
|
{% endif %}
|
||||||
|
</p></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
<div class="modal-action">
|
<button type="button" class="btn btn-primary" id="edit-prediction-setting-modal-submit">Update</button>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit('edit-prediction-setting-modal-form')"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Update</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Updating...</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
|
||||||
<!-- Backdrop -->
|
$('#edit-prediction-setting-modal-submit').click(function(e){
|
||||||
<form method="dialog" class="modal-backdrop">
|
e.preventDefault();
|
||||||
<button :disabled="isSubmitting">close</button>
|
$('#edit-prediction-setting-modal-form').submit();
|
||||||
</form>
|
});
|
||||||
</dialog>
|
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,91 +1,45 @@
|
|||||||
|
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
<!-- Edit Reaction -->
|
||||||
<dialog
|
<div id="edit_reaction_modal" class="modal" tabindex="-1">
|
||||||
id="edit_reaction_modal"
|
<div class="modal-dialog">
|
||||||
class="modal"
|
<div class="modal-content">
|
||||||
x-data="modalForm()"
|
<div class="modal-header">
|
||||||
@close="reset()"
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
>
|
<span aria-hidden="true">×</span>
|
||||||
<div class="modal-box">
|
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="font-bold text-lg">Update Reaction</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
<h3 class="modal-title">Update Reaction</h3>
|
||||||
|
</div>
|
||||||
<!-- Body -->
|
<div class="modal-body">
|
||||||
<div class="py-4">
|
<form id="edit-reaction-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||||
<form
|
|
||||||
id="edit-reaction-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action=""
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
<p>
|
||||||
<div class="form-control mb-3">
|
<label for="reaction-name">Name</label>
|
||||||
<label class="label" for="reaction-name">
|
<input id="reaction-name" class="form-control" name="reaction-name" value="{{ reaction.name|safe }}">
|
||||||
<span class="label-text">Name</span>
|
</p>
|
||||||
</label>
|
<p>
|
||||||
<input
|
<label for="reaction-description">Description</label>
|
||||||
id="reaction-name"
|
<input id="reaction-description" type="text" class="form-control"
|
||||||
class="input input-bordered w-full"
|
value="{{ reaction.description|safe }}" name="reaction-description">
|
||||||
name="reaction-name"
|
</p>
|
||||||
value="{{ reaction.name|safe }}"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="reaction-description">
|
|
||||||
<span class="label-text">Description</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="reaction-description"
|
|
||||||
type="text"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
value="{{ reaction.description|safe }}"
|
|
||||||
name="reaction-description"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
<div class="modal-action">
|
<button type="button" class="btn btn-primary" id="edit-reaction-modal-submit">Update</button>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit('edit-reaction-modal-form')"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Update</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Updating...</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
|
||||||
<!-- Backdrop -->
|
$('#edit-reaction-modal-submit').click(function(e){
|
||||||
<form method="dialog" class="modal-backdrop">
|
e.preventDefault();
|
||||||
<button :disabled="isSubmitting">close</button>
|
$('#edit-reaction-modal-form').submit();
|
||||||
</form>
|
});
|
||||||
</dialog>
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|||||||
@ -1,91 +1,45 @@
|
|||||||
|
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
<!-- Edit Rule -->
|
||||||
<dialog
|
<div id="edit_rule_modal" class="modal" tabindex="-1">
|
||||||
id="edit_rule_modal"
|
<div class="modal-dialog">
|
||||||
class="modal"
|
<div class="modal-content">
|
||||||
x-data="modalForm()"
|
<div class="modal-header">
|
||||||
@close="reset()"
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
>
|
<span aria-hidden="true">×</span>
|
||||||
<div class="modal-box">
|
|
||||||
<!-- Header -->
|
|
||||||
<h3 class="font-bold text-lg">Update Rule</h3>
|
|
||||||
|
|
||||||
<!-- Close button (X) -->
|
|
||||||
<form method="dialog">
|
|
||||||
<button
|
|
||||||
class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
✕
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
<h3 class="modal-title">Update Rule</h3>
|
||||||
|
</div>
|
||||||
<!-- Body -->
|
<div class="modal-body">
|
||||||
<div class="py-4">
|
<form id="edit-rule-modal-form" accept-charset="UTF-8" action="" data-remote="true" method="post">
|
||||||
<form
|
|
||||||
id="edit-rule-modal-form"
|
|
||||||
accept-charset="UTF-8"
|
|
||||||
action=""
|
|
||||||
method="post"
|
|
||||||
>
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
<p>
|
||||||
<div class="form-control mb-3">
|
<label for="rule-name">Name</label>
|
||||||
<label class="label" for="rule-name">
|
<input id="rule-name" class="form-control" name="rule-name" value="{{ rule.name|safe }}">
|
||||||
<span class="label-text">Name</span>
|
</p>
|
||||||
</label>
|
<p>
|
||||||
<input
|
<label for="rule-description">Description</label>
|
||||||
id="rule-name"
|
<input id="rule-description" type="text" class="form-control"
|
||||||
class="input input-bordered w-full"
|
value="{{ rule.description|safe }}" name="rule-description">
|
||||||
name="rule-name"
|
</p>
|
||||||
value="{{ rule.name|safe }}"
|
|
||||||
required
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-control mb-3">
|
|
||||||
<label class="label" for="rule-description">
|
|
||||||
<span class="label-text">Description</span>
|
|
||||||
</label>
|
|
||||||
<input
|
|
||||||
id="rule-description"
|
|
||||||
type="text"
|
|
||||||
class="input input-bordered w-full"
|
|
||||||
value="{{ rule.description|safe }}"
|
|
||||||
name="rule-description"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
<!-- Footer -->
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
|
||||||
<div class="modal-action">
|
<button type="button" class="btn btn-primary" id="edit-rule-modal-submit">Update</button>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn"
|
|
||||||
onclick="this.closest('dialog').close()"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
Close
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="btn btn-primary"
|
|
||||||
@click="submit('edit-rule-modal-form')"
|
|
||||||
:disabled="isSubmitting"
|
|
||||||
>
|
|
||||||
<span x-show="!isSubmitting">Update</span>
|
|
||||||
<span
|
|
||||||
x-show="isSubmitting"
|
|
||||||
class="loading loading-spinner loading-sm"
|
|
||||||
></span>
|
|
||||||
<span x-show="isSubmitting">Updating...</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
|
||||||
<!-- Backdrop -->
|
$('#edit-rule-modal-submit').click(function(e){
|
||||||
<form method="dialog" class="modal-backdrop">
|
e.preventDefault();
|
||||||
<button :disabled="isSubmitting">close</button>
|
$('#edit-rule-modal-form').submit();
|
||||||
</form>
|
});
|
||||||
</dialog>
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user