группировка по папкам + удоление источников
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> <script setup>
import { onMounted, ref, watch } from "vue"; import { onMounted, ref, watch } from "vue";
import All_new_section from "./components/All_new_section.vue"; import All_new_section from "./components/Naw_bar/All_new_section.vue";
import General_section from "./components/General_section.vue"; import General_section from "./components/News_section/General_section.vue";
import Setings from "./components/Setings.vue"; import Setings from "./components/Settings_section/Setings.vue";
import Authe from "./components/Authe.vue"; import Authe from "./components/Autherization/Authe.vue";
import Istochnik from "./components/Istochnik.vue"; import Istochnik from "./components/Istochnik_section/Istochnik.vue";
// Инициализация темы при загрузке приложения // Инициализация темы при загрузке приложения
onMounted(() => { 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 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"> <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> </div>
</div> </div>
@@ -146,6 +150,14 @@ const onfilterItems = (filterValue) => {
console.log("Фильтр:", filterValue); console.log("Фильтр:", filterValue);
}; };
const handleSourceStarted = (url) => {
console.log("Парсинг запущен для:", url);
};
const handleSourceDeleted = (deletedUrl) => {
sources.value = sources.value.filter((source) => source.url !== deletedUrl);
};
onMounted(() => { onMounted(() => {
isDarkMode.value = document.documentElement.classList.contains("dark"); isDarkMode.value = document.documentElement.classList.contains("dark");
const mutationObserver = new MutationObserver(() => { const mutationObserver = new MutationObserver(() => {

View File

@@ -19,6 +19,14 @@
class="flex-1 m-1 h-12 dark:bg-gray-900 border-slate-100 shadow rounded-xl p-3 max-w-20" class="flex-1 m-1 h-12 dark:bg-gray-900 border-slate-100 shadow rounded-xl p-3 max-w-20"
/> />
</dev> </dev>
<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 <button
@click="startParsing" @click="startParsing"
:disabled="isLoading" :disabled="isLoading"
@@ -27,6 +35,7 @@
{{ isLoading ? "..." : "Start" }} {{ isLoading ? "..." : "Start" }}
</button> </button>
</div> </div>
</div>
</template> </template>
<script setup> <script setup>
@@ -41,9 +50,10 @@ const props = defineProps({
}, },
}); });
const emit = defineEmits(["sourceStarted"]); const emit = defineEmits(["sourceStarted", "sourceDeleted"]);
const isLoading = ref(false); const isLoading = ref(false);
const isDeleting = ref(false);
const displayUrl = computed({ const displayUrl = computed({
get: () => props.source.url || "", get: () => props.source.url || "",
@@ -83,4 +93,30 @@ const startParsing = async () => {
isLoading.value = false; 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> </script>

View File

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