underpost 2.8.1 → 2.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/.dockerignore +1 -0
  2. package/.github/workflows/ghpkg.yml +19 -49
  3. package/.github/workflows/npmpkg.yml +67 -0
  4. package/.github/workflows/publish.yml +5 -5
  5. package/.github/workflows/pwa-microservices-template.page.yml +12 -4
  6. package/.github/workflows/pwa-microservices-template.test.yml +2 -2
  7. package/.vscode/extensions.json +18 -71
  8. package/.vscode/settings.json +20 -3
  9. package/AUTHORS.md +16 -5
  10. package/CHANGELOG.md +123 -3
  11. package/Dockerfile +27 -70
  12. package/README.md +39 -29
  13. package/bin/build.js +186 -0
  14. package/bin/db.js +2 -24
  15. package/bin/deploy.js +1467 -236
  16. package/bin/file.js +67 -16
  17. package/bin/hwt.js +0 -10
  18. package/bin/index.js +1 -77
  19. package/bin/ssl.js +19 -11
  20. package/bin/util.js +9 -104
  21. package/bin/vs.js +26 -2
  22. package/cli.md +451 -0
  23. package/conf.js +29 -138
  24. package/docker-compose.yml +1 -1
  25. package/jsdoc.json +1 -1
  26. package/manifests/calico-custom-resources.yaml +25 -0
  27. package/manifests/deployment/adminer/deployment.yaml +32 -0
  28. package/manifests/deployment/adminer/kustomization.yaml +7 -0
  29. package/manifests/deployment/adminer/service.yaml +13 -0
  30. package/manifests/deployment/fastapi/backend-deployment.yml +120 -0
  31. package/manifests/deployment/fastapi/backend-service.yml +19 -0
  32. package/manifests/deployment/fastapi/frontend-deployment.yml +54 -0
  33. package/manifests/deployment/fastapi/frontend-service.yml +15 -0
  34. package/manifests/deployment/kafka/deployment.yaml +69 -0
  35. package/manifests/deployment/mongo-express/deployment.yaml +60 -0
  36. package/manifests/deployment/phpmyadmin/deployment.yaml +54 -0
  37. package/manifests/kind-config-dev.yaml +12 -0
  38. package/manifests/kind-config.yaml +12 -0
  39. package/manifests/kubeadm-calico-config.yaml +119 -0
  40. package/manifests/letsencrypt-prod.yaml +15 -0
  41. package/manifests/mariadb/config.yaml +10 -0
  42. package/manifests/mariadb/kustomization.yaml +9 -0
  43. package/manifests/mariadb/pv.yaml +12 -0
  44. package/manifests/mariadb/pvc.yaml +10 -0
  45. package/manifests/mariadb/secret.yaml +8 -0
  46. package/manifests/mariadb/service.yaml +10 -0
  47. package/manifests/mariadb/statefulset.yaml +55 -0
  48. package/manifests/mongodb/backup-access.yaml +16 -0
  49. package/manifests/mongodb/backup-cronjob.yaml +42 -0
  50. package/manifests/mongodb/backup-pv-pvc.yaml +22 -0
  51. package/manifests/mongodb/configmap.yaml +26 -0
  52. package/manifests/mongodb/headless-service.yaml +10 -0
  53. package/manifests/mongodb/kustomization.yaml +11 -0
  54. package/manifests/mongodb/pv-pvc.yaml +23 -0
  55. package/manifests/mongodb/statefulset.yaml +125 -0
  56. package/manifests/mongodb-4.4/kustomization.yaml +7 -0
  57. package/manifests/mongodb-4.4/pv-pvc.yaml +23 -0
  58. package/manifests/mongodb-4.4/service-deployment.yaml +63 -0
  59. package/manifests/postgresql/configmap.yaml +9 -0
  60. package/manifests/postgresql/kustomization.yaml +10 -0
  61. package/manifests/postgresql/pv.yaml +15 -0
  62. package/manifests/postgresql/pvc.yaml +13 -0
  63. package/manifests/postgresql/service.yaml +10 -0
  64. package/manifests/postgresql/statefulset.yaml +37 -0
  65. package/manifests/valkey/kustomization.yaml +7 -0
  66. package/manifests/valkey/service.yaml +17 -0
  67. package/manifests/valkey/statefulset.yaml +41 -0
  68. package/package.json +127 -136
  69. package/src/api/core/core.service.js +1 -1
  70. package/src/api/default/default.service.js +1 -1
  71. package/src/api/user/user.model.js +16 -3
  72. package/src/api/user/user.service.js +15 -12
  73. package/src/cli/cluster.js +389 -0
  74. package/src/cli/cron.js +121 -0
  75. package/src/cli/db.js +222 -0
  76. package/src/cli/deploy.js +487 -0
  77. package/src/cli/env.js +58 -0
  78. package/src/cli/fs.js +161 -0
  79. package/src/cli/image.js +66 -0
  80. package/src/cli/index.js +312 -0
  81. package/src/cli/monitor.js +236 -0
  82. package/src/cli/repository.js +128 -0
  83. package/src/cli/script.js +53 -0
  84. package/src/cli/secrets.js +37 -0
  85. package/src/cli/test.js +118 -0
  86. package/src/client/components/core/Account.js +28 -24
  87. package/src/client/components/core/Auth.js +22 -4
  88. package/src/client/components/core/Blockchain.js +1 -1
  89. package/src/client/components/core/CalendarCore.js +128 -121
  90. package/src/client/components/core/CommonJs.js +283 -19
  91. package/src/client/components/core/CssCore.js +16 -4
  92. package/src/client/components/core/Docs.js +1 -2
  93. package/src/client/components/core/DropDown.js +5 -1
  94. package/src/client/components/core/EventsUI.js +3 -3
  95. package/src/client/components/core/FileExplorer.js +86 -78
  96. package/src/client/components/core/Input.js +22 -6
  97. package/src/client/components/core/JoyStick.js +2 -2
  98. package/src/client/components/core/LoadingAnimation.js +3 -12
  99. package/src/client/components/core/LogIn.js +3 -3
  100. package/src/client/components/core/LogOut.js +1 -1
  101. package/src/client/components/core/Modal.js +54 -20
  102. package/src/client/components/core/Panel.js +109 -90
  103. package/src/client/components/core/PanelForm.js +23 -30
  104. package/src/client/components/core/Recover.js +3 -3
  105. package/src/client/components/core/RichText.js +1 -11
  106. package/src/client/components/core/Router.js +3 -1
  107. package/src/client/components/core/Scroll.js +1 -0
  108. package/src/client/components/core/SignUp.js +2 -2
  109. package/src/client/components/core/Translate.js +47 -9
  110. package/src/client/components/core/Validator.js +9 -1
  111. package/src/client/components/core/VanillaJs.js +0 -9
  112. package/src/client/components/core/Worker.js +34 -31
  113. package/src/client/components/default/RoutesDefault.js +3 -2
  114. package/src/client/services/core/core.service.js +15 -10
  115. package/src/client/services/default/default.management.js +46 -37
  116. package/src/client/ssr/Render.js +6 -1
  117. package/src/client/ssr/body/CacheControl.js +2 -3
  118. package/src/client/sw/default.sw.js +3 -3
  119. package/src/db/mongo/MongooseDB.js +29 -1
  120. package/src/index.js +101 -19
  121. package/src/mailer/MailerProvider.js +3 -0
  122. package/src/runtime/lampp/Dockerfile +65 -0
  123. package/src/runtime/lampp/Lampp.js +1 -13
  124. package/src/runtime/xampp/Xampp.js +0 -13
  125. package/src/server/auth.js +3 -3
  126. package/src/server/backup.js +49 -93
  127. package/src/server/client-build.js +49 -46
  128. package/src/server/client-formatted.js +6 -3
  129. package/src/server/conf.js +297 -55
  130. package/src/server/dns.js +75 -62
  131. package/src/server/downloader.js +0 -8
  132. package/src/server/json-schema.js +77 -0
  133. package/src/server/logger.js +15 -10
  134. package/src/server/network.js +20 -161
  135. package/src/server/peer.js +2 -2
  136. package/src/server/process.js +25 -2
  137. package/src/server/proxy.js +7 -29
  138. package/src/server/runtime.js +53 -40
  139. package/src/server/ssl.js +1 -1
  140. package/src/server/start.js +122 -0
  141. package/src/server/valkey.js +27 -11
  142. package/test/api.test.js +0 -8
  143. package/src/dns.js +0 -22
  144. package/src/server/prompt-optimizer.js +0 -28
  145. package/startup.js +0 -11
@@ -518,25 +518,25 @@ function getDirname(path) {
518
518
  return parts.join('/'); // Adjust separator if needed for Windows ('\')
519
519
  }
520
520
 
521
- const isDayValid = (day) => {
522
- const date = new Date();
523
- date.setDate(day);
524
- return date.getDate() === day;
525
- };
526
-
527
- const isMonthValid = (month) => {
528
- const date = new Date();
529
- date.setMonth(month - 1);
530
- return date.getMonth() === month - 1;
531
- };
532
-
533
521
  const isValidDate = (day, month, year) => {
534
- if (!isDayValid(day) || !isMonthValid(month)) {
535
- return false;
536
- }
522
+ if (!month && !year) return !(new Date(day) == 'Invalid Date');
523
+ // new Date('2025-12-28')
524
+ // Sat Dec 27 2025 19:00:00 GMT-0500 (Eastern Standard Time)
525
+ // new Date('2025/12/28')
526
+ // Sun Dec 28 2025 00:00:00 GMT-0500 (Eastern Standard Time)
527
+ return !(new Date(`${year}/${month}/${day}`) == 'Invalid Date');
528
+ };
537
529
 
538
- const date = new Date(year, month - 1, day);
539
- return !isNaN(date.getTime());
530
+ // console.log(req.body.timeZoneClient, Intl.DateTimeFormat().resolvedOptions().timeZone);
531
+ // DateTime.fromISO("2017-05-15T09:10:23", { zone: "Europe/Paris" });
532
+ const strToDateUTC = (date = '2025-01-30T14:32') => {
533
+ const year = parseInt(date.split('-')[0]);
534
+ const month = parseInt(date.split('-')[1]);
535
+ const day = parseInt(date.split('-')[2].split('T')[0]);
536
+ const hour = parseInt(date.split('T')[1].split(':')[0]);
537
+ const minute = parseInt(date.split('T')[1].split(':')[1]);
538
+ date = new Date(Date.UTC(year, month - 1, day, hour, minute, 0, 0));
539
+ return date;
540
540
  };
541
541
 
542
542
  const isValidFormat = (value, format) => {
@@ -573,6 +573,15 @@ const isValidFormat = (value, format) => {
573
573
  }
574
574
  };
575
575
 
576
+ const getCurrentTrace = () => {
577
+ try {
578
+ _stack;
579
+ } catch (error) {
580
+ console.error(error);
581
+ return error;
582
+ }
583
+ };
584
+
576
585
  /**
577
586
  * Returns the time difference between UTC time and local time, in minutes.
578
587
  * @memberof CommonJS
@@ -662,6 +671,22 @@ function componentFromStr(numStr, percent) {
662
671
  return percent ? Math.floor((255 * Math.min(100, num)) / 100) : Math.min(255, num);
663
672
  }
664
673
 
674
+ const isChileanIdentityDocument = function (rutCompleto) {
675
+ const dv = function (T) {
676
+ let M = 0,
677
+ S = 1;
678
+ for (; T; T = Math.floor(T / 10)) S = (S + (T % 10) * (9 - (M++ % 6))) % 11;
679
+ return S ? S - 1 : 'k';
680
+ };
681
+ rutCompleto = rutCompleto.replace('‐', '-');
682
+ if (!/^[0-9]+[-|‐]{1}[0-9kK]{1}$/.test(rutCompleto)) return false;
683
+ var tmp = rutCompleto.split('-');
684
+ var digv = tmp[1];
685
+ var rut = tmp[0];
686
+ if (digv == 'K') digv = 'k';
687
+ return dv(rut) == digv;
688
+ };
689
+
665
690
  function rgbToHex(rgb) {
666
691
  const rgbRegex = /^rgb\(\s*(-?\d+)(%?)\s*,\s*(-?\d+)(%?)\s*,\s*(-?\d+)(%?)\s*\)$/;
667
692
  let result,
@@ -685,10 +710,242 @@ const hexToNumber = (hex = 0xdc) => Number(hex) || parseFloat(hex, 16);
685
710
 
686
711
  const numberToHex = (number = 0) => number.toString(16);
687
712
 
713
+ const generateRandomPasswordSelection = (length) => {
714
+ const _random = (arr) => {
715
+ const rand = Math.floor(Math.random() * arr.length);
716
+ return arr[rand];
717
+ };
718
+
719
+ const uppercase = [
720
+ 'A',
721
+ 'B',
722
+ 'C',
723
+ 'D',
724
+ 'E',
725
+ 'F',
726
+ 'G',
727
+ 'H',
728
+ 'I',
729
+ 'J',
730
+ 'K',
731
+ 'L',
732
+ 'M',
733
+ 'N',
734
+ 'O',
735
+ 'P',
736
+ 'Q',
737
+ 'R',
738
+ 'S',
739
+ 'T',
740
+ 'U',
741
+ 'V',
742
+ 'W',
743
+ 'X',
744
+ 'Y',
745
+ 'Z',
746
+ ];
747
+ const lowercase = [
748
+ 'a',
749
+ 'b',
750
+ 'c',
751
+ 'd',
752
+ 'e',
753
+ 'f',
754
+ 'g',
755
+ 'h',
756
+ 'i',
757
+ 'j',
758
+ 'k',
759
+ 'l',
760
+ 'm',
761
+ 'n',
762
+ 'o',
763
+ 'p',
764
+ 'q',
765
+ 'r',
766
+ 's',
767
+ 't',
768
+ 'u',
769
+ 'v',
770
+ 'w',
771
+ 'x',
772
+ 'y',
773
+ 'z',
774
+ ];
775
+ const special = [
776
+ '~',
777
+ '!',
778
+ '@',
779
+ '#',
780
+ '$',
781
+ '%',
782
+ '^',
783
+ '&',
784
+ '*',
785
+ '(',
786
+ ')',
787
+ '_',
788
+ '+',
789
+ '-',
790
+ '=',
791
+ '{',
792
+ '}',
793
+ '[',
794
+ ']',
795
+ ':',
796
+ ';',
797
+ '?',
798
+ ',',
799
+ '.',
800
+ '|',
801
+ '\\',
802
+ ];
803
+ const numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
804
+
805
+ const nonSpecial = [...uppercase, ...lowercase, ...numbers];
806
+
807
+ let password = '';
808
+
809
+ for (let i = 0; i < length; i++) {
810
+ // Previous character is a special character
811
+ if (i !== 0 && special.includes(password[i - 1])) {
812
+ password += _random(nonSpecial);
813
+ } else password += _random([...nonSpecial, ...special]);
814
+ }
815
+
816
+ return password;
817
+ };
818
+
688
819
  // 0x = Hexadecimal
689
820
  // 0b = Binary
690
821
  // 0o = Octal
691
822
 
823
+ const commitData = {
824
+ feat: {
825
+ description: 'A new feature',
826
+ title: 'Features',
827
+ emoji: '✨',
828
+ },
829
+ fix: {
830
+ description: 'A bug fix',
831
+ title: 'Bug Fixes',
832
+ emoji: '🐛',
833
+ },
834
+ docs: {
835
+ description: 'Documentation only changes',
836
+ title: 'Documentation',
837
+ emoji: '📚',
838
+ },
839
+ style: {
840
+ description:
841
+ 'Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)',
842
+ title: 'Styles',
843
+ emoji: '💎',
844
+ },
845
+ refactor: {
846
+ description: 'A code change that neither fixes a bug nor adds a feature',
847
+ title: 'Code Refactoring',
848
+ emoji: '📦',
849
+ },
850
+ perf: {
851
+ description: 'A code change that improves performance',
852
+ title: 'Performance Improvements',
853
+ emoji: '⚡️',
854
+ },
855
+ cd: {
856
+ description:
857
+ 'Changes to our Continuous Delivery configuration files and scripts (example scopes: Jenkins, Spinnaker, ArgoCD)',
858
+ title: 'Continuous Delivery',
859
+ emoji: '🚀',
860
+ },
861
+ test: {
862
+ description: 'Adding missing tests or correcting existing tests',
863
+ title: 'Tests',
864
+ emoji: '🚨',
865
+ },
866
+ build: {
867
+ description: 'Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)',
868
+ title: 'Builds',
869
+ emoji: '🛠',
870
+ },
871
+ ci: {
872
+ description:
873
+ 'Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)',
874
+ title: 'Continuous Integrations',
875
+ emoji: '⚙️',
876
+ },
877
+ chore: {
878
+ description: "Other changes that don't modify src or test files",
879
+ title: 'Chores',
880
+ emoji: '♻️',
881
+ },
882
+ revert: {
883
+ description: 'Reverts a previous commit',
884
+ title: 'Reverts',
885
+ emoji: '🗑',
886
+ },
887
+ backup: {
888
+ description: 'Changes related to backups, including creation, restoration, and maintenance.',
889
+ title: 'Backups',
890
+ emoji: '💾',
891
+ },
892
+ };
893
+
894
+ const emotionsData = [
895
+ {
896
+ name: 'like',
897
+ ad_display: {
898
+ es: 'Me gusta',
899
+ en: 'Like',
900
+ },
901
+ emoji: '👍',
902
+ },
903
+ {
904
+ name: 'love',
905
+ ad_display: {
906
+ es: 'Me encanta',
907
+ en: 'Love',
908
+ },
909
+ emoji: '❤️',
910
+ },
911
+ {
912
+ name: 'haha',
913
+ ad_display: {
914
+ es: 'Me divierte',
915
+ en: 'Haha',
916
+ },
917
+ emoji: '😂',
918
+ },
919
+ {
920
+ name: 'wow',
921
+ ad_display: {
922
+ es: 'Me asombra',
923
+ en: 'Wow',
924
+ },
925
+ emoji: '😮',
926
+ },
927
+ {
928
+ name: 'sad',
929
+ ad_display: {
930
+ es: 'Me entristece',
931
+ en: 'Sad',
932
+ },
933
+ emoji: '😢',
934
+ },
935
+ {
936
+ name: 'angry',
937
+ ad_display: {
938
+ es: 'Me enoja',
939
+ en: 'Angry',
940
+ },
941
+ emoji: '😠',
942
+ },
943
+ ];
944
+
945
+ const userRoleEnum = ['admin', 'moderator', 'user', 'guest'];
946
+ const commonAdminGuard = (role) => userRoleEnum.indexOf(role) === userRoleEnum.indexOf('admin');
947
+ const commonModeratorGuard = (role) => userRoleEnum.indexOf(role) <= userRoleEnum.indexOf('moderator');
948
+
692
949
  export {
693
950
  s4,
694
951
  range,
@@ -727,10 +984,9 @@ export {
727
984
  getSubpaths,
728
985
  formatBytes,
729
986
  getDirname,
730
- isDayValid,
731
- isMonthValid,
732
987
  isValidDate,
733
988
  isValidFormat,
989
+ strToDateUTC,
734
990
  getTimezoneOffset,
735
991
  cleanString,
736
992
  splitEveryXChar,
@@ -742,4 +998,12 @@ export {
742
998
  getCapVariableName,
743
999
  hexToNumber,
744
1000
  numberToHex,
1001
+ generateRandomPasswordSelection,
1002
+ commonAdminGuard,
1003
+ commonModeratorGuard,
1004
+ isChileanIdentityDocument,
1005
+ getCurrentTrace,
1006
+ userRoleEnum,
1007
+ commitData,
1008
+ emotionsData,
745
1009
  };
@@ -117,6 +117,12 @@ const CssCommonCore = async () => {
117
117
  animation: ripple 600ms linear;
118
118
  background-color: rgba(137, 137, 137, 0.503);
119
119
  }
120
+ .slide-menu-top-bar-fix {
121
+ top: 0;
122
+ left: 0;
123
+ width: 100%;
124
+ z-index: 1;
125
+ }
120
126
  @keyframes ripple {
121
127
  to {
122
128
  transform: scale(4);
@@ -390,8 +396,8 @@ const CssCoreDark = {
390
396
  text-align: center;
391
397
  background: #1a1a1a;
392
398
  font-size: 17px;
393
- padding-top: 7px;
394
- padding-bottom: 6px;
399
+ height: 30px;
400
+ padding: 5px 0px 5px 0px;
395
401
  }
396
402
  ::placeholder {
397
403
  color: #c6c4c4;
@@ -466,6 +472,7 @@ const CssCoreDark = {
466
472
  width: 260px;
467
473
  font-size: 20px;
468
474
  padding: 10px;
475
+ min-height: 45px;
469
476
  }
470
477
  .toggle-form-container {
471
478
  border: 2px solid #313131;
@@ -489,6 +496,7 @@ const CssCoreDark = {
489
496
  font-size: 20px;
490
497
  padding: 10px;
491
498
  text-align: center;
499
+ min-height: 45px;
492
500
  }
493
501
  .drop-zone-file-explorer {
494
502
  min-height: 300px;
@@ -516,6 +524,7 @@ const CssCoreDark = {
516
524
  margin: 5px 0 0 0;
517
525
  padding: 5px;
518
526
  font-size: 16px;
527
+ min-height: 40px;
519
528
  }
520
529
  .btn-input-extension:hover {
521
530
  }
@@ -695,8 +704,8 @@ const CssCoreLight = {
695
704
  text-align: center;
696
705
  background: #eaeaea;
697
706
  font-size: 17px;
698
- padding-top: 7px;
699
- padding-bottom: 6px;
707
+ height: 30px;
708
+ padding: 5px 0px 5px 0px;
700
709
  }
701
710
  ::placeholder {
702
711
  color: #333;
@@ -772,6 +781,7 @@ const CssCoreLight = {
772
781
  width: 260px;
773
782
  font-size: 20px;
774
783
  padding: 10px;
784
+ min-height: 45px;
775
785
  }
776
786
  .toggle-form-container {
777
787
  border-radius: 5px;
@@ -796,6 +806,7 @@ const CssCoreLight = {
796
806
  font-size: 20px;
797
807
  padding: 10px;
798
808
  text-align: center;
809
+ min-height: 45px;
799
810
  }
800
811
  .input-container-width {
801
812
  cursor: pointer;
@@ -833,6 +844,7 @@ const CssCoreLight = {
833
844
  margin: 5px 0 0 0;
834
845
  padding: 5px;
835
846
  font-size: 16px;
847
+ min-height: 40px;
836
848
  }
837
849
  .btn-input-extension:hover {
838
850
  }
@@ -1,4 +1,3 @@
1
- import { _VERSION, CoreService } from '../../services/core/core.service.js';
2
1
  import { Badge } from './Badge.js';
3
2
  import { BtnIcon } from './BtnIcon.js';
4
3
  import { rgbToHex } from './CommonJs.js';
@@ -80,7 +79,7 @@ const Docs = {
80
79
  icon: html`<i class="fa-brands fa-osi"></i>`,
81
80
  text: 'Source Docs',
82
81
  url: function () {
83
- return `${getProxyPath()}docs/engine/${_VERSION}`;
82
+ return `${getProxyPath()}docs/engine/${window.renderPayload.version.replace('v', '')}`;
84
83
  },
85
84
  },
86
85
  {
@@ -16,7 +16,11 @@ const DropDown = {
16
16
  onClick: () => {
17
17
  console.log('DropDown onClick', this.value);
18
18
  if (options && options.resetOnClick) options.resetOnClick();
19
- this.Tokens[id].value = undefined;
19
+ if (options && options.type === 'checkbox')
20
+ for (const opt of DropDown.Tokens[id].value) {
21
+ s(`.dropdown-option-${id}-${opt}`).click();
22
+ }
23
+ else this.Tokens[id].value = undefined;
20
24
  },
21
25
  });
22
26
 
@@ -12,11 +12,11 @@ const EventsUI = {
12
12
  if (!s(id)) return;
13
13
  let complete = true;
14
14
  s(id)[type] = async function (e) {
15
- cssEffect(id, e);
15
+ if (options.clickEffect) cssEffect(id, e);
16
16
  if (complete) {
17
17
  complete = false;
18
18
  await LoadingAnimation.spinner.play(loadingContainer ? loadingContainer : id);
19
- await LoadingAnimation.bar.play(id);
19
+ if (options.context !== 'modal') await LoadingAnimation.bar.play(id);
20
20
  try {
21
21
  await logic(e);
22
22
  } catch (error) {
@@ -26,7 +26,7 @@ const EventsUI = {
26
26
  html: error?.message ? error.message : error ? error : 'Event error',
27
27
  });
28
28
  }
29
- LoadingAnimation.bar.stop(id);
29
+ if (options.context !== 'modal') LoadingAnimation.bar.stop(id);
30
30
  await LoadingAnimation.spinner.stop(loadingContainer ? loadingContainer : id);
31
31
  complete = true;
32
32
  return;
@@ -323,50 +323,54 @@ const FileExplorer = {
323
323
 
324
324
  downloadFile(new Blob([new Uint8Array(file.data.data)], { type: params.data.mimetype }), params.data.name);
325
325
  });
326
- EventsUI.onClick(`.btn-file-delete-${params.data._id}`, async (e) => {
327
- e.preventDefault();
328
- {
329
- const confirmResult = await Modal.RenderConfirm({
330
- html: async () => {
331
- return html`
332
- <div class="in section-mp" style="text-align: center">
333
- ${Translate.Render('confirm-delete-item')}
334
- <br />
335
- "${params.data.title}"
336
- </div>
337
- `;
338
- },
339
- id: `delete-${params.data._id}`,
340
- });
341
- if (confirmResult.status !== 'confirm') return;
326
+ EventsUI.onClick(
327
+ `.btn-file-delete-${params.data._id}`,
328
+ async (e) => {
329
+ e.preventDefault();
330
+ {
331
+ const confirmResult = await Modal.RenderConfirm({
332
+ html: async () => {
333
+ return html`
334
+ <div class="in section-mp" style="text-align: center">
335
+ ${Translate.Render('confirm-delete-item')}
336
+ <br />
337
+ "${params.data.title}"
338
+ </div>
339
+ `;
340
+ },
341
+ id: `delete-${params.data._id}`,
342
+ });
343
+ if (confirmResult.status !== 'confirm') return;
342
344
 
343
- const { data, status, message } = await FileService.delete({
344
- id: params.data.fileId,
345
+ const { data, status, message } = await FileService.delete({
346
+ id: params.data.fileId,
347
+ });
348
+ NotificationManager.Push({
349
+ html: status,
350
+ status,
351
+ });
352
+ if (status === 'error') return;
353
+ }
354
+ const { data, status, message } = await DocumentService.delete({
355
+ id: params.data._id,
345
356
  });
346
357
  NotificationManager.Push({
347
358
  html: status,
348
359
  status,
349
360
  });
350
361
  if (status === 'error') return;
351
- }
352
- const { data, status, message } = await DocumentService.delete({
353
- id: params.data._id,
354
- });
355
- NotificationManager.Push({
356
- html: status,
357
- status,
358
- });
359
- if (status === 'error') return;
360
-
361
- documentInstance = documentInstance.filter((f) => f._id !== params.data._id);
362
- const format = FileExplorer.documentDataFormat({ document: documentInstance, location });
363
- files = format.files;
364
- folders = format.folders;
365
- // AgGrid.grids[gridFileId].setGridOption('rowData', files);
366
- // const selectedData = gridApi.getSelectedRows();
367
- AgGrid.grids[gridFileId].applyTransaction({ remove: [params.data] });
368
- AgGrid.grids[gridFolderId].setGridOption('rowData', folders);
369
- });
362
+
363
+ documentInstance = documentInstance.filter((f) => f._id !== params.data._id);
364
+ const format = FileExplorer.documentDataFormat({ document: documentInstance, location });
365
+ files = format.files;
366
+ folders = format.folders;
367
+ // AgGrid.grids[gridFileId].setGridOption('rowData', files);
368
+ // const selectedData = gridApi.getSelectedRows();
369
+ AgGrid.grids[gridFileId].applyTransaction({ remove: [params.data] });
370
+ AgGrid.grids[gridFolderId].setGridOption('rowData', folders);
371
+ },
372
+ { context: 'modal' },
373
+ );
370
374
  });
371
375
  }
372
376
 
@@ -400,49 +404,53 @@ const FileExplorer = {
400
404
  `;
401
405
 
402
406
  setTimeout(() => {
403
- EventsUI.onClick(`.btn-folder-delete-${id}`, async (e) => {
404
- const confirmResult = await Modal.RenderConfirm({
405
- html: async () => {
406
- return html`
407
- <div class="in section-mp" style="text-align: center">
408
- ${Translate.Render('confirm-delete-item')}
409
- <br />
410
- "${params.data.location}"
411
- </div>
412
- `;
413
- },
414
- id: `delete-${id}`,
415
- });
416
- if (confirmResult.status !== 'confirm') return;
407
+ EventsUI.onClick(
408
+ `.btn-folder-delete-${id}`,
409
+ async (e) => {
410
+ const confirmResult = await Modal.RenderConfirm({
411
+ html: async () => {
412
+ return html`
413
+ <div class="in section-mp" style="text-align: center">
414
+ ${Translate.Render('confirm-delete-item')}
415
+ <br />
416
+ "${params.data.location}"
417
+ </div>
418
+ `;
419
+ },
420
+ id: `delete-${id}`,
421
+ });
422
+ if (confirmResult.status !== 'confirm') return;
417
423
 
418
- e.preventDefault();
419
- const idFilesDelete = [];
420
- for (const file of documentInstance.filter(
421
- (f) => FileExplorer.locationFormat({ f }) === params.data.location, // .startsWith(params.data.location),
422
- )) {
423
- {
424
- const { data, status, message } = await FileService.delete({
425
- id: file.fileId._id,
426
- });
424
+ e.preventDefault();
425
+ const idFilesDelete = [];
426
+ for (const file of documentInstance.filter(
427
+ (f) => FileExplorer.locationFormat({ f }) === params.data.location, // .startsWith(params.data.location),
428
+ )) {
429
+ {
430
+ const { data, status, message } = await FileService.delete({
431
+ id: file.fileId._id,
432
+ });
433
+ }
434
+ {
435
+ idFilesDelete.push(file._id);
436
+ const { data, status, message } = await DocumentService.delete({
437
+ id: file._id,
438
+ });
439
+ }
427
440
  }
428
- {
429
- idFilesDelete.push(file._id);
430
- const { data, status, message } = await DocumentService.delete({
431
- id: file._id,
432
- });
433
- }
434
- }
435
- NotificationManager.Push({
436
- html: Translate.Render('success-delete'),
437
- status: 'success',
438
- });
439
- documentInstance = documentInstance.filter((f) => !idFilesDelete.includes(f._id));
440
- const format = FileExplorer.documentDataFormat({ document: documentInstance, location });
441
- files = format.files;
442
- folders = format.folders;
443
- AgGrid.grids[gridFileId].setGridOption('rowData', files);
444
- AgGrid.grids[gridFolderId].setGridOption('rowData', folders);
445
- });
441
+ NotificationManager.Push({
442
+ html: Translate.Render('success-delete'),
443
+ status: 'success',
444
+ });
445
+ documentInstance = documentInstance.filter((f) => !idFilesDelete.includes(f._id));
446
+ const format = FileExplorer.documentDataFormat({ document: documentInstance, location });
447
+ files = format.files;
448
+ folders = format.folders;
449
+ AgGrid.grids[gridFileId].setGridOption('rowData', files);
450
+ AgGrid.grids[gridFolderId].setGridOption('rowData', folders);
451
+ },
452
+ { context: 'modal' },
453
+ );
446
454
  });
447
455
  }
448
456