Skip to content

Commit

Permalink
Add throttle config to UI (#1303)
Browse files Browse the repository at this point in the history
  • Loading branch information
goodoldneon committed Apr 26, 2024
1 parent 312da2e commit ea1adb1
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,32 @@ export default function FunctionConfiguration({ configuration }: FunctionConfigu
}
}

let throttleItems: MetadataItemProps[] | undefined;
if (configuration.throttle) {
throttleItems = [
{
label: 'Period',
value: configuration.throttle.period,
},
{
label: 'Limit',
value: configuration.throttle.limit.toString(),
},
{
label: 'Burst',
value: configuration.throttle.burst.toString(),
},
];

if (configuration.throttle.key) {
throttleItems.push({
label: 'Key',
value: configuration.throttle.key,
type: 'code',
});
}
}

return (
<Block title="Configuration">
<MetadataGrid columns={2} metadataItems={miscellaneousItems} />
Expand Down Expand Up @@ -141,6 +167,12 @@ export default function FunctionConfiguration({ configuration }: FunctionConfigu
<MetadataGrid columns={2} metadataItems={debounceItems} />
</>
)}
{throttleItems && (
<>
<h3 className="pb-2 pt-6 text-sm font-medium text-slate-800">Throttle</h3>
<MetadataGrid columns={2} metadataItems={throttleItems} />
</>
)}
</Block>
);
}
4 changes: 2 additions & 2 deletions ui/apps/dashboard/src/gql/gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const documents = {
"\n query GetEventType($eventName: String, $environmentID: ID!) {\n events(query: { name: $eventName, workspaceID: $environmentID }) {\n data {\n name\n usage(opts: { period: \"hour\", range: \"day\" }) {\n total\n data {\n slot\n count\n }\n }\n workflows {\n id\n slug\n name\n current {\n createdAt\n }\n }\n }\n }\n }\n": types.GetEventTypeDocument,
"\n query GetFunctionsUsage($environmentID: ID!, $page: Int, $archived: Boolean, $pageSize: Int) {\n workspace(id: $environmentID) {\n workflows(archived: $archived) @paginated(perPage: $pageSize, page: $page) {\n page {\n page\n perPage\n totalItems\n totalPages\n }\n data {\n id\n slug\n dailyStarts: usage(opts: { period: \"hour\", range: \"day\" }, event: \"started\") {\n total\n data {\n count\n }\n }\n dailyFailures: usage(opts: { period: \"hour\", range: \"day\" }, event: \"errored\") {\n total\n data {\n count\n }\n }\n }\n }\n }\n }\n": types.GetFunctionsUsageDocument,
"\n query GetFunctions($environmentID: ID!, $page: Int, $archived: Boolean, $pageSize: Int) {\n workspace(id: $environmentID) {\n workflows(archived: $archived) @paginated(perPage: $pageSize, page: $page) {\n page {\n page\n perPage\n totalItems\n totalPages\n }\n data {\n appName\n id\n slug\n name\n isArchived\n current {\n triggers {\n eventName\n schedule\n }\n }\n }\n }\n }\n }\n": types.GetFunctionsDocument,
"\n query GetFunction($slug: String!, $environmentID: ID!) {\n workspace(id: $environmentID) {\n id\n workflow: workflowBySlug(slug: $slug) {\n id\n name\n slug\n isArchived\n appName\n current {\n triggers {\n eventName\n schedule\n condition\n }\n deploy {\n id\n createdAt\n }\n }\n failureHandler {\n slug\n name\n }\n configuration {\n cancellations {\n event\n timeout\n condition\n }\n retries {\n value\n isDefault\n }\n priority\n eventsBatch {\n maxSize\n timeout\n }\n concurrency {\n scope\n limit {\n value\n isPlanLimit\n }\n key\n }\n rateLimit {\n limit\n period\n key\n }\n debounce {\n period\n key\n }\n }\n }\n }\n }\n": types.GetFunctionDocument,
"\n query GetFunction($slug: String!, $environmentID: ID!) {\n workspace(id: $environmentID) {\n id\n workflow: workflowBySlug(slug: $slug) {\n id\n name\n slug\n isArchived\n appName\n current {\n triggers {\n eventName\n schedule\n condition\n }\n deploy {\n id\n createdAt\n }\n }\n failureHandler {\n slug\n name\n }\n configuration {\n cancellations {\n event\n timeout\n condition\n }\n retries {\n value\n isDefault\n }\n priority\n eventsBatch {\n maxSize\n timeout\n }\n concurrency {\n scope\n limit {\n value\n isPlanLimit\n }\n key\n }\n rateLimit {\n limit\n period\n key\n }\n debounce {\n period\n key\n }\n throttle {\n burst\n key\n limit\n period\n }\n }\n }\n }\n }\n": types.GetFunctionDocument,
"\n query GetFunctionUsage($id: ID!, $environmentID: ID!, $startTime: Time!, $endTime: Time!) {\n workspace(id: $environmentID) {\n workflow(id: $id) {\n dailyStarts: usage(opts: { from: $startTime, to: $endTime }, event: \"started\") {\n period\n total\n data {\n slot\n count\n }\n }\n dailyFailures: usage(opts: { from: $startTime, to: $endTime }, event: \"errored\") {\n period\n total\n data {\n slot\n count\n }\n }\n }\n }\n }\n": types.GetFunctionUsageDocument,
"\n query GetAllEnvironments {\n workspaces {\n id\n name\n parentID\n test\n type\n createdAt\n lastDeployedAt\n isArchived\n isAutoArchiveEnabled\n }\n }\n": types.GetAllEnvironmentsDocument,
};
Expand Down Expand Up @@ -455,7 +455,7 @@ export function graphql(source: "\n query GetFunctions($environmentID: ID!, $pa
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n query GetFunction($slug: String!, $environmentID: ID!) {\n workspace(id: $environmentID) {\n id\n workflow: workflowBySlug(slug: $slug) {\n id\n name\n slug\n isArchived\n appName\n current {\n triggers {\n eventName\n schedule\n condition\n }\n deploy {\n id\n createdAt\n }\n }\n failureHandler {\n slug\n name\n }\n configuration {\n cancellations {\n event\n timeout\n condition\n }\n retries {\n value\n isDefault\n }\n priority\n eventsBatch {\n maxSize\n timeout\n }\n concurrency {\n scope\n limit {\n value\n isPlanLimit\n }\n key\n }\n rateLimit {\n limit\n period\n key\n }\n debounce {\n period\n key\n }\n }\n }\n }\n }\n"): (typeof documents)["\n query GetFunction($slug: String!, $environmentID: ID!) {\n workspace(id: $environmentID) {\n id\n workflow: workflowBySlug(slug: $slug) {\n id\n name\n slug\n isArchived\n appName\n current {\n triggers {\n eventName\n schedule\n condition\n }\n deploy {\n id\n createdAt\n }\n }\n failureHandler {\n slug\n name\n }\n configuration {\n cancellations {\n event\n timeout\n condition\n }\n retries {\n value\n isDefault\n }\n priority\n eventsBatch {\n maxSize\n timeout\n }\n concurrency {\n scope\n limit {\n value\n isPlanLimit\n }\n key\n }\n rateLimit {\n limit\n period\n key\n }\n debounce {\n period\n key\n }\n }\n }\n }\n }\n"];
export function graphql(source: "\n query GetFunction($slug: String!, $environmentID: ID!) {\n workspace(id: $environmentID) {\n id\n workflow: workflowBySlug(slug: $slug) {\n id\n name\n slug\n isArchived\n appName\n current {\n triggers {\n eventName\n schedule\n condition\n }\n deploy {\n id\n createdAt\n }\n }\n failureHandler {\n slug\n name\n }\n configuration {\n cancellations {\n event\n timeout\n condition\n }\n retries {\n value\n isDefault\n }\n priority\n eventsBatch {\n maxSize\n timeout\n }\n concurrency {\n scope\n limit {\n value\n isPlanLimit\n }\n key\n }\n rateLimit {\n limit\n period\n key\n }\n debounce {\n period\n key\n }\n throttle {\n burst\n key\n limit\n period\n }\n }\n }\n }\n }\n"): (typeof documents)["\n query GetFunction($slug: String!, $environmentID: ID!) {\n workspace(id: $environmentID) {\n id\n workflow: workflowBySlug(slug: $slug) {\n id\n name\n slug\n isArchived\n appName\n current {\n triggers {\n eventName\n schedule\n condition\n }\n deploy {\n id\n createdAt\n }\n }\n failureHandler {\n slug\n name\n }\n configuration {\n cancellations {\n event\n timeout\n condition\n }\n retries {\n value\n isDefault\n }\n priority\n eventsBatch {\n maxSize\n timeout\n }\n concurrency {\n scope\n limit {\n value\n isPlanLimit\n }\n key\n }\n rateLimit {\n limit\n period\n key\n }\n debounce {\n period\n key\n }\n throttle {\n burst\n key\n limit\n period\n }\n }\n }\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
Expand Down
Loading

0 comments on commit ea1adb1

Please sign in to comment.