1
0
mirror of https://github.com/TandoorRecipes/recipes.git synced 2026-01-11 00:58:32 -05:00

api settings linked browser and docs

This commit is contained in:
vabene1111
2025-06-06 14:50:29 +02:00
parent d1a69dac90
commit 23c4c2e543
2 changed files with 49 additions and 24 deletions

View File

@@ -1,7 +1,7 @@
<template> <template>
<v-col cols="12" md="6" lg="4"> <v-col :cols="props.cols" :md="props.md" :lg="props.lg">
<v-card :prepend-icon="props.prependIcon" :title="props.title" :subtitle="props.subtitle" variant="outlined" elevation="1" <v-card :prepend-icon="props.prependIcon" :title="props.title" :subtitle="props.subtitle" variant="outlined" elevation="1"
:to="props.to" :to="props.to" :link="isLink" :href="props.href"
append-icon="fa-solid fa-arrow-right"> append-icon="fa-solid fa-arrow-right">
</v-card> </v-card>
</v-col> </v-col>
@@ -9,8 +9,7 @@
<script setup lang="ts"> <script setup lang="ts">
import {EditorSupportedModels, GenericModel, getGenericModelFromString} from "@/types/Models.ts"; import {computed, onBeforeMount, PropType, ref, watch} from "vue";
import {onBeforeMount, PropType, ref, watch} from "vue";
import {useI18n} from "vue-i18n"; import {useI18n} from "vue-i18n";
import type { RouteLocationRaw } from 'vue-router'; import type { RouteLocationRaw } from 'vue-router';
@@ -20,10 +19,18 @@ const props = defineProps({
prependIcon: {type: String, default: ''}, prependIcon: {type: String, default: ''},
title: {type: String, default: ''}, title: {type: String, default: ''},
subtitle: {type: String, default: ''}, subtitle: {type: String, default: ''},
to: {type: {} as PropType<RouteLocationRaw> } to: {type: {} as PropType<RouteLocationRaw> },
href: {type: String, default: ''},
cols: {type: Number, default: 12 },
md: {type: Number, default: 6 },
lg: {type: Number, default: 4 },
}) })
const isLink = computed(() => {
return props.href != '' && props.to == undefined
})
</script> </script>

View File

@@ -3,13 +3,26 @@
<p class="text-h6">{{ $t('API') }}</p> <p class="text-h6">{{ $t('API') }}</p>
<v-divider class="mb-3"></v-divider> <v-divider class="mb-3"></v-divider>
<v-row>
<database-link-col prepend-icon="fa-solid fa-terminal" :href="useDjangoUrls().getDjangoUrl('api')" :lg="6" :title="$t('API Browser')"></database-link-col>
<database-link-col prepend-icon="fa-solid fa-laptop-code" :href="useDjangoUrls().getDjangoUrl('/docs/api/')" :lg="6"
:title="$t('API Dokumentation')"></database-link-col>
</v-row>
<v-row>
<v-col>
<v-alert color="error" variant="tonal"> <v-alert color="error" variant="tonal">
The API is made for developers to interact with the application. The API is made for developers to interact with the application.
It is possible to break things using the API so be careful and create a backup first. It is possible to break things using the API so be careful and create a backup first.
The API definition can and will change in the future, make sure to read the changelog to spot changes early The API definition can and will change in the future, make sure to read the changelog to spot changes early
on. on.
</v-alert> </v-alert>
</v-col>
</v-row>
<v-row>
<v-col>
Authentication works by proving the word <code>Bearer</code> followed by an API Token as a request Authorization Authentication works by proving the word <code>Bearer</code> followed by an API Token as a request Authorization
header as shown below. <br/> header as shown below. <br/>
<code>Authorization: Bearer TOKEN</code> -or-<br/> <code>Authorization: Bearer TOKEN</code> -or-<br/>
@@ -24,6 +37,9 @@
it. it.
<v-alert color="warning" variant="tonal">Make sure to save your token after creation as they cannot be viewed afterwards.</v-alert> <v-alert color="warning" variant="tonal">Make sure to save your token after creation as they cannot be viewed afterwards.</v-alert>
</v-col>
</v-row>
<v-btn prepend-icon="$create" color="create" class="mt-2">{{ $t('New') }} <v-btn prepend-icon="$create" color="create" class="mt-2">{{ $t('New') }}
<model-edit-dialog model="AccessToken" @create="loadAccessTokens()" :close-after-create="false"></model-edit-dialog> <model-edit-dialog model="AccessToken" @create="loadAccessTokens()" :close-after-create="false"></model-edit-dialog>
@@ -57,6 +73,8 @@ import {AccessToken, ApiApi} from "@/openapi";
import {ErrorMessageType, useMessageStore} from "@/stores/MessageStore"; import {ErrorMessageType, useMessageStore} from "@/stores/MessageStore";
import {DateTime} from "luxon"; import {DateTime} from "luxon";
import ModelEditDialog from "@/components/dialogs/ModelEditDialog.vue"; import ModelEditDialog from "@/components/dialogs/ModelEditDialog.vue";
import DatabaseLinkCol from "@/components/display/DatabaseLinkCol.vue";
import {useDjangoUrls} from "@/composables/useDjangoUrls.ts";
const accessTokenList = ref([] as AccessToken[]) const accessTokenList = ref([] as AccessToken[])