fae93ac747
* Fix for “overridden” spelling mistake * Make the task function names grey instead of yellow * The task page now shows each task once * Blankline * WIP on activity bars * Correct size of the graphs * Add data for all days, even if there are no runs * Activity graph is working and has a tooltip * No activity label * Got the bar bg working * Activity chart now has a bg * Added a compound id to make the activity graphs appear faster * Improvements to the activity graph * Tried to disable the bg from animating * Added read replica support to the app, using Nick’s code from his batching PR * Added the read replica to BasePresenter * Added the queued and running columns to the Tasks list * Added avg duration column * Included completed but failed runs in the average duration * Get rid of the old useDevEnvironment hook and remove API keys from the projects query * Unified getting environment info to using a function and doing it in presenters * Removed the path from the tasks table * Onboarding for dev for 2nd+ user. Improved environment sorting. * Removed log * Improved the spacing * Enable staging for new v3 projects
33 lines
823 B
TypeScript
33 lines
823 B
TypeScript
import { RuntimeEnvironmentType } from "@trigger.dev/database";
|
|
import { logger } from "./logger.server";
|
|
|
|
const environmentSortOrder: RuntimeEnvironmentType[] = [
|
|
"DEVELOPMENT",
|
|
"PREVIEW",
|
|
"STAGING",
|
|
"PRODUCTION",
|
|
];
|
|
|
|
type SortType = {
|
|
type: RuntimeEnvironmentType;
|
|
userName?: string | null;
|
|
};
|
|
|
|
export function sortEnvironments<T extends SortType>(environments: T[]): T[] {
|
|
return environments.sort((a, b) => {
|
|
const aIndex = environmentSortOrder.indexOf(a.type);
|
|
const bIndex = environmentSortOrder.indexOf(b.type);
|
|
|
|
const difference = aIndex - bIndex;
|
|
|
|
if (difference === 0) {
|
|
//same environment so sort by name
|
|
const usernameA = a.userName || "";
|
|
const usernameB = b.userName || "";
|
|
return usernameA.localeCompare(usernameB);
|
|
}
|
|
|
|
return difference;
|
|
});
|
|
}
|