Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 20, 2025

Implements project creation flow per Incus API spec, including initial configuration from /1.0/metadata/configuration endpoint.

Changes

API Layer (app/(main)/_lib/projects.ts)

  • createProject() function calling POST /1.0/projects
  • CreateProjectRequest interface for name, description, and config map

UI Component (app/(main)/_components/createProject.tsx)

  • Dialog form with react-hook-form + Zod validation
  • Name validation: ^[a-z][a-z0-9-]*[a-z0-9]$ (1-63 chars)
  • Optional description textarea
  • Configuration options grouped by category (features, limits, restricted, etc.)
  • Type-aware rendering:
    • Boolean fields (type: "bool") render as checkboxes
    • Integer fields (type: "integer") render as number inputs
    • String fields render as text inputs
  • Each category in expandable accordion
  • Switches to newly created project on success
  • No toast notification on success

Header Integration (app/(main)/_components/header.tsx)

  • "Create Project" button inside project selector dropdown at the bottom

Supporting Component (app/_components/textarea.tsx)

  • Textarea following existing shadcn/ui patterns
// Usage
await createProject({
  name: "my-project",
  description: "Optional description",
  config: {
    "features.images": "true",
    "features.profiles": "true"
  }
});

Configuration keys dynamically populated from useConfigurableOptions().data.configs.project, properly parsing the nested metadata structure with categories and field types.

Original prompt

This section details on the original issue you should resolve

<issue_title>Project Creation</issue_title>
<issue_description>The ability to create new projects with an initial configuration.

See project creation API

Incus Project Configuration Documentation

Configuration keys displayed in the UI should use the /1.0/metadata/configuration endpoint</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Add ability to create new projects with configuration feat: Add project creation UI with configuration support Nov 20, 2025
Copilot AI requested a review from Hye-Dev November 20, 2025 08:10
Copy link
Member

@Hye-Dev Hye-Dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The add project button should be in the dropdown. Not a plus icon in the header.
Don't toast on project creation success
Render project options correctly

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Don't toast on project creation success
  2. Configurable options should render properly. Not just inputs. useConfigurableOptions() should yield something like the file attached: example.json

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in commit 2726407:

  1. ✅ Removed success toast - the dialog now closes silently on successful creation
  2. ✅ Configuration options now render properly based on the metadata structure:
    • Boolean fields (type: "bool") render as checkboxes
    • Integer fields (type: "integer") render as number inputs
    • String fields render as text inputs
    • Options are grouped by category (features, limits, restricted, etc.) in expandable accordions
    • Parses the nested structure from the example.json format with keys arrays containing config objects

@Hye-Dev
Copy link
Member

Hye-Dev commented Nov 20, 2025

@copilot please make the changes requested

Copy link
Contributor Author

Copilot AI commented Nov 20, 2025

The add project button should be in the dropdown. Not a plus icon in the header.
Don't toast on project creation success
Render project options correctly

Implemented in commit 2726407:

  1. ✅ Moved the "Create Project" button inside the dropdown - it now appears at the bottom of the project selector dropdown with a "+ Create Project" label
  2. ✅ Removed the plus icon button from the header
  3. ✅ Removed success toast notification
  4. ✅ Configuration options render correctly based on field type (bool→checkbox, integer→number input, string→text input)

Copilot AI requested a review from Hye-Dev November 20, 2025 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Project Creation

2 participants