Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused web code for desktop access #49854

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
};
Loading