switch off prod logs on ui

This commit is contained in:
Ishaan Jaff 2024-07-30 13:23:45 -07:00
parent c2289afee8
commit f9e6ac0542
15 changed files with 48 additions and 11 deletions

View file

@ -91,7 +91,7 @@ const AdminPanel: React.FC<AdminPanelProps> = ({
>>(null); >>(null);
const isLocal = process.env.NODE_ENV === "development"; const isLocal = process.env.NODE_ENV === "development";
if (isLocal === true) { if (isLocal != true) {
console.log = function() {}; console.log = function() {};
} }
const [baseUrl, setBaseUrl] = useState( const [baseUrl, setBaseUrl] = useState(

View file

@ -45,7 +45,7 @@ async function generateModelResponse(
) { ) {
// base url should be the current base_url // base url should be the current base_url
const isLocal = process.env.NODE_ENV === "development"; const isLocal = process.env.NODE_ENV === "development";
if (isLocal === true) { if (isLocal != true) {
console.log = function() {}; console.log = function() {};
} }
console.log("isLocal:", isLocal); console.log("isLocal:", isLocal);

View file

@ -43,7 +43,7 @@ const Createuser: React.FC<CreateuserProps> = ({
useState<InvitationLink | null>(null); useState<InvitationLink | null>(null);
const router = useRouter(); const router = useRouter();
const isLocal = process.env.NODE_ENV === "development"; const isLocal = process.env.NODE_ENV === "development";
if (isLocal === true) { if (isLocal != true) {
console.log = function() {}; console.log = function() {};
} }
const [baseUrl, setBaseUrl] = useState( const [baseUrl, setBaseUrl] = useState(

View file

@ -76,7 +76,7 @@ async function testFallbackModelResponse(
) { ) {
// base url should be the current base_url // base url should be the current base_url
const isLocal = process.env.NODE_ENV === "development"; const isLocal = process.env.NODE_ENV === "development";
if (isLocal === true) { if (isLocal != true) {
console.log = function() {}; console.log = function() {};
} }
console.log("isLocal:", isLocal); console.log("isLocal:", isLocal);

View file

@ -43,7 +43,7 @@ const Navbar: React.FC<NavbarProps> = ({
// const userColors = require('./ui_colors.json') || {}; // const userColors = require('./ui_colors.json') || {};
const isLocal = process.env.NODE_ENV === "development"; const isLocal = process.env.NODE_ENV === "development";
if (isLocal === true) { if (isLocal != true) {
console.log = function() {}; console.log = function() {};
} }
const proxyBaseUrl = isLocal ? "http://localhost:4000" : null; const proxyBaseUrl = isLocal ? "http://localhost:4000" : null;

View file

@ -5,7 +5,7 @@ import { message } from "antd";
const isLocal = process.env.NODE_ENV === "development"; const isLocal = process.env.NODE_ENV === "development";
const proxyBaseUrl = isLocal ? "http://localhost:4000" : null; const proxyBaseUrl = isLocal ? "http://localhost:4000" : null;
if (isLocal === true) { if (isLocal != true) {
console.log = function() {}; console.log = function() {};
} }

View file

@ -12,7 +12,11 @@ interface RequestAccessProps {
accessToken: string; accessToken: string;
userID: string; userID: string;
} }
const isLocal = process.env.NODE_ENV === "development";
const proxyBaseUrl = isLocal ? "http://localhost:4000" : null;
if (isLocal != true) {
console.log = function() {};
}
function onRequestAccess(formData: Record<string, any>): void { function onRequestAccess(formData: Record<string, any>): void {
// This function does nothing for now // This function does nothing for now
} }

View file

@ -34,6 +34,11 @@ import {
import { Modal, Typography, Form, Input, Select, Button as Button2, message } from "antd"; import { Modal, Typography, Form, Input, Select, Button as Button2, message } from "antd";
const { Title, Paragraph } = Typography; const { Title, Paragraph } = Typography;
const isLocal = process.env.NODE_ENV === "development";
const proxyBaseUrl = isLocal ? "http://localhost:4000" : null;
if (isLocal != true) {
console.log = function() {};
}
import { import {
getCallbacksCall, getCallbacksCall,
setCallbacksCall, setCallbacksCall,

View file

@ -36,6 +36,11 @@ import {
Grid, Grid,
} from "@tremor/react"; } from "@tremor/react";
import { CogIcon } from "@heroicons/react/outline"; import { CogIcon } from "@heroicons/react/outline";
const isLocal = process.env.NODE_ENV === "development";
const proxyBaseUrl = isLocal ? "http://localhost:4000" : null;
if (isLocal != true) {
console.log = function() {};
}
interface TeamProps { interface TeamProps {
teams: any[] | null; teams: any[] | null;
searchParams: any; searchParams: any;

View file

@ -37,6 +37,12 @@ import {
adminGlobalActivityPerModel, adminGlobalActivityPerModel,
} from "./networking"; } from "./networking";
import { start } from "repl"; import { start } from "repl";
console.log("process.env.NODE_ENV", process.env.NODE_ENV);
const isLocal = process.env.NODE_ENV === "development";
const proxyBaseUrl = isLocal ? "http://localhost:4000" : null;
if (isLocal !== true) {
console.log = function() {};
}
interface UsagePageProps { interface UsagePageProps {
accessToken: string | null; accessToken: string | null;

View file

@ -17,7 +17,7 @@ import { useSearchParams, useRouter } from "next/navigation";
import { jwtDecode } from "jwt-decode"; import { jwtDecode } from "jwt-decode";
import { Typography } from "antd"; import { Typography } from "antd";
const isLocal = process.env.NODE_ENV === "development"; const isLocal = process.env.NODE_ENV === "development";
if (isLocal === true) { if (isLocal != true) {
console.log = function() {}; console.log = function() {};
} }
console.log("isLocal:", isLocal); console.log("isLocal:", isLocal);

View file

@ -34,7 +34,11 @@ import {
} from "antd"; } from "antd";
const { Option } = Select; const { Option } = Select;
const isLocal = process.env.NODE_ENV === "development";
const proxyBaseUrl = isLocal ? "http://localhost:4000" : null;
if (isLocal != true) {
console.log = function() {};
}
interface EditKeyModalProps { interface EditKeyModalProps {
visible: boolean; visible: boolean;

View file

@ -23,7 +23,11 @@ import {
} from "@tremor/react"; } from "@tremor/react";
import { Statistic } from "antd" import { Statistic } from "antd"
import { spendUsersCall, modelAvailableCall } from "./networking"; import { spendUsersCall, modelAvailableCall } from "./networking";
const isLocal = process.env.NODE_ENV === "development";
const proxyBaseUrl = isLocal ? "http://localhost:4000" : null;
if (isLocal != true) {
console.log = function() {};
}
// Define the props type // Define the props type
interface UserSpendData { interface UserSpendData {

View file

@ -21,7 +21,11 @@ import {
} from "@tremor/react"; } from "@tremor/react";
import { Statistic } from "antd" import { Statistic } from "antd"
import { modelAvailableCall } from "./networking"; import { modelAvailableCall } from "./networking";
const isLocal = process.env.NODE_ENV === "development";
const proxyBaseUrl = isLocal ? "http://localhost:4000" : null;
if (isLocal != true) {
console.log = function() {};
}
interface ViewUserTeamProps { interface ViewUserTeamProps {
userID: string | null; userID: string | null;

View file

@ -52,6 +52,11 @@ interface ViewUserDashboardProps {
teams: any[] | null; teams: any[] | null;
setKeys: React.Dispatch<React.SetStateAction<Object[] | null>>; setKeys: React.Dispatch<React.SetStateAction<Object[] | null>>;
} }
const isLocal = process.env.NODE_ENV === "development";
const proxyBaseUrl = isLocal ? "http://localhost:4000" : null;
if (isLocal != true) {
console.log = function() {};
}
const ViewUserDashboard: React.FC<ViewUserDashboardProps> = ({ const ViewUserDashboard: React.FC<ViewUserDashboardProps> = ({
accessToken, accessToken,