Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Environments Refactor + New Plugin Updates#1684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
FalkWolsky merged 8 commits intolowcoder-org:ee-setupfromiamfaran:environments
May 8, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
import React, {useState} from "react";
import { useParams } from "react-router-dom";
import {
Spin,
Typography,
Expand All@@ -8,25 +7,18 @@ import {
Tabs,
Alert,
Descriptions,
Dropdown,
Menu,
Button,
Breadcrumb,
} from "antd";
import {
ReloadOutlined,
LinkOutlined,
ClusterOutlined,
TeamOutlined,
UserOutlined,
SyncOutlined,
EditOutlined,
EllipsisOutlined,
MoreOutlined,
HomeOutlined
} from "@ant-design/icons";

import {useEnvironmentContext } from "./context/EnvironmentContext";
import {useSingleEnvironmentContext } from "./context/SingleEnvironmentContext";
import { workspaceConfig } from "./config/workspace.config";
import { userGroupsConfig } from "./config/usergroups.config";
import DeployableItemsTab from "./components/DeployableItemsTab";
Expand All@@ -37,21 +29,18 @@ import history from "@lowcoder-ee/util/history";
const { Title, Text } = Typography;
const { TabPane } = Tabs;


/**
* Environment Detail Page Component
* Shows detailed information about a specific environment
*/
const EnvironmentDetail: React.FC = () => {
//Get environment ID from URL params
//Use the SingleEnvironmentContext instead of EnvironmentContext
const {
environment,
isLoadingEnvironment,
isLoading,
error,
updateEnvironmentData
} = useEnvironmentContext();


} = useSingleEnvironmentContext();

const [isEditModalVisible, setIsEditModalVisible] = useState(false);
const [isUpdating, setIsUpdating] = useState(false);
Expand All@@ -67,11 +56,16 @@ const EnvironmentDetail: React.FC = () => {
};

// Handle save environment
const handleSaveEnvironment = async (environmentId: string, data: Partial<Environment>) => {
const handleSaveEnvironment = async (data: Partial<Environment>) => {
if (!environment) return;

setIsUpdating(true);
try {
await updateEnvironmentData(environmentId, data);
// Close the modal first, before the update completes
handleCloseModal();

// Then update the environment data
await updateEnvironmentData(data);
} catch (error) {
console.error('Failed to update environment:', error);
} finally {
Expand All@@ -89,7 +83,7 @@ const EnvironmentDetail: React.FC = () => {
</Menu>
);

if (isLoadingEnvironment) {
if (isLoading) {
return (
<div style={{ display: 'flex', justifyContent: 'center', padding: '50px' }}>
<Spin size="large" tip="Loading environment..." />
Expand All@@ -107,6 +101,7 @@ const EnvironmentDetail: React.FC = () => {
/>
);
}

return (
<div
className="environment-detail-container"
Expand All@@ -124,7 +119,6 @@ const EnvironmentDetail: React.FC = () => {
<Breadcrumb.Item>{environment.environmentName}</Breadcrumb.Item>
</Breadcrumb>

{/* Header with environment name and controls */}
{/* Header with environment name and controls */}
<div
className="environment-header"
Expand DownExpand Up@@ -231,6 +225,7 @@ const EnvironmentDetail: React.FC = () => {
/>
</TabPane>
</Tabs>

{/* Edit Environment Modal */}
{environment && (
<EditEnvironmentModal
Expand All@@ -245,4 +240,4 @@ const EnvironmentDetail: React.FC = () => {
);
};

export default EnvironmentDetail;
export default EnvironmentDetail;
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
// client/packages/lowcoder/src/pages/setting/environments/Environments.tsx
import React from "react";
import { Switch, Route } from "react-router-dom";
import { Switch, Route, useRouteMatch } from "react-router-dom";
import { EnvironmentProvider } from "./context/EnvironmentContext";
import EnvironmentRoutes from "./routes/EnvironmentRoutes";
import EnvironmentsList from "./EnvironmentsList";
import EnvironmentScopedRoutes from "./components/EnvironmentScopedRoutes";

import {
ENVIRONMENT_SETTING,
ENVIRONMENT_DETAIL
} from "@lowcoder-ee/constants/routesURL";

/**
* Top-level Environments component that wraps all environment-related routes
*with the EnvironmentProviderfor shared state management
* Top-level Environments component
*Provides the EnvironmentProviderat the top level
*/
const Environments: React.FC = () => {
const { path } = useRouteMatch();

return (
<EnvironmentProvider>
<Switch>
{/*Route that shows thelistof environments */}
<Route exact path={ENVIRONMENT_SETTING}>
{/*Environmentlistroute */}
<Route exact path={path}>
<EnvironmentsList />
</Route>

{/* Allotherroutesunder /environments/:envId */}
<Route path={ENVIRONMENT_DETAIL}>
<EnvironmentScopedRoutes />
{/* All routesthat need a specific environment */}
<Route path={`${path}/:envId`}>
<EnvironmentRoutes />
</Route>
</Switch>
</EnvironmentProvider>
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,7 @@ const EnvironmentsList: React.FC = () => {
// Use the shared context instead of a local hook
const {
environments,
isLoadingEnvironments,
isLoading,
error,
} = useEnvironmentContext();

Expand DownExpand Up@@ -83,7 +83,7 @@ const EnvironmentsList: React.FC = () => {
)}

{/* Empty state handling */}
{!isLoadingEnvironments && environments.length === 0 && !error ? (
{!isLoading && environments.length === 0 && !error ? (
<Empty
description="No environments found"
image={Empty.PRESENTED_IMAGE_SIMPLE}
Expand All@@ -92,7 +92,7 @@ const EnvironmentsList: React.FC = () => {
/* Table component */
<EnvironmentsTable
environments={filteredEnvironments}
loading={isLoadingEnvironments}
loading={isLoading}
onRowClick={handleRowClick}
/>
)}
Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp