MCPcopy Create free account
hub / github.com/bytebase/bytebase / writeEnvironmentSetting

Function writeEnvironmentSetting

frontend/src/react/stores/app/workspace.ts:180–198  ·  view source on GitHub ↗
(
    environments: EnvironmentSetting_Environment[]
  )

Source from the content-addressed store, hash-verified

178 // Persist the ENVIRONMENT setting and re-derive the cached environment list
179 // from the server's response (mirrors the legacy Pinia env store).
180 const writeEnvironmentSetting = async (
181 environments: EnvironmentSetting_Environment[]
182 ): Promise<Environment[]> => {
183 const response = await get().upsertSetting({
184 name: Setting_SettingName.ENVIRONMENT,
185 value: createProto(SettingValueSchema, {
186 value: {
187 case: "environment",
188 value: createProto(EnvironmentSettingSchema, { environments }),
189 },
190 }),
191 });
192 const next =
193 response.value?.value?.case === "environment"
194 ? convertEnvironmentList(response.value.value.value.environments)
195 : [];
196 set({ environmentList: next });
197 return next;
198 };
199
200 return {
201 serverInfoTs: 0,

Callers 1

createWorkspaceSliceFunction · 0.85

Calls 4

getFunction · 0.85
convertEnvironmentListFunction · 0.85
setFunction · 0.85
upsertSettingMethod · 0.80

Tested by

no test coverage detected