Skip to content

Commit

Permalink
Move app to standalone plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Mar 14, 2024
1 parent 671b9cd commit f552958
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 69 deletions.
28 changes: 12 additions & 16 deletions arches_rdm/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from arches.app.models import models


from django.db import migrations, models
from django.db import migrations
from django.utils.translation import gettext as _


class Migration(migrations.Migration):
Expand All @@ -15,23 +13,21 @@ class Migration(migrations.Migration):
def add_plugins(apps, schema_editor):
Plugin = apps.get_model("models", "Plugin")

Plugin.objects.update_or_create(
Plugin(
pluginid="29321ce0-bd95-4357-a2a5-822e9cb06f70",
name="Reference Data Manager (RDM)",
name=_("Lingo"),
icon="fa fa-code-fork",
component="views/components/plugins/reference-data-manager",
componentname="reference-data-manager",
config={},
slug="reference-data-manager",
sortorder=0
)
component="App.vue",
componentname="lingo",
config={"show": True, "is_standalone": True},
slug="lingo",
sortorder=0,
).save()

def remove_plugin(apps, schema_editor):
Plugin = apps.get_model("models", "Plugin")

for plugin in Plugin.objects.filter(pluginid__in=["29321ce0-bd95-4357-a2a5-822e9cb06f70"]):
plugin.delete()
Plugin.objects.filter(slug="lingo").delete()

operations = [
migrations.RunPython(add_plugins, remove_plugin),
]
]
5 changes: 0 additions & 5 deletions arches_rdm/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ const isAuthenticated = ref(false);
</script>

<template>
<link
rel="stylesheet"
type="text/css"
href="https://unpkg.com/primevue/resources/themes/mdc-light-indigo/theme.css"
>
<link
rel="stylesheet"
type="text/css"
Expand Down
7 changes: 2 additions & 5 deletions arches_rdm/src/components/ConceptTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Tree from "primevue/tree";
import LetterCircle from "@/components/LetterCircle.vue";
import { bestLabel } from "@/utils";
import { bestLabel } from "@/utils.ts";
import type { Ref } from "vue";
import type {
Expand Down Expand Up @@ -52,8 +52,6 @@ const CONCEPT_LABEL = $gettext("Concept");
const FOCUS = $gettext("Focus");
const UNFOCUS = $gettext("Unfocus");
import { DJANGO_HOST } from "@/main";
const onSelect = (node: TreeNode) => {
selectedNode.value = node;
};
Expand Down Expand Up @@ -177,9 +175,8 @@ const toggleFocus = (node: TreeNode) => {
const fetchSchemes = async () => {
let errorText;
const url = new URL("concept_trees/", DJANGO_HOST);
try {
const response = await fetch(url, { credentials: "include" });
const response = await fetch("concept_trees/", { credentials: "include" });
if (!response.ok) {
errorText = response.statusText;
const body = await response.json();
Expand Down
7 changes: 2 additions & 5 deletions arches_rdm/src/components/LoginPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@ import Cookies from "js-cookie";
import InputText from "primevue/inputtext";
import Button from "primevue/button";
import { DJANGO_HOST } from "@/main.ts";
const { $gettext } = useGettext();
const isAuthenticated = defineModel();
const username = ref();
const password = ref();
const setCsrfToken = async () => {
await fetch(new URL("/csrf/", DJANGO_HOST)).then(
await fetch("/csrf/").then(
async (response) => {
const data = await response.json();
Cookies.set("csrftoken", data.csrftoken);
Expand All @@ -28,7 +26,6 @@ const submit = async () => {
await setCsrfToken();
}
const url = new URL("/login/", DJANGO_HOST);
const requestOptions = {
method: "POST",
credentials: "include",
Expand All @@ -44,7 +41,7 @@ const submit = async () => {
let errorText;
try {
const response = await fetch(url, requestOptions);
const response = await fetch("/login/", requestOptions);
if (response.ok) {
// const data = await response.json();
isAuthenticated.value = true;
Expand Down
37 changes: 0 additions & 37 deletions arches_rdm/src/main.ts

This file was deleted.

2 changes: 1 addition & 1 deletion arches_rdm/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class JsonbArrayElements(Func):


@method_decorator(
group_required("RDM Administrator", raise_exception=True), name="dispatch"
group_required("RDM Administrator"), name="dispatch"
)
class ConceptTreeView(View):
def __init__(self):
Expand Down

0 comments on commit f552958

Please sign in to comment.