Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Add ability to set up git user name and email in theia preferences #424

Merged
merged 1 commit into from
Sep 13, 2019

Conversation

vzhukovs
Copy link
Contributor

@vzhukovs vzhukovs commented Sep 2, 2019

What does this PR do?

This changes proposal is addition to eclipse-che/che#14402 and adds ability to configure git user name and email through Theia preferences.

Demo for this PR: https://www.youtube.com/watch?v=Q_XsUWR_mJY&feature=youtu.be

Signed-off-by: Vlad Zhukovskyi vzhukovs@redhat.com

What issues does this PR fix or reference?

eclipse-che/che#13959

Release Notes

Add ability to set up git user name and email in theia preferences

Docs PR

@che-bot
Copy link
Contributor

che-bot commented Sep 2, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has been successful:

return {} as UserConfiguration;
}

const userName = gitConfig.user.name;
Copy link
Contributor

Choose a reason for hiding this comment

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

Up to you, but it can be a bit simplier:

const {name, email}  = gitConfig.user;

return { name, email }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Updated.

return;
}

const gitConfig = { user: {} };
Copy link
Contributor

Choose a reason for hiding this comment

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

You can improve typization here:

const gitConfig =  { user : {} as UserConfiguration };
 if (config.name) {
     gitConfig.user.name = config.name;
 }
...

Or create object and use it.:

export interface GitConfig {
   user: UserConfiguration
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, updated.

@che-bot
Copy link
Contributor

che-bot commented Sep 11, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

userPreferences = JSON.stringify(JSON.parse(userPreferences));
const userPreferences = JSON.parse(userPreferencesContent);
this.fireUserPreferencesModify(userPreferences);
userPreferencesContent = JSON.stringify(userPreferences);
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, why do you override userPreferencesContent = JSON.stringify(userPreferences); ? You have already got content like string in the code above:
let userPreferencesContent = await readFile(THEIA_USER_PREFERENCES_PATH, 'utf8');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The origin logic was not modified in this piece of code, just extracted parsed JSON object to fire it in event. 1) we read settings.json; 2) validate it through JSON.parse; 3) fire event with parsed preferences (was added); 4) call JSON.stringify, I suppose just for formatting JSON string; 5) update user preferences with new value.

Agree, looks a bit odd, but decided not to remove this line.

@che-bot
Copy link
Contributor

che-bot commented Sep 11, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

import * as nsfw from 'nsfw';
import { Disposable } from '@theia/core';

export const GIT_CONFIG_PATH = resolve(homedir(), '.gitconfig');
Copy link
Contributor

Choose a reason for hiding this comment

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

It is better to have path.resolve here, because resolve is often used in promises.

@che-bot
Copy link
Contributor

che-bot commented Sep 12, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

@che-bot
Copy link
Contributor

che-bot commented Sep 12, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

@che-bot
Copy link
Contributor

che-bot commented Sep 12, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

@che-bot
Copy link
Contributor

che-bot commented Sep 12, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

@che-bot
Copy link
Contributor

che-bot commented Sep 12, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

@che-bot
Copy link
Contributor

che-bot commented Sep 12, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

@musienko-maxim
Copy link

The PR was checked locally. The Happy Path scenario passed without any failures.

@che-bot
Copy link
Contributor

che-bot commented Sep 13, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

Signed-off-by: Vlad Zhukovskyi <vzhukovs@redhat.com>
@che-bot
Copy link
Contributor

che-bot commented Sep 13, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

vinokurig pushed a commit that referenced this pull request Apr 6, 2021
* Use png icons for Kubernetes plugin
* Update regexp for icon validation
* Update README

Signed-off-by: Vitaliy Gulyy <vgulyy@redhat.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants