группировка по папкам + удоление источников
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-04-19 19:14:46 +10:00
parent 796769d270
commit 6e58337490
12 changed files with 63 additions and 16 deletions

View File

@@ -1,10 +1,10 @@
<script setup>
import { onMounted, ref, watch } from "vue";
import All_new_section from "./components/All_new_section.vue";
import General_section from "./components/General_section.vue";
import Setings from "./components/Setings.vue";
import Authe from "./components/Authe.vue";
import Istochnik from "./components/Istochnik.vue";
import All_new_section from "./components/Naw_bar/All_new_section.vue";
import General_section from "./components/News_section/General_section.vue";
import Setings from "./components/Settings_section/Setings.vue";
import Authe from "./components/Autherization/Authe.vue";
import Istochnik from "./components/Istochnik_section/Istochnik.vue";
// Инициализация темы при загрузке приложения
onMounted(() => {

View File

@@ -75,7 +75,11 @@
<!-- Список источников -->
<div class="p-4 grid gap-2 grid-cols-1 lg:grid-cols-2 2xl:grid-cols-3">
<div v-for="source in filteredSources" :key="source.url" class="mb-4">
<Istochnik_one_kard :source="source" />
<Istochnik_one_kard
:source="source"
@sourceStarted="handleSourceStarted"
@sourceDeleted="handleSourceDeleted"
/>
</div>
</div>
</div>
@@ -146,6 +150,14 @@ const onfilterItems = (filterValue) => {
console.log("Фильтр:", filterValue);
};
const handleSourceStarted = (url) => {
console.log("Парсинг запущен для:", url);
};
const handleSourceDeleted = (deletedUrl) => {
sources.value = sources.value.filter((source) => source.url !== deletedUrl);
};
onMounted(() => {
isDarkMode.value = document.documentElement.classList.contains("dark");
const mutationObserver = new MutationObserver(() => {

View File

@@ -19,13 +19,22 @@
class="flex-1 m-1 h-12 dark:bg-gray-900 border-slate-100 shadow rounded-xl p-3 max-w-20"
/>
</dev>
<button
@click="startParsing"
:disabled="isLoading"
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" }}
</button>
<div class="">
<button
@click="deleteParsing"
:disabled="isDeleting"
class="w-9 h-11 m-1 bg-rose-600 hover:bg-rose-800 shadow text-white rounded-xl cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed"
>
X
</button>
<button
@click="startParsing"
:disabled="isLoading"
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" }}
</button>
</div>
</div>
</template>
@@ -41,9 +50,10 @@ const props = defineProps({
},
});
const emit = defineEmits(["sourceStarted"]);
const emit = defineEmits(["sourceStarted", "sourceDeleted"]);
const isLoading = ref(false);
const isDeleting = ref(false);
const displayUrl = computed({
get: () => props.source.url || "",
@@ -68,7 +78,7 @@ const startParsing = async () => {
isLoading.value = true;
try {
await axios.post("https://allowlgroup.ru/api/8001/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,
promt: props.source.promt,
@@ -83,4 +93,30 @@ const startParsing = async () => {
isLoading.value = false;
}
};
const deleteParsing = async () => {
// if (!props.source.url) {
// alert("URL источника не указан");
// return;
// }
// if (!confirm(`Вы уверены, что хотите удалить источник "${props.source.url}"?`)) {
// return;
// }
isDeleting.value = true;
try {
await axios.delete(
// "https://allowlgroup.ru/api/8001/delete_sources",
"http://127.0.0.1:8001/delete_sources",
{ params: { url: props.source.url } }
);
emit("sourceDeleted", props.source.url);
} catch (error) {
console.error("Ошибка при удалении задачи:", error);
} finally {
isDeleting.value = false;
}
};
</script>

View File

@@ -202,7 +202,6 @@ const delete_row = async (id) => {
const response = await axios.delete(
`https://allowlgroup.ru/api/8001/delete_task/${id}`,
);
console.log(response.data);
loadTasks();
} catch (error) {
console.error("Ошибка при удалении задачи:", error);