Refactor code and fix database issues (#1484)
* Refactor chat.py for improved readability and maintainability * Add imports and fix formatting issues * Refactor database connection in Alembic env.py * Add nullable columns to tables and fix foreign key constraint * Update sqlalchemy logging level to DEBUG in alembic.ini * Add connection and inspector objects for database reflection * Refactor alembic initialization and migration process * Refactor version option in main_entry_point function * Remove pre-commit hook and format code * Fix database inspector type hinting * Add unique constraints and fix credential table
This commit is contained in:
parent
bef5f13eaa
commit
ba23f93463
26 changed files with 438 additions and 368 deletions
|
|
@ -20,8 +20,8 @@ import Router from "./routes";
|
|||
import useAlertStore from "./stores/alertStore";
|
||||
import { useDarkStore } from "./stores/darkStore";
|
||||
import useFlowsManagerStore from "./stores/flowsManagerStore";
|
||||
import { useTypesStore } from "./stores/typesStore";
|
||||
import { useStoreStore } from "./stores/storeStore";
|
||||
import { useTypesStore } from "./stores/typesStore";
|
||||
|
||||
export default function App() {
|
||||
const errorData = useAlertStore((state) => state.errorData);
|
||||
|
|
|
|||
|
|
@ -172,16 +172,26 @@ export default function NodeToolbarComponent({
|
|||
<IconComponent name="Copy" className="h-4 w-4" />
|
||||
</button>
|
||||
</ShadTooltip>
|
||||
{hasStore && (
|
||||
<ShadTooltip content={(!hasApiKey || !validApiKey) ? "Set a valid API key to share this component." : "Share"} side="top">
|
||||
{hasStore && (
|
||||
<ShadTooltip
|
||||
content={
|
||||
!hasApiKey || !validApiKey
|
||||
? "Set a valid API key to share this component."
|
||||
: "Share"
|
||||
}
|
||||
side="top"
|
||||
>
|
||||
<button
|
||||
className={classNames(
|
||||
"relative -ml-px inline-flex items-center bg-background px-2 py-2 text-foreground shadow-md ring-1 ring-inset ring-ring transition-all duration-500 ease-in-out hover:bg-muted focus:z-10",
|
||||
(!hasApiKey || !validApiKey) ? " text-muted-foreground cursor-not-allowed" : ""
|
||||
!hasApiKey || !validApiKey
|
||||
? " cursor-not-allowed text-muted-foreground"
|
||||
: ""
|
||||
)}
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
if (hasApiKey && hasStore && validApiKey) setShowconfirmShare(true);
|
||||
if (hasApiKey && hasStore && validApiKey)
|
||||
setShowconfirmShare(true);
|
||||
}}
|
||||
>
|
||||
<IconComponent name="Share3" className="-m-1 h-6 w-6" />
|
||||
|
|
|
|||
|
|
@ -21,11 +21,7 @@ import {
|
|||
SelectValue,
|
||||
} from "../../components/ui/select";
|
||||
import { AuthContext } from "../../contexts/authContext";
|
||||
import {
|
||||
checkHasApiKey,
|
||||
getStoreComponents,
|
||||
getStoreTags,
|
||||
} from "../../controllers/API";
|
||||
import { getStoreComponents, getStoreTags } from "../../controllers/API";
|
||||
import StoreApiKeyModal from "../../modals/StoreApiKeyModal";
|
||||
import useAlertStore from "../../stores/alertStore";
|
||||
import useFlowsManagerStore from "../../stores/flowsManagerStore";
|
||||
|
|
@ -46,9 +42,7 @@ export default function StorePage(): JSX.Element {
|
|||
const setCurrentFlowId = useFlowsManagerStore(
|
||||
(state) => state.setCurrentFlowId
|
||||
);
|
||||
const currentFlowId = useFlowsManagerStore(
|
||||
(state) => state.currentFlowId
|
||||
);
|
||||
const currentFlowId = useFlowsManagerStore((state) => state.currentFlowId);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [loadingTags, setLoadingTags] = useState(true);
|
||||
const { id } = useParams();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import { create } from "zustand";
|
||||
import { checkHasApiKey, checkHasStore } from "../controllers/API";
|
||||
import { StoreStoreType } from "../types/zustand/store";
|
||||
import useAlertStore from "./alertStore";
|
||||
|
||||
export const useStoreStore = create<StoreStoreType>((set) => ({
|
||||
hasStore: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue