PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.16
Yatra – Travel Booking & Tour Operator Software v3.0.16
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
← All changes | resources/js/components/Tools.tsx +20 -10 3.0.3 → 3.0.16 View file →
@@ -4,8 +4,9 @@
4 4 import { Button } from "./ui/button";
5 5 import { Badge } from "./ui/badge";
6 6 import { Modal } from "./ui/modal";
7 7 import { __ } from "../lib/i18n";
8 +import { todayYmd } from "../lib/dateFormat";
8 9 import { apiService } from "../lib/api-client";
9 10 import {
10 11 Download,
11 12 Upload,
@@ -427,8 +428,9 @@
427 428 // Load system status when tab is system-status
428 429 if (activeTab === "system-status") {
429 430 loadSystemStatus();
430 431 }
432 + // eslint-disable-next-line react-hooks/exhaustive-deps
431 433 }, [activeTab]);
432 434
433 435 // Load logs
434 436 const loadLogs = async (type: string, page = 1) => {
@@ -518,9 +520,9 @@
518 520
519 521 // Handle actual export after data type selection - uses background job
520 522 const handleExport = async () => {
521 523 if (selectedExportData.length === 0) {
522 - alert("Please select at least one data type to export.");
524 + showToast(__("Please select at least one data type to export.", "yatra"), "error");
523 525 return;
524 526 }
525 527
526 528 setIsExporting(true);
@@ -535,9 +537,9 @@
535 537 const jobId = data.job_id;
536 538 pollJobStatus(jobId, "export");
537 539 } catch (error) {
538 540 console.error("Export error:", error);
539 - alert("Export failed. Please try again.");
541 + showToast(__("Export failed. Please try again.", "yatra"), "error");
540 542 setIsExporting(false);
541 543 }
542 544 };
543 545
@@ -576,10 +578,17 @@
576 578 setIsImporting(false);
577 579 }
578 580
579 581 if (jobData.status === "failed") {
580 - alert(
581 - `${type === "export" ? "Export" : "Import"} failed: ${jobData.error || "Unknown error"}`,
582 + showToast(
583 + (type === "export"
584 + ? __("Export failed: %s", "yatra")
585 + : __("Import failed: %s", "yatra")
586 + ).replace(
587 + "%s",
588 + jobData.error || __("Unknown error", "yatra"),
589 + ),
590 + "error",
582 591 );
583 592 }
584 593 }
585 594 }
@@ -606,9 +615,9 @@
606 615 const url = window.URL.createObjectURL(blob);
607 616 const a = document.createElement("a");
608 617 a.style.display = "none";
609 618 a.href = url;
610 - a.download = `yatra-export-${new Date().toISOString().split("T")[0]}.json`;
619 + a.download = `yatra-export-${todayYmd()}.json`;
611 620 document.body.appendChild(a);
612 621 a.click();
613 622 window.URL.revokeObjectURL(url);
614 623 document.body.removeChild(a);
@@ -618,9 +627,9 @@
618 627 // Clear the job after download and deletion
619 628 setExportJob(null);
620 629 } catch (error) {
621 630 console.error("Download error:", error);
622 - alert("Download failed. Please try again.");
631 + showToast(__("Download failed. Please try again.", "yatra"), "error");
623 632 }
624 633 };
625 634
626 635 // Show delete confirmation modal
@@ -644,9 +653,9 @@
644 653 // Immediately clear the export job from state to remove it from UI
645 654 setExportJob(null);
646 655 } catch (error) {
647 656 console.error("Delete error:", error);
648 - alert("Failed to delete export file.");
657 + showToast(__("Failed to delete export file.", "yatra"), "error");
649 658 }
650 659 };
651 660
652 661 // Load logs when logs tab becomes active
@@ -658,9 +667,9 @@
658 667
659 668 // Handle file processing (for both input and drop) - uses background job
660 669 const processFile = async (file: File) => {
661 670 if (selectedImportData.length === 0) {
662 - alert("Please select at least one data type to import.");
671 + showToast(__("Please select at least one data type to import.", "yatra"), "error");
663 672 return;
664 673 }
665 674
666 675 setIsImporting(true);
@@ -677,9 +686,9 @@
677 686 pollJobStatus(jobId, "import");
678 687 setSelectedImportData([]);
679 688 } catch (error) {
680 689 console.error("Import error:", error);
681 - alert("Import failed. Please check the file format and try again.");
690 + showToast(__("Import failed. Please check the file format and try again.", "yatra"), "error");
682 691 setIsImporting(false);
683 692 }
684 693 };
685 694
@@ -713,9 +722,9 @@
713 722 (file) => file.type === "application/json" || file.name.endsWith(".json"),
714 723 );
715 724
716 725 if (!jsonFile) {
717 - alert("Please drop a valid JSON file.");
726 + showToast(__("Please drop a valid JSON file.", "yatra"), "error");
718 727 return;
719 728 }
720 729
721 730 setPendingImportFile(jsonFile);
@@ -1178,8 +1187,9 @@
1178 1187 if (activeTab === "migration") {
1179 1188 stopMigrationPolling();
1180 1189 }
1181 1190 };
1191 + // eslint-disable-next-line react-hooks/exhaustive-deps
1182 1192 }, [activeTab, selectedLogType]);
1183 1193
1184 1194 return (
1185 1195 <div>