Skip to content

Commit

Permalink
fixed a bug in server items editing
Browse files Browse the repository at this point in the history
  • Loading branch information
maximtrp committed Mar 14, 2023
1 parent 585440b commit 442ceec
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ vsc-extension-quickstart.md
**/tsconfig.json
**/.eslintrc.json
**/*.map
**/*.ts
**/*.ts
dist/
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 1.2.3 - 2023-03-14

- Fixed a bug in server items editing.

## 1.2.1 - 2023-03-12

- Server items editing improved.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "drone-ci",
"displayName": "Drone CI",
"description": "Manage your Drone CI servers easily",
"version": "1.2.1",
"version": "1.2.3",
"publisher": "maximtrp",
"author": {
"name": "Maksim Terpilovskii",
Expand Down
10 changes: 4 additions & 6 deletions src/servers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,15 @@ export class ServersProvider implements vscode.TreeDataProvider<Server> {
return;
} else {
// Getting existing servers
servers = JSON.parse((await this.context.secrets.get("servers")) || "[]");
servers = JSON.parse((await this.context.secrets.get("servers")) || "[]").filter(
(existingServer: ServerInfo) => server.url !== existingServer.url
);
// Checking if a server with entered URL exists
let serverExists = servers
.filter((existingServer: ServerInfo) => server.url !== existingServer.url)
.find((server: ServerInfo) => server.url === url);
let serverExists = servers.find((server: ServerInfo) => server.url === url);
if (serverExists) {
vscode.window.showErrorMessage("Server with this URL already exists");
return;
}
// Removing the server that is being editted
servers = servers.filter((server: ServerInfo) => server.url !== url);
}

const label = await vscode.window.showInputBox({
Expand Down

0 comments on commit 442ceec

Please sign in to comment.