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

Added Git Servies tab to the User Preferences #687

Merged
merged 6 commits into from
Jan 17, 2023
Merged

Added Git Servies tab to the User Preferences #687

merged 6 commits into from
Jan 17, 2023

Conversation

olexii4
Copy link
Contributor

@olexii4 olexii4 commented Dec 12, 2022

Signed-off-by: Oleksii Orel oorel@redhat.com

What does this PR do?

Added Git Servies tab to the User Preferences.

It depends on eclipse-che/che-workspace-client#87 and eclipse-che/che#21890

What issues does this PR fix or reference?

fixes Add "Git Servies" tab to the User Preferences

Is it tested? How?

  1. Deploy CHE using the dashboard image from this PR.
  2. Added OAuth for GitHub, GitLab, and Bitbucket.
  3. Open User Preferences/Git Servies.
  4. Delete OAuth for GitHub, GitLab, and Bitbucket.

Знімок екрана 2022-12-12 о 07 42 55
Знімок екрана 2022-12-12 о 07 42 43
Знімок екрана 2022-12-12 о 07 43 21

This PR depends on eclipse-che/che-server#408

@che-bot
Copy link
Contributor

che-bot commented Dec 12, 2022

Click here to review and test in web IDE: Contribute

@github-actions
Copy link

Docker image build succeeded: quay.io/eclipse/che-dashboard:pr-687

@che-bot
Copy link
Contributor

che-bot commented Dec 13, 2022

Click here to review and test in web IDE: Contribute

@github-actions
Copy link

Docker image build succeeded: quay.io/eclipse/che-dashboard:pr-687

@olexii4 olexii4 marked this pull request as ready for review December 28, 2022 16:52
@che-bot
Copy link
Contributor

che-bot commented Dec 28, 2022

Click here to review and test in web IDE: Contribute

@che-bot
Copy link
Contributor

che-bot commented Jan 3, 2023

Click here to review and test in web IDE: Contribute

@@ -19,6 +20,9 @@ export async function retryableExec<T>(callback: () => Promise<T>, maxAttempt =
return await callback();
} catch (e) {
error = e;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a useless variable assignment. Don't you mind getting rid of it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this variable out of the loop because we can have several errors until rejecting the last one.

@github-actions
Copy link

Docker image build succeeded: quay.io/eclipse/che-dashboard:pr-687

@codecov
Copy link

codecov bot commented Jan 13, 2023

Codecov Report

Merging #687 (0bbb129) into main (915a51e) will increase coverage by 0.71%.
The diff coverage is 62.17%.

@@            Coverage Diff             @@
##             main     #687      +/-   ##
==========================================
+ Coverage   62.69%   63.41%   +0.71%     
==========================================
  Files         290      288       -2     
  Lines        9004     8585     -419     
  Branches     1453     1349     -104     
==========================================
- Hits         5645     5444     -201     
+ Misses       3118     2918     -200     
+ Partials      241      223      -18     
Flag Coverage Δ
unittests 63.41% <62.17%> (+0.71%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...d-backend/src/localRun/hooks/authorizationHooks.ts 8.33% <0.00%> (ø)
.../dashboard-backend/src/routes/api/devfileSchema.ts 58.82% <ø> (+0.92%) ⬆️
...oard-frontend/src/components/EditorTools/index.tsx 0.00% <ø> (ø)
...-frontend/src/components/WorkspaceEditor/index.tsx 0.00% <ø> (ø)
...frontend/src/containers/WorkspaceDetails/index.tsx 87.50% <ø> (-1.27%) ⬇️
...shboard-frontend/src/containers/WorkspacesList.tsx 92.59% <ø> (+0.48%) ⬆️
...es/GetStarted/GetStartedTab/SamplesListGallery.tsx 55.55% <0.00%> (-6.41%) ⬇️
...s/UserPreferences/ContainerRegistriesTab/index.tsx 58.33% <ø> (+0.26%) ⬆️
...board-frontend/src/pages/UserPreferences/index.tsx 0.00% <0.00%> (ø)
...WorkspaceDetails/OverviewTab/StorageType/index.tsx 0.00% <0.00%> (ø)
... and 60 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@@ -15,7 +15,7 @@ import { FastifyInstance } from 'fastify';
export function addAuthorizationHooks(server: FastifyInstance) {
server.addHook('onResponse', (request, reply, done) => {
if (
(request.url.startsWith('/api/') || request.url.startsWith('/dashboard/api/')) &&
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@olexii4 could you please clarify why do we need this change, as I recall api was added explicitly to prevent some redirection issue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is only for a local run.
It removes the local environment variable CLUSTER_ACCESS_TOKEN when a response from '{CHE-Server}/api/' or '/dashboard/api/' has status code '401'.

I added the following changes

(request.url.startsWith('/api/') || request.url.startsWith('/dashboard/api/')) &&

->

request.url.startsWith('/dashboard/api/') &&

because I already have a code that can return status code '401' from CHE-Server API:

 {CHE-Server}/api/oauth/token?oauth_provider=...

@ibuziuk
Copy link
Member

ibuziuk commented Jan 16, 2023

@olexii4 during verification I got the following error when deleting the GitHub Service:

Danger alert:TypeError: gitOauth.map is not a function

    in GitServicesTab (created by Connect(GitServicesTab))
    in Connect(GitServicesTab) (created by UserPreferences)
    in section (created by Context.Consumer)
    in TabContentBase (created by ForwardRef)
    in ForwardRef (created by Tabs)
    in Tabs (created by UserPreferences)
    in UserPreferences (created by Connect(UserPreferences))
    in Connect(UserPreferences) (created by Context.Consumer)
    in Route (created by RoutesComponent)
    in Switch (created by RoutesComponent)
    in RoutesComponent (created by AppComponent)
    in Suspense (created by AppComponent)
    in ErrorBoundary (created by Layout)
    in main (created by Page)
    in div (created by Page)
    in Page (created by Layout)
    in Layout (created by Connect(Layout))
    in Connect(Layout) (created by AppComponent)
    in Router (created by ConnectedRouter)
    in ConnectedRouter (created by Context.Consumer)
    in ConnectedRouterWithContext (created by Connect(ConnectedRouterWithContext))
    in Connect(ConnectedRouterWithContext) (created by AppComponent)
    in AppComponent
    in Provider

image

@che-bot
Copy link
Contributor

che-bot commented Jan 16, 2023

Click here to review and test in web IDE: Contribute

@github-actions
Copy link

Docker image build succeeded: quay.io/eclipse/che-dashboard:pr-687

@che-bot
Copy link
Contributor

che-bot commented Jan 16, 2023

Click here to review and test in web IDE: Contribute

@olexii4
Copy link
Contributor Author

olexii4 commented Jan 16, 2023

@olexii4 during verification I got the following error when deleting the GitHub Service:

Danger alert:TypeError: gitOauth.map is not a function

    in GitServicesTab (created by Connect(GitServicesTab))
    in Connect(GitServicesTab) (created by UserPreferences)
    in section (created by Context.Consumer)
    in TabContentBase (created by ForwardRef)
    in ForwardRef (created by Tabs)
    in Tabs (created by UserPreferences)
    in UserPreferences (created by Connect(UserPreferences))
    in Connect(UserPreferences) (created by Context.Consumer)
    in Route (created by RoutesComponent)
    in Switch (created by RoutesComponent)
    in RoutesComponent (created by AppComponent)
    in Suspense (created by AppComponent)
    in ErrorBoundary (created by Layout)
    in main (created by Page)
    in div (created by Page)
    in Page (created by Layout)
    in Layout (created by Connect(Layout))
    in Connect(Layout) (created by AppComponent)
    in Router (created by ConnectedRouter)
    in ConnectedRouter (created by Context.Consumer)
    in ConnectedRouterWithContext (created by Connect(ConnectedRouterWithContext))
    in Connect(ConnectedRouterWithContext) (created by AppComponent)
    in AppComponent
    in Provider

image

@ibuziuk I have fixed it.

@github-actions
Copy link

Docker image build succeeded: quay.io/eclipse/che-dashboard:pr-687

@che-bot
Copy link
Contributor

che-bot commented Jan 16, 2023

Click here to review and test in web IDE: Contribute

@che-bot
Copy link
Contributor

che-bot commented Jan 16, 2023

Click here to review and test in web IDE: Contribute

@github-actions
Copy link

Docker image build succeeded: quay.io/eclipse/che-dashboard:pr-687

1 similar comment
@github-actions
Copy link

Docker image build succeeded: quay.io/eclipse/che-dashboard:pr-687

Copy link
Member

@ibuziuk ibuziuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@olexii4 great job 👍
works like a charm

Copy link
Contributor

@akurinnoy akurinnoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@openshift-ci
Copy link

openshift-ci bot commented Jan 17, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: akurinnoy, ibuziuk, olexii4

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@olexii4 olexii4 merged commit c10114c into main Jan 17, 2023
@olexii4 olexii4 deleted the CHE-21595 branch January 17, 2023 13:42
@che-bot che-bot added this to the 7.60 milestone Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "Git Services" tab to the User Preferences
5 participants