## Description - Introducing artifact aware permissions - Better error handling for sagas - New API contracts for local profile Fixes https://github.com/appsmithorg/appsmith/issues/38505 ## Automation /ok-to-test tags="@tag.Git" ### 🔍 Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/13375089313> > Commit: 13aa020d4699a94ab5464e1a92b024d4068896b2 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=13375089313&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.Git` > Spec: > <hr>Mon, 17 Feb 2025 17:44:17 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced Git integration with adaptive connection messages and success modals that now reflect the type of artifact being handled. - Added support for storing additional Git metadata to improve artifact management. - **Refactor** - Streamlined error handling across Git operations to ensure more reliable feedback. - Updated permission structures and context management to deliver a more robust and flexible Git experience. - **Chores** - Consolidated module organization and improved type consistency for better maintainability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
101 lines
2.6 KiB
TypeScript
101 lines
2.6 KiB
TypeScript
import React, { useEffect, useState } from "react";
|
|
import PageWrapper from "pages/common/PageWrapper";
|
|
import styled from "styled-components";
|
|
import { Tabs, Tab, TabsList, TabPanel } from "@appsmith/ads";
|
|
import General from "./General";
|
|
import OldGitConfig from "./GitConfig";
|
|
import { useLocation } from "react-router";
|
|
import { GIT_PROFILE_ROUTE } from "constants/routes";
|
|
import { BackButton } from "components/utils/helperComponents";
|
|
import { useDispatch } from "react-redux";
|
|
import { fetchGlobalGitConfigInit } from "actions/gitSyncActions";
|
|
import { useGitModEnabled } from "pages/Editor/gitSync/hooks/modHooks";
|
|
import { GitGlobalProfile as GitGlobalProfileNew } from "git";
|
|
import { gitFetchGlobalProfile } from "git/store";
|
|
|
|
function GitGlobalProfile() {
|
|
const isGitModEnabled = useGitModEnabled();
|
|
|
|
return isGitModEnabled ? <GitGlobalProfileNew /> : <OldGitConfig />;
|
|
}
|
|
|
|
const ProfileWrapper = styled.div`
|
|
width: 978px;
|
|
margin: var(--ads-v2-spaces-7) auto;
|
|
padding-left: var(--ads-v2-spaces-7);
|
|
|
|
.tab-item {
|
|
display: flex;
|
|
gap: 5px;
|
|
align-items: center;
|
|
}
|
|
`;
|
|
|
|
function UserProfile() {
|
|
const location = useLocation();
|
|
const dispatch = useDispatch();
|
|
const isGitModEnabled = useGitModEnabled();
|
|
|
|
let initialTab = "general";
|
|
const tabs = [
|
|
{
|
|
key: "general",
|
|
title: "General",
|
|
panelComponent: <General />,
|
|
icon: "general",
|
|
},
|
|
];
|
|
|
|
tabs.push({
|
|
key: "gitConfig",
|
|
title: "Git user config",
|
|
panelComponent: <GitGlobalProfile />,
|
|
icon: "git-branch",
|
|
});
|
|
|
|
if (location.pathname === GIT_PROFILE_ROUTE) {
|
|
initialTab = "gitConfig";
|
|
}
|
|
|
|
const [selectedTab, setSelectedTab] = useState(initialTab);
|
|
|
|
useEffect(
|
|
function fetchGlobalGitConfigOnInitEffect() {
|
|
if (isGitModEnabled) {
|
|
dispatch(gitFetchGlobalProfile());
|
|
} else {
|
|
dispatch(fetchGlobalGitConfigInit());
|
|
}
|
|
},
|
|
[dispatch, isGitModEnabled],
|
|
);
|
|
|
|
return (
|
|
<PageWrapper displayName={"Profile"}>
|
|
<ProfileWrapper>
|
|
<BackButton />
|
|
<Tabs defaultValue={selectedTab} onValueChange={setSelectedTab}>
|
|
<TabsList>
|
|
{tabs.map((tab) => {
|
|
return (
|
|
<Tab key={tab.key} value={tab.key}>
|
|
<div className="tab-item">{tab.title}</div>
|
|
</Tab>
|
|
);
|
|
})}
|
|
</TabsList>
|
|
{tabs.map((tab) => {
|
|
return (
|
|
<TabPanel key={tab.key} value={tab.key}>
|
|
{tab.panelComponent}
|
|
</TabPanel>
|
|
);
|
|
})}
|
|
</Tabs>
|
|
</ProfileWrapper>
|
|
</PageWrapper>
|
|
);
|
|
}
|
|
|
|
export default UserProfile;
|