summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorMaciej Bendkowski2012-09-18 04:58:45 (EDT)
committer Malgorzata Janczarska2012-09-18 05:37:02 (EDT)
commitca85f4f3f68d65d0f9bf86b8e57033bd19c55202 (patch)
tree83875399b6bbc737e3a5dc3705f10eeeb22da2e2
parentaa08e9d06324e37b14ef21861ad52b261d42f6fa (diff)
downloadorg.eclipse.orion.client-ca85f4f3f68d65d0f9bf86b8e57033bd19c55202.zip
org.eclipse.orion.client-ca85f4f3f68d65d0f9bf86b8e57033bd19c55202.tar.gz
org.eclipse.orion.client-ca85f4f3f68d65d0f9bf86b8e57033bd19c55202.tar.bz2
Bug 388927 - Some extra comments for Saving Git Credentials feature
-rw-r--r--bundles/org.eclipse.orion.client.core/web/orion/settings/nls/root/messages.js11
-rw-r--r--bundles/org.eclipse.orion.client.core/web/orion/widgets/settings/LabeledCommand.js51
-rw-r--r--bundles/org.eclipse.orion.client.core/web/orion/widgets/settings/UserSettings.js39
3 files changed, 89 insertions, 12 deletions
diff --git a/bundles/org.eclipse.orion.client.core/web/orion/settings/nls/root/messages.js b/bundles/org.eclipse.orion.client.core/web/orion/settings/nls/root/messages.js
index 3e54593..fda7b33 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/settings/nls/root/messages.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/settings/nls/root/messages.js
@@ -67,7 +67,7 @@ define({
"Linked Accounts": "Linked Accounts",
"Git Email Address": "Git Email Address",
"Git Username": "Git Username",
- "Git Credentials": "Git Credentials",
+ "Git Credentials Storage": "Git Credentials Storage",
"Update": "Update",
"Update Profile Settings": "Update Profile Settings",
"Update Git Credentials": "Update Git Credentials",
@@ -109,10 +109,9 @@ define({
"Reset" : "Reset",
"Reset Git Credentials" : "Reset Git Credentials",
"Clear Git Credentials" : "Clear Git Credentials",
- "Enable Key Storage" : "Enable Key Storage",
- "Authentication" : "Authentication",
- "Please be aware that your credentials will be stored persistently in the browser." : "Please be aware that your credentials will be stored persistently in the browser.",
+ "Enable Storage" : "Enable Storage",
+ "Please be aware that your credentials will be stored persistently in the browser." : "Please be aware that your credentials will be stored persistently in the browser.",
"Do you wish to enable the Key Storage?" : "Do you wish to enable the Key Storage?",
"general": "General",
- "validation": "Validation"
-}); \ No newline at end of file
+ "validation": "Validation"
+});
diff --git a/bundles/org.eclipse.orion.client.core/web/orion/widgets/settings/LabeledCommand.js b/bundles/org.eclipse.orion.client.core/web/orion/widgets/settings/LabeledCommand.js
new file mode 100644
index 0000000..95c5390
--- /dev/null
+++ b/bundles/org.eclipse.orion.client.core/web/orion/widgets/settings/LabeledCommand.js
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * @license
+ * Copyright (c) 2012 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0
+ * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution
+ * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html).
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+/*global dojo dijit widgets orion window console define localStorage*/
+/*jslint browser:true*/
+
+/* This SettingsContainer widget is a dojo border container with a left and right side. The left is for choosing a
+ category, the right shows the resulting HTML for that category. */
+
+define(['i18n!orion/settings/nls/messages', 'require', 'dojo', 'dijit', 'orion/util', 'orion/commands', 'orion/git/GitCredentialsStorage'], function(messages, require, dojo, dijit, mUtil, mCommands, GitCredentialsStorage) {
+
+ dojo.declare("orion.widgets.settings.LabeledCommand",[dijit._Widget, dijit._Templated],{ //$NON-NLS-0$
+
+ templateString: '<div>' + //$NON-NLS-0$
+ '<label>' + //$NON-NLS-0$
+ '<span class="setting-repository-label" data-dojo-attach-point="mylabel">'+messages['Label:']+'</span>' + //$NON-NLS-2$ //$NON-NLS-0$
+ '<span data-dojo-attach-point="myCommand"></span>' + //$NON-NLS-0$
+ '</label>' + //$NON-NLS-0$
+ '</div>', //$NON-NLS-0$
+
+ destroy: function(){
+ dojo.empty(this.domNode);
+ },
+
+ change: function(){
+ var gitCredentialsStorage = new GitCredentialsStorage();
+ if(gitCredentialsStorage.isBrowserEnabled()){
+ gitCredentialsStorage.erasePrompt(this.mylabel.innerHTML);
+ }
+ },
+
+ postCreate: function(){
+ this.inherited( arguments );
+ this.mylabel.innerHTML = this.fieldlabel; //$NON-NLS-0$
+
+ // add erase command
+ this.commandService.renderCommands(this.scopeId, this.myCommand, {gitUrl: this.fieldlabel, keyIndex: this.keyIndex}, this, "button");
+ },
+
+ startup: function(){
+
+ }
+ });
+}); \ No newline at end of file
diff --git a/bundles/org.eclipse.orion.client.core/web/orion/widgets/settings/UserSettings.js b/bundles/org.eclipse.orion.client.core/web/orion/widgets/settings/UserSettings.js
index e130921..7062f7b 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/widgets/settings/UserSettings.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/widgets/settings/UserSettings.js
@@ -13,8 +13,8 @@
/* This SettingsContainer widget is a dojo border container with a left and right side. The left is for choosing a
category, the right shows the resulting HTML for that category. */
-
-define(['i18n!orion/settings/nls/messages', 'require', 'dojo', 'dijit', 'orion/util', 'orion/commands', 'orion/section', 'orion/git/GitCredentialsStorage', 'orion/widgets/settings/LabeledTextfield', 'orion/widgets/settings/LabeledCheckbox', 'orion/widgets/settings/LabeledRepositoryLink', 'orion/widgets/settings/LabeledToggle', 'profile/UsersService', 'orion/widgets/settings/Section' ], function(messages, require, dojo, dijit, mUtil, mCommands, mSection, GitCredentialsStorage) {
+
+define(['i18n!orion/settings/nls/messages', 'require', 'dojo', 'dijit', 'orion/util', 'orion/commands', 'orion/section', 'orion/git/GitCredentialsStorage', 'orion/widgets/settings/LabeledTextfield', 'orion/widgets/settings/LabeledCheckbox', 'orion/widgets/settings/LabeledCommand', 'orion/widgets/settings/LabeledToggle', 'profile/UsersService', 'orion/widgets/settings/Section' ], function(messages, require, dojo, dijit, mUtil, mCommands, mSection, GitCredentialsStorage) {
dojo.declare("orion.widgets.settings.UserSettings", [dijit._Widget, dijit._Templated], { //$NON-NLS-0$
@@ -37,7 +37,7 @@ define(['i18n!orion/settings/nls/messages', 'require', 'dojo', 'dijit', 'orion/u
'<div data-dojo-attach-point="gitTable">' + //$NON-NLS-0$
'<div class="sectionWrapper toolComposite">' +
- '<div class="sectionAnchor sectionTitle layoutLeft">'+messages['Git Credentials']+'</div>' +
+ '<div class="sectionAnchor sectionTitle layoutLeft">'+messages['Git Credentials Storage']+'</div>' +
'<div id="gitCommands" class="layoutRight sectionActions"></div>' +
'</div>' + //$NON-NLS-2$ //$NON-NLS-0$
'<div data-dojo-attach-point="gitSections">' + //$NON-NLS-0$
@@ -140,7 +140,33 @@ define(['i18n!orion/settings/nls/messages', 'require', 'dojo', 'dijit', 'orion/u
//--------- git credentials -------------------------------
this.gitCredentialsFields = [];
- this.gitCredentialsFields.push( new orion.widgets.settings.LabeledCheckbox( {fieldlabel:messages["Enable Key Storage"]} ) );
+ this.gitCredentialsFields.push( new orion.widgets.settings.LabeledCheckbox( {fieldlabel:messages["Enable Storage"]} ) );
+ var gitCredentialsSection;
+ var that = this;
+
+ // erase private key command
+ var erasePrivateKeyCommand = new mCommands.Command({
+ name: messages["Delete"],
+ id: "eclipse.orion.git.erasePrivateKey",
+ callback : function(data){
+ var repository = data.items.gitUrl;
+ var keyIndex = data.items.keyIndex;
+
+ var messageService = that.registry.getService("orion.page.message");
+
+ var gitCredentialsStorage = new GitCredentialsStorage();
+ if(gitCredentialsStorage.isBrowserEnabled()){
+ gitCredentialsStorage.erasePrompt(repository);
+ messageService.setProgressResult("Deleted private key for " + repository);
+ that.gitCredentialsFields[keyIndex+1].destroy();
+ }
+ },
+ visibleWhen : function(item){
+ return true;
+ }
+ });
+ this.commandService.addCommand(erasePrivateKeyCommand);
+ this.commandService.registerCommandContribution("repositoryItemCommands", "eclipse.orion.git.erasePrivateKey", 1);
var gitCredentialsStorage = new GitCredentialsStorage();
if(gitCredentialsStorage.isBrowserEnabled()){
@@ -148,12 +174,13 @@ define(['i18n!orion/settings/nls/messages', 'require', 'dojo', 'dijit', 'orion/u
for(var i=0; i<repositories.length; ++i){
if(!gitCredentialsStorage.getPrompt(repositories[i])){
- this.gitCredentialsFields.push( new orion.widgets.settings.LabeledRepositoryLink( {fieldlabel: repositories[i]} ) );
+ var labeledCommand = new orion.widgets.settings.LabeledCommand( {keyIndex: i, fieldlabel: repositories[i], commandService: this.commandService, scopeId: "repositoryItemCommands"} );
+ this.gitCredentialsFields.push(labeledCommand);
}
}
}
- var gitCredentialsSection = new orion.widgets.settings.Section( {sectionName:messages["Authentication"], container: this.gitSections, sections: this.gitCredentialsFields} );
+ gitCredentialsSection = new orion.widgets.settings.Section( {sectionName:"", container: this.gitSections, sections: this.gitCredentialsFields} );
var clearCredentials = new mCommands.Command({
name: messages["Reset"],