Skip to content

Commit 5d37a75

Browse files
committed
massive progress made to ui
1 parent b5982da commit 5d37a75

File tree

5 files changed

+363
-87
lines changed

5 files changed

+363
-87
lines changed

cls/SourceControl/Git/WebUIDriver.cls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,3 +243,4 @@ ClassMethod GetPackageVersion() As %Library.DynamicObject
243243
}
244244

245245
}
246+

git-webui/release/share/git-webui/webui/css/git-webui.css

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -862,24 +862,52 @@ body {
862862
margin: 0 10px;
863863
}
864864
#changedFilesContainer .file-area {
865-
padding-left: 20px;
866865
padding-top: 15px;
867866
overflow-y: scroll;
868867
}
868+
#changedFilesContainer .file-area .select-all {
869+
border-bottom: 2px solid black;
870+
}
871+
#changedFilesContainer .file-area .select-all .form-check-label {
872+
font-size: 1rem;
873+
padding-top: 1px;
874+
padding-left: 8px;
875+
}
876+
#changedFilesContainer .file-area .select-all .form-check-input {
877+
margin-bottom: 2px;
878+
}
879+
#changedFilesContainer .file-area .diffed-file {
880+
background-color: #4daefd;
881+
}
869882
#changedFilesContainer .file-area .form-check {
870-
margin-left: 10px;
871-
padding: 3px 5px 3px 5px;
883+
padding: 3px 5px 3px 15px;
884+
}
885+
#changedFilesContainer .file-area .changes-check:hover {
886+
background-color: rgba(61, 174, 253, 0.2);
872887
}
873888
#changedFilesContainer .file-area .file-item-label {
874889
padding-top: 1px;
875890
padding-left: 8px;
876891
font-size: 1rem;
877892
}
878-
#changedFilesContainer .file-area .file-item-label::after {
893+
#changedFilesContainer .file-area .form-check-input {
894+
margin-left: -12px !important;
895+
}
896+
#changedFilesContainer .file-area .A::after {
879897
content: "A";
880898
position: absolute;
881899
right: 5px;
882900
}
901+
#changedFilesContainer .file-area .D::after {
902+
content: "D";
903+
position: absolute;
904+
right: 5px;
905+
}
906+
#changedFilesContainer .file-area .M::after {
907+
content: "M";
908+
position: absolute;
909+
right: 5px;
910+
}
883911
#changedFilesContainer .commit-area {
884912
padding-top: 15px;
885913
overflow-y: scroll;

git-webui/release/share/git-webui/webui/js/git-webui.js

Lines changed: 142 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2123,6 +2123,7 @@ webui.WorkspaceView = function(mainView) {
21232123
self.workingCopyView.update();
21242124
self.stagingAreaView.update();
21252125
self.commitMessageView.update();
2126+
self.newChangedFilesView.update();
21262127
if (self.workingCopyView.getSelectedItemsCount() + self.stagingAreaView.getSelectedItemsCount() == 0) {
21272128
self.diffView.update(undefined, undefined, undefined, mode);
21282129
}
@@ -2205,7 +2206,6 @@ webui.ChangedFilesView = function(workspaceView, type, label) {
22052206
}
22062207

22072208
if (isForCurrentUser) {
2208-
console.log(fileList);
22092209
addItemToFileList(fileList, "", model);
22102210
}
22112211
}
@@ -2514,70 +2514,173 @@ webui.NewChangedFilesView = function(workspaceView) {
25142514
webui.git("status -u --porcelain", function(data) {
25152515
$.get("api/uncommitted", function (uncommitted) {
25162516
var uncommittedItems = JSON.parse(uncommitted)["current user's changes"];
2517+
self.filesCount = 0;
2518+
function addItemToFileList(fileList, workingTreeStatus, model) {
2519+
var formCheck = $('<div class="form-check changes-check"></div>');
2520+
formCheck.attr("data-filename", model);
2521+
2522+
var checkboxInput = $('<input class="form-check-input changes-checkbox" type="checkbox" value="">');
2523+
checkboxInput.attr('id', model);
2524+
formCheck.append(checkboxInput);
2525+
2526+
var checkboxLabel = $('<label class="form-check-label file-item-label"></label>').text(model);
2527+
checkboxLabel.addClass(workingTreeStatus);
2528+
checkboxLabel.attr('for', model);
2529+
formCheck.append(checkboxLabel);
2530+
2531+
formCheck.prependTo(fileList)[0];
2532+
// item.model = model;
2533+
// item.appendChild(document.createTextNode(model));
2534+
// $(item).click(self.select);
2535+
2536+
}
2537+
webui.splitLines(data).forEach(function(line) {
2538+
var indexStatus = line[0];
2539+
var workingTreeStatus = line[1];
2540+
line = line.substring(3);
2541+
var splitted = line.split(" -> ");
2542+
var model;
2543+
if (splitted.length > 1) {
2544+
model = splitted[1];
2545+
} else {
2546+
model = line;
2547+
}
2548+
2549+
2550+
++self.filesCount;
2551+
var isForCurrentUser;
2552+
if(model.indexOf(" ") > -1){
2553+
isForCurrentUser = (uncommittedItems.indexOf(model.substring(1, model.length-1)) > -1);
2554+
} else {
2555+
isForCurrentUser = (uncommittedItems.indexOf(model) > -1);
2556+
}
2557+
2558+
if (isForCurrentUser) {
2559+
addItemToFileList(fileList, workingTreeStatus, model);
2560+
}
2561+
2562+
});
2563+
$(".changes-checkbox").change(function() {
2564+
var fileName = this.id;
2565+
var fileIndex = selectedItems.indexOf(fileName);
2566+
if (this.checked) {
2567+
if (fileIndex == -1) {
2568+
selectedItems.push(fileName);
2569+
}
2570+
} else {
2571+
$('#selectAllFiles').prop('checked', false);
2572+
if (fileIndex > -1) {
2573+
selectedItems.splice(fileIndex, 1);
2574+
}
2575+
}
2576+
self.updateButtons();
2577+
});
25172578

2518-
})
2579+
$("#commitMsg").on("input", function() {
2580+
self.updateButtons();
2581+
});
2582+
2583+
$('.changes-check').on("click", function() {
2584+
self.unhighlightPrevious();
2585+
$(this).addClass("diffed-file");
2586+
self.fileToDiff = $(this).attr("data-filename");
2587+
self.refreshDiff();
2588+
2589+
});
2590+
2591+
$('#selectAllFiles').on("input", function() {
2592+
if ($(this).checked) {
2593+
self.selectAll();
2594+
} else {
2595+
self.deselectAll();
2596+
}
2597+
})
2598+
});
25192599
});
25202600
}
25212601

2602+
self.handleCheckEvent = function(file) {
2603+
var fileIndex = selectedItems.indexOf(file);
2604+
if (fileIndex > -1) {
2605+
selectedItems.splice(fileIndex, 1);
2606+
} else {
2607+
selectedItems.push(file);
2608+
}
2609+
self.updateButtons();
2610+
}
2611+
2612+
self.updateButtons = function() {
2613+
if (self.getSelectedItemsCount() > 0) {
2614+
$('#stashBtn').prop("disabled", false);
2615+
$('#discardBtn').prop("disabled", false);
2616+
if (!self.commitMsgEmpty()) {
2617+
$('#commitBtn').prop("disabled", false);
2618+
} else {
2619+
$('#commitBtn').prop("disabled", true);
2620+
}
2621+
} else {
2622+
$('#stashBtn').prop("disabled", true);
2623+
$('#discardBtn').prop("disabled", true);
2624+
$('#commitBtn').prop("disabled", true);
2625+
}
2626+
2627+
}
2628+
2629+
self.commitMsgEmpty = function() {
2630+
return $('#commitMsg').val().length == 0;
2631+
}
2632+
25222633
self.getSelectedItemsCount = function() {
2523-
return $(".active", fileList).length;
2634+
return selectedItems.length;
2635+
}
2636+
2637+
self.selectAll = function() {
2638+
2639+
}
2640+
2641+
self.deselectAll = function() {
2642+
2643+
}
2644+
2645+
self.unhighlightPrevious = function(){
2646+
$('[data-filename="' + self.fileToDiff + '"]').removeClass("diffed-file");
2647+
}
2648+
2649+
self.refreshDiff = function() {
2650+
self.fileToDiff;
2651+
workspaceView.diffView.update("diff", [], self.fileToDiff, "stage");
25242652
}
25252653

25262654
self.element = $(
25272655
'<div id="changedFilesContainer" class="container">' +
25282656
'<div class="row">' +
25292657
'<div class="col-sm-6 file-area">' +
2530-
'<div class="changed-files-list">' +
2531-
'<div class="form-check">' +
2532-
'<input class="form-check-input" type="checkbox" value="" id="defaultCheck1">' +
2533-
'<label class="form-check-label file-item-label" for="defaultCheck1">' +
2534-
'test check'+
2535-
'</label>' +
2536-
'</div>' +
2537-
'<div class="form-check">' +
2538-
'<input class="form-check-input" type="checkbox" value="" id="defaultCheck2" checked>' +
2539-
'<label class="form-check-label file-item-label" for="defaultCheck2">' +
2540-
'test check'+
2541-
'</label>' +
2542-
'</div>' +
2543-
'<div class="form-check">' +
2544-
'<input class="form-check-input" type="checkbox" value="" id="defaultCheck3">' +
2545-
'<label class="form-check-label file-item-label" for="defaultCheck3">' +
2546-
'test check'+
2547-
'</label>' +
2548-
'</div>' +
2549-
'<div class="form-check">' +
2550-
'<input class="form-check-input" type="checkbox" value="" id="defaultCheck4">' +
2551-
'<label class="form-check-label file-item-label" for="defaultCheck4">' +
2552-
'test check'+
2553-
'</label>' +
2554-
'</div>' +
2555-
'<div class="form-check">' +
2556-
'<input class="form-check-input" type="checkbox" value="" id="defaultCheck5" checked>' +
2557-
'<label class="form-check-label file-item-label" for="defaultCheck5">' +
2558-
'test check'+
2559-
'</label>' +
2560-
'</div>' +
2658+
'<div class="form-check select-all">' +
2659+
'<input class="form-check-input" id="selectAllFiles" type="checkbox" value="">' +
2660+
'<label class="form-check-label" for="selectAllFiles"> Select All Files </label>' +
25612661
'</div>' +
2662+
'<div class="changed-files-list"></div>' +
25622663
'</div>' +
25632664
'<div class="commit-area col-sm-6">' +
25642665
'<div class="form-group">' +
2565-
'<input type="area" class="form-control" id="commitMsg" placeholder="Enter commit message">' +
2666+
'<input type="area" class="form-control" id="commitMsg" placeholder="Enter commit message (required, 72 character limit)">' +
25662667
'</div>' +
25672668
'<div class="form-group">' +
2568-
'<textarea class="form-control" id="commitMsgDetail" placeholder="Enter commit message details (optional)"></textarea>' +
2669+
'<textarea class="form-control" id="commitMsgDetail" placeholder="Enter commit details (optional, no character limit)"></textarea>' +
25692670
'</div>' +
25702671
'<div class="button-group">' +
2571-
'<button type="button" class="btn btn-primary file-action-button"> Commit </button>' +
2572-
'<button type="button" class="btn btn-secondary file-action-button" > Stash </button>' +
2573-
'<button type="button" class="btn btn-danger file-action-button"> Discard </button>' +
2672+
'<button type="button" class="btn btn-primary file-action-button" id="commitBtn" disabled> Commit </button>' +
2673+
'<button type="button" class="btn btn-secondary file-action-button" id="stashBtn" disabled> Stash </button>' +
2674+
'<button type="button" class="btn btn-danger file-action-button" id="discardBtn" disabled> Discard </button>' +
25742675
'</div>' +
25752676
'</div>' +
25762677
'</div>' +
25772678
'</div>'
25782679
)[0];
25792680
var fileListContainer = $(".file-area", self.element)[0];
25802681
var fileList = $(".changed-files-list", fileListContainer)[0];
2682+
var selectedItems = [];
2683+
var fileToDiff;
25812684
}
25822685

25832686
/*

git-webui/src/share/git-webui/webui/css/git-webui.less

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -832,26 +832,67 @@ body {
832832
max-width: 100% !important;
833833
margin: 0 10px;
834834
.file-area {
835-
padding-left: 20px;
835+
// padding-left: 20px;
836836
padding-top: 15px;
837-
838837
overflow-y: scroll;
839838

839+
.select-all {
840+
841+
.form-check-label {
842+
font-size: 1rem;
843+
padding-top: 1px;
844+
padding-left: 8px;
845+
}
846+
847+
.form-check-input {
848+
margin-bottom: 2px;
849+
}
850+
851+
border-bottom: 2px solid black;
852+
}
853+
854+
.diffed-file {
855+
background-color: #4daefd;
856+
}
857+
858+
859+
840860
.form-check {
841-
margin-left: 10px;
842-
padding: 3px 5px 3px 5px;
861+
padding: 3px 5px 3px 15px;
862+
}
863+
864+
.changes-check:hover {
865+
background-color: rgba(61, 174, 253, 0.2);
843866
}
867+
844868
.file-item-label {
845869
padding-top: 1px;
846870
padding-left: 8px;
847871
font-size: 1rem;
848872

849873
}
850-
.file-item-label::after {
874+
875+
.form-check-input {
876+
margin-left: -12px !important;
877+
}
878+
.A::after {
851879
content: "A";
852880
position: absolute;
853881
right: 5px;
854882
}
883+
884+
.D::after {
885+
content: "D";
886+
position: absolute;
887+
right: 5px;
888+
}
889+
890+
.M::after {
891+
content: "M";
892+
position: absolute;
893+
right: 5px;
894+
}
895+
855896
}
856897

857898
.commit-area {

0 commit comments

Comments
 (0)