Skip to content

Conversation

@xurui-c
Copy link
Member

@xurui-c xurui-c commented Sep 9, 2025

Screenshot 2025-09-11 at 10 40 52 AM

@codecov
Copy link

codecov bot commented Sep 10, 2025

✅ All tests passed

@xurui-c xurui-c changed the title c feat(cbrs): Snuba Admin UI (webpage) Sep 11, 2025
runMigration: (req: RunMigrationRequest) => Promise<RunMigrationResult>;
getAllowedTools: () => Promise<AllowedTools>;
getStoragesWithAllocationPolicies: () => Promise<string[]>;
getRoutingStrategies: () => Promise<string[]>,
Copy link
Member Author

Choose a reason for hiding this comment

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

This endpoint is used for the dropdown, right now we only have 1 strat
Screenshot 2025-09-10 at 8 18 17 PM

getRoutingStrategies: () => Promise<string[]>,
getAllocationPolicies: (storage: string) => Promise<AllocationPolicy[]>;
setAllocationPolicyConfig: (
getRoutingStrategyConfigs: (strategy_name: string) => Promise<StrategyData>;
Copy link
Member Author

Choose a reason for hiding this comment

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

This endpoint retrieves all of the strategy configurations as well as the allocation policies, so I don't know if getRoutingStrategyConfigs is the best name - I'm open to other suggestions

getAllocationPolicies: (storage: string) => Promise<AllocationPolicy[]>;
setAllocationPolicyConfig: (
getRoutingStrategyConfigs: (strategy_name: string) => Promise<StrategyData>;
setConfigurableComponentConfiguration: (
Copy link
Member Author

Choose a reason for hiding this comment

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

The content of setAllocationPolicyConfig and deleteAllocationPolicyConfig is no longer specific to allocation policy anymore so I changed their names to setConfigurableComponentConfiguration and deleteConfigurableComponentConfiguration

};

type AllocationPolicyConfig = {
type Configuration = {
Copy link
Member Author

Choose a reason for hiding this comment

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

This isn't really specific to AllocationPolicy anymore - a configuration is a configuration, so I changed the names in this file accordingly

edit: ReactNode;
};

type ConfigurableComponentData = {
Copy link
Member Author

@xurui-c xurui-c Sep 11, 2025

Choose a reason for hiding this comment

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

These mirror the ConfigurableComponentData, PolicyData, and StrategyData in the backend

Copy link
Member Author

Choose a reason for hiding this comment

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

I decided to keep this file in /capacity_management because allocation policies are originally a CapMan concpet

Copy link
Member Author

Choose a reason for hiding this comment

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

we don't need this anymore: #7346 (comment) 🦅 🦅 🦅

Comment on lines +34 to +35
deleteOrReset().toLowerCase() +
" this config?"
Copy link
Member Author

Choose a reason for hiding this comment

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

auto-reformatting

export function PolicyRenderer({ api, policies, resourceIdentifier, resourceType }: PolicyRendererProps) {
function renderPolicies(policies: AllocationPolicy[]) {
if (!resourceIdentifier) {
return <p>{resourceType} not selected.</p>;
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm also down to have this as return <p>Resource not selected.</p>; so we don't have to have an extra parameter resourceType

},
name: "key1",
value: "10",
description: "something",
Copy link
Member Author

Choose a reason for hiding this comment

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

auto-reformat

resourceType: string;
}

const policyTypeStyle = {
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm going to change this to ConfigurableComponentTypeStyle

Copy link
Member

Choose a reason for hiding this comment

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

yes please

@xurui-c xurui-c marked this pull request as ready for review September 11, 2025 19:50
@xurui-c xurui-c requested review from a team as code owners September 11, 2025 19:50
renderContent: (data: T | undefined, selectedResource: string | undefined) => React.ReactNode;
}

function ConfigurableComponentRenderer<T>({
Copy link
Member

Choose a reason for hiding this comment

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

this is more of a dropdown renderer, it has nothing to do with configurable component

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried to make a new file after renaming but git still recognize the renaming instead

@xurui-c xurui-c requested a review from volokluev September 15, 2025 17:40
Copy link
Member

@volokluev volokluev left a comment

Choose a reason for hiding this comment

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

Looks good overall, have some comments you can resolve in this PR or a different one

resourceType: string;
}

const policyTypeStyle = {
Copy link
Member

Choose a reason for hiding this comment

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

yes please

Comment on lines 13 to 15
if (configurableComponentData.configurable_component_namespace === "BaseRoutingStrategy") {
return COLORS.SNUBA_BLUE;
}
Copy link
Member

Choose a reason for hiding this comment

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

I think you could probably rewrite this logic to be more generic. I.e. if there is no is_active or is_enforced config, the table color is blue. I don't think you need to have this conditional specific to the routing strategies in this generic component

description="Placeholder for now",
value_type=int,
default=50,
param_types={"organization_id": int},
Copy link
Member

Choose a reason for hiding this comment

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

Not for this PR but a follow up here would be to put the configurations that exist in this strategy (i.e. everywhere that we use get_config in this class, to use the configuration instead

@xurui-c xurui-c enabled auto-merge (squash) September 16, 2025 18:56
@xurui-c xurui-c merged commit f3949b2 into master Sep 16, 2025
34 checks passed
@xurui-c xurui-c deleted the rachel/frontend branch September 16, 2025 19:11
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.

3 participants