diff --git a/TestMasterUI/src/App.jsx b/TestMasterUI/src/App.jsx index 7394490..537fba0 100644 --- a/TestMasterUI/src/App.jsx +++ b/TestMasterUI/src/App.jsx @@ -5,6 +5,7 @@ import APITester from './components/APITester'; import LoadTestManager from './components/LoadTestManager'; import {monacoConfig} from '@/config/monaco.js'; import LoginDialog from '@/components/LoginDialog.jsx'; +import {Menubar, MenubarContent, MenubarItem, MenubarMenu, MenubarSeparator, MenubarTrigger} from '@/components/ui/menubar.jsx'; window.MonacoEnvironment = monacoConfig; @@ -18,6 +19,104 @@ const App = ({ options = { type: 'api', contextPath: '/' } }) => { ); }; +const menuConfig = [ + { + id: 'response', + label: '응답관리', + items: [ + {id: 'response-list', label: '응답목록', action: 'response-list'}, + {id: 'response-add', label: '응답추가', action: 'response-add'} + ] + }, + { + id: 'request', + label: '요청관리', + items: [ + {id: 'collection-add', label: '컬렉션 추가', action: 'collection-add'}, + {id: 'request-add', label: '요청 추가', action: 'request-add'}, + {id: 'scenario-add', label: '시나리오 추가', action: 'scenario-add'}, + {id: 'variables-show', label: '변수 보기', action: 'variables-show'}, + ] + }, + { + id: 'queue', + label: '큐관리', + items: [ + {id: 'queue-status', label: '큐상태', action: 'queue-status'}, + {id: 'queue-settings', label: '큐설정', action: 'queue-settings'} + ] + }, + { + id: 'loadtest', + label: '부하테스트', + items: [ + {id: 'load-test-new', label: '새 테스트', action: 'load-test-new'}, + {id: 'load-test-history', label: '테스트 이력', action: 'load-test-history'}, + {id: 'load-test-reports', label: '결과 리포트', action: 'load-test-reports'} + ] + }, + { + id: 'system', + label: '시스템관리', + items: [ + {id: 'system-settings', label: '시스템설정', action: 'system-settings'}, + {id: 'user-management', label: '사용자관리', action: 'user-management'}, + {type: 'separator'}, + {id: 'system-logs', label: '시스템로그', action: 'system-logs'} + ] + }, + { + id: 'account', + label: '계정', + items: [ + {id: 'change-password', label: '비밀번호변경', action: 'change-password'}, + {type: 'separator'}, + {id: 'logout', label: '로그아웃', action: 'logout'} + ] + } +]; + +const MenuItem = ({item, onMenuClick}) => { + if (item.type === 'separator') { + return ; + } + + return ( + onMenuClick(item.action)}> + {item.label} + + ); +}; + +const handleMenuClick = async (action) => { + // Handle menu item clicks + console.log('Menu action:', action); + switch (action) { + case 'request-add': + setShowAddApi(true); + break; + case 'collection-add': + setShowAddCollection(true); + break; + case 'scenario-add': + setShowAddScenario(true); + break; + case 'variables-show': + setShowVariableModal(true); + break; + case 'logout': + const success = await handleLogout(); + if (success) { + window.location.href = "/actionLogout.do"; + } + break; + case 'change-password': + // Handle password change + break; + // Add other cases as needed + } +}; + const AppContent = ({ options, showLogin, setShowLogin }) => { const { isAuthenticated, setIsAuthenticated } = useAPI(); const [isInitialized, setIsInitialized] = useState(false); @@ -59,6 +158,35 @@ const AppContent = ({ options, showLogin, setShowLogin }) => { return (
+
+
+
+ testmaster +
+ + {menuConfig.map((menu) => ( + + + {menu.label} + + + {menu.items.map((item, index) => ( + + ))} + + + ))} + +
+
{options.type === 'api' ? ( ) : ( diff --git a/TestMasterUI/src/components/APITester.jsx b/TestMasterUI/src/components/APITester.jsx index d8c1cf1..c6dfc44 100644 --- a/TestMasterUI/src/components/APITester.jsx +++ b/TestMasterUI/src/components/APITester.jsx @@ -1,5 +1,4 @@ import React, {useState} from 'react'; -import {Menubar, MenubarContent, MenubarItem, MenubarMenu, MenubarSeparator, MenubarTrigger} from '@/components/ui/menubar'; import MainContentArea from '@/components/MainContentArea.jsx'; import {useAPI} from '@/providers/APIProvider.jsx'; import AddCollectionDialog from '@/components/api-tester/AddCollectionDialog.jsx'; @@ -8,75 +7,6 @@ import AddScenarioDialog from '@/components/api-tester/AddScenarioDialog.jsx'; import {useLoadTest} from '@/providers/LoadTestProvider.jsx'; import VariableModal from '@/components/api-tester/VariableModal.jsx'; -const menuConfig = [ - { - id: 'response', - label: '응답관리', - items: [ - {id: 'response-list', label: '응답목록', action: 'response-list'}, - {id: 'response-add', label: '응답추가', action: 'response-add'} - ] - }, - { - id: 'request', - label: '요청관리', - items: [ - {id: 'collection-add', label: '컬렉션 추가', action: 'collection-add'}, - {id: 'request-add', label: '요청 추가', action: 'request-add'}, - {id: 'scenario-add', label: '시나리오 추가', action: 'scenario-add'}, - {id: 'variables-show', label: '변수 보기', action: 'variables-show'}, - ] - }, - { - id: 'queue', - label: '큐관리', - items: [ - {id: 'queue-status', label: '큐상태', action: 'queue-status'}, - {id: 'queue-settings', label: '큐설정', action: 'queue-settings'} - ] - }, - { - id: 'loadtest', - label: '부하테스트', - items: [ - {id: 'load-test-new', label: '새 테스트', action: 'load-test-new'}, - {id: 'load-test-history', label: '테스트 이력', action: 'load-test-history'}, - {id: 'load-test-reports', label: '결과 리포트', action: 'load-test-reports'} - ] - }, - { - id: 'system', - label: '시스템관리', - items: [ - {id: 'system-settings', label: '시스템설정', action: 'system-settings'}, - {id: 'user-management', label: '사용자관리', action: 'user-management'}, - {type: 'separator'}, - {id: 'system-logs', label: '시스템로그', action: 'system-logs'} - ] - }, - { - id: 'account', - label: '계정', - items: [ - {id: 'change-password', label: '비밀번호변경', action: 'change-password'}, - {type: 'separator'}, - {id: 'logout', label: '로그아웃', action: 'logout'} - ] - } -]; - -const MenuItem = ({item, onMenuClick}) => { - if (item.type === 'separator') { - return ; - } - - return ( - onMenuClick(item.action)}> - {item.label} - - ); -}; - const APITester = () => { // API 모드와 시나리오 모드 상태를 관리 const [isApiMode, setIsApiMode] = useState(true); @@ -120,68 +50,8 @@ const APITester = () => { } } - - const handleMenuClick = async (action) => { - // Handle menu item clicks - console.log('Menu action:', action); - switch (action) { - case 'request-add': - setShowAddApi(true); - break; - case 'collection-add': - setShowAddCollection(true); - break; - case 'scenario-add': - setShowAddScenario(true); - break; - case 'variables-show': - setShowVariableModal(true); - break; - case 'logout': - const success = await handleLogout(); - if (success) { - window.location.href = "/actionLogout.do"; - } - break; - case 'change-password': - // Handle password change - break; - // Add other cases as needed - } - }; - return (
- {/* Fixed Menubar */} -
-
-
- testmaster -
- - {menuConfig.map((menu) => ( - - - {menu.label} - - - {menu.items.map((item, index) => ( - - ))} - - - ))} - -
-
{/* Main content area with top padding for menubar */}
diff --git a/TestMasterUI/src/components/MainContentArea.jsx b/TestMasterUI/src/components/MainContentArea.jsx index f226097..6e79dc0 100644 --- a/TestMasterUI/src/components/MainContentArea.jsx +++ b/TestMasterUI/src/components/MainContentArea.jsx @@ -19,11 +19,10 @@ const MainContentArea = ({isApiMode, toggleMode}) => { } }; - window.addEventListener("keydown", handleKeyDown); - return () => window.removeEventListener("keydown", handleKeyDown); + window.addEventListener('keydown', handleKeyDown); + return () => window.removeEventListener('keydown', handleKeyDown); }, [toggleMode]); - return (
{isApiMode ? ( @@ -107,7 +106,7 @@ const APIMode = ({ collectionName: collection.name, server: api.server || null, description: api.description || '', - layout: api.layout || {}, + layout: api.layout || {} }; const existingIndex = apiRequests.findIndex( @@ -132,35 +131,35 @@ const APIMode = ({ ); return ( - -
-
- { - // Handle new collection creation - }} - isApiMode={isApiMode} - onToggleMode={onToggleMode} - /> + +
+
+ { + // Handle new collection creation + }} + isApiMode={isApiMode} + onToggleMode={onToggleMode} + /> +
+
+ {apiRequests.length === 0 ? ( + renderFallback() // Render fallback when no tabs exist + ) : ( + + )} +
-
- {apiRequests.length === 0 ? ( - renderFallback() // Render fallback when no tabs exist - ) : ( - - )} -
-
- + ); };