From 1d423adc12f8af52c89113ad33c6e4a3064b78ee Mon Sep 17 00:00:00 2001 From: F4ilji Date: Sun, 5 Jul 2026 02:52:50 +0500 Subject: [PATCH] feat(vikon): add part selection UI to Vue dashboard --- .../UI/WEB/Controllers/VikonController.php | 2 + .../js/Pages/Dashboard/VikonUpdates/Index.vue | 73 ++++++++++++++++--- 2 files changed, 65 insertions(+), 10 deletions(-) diff --git a/app/Containers/VikonIntegration/UI/WEB/Controllers/VikonController.php b/app/Containers/VikonIntegration/UI/WEB/Controllers/VikonController.php index ed23a50..ebb54bb 100644 --- a/app/Containers/VikonIntegration/UI/WEB/Controllers/VikonController.php +++ b/app/Containers/VikonIntegration/UI/WEB/Controllers/VikonController.php @@ -41,6 +41,7 @@ class VikonController extends Controller 'is_authenticated' => $isAuth, 'current_version' => config('vikon.current_version'), 'modules' => config('vikon.modules'), + 'parts' => config('vikon.parts'), 'vikon_api_domain' => config('vikon.api_domain'), 'vikon_client_id' => config('vikon.client_id'), ]); @@ -74,6 +75,7 @@ class VikonController extends Controller 'is_authenticated' => $isAuth, 'current_version' => config('vikon.current_version'), 'modules' => config('vikon.modules'), + 'parts' => config('vikon.parts'), 'vikon_api_domain' => config('vikon.api_domain'), 'vikon_client_id' => config('vikon.client_id'), ]); diff --git a/resources/js/Pages/Dashboard/VikonUpdates/Index.vue b/resources/js/Pages/Dashboard/VikonUpdates/Index.vue index 551d8c3..341ad93 100644 --- a/resources/js/Pages/Dashboard/VikonUpdates/Index.vue +++ b/resources/js/Pages/Dashboard/VikonUpdates/Index.vue @@ -67,18 +67,34 @@

Модули для обновления

-
-
- -
-

{{ mod.name }}

-

ID: {{ id }}

+
+
+
+ +
+

{{ mod.name }}

+

ID: {{ id }}

+
+ +
+
+ +
-
@@ -95,6 +111,13 @@

{{ progress }}%

+ +
+

+ {{ partResult.message }} +

+
+
@@ -126,6 +149,7 @@ const props = defineProps({ is_authenticated: Boolean, current_version: String, modules: Object, + parts: Object, vikon_api_domain: String, vikon_client_id: String, }); @@ -139,6 +163,9 @@ const progress = ref(0); const updateError = ref(null); const versionInfo = ref({ current_version: props.current_version, has_update: false, latest_version: null }); const accessInfo = ref({ has_access: false, error: null }); +const selectedPart = ref({}); +const updatingPart = ref(null); +const partResult = ref(null); const authUrl = computed(() => { const redirect = encodeURIComponent(`${window.location.origin}/vikon_core/update/index.php`); @@ -234,6 +261,32 @@ async function updateModule(moduleId) { } } +async function updatePart(moduleId, part) { + if (!part) return; + + updatingPart.value = `${moduleId}-${part}`; + partResult.value = null; + + try { + const res = await fetch('/dashboard/vikon-updates/update-part', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content, + 'Accept': 'application/json', + }, + body: JSON.stringify({ module_id: moduleId, part }), + }); + + const data = await res.json(); + partResult.value = data; + } catch (e) { + partResult.value = { success: false, message: e.message }; + } finally { + updatingPart.value = null; + } +} + async function logout() { try { await axios.post(route('dashboard.vikon-updates.logout'));