-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove che-workspace-client lib
Signed-off-by: Oleksii Orel <oorel@redhat.com>
- Loading branch information
Showing
69 changed files
with
331 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
.../dashboard-frontend/src/services/backend-client/__tests__/kubernetesNamespaceApi.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright (c) 2018-2023 Red Hat, Inc. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
|
||
import mockAxios from 'axios'; | ||
import { getKubernetesNamespace, provisionKubernetesNamespace } from '../kubernetesNamespaceApi'; | ||
|
||
describe('Kubernetes namespace API', () => { | ||
const mockGet = mockAxios.get as jest.Mock; | ||
const mockPost = mockAxios.post as jest.Mock; | ||
|
||
const namespace: che.KubernetesNamespace = { name: 'test-name', attributes: { phase: 'Active' } }; | ||
|
||
afterEach(() => { | ||
jest.resetAllMocks(); | ||
}); | ||
|
||
describe('fetch namespace', () => { | ||
it('should call "/api/kubernetes/namespace"', async () => { | ||
mockGet.mockResolvedValueOnce({ | ||
data: expect.anything(), | ||
}); | ||
await getKubernetesNamespace(); | ||
|
||
expect(mockGet).toBeCalledWith('/api/kubernetes/namespace'); | ||
expect(mockPost).not.toBeCalled(); | ||
}); | ||
|
||
it('should return a list of namespaces', async () => { | ||
mockGet.mockResolvedValueOnce({ | ||
data: [namespace], | ||
}); | ||
|
||
const res = await getKubernetesNamespace(); | ||
|
||
expect(res).toEqual([namespace]); | ||
}); | ||
}); | ||
|
||
describe('provision namespace', () => { | ||
it('should call "/api/kubernetes/namespace/provision"', async () => { | ||
mockPost.mockResolvedValueOnce({ | ||
data: expect.anything(), | ||
}); | ||
await provisionKubernetesNamespace(); | ||
|
||
expect(mockGet).not.toBeCalled(); | ||
expect(mockPost).toBeCalledWith('/api/kubernetes/namespace/provision'); | ||
}); | ||
|
||
it('should return a list of namespaces', async () => { | ||
mockPost.mockResolvedValueOnce({ | ||
data: [namespace], | ||
}); | ||
|
||
const res = await provisionKubernetesNamespace(); | ||
|
||
expect(res).toEqual([namespace]); | ||
}); | ||
}); | ||
}); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
packages/dashboard-frontend/src/services/backend-client/kubernetesNamespaceApi.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) 2018-2023 Red Hat, Inc. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
|
||
import axios from 'axios'; | ||
import { cheServerPrefix } from './const'; | ||
import { api } from '@eclipse-che/common'; | ||
Check failure on line 15 in packages/dashboard-frontend/src/services/backend-client/kubernetesNamespaceApi.ts GitHub Actions / build-and-test (18.x)
|
||
|
||
export async function getKubernetesNamespace(): Promise<che.KubernetesNamespace[]> { | ||
const response = await axios.get(`${cheServerPrefix}/kubernetes/namespace`); | ||
|
||
return response.data; | ||
} | ||
|
||
export async function provisionKubernetesNamespace(): Promise<che.KubernetesNamespace> { | ||
const response = await axios.post(`${cheServerPrefix}/kubernetes/namespace/provision`); | ||
|
||
return response.data; | ||
} |
38 changes: 38 additions & 0 deletions
38
packages/dashboard-frontend/src/services/backend-client/oAuthApi.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2018-2023 Red Hat, Inc. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
|
||
import axios from 'axios'; | ||
import { cheServerPrefix } from './const'; | ||
import { api } from '@eclipse-che/common'; | ||
|
||
export async function getOAuthProviders(): Promise< | ||
{ | ||
name: api.GitOauthProvider; | ||
endpointUrl: string; | ||
}[] | ||
> { | ||
const response = await axios.get(`${cheServerPrefix}/resolver`); | ||
|
||
return response.data; | ||
} | ||
|
||
export async function getOAuthToken(provider: api.GitOauthProvider): Promise<void> { | ||
const response = await axios.get(`${cheServerPrefix}/oauth/token?oauth_provider=${provider}`); | ||
|
||
return response.data; | ||
} | ||
|
||
export async function deleteOAuthToken(provider: api.GitOauthProvider): Promise<void> { | ||
await axios.delete(`${cheServerPrefix}/oauth/token?oauth_provider=${provider}`); | ||
|
||
return Promise.resolve(); | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 0 additions & 43 deletions
43
packages/dashboard-frontend/src/services/workspace-client/cheworkspace/cheWorkspaceClient.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.