This commit is contained in:
Sense T 2024-04-22 12:35:37 +08:00
parent 8960b77828
commit c388df3f15
3 changed files with 28 additions and 0 deletions

20
main.go
View File

@ -1,3 +1,23 @@
/*
reCoreD-UI provides web ui for CoreDNS
NAME:
reCoreD-UI - Web UI for CoreDNS
USAGE:
reCoreD-UI [global options] command [command options]
COMMANDS:
server run server
config config some settings
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--config value, -c value config yaml file [$RECORED_CONFIG_FILE]
--mysql-dsn value mysql dsn [$RECORED_MYSQL_DSN]
--debug enable debug mode (default: false)
--help, -h show help
*/
package main package main
import ( import (

View File

@ -18,6 +18,7 @@ type Props = {
createRecord(record: Record): Promise<void> createRecord(record: Record): Promise<void>
} }
// convert enum RecordTypes to a list for select options.
const recordTypeOptions = Object.entries(RecordTypes).filter(e => e[1] !== RecordTypes.RecordTypeSOA).map(e => { const recordTypeOptions = Object.entries(RecordTypes).filter(e => e[1] !== RecordTypes.RecordTypeSOA).map(e => {
return { return {
value: e[1], value: e[1],
@ -246,6 +247,8 @@ export default function RecordEditModal({ open, record, onOk, onCancel, editReco
</Form.Item> </Form.Item>
<Form.Item<Record> noStyle shouldUpdate={(p, c) => p.record_type !== c.record_type}> <Form.Item<Record> noStyle shouldUpdate={(p, c) => p.record_type !== c.record_type}>
{ {
// load form for record type from the map 'controls'.
// this is a dynamic form
({ getFieldValue }: FormInstance<Record>) => { ({ getFieldValue }: FormInstance<Record>) => {
const e = controls.get(getFieldValue('record_type')) const e = controls.get(getFieldValue('record_type'))
if (!e) { if (!e) {

View File

@ -1,3 +1,8 @@
/*
Web UI for reCoreD-UI
Use React and ant-design now.
JSX/TSX is cool!
*/
import React from 'react' import React from 'react'
import ReactDOM from 'react-dom/client' import ReactDOM from 'react-dom/client'
import App from './App.tsx' import App from './App.tsx'