Skip to content

Commit

Permalink
added autorefresh of repos on server edit
Browse files Browse the repository at this point in the history
  • Loading branch information
maximtrp committed Aug 31, 2023
1 parent ec80bf5 commit 1c48635
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 13 deletions.
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.5.1 - 2023-08-31

- Implemented autorefresh of repositories after server editing (if an edited server was selected).

## 1.5.0 - 2023-08-24

- Implemented autoselection of the first repo (when choosing a server).
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ and cron jobs.

## Features

* Support for multiple Drone CI servers
* Repositories, builds, secrets, and cron jobs management: add, edit, delete, update or even promote your builds to any target
* Build info and step log
* Quick links to your servers and repository pages
* *Multi-server support for Drone CI*: enhance your workflow with support for multiple Drone CI servers.
* *Effortless repository and build management*: seamlessly manage repositories, builds, secrets, and cron jobs; easily perform actions like adding, editing, deleting, updating, or promoting your builds to any target.
* *Detailed build information and step logs*: access comprehensive build information and step logs.
* *Convenient access to server and repository pages*: quickly navigate to your server and repository pages with direct links.

## Installation

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.5.0",
"version": "1.5.1",
"publisher": "maximtrp",
"author": {
"name": "Maksim Terpilovskii",
Expand Down
15 changes: 12 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,18 @@ export function activate(context: vscode.ExtensionContext) {
secretsProvider.editSecret(secret)
);
const commandAddServer = vscode.commands.registerCommand("drone-ci.addServer", () => serversProvider.addServer());
const commandEditServer = vscode.commands.registerCommand("drone-ci.editServer", (server) =>
serversProvider.editServer(server)
);
const commandEditServer = vscode.commands.registerCommand("drone-ci.editServer", async (server) => {
const serverSelected = serversTree.selection[0];
const serverNew = await serversProvider.editServer(server);

if (serverNew && serverSelected.url === server.url) {
droneClient = new drone.Client({
url: serverNew.url,
token: serverNew.token,
});
reposProvider.setClient(droneClient).refresh();
}
});
const commandAddCron = vscode.commands.registerCommand("drone-ci.addCron", () => cronsProvider.addCron());
const commandEditCron = vscode.commands.registerCommand("drone-ci.editCron", (cron) => cronsProvider.editCron(cron));
const commandTriggerBuild = vscode.commands.registerCommand("drone-ci.triggerBuild", () =>
Expand Down
5 changes: 1 addition & 4 deletions src/repos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,7 @@ export class ReposProvider implements vscode.TreeDataProvider<Repo> {
return [new None("Select server to view repositories")];
}

getParent(element: vscode.TreeItem) {
if (!element) {
return null;
}
getParent() {
return null;
}

Expand Down
7 changes: 6 additions & 1 deletion src/servers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class ServersProvider implements vscode.TreeDataProvider<Server> {
this.refresh();
}

async editServer(server: Server) {
async editServer(server: Server): Promise<ServerInfo | undefined> {
let servers: ServerInfo[] = [];

const url = (
Expand Down Expand Up @@ -123,6 +123,7 @@ export class ServersProvider implements vscode.TreeDataProvider<Server> {
await this.context.secrets.store("servers", JSON.stringify(servers));
vscode.window.showInformationMessage(`You have successfully updated your Drone CI server`);
this.refresh();
return serverNew;
}

async deleteServer(serverDeleted: vscode.TreeItem) {
Expand Down Expand Up @@ -160,6 +161,10 @@ export class ServersProvider implements vscode.TreeDataProvider<Server> {
get serversNum() {
return this.servers.length;
}

getParent() {
return null;
}
}

export class Server extends vscode.TreeItem {
Expand Down

0 comments on commit 1c48635

Please sign in to comment.