Skip to content

Commit f6c2508

Browse files
committed
Big refactor: getting rid of comnposable passed as arguments
1 parent 2467a37 commit f6c2508

18 files changed

Lines changed: 62 additions & 62 deletions

File tree

admin/components/ai_config/AIConfig.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
}"
2222
:defaultSort="{'prop': 'name'}">
2323
<template v-slot:extra-card-bottom="{item}">
24-
<el-button class="bottom-card-button" @click="callRagReindex($axios, item.id, $t)" :disabled="item.disabled || item.index_up_to_date">
24+
<el-button class="bottom-card-button" @click="callRagReindex(item.id, $t)" :disabled="item.disabled || item.index_up_to_date">
2525
<span>{{ $t("reindex") }}</span>
2626
<el-icon>
2727
<Refresh/>
@@ -113,7 +113,7 @@ import {callRagReindex} from "~/utils/index.js";
113113
const {$axios} = useNuxtApp();
114114
const itemsStore = useItemsStore()
115115
const itemType = ref("rag-configs")
116-
await itemsStore.loadSchema($axios)
116+
await itemsStore.loadSchema()
117117
118118
</script>
119119

admin/components/dashboard/Dashboard.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ const sdks = ref([]);
8484
8585
async function initData() {
8686
itemsStore.loading = true;
87-
itemSchemaRAG.value = await itemsStore.getSchemaDef($axios, RAGAPIUrl.value);
88-
itemSchemaWidget.value = await itemsStore.getSchemaDef($axios, WidgetAPIUrl.value);
89-
itemSchemaSDK.value = await itemsStore.getSchemaDef($axios, SDKAPIUrl.value);
87+
itemSchemaRAG.value = await itemsStore.getSchemaDef(RAGAPIUrl.value);
88+
itemSchemaWidget.value = await itemsStore.getSchemaDef(WidgetAPIUrl.value);
89+
itemSchemaSDK.value = await itemsStore.getSchemaDef(SDKAPIUrl.value);
9090
itemsStore.loading = false;
9191
}
9292

admin/components/data/Data.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,12 @@ import WriteViewDataSources from "~/components/data/WriteViewDataSources.vue";
119119
120120
const password = ref(null)
121121
122-
const {$axios} = useNuxtApp();
123-
124122
const itemsStore = useItemsStore()
125123
126124
const itemType = ref("knowledge-base")
127125
const dataSources = ref(null)
128126
129-
await itemsStore.loadSchema($axios)
127+
await itemsStore.loadSchema()
130128
131129
132130
function goToKIs(kb_id) {

admin/components/data/WriteViewDataSources.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ const { t } = useI18n();
7878
7979
const endpoint = ref("/back/api/language-model/data-sources/")
8080
const itemsStore = useItemsStore()
81-
const {$axios} = useNuxtApp();
8281
const dataSources = ref([])
8382
const dataSourceForms = ref(null)
8483
const deleteDialogVisible = ref(false)
@@ -88,7 +87,7 @@ const deletingIndex = ref(undefined)
8887
defineExpose({submit})
8988
9089
if (itemsStore.editing) {
91-
dataSources.value = (await itemsStore.retrieveItems($axios, endpoint.value, {
90+
dataSources.value = (await itemsStore.retrieveItems(endpoint.value, {
9291
limit: 0,
9392
offset: 0,
9493
knowledge_base__id: itemsStore.editing
@@ -142,7 +141,7 @@ function setDeleteDataSource(id, index) {
142141
}
143142
async function deleteDataSource() {
144143
if(deletingDataSourceID.value !== undefined) {
145-
await itemsStore.deleteItem($axios, endpoint.value, deletingDataSourceID.value, false)
144+
await itemsStore.deleteItem(endpoint.value, deletingDataSourceID.value, false)
146145
dataSources.value.splice(deletingIndex.value, 1)
147146
deleteDialogVisible.value = false
148147
}

admin/components/generic/Card.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function createTitle(item) {
9191
}
9292
9393
async function delItem() {
94-
await deleteItem(deleting.value, itemsStore, props.apiUrl, t, $axios);
94+
await deleteItem(deleting.value, itemsStore, props.apiUrl);
9595
deleting.value = undefined;
9696
deleteDialogVisible.value = false;
9797
emit("click-delete", props.item.id);

admin/components/generic/InputSelect.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const isRef = computed(() => {
101101
onMounted(async () => {
102102
if (props.filterSchema) {
103103
if (props.filterSchema.type === "ref") {
104-
let items = await itemsStore.retrieveItems($axios, props.filterSchema.endpoint, {}, false)
104+
let items = await itemsStore.retrieveItems(props.filterSchema.endpoint, {}, false)
105105
items = JSON.parse(JSON.stringify(items))
106106
items.results = items.results.map((item) => {
107107
return {
@@ -137,7 +137,7 @@ function remoteSearch(query) {
137137
return
138138
}
139139
if (ref) {
140-
itemsStore.retrieveItems($axios, url, {search: query, limit: 0, offset: 0, ordering: undefined}, false).then((items) => {
140+
itemsStore.retrieveItems(url, {search: query, limit: 0, offset: 0, ordering: undefined}, false).then((items) => {
141141
items = JSON.parse(JSON.stringify(items))
142142
items.results = items.results.map((item) => {
143143
return {
@@ -169,7 +169,7 @@ useIntersectionObserver(lastElement, async ([{ isIntersecting }], observerElemen
169169
let url = next.split('?')[0]
170170
let params = next.split('?')[1]
171171
params = Object.fromEntries(new URLSearchParams(params))
172-
let items = await itemsStore.retrieveItems($axios, url, params)
172+
let items = await itemsStore.retrieveItems(url, params)
173173
items = JSON.parse(JSON.stringify(items))
174174
items.results = items.results.map((item) => {
175175
return {

admin/components/generic/Pagination.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
<script lang="ts" setup>
2121
import {useItemsStore} from "~/store/items.js";
2222
import {ref} from 'vue'
23-
const {$axios} = useNuxtApp();
2423
const emit = defineEmits(['change'])
2524
2625
const props = defineProps({

admin/components/generic/ReadView.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ import {storeToRefs} from 'pinia'
118118
119119
const { t } = useI18n();
120120
const itemsStore = useItemsStore()
121-
const {$axios} = useNuxtApp();
122121
const deleting = ref(undefined)
123122
const deleteDialogVisible = ref(false)
124123
const {schema} = storeToRefs(itemsStore)
@@ -201,7 +200,7 @@ function initStoreWatchers() {
201200
202201
async function initData() {
203202
itemsStore.loading = true
204-
itemSchema.value = await itemsStore.getSchemaDef($axios, props.apiUrl)
203+
itemSchema.value = await itemsStore.getSchemaDef(props.apiUrl)
205204
sortChange(props.defaultSort)
206205
await loadItems()
207206
initStoreWatchers()
@@ -217,7 +216,7 @@ async function loadItems() {
217216
const params = {}
218217
if (props.defaultFilters)
219218
Object.assign(params, props.defaultFilters)
220-
await itemsStore.retrieveItems($axios, props.apiUrl, params)
219+
await itemsStore.retrieveItems(props.apiUrl, params)
221220
await resolveTableRowProps(itemsStore.items[props.apiUrl]?.results)
222221
itemsStore.loading = false
223222
}
@@ -253,7 +252,7 @@ function sortChange({column, prop, order}) {
253252
254253
255254
async function delItem() {
256-
await deleteItem(deleting.value, itemsStore, props.apiUrl, t, $axios);
255+
await deleteItem(deleting.value, itemsStore, props.apiUrl);
257256
deleting.value = undefined;
258257
deleteDialogVisible.value = false
259258
}

admin/components/generic/WriteView.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ const allExcludeFields = computed(() => {
244244
})
245245
async function initData() {
246246
itemsStore.loading = true
247-
itemSchema.value = await itemsStore.getSchemaDef($axios, props.apiUrl)
247+
itemSchema.value = await itemsStore.getSchemaDef(props.apiUrl)
248248
itemsStore.loading = false
249249
}
250250
@@ -270,7 +270,7 @@ initializeFormValues()
270270
async function initializeFormValues() {
271271
if (props.itemId !== undefined) {
272272
itemsStore.loading = true
273-
const data = await itemsStore.retrieveItems($axios, props.apiUrl, {
273+
const data = await itemsStore.retrieveItems(props.apiUrl, {
274274
id: props.itemId,
275275
limit: 0,
276276
offset: 0
@@ -369,7 +369,7 @@ async function submitForm(extraVals = {}, callback = undefined) {
369369
function deleteItem() {
370370
try {
371371
itemsStore.loading = true
372-
itemsStore.deleteItem($axios, props.apiUrl, props.itemId)
372+
itemsStore.deleteItem(props.apiUrl, props.itemId)
373373
deleteDialogVisible.value = undefined
374374
itemsStore.stateToRead()
375375
itemsStore.loading = false

admin/components/generic/filters/Filters.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@
3333
<script lang="ts" setup>
3434
import {useItemsStore} from "~/store/items.js";
3535
import InputSelect from "~/components/generic/InputSelect.vue";
36-
37-
const {$axios} = useNuxtApp();
3836
const itemsStore = useItemsStore()
3937
const form = ref({})
4038
const emit = defineEmits(['change'])

0 commit comments

Comments
 (0)