mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-25 11:51:07 +00:00
* Upgrade Cosmos SDK to v4.3 * push pkg lock * fix tests * fix package-lock.json * fix package-lock * fix package-lock.json * fix package-lock.json * log console warning when RU limit is reached * fix tests * fix format * fix tests * added description to RU limit message * show warning icon on tab header --------- Co-authored-by: Asier Isayas <aisayas@microsoft.com>
30 lines
1003 B
TypeScript
30 lines
1003 B
TypeScript
import * as _ from "underscore";
|
|
import { ConsoleDataType } from "../Explorer/Menus/NotificationConsole/ConsoleData";
|
|
import { useNotificationConsole } from "../hooks/useNotificationConsole";
|
|
|
|
function log(type: ConsoleDataType, message: string): () => void {
|
|
const id = _.uniqueId();
|
|
const date = new Intl.DateTimeFormat("en-EN", {
|
|
hour12: true,
|
|
hour: "numeric",
|
|
minute: "numeric",
|
|
}).format(new Date());
|
|
|
|
useNotificationConsole.getState().setNotificationConsoleData({ type, date, message, id });
|
|
return () => useNotificationConsole.getState().setInProgressConsoleDataIdToBeDeleted(id);
|
|
}
|
|
|
|
export const logConsoleProgress = (msg: string): (() => void) => log(ConsoleDataType.InProgress, msg);
|
|
|
|
export const logConsoleError = (msg: string): void => {
|
|
log(ConsoleDataType.Error, msg);
|
|
};
|
|
|
|
export const logConsoleInfo = (msg: string): void => {
|
|
log(ConsoleDataType.Info, msg);
|
|
};
|
|
|
|
export const logConsoleWarning = (msg: string): void => {
|
|
log(ConsoleDataType.Warning, msg);
|
|
};
|