парсер всех источников добавлен, без адаптации фронтента
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -45,7 +45,7 @@
|
|||||||
<input
|
<input
|
||||||
v-model="newSourceUrl"
|
v-model="newSourceUrl"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="введите url источника"
|
placeholder="https://example.com"
|
||||||
class="flex-1 h-12 dark:bg-gray-900 border-slate-100 shadow rounded-xl p-3 min-w-0"
|
class="flex-1 h-12 dark:bg-gray-900 border-slate-100 shadow rounded-xl p-3 min-w-0"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Список источников -->
|
<!-- Список источников -->
|
||||||
<div class="p-4">
|
<div class="p-4 xl:flex gap-2 justify-between">
|
||||||
<div
|
<div
|
||||||
v-for="source in filteredSources"
|
v-for="source in filteredSources"
|
||||||
:key="source.url"
|
:key="source.url"
|
||||||
|
|||||||
@@ -1,27 +1,28 @@
|
|||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
class="flex flex-row w-full lg:w-auto gap-2 p-2 bg-gray-50 dark:bg-gray-700 rounded-xl border border-gray-200 dark:border-gray-600"
|
class="flex flex-row justify-between w-full lg:w-auto gap-2 p-2 bg-gray-100 shadow dark:bg-gray-800 rounded-xl border border-gray-200 dark:border-gray-600"
|
||||||
>
|
>
|
||||||
<input
|
<dev class="">
|
||||||
v-model="displayUrl"
|
<input
|
||||||
type="text"
|
v-model="displayUrl"
|
||||||
placeholder="URL источника"
|
type="text"
|
||||||
readonly
|
placeholder="URL источника"
|
||||||
class="flex-1 h-12 dark:bg-gray-900 border-slate-100 shadow rounded-xl p-3 min-w-0"
|
readonly
|
||||||
/>
|
class="flex-1 m-1 h-12 dark:bg-gray-900 border-slate-100 shadow rounded-xl p-3 min-w-0"
|
||||||
|
/>
|
||||||
<input
|
|
||||||
v-model="displayPromt"
|
<input
|
||||||
type="text"
|
v-model="displayPromt"
|
||||||
placeholder="Промт"
|
type="text"
|
||||||
readonly
|
placeholder="Промт"
|
||||||
class="flex-1 h-12 dark:bg-gray-900 border-slate-100 shadow rounded-xl p-3 min-w-0"
|
readonly
|
||||||
/>
|
class="flex-1 m-1 h-12 dark:bg-gray-900 border-slate-100 shadow rounded-xl p-3 max-w-20"
|
||||||
|
/>
|
||||||
|
</dev>
|
||||||
<button
|
<button
|
||||||
@click="startParsing"
|
@click="startParsing"
|
||||||
:disabled="isLoading"
|
:disabled="isLoading"
|
||||||
class="w-20 h-12 bg-green-600 text-white px-2 rounded-xl shadow hover:bg-green-700 cursor-pointer whitespace-nowrap disabled:opacity-50 disabled:cursor-not-allowed"
|
class="w-25 h-11 m-1 dark:bg-orange-500 hover:dark:bg-orange-600 shadow text-white bg-sky-700 hover:bg-sky-900 rounded-xl px-2 cursor-pointer whitespace-nowrap disabled:opacity-50 disabled:cursor-not-allowed"
|
||||||
>
|
>
|
||||||
{{ isLoading ? "..." : "Start" }}
|
{{ isLoading ? "..." : "Start" }}
|
||||||
</button>
|
</button>
|
||||||
@@ -36,8 +37,8 @@ const props = defineProps({
|
|||||||
source: {
|
source: {
|
||||||
type: Object,
|
type: Object,
|
||||||
required: true,
|
required: true,
|
||||||
default: () => ({ url: "", promt: "" })
|
default: () => ({ url: "", promt: "" }),
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const emit = defineEmits(["sourceStarted"]);
|
const emit = defineEmits(["sourceStarted"]);
|
||||||
@@ -48,14 +49,14 @@ const displayUrl = computed({
|
|||||||
get: () => props.source.url || "",
|
get: () => props.source.url || "",
|
||||||
set: (val) => {
|
set: (val) => {
|
||||||
// Только для чтения
|
// Только для чтения
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const displayPromt = computed({
|
const displayPromt = computed({
|
||||||
get: () => props.source.promt || "",
|
get: () => props.source.promt || "",
|
||||||
set: (val) => {
|
set: (val) => {
|
||||||
// Только для чтения
|
// Только для чтения
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const startParsing = async () => {
|
const startParsing = async () => {
|
||||||
@@ -65,13 +66,14 @@ const startParsing = async () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await axios.post("https://allowlgroup.ru/api/parser_all", {
|
// await axios.post("https://allowlgroup.ru/api/8001/parser_all", {
|
||||||
|
await axios.post("http://127.0.0.1:8001/parser_all", {
|
||||||
url: props.source.url,
|
url: props.source.url,
|
||||||
promt: props.source.promt
|
promt: props.source.promt,
|
||||||
});
|
});
|
||||||
|
|
||||||
emit("sourceStarted", props.source.url);
|
emit("sourceStarted", props.source.url);
|
||||||
alert(`Парсинг для ${props.source.url} запущен`);
|
alert(`Парсинг для ${props.source.url} запущен`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -81,4 +83,4 @@ const startParsing = async () => {
|
|||||||
isLoading.value = false;
|
isLoading.value = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user