-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
97 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
from fastapi import APIRouter | ||
|
||
from backend.api.endpoints import analyze, lookup, submit | ||
from backend.api.endpoints import analyze, cache, lookup, submit | ||
|
||
api_router = APIRouter() | ||
api_router.include_router(analyze.router, prefix="/analyze", tags=["analyze"]) | ||
api_router.include_router(submit.router, prefix="/submit", tags=["submit"]) | ||
api_router.include_router(lookup.router, prefix="/lookup", tags=["lookup"]) | ||
api_router.include_router(cache.router, prefix="/cache", tags=["cache"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from fastapi import APIRouter, HTTPException, status | ||
|
||
from backend import deps, settings | ||
|
||
router = APIRouter() | ||
|
||
|
||
@router.get( | ||
"/", | ||
response_description="Return cache keys", | ||
summary="Get analysis cache keys", | ||
description="Try to get analysis cache keys", | ||
) | ||
async def cache_keys(optional_redis: deps.OptionalRedis) -> list[str]: | ||
if optional_redis is None: | ||
raise HTTPException( | ||
status_code=status.HTTP_501_NOT_IMPLEMENTED, | ||
detail="Redis cache is not enabled", | ||
) | ||
|
||
return optional_redis.hkeys(settings.REDIS_FIELD) # type: ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<template> | ||
<div class="box"> | ||
<h2 class="is-size-4 has-text-weight-bold middle">Cache</h2> | ||
<Loading v-if="getCacheKeysTask.isRunning"></Loading> | ||
<ErrorMessage :error="getCacheKeysTask.last?.error" v-if="getCacheKeysTask.isError" /> | ||
<div class="block" v-if="getCacheKeysTask.last?.value && !getCacheKeysTask.last.isRunning"> | ||
<div class="buttons"> | ||
<router-link | ||
class="button is-link is-light" | ||
:to="{ name: 'Lookup', params: { id: key } }" | ||
v-for="key in getCacheKeysTask.last.value" | ||
:key="key" | ||
>{{ key }}</router-link | ||
> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent, onMounted } from 'vue' | ||
import { useAsyncTask } from 'vue-concurrency' | ||
import { API } from '@/api' | ||
import ErrorMessage from '@/components/ErrorMessage.vue' | ||
import Loading from '@/components/Loading.vue' | ||
export default defineComponent({ | ||
name: 'HomeView', | ||
components: { | ||
ErrorMessage, | ||
Loading | ||
}, | ||
setup() { | ||
const getCacheKeysTask = useAsyncTask<string[], []>(async () => { | ||
return await API.getCacheKeys() | ||
}) | ||
onMounted(async () => { | ||
await getCacheKeysTask.perform() | ||
}) | ||
return { getCacheKeysTask } | ||
} | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<template> | ||
<Cache /> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { defineComponent } from 'vue' | ||
import Cache from '@/components/Cache.vue' | ||
export default defineComponent({ | ||
name: 'CacheView', | ||
components: { Cache }, | ||
setup() {} | ||
}) | ||
</script> |