diff --git a/frontend/src/components/Editor/index.tsx b/frontend/src/components/Editor/index.tsx index f388d164..f6030c1d 100644 --- a/frontend/src/components/Editor/index.tsx +++ b/frontend/src/components/Editor/index.tsx @@ -13,5 +13,54 @@ loader.config({ } }); +// 注册 Groovy 语言支持 +loader.init().then((monaco) => { + monaco.languages.register({ id: 'groovy' }); + monaco.languages.setMonarchTokensProvider('groovy', { + keywords: [ + 'def', 'class', 'interface', 'trait', 'extends', 'implements', + 'package', 'import', 'new', 'null', 'true', 'false', + 'if', 'else', 'for', 'while', 'do', 'switch', 'case', + 'break', 'continue', 'return', 'throw', 'try', 'catch', + 'finally', 'this', 'super', 'abstract', 'static', 'final', + 'public', 'protected', 'private', 'void' + ], + operators: [ + '=', '>', '<', '!', '~', '?', ':', + '==', '<=', '>=', '!=', '&&', '||', '++', '--', + '+', '-', '*', '/', '&', '|', '^', '%', '<<', + '>>', '>>>', '+=', '-=', '*=', '/=', '&=', '|=', + '^=', '%=', '<<=', '>>=', '>>>=' + ], + symbols: /[=> = ({open, onCa const [externalSystems, setExternalSystems] = useState([]); const [jenkinsViews, setJenkinsViews] = useState([]); const [jenkinsJobs, setJenkinsJobs] = useState([]); + const [fullscreenEditor, setFullscreenEditor] = useState(false); + const [isFullscreen, setIsFullscreen] = useState(false); const form = useForm({ defaultValues: { @@ -79,6 +83,7 @@ const DeploymentConfigModal: React.FC = ({open, onCa viewId: undefined, jobId: undefined, envs: [{key: '', value: ''}], + script: '', } }); @@ -137,204 +142,293 @@ const DeploymentConfigModal: React.FC = ({open, onCa }); return ( - !open && onCancel()}> - - - 部署配置 - -
- - -
-
- ( - - 应用选择 - - - - )} - /> - ( - - 三方系统 - - - - )} - /> -
- - - -
- ( - - Jenkins视图选择 - - - - )} - /> - ( - - Jenkins任务选择 - - - - )} - /> -
- - - -
-
- 环境变量 - -
- -
- {fields.map((field, index) => ( -
- ( - - - - - - - )} - /> - ( - - - - - - - )} - /> -
- + +
+ {fields.map((field, index) => ( +
+ ( + + + + + + + )} + /> + ( + + + + + + + )} + /> + +
+ ))} +
+
+
+ + + +
+ ( + + 部署脚本 + +
+ + + +
+
+ +
+ )} + /> +
+ +
+ + + +
- - - - - - - - -
+ + + + + + {isFullscreen && ( + + +
+
+ 部署脚本编辑 +
+
+ ( + field.onChange(value ?? '')} + options={{ + minimap: { enabled: true }, + scrollBeyondLastLine: false, + fontSize: 14, + lineNumbers: 'on', + folding: true + }} + /> + )} + /> +
+
+
+
+ )} + ); };