Skip to content

Commit

Permalink
Remove unused web code for desktop access
Browse files Browse the repository at this point in the history
  • Loading branch information
zmb3 committed Dec 13, 2024
1 parent 363f83a commit c5024f4
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 62 deletions.
8 changes: 0 additions & 8 deletions web/packages/teleport/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ const cfg = {
databasesPath: `/v1/webapi/sites/:clusterId/databases?searchAsRoles=:searchAsRoles?&limit=:limit?&startKey=:startKey?&query=:query?&search=:search?&sort=:sort?`,

desktopsPath: `/v1/webapi/sites/:clusterId/desktops?searchAsRoles=:searchAsRoles?&limit=:limit?&startKey=:startKey?&query=:query?&search=:search?&sort=:sort?`,
desktopServicesPath: `/v1/webapi/sites/:clusterId/desktopservices?searchAsRoles=:searchAsRoles?&limit=:limit?&startKey=:startKey?&query=:query?&search=:search?&sort=:sort?`,
desktopPath: `/v1/webapi/sites/:clusterId/desktops/:desktopName`,
desktopWsAddr:
'wss://:fqdn/v1/webapi/sites/:clusterId/desktops/:desktopName/connect/ws?username=:username',
Expand Down Expand Up @@ -851,13 +850,6 @@ const cfg = {
});
},

getDesktopServicesUrl(clusterId: string, params: UrlResourcesParams) {
return generateResourcePath(cfg.api.desktopServicesPath, {
clusterId,
...params,
});
},

getDesktopUrl(clusterId: string, desktopName: string) {
return generatePath(cfg.api.desktopPath, { clusterId, desktopName });
},
Expand Down
22 changes: 2 additions & 20 deletions web/packages/teleport/src/services/desktops/desktops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import api from 'teleport/services/api';
import cfg, { UrlResourcesParams } from 'teleport/config';
import { ResourcesResponse } from 'teleport/services/agents';

import { makeDesktop, makeDesktopService } from './makeDesktop';
import { makeDesktop } from './makeDesktop';

import type { Desktop, WindowsDesktopService } from './types';
import type { Desktop } from './types';

class DesktopService {
fetchDesktops(
Expand All @@ -41,24 +41,6 @@ class DesktopService {
});
}

fetchDesktopServices(
clusterId: string,
params: UrlResourcesParams,
signal?: AbortSignal
): Promise<ResourcesResponse<WindowsDesktopService>> {
return api
.get(cfg.getDesktopServicesUrl(clusterId, params), signal)
.then(json => {
const items = json?.items || [];

return {
agents: items.map(makeDesktopService),
startKey: json?.startKey,
totalCount: json?.totalCount,
};
});
}

fetchDesktop(clusterId: string, desktopPath: string) {
return api
.get(cfg.getDesktopUrl(clusterId, desktopPath))
Expand Down
16 changes: 1 addition & 15 deletions web/packages/teleport/src/services/desktops/makeDesktop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import type { Desktop, WindowsDesktopService } from './types';
import type { Desktop } from './types';

export function makeDesktop(json): Desktop {
const { os, name, addr, host_id, requiresRequest } = json;
Expand All @@ -35,17 +35,3 @@ export function makeDesktop(json): Desktop {
requiresRequest,
};
}

export function makeDesktopService(json): WindowsDesktopService {
const { name, hostname, addr } = json;

const labels = json.labels || [];

return {
kind: 'windows_desktop_service',
hostname,
addr,
labels,
name,
};
}
19 changes: 0 additions & 19 deletions web/packages/teleport/src/services/desktops/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,3 @@ export type Desktop = {
host_addr?: string;
requiresRequest?: boolean;
};

// DesktopService is a Windows Desktop Service.
export type WindowsDesktopService = {
kind: 'windows_desktop_service';
// Name is name (uuid) of the windows desktop service.
name: string;
// Hostname is the hostname of the windows desktop service.
hostname: string;
// Addr is the network address the desktop service can be reached at.
addr: string;
// Labels.
labels: ResourceLabel[];
};

export type WindowsDesktopServicesResponse = {
desktopServices: WindowsDesktopService[];
startKey?: string;
totalCount?: number;
};

0 comments on commit c5024f4

Please sign in to comment.