Skip to content

feat(config): manage manual properties#3000

Open
adityathebe wants to merge 3 commits intomainfrom
feat/manual-config-properties
Open

feat(config): manage manual properties#3000
adityathebe wants to merge 3 commits intomainfrom
feat/manual-config-properties

Conversation

@adityathebe
Copy link
Copy Markdown
Member

@adityathebe adityathebe commented Apr 28, 2026

Add config sidebar actions for users to add and delete manually-owned config properties.

Manual add supports both text and numeric property values. Delete is exposed through a separate properties manage modal and calls the single-property delete RPC so users do not replace their whole owned property list.

Property ownership fields are carried through config property types so the UI only shows the current user's manual properties for deletion.

Summary by CodeRabbit

Release Notes

  • New Features
    • Added ability to add custom properties to configuration items with a dedicated modal interface.
    • Added ability to manage and delete user-created properties.
    • Property management now tracks creator information for better organization and ownership clarity.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 28, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
aws-preview Ready Ready Preview May 5, 2026 5:29pm
flanksource-ui Ready Ready Preview May 5, 2026 5:29pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 28, 2026

Warning

Rate limit exceeded

@adityathebe has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 59 minutes and 22 seconds before requesting another review.

To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 25671156-0df8-4e54-b1bd-2837651ed57f

📥 Commits

Reviewing files that changed from the base of the PR and between 5850fe0 and 3461369.

📒 Files selected for processing (7)
  • src/api/services/configs.ts
  • src/api/types/configs.ts
  • src/api/types/topology.ts
  • src/components/Configs/Sidebar/AddConfigPropertyModal.tsx
  • src/components/Configs/Sidebar/ConfigDetails.tsx
  • src/components/Configs/Sidebar/ManageConfigPropertiesModal.tsx
  • src/components/Topology/Sidebar/Utils/formatProperties.tsx

Walkthrough

This PR adds property management capabilities to configuration items. It extends the Property type with creator metadata, updates ConfigItem's property type, introduces RPC-based API services for adding and deleting properties, and implements two modal components for managing user-owned properties integrated into ConfigDetails.

Changes

Configuration Property Management

Layer / File(s) Summary
Type System Foundation
src/api/types/topology.ts, src/api/types/configs.ts
Property type gains optional created_by and creator_type fields; ConfigItem.properties is retyped from inline shape to Property[] | null.
API Services
src/api/services/configs.ts
New exported functions updateConfigItemProperties and deleteConfigItemProperty post to RPC endpoints with config/creator metadata, returning UpdateConfigItemPropertiesResponse.
Add Property Modal
src/components/Configs/Sidebar/AddConfigPropertyModal.tsx
AddConfigPropertyModal component filters existing user properties, validates form inputs (name and value/text), and submits updates via the new API function.
Manage Properties Modal
src/components/Configs/Sidebar/ManageConfigPropertiesModal.tsx
ManageConfigPropertiesModal component displays and allows deletion of user-owned properties, calling the delete API and refreshing the property list on success.
ConfigDetails Integration
src/components/Configs/Sidebar/ConfigDetails.tsx
Adds state for modal visibility, renders Properties section header with edit/add icon buttons, and mounts both modals with callbacks to refetch config.
Utility Signature Update
src/components/Topology/Sidebar/Utils/formatProperties.tsx
formatProperties parameter type broadened to accept objects with optional/nullable properties field alongside the existing Topology pick type.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and concisely summarizes the main change: adding the ability to manage manual properties in the config sidebar. It is specific, directly related to the changeset, and follows conventional commit format.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/manual-config-properties
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feat/manual-config-properties

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/Configs/Sidebar/ConfigDetails.tsx`:
- Around line 267-282: The "Edit properties" pencil icon and tooltip (FaEdit /
data-tooltip-content="Edit properties") are misleading because
ManageConfigPropertiesModal (opened via setIsManagePropertiesOpen) only supports
deletion; replace the FaEdit icon with a more appropriate icon such as FaList or
FaEllipsisV and update the tooltip text to "Manage properties" (and tooltip id
if desired) so the IconButton that triggers setIsManagePropertiesOpen accurately
reflects that it opens the deletion/management modal.

In `@src/components/Configs/Sidebar/ManageConfigPropertiesModal.tsx`:
- Around line 35-53: deleteProperty currently allows concurrent deletes because
there is no in-flight guard; add a local loading guard (e.g., a state like
deletingPropertyName or a Set<string> of deleting names) and check it at the top
of deleteProperty to return early if that property is already being deleted, set
the guard true before calling deleteConfigItemProperty and false in finally, and
pass that guard into the IconButton's disabled prop (and the other IconButton
instance referenced around lines 81-87) so the button is disabled while the RPC
is in-flight; keep using toastSuccess/toastError and call onChanged with the
result (or optimistically remove the item from UI) only after the RPC succeeds.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 66c98eb9-58f0-4dfc-baef-03910dedb7ca

📥 Commits

Reviewing files that changed from the base of the PR and between ac797ff and 5850fe0.

📒 Files selected for processing (7)
  • src/api/services/configs.ts
  • src/api/types/configs.ts
  • src/api/types/topology.ts
  • src/components/Configs/Sidebar/AddConfigPropertyModal.tsx
  • src/components/Configs/Sidebar/ConfigDetails.tsx
  • src/components/Configs/Sidebar/ManageConfigPropertiesModal.tsx
  • src/components/Topology/Sidebar/Utils/formatProperties.tsx

Comment on lines +267 to +282
<IconButton
data-tooltip-id="edit-properties-tooltip"
data-tooltip-content="Edit properties"
icon={<FaEdit className="text-gray-600" size={14} />}
onClick={() => setIsManagePropertiesOpen(true)}
/>
<IconButton
data-tooltip-id="add-property-tooltip"
data-tooltip-content="Add property"
icon={<FaPlus className="text-gray-600" size={14} />}
onClick={() => setIsAddPropertyOpen(true)}
/>
</div>
<Tooltip id="edit-properties-tooltip" />
<Tooltip id="add-property-tooltip" />
</div>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

FaEdit/"Edit properties" is semantically misleading for a delete-only modal.

ManageConfigPropertiesModal only supports deletion (its own title says "Delete Properties"). The FaEdit pencil icon and "Edit properties" tooltip will mislead users expecting to rename or update property values. Consider FaList / FaEllipsisV with the tooltip "Manage properties" to better reflect the actual action.

💡 Suggested change
-import { FaEdit, FaExclamationTriangle, FaPlus, FaTrash } from "react-icons/fa";
+import { FaExclamationTriangle, FaList, FaPlus, FaTrash } from "react-icons/fa";
  <IconButton
-   data-tooltip-id="edit-properties-tooltip"
-   data-tooltip-content="Edit properties"
-   icon={<FaEdit className="text-gray-600" size={14} />}
+   data-tooltip-id="manage-properties-tooltip"
+   data-tooltip-content="Manage properties"
+   icon={<FaList className="text-gray-600" size={14} />}
    onClick={() => setIsManagePropertiesOpen(true)}
  />
- <Tooltip id="edit-properties-tooltip" />
+ <Tooltip id="manage-properties-tooltip" />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<IconButton
data-tooltip-id="edit-properties-tooltip"
data-tooltip-content="Edit properties"
icon={<FaEdit className="text-gray-600" size={14} />}
onClick={() => setIsManagePropertiesOpen(true)}
/>
<IconButton
data-tooltip-id="add-property-tooltip"
data-tooltip-content="Add property"
icon={<FaPlus className="text-gray-600" size={14} />}
onClick={() => setIsAddPropertyOpen(true)}
/>
</div>
<Tooltip id="edit-properties-tooltip" />
<Tooltip id="add-property-tooltip" />
</div>
<IconButton
data-tooltip-id="manage-properties-tooltip"
data-tooltip-content="Manage properties"
icon={<FaList className="text-gray-600" size={14} />}
onClick={() => setIsManagePropertiesOpen(true)}
/>
<IconButton
data-tooltip-id="add-property-tooltip"
data-tooltip-content="Add property"
icon={<FaPlus className="text-gray-600" size={14} />}
onClick={() => setIsAddPropertyOpen(true)}
/>
</div>
<Tooltip id="manage-properties-tooltip" />
<Tooltip id="add-property-tooltip" />
</div>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/Configs/Sidebar/ConfigDetails.tsx` around lines 267 - 282, The
"Edit properties" pencil icon and tooltip (FaEdit / data-tooltip-content="Edit
properties") are misleading because ManageConfigPropertiesModal (opened via
setIsManagePropertiesOpen) only supports deletion; replace the FaEdit icon with
a more appropriate icon such as FaList or FaEllipsisV and update the tooltip
text to "Manage properties" (and tooltip id if desired) so the IconButton that
triggers setIsManagePropertiesOpen accurately reflects that it opens the
deletion/management modal.

Comment on lines +35 to +53
const deleteProperty = async (property: Property) => {
if (!user?.id) {
toastError("Could not determine current user");
return;
}

try {
const result = await deleteConfigItemProperty(
configId,
"person",
user.id,
property.name
);
toastSuccess("Property deleted");
onChanged?.(result?.properties);
} catch (e) {
toastError((e as Error).message);
}
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Delete button has no in-flight guard — concurrent/double deletes are possible.

deleteProperty tracks no loading state and the IconButton has no disabled prop. A double-click (or deleting two properties rapidly) fires concurrent RPC calls against the same config: the first succeeds, the second fails with an error toast because the property no longer exists. The stale entry also remains visible in the list until the parent's refetchConfig resolves.

🔒 Proposed fix
 export default function ManageConfigPropertiesModal({ ... }: Props) {
   const { user } = useUser();
+  const [deletingProperty, setDeletingProperty] = useState<string | null>(null);

   const userProperties = ...;

   const deleteProperty = async (property: Property) => {
     if (!user?.id) {
       toastError("Could not determine current user");
       return;
     }
+    if (deletingProperty != null) return;

     try {
+      setDeletingProperty(property.name);
       const result = await deleteConfigItemProperty(
         configId,
         "person",
         user.id,
         property.name
       );
       toastSuccess("Property deleted");
       onChanged?.(result?.properties);
     } catch (e) {
       toastError((e as Error).message);
+    } finally {
+      setDeletingProperty(null);
     }
   };

And on the button:

  <IconButton
    aria-label={`Delete ${property.name}`}
    title="Delete property"
    className="text-gray-500 hover:text-red-600"
    icon={<FaTrash />}
    onClick={() => deleteProperty(property)}
+   disabled={deletingProperty != null}
  />

Also applies to: 81-87

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/Configs/Sidebar/ManageConfigPropertiesModal.tsx` around lines
35 - 53, deleteProperty currently allows concurrent deletes because there is no
in-flight guard; add a local loading guard (e.g., a state like
deletingPropertyName or a Set<string> of deleting names) and check it at the top
of deleteProperty to return early if that property is already being deleted, set
the guard true before calling deleteConfigItemProperty and false in finally, and
pass that guard into the IconButton's disabled prop (and the other IconButton
instance referenced around lines 81-87) so the button is disabled while the RPC
is in-flight; keep using toastSuccess/toastError and call onChanged with the
result (or optimistically remove the item from UI) only after the RPC succeeds.

Add config sidebar controls for users to add manual properties with either text or numeric values and delete only their own manually-added properties.\n\nWire the UI to the config item property update/delete RPCs and carry property ownership fields through config property types.
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.

1 participant