Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const calendarViewResolver = createViewResolver(() => _asyncImport("src/calendar/CalendarView.js")
.then(module => new module.CalendarView()), true)
let start = "/"
if (!state.prefix) {
state.prefix = location.pathname[location.pathname.length - 1] !== '/'
? location.pathname : location.pathname.substring(0, location.pathname.length - 1)
let query = m.parseQueryString(location.search)
let redirectTo = query['r'] // redirection triggered by the server (e.g. the user reloads /mail/id by pressing F5)
if (redirectTo) {
delete query['r']
} else {
redirectTo = ""
}
let newQueryString = m.buildQueryString(query)
if (newQueryString.length > 0) {
newQueryString = "?" + newQueryString
}
let target = redirectTo + newQueryString + location.hash
if (target === "" || target[0] !== "/") target = "/" + target
history.replaceState(null, "", neverNull(state.prefix) + target)
start = target
}
m.route.prefix = neverNull(state.prefix)
// keep in sync with RewriteAppResourceUrlHandler.java
m.route(document.body, start, {
"/": {
onmatch: (args, requestedPath) => forceLogin(args, requestedPath)
},
"/login": loginViewResolver,
function currentView(viewName, replace = false) {
const current = queryObject();
if (!arguments.length) {
return current.viewName || personalizeVM.names()[0];
}
const route = window.location.hash.replace(/^#!/, "");
if (current.viewName !== viewName) {
const path = [
window.location.pathname,
viewName ? `?${m.buildQueryString($.extend({}, current, {viewName}))}` : "",
route ? `#!${route}` : ""
].join("");
history[replace ? "replaceState" : "pushState"](null, "", path);
if (route) {
m.route.set(route, null, {replace: true}); // force m.route() evaluation
}
}
personalizeVM.loadingView(true);
// Explicit set always refreshes; even if the viewName didn't change,
// we should refresh because the filter definition may have changed as
// currentView() is called after every personalization save operation.
repeater().restart();
static apiUsersSearchPath(searchText: string) {
return `/go/api/user_search?${m.buildQueryString({q: searchText})}`;
}
static apiPipelineActivity(params: { [key: string]: string | number }) {
return `/go/pipelineHistory.json?${m.buildQueryString(params)}`;
}
static apiCurrentAccessTokensPath(filter?: "all" | "revoked" | "active") {
if (filter) {
return `/go/api/current_user/access_tokens?${m.buildQueryString({filter})}`;
} else {
return `/go/api/current_user/access_tokens`;
}
}
pipelineMaterialSearchPath: (pipelineName, fingerprint, searchText) => {
const queryString = m.buildQueryString({
fingerprint,
pipeline_name: pipelineName, //eslint-disable-line camelcase
search_text: searchText //eslint-disable-line camelcase
});
return `/go/api/internal/material_search?${queryString}`;
},
static showDashboardPath(viewName?: string, allowEmpty?: boolean): string {
const params: any = {};
if (viewName) {
Object.assign(params, { viewName });
}
if ("boolean" === typeof allowEmpty) {
Object.assign(params, { allowEmpty });
}
return Object.keys(params).length ?
`/go/api/dashboard?${m.buildQueryString(params)}` :
"/go/api/dashboard";
}
static showDashboardPath(viewName?: string, allowEmpty?: boolean): string {
const params: any = {};
if (viewName) {
Object.assign(params, {viewName});
}
if ("boolean" === typeof allowEmpty) {
Object.assign(params, {allowEmpty});
}
return Object.keys(params).length ?
`/go/api/dashboard?${m.buildQueryString(params)}` :
"/go/api/dashboard";
}
static apiCurrentAccessTokensPath(filter?: "all" | "revoked" | "active") {
if (filter) {
return `/go/api/current_user/access_tokens?${m.buildQueryString({filter})}`;
} else {
return `/go/api/current_user/access_tokens`;
}
}
static showAnalyticsPath(pluginId: string, metric: AnalyticsCapability, params: { [key: string]: string | number }) {
return `/go/analytics/${pluginId}/${metric.type}/${metric.id}?${m.buildQueryString(params)}`;
}