mirror of
https://github.com/getredash/redash.git
synced 2025-12-19 17:37:19 -05:00
54 lines
1.2 KiB
JavaScript
54 lines
1.2 KiB
JavaScript
import moment from "moment";
|
|
import { isFunction } from "lodash";
|
|
|
|
// Ensure that this image will be available in assets folder
|
|
import "@/assets/images/avatar.svg";
|
|
|
|
// Register visualizations
|
|
import "@redash/viz/lib";
|
|
|
|
// Register routes before registering extensions as they may want to override some
|
|
import "@/pages";
|
|
|
|
import "./antd-spinner";
|
|
|
|
moment.updateLocale("en", {
|
|
relativeTime: {
|
|
future: "%s",
|
|
past: "%s",
|
|
s: "just now",
|
|
m: "a minute ago",
|
|
mm: "%d minutes ago",
|
|
h: "an hour ago",
|
|
hh: "%d hours ago",
|
|
d: "a day ago",
|
|
dd: "%d days ago",
|
|
M: "a month ago",
|
|
MM: "%d months ago",
|
|
y: "a year ago",
|
|
yy: "%d years ago",
|
|
},
|
|
});
|
|
|
|
function requireImages() {
|
|
// client/app/assets/images/<path> => /images/<path>
|
|
const ctx = require.context("@/assets/images/", true, /\.(png|jpe?g|gif|svg)$/);
|
|
ctx.keys().forEach(ctx);
|
|
}
|
|
|
|
function registerExtensions() {
|
|
const context = require.context("extensions", true, /^((?![\\/.]test[\\./]).)*\.jsx?$/);
|
|
const modules = context
|
|
.keys()
|
|
.map(context)
|
|
.map(module => module.default);
|
|
|
|
return modules
|
|
.filter(isFunction)
|
|
.filter(f => f.init)
|
|
.map(f => f());
|
|
}
|
|
|
|
requireImages();
|
|
registerExtensions();
|