main.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import $ from 'jquery';
  2. import GPM, { Instance as gpm } from './utils/gpm';
  3. import KeepAlive from './utils/keepalive';
  4. import Updates, { Instance as updates, Notifications, Feed } from './updates';
  5. import Dashboard from './dashboard';
  6. import Pages from './pages';
  7. import Forms from './forms';
  8. import Scrollbar, { Instance as contentScrollbar } from './utils/scrollbar';
  9. import './plugins';
  10. import './themes';
  11. import { Filter as MediaFilter, Instance as MediaFilterInstance} from './media';
  12. import toastr from './utils/toastr';
  13. import request from './utils/request';
  14. import './utils/2fa';
  15. // bootstrap jQuery extensions
  16. import 'bootstrap/js/transition';
  17. import 'bootstrap/js/dropdown';
  18. import 'bootstrap/js/collapse';
  19. // tabs memory
  20. import './utils/tabs-memory';
  21. // Main Sidebar
  22. import Sidebar, { Instance as sidebar } from './utils/sidebar';
  23. // starts the keep alive, auto runs every X seconds
  24. KeepAlive.start();
  25. // Sidebar auto-refresh
  26. global.setInterval(() => {
  27. contentScrollbar.update();
  28. sidebar.scroller.update();
  29. }, 150);
  30. // global event to catch sidebar_state changes
  31. $(global).on('sidebar_state._grav', () => {
  32. /* Should not be needed since Gemini Scrollbar v1.4.0
  33. * - Auto-update scrollbar on resize
  34. *
  35. * $('.admin-menu-wrapper').data('scrollbar').update();
  36. * $('#admin-main .content-wrapper').data('scrollbar').update();
  37. */
  38. Object.keys(Dashboard.Chart.Instances).forEach((chart) => {
  39. setTimeout(() => Dashboard.Chart.Instances[chart].chart.update(), 10);
  40. });
  41. });
  42. export default {
  43. GPM: {
  44. GPM,
  45. Instance: gpm
  46. },
  47. KeepAlive,
  48. Dashboard,
  49. Pages,
  50. Forms,
  51. Scrollbar: {
  52. Scrollbar,
  53. Instance: contentScrollbar
  54. },
  55. Updates: {
  56. Updates,
  57. Notifications,
  58. Feed,
  59. Instance: updates
  60. },
  61. Sidebar: {
  62. Sidebar,
  63. Instance: sidebar
  64. },
  65. MediaFilter: {
  66. MediaFilter,
  67. Instance: MediaFilterInstance
  68. },
  69. Utils: { request, toastr }
  70. };