mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Disable view-diff button for deletes/unknown files
This commit is contained in:
parent
10567afbb9
commit
eae390acf5
@ -22,11 +22,17 @@ RED.stack = (function() {
|
|||||||
var entries = [];
|
var entries = [];
|
||||||
|
|
||||||
var visible = true;
|
var visible = true;
|
||||||
|
// TODO: make this a singleton function - and watch out for stacks no longer
|
||||||
|
// in the DOM
|
||||||
var resizeStack = function() {
|
var resizeStack = function() {
|
||||||
if (entries.length > 0) {
|
if (entries.length > 0) {
|
||||||
var headerHeight = entries[0].header.outerHeight();
|
var headerHeight = 0;
|
||||||
|
entries.forEach(function(entry) {
|
||||||
|
headerHeight += entry.header.outerHeight();
|
||||||
|
});
|
||||||
|
|
||||||
var height = container.innerHeight();
|
var height = container.innerHeight();
|
||||||
contentHeight = height - entries.length*headerHeight - (entries.length-1);
|
contentHeight = height - headerHeight - (entries.length-1);
|
||||||
entries.forEach(function(e) {
|
entries.forEach(function(e) {
|
||||||
e.contentWrap.height(contentHeight);
|
e.contentWrap.height(contentHeight);
|
||||||
});
|
});
|
||||||
|
@ -37,11 +37,18 @@ RED.sidebar.versionControl = (function() {
|
|||||||
function createChangeEntry(row, entry, status, unstaged) {
|
function createChangeEntry(row, entry, status, unstaged) {
|
||||||
row.addClass("sidebar-version-control-change-entry");
|
row.addClass("sidebar-version-control-change-entry");
|
||||||
var container = $('<div>').appendTo(row);
|
var container = $('<div>').appendTo(row);
|
||||||
|
if (entry.label) {
|
||||||
|
row.addClass('node-info-none');
|
||||||
|
container.text(entry.label);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var icon = $('<i class=""></i>').appendTo(container);
|
var icon = $('<i class=""></i>').appendTo(container);
|
||||||
var label = $('<span>').appendTo(container);
|
var label = $('<span>').appendTo(container);
|
||||||
|
|
||||||
var bg = $('<div class="button-group"></div>').appendTo(row);
|
var bg = $('<div class="button-group"></div>').appendTo(row);
|
||||||
$('<button class="editor-button editor-button-small"><i class="fa fa-eye"></i></button>')
|
var viewDiffButton = $('<button class="editor-button editor-button-small"><i class="fa fa-eye"></i></button>')
|
||||||
.appendTo(bg)
|
.appendTo(bg)
|
||||||
.click(function(evt) {
|
.click(function(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
@ -131,6 +138,12 @@ RED.sidebar.versionControl = (function() {
|
|||||||
entry.spinner.remove();
|
entry.spinner.remove();
|
||||||
delete entry.spinner;
|
delete entry.spinner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
viewDiffButton.attr("disabled",(status === 'D' || status === '?'));
|
||||||
|
viewDiffButton.find("i")
|
||||||
|
.toggleClass('fa-eye',!(status === 'D' || status === '?'))
|
||||||
|
.toggleClass('fa-eye-slash',(status === 'D' || status === '?'))
|
||||||
|
|
||||||
}
|
}
|
||||||
entry["update"+(unstaged?"Unstaged":"Staged")](entry, status);
|
entry["update"+(unstaged?"Unstaged":"Staged")](entry, status);
|
||||||
}
|
}
|
||||||
@ -156,7 +169,7 @@ RED.sidebar.versionControl = (function() {
|
|||||||
localChanges.content.css({height:"100%"});
|
localChanges.content.css({height:"100%"});
|
||||||
|
|
||||||
var bg = $('<div style="float: right"></div>').appendTo(localChanges.header);
|
var bg = $('<div style="float: right"></div>').appendTo(localChanges.header);
|
||||||
$('<button class="sidebar-header-button"><i class="fa fa-refresh"></i></button>')
|
$('<button class="editor-button editor-button-small"><i class="fa fa-refresh"></i></button>')
|
||||||
.appendTo(bg)
|
.appendTo(bg)
|
||||||
.click(function(evt) {
|
.click(function(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
@ -208,6 +221,7 @@ RED.sidebar.versionControl = (function() {
|
|||||||
submitCommitButton.attr("disabled",true);
|
submitCommitButton.attr("disabled",true);
|
||||||
unstagedContent.css("height","30px");
|
unstagedContent.css("height","30px");
|
||||||
stagedContent.css("height","calc(100% - 30px - 175px)");
|
stagedContent.css("height","calc(100% - 30px - 175px)");
|
||||||
|
commitBox.show();
|
||||||
commitBox.css("height","175px");
|
commitBox.css("height","175px");
|
||||||
stageAllButton.attr("disabled",true);
|
stageAllButton.attr("disabled",true);
|
||||||
unstageAllButton.attr("disabled",true);
|
unstageAllButton.attr("disabled",true);
|
||||||
@ -239,7 +253,7 @@ RED.sidebar.versionControl = (function() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
commitBox = $('<div class="sidebar-version-control-change-commit-box"></div>').appendTo(localChanges.content);
|
commitBox = $('<div class="sidebar-version-control-change-commit-box"></div>').hide().appendTo(localChanges.content);
|
||||||
|
|
||||||
var commitMessage = $('<textarea>')
|
var commitMessage = $('<textarea>')
|
||||||
.appendTo(commitBox)
|
.appendTo(commitBox)
|
||||||
@ -256,6 +270,9 @@ RED.sidebar.versionControl = (function() {
|
|||||||
unstagedContent.css("height","");
|
unstagedContent.css("height","");
|
||||||
stagedContent.css("height","");
|
stagedContent.css("height","");
|
||||||
commitBox.css("height","");
|
commitBox.css("height","");
|
||||||
|
setTimeout(function() {
|
||||||
|
commitBox.hide();
|
||||||
|
},200);
|
||||||
stageAllButton.attr("disabled",false);
|
stageAllButton.attr("disabled",false);
|
||||||
unstageAllButton.attr("disabled",false);
|
unstageAllButton.attr("disabled",false);
|
||||||
commitButton.attr("disabled",false);
|
commitButton.attr("disabled",false);
|
||||||
@ -350,13 +367,16 @@ RED.sidebar.versionControl = (function() {
|
|||||||
|
|
||||||
var refreshInProgress = false;
|
var refreshInProgress = false;
|
||||||
|
|
||||||
|
var emptyStagedItem = { label:"None" };
|
||||||
|
|
||||||
function refreshFiles(result) {
|
function refreshFiles(result) {
|
||||||
if (bulkChangeSpinner) {
|
if (bulkChangeSpinner) {
|
||||||
bulkChangeSpinner.remove();
|
bulkChangeSpinner.remove();
|
||||||
bulkChangeSpinner = null;
|
bulkChangeSpinner = null;
|
||||||
}
|
}
|
||||||
// unstagedChangesList.editableList('empty');
|
unstagedChangesList.editableList('removeItem',emptyStagedItem);
|
||||||
// stagedChangesList.editableList('empty');
|
stagedChangesList.editableList('removeItem',emptyStagedItem);
|
||||||
|
|
||||||
var fileNames = Object.keys(result).filter(function(f) { return result[f].type === 'f'})
|
var fileNames = Object.keys(result).filter(function(f) { return result[f].type === 'f'})
|
||||||
fileNames.sort();
|
fileNames.sort();
|
||||||
var updateIndex = Date.now()+Math.floor(Math.random()*100);
|
var updateIndex = Date.now()+Math.floor(Math.random()*100);
|
||||||
@ -425,6 +445,14 @@ RED.sidebar.versionControl = (function() {
|
|||||||
stageAllButton.attr('disabled',unstagedCount === 0);
|
stageAllButton.attr('disabled',unstagedCount === 0);
|
||||||
unstageAllButton.attr('disabled',stagedCount === 0);
|
unstageAllButton.attr('disabled',stagedCount === 0);
|
||||||
|
|
||||||
|
if (stagedCount === 0) {
|
||||||
|
stagedChangesList.editableList('addItem',emptyStagedItem);
|
||||||
|
}
|
||||||
|
if (unstagedCount === 0) {
|
||||||
|
unstagedChangesList.editableList('addItem',emptyStagedItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function refresh(full) {
|
function refresh(full) {
|
||||||
|
@ -115,10 +115,10 @@ RED.tray = (function() {
|
|||||||
$("#editor-shade").show();
|
$("#editor-shade").show();
|
||||||
$("#palette-shade").show();
|
$("#palette-shade").show();
|
||||||
$(".sidebar-shade").show();
|
$(".sidebar-shade").show();
|
||||||
|
|
||||||
tray.preferredWidth = Math.max(el.width(),500);
|
tray.preferredWidth = Math.max(el.width(),500);
|
||||||
body.css({"minWidth":tray.preferredWidth-40});
|
if (!options.maximized) {
|
||||||
|
body.css({"minWidth":tray.preferredWidth-40});
|
||||||
|
}
|
||||||
if (options.width) {
|
if (options.width) {
|
||||||
if (options.width > $("#editor-stack").position().left-8) {
|
if (options.width > $("#editor-stack").position().left-8) {
|
||||||
options.width = $("#editor-stack").position().left-8;
|
options.width = $("#editor-stack").position().left-8;
|
||||||
|
@ -318,6 +318,10 @@
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&.node-info-none {
|
||||||
|
text-align: center;
|
||||||
|
background: #fefefe;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.sidebar-version-control-change-header {
|
.sidebar-version-control-change-header {
|
||||||
color: #666;
|
color: #666;
|
||||||
|
Loading…
Reference in New Issue
Block a user