1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Add a class to the Differential banner when unsubmitted/unsaved changes are present

Summary: Ref T12733. This adds classes for unsubmitted/unsaved changes, and lays some groundwork for additional buttons.

Test Plan:
  - Added, edited, deleted comments.
  - Saw bar background color update appropriately.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12733

Differential Revision: https://secure.phabricator.com/D18045
This commit is contained in:
epriestley 2017-05-30 14:00:02 -07:00
parent cc0a6fd3aa
commit 83e99fb691
5 changed files with 98 additions and 30 deletions

View file

@ -12,8 +12,8 @@ return array(
'core.pkg.css' => 'bb7f0446', 'core.pkg.css' => 'bb7f0446',
'core.pkg.js' => '1475bd91', 'core.pkg.js' => '1475bd91',
'darkconsole.pkg.js' => '1f9a31bc', 'darkconsole.pkg.js' => '1f9a31bc',
'differential.pkg.css' => '9ebe4f44', 'differential.pkg.css' => 'a2755617',
'differential.pkg.js' => '40f4acb3', 'differential.pkg.js' => '5bf658f0',
'diffusion.pkg.css' => 'b93d9b8c', 'diffusion.pkg.css' => 'b93d9b8c',
'diffusion.pkg.js' => '84c8f8fd', 'diffusion.pkg.js' => '84c8f8fd',
'favicon.ico' => '30672e08', 'favicon.ico' => '30672e08',
@ -64,7 +64,7 @@ return array(
'rsrc/css/application/dashboard/dashboard.css' => 'fe5b1869', 'rsrc/css/application/dashboard/dashboard.css' => 'fe5b1869',
'rsrc/css/application/diff/inline-comment-summary.css' => '51efda3a', 'rsrc/css/application/diff/inline-comment-summary.css' => '51efda3a',
'rsrc/css/application/differential/add-comment.css' => 'c47f8c40', 'rsrc/css/application/differential/add-comment.css' => 'c47f8c40',
'rsrc/css/application/differential/changeset-view.css' => '2971e2a2', 'rsrc/css/application/differential/changeset-view.css' => '983751ee',
'rsrc/css/application/differential/core.css' => '5b7b8ff4', 'rsrc/css/application/differential/core.css' => '5b7b8ff4',
'rsrc/css/application/differential/phui-inline-comment.css' => 'ffd1a542', 'rsrc/css/application/differential/phui-inline-comment.css' => 'ffd1a542',
'rsrc/css/application/differential/revision-comment.css' => '14b8565a', 'rsrc/css/application/differential/revision-comment.css' => '14b8565a',
@ -391,9 +391,9 @@ return array(
'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '408bf173', 'rsrc/js/application/dashboard/behavior-dashboard-move-panels.js' => '408bf173',
'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375', 'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375',
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63', 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63',
'rsrc/js/application/diff/DiffChangeset.js' => '3359ad02', 'rsrc/js/application/diff/DiffChangeset.js' => '1f6748ae',
'rsrc/js/application/diff/DiffChangesetList.js' => 'b42eb5ff', 'rsrc/js/application/diff/DiffChangesetList.js' => '85abc805',
'rsrc/js/application/diff/DiffInline.js' => '45d37835', 'rsrc/js/application/diff/DiffInline.js' => '1d17130f',
'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832', 'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832',
'rsrc/js/application/differential/behavior-comment-preview.js' => '51c5ad07', 'rsrc/js/application/differential/behavior-comment-preview.js' => '51c5ad07',
'rsrc/js/application/differential/behavior-diff-radios.js' => 'e1ff79b1', 'rsrc/js/application/differential/behavior-diff-radios.js' => 'e1ff79b1',
@ -566,7 +566,7 @@ return array(
'conpherence-thread-manager' => '4d863052', 'conpherence-thread-manager' => '4d863052',
'conpherence-transaction-css' => '85129c68', 'conpherence-transaction-css' => '85129c68',
'd3' => 'a11a5ff2', 'd3' => 'a11a5ff2',
'differential-changeset-view-css' => '2971e2a2', 'differential-changeset-view-css' => '983751ee',
'differential-core-view-css' => '5b7b8ff4', 'differential-core-view-css' => '5b7b8ff4',
'differential-revision-add-comment-css' => 'c47f8c40', 'differential-revision-add-comment-css' => 'c47f8c40',
'differential-revision-comment-css' => '14b8565a', 'differential-revision-comment-css' => '14b8565a',
@ -777,9 +777,9 @@ return array(
'phabricator-darklog' => 'c8e1ffe3', 'phabricator-darklog' => 'c8e1ffe3',
'phabricator-darkmessage' => 'c48cccdd', 'phabricator-darkmessage' => 'c48cccdd',
'phabricator-dashboard-css' => 'fe5b1869', 'phabricator-dashboard-css' => 'fe5b1869',
'phabricator-diff-changeset' => '3359ad02', 'phabricator-diff-changeset' => '1f6748ae',
'phabricator-diff-changeset-list' => 'b42eb5ff', 'phabricator-diff-changeset-list' => '85abc805',
'phabricator-diff-inline' => '45d37835', 'phabricator-diff-inline' => '1d17130f',
'phabricator-drag-and-drop-file-upload' => '58dea2fa', 'phabricator-drag-and-drop-file-upload' => '58dea2fa',
'phabricator-draggable-list' => 'bea6e7f4', 'phabricator-draggable-list' => 'bea6e7f4',
'phabricator-fatal-config-template-css' => '8f18fa41', 'phabricator-fatal-config-template-css' => '8f18fa41',
@ -1019,6 +1019,9 @@ return array(
'javelin-request', 'javelin-request',
'javelin-uri', 'javelin-uri',
), ),
'1d17130f' => array(
'javelin-dom',
),
'1def2711' => array( '1def2711' => array(
'javelin-install', 'javelin-install',
'javelin-dom', 'javelin-dom',
@ -1035,6 +1038,17 @@ return array(
'javelin-uri', 'javelin-uri',
'javelin-routable', 'javelin-routable',
), ),
'1f6748ae' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-workflow',
'javelin-router',
'javelin-behavior-device',
'javelin-vector',
'phabricator-diff-inline',
),
'1f6794f6' => array( '1f6794f6' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-stratcom', 'javelin-stratcom',
@ -1072,9 +1086,6 @@ return array(
'javelin-install', 'javelin-install',
'javelin-util', 'javelin-util',
), ),
'2971e2a2' => array(
'phui-inline-comment-view-css',
),
'2ae077e1' => array( '2ae077e1' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-dom', 'javelin-dom',
@ -1110,17 +1121,6 @@ return array(
'javelin-dom', 'javelin-dom',
'javelin-workflow', 'javelin-workflow',
), ),
'3359ad02' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-workflow',
'javelin-router',
'javelin-behavior-device',
'javelin-vector',
'phabricator-diff-inline',
),
'358b8c04' => array( '358b8c04' => array(
'javelin-install', 'javelin-install',
'javelin-util', 'javelin-util',
@ -1203,9 +1203,6 @@ return array(
'javelin-behavior', 'javelin-behavior',
'javelin-dom', 'javelin-dom',
), ),
'45d37835' => array(
'javelin-dom',
),
'469c0d9e' => array( '469c0d9e' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-dom', 'javelin-dom',
@ -1541,6 +1538,9 @@ return array(
'javelin-dom', 'javelin-dom',
'javelin-stratcom', 'javelin-stratcom',
), ),
'85abc805' => array(
'javelin-install',
),
'85ee8ce6' => array( '85ee8ce6' => array(
'aphront-dialog-view-css', 'aphront-dialog-view-css',
), ),
@ -1652,6 +1652,9 @@ return array(
'javelin-mask', 'javelin-mask',
'phabricator-drag-and-drop-file-upload', 'phabricator-drag-and-drop-file-upload',
), ),
'983751ee' => array(
'phui-inline-comment-view-css',
),
'988040b4' => array( '988040b4' => array(
'javelin-install', 'javelin-install',
'javelin-dom', 'javelin-dom',
@ -1819,9 +1822,6 @@ return array(
'b3e7d692' => array( 'b3e7d692' => array(
'javelin-install', 'javelin-install',
), ),
'b42eb5ff' => array(
'javelin-install',
),
'b59e1e96' => array( 'b59e1e96' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-stratcom', 'javelin-stratcom',

View file

@ -408,3 +408,8 @@ tr.differential-inline-loading {
.diff-banner-path { .diff-banner-path {
color: {$greytext}; color: {$greytext};
} }
.diff-banner-has-unsaved,
.diff-banner-has-unsubmitted {
background: {$sh-yellowbackground};
}

View file

@ -679,6 +679,11 @@ JX.install('DiffChangeset', {
return null; return null;
}, },
getInlines: function() {
this._rebuildAllInlines();
return this._inlines;
},
_rebuildAllInlines: function() { _rebuildAllInlines: function() {
var rows = JX.DOM.scry(this._node, 'tr'); var rows = JX.DOM.scry(this._node, 'tr');
for (var ii = 0; ii < rows.length; ii++) { for (var ii = 0; ii < rows.length; ii++) {

View file

@ -818,6 +818,11 @@ JX.install('DiffChangesetList', {
this._redrawSelection(); this._redrawSelection();
this._redrawHover(); this._redrawHover();
// Force a banner redraw after a resize event. Particularly, this makes
// sure the inline state updates immediately after an inline edit
// operation, even if the changeset itself has not changed.
this._bannerChangeset = null;
this._redrawBanner(); this._redrawBanner();
}, },
@ -1278,6 +1283,43 @@ JX.install('DiffChangesetList', {
return; return;
} }
var changesets = this._changesets;
var unsaved = [];
var unsubmitted = [];
var undone = [];
var all = [];
for (var ii = 0; ii < changesets.length; ii++) {
var inlines = changesets[ii].getInlines();
for (var jj = 0; jj < inlines.length; jj++) {
var inline = inlines[jj];
if (inline.isDeleted()) {
continue;
}
all.push(inline);
if (inline.isEditing()) {
unsaved.push(inline);
} else if (inline.isDraft()) {
unsubmitted.push(inline);
} else if (!inline.isDone()) {
undone.push(inline);
}
}
}
JX.DOM.alterClass(
node,
'diff-banner-has-unsaved',
!!unsaved.length);
JX.DOM.alterClass(
node,
'diff-banner-has-unsubmitted',
!!unsubmitted.length);
var icon = new JX.PHUIXIconView() var icon = new JX.PHUIXIconView()
.setIcon(changeset.getIcon()) .setIcon(changeset.getIcon())
.getNode(); .getNode();

View file

@ -81,6 +81,22 @@ JX.install('DiffInline', {
return this; return this;
}, },
isDraft: function() {
return this._isDraft;
},
isDone: function() {
return this._isFixed;
},
isEditing: function() {
return this._isEditing;
},
isDeleted: function() {
return this._isDeleted;
},
bindToRange: function(data) { bindToRange: function(data) {
this._displaySide = data.displaySide; this._displaySide = data.displaySide;
this._number = parseInt(data.number, 10); this._number = parseInt(data.number, 10);