Skip to content
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

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

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 2 times, most recently from 7d10cda to e90ca11 Compare February 24, 2025 09:42
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.

2 participants