diff --git a/client/app/components/items-list/classes/Sorter.js b/client/app/components/items-list/classes/Sorter.js
index 4275dec8a..c1935c959 100644
--- a/client/app/components/items-list/classes/Sorter.js
+++ b/client/app/components/items-list/classes/Sorter.js
@@ -24,6 +24,8 @@ export default class Sorter {
reverse = false;
+ sortByIteratees = null;
+
get compiled() {
return compile(this.field, this.reverse);
}
@@ -42,9 +44,10 @@ export default class Sorter {
this.reverse = !!value; // cast to boolean
}
- constructor({ orderByField, orderByReverse } = {}) {
+ constructor({ orderByField, orderByReverse } = {}, sortByIteratees = undefined) {
this.setField(orderByField);
this.setReverse(orderByReverse);
+ this.sortByIteratees = sortByIteratees;
}
toggleField(field) {
@@ -61,7 +64,8 @@ export default class Sorter {
sort(items) {
if (this.field) {
- items = sortBy(items, this.field);
+ const customIteratee = this.sortByIteratees && this.sortByIteratees[this.field];
+ items = sortBy(items, customIteratee ? [customIteratee] : this.field);
if (this.reverse) {
items.reverse();
}
diff --git a/client/app/lib/utils.js b/client/app/lib/utils.js
index b9361f849..3508eda22 100644
--- a/client/app/lib/utils.js
+++ b/client/app/lib/utils.js
@@ -8,6 +8,7 @@ export const IntervalEnum = {
HOURS: "hour",
DAYS: "day",
WEEKS: "week",
+ MILLISECONDS: "millisecond",
};
export function formatDateTime(value) {
@@ -76,12 +77,12 @@ export function pluralize(text, count) {
return text + (should ? "s" : "");
}
-export function durationHumanize(duration, options = {}) {
- if (!duration) {
+export function durationHumanize(durationInSeconds, options = {}) {
+ if (!durationInSeconds) {
return "-";
}
let ret = "";
- const { interval, count } = secondsToInterval(duration);
+ const { interval, count } = secondsToInterval(durationInSeconds);
const rounded = Math.round(count);
if (rounded !== 1 || !options.omitSingleValueNumber) {
ret = `${rounded} `;
diff --git a/client/app/pages/queries/QuerySource.jsx b/client/app/pages/queries/QuerySource.jsx
index 99646ce79..2f97c5066 100644
--- a/client/app/pages/queries/QuerySource.jsx
+++ b/client/app/pages/queries/QuerySource.jsx
@@ -213,7 +213,7 @@ function QuerySource(props) {
value={ds.id}
data-name={ds.name}
data-test={`SelectDataSource${ds.id}`}>
-
+
{ds.name}
))}
diff --git a/client/app/services/auth.js b/client/app/services/auth.js
index b7a2fe0b0..db5e2af18 100644
--- a/client/app/services/auth.js
+++ b/client/app/services/auth.js
@@ -30,6 +30,10 @@ export const messages = [];
const logger = debug("redash:auth");
const session = { loaded: false };
+const AuthUrls = {
+ Login: "login",
+};
+
function updateSession(sessionData) {
logger("Updating session to be:", sessionData);
extend(session, sessionData, { loaded: true });
@@ -42,10 +46,13 @@ export const Auth = {
isAuthenticated() {
return session.loaded && session.user.id;
},
+ setLoginUrl(loginUrl) {
+ AuthUrls.Login = loginUrl;
+ },
login() {
const next = encodeURI(location.url);
logger("Calling login with next = %s", next);
- window.location.href = `login?next=${next}`;
+ window.location.href = `${AuthUrls.Login}?next=${next}`;
},
logout() {
logger("Logout.");