Skip to content

Commit

Permalink
Implement new base-root.htm template (#38)
Browse files Browse the repository at this point in the history
Co-authored-by: Christopher Byrd <[email protected]>
  • Loading branch information
jacobtylerwalls and chrabyrd authored Aug 6, 2024
1 parent 1af55ce commit b12cb37
Show file tree
Hide file tree
Showing 23 changed files with 80 additions and 259 deletions.
21 changes: 5 additions & 16 deletions .github/actions/build-and-test-branch/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,16 @@ runs:
echo Python packages installed
shell: bash

- name: Ensure frontend configuration files exist
run: |
python manage.py check
shell: bash

- name: Install Arches applications
uses: ./.github/actions/install-arches-applications
with:
secrets: ${{ inputs.secrets }}

- name: Checkout into feature branch
if: inputs.branch-type == 'feature'
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
ref: ${{ github.ref }}
path: .

- name: Checkout into target branch
if: inputs.branch-type == 'target'
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
ref: ${{ github.event.pull_request.base.ref }}
path: .

- name: Install frontend dependencies
run: |
npm install
Expand Down
28 changes: 21 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
workflow_dispatch:

jobs:
build_feature_branch:
build_target_branch:
runs-on: ubuntu-latest

services:
Expand All @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.12"]

steps:
- uses: actions/checkout@v4
Expand All @@ -33,14 +33,21 @@ jobs:
python-version: ${{ matrix.python-version }}
check-latest: true

- name: Checkout into target branch
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
ref: ${{ github.event.pull_request.base.ref }}
path: .

- name: Build and test branch
uses: ./.github/actions/build-and-test-branch
with:
secrets: ${{ toJSON(secrets) }}
project-name: 'arches_lingo'
branch-type: 'feature'
branch-type: 'target'

build_target_branch:
build_feature_branch:
runs-on: ubuntu-latest

services:
Expand All @@ -56,7 +63,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
Expand All @@ -67,12 +74,19 @@ jobs:
python-version: ${{ matrix.python-version }}
check-latest: true

- name: Checkout into feature branch
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
ref: ${{ github.ref }}
path: .

- name: Build and test branch
uses: ./.github/actions/build-and-test-branch
with:
secrets: ${{ toJSON(secrets) }}
project-name: 'arches_lingo'
branch-type: 'target'
branch-type: 'feature'

check_frontend_coverage:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -255,4 +269,4 @@ jobs:
exit 1
else
echo "Feature branch coverage ($feature_branch_python_coverage%) >= Target branch coverage ($target_branch_python_coverage%)."
fi
fi
9 changes: 8 additions & 1 deletion arches_lingo/apps.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
from django.apps import AppConfig
from django.conf import settings

from arches.settings_utils import generate_frontend_configuration

class Arches_LingoConfig(AppConfig):

class ArchesLingoConfig(AppConfig):
name = "arches_lingo"
verbose_name = "Arches Lingo"
is_arches_application = True

def ready(self):
if settings.APP_NAME.lower() == self.name:
generate_frontend_configuration()
1 change: 0 additions & 1 deletion arches_lingo/install/requirements.txt

This file was deleted.

6 changes: 0 additions & 6 deletions arches_lingo/install/requirements_dev.txt

This file was deleted.

This file was deleted.

6 changes: 6 additions & 0 deletions arches_lingo/media/js/views/root.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import LingoApp from '@/arches_lingo/App.vue';
import createVueApplication from 'arches/arches/app/media/js/utils/create-vue-application';

createVueApplication(LingoApp).then(vueApp => {
vueApp.mount('#lingo-mounting-point');
});
39 changes: 0 additions & 39 deletions arches_lingo/migrations/0001_initial.py

This file was deleted.

9 changes: 4 additions & 5 deletions arches_lingo/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@
"django.contrib.staticfiles",
"django.contrib.gis",
"django_hosts",
"arches_references",
"arches",
"arches.app.models",
"arches.management",
Expand All @@ -145,6 +144,7 @@
"corsheaders",
"oauth2_provider",
"django_celery_results",
"arches_references",
# "silk",
)

Expand Down Expand Up @@ -425,6 +425,9 @@
# override this to permenantly display/hide the language switcher
SHOW_LANGUAGE_SWITCH = len(LANGUAGES) > 1

# TODO: remove when finalizing release
SILENCED_SYSTEM_CHECKS += ["arches.E002"]

try:
from .package_settings import *
except ImportError:
Expand All @@ -440,7 +443,3 @@
from settings_local import *
except ImportError as e:
pass

# returns an output that can be read by NODEJS
if __name__ == "__main__":
transmit_webpack_django_config(**locals())
7 changes: 0 additions & 7 deletions arches_lingo/src/App.vue

This file was deleted.

7 changes: 7 additions & 0 deletions arches_lingo/src/arches_lingo/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script setup>
import Foo from "@/arches_lingo/components/FooComponent.vue";
</script>

<template>
<Foo />
</template>
8 changes: 1 addition & 7 deletions arches_lingo/src/declarations.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
// import declarations from other projects or Arches core
import("../../node_modules/arches/arches/app/src/declarations.d.ts");

// declare untyped modules that have been added to your project in `package.json`
// Module homepage on npmjs.com uses logos "TS" or "DT" to indicate if typed
declare module "arches";

// declare filetypes used in `./src/` folder
declare module "*.ts";
declare module "*.vue";
import("@/arches/declarations.d.ts");
9 changes: 9 additions & 0 deletions arches_lingo/templates/arches_lingo/root.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% extends "base-root.htm" %}

{% block title %}

{% endblock title %}

{% block body %}
<div id="lingo-mounting-point"></div>
{% endblock body %}

This file was deleted.

34 changes: 0 additions & 34 deletions arches_lingo/test_settings.py

This file was deleted.

3 changes: 2 additions & 1 deletion arches_lingo/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
from django.conf.urls.i18n import i18n_patterns
from django.urls import include, path

from arches_lingo.views import ConceptTreeView
from arches_lingo.views import LingoRootView, ConceptTreeView

urlpatterns = [
path("", LingoRootView.as_view(), name="root"),
path("concept_trees/", ConceptTreeView.as_view(), name="concept_trees"),
path("", include("arches_references.urls")),
]
Expand Down
11 changes: 10 additions & 1 deletion arches_lingo/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from django.contrib.postgres.expressions import ArraySubquery
from django.db.models import CharField, F, OuterRef, Subquery, Value
from django.db.models.expressions import CombinedExpression, Func
from django.shortcuts import render
from django.utils.translation import gettext_lazy as _
from django.utils.decorators import method_decorator
from django.views.generic import View

Expand All @@ -13,8 +15,8 @@
Value as ConceptValue,
)
from arches.app.utils.decorators import group_required

from arches.app.utils.response import JSONResponse
from arches.app.views.base import BaseManagerView

from arches_lingo.const import (
SCHEMES_GRAPH_ID,
Expand Down Expand Up @@ -199,3 +201,10 @@ def get(self, request):
}
# Todo: filter by nodegroup permissions
return JSONResponse(data)


class LingoRootView(BaseManagerView):
def get(self, request, graphid=None, resourceid=None):
context = self.get_context_data(main_script="views/root")
context["page_title"] = _("Lingo")
return render(request, "arches_lingo/root.htm", context)
2 changes: 0 additions & 2 deletions tests/search_indexes/__init__.py

This file was deleted.

37 changes: 0 additions & 37 deletions tests/search_indexes/sample_index_tests.py

This file was deleted.

Loading

0 comments on commit b12cb37

Please sign in to comment.