Skip to content

Commit

Permalink
[public-api] Some renaming (#19095)
Browse files Browse the repository at this point in the history
* 💄

* 💄

* 💄
  • Loading branch information
jeanp413 authored Nov 21, 2023
1 parent 6f7ff4f commit 4aef5ce
Show file tree
Hide file tree
Showing 8 changed files with 853 additions and 894 deletions.
2 changes: 1 addition & 1 deletion components/dashboard/src/projects/ProjectVariables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function ProjectVariablesPage() {
}, [project]);

const deleteEnvVar = async (variableId: string) => {
await envVarClient.deleteConfigurationEnvironmentVariable({ envVarId: variableId });
await envVarClient.deleteConfigurationEnvironmentVariable({ environmentVariableId: variableId });
updateEnvVars();
};

Expand Down
30 changes: 15 additions & 15 deletions components/dashboard/src/service/json-rpc-envvar-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ export class JsonRpcEnvvarClient implements PromiseClient<typeof EnvironmentVari
async updateUserEnvironmentVariable(
req: PartialMessage<UpdateUserEnvironmentVariableRequest>,
): Promise<UpdateUserEnvironmentVariableResponse> {
if (!req.envVarId) {
throw new ApplicationError(ErrorCodes.BAD_REQUEST, "envVarId is required");
if (!req.environmentVariableId) {
throw new ApplicationError(ErrorCodes.BAD_REQUEST, "environmentVariableId is required");
}

const response = new UpdateUserEnvironmentVariableResponse();

const userEnvVars = await getGitpodService().server.getAllEnvVars();
const userEnvVarfound = userEnvVars.find((i) => i.id === req.envVarId);
const userEnvVarfound = userEnvVars.find((i) => i.id === req.environmentVariableId);
if (userEnvVarfound) {
const variable: UserEnvVarValue = {
id: req.envVarId,
id: req.environmentVariableId,
name: req.name ?? userEnvVarfound.name,
value: req.value ?? userEnvVarfound.value,
repositoryPattern: req.repositoryPattern ?? userEnvVarfound.repositoryPattern,
Expand All @@ -67,7 +67,7 @@ export class JsonRpcEnvvarClient implements PromiseClient<typeof EnvironmentVari
await getGitpodService().server.setEnvVar(variable);

const updatedUserEnvVars = await getGitpodService().server.getAllEnvVars();
const updatedUserEnvVar = updatedUserEnvVars.find((i) => i.id === req.envVarId);
const updatedUserEnvVar = updatedUserEnvVars.find((i) => i.id === req.environmentVariableId);
if (!updatedUserEnvVar) {
throw new ApplicationError(ErrorCodes.INTERNAL_SERVER_ERROR, "could not update env variable");
}
Expand Down Expand Up @@ -113,12 +113,12 @@ export class JsonRpcEnvvarClient implements PromiseClient<typeof EnvironmentVari
async deleteUserEnvironmentVariable(
req: PartialMessage<DeleteUserEnvironmentVariableRequest>,
): Promise<DeleteUserEnvironmentVariableResponse> {
if (!req.envVarId) {
throw new ApplicationError(ErrorCodes.BAD_REQUEST, "envVarId is required");
if (!req.environmentVariableId) {
throw new ApplicationError(ErrorCodes.BAD_REQUEST, "environmentVariableId is required");
}

const variable: UserEnvVarValue = {
id: req.envVarId,
id: req.environmentVariableId,
name: "",
value: "",
repositoryPattern: "",
Expand Down Expand Up @@ -147,8 +147,8 @@ export class JsonRpcEnvvarClient implements PromiseClient<typeof EnvironmentVari
async updateConfigurationEnvironmentVariable(
req: PartialMessage<UpdateConfigurationEnvironmentVariableRequest>,
): Promise<UpdateConfigurationEnvironmentVariableResponse> {
if (!req.envVarId) {
throw new ApplicationError(ErrorCodes.BAD_REQUEST, "envVarId is required");
if (!req.environmentVariableId) {
throw new ApplicationError(ErrorCodes.BAD_REQUEST, "environmentVariableId is required");
}
if (!req.configurationId) {
throw new ApplicationError(ErrorCodes.BAD_REQUEST, "configurationId is required");
Expand All @@ -157,7 +157,7 @@ export class JsonRpcEnvvarClient implements PromiseClient<typeof EnvironmentVari
const response = new UpdateConfigurationEnvironmentVariableResponse();

const projectEnvVars = await getGitpodService().server.getProjectEnvironmentVariables(req.configurationId);
const projectEnvVarfound = projectEnvVars.find((i) => i.id === req.envVarId);
const projectEnvVarfound = projectEnvVars.find((i) => i.id === req.environmentVariableId);
if (projectEnvVarfound) {
await getGitpodService().server.setProjectEnvironmentVariable(
req.configurationId,
Expand All @@ -169,7 +169,7 @@ export class JsonRpcEnvvarClient implements PromiseClient<typeof EnvironmentVari
const updatedProjectEnvVars = await getGitpodService().server.getProjectEnvironmentVariables(
req.configurationId,
);
const updatedProjectEnvVar = updatedProjectEnvVars.find((i) => i.id === req.envVarId);
const updatedProjectEnvVar = updatedProjectEnvVars.find((i) => i.id === req.environmentVariableId);
if (!updatedProjectEnvVar) {
throw new ApplicationError(ErrorCodes.INTERNAL_SERVER_ERROR, "could not update env variable");
}
Expand Down Expand Up @@ -213,11 +213,11 @@ export class JsonRpcEnvvarClient implements PromiseClient<typeof EnvironmentVari
async deleteConfigurationEnvironmentVariable(
req: PartialMessage<DeleteConfigurationEnvironmentVariableRequest>,
): Promise<DeleteConfigurationEnvironmentVariableResponse> {
if (!req.envVarId) {
throw new ApplicationError(ErrorCodes.BAD_REQUEST, "envVarId is required");
if (!req.environmentVariableId) {
throw new ApplicationError(ErrorCodes.BAD_REQUEST, "environmentVariableId is required");
}

await getGitpodService().server.deleteProjectEnvironmentVariable(req.envVarId);
await getGitpodService().server.deleteProjectEnvironmentVariable(req.environmentVariableId);

const response = new DeleteConfigurationEnvironmentVariableResponse();
return response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export default function EnvVars() {
const save = async (variable: UserEnvVarValue) => {
if (variable.id) {
await envVarClient.updateUserEnvironmentVariable({
envVarId: variable.id,
environmentVariableId: variable.id,
name: variable.name,
value: variable.value,
repositoryPattern: variable.repositoryPattern,
Expand All @@ -207,7 +207,7 @@ export default function EnvVars() {

const deleteVariable = async (variable: UserEnvVarValue) => {
await envVarClient.deleteUserEnvironmentVariable({
envVarId: variable.id,
environmentVariableId: variable.id,
});
await update();
};
Expand Down
8 changes: 4 additions & 4 deletions components/public-api/gitpod/v1/envvar.proto
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ message ListUserEnvironmentVariablesResponse {
}

message UpdateUserEnvironmentVariableRequest {
string env_var_id = 1;
string environment_variable_id = 1;
optional string name = 2;
optional string value = 3;
optional string repository_pattern = 4;
Expand All @@ -80,7 +80,7 @@ message CreateUserEnvironmentVariableResponse {
}

message DeleteUserEnvironmentVariableRequest {
string env_var_id = 1;
string environment_variable_id = 1;
}

message DeleteUserEnvironmentVariableResponse {}
Expand Down Expand Up @@ -110,7 +110,7 @@ message ListConfigurationEnvironmentVariablesResponse {

message UpdateConfigurationEnvironmentVariableRequest {
string configuration_id = 1;
string env_var_id = 2;
string environment_variable_id = 2;
optional string name = 3;
optional string value = 4;
optional EnvironmentVariableAdmission admission = 5;
Expand All @@ -132,7 +132,7 @@ message CreateConfigurationEnvironmentVariableResponse {
}

message DeleteConfigurationEnvironmentVariableRequest {
string env_var_id = 1;
string environment_variable_id = 1;
}

message DeleteConfigurationEnvironmentVariableResponse {}
Expand Down
Loading

0 comments on commit 4aef5ce

Please sign in to comment.