группировка по папкам + удоление источников
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:
10
src/App.vue
10
src/App.vue
@@ -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(() => {
|
||||||
|
|||||||
@@ -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(() => {
|
||||||
@@ -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"
|
class="flex-1 m-1 h-12 dark:bg-gray-900 border-slate-100 shadow rounded-xl p-3 max-w-20"
|
||||||
/>
|
/>
|
||||||
</dev>
|
</dev>
|
||||||
<button
|
<div class="">
|
||||||
@click="startParsing"
|
<button
|
||||||
:disabled="isLoading"
|
@click="deleteParsing"
|
||||||
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"
|
: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"
|
||||||
{{ isLoading ? "..." : "Start" }}
|
>
|
||||||
</button>
|
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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -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 || "",
|
||||||
@@ -68,7 +78,7 @@ const startParsing = async () => {
|
|||||||
isLoading.value = true;
|
isLoading.value = true;
|
||||||
|
|
||||||
try {
|
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", {
|
// 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,
|
||||||
@@ -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>
|
||||||
@@ -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);
|
||||||
Reference in New Issue
Block a user