Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ it is used only to serve the front-end component as bundeled javascript.

The ```front-end``` folder contains a Vue Application, built with Vite and Typescript. The ultimate goal of this application is to provide an alternative UI to the current Arches platform, using a modern web framework like Vue. Currently, the Vue code is bundled by vite into the static directory of the Django Application, which is then served on the user's Arches server.

The application also supports fetching data from external api sources, as seen in the `src/components/ArtistNote.vue` component. This component is designed around a simple API endpoint that is foreign-keyed to the Arches database, linking the arches dataset to an external custom set. The repository for the external API is [here](https://github.com/hminsky2002/archesAppRemoteServer).

# Installation Instructions
*Credits to users @apeters and @chiatt*
Expand Down
4 changes: 2 additions & 2 deletions archesdataviewer/static/vite_build/.vite/manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"index.html": {
"file": "assets/index-DIt9QbVy.js",
"file": "assets/index-CVuN95tD.js",
"name": "index",
"src": "index.html",
"isEntry": true,
"css": [
"assets/index-BfOOURI1.css"
"assets/index-Byc3Ge_L.css"
]
}
}

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions archesdataviewer/static/vite_build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Arches Data Viewer</title>
<script type="module" crossorigin src="/assets/index-DIt9QbVy.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-BfOOURI1.css">
<script type="module" crossorigin src="/assets/index-CVuN95tD.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Byc3Ge_L.css">
</head>
<body>
<div id="app"></div>
Expand Down
3 changes: 2 additions & 1 deletion front-end/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
VITE_ARCHES_API_URL="http://localhost:8002"
VITE_ARTIST_GRAPH_ID=""
VITE_ARTWORK_GRAPH_ID=""
VITE_ARTWORK_GRAPH_ID=""
VITE_REMOTE_SERVER_URL=""
41 changes: 41 additions & 0 deletions front-end/src/components/ArtistNote.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<template>
<div v-if="validateRemoteServerResponseSchema(remoteServerResponse)" class="artist-note">
<p>
{{ remoteServerResponse.note }}
<a :href="remoteServerResponse.url" target="_blank" rel="noopener noreferrer">{{
remoteServerResponse.url
}}</a>
</p>
</div>
</template>

<script setup lang="ts">
import type { Artist, RemoteServerResponse } from '@/types';
import { ref, onMounted } from 'vue';
import { validateRemoteServerResponseSchema } from '@/types';

const props = defineProps<{
artist: Artist;
}>();

const remoteServerResponse = ref<RemoteServerResponse | undefined>();

async function fetchRemoteServerResponse() {
const url = new URL(
`${import.meta.env.VITE_REMOTE_SERVER_URL}/artist/${props.artist.remoteServerId}`
);
const response = await fetch(url.toString()).then((res) => res.json());
remoteServerResponse.value = response;
}

onMounted(async () => {
await fetchRemoteServerResponse();
});
</script>
<style scoped>
.artist-note {
color: var(--wac--color--gray);
padding-top: var(--wac--accessible-spacing--1x);
padding-bottom: var(--wac--accessible-spacing--1x);
}
</style>
9 changes: 6 additions & 3 deletions front-end/src/components/ResourcePanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@
/>
<h1>{{ props.resource.displayname ?? '' }}</h1>
</div>

<RouterLink :to="'/'" class="resource-detail-back-button">
<button type="button" class="back-button">
<ArrowLeftIcon class="back-button-icon" />
BACK
</button>
</RouterLink>
</div>

<ArtistNote
v-if="validateArtistSchema(props.resource.resource)"
:artist="props.resource.resource"
/>
<ResourceDetail>
<template #items>
<ArtworkDetailItem
Expand Down Expand Up @@ -89,14 +91,15 @@ import type {
ImageTileData,
Resource
} from '@/types';
import { validateArtworkSchema, PanelResourceEnum } from '@/types';
import { validateArtworkSchema, PanelResourceEnum, validateArtistSchema } from '@/types';
import { ArrowLeftIcon } from '@heroicons/vue/24/outline';
import ResourceDetail from './ResourceDetail.vue';
import ArtworkDetailItem from './ArtworkDetailItem.vue';
import RelatedArtworkDetailItem from './RelatedArtworkDetailItem.vue';
import MoreArtworksByArtist from './MoreArtworksByArtist.vue';
import ArtworksIcon from './Icons/ArtworksIcon.vue';
import ArtistsIcon from './Icons/ArtistsIcon.vue';
import ArtistNote from './ArtistNote.vue';

const props = defineProps<{
resource: ApiResource;
Expand Down
4 changes: 3 additions & 1 deletion front-end/src/types/Artist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import ajv from '@/ajv';

export interface Artist {
Name: string;
remoteServerId?: string;
}

const ArtistSchema: JSONSchemaType<Artist> = {
type: 'object',
properties: {
Name: { type: 'string' }
Name: { type: 'string' },
remoteServerId: { type: 'string', nullable: true }
},
required: ['Name'],
additionalProperties: true
Expand Down
29 changes: 29 additions & 0 deletions front-end/src/types/RemoteServerResponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import type { JSONSchemaType } from 'ajv';
import ajv from '@/ajv';

interface RemoteServerResponse {
arches_resource_id: string;
arches_tileid: string;
id: string;
name: string;
note: string;
url: string;
}

const RemoteServerResponseSchema: JSONSchemaType<RemoteServerResponse> = {
type: 'object',
properties: {
arches_resource_id: { type: 'string' },
arches_tileid: { type: 'string' },
id: { type: 'string' },
name: { type: 'string' },
note: { type: 'string' },
url: { type: 'string' }
},
required: ['arches_resource_id', 'arches_tileid', 'id', 'name', 'note', 'url'],
additionalProperties: true
};

const validateRemoteServerResponseSchema = ajv.compile(RemoteServerResponseSchema);

export { type RemoteServerResponse, validateRemoteServerResponseSchema };
1 change: 1 addition & 0 deletions front-end/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export * from './ImageTileData';
export * from './MapResource';
export * from './Prefetch';
export * from './Photographer';
export * from './RemoteServerResponse';
export * from './Resource';
export * from './ResourceXResource';
export * from './ApiResourceRelation';
Expand Down