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 -12 3.0.5.1 → 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,9 +428,9 @@
427 428 // Load system status when tab is system-status
428 429 if (activeTab === "system-status") {
429 430 loadSystemStatus();
430 431 }
431 - // eslint-disable-next-line react-hooks/exhaustive-deps
432 + // eslint-disable-next-line react-hooks/exhaustive-deps
432 433 }, [activeTab]);
433 434
434 435 // Load logs
435 436 const loadLogs = async (type: string, page = 1) => {
@@ -519,9 +520,9 @@
519 520
520 521 // Handle actual export after data type selection - uses background job
521 522 const handleExport = async () => {
522 523 if (selectedExportData.length === 0) {
523 - alert("Please select at least one data type to export.");
524 + showToast(__("Please select at least one data type to export.", "yatra"), "error");
524 525 return;
525 526 }
526 527
527 528 setIsExporting(true);
@@ -536,9 +537,9 @@
536 537 const jobId = data.job_id;
537 538 pollJobStatus(jobId, "export");
538 539 } catch (error) {
539 540 console.error("Export error:", error);
540 - alert("Export failed. Please try again.");
541 + showToast(__("Export failed. Please try again.", "yatra"), "error");
541 542 setIsExporting(false);
542 543 }
543 544 };
544 545
@@ -577,10 +578,17 @@
577 578 setIsImporting(false);
578 579 }
579 580
580 581 if (jobData.status === "failed") {
581 - alert(
582 - `${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",
583 591 );
584 592 }
585 593 }
586 594 }
@@ -607,9 +615,9 @@
607 615 const url = window.URL.createObjectURL(blob);
608 616 const a = document.createElement("a");
609 617 a.style.display = "none";
610 618 a.href = url;
611 - a.download = `yatra-export-${new Date().toISOString().split("T")[0]}.json`;
619 + a.download = `yatra-export-${todayYmd()}.json`;
612 620 document.body.appendChild(a);
613 621 a.click();
614 622 window.URL.revokeObjectURL(url);
615 623 document.body.removeChild(a);
@@ -619,9 +627,9 @@
619 627 // Clear the job after download and deletion
620 628 setExportJob(null);
621 629 } catch (error) {
622 630 console.error("Download error:", error);
623 - alert("Download failed. Please try again.");
631 + showToast(__("Download failed. Please try again.", "yatra"), "error");
624 632 }
625 633 };
626 634
627 635 // Show delete confirmation modal
@@ -645,9 +653,9 @@
645 653 // Immediately clear the export job from state to remove it from UI
646 654 setExportJob(null);
647 655 } catch (error) {
648 656 console.error("Delete error:", error);
649 - alert("Failed to delete export file.");
657 + showToast(__("Failed to delete export file.", "yatra"), "error");
650 658 }
651 659 };
652 660
653 661 // Load logs when logs tab becomes active
@@ -659,9 +667,9 @@
659 667
660 668 // Handle file processing (for both input and drop) - uses background job
661 669 const processFile = async (file: File) => {
662 670 if (selectedImportData.length === 0) {
663 - alert("Please select at least one data type to import.");
671 + showToast(__("Please select at least one data type to import.", "yatra"), "error");
664 672 return;
665 673 }
666 674
667 675 setIsImporting(true);
@@ -678,9 +686,9 @@
678 686 pollJobStatus(jobId, "import");
679 687 setSelectedImportData([]);
680 688 } catch (error) {
681 689 console.error("Import error:", error);
682 - 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");
683 691 setIsImporting(false);
684 692 }
685 693 };
686 694
@@ -714,9 +722,9 @@
714 722 (file) => file.type === "application/json" || file.name.endsWith(".json"),
715 723 );
716 724
717 725 if (!jsonFile) {
718 - alert("Please drop a valid JSON file.");
726 + showToast(__("Please drop a valid JSON file.", "yatra"), "error");
719 727 return;
720 728 }
721 729
722 730 setPendingImportFile(jsonFile);
@@ -1179,9 +1187,9 @@
1179 1187 if (activeTab === "migration") {
1180 1188 stopMigrationPolling();
1181 1189 }
1182 1190 };
1183 - // eslint-disable-next-line react-hooks/exhaustive-deps
1191 + // eslint-disable-next-line react-hooks/exhaustive-deps
1184 1192 }, [activeTab, selectedLogType]);
1185 1193
1186 1194 return (
1187 1195 <div>