* Add Iceberg table details view
* Enhance Iceberg catalog browsing UI
* Fix Iceberg UI security and logic issues
- Fix selectSchema() and partitionFieldsFromFullMetadata() to always search for matching IDs instead of checking != 0
- Fix snapshotsFromFullMetadata() to defensive-copy before sorting to prevent mutating caller's slice
- Fix XSS vulnerabilities in s3tables.js: replace innerHTML with textContent/createElement for user-controlled data
- Fix deleteIcebergTable() to redirect to namespace tables list on details page instead of reloading
- Fix data-bs-target in iceberg_namespaces.templ: remove templ.SafeURL for CSS selector
- Add catalogName to delete modal data attributes for proper redirect
- Remove unused hidden inputs from create table form (icebergTableBucketArn, icebergTableNamespace)
* Regenerate templ files for Iceberg UI updates
* Support complex Iceberg type objects in schema
Change Type field from string to json.RawMessage in both IcebergSchemaFieldInfo
and internal icebergSchemaField to properly handle Iceberg spec's complex type
objects (e.g. {"type": "struct", "fields": [...]}). Currently test data
only shows primitive string types, but this change makes the implementation
defensively robust for future complex types by preserving the exact JSON
representation. Add typeToString() helper and update schema extraction
functions to marshal string types as JSON. Update template to convert
json.RawMessage to string for display.
* Regenerate templ files for Type field changes
* templ
* Fix additional Iceberg UI issues from code review
- Fix lazy-load flag that was set before async operation completed, preventing retries
on error; now sets loaded flag only after successful load and throws error to caller
for proper error handling and UI updates
- Add zero-time guards for CreatedAt and ModifiedAt fields in table details to avoid
displaying Go zero-time values; render dash when time is zero
- Add URL path escaping for all catalog/namespace/table names in URLs to prevent
malformed URLs when names contain special characters like /, ?, or #
- Remove redundant innerHTML clear in loadIcebergNamespaceTables that cleared twice
before appending the table list
- Fix selectSnapshotForMetrics to remove != 0 guard for consistency with selectSchema
fix; now always searches for CurrentSnapshotID without zero-value gate
- Enhance typeToString() helper to display '(complex)' for non-primitive JSON types
* Regenerate templ files for Phase 3 updates
* Fix template generation to use correct file paths
Run templ generate from repo root instead of weed/admin directory to ensure
generated _templ.go files have correct absolute paths in error messages
(e.g., 'weed/admin/view/app/iceberg_table_details.templ' instead of
'app/iceberg_table_details.templ'). This ensures both 'make admin-generate'
at repo root and 'make generate' in weed/admin directory produce identical
output with consistent file path references.
* Regenerate template files with correct path references
* Validate S3 Tables names in UI
- Add client-side validation for table bucket and namespace names to surface
errors for invalid characters (dots/underscores) before submission
- Use HTML validity messages with reportValidity for immediate feedback
- Update namespace helper text to reflect actual constraints (single-level,
lowercase letters, numbers, and underscores)
* Regenerate templ files for namespace helper text
* Fix Iceberg catalog REST link and actions
* Disallow S3 object access on table buckets
* Validate Iceberg layout for table bucket objects
* Fix REST API link to /v1/config
* merge iceberg page with table bucket page
* Allowed Trino/Iceberg stats files in metadata validation
* fixes
- Backend/data handling:
- Normalized Iceberg type display and fallback handling in weed/admin/dash/s3tables_management.go.
- Fixed snapshot fallback pointer semantics in weed/admin/dash/s3tables_management.go.
- Added CSRF token generation/propagation/validation for namespace create/delete in:
- weed/admin/dash/csrf.go
- weed/admin/dash/auth_middleware.go
- weed/admin/dash/middleware.go
- weed/admin/dash/s3tables_management.go
- weed/admin/view/layout/layout.templ
- weed/admin/static/js/s3tables.js
- UI/template fixes:
- Zero-time guards for CreatedAt fields in:
- weed/admin/view/app/iceberg_namespaces.templ
- weed/admin/view/app/iceberg_tables.templ
- Fixed invalid templ-in-script interpolation and host/port rendering in:
- weed/admin/view/app/iceberg_catalog.templ
- weed/admin/view/app/s3tables_buckets.templ
- Added data-catalog-name consistency on Iceberg delete action in weed/admin/view/app/iceberg_tables.templ.
- Updated retry wording in weed/admin/static/js/s3tables.js.
- Regenerated all affected _templ.go files.
- S3 API/comment follow-ups:
- Reused cached table-bucket validator in weed/s3api/bucket_paths.go.
- Added validation-failure debug logging in weed/s3api/s3api_object_handlers_tagging.go.
- Added multipart path-validation design comment in weed/s3api/s3api_object_handlers_multipart.go.
- Build tooling:
- Fixed templ generate working directory issues in weed/admin/Makefile (watch + pattern rule).
* populate data
* test/s3tables: harden populate service checks
* admin: skip table buckets in object-store bucket list
* admin sidebar: move object store to top-level links
* admin iceberg catalog: guard zero times and escape links
* admin forms: add csrf/error handling and client-side name validation
* admin s3tables: fix namespace delete modal redeclaration
* admin: replace native confirm dialogs with modal helpers
* admin modal-alerts: remove noisy confirm usage console log
* reduce logs
* test/s3tables: use partitioned tables in trino and spark populate
* admin file browser: normalize filer ServerAddress for HTTP parsing
164 lines
4.9 KiB
Makefile
164 lines
4.9 KiB
Makefile
# SeaweedFS Admin Component Makefile
|
|
|
|
# Variables
|
|
ADMIN_DIR := .
|
|
VIEW_DIR := $(ADMIN_DIR)/view
|
|
STATIC_DIR := $(ADMIN_DIR)/static
|
|
TEMPL_FILES := $(shell find $(VIEW_DIR) -name "*.templ")
|
|
TEMPL_GO_FILES := $(TEMPL_FILES:.templ=_templ.go)
|
|
GO_FILES := $(shell find $(ADMIN_DIR) -name "*.go" -not -name "*_templ.go")
|
|
BUILD_DIR := ../..
|
|
WEED_BINARY := $(BUILD_DIR)/weed
|
|
|
|
# Default target
|
|
.PHONY: all
|
|
all: build
|
|
|
|
# Install templ if not present
|
|
.PHONY: install-templ
|
|
install-templ:
|
|
@which templ > /dev/null || (echo "Installing templ..." && go install github.com/a-h/templ/cmd/templ@latest)
|
|
|
|
# Generate templ files
|
|
.PHONY: generate
|
|
generate: install-templ
|
|
@echo "Generating templ files..."
|
|
@cd $(BUILD_DIR) && templ generate
|
|
@echo "Generated: $(TEMPL_GO_FILES)"
|
|
|
|
# Clean generated files
|
|
.PHONY: clean-templ
|
|
clean-templ:
|
|
@echo "Cleaning generated templ files..."
|
|
@find $(VIEW_DIR) -name "*_templ.go" -delete
|
|
@echo "Cleaned templ files"
|
|
|
|
# Watch for changes and regenerate
|
|
.PHONY: watch
|
|
watch: install-templ
|
|
@echo "Watching for templ file changes..."
|
|
@cd $(BUILD_DIR) && templ generate --watch
|
|
|
|
# Build the main weed binary with admin component
|
|
.PHONY: build
|
|
build: generate
|
|
@echo "Building weed binary with admin component..."
|
|
@cd $(BUILD_DIR) && go build -o weed ./weed
|
|
@echo "Built: $(BUILD_DIR)/weed"
|
|
|
|
# Test the admin component
|
|
.PHONY: test
|
|
test: generate
|
|
@echo "Running admin component tests..."
|
|
@go test ./...
|
|
|
|
# Run the admin server via weed command
|
|
.PHONY: run
|
|
run: build
|
|
@echo "Starting admin server via weed command..."
|
|
@cd $(BUILD_DIR) && ./weed admin
|
|
|
|
# Development server with auto-reload
|
|
.PHONY: dev
|
|
dev: generate
|
|
@echo "Starting development server with auto-reload..."
|
|
@echo "Note: You'll need to manually restart the server when Go files change"
|
|
@cd $(BUILD_DIR) && ./weed admin -port=23647 &
|
|
@$(MAKE) watch
|
|
|
|
# Lint the code
|
|
.PHONY: lint
|
|
lint:
|
|
@echo "Linting admin component..."
|
|
@golangci-lint run ./...
|
|
|
|
# Format the code
|
|
.PHONY: fmt
|
|
fmt:
|
|
@echo "Formatting Go code..."
|
|
@go fmt ./...
|
|
@echo "Formatting templ files..."
|
|
@templ fmt $(VIEW_DIR)
|
|
|
|
# Validate static files exist
|
|
.PHONY: validate-static
|
|
validate-static:
|
|
@echo "Validating static files..."
|
|
@test -f $(STATIC_DIR)/css/admin.css || (echo "Missing: admin.css" && exit 1)
|
|
@test -f $(STATIC_DIR)/js/admin.js || (echo "Missing: admin.js" && exit 1)
|
|
@echo "Static files validated"
|
|
|
|
# Check dependencies
|
|
.PHONY: deps
|
|
deps:
|
|
@echo "Checking dependencies..."
|
|
@go mod tidy
|
|
@go mod verify
|
|
|
|
# Clean all build artifacts
|
|
.PHONY: clean
|
|
clean: clean-templ
|
|
@echo "Cleaning build artifacts..."
|
|
@rm -f $(BUILD_DIR)/weed 2>/dev/null || true
|
|
@echo "Cleaned build artifacts"
|
|
|
|
# Install dependencies
|
|
.PHONY: install-deps
|
|
install-deps:
|
|
@echo "Installing Go dependencies..."
|
|
@go mod download
|
|
@$(MAKE) install-templ
|
|
|
|
# Production build
|
|
.PHONY: build-prod
|
|
build-prod: clean generate validate-static
|
|
@echo "Building production binary..."
|
|
@cd $(BUILD_DIR) && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" -o weed-linux-amd64 ./weed
|
|
@echo "Built production binary: $(BUILD_DIR)/weed-linux-amd64"
|
|
|
|
# Docker build (if needed)
|
|
.PHONY: docker-build
|
|
docker-build: generate
|
|
@echo "Building Docker image with admin component..."
|
|
@cd $(BUILD_DIR) && docker build -t seaweedfs/seaweedfs:latest .
|
|
|
|
# Help target
|
|
.PHONY: help
|
|
help:
|
|
@echo "SeaweedFS Admin Component Makefile"
|
|
@echo ""
|
|
@echo "Available targets:"
|
|
@echo " all - Build the weed binary with admin component (default)"
|
|
@echo " generate - Generate templ files from templates"
|
|
@echo " build - Build weed binary with admin component"
|
|
@echo " build-prod - Build production binary"
|
|
@echo " run - Run admin server via weed command"
|
|
@echo " dev - Start development server with template watching"
|
|
@echo " test - Run tests"
|
|
@echo " watch - Watch for template changes and regenerate"
|
|
@echo " clean - Clean all build artifacts"
|
|
@echo " clean-templ - Clean generated template files"
|
|
@echo " fmt - Format Go and templ code"
|
|
@echo " lint - Lint the code"
|
|
@echo " deps - Check and tidy dependencies"
|
|
@echo " install-deps - Install all dependencies"
|
|
@echo " install-templ - Install templ compiler"
|
|
@echo " validate-static - Validate static files exist"
|
|
@echo " docker-build - Build Docker image"
|
|
@echo " help - Show this help message"
|
|
@echo ""
|
|
@echo "Examples:"
|
|
@echo " make generate # Generate templates"
|
|
@echo " make build # Build weed binary"
|
|
@echo " make run # Start admin server"
|
|
@echo " make dev # Development mode with auto-reload"
|
|
|
|
# Make sure generated files are up to date before building
|
|
$(WEED_BINARY): $(TEMPL_GO_FILES) $(GO_FILES)
|
|
@$(MAKE) build
|
|
|
|
# Auto-generate templ files when .templ files change
|
|
%_templ.go: %.templ
|
|
@echo "Regenerating $@ from $<"
|
|
@cd $(BUILD_DIR) && templ generate
|