* Add schema management screen with list and editor * Implement table management screen with list and editor * Create data operations for schema and table management * Define UI rules and guidelines for consistency * Ensure circular tab navigation and keyboard shortcuts * Add forms for creating and editing schemas and tables * Implement confirmation dialogs for destructive actions
36 lines
929 B
Go
36 lines
929 B
Go
package ui
|
|
|
|
import (
|
|
"git.warky.dev/wdevs/relspecgo/pkg/models"
|
|
)
|
|
|
|
// createDomain creates a new domain
|
|
func (se *SchemaEditor) createDomain(name, description string) {
|
|
domain := &models.Domain{
|
|
Name: name,
|
|
Description: description,
|
|
Tables: make([]*models.DomainTable, 0),
|
|
Sequence: uint(len(se.db.Domains)),
|
|
}
|
|
|
|
se.db.Domains = append(se.db.Domains, domain)
|
|
se.showDomainList()
|
|
}
|
|
|
|
// updateDomain updates an existing domain
|
|
func (se *SchemaEditor) updateDomain(index int, name, description string) {
|
|
if index >= 0 && index < len(se.db.Domains) {
|
|
se.db.Domains[index].Name = name
|
|
se.db.Domains[index].Description = description
|
|
se.showDomainList()
|
|
}
|
|
}
|
|
|
|
// deleteDomain deletes a domain by index
|
|
func (se *SchemaEditor) deleteDomain(index int) {
|
|
if index >= 0 && index < len(se.db.Domains) {
|
|
se.db.Domains = append(se.db.Domains[:index], se.db.Domains[index+1:]...)
|
|
se.showDomainList()
|
|
}
|
|
}
|