Skip to content

[api, server, dashboard] Cleanup UpdateOrganizationSettings API #20603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 25, 2025

Conversation

geropl
Copy link
Member

@geropl geropl commented Feb 14, 2025

Description

Follow-up for: #20577

This PR cleans up the UpdateOrganizationSettings API shapes and related handlers and dashboard client.
The changes keep the current inconsistencies w.r.t. duplicate shapes and different field IDs, but maintains (or strengthens) the compatibility on the field name level. This allows us to get rid of a ton of duplicate code/field handling.

Related Issue(s)

Fixes #

How to test

Documentation

Preview status

gitpod:summary

Build Options

Build
  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer
  • analytics=segment
  • with-dedicated-emulation
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • /werft preemptible
    Saves cost. Untick this only if you're really sure you need a non-preemtible machine.
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh. If enabled, with-preview and with-large-vm will be enabled.
  • with-monitoring

/hold

@@ -25,34 +25,34 @@ export class DBOrgSettings implements OrganizationSettings {
workspaceSharingDisabled?: boolean;

@Column("varchar", { nullable: true })
defaultWorkspaceImage?: string | null;
defaultWorkspaceImage?: 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.

The null is treated as special value by typeorm to clear the column.
This is the only place we did this, and it's also unnecessary: We treat the default value "" the same anyway. 🤷 So we can get rid of that complexity.

@@ -1059,7 +1059,45 @@ export class PublicAPIConverter {
}
}

fromTimeoutSettings(timeoutSettings: TimeoutSettings): TimeoutSettingsProtocol {
fromOrganizationSettings(settings: PlainMessage<OrganizationSettings>): OrganizationSettingsProtocol {
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 is the field translation, untangled from validation etc. from the organization-service-api.ts handler.

if (req.updateRestrictedEditorNames) {
update.restrictedEditorNames = req.restrictedEditorNames;
} else if (req.restrictedEditorNames.length > 0) {
const settings = req.settings;
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 code here was split into three things:

  1. gRPC validation (stayed here)
  2. general field validation (went into organization-service.ts
  3. field translation (went to public-api-converter.ts)

@@ -551,6 +550,22 @@ export class OrganizationService {
}
}

if (settings.maxParallelRunningWorkspaces !== undefined) {
Copy link
Member Author

Choose a reason for hiding this comment

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

From the -api.ts handler.

@geropl geropl force-pushed the gpl/org-settings-refresh branch 3 times, most recently from e90ca11 to fa14fac Compare February 24, 2025 09:52
@roboquat roboquat added size/XXL and removed size/XL labels Feb 25, 2025
Tool: gitpod/catfood.gitpod.cloud
@geropl geropl force-pushed the gpl/org-settings-refresh branch from d32f465 to d829633 Compare February 25, 2025 13:12
Tool: gitpod/catfood.gitpod.cloud
@geropl
Copy link
Member Author

geropl commented Feb 25, 2025

/unhold

Copy link
Member

@filiptronicek filiptronicek left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@roboquat roboquat merged commit dd50c2a into main Feb 25, 2025
19 checks passed
@roboquat roboquat deleted the gpl/org-settings-refresh branch February 25, 2025 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants