From f0869ba2b788a34512c6f5a8cfa027f841fd5e10 Mon Sep 17 00:00:00 2001 From: Matheus Paiva Date: Wed, 2 Mar 2016 14:30:14 -0300 Subject: [PATCH 01/17] Created commit log in merge diff --- app/core/git.js | 31 +++ app/frontend/modules/dialogs.js | 15 ++ .../view/content/merge-modal-dialog.html | 69 ++++-- language/en.json | 1 + language/pt-BR.json | 1 + resources/sass/all.scss | 202 +++++------------- resources/sass/mixins.scss | 147 +++++++++++++ 7 files changed, 295 insertions(+), 171 deletions(-) diff --git a/app/core/git.js b/app/core/git.js index b4352d2..cd04063 100644 --- a/app/core/git.js +++ b/app/core/git.js @@ -776,6 +776,37 @@ Git.prototype.deleteBranch = function (path, opts) { performCommand(`git branch -D ${opts.branchName}`, path, opts.callback); }; +Git.prototype.getCommitDiff = function (path, opts) { + opts = opts || {}; + let command = `git log --pretty=%an-gtseparator-%h-gtseparator-%s-gtseparator-%aD ${opts.branchBase.trim()}..${opts.branchCompare.trim()}`; + + performCommand(command, path, function (error, stdout) { + let commits; + + if (!error) { + commits = []; + + let lines = stdout.split('\n'); + + for (let i = 0; i < lines.length; i++) { + + if (lines[i]) { + let commitInfo = lines[i].split('-gtseparator-'); + + commits.push({ + author: commitInfo[0], + hash: commitInfo[1], + message: commitInfo[2], + date: new Date(commitInfo[3]) + }); + } + } + } + + invokeCallback(opts.callback, [ error, commits ]); + }); +}; + Git.prototype.geDiffMerge = function (path, opts) { opts = opts || {}; diff --git a/app/frontend/modules/dialogs.js b/app/frontend/modules/dialogs.js index 7ba4830..4bab863 100644 --- a/app/frontend/modules/dialogs.js +++ b/app/frontend/modules/dialogs.js @@ -75,6 +75,7 @@ angular.module('dialogs', []) this.remoteBranches = []; this.localBranches = []; this.diffInformation = {}; + this.commitDiffList = []; this.hideDialog = function () { this.showDialog = false; @@ -131,6 +132,20 @@ angular.module('dialogs', []) } }.bind(this) }); + + GIT.getCommitDiff(header.selectedRepository.path, { + branchCompare: this.branchCompare, + branchBase: header.currentBranch, + callback: function (err, commits) { + + if (err) { + alert(err); + } else { + this.commitDiffList = commits; + } + }.bind(this) + }); + } else { this.showIsUpToDateMsg = true; } diff --git a/app/frontend/view/content/merge-modal-dialog.html b/app/frontend/view/content/merge-modal-dialog.html index 8d7ea21..64be849 100644 --- a/app/frontend/view/content/merge-modal-dialog.html +++ b/app/frontend/view/content/merge-modal-dialog.html @@ -23,26 +23,57 @@

{{ MSGS['Merge branches'] }}

-
-
    -
  • - - - - {{ file.name.length > 50 ? '...' : ''}}{{ file.name | limitTo: - 50 }} - + + + + + + + + + + + + +
    +
    + {{ commit.author.trim()[0] }} +
    +
    + {{ commit.author }} + + + {{ commit.message | limitTo: 100 }}{{ commit.message.length > 100 ? '...' : ''}} + + + {{ commit.hash }} + + {{ commit.date.toLocaleString() }} +
    +
    + +
    +
      +
    • + + + + {{ file.name.length > 80 ? '...' : ''}}{{ file.name | limitTo: - 80 }} + - - {{ file.deletions }} - - - {{ file.additions }} - - -
    • -
    -
    -
    {{ mergeCtrl.diffInformation.shortstat }}
    + + {{ file.deletions }} + + + {{ file.additions }} + + +
  • +
+
+
{{ mergeCtrl.diffInformation.shortstat }}
+ +
diff --git a/language/en.json b/language/en.json index e4727e6..8c2387a 100644 --- a/language/en.json +++ b/language/en.json @@ -86,6 +86,7 @@ "Discart all selected": "Discart all selected", "Close stash tab": "Close stash tab", "View files": "View files", + "Files changed": "Files changed", "Select or create a new branch": "Select or create a new branch", "Hide menu": "Hide menu", "Show menu": "Show menu", diff --git a/language/pt-BR.json b/language/pt-BR.json index 3a6e32b..fcd2b60 100644 --- a/language/pt-BR.json +++ b/language/pt-BR.json @@ -86,6 +86,7 @@ "Discart all selected": "Discartar todos selecionados", "Close stash tab": "Fechar aba stash", "View files": "Ver arquivos", + "Files changed": "Arquivos alterados", "Select or create a new branch": "Selecione ou crie um novo branch", "Hide menu": "Esconder menu", "Show menu": "Mostrar menu", diff --git a/resources/sass/all.scss b/resources/sass/all.scss index 8f465f6..c762f8a 100644 --- a/resources/sass/all.scss +++ b/resources/sass/all.scss @@ -224,14 +224,57 @@ body { .page-modal { background-color: #FFF; padding: 15px; - width: 500px; + width: 700px; border-radius: 3px; box-shadow: 4px 4px 40px #333; overflow: hidden; - margin-top: -10%; + + .tabPanel { + @include tabPanel(#999, #666, #FFF, #DDD); + + .tab-content { + max-height: 300px; + overflow: auto; + } + } .merge-modal { + table { + width: 100%; + margin-top: 10px; + font-size: 0.9em; + + .thumbnail { + @include thumbnail; + + .thumb { + margin-right: 0; + border-radius: 3px; + width: 30px; + height: 30px; + line-height: 30px; + } + } + + .author { + font-weight: bold; + } + + .hash { + color: #666; + } + + .date { + color: #999; + text-align: right; + } + + td { + padding: 5px 10px; + } + } + .compare-box { background-color: #f4f4f4; padding: 5px 10px 0; @@ -258,8 +301,7 @@ body { } .diff-box { - max-height: 250px; - overflow: auto; + margin-top: 10px; ul { list-style: none; @@ -579,7 +621,7 @@ body { .content { flex: 1 1 auto; } - + .close-button { padding: 0; padding-left: 20px; @@ -590,9 +632,9 @@ body { box-shadow: none; cursor: pointer; transition: color ease 0.2s; - + &:hover { - color: rgba(255, 255, 255, 0.7); + color: rgba(255, 255, 255, 0.7); } } } @@ -905,156 +947,12 @@ body { } li { + @include thumbnail; border-bottom: $border-color 1px solid; padding: 15px; cursor: default; word-wrap: break-word; - .thumb { - background-color: #bd6eca; - border-radius: 50%; - display: inline-block; - width: 40px; - color: rgba(255, 255, 255, 0.75); - float: left; - margin-right: 10px; - height: 40px; - text-align: center; - line-height: 40px; - text-transform: uppercase; - font-weight: bold; - } - - .a { - @extend .thumb; - background-color: #e06055 !important; - } - - .b { - @extend .thumb; - background-color: #f06e9a !important; - } - - .c { - @extend .thumb; - background-color: #bd6eca !important; - } - - .d { - @extend .thumb; - background-color: #9575cd !important; - } - - .e { - @extend .thumb; - background-color: #7986cb !important; - } - - .f { - @extend .thumb; - background-color: #5e97f6 !important; - } - - .g { - @extend .thumb; - background-color: #4fc3f7 !important; - } - - .h { - @extend .thumb; - background-color: #4dd0e1 !important; - } - - .i { - @extend .thumb; - background-color: #fdd835 !important; - } - - .j { - @extend .thumb; - background-color: #57bb8a !important; - } - - .k { - @extend .thumb; - background-color: #9ccc65 !important; - } - - .l { - @extend .thumb; - background-color: #d4e157 !important; - } - - .m { - @extend .thumb; - background-color: #4db6ac !important; - } - - .n { - @extend .thumb; - background-color: #fdd835 !important; - } - - .o { - @extend .thumb; - background-color: #ffa726 !important; - } - - .p { - @extend .thumb; - background-color: #ff8a65 !important; - } - - .q { - @extend .thumb; - background-color: #C2C2C2 !important; - } - - .r { - @extend .thumb; - background-color: #90a4ae !important; - } - - .s { - @extend .thumb; - background-color: #a1887f !important; - } - - .t { - @extend .thumb; - background-color: #a3a3a3 !important; - } - - .u { - @extend .thumb; - background-color: #afb6e0 !important; - } - - .v { - @extend .thumb; - background-color: #b39ddb !important; - } - - .x { - @extend .thumb; - background-color: #80DEEA !important; - } - - .y { - @extend .thumb; - background-color: #bcaaa4 !important; - } - - .w { - @extend .thumb; - background-color: #c2c2c2 !important; - } - - .z { - @extend .thumb; - background-color: #AED581 !important; - } - .commit-message { font-size: 1.2em; color: #111; diff --git a/resources/sass/mixins.scss b/resources/sass/mixins.scss index f403851..5651404 100644 --- a/resources/sass/mixins.scss +++ b/resources/sass/mixins.scss @@ -123,3 +123,150 @@ top: -5px; } } + +@mixin thumbnail { + .thumb { + background-color: #bd6eca; + border-radius: 50%; + display: inline-block; + width: 40px; + color: rgba(255, 255, 255, 0.75); + float: left; + margin-right: 10px; + height: 40px; + text-align: center; + line-height: 40px; + text-transform: uppercase; + font-weight: bold; + } + + .a { + @extend .thumb; + background-color: #e06055 !important; + } + + .b { + @extend .thumb; + background-color: #f06e9a !important; + } + + .c { + @extend .thumb; + background-color: #bd6eca !important; + } + + .d { + @extend .thumb; + background-color: #9575cd !important; + } + + .e { + @extend .thumb; + background-color: #7986cb !important; + } + + .f { + @extend .thumb; + background-color: #5e97f6 !important; + } + + .g { + @extend .thumb; + background-color: #4fc3f7 !important; + } + + .h { + @extend .thumb; + background-color: #4dd0e1 !important; + } + + .i { + @extend .thumb; + background-color: #fdd835 !important; + } + + .j { + @extend .thumb; + background-color: #57bb8a !important; + } + + .k { + @extend .thumb; + background-color: #9ccc65 !important; + } + + .l { + @extend .thumb; + background-color: #d4e157 !important; + } + + .m { + @extend .thumb; + background-color: #4db6ac !important; + } + + .n { + @extend .thumb; + background-color: #fdd835 !important; + } + + .o { + @extend .thumb; + background-color: #ffa726 !important; + } + + .p { + @extend .thumb; + background-color: #ff8a65 !important; + } + + .q { + @extend .thumb; + background-color: #C2C2C2 !important; + } + + .r { + @extend .thumb; + background-color: #90a4ae !important; + } + + .s { + @extend .thumb; + background-color: #a1887f !important; + } + + .t { + @extend .thumb; + background-color: #a3a3a3 !important; + } + + .u { + @extend .thumb; + background-color: #afb6e0 !important; + } + + .v { + @extend .thumb; + background-color: #b39ddb !important; + } + + .x { + @extend .thumb; + background-color: #80DEEA !important; + } + + .y { + @extend .thumb; + background-color: #bcaaa4 !important; + } + + .w { + @extend .thumb; + background-color: #c2c2c2 !important; + } + + .z { + @extend .thumb; + background-color: #AED581 !important; + } +} From 12fd70767ae6e031d31db22a8fbb9c235f546043 Mon Sep 17 00:00:00 2001 From: Matheus Paiva Date: Wed, 2 Mar 2016 16:03:34 -0300 Subject: [PATCH 02/17] Fill commit message and description on merge On merge a default summary and body are given using the commit log between the envolving branches. Changing repositories the commit message and description fields are reseted --- app/frontend/modules/content.js | 15 +++++++++++++-- app/frontend/modules/dialogs.js | 9 +++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/app/frontend/modules/content.js b/app/frontend/modules/content.js index 25a66b7..ae81149 100644 --- a/app/frontend/modules/content.js +++ b/app/frontend/modules/content.js @@ -58,6 +58,9 @@ let notification; if (!forceReload) { + this.setCommitMessage(null); + this.setCommitDescription(null); + notification = new GPNotification(`${MSGS['Opening repository']} ${repository.name}`, { showLoad: true }); notification.pop(); @@ -300,8 +303,8 @@ } else { this.showRepositoryInfo(selectedRepository, true); - $scope.commitMessage = null; - $scope.commitDescription = null; + this.setCommitMessage(null); + this.setCommitDescription(null); } event.target.removeAttribute('disabled'); @@ -317,6 +320,14 @@ } }; + this.setCommitMessage = function (value) { + $scope.commitMessage = value; + }; + + this.setCommitDescription = function (value) { + $scope.commitDescription = value; + }; + this.loadMoreCommits = function ($event) { var element = $event.srcElement, historyContainerHeight = element.scrollHeight - element.clientHeight; diff --git a/app/frontend/modules/dialogs.js b/app/frontend/modules/dialogs.js index 4bab863..55e09ec 100644 --- a/app/frontend/modules/dialogs.js +++ b/app/frontend/modules/dialogs.js @@ -142,6 +142,8 @@ angular.module('dialogs', []) alert(err); } else { this.commitDiffList = commits; + + applyScope($scope); } }.bind(this) }); @@ -210,14 +212,17 @@ angular.module('dialogs', []) $scope.$broadcast('changedbranch', header.selectedRepository); }); } else { + $scope.appCtrl.setCommitMessage(`Merge branch '${branchCompare}' into '${header.currentBranch}'`); + $scope.appCtrl.setCommitDescription( this.commitDiffList.map((commit) => { return `- ${commit.message}`; }).join('\n') ); + $scope.$broadcast('changedbranch', header.selectedRepository); } - } + }.bind(this) ); } else { $scope.$broadcast('changedbranch', header.selectedRepository); } - } + }.bind(this) }); }; From 180013f2a7d099ef7b859419a5dac8ff286f6cb5 Mon Sep 17 00:00:00 2001 From: Matheus Paiva Date: Wed, 2 Mar 2016 16:50:41 -0300 Subject: [PATCH 03/17] Fixed title for changed files on merge dialog --- app/frontend/view/content/merge-modal-dialog.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/frontend/view/content/merge-modal-dialog.html b/app/frontend/view/content/merge-modal-dialog.html index 64be849..8337bd0 100644 --- a/app/frontend/view/content/merge-modal-dialog.html +++ b/app/frontend/view/content/merge-modal-dialog.html @@ -57,7 +57,7 @@

{{ MSGS['Merge branches'] }}
  • - + {{ file.name.length > 80 ? '...' : ''}}{{ file.name | limitTo: - 80 }} From 492a5597c29ea3ac221422de3a4d44fdcf31cc98 Mon Sep 17 00:00:00 2001 From: Matheus Paiva Date: Wed, 2 Mar 2016 16:56:02 -0300 Subject: [PATCH 04/17] :bug: Fixed '+' char for non added lines on git diff --- app/core/code-processor.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/core/code-processor.js b/app/core/code-processor.js index 63a6996..7300676 100644 --- a/app/core/code-processor.js +++ b/app/core/code-processor.js @@ -51,7 +51,20 @@ var getLineType = function (firstChar) { ].join('')); for (var i = 0; i < block.lines.length; i++) { - var lineCode = block.lines[i].code.replace(//g, '>'); + var lineCode = block.lines[i].code.replace(//g, '>'), + indicator; + + switch (block.lines[i].type) { + case 'PLUS': + indicator = '+'; + break; + case 'MINOR': + indicator = '-'; + break; + default: + indicator = ''; + break; + } if (block.lines[i].type != 'UNCHANGED') { lineCode = lineCode.substr(1); @@ -66,7 +79,7 @@ var getLineType = function (firstChar) { ( block.lines[i].type != 'MINOR' ? rightNumberColumn : '' ), '', '', - ( block.lines[i].type == 'MINOR' ? '-' : '+' ), + indicator, '', '', '', From 15791bb27ab62b4b0926b22ddf1925f3295105ee Mon Sep 17 00:00:00 2001 From: Matheus Paiva Date: Mon, 7 Mar 2016 13:13:23 -0300 Subject: [PATCH 05/17] Created search feature Now is possible search for: - Author - Message - Files TODO: Docs for the shortcut to toggle the search block --- app/core/git.js | 30 ++++++-- app/frontend/modules/attributes.js | 25 +++---- app/frontend/modules/content.js | 86 +++++++++++++++++++++-- app/frontend/modules/header.js | 7 ++ app/frontend/view/content/pieContent.html | 25 ++++++- resources/sass/all.scss | 28 +++++++- 6 files changed, 168 insertions(+), 33 deletions(-) diff --git a/app/core/git.js b/app/core/git.js index cd04063..6310fee 100644 --- a/app/core/git.js +++ b/app/core/git.js @@ -122,12 +122,29 @@ Git.prototype.getCurrentBranch = function (path, callback) { * @param {function} callback - Callback to be execute in error or success case */ Git.prototype.getCommitHistory = function (opts, callback) { - var emoji = require('./emoji'); + let emoji = require('./emoji'), + skip = (opts.skip ? `--skip ${opts.skip}` : ''), + filter = '', + command; + + if (opts.filter && opts.filter.text) { + + switch (opts.filter.type) { + case 'MESSAGE': + filter = `--grep="${opts.filter.text}"`; + break; + case 'AUTHOR': + filter = `--author="${opts.filter.text}"`; + break; + case 'FILE': + filter = `-- ${opts.filter.text}`; + break; + } + } + + command = `git --no-pager log -n 25 --pretty=format:%an-gtseparator-%cr-gtseparator-%h-gtseparator-%s-gtseparator-%b-gtseparator-%ae-gtseparator-%p-pieLineBreak- ${skip} ${filter}`; - performCommand( - "git --no-pager log -n 50 --pretty=format:%an-gtseparator-%cr-gtseparator-%h-gtseparator-%s-gtseparator-%b-gtseparator-%ae-pieLineBreak-" + (opts.skip ? ' --skip '.concat(opts.skip) : '' ), - opts.path, - function (error, stdout, stderr) { + performCommand(command, opts.path, function (error, stdout, stderr) { var lines = stdout.split('-pieLineBreak-'), historyList = [], err = null; @@ -147,7 +164,8 @@ Git.prototype.getCommitHistory = function (opts, callback) { hash: historyItem[2], message: emoji.parse(historyItem[3]), body: historyItem[4], - email: historyItem[5] + email: historyItem[5], + parentHash: historyItem[6] }); } } diff --git a/app/frontend/modules/attributes.js b/app/frontend/modules/attributes.js index e786251..5245f0e 100644 --- a/app/frontend/modules/attributes.js +++ b/app/frontend/modules/attributes.js @@ -2,7 +2,6 @@ angular.module('attributes', []) .directive('ngRightClick', function($parse) { - return function(scope, element, attrs) { var fn = $parse(attrs.ngRightClick); @@ -17,7 +16,6 @@ }) .directive('ngScroll', function ($parse) { - return function (scope, element, attrs) { var fn = $parse(attrs.ngScroll); @@ -31,22 +29,17 @@ }; }) - .directive('ngInputChange', function ($parse) { - - return { - restrict: 'A', - require: '?ngModel', - - link: function(scope, element, attrs, ngModel) { + .directive('ngEnter', function() { + return function(scope, element, attrs) { - element.on('change', function (e) { + element.bind("keydown keypress", function(event) { - if (ngModel) { - ngModel.$setViewValue(e.srcElement.value); - } - }); - } + if (event.which === 13) { + scope.$apply(function() { + scope.$eval(attrs.ngEnter); + }); + } + }); }; }); - })(); diff --git a/app/frontend/modules/content.js b/app/frontend/modules/content.js index ae81149..2b1db2d 100644 --- a/app/frontend/modules/content.js +++ b/app/frontend/modules/content.js @@ -60,7 +60,12 @@ if (!forceReload) { this.setCommitMessage(null); this.setCommitDescription(null); - + + // Reset filter info + this.searchCommitFilter.text = null; + this.showNoMatchFilterMessage = false; + this.enableSearchBlock = false; + notification = new GPNotification(`${MSGS['Opening repository']} ${repository.name}`, { showLoad: true }); notification.pop(); @@ -107,15 +112,13 @@ } }; - this.showCommitChanges = function (commit, commitIndex) { - var ancestorCommit = this.repositoryHistory[commitIndex+1] || {}, - opts = { + this.showCommitChanges = function (commit) { + var opts = { hash: commit.hash, - ancestorHash: ancestorCommit.hash || '', + ancestorHash: commit.parentHash, path: selectedRepository.path }; - selectedCommitAncestor = ancestorCommit; CommomService.selectedCommit = commit; this.loadingChanges = true; @@ -336,7 +339,8 @@ GIT.getCommitHistory({ path: selectedRepository.path, - skip: this.repositoryHistory.length + skip: this.repositoryHistory.length, + filter: this.searchCommitFilter }, function (err, historyList) { if (err) { @@ -754,6 +758,74 @@ return CommomService.isRepoListEmpty(); }; + this.enableSearchBlock = false; + + this.searchCommitFilter = { + types: [ + 'MESSAGE', + 'FILE', + 'AUTHOR' + ], + type: 'MESSAGE', + text: null + }; + + this.showNoMatchFilterMessage = false; + + this.toogleSearchBlock = function () { + this.enableSearchBlock = !this.enableSearchBlock; + + if (!this.enableSearchBlock) { + this.repositoryHistory = []; + this.searchCommitFilter.text = null; + this.showNoMatchFilterMessage = false; + + GIT.getCommitHistory({ + path: selectedRepository.path + }, function (err, historyList) { + + if (err) { + alert(MSGS['Error getting more history. Error: '] + err.message); + } else { + this.repositoryHistory = historyList; + + applyScope($scope); + } + + }.bind(this)); + } + }.bind(this); + + this.filterCommits = function () { + + if (this.searchCommitFilter.text) { + this.commitHistory = []; + selectedCommit = null; + + GIT.getCommitHistory({ + path: selectedRepository.path, + filter: this.searchCommitFilter + }, function (err, historyList) { + + if (err) { + alert(MSGS['Error getting more history. Error: '] + err.message); + } else { + + if (historyList.length > 0) { + this.showNoMatchFilterMessage = false; + + this.repositoryHistory = historyList; + } else { + this.showNoMatchFilterMessage = true; + } + + applyScope($scope); + } + + }.bind(this)); + } + }; + // Listener to "showStashDiff" event fired on click View file on a Stash $scope.$on('showStashDiff', function (event, stash, files) { this.stash.info = stash; diff --git a/app/frontend/modules/header.js b/app/frontend/modules/header.js index 9d85e80..7b5b6ca 100644 --- a/app/frontend/modules/header.js +++ b/app/frontend/modules/header.js @@ -717,6 +717,13 @@ applyScope($scope); }.bind(this)); + // Toggle search commits block + globalShortcut.register('ctrl+shift+f', function () { + $scope.appCtrl.toogleSearchBlock(); + + applyScope($scope); + }.bind(this)); + }.bind(this); registerShortcuts(); diff --git a/app/frontend/view/content/pieContent.html b/app/frontend/view/content/pieContent.html index 4cc1815..1104569 100644 --- a/app/frontend/view/content/pieContent.html +++ b/app/frontend/view/content/pieContent.html @@ -51,7 +51,26 @@
    -
    +
    + + + + + +
    + +
    + +

    No match for the filter

    +

    + +

    {{ MSGS["Commit changes"] }}

    @@ -61,7 +80,7 @@

    {{ MSGS["Commit changes"] }}

    -
  • - +
  • {{ MSGS.SettingsPage.Version }}
      diff --git a/language/en.json b/language/en.json index 3c0697a..42462fe 100644 --- a/language/en.json +++ b/language/en.json @@ -154,7 +154,8 @@ "Navigate between repositories bottom to top": "Navigate between repositories bottom to top", "Add focus on the \"Search repositories\" field": "Add focus on the \"Search repositories\" field", "Close modal windows and header menus": "Close modal windows and header menus", - "Version": "Version" + "Version": "Version", + "Toogle \"Search Commit\" Block": "Toogle \"Search Commit\" Block" }, "Authentication required": "Authentication required", diff --git a/language/pt-BR.json b/language/pt-BR.json index 284e29c..5753b57 100644 --- a/language/pt-BR.json +++ b/language/pt-BR.json @@ -154,7 +154,8 @@ "Navigate between repositories bottom to top": "Navega entre os repositórios de baixo para cima", "Add focus on the \"Search repositories\" field": "Adiciona foco no campo \"Procurar repositórios\"", "Close modal windows and header menus": "Fecha janelas modais e menus de cabeçalho", - "Version": "Versão" + "Version": "Versão", + "Toogle \"Search Commit\" Block": "Abrir/Fechar bloco de busca de commits" }, "Authentication required": "Autenticação requerida", From 9824d324723d087b210b4bd0e15be16bd8f1eb4a Mon Sep 17 00:00:00 2001 From: Matheus Paiva Date: Mon, 7 Mar 2016 14:12:28 -0300 Subject: [PATCH 08/17] Improved UX closing Search commit box The var selectedCommit became a controller attribute --- app/frontend/modules/content.js | 44 +++++++++-------------- app/frontend/view/content/pieContent.html | 16 ++++----- 2 files changed, 25 insertions(+), 35 deletions(-) diff --git a/app/frontend/modules/content.js b/app/frontend/modules/content.js index 2b1db2d..873a674 100644 --- a/app/frontend/modules/content.js +++ b/app/frontend/modules/content.js @@ -18,10 +18,14 @@ const shell = require('shell'); let selectedRepository = {}, - selectedCommit = {}, - selectedCommitAncestor = null, Menu = remote.require('menu'), - MenuItem = remote.require('menu-item'); + MenuItem = remote.require('menu-item'), + cleanCommitHistory = function () { + this.selectedCommit = {}; + this.commitHistory = []; + }.bind(this); + + this.selectedCommit = {}; this.loadingHistory = false; @@ -78,9 +82,10 @@ repository.selected = true; selectedRepository = repository; this.commitChanges = []; - this.commitHistory = []; - selectedCommit = {}; + + cleanCommitHistory(); CommomService.selectedCommit = null; + this.hideStashTab(); GIT.getCommitHistory({ @@ -123,12 +128,12 @@ this.loadingChanges = true; - if (selectedCommit) { - selectedCommit.selected = false; + if (this.selectedCommit) { + this.selectedCommit.selected = false; } commit.selected = true; - selectedCommit = commit; + this.selectedCommit = commit; CommomService.changesTabPanel.select(0); @@ -169,22 +174,6 @@ }.bind(this)); }; - this.getCommitMessage = function () { - return selectedCommit.message; - }; - - this.getCommitHash = function () { - return selectedCommit.hash; - }; - - this.getCommitUser = function () { - return selectedCommit.user; - }; - - this.getCommitBody = function () { - return selectedCommit.body; - }; - this.showFileDiff = function (change, forceReload) { if (!change.code || forceReload) { @@ -193,7 +182,7 @@ GIT.getFileDiff({ file: change.name, - hash: selectedCommit.hash, + hash: this.selectedCommit.hash, path: selectedRepository.path }, function (err, stdout) { @@ -780,6 +769,8 @@ this.searchCommitFilter.text = null; this.showNoMatchFilterMessage = false; + cleanCommitHistory(); + GIT.getCommitHistory({ path: selectedRepository.path }, function (err, historyList) { @@ -799,8 +790,7 @@ this.filterCommits = function () { if (this.searchCommitFilter.text) { - this.commitHistory = []; - selectedCommit = null; + cleanCommitHistory(); GIT.getCommitHistory({ path: selectedRepository.path, diff --git a/app/frontend/view/content/pieContent.html b/app/frontend/view/content/pieContent.html index 1250801..b408d23 100644 --- a/app/frontend/view/content/pieContent.html +++ b/app/frontend/view/content/pieContent.html @@ -108,21 +108,21 @@

      {{ MSGS["Commit changes"] }}

      -
      +
      {{ MSGS['Click on a commit to see what happend there'] }}
      -
      -

      -

      +
      +

      +

      -

      - {{ appCtrl.getCommitUser() }} +

      + {{ appCtrl.selectedCommit.user }}

      - {{ appCtrl.getCommitHash() }} + {{ appCtrl.selectedCommit.hash }}

      {{ MSGS['Expand all'] }} From a7c195931326c21feeafc6a1ae716607e07ba76f Mon Sep 17 00:00:00 2001 From: Matheus Paiva Date: Mon, 7 Mar 2016 15:01:46 -0300 Subject: [PATCH 09/17] Added "No match filter" message in the lang file --- app/frontend/view/content/pieContent.html | 4 ++-- language/en.json | 1 + language/pt-BR.json | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/frontend/view/content/pieContent.html b/app/frontend/view/content/pieContent.html index b408d23..f81bdc4 100644 --- a/app/frontend/view/content/pieContent.html +++ b/app/frontend/view/content/pieContent.html @@ -64,9 +64,9 @@

      -
      +
      -

      No match for the filter

      +

      {{ MSGS['No match for the filter'] }}

      Date: Mon, 7 Mar 2016 15:31:34 -0300 Subject: [PATCH 10/17] Added notification searching commits The "pop" method of the class GPNotification now returns a notification instance --- app/frontend/global/notification.js | 8 +++++--- app/frontend/modules/content.js | 3 +++ language/en.json | 1 + language/pt-BR.json | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/frontend/global/notification.js b/app/frontend/global/notification.js index c2d6708..80f0340 100644 --- a/app/frontend/global/notification.js +++ b/app/frontend/global/notification.js @@ -57,17 +57,17 @@ class GPNotification { } this.notificationElement.innerHTML += `
      ${bodyText || titleText}
      `; - + if (this.closable) { let closeBtn = document.createElement('button'); - + closeBtn.className = 'close-button'; closeBtn.title = MSGS.Close; closeBtn.innerHTML = ''; closeBtn.onclick = function () { this.close(); }.bind(this); - + this.notificationElement.appendChild(closeBtn); } @@ -82,6 +82,8 @@ class GPNotification { this.close(); }.bind(this), 3000); } + + return this; } } diff --git a/app/frontend/modules/content.js b/app/frontend/modules/content.js index 873a674..34b2e0d 100644 --- a/app/frontend/modules/content.js +++ b/app/frontend/modules/content.js @@ -792,10 +792,13 @@ if (this.searchCommitFilter.text) { cleanCommitHistory(); + let noti = new GPNotification(`${MSGS['Searching for']} "${this.searchCommitFilter.text}"`, {showLoad: true}).pop(); + GIT.getCommitHistory({ path: selectedRepository.path, filter: this.searchCommitFilter }, function (err, historyList) { + noti.close(); if (err) { alert(MSGS['Error getting more history. Error: '] + err.message); diff --git a/language/en.json b/language/en.json index a4cc158..95beed1 100644 --- a/language/en.json +++ b/language/en.json @@ -109,6 +109,7 @@ "FILE": "File", "AUTHOR": "Author", "No match for the filter": "No match for the filter", + "Searching for": "Searching for", "Error counting commits. Error: ": "Error counting commits. Error: ", "Error adding files. Error:": "Error adding files. Error:", diff --git a/language/pt-BR.json b/language/pt-BR.json index 7b26291..49df538 100644 --- a/language/pt-BR.json +++ b/language/pt-BR.json @@ -109,6 +109,7 @@ "FILE": "Arquivo", "AUTHOR": "Autor", "No match for the filter": "Nenhuma correspondência para o filtro", + "Searching for": "Buscando por", "Error counting commits. Error: ": "Erro contando commits. Erro: ", "Error adding files. Error:": "Erro adicionando arquivos. Erro:", From 2efb064d431e8f5696d3d7ee7fec84b40bf33f9f Mon Sep 17 00:00:00 2001 From: Matheus Paiva Date: Thu, 17 Mar 2016 10:26:58 -0300 Subject: [PATCH 11/17] :bug: Fixed problem with commit hash visibility --- app/frontend/view/content/pieContent.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/frontend/view/content/pieContent.html b/app/frontend/view/content/pieContent.html index f81bdc4..184d600 100644 --- a/app/frontend/view/content/pieContent.html +++ b/app/frontend/view/content/pieContent.html @@ -121,7 +121,7 @@

      {{ appCtrl.selectedCommit.user }}

      -

      +

      {{ appCtrl.selectedCommit.hash }}

      From c4a0a4e4ff5cb790b1116a785690b08877eec646 Mon Sep 17 00:00:00 2001 From: Matheus Paiva Date: Tue, 29 Mar 2016 13:41:57 -0300 Subject: [PATCH 12/17] Helvetica font added as a selectable font TODO: List dynamically the operating system available fonts --- app/frontend/modules/settings-page.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/frontend/modules/settings-page.js b/app/frontend/modules/settings-page.js index d48cc12..1abb96d 100644 --- a/app/frontend/modules/settings-page.js +++ b/app/frontend/modules/settings-page.js @@ -14,7 +14,8 @@ 'Comic Sans MS', 'Ubuntu', 'Droid Sans', - 'Roboto' + 'Roboto', + 'Helvetica' ]; this.selectedRepository = null; this.globalGitConfigs = { @@ -26,7 +27,7 @@ { code: 'en', description: 'English'}, { code: 'pt-BR', description: 'Portuguese (Brazil)'} ]; - + this.appVersion = require('./package').version; this.hideSettingsPage = function () { @@ -40,7 +41,7 @@ this.getGlobalGitConfigs = function () { GIT.getGlobalConfigs(function (err, configs) { - + if (err) { new GPNotification(MSGS['It seems that a git username and email are not set globally. You can fix this accessing the Settings menu'], { closable: true }).pop(); } else { From 011cf8e351518d1c4617effca3ac168865551f9d Mon Sep 17 00:00:00 2001 From: Matheus Paiva Date: Tue, 5 Apr 2016 21:33:37 -0300 Subject: [PATCH 13/17] :bug: Character "&" treated on code-processor --- app/core/code-processor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/core/code-processor.js b/app/core/code-processor.js index 7300676..feebff8 100644 --- a/app/core/code-processor.js +++ b/app/core/code-processor.js @@ -51,7 +51,7 @@ var getLineType = function (firstChar) { ].join('')); for (var i = 0; i < block.lines.length; i++) { - var lineCode = block.lines[i].code.replace(//g, '>'), + var lineCode = block.lines[i].code.replace(//g, '>').replace(/&/g, '&'), indicator; switch (block.lines[i].type) { From 2ac27e795e39e514f58ded7d962e4a32f0c95c4d Mon Sep 17 00:00:00 2001 From: Matheus Paiva Date: Wed, 6 Apr 2016 10:09:08 -0300 Subject: [PATCH 14/17] :bug: Repositioned "&" replace --- app/core/code-processor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/core/code-processor.js b/app/core/code-processor.js index feebff8..869da89 100644 --- a/app/core/code-processor.js +++ b/app/core/code-processor.js @@ -51,7 +51,7 @@ var getLineType = function (firstChar) { ].join('')); for (var i = 0; i < block.lines.length; i++) { - var lineCode = block.lines[i].code.replace(//g, '>').replace(/&/g, '&'), + var lineCode = block.lines[i].code.replace(/&/g, '&').replace(//g, '>'), indicator; switch (block.lines[i].type) { From 6d4d562534b8a6e36f00d822c400290ef1d011ec Mon Sep 17 00:00:00 2001 From: Matheus Paiva Date: Mon, 18 Apr 2016 10:10:47 -0300 Subject: [PATCH 15/17] Added title attribute in the repository list Added title containing the local path of the repository --- app/frontend/view/content/pieContent.html | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/frontend/view/content/pieContent.html b/app/frontend/view/content/pieContent.html index 184d600..51cfe57 100644 --- a/app/frontend/view/content/pieContent.html +++ b/app/frontend/view/content/pieContent.html @@ -10,7 +10,8 @@
      Github
      • + ng-click="appCtrl.showRepositoryInfo(repository)" ng-right-click="appCtrl.openRepositoryContextualMenu($event, repository, $index)" + title="{{repository.path}}"> {{ repository.name }}
      @@ -19,7 +20,8 @@
      Bitbucket
      • + ng-click="appCtrl.showRepositoryInfo(repository)" ng-right-click="appCtrl.openRepositoryContextualMenu($event, repository, $index)" + title="{{repository.path}}"> {{ repository.name }}
      @@ -28,7 +30,8 @@
      {{ MSGS.Others }}
      • + ng-click="appCtrl.showRepositoryInfo(repository)" ng-right-click="appCtrl.openRepositoryContextualMenu($event, repository, $index)" + title="{{repository.path}}"> {{ repository.name }}
      From efb528fdb146f180cb42acbc7f185905ca8c98b3 Mon Sep 17 00:00:00 2001 From: Matheus Paiva Date: Fri, 13 May 2016 14:19:27 -0300 Subject: [PATCH 16/17] Better commit workflow After click on the COMMIT button the entire commit form is blocked instead just the button --- app/frontend/modules/content.js | 15 ++++++++++----- app/frontend/view/content/pieContent.html | 4 +++- language/en.json | 1 + language/pt-BR.json | 1 + resources/sass/all.scss | 5 +++++ 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/app/frontend/modules/content.js b/app/frontend/modules/content.js index 34b2e0d..306ad5b 100644 --- a/app/frontend/modules/content.js +++ b/app/frontend/modules/content.js @@ -266,7 +266,7 @@ if (commitMessage) { let selectedFiles = []; - event.target.setAttribute('disabled', true); + event.target.parentNode.setAttribute('disabled', true); this.commitChanges.forEach(function (file) { if (file.checked) { @@ -274,6 +274,8 @@ } }); + this.isCreatingCommit = true; + if (selectedFiles.length > 0) { GIT.add(selectedRepository.path, { @@ -281,9 +283,10 @@ callback: function (error) { if (error) { - alert(`${MSGS['Error adding files. Error:']} ${error.message}`); + event.target.parentNode.removeAttribute('disabled'); + this.isCreatingCommit = false; - event.target.removeAttribute('disabled'); + alert(`${MSGS['Error adding files. Error:']} ${error.message}`); } else { GIT.commit(selectedRepository.path, { @@ -299,7 +302,8 @@ this.setCommitDescription(null); } - event.target.removeAttribute('disabled'); + event.target.parentNode.removeAttribute('disabled'); + this.isCreatingCommit = false; }.bind(this) }); @@ -307,7 +311,8 @@ }.bind(this) }); } else { - event.target.removeAttribute('disabled'); + event.target.parentNode.removeAttribute('disabled'); + this.isCreatingCommit = false; } } }; diff --git a/app/frontend/view/content/pieContent.html b/app/frontend/view/content/pieContent.html index 51cfe57..77a2f8a 100644 --- a/app/frontend/view/content/pieContent.html +++ b/app/frontend/view/content/pieContent.html @@ -80,7 +80,9 @@

      {{ MSGS["Commit changes"] }}

      - +