From f13642b4d18c99d49d0367d46b48e98e4570e3e5 Mon Sep 17 00:00:00 2001 From: Wyatt Allen Date: Fri, 7 Sep 2018 12:14:36 -0700 Subject: [PATCH] Provide in-dashboard help for creating changes When an authenticated user's "Outgoing Changes" section is empty, provide a message and dialogs with step-by-step instructions and command samples for how to create a new change. Change-Id: Id8f05a3b6bec399dd8ad3f226185f03d8663cc80 --- .../gr-change-list/gr-change-list.html | 9 +- .../gr-change-list/gr-change-list.js | 8 ++ .../gr-change-list/gr-change-list_test.html | 26 ++++++ .../gr-create-commands-dialog.html | 87 +++++++++++++++++++ .../gr-create-commands-dialog.js | 58 +++++++++++++ .../gr-create-commands-dialog_test.html | 53 +++++++++++ .../gr-create-destination-dialog.html | 48 ++++++++++ .../gr-create-destination-dialog.js | 58 +++++++++++++ .../gr-dashboard-view/gr-dashboard-view.html | 60 ++++++++++++- .../gr-dashboard-view/gr-dashboard-view.js | 11 +++ .../gr-dashboard-view_test.html | 16 ++++ .../app/styles/gr-change-list-styles.html | 4 + polygerrit-ui/app/test/index.html | 1 + 13 files changed, 436 insertions(+), 3 deletions(-) create mode 100644 polygerrit-ui/app/elements/change-list/gr-create-commands-dialog/gr-create-commands-dialog.html create mode 100644 polygerrit-ui/app/elements/change-list/gr-create-commands-dialog/gr-create-commands-dialog.js create mode 100644 polygerrit-ui/app/elements/change-list/gr-create-commands-dialog/gr-create-commands-dialog_test.html create mode 100644 polygerrit-ui/app/elements/change-list/gr-create-destination-dialog/gr-create-destination-dialog.html create mode 100644 polygerrit-ui/app/elements/change-list/gr-create-destination-dialog/gr-create-destination-dialog.js diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.html b/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.html index 4ebe027fea..372e6beff2 100644 --- a/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.html +++ b/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.html @@ -67,13 +67,18 @@ limitations under the License. - diff --git a/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view.js b/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view.js index d84dec5441..6dec1a68ef 100644 --- a/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view.js +++ b/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view.js @@ -45,6 +45,7 @@ // by the viewing user. name: 'Outgoing reviews', query: 'is:open owner:${user} -is:wip -is:ignored', + isOutgoing: true, }, { // Non-WIP open changes not owned by the viewed user, that the viewed user @@ -249,6 +250,7 @@ sectionName: res.sections[i].name, query: res.sections[i].query, results, + isOutgoing: res.sections[i].isOutgoing, })).filter((section, i) => !res.sections[i].hideIfEmpty || section.results.length); }); @@ -267,5 +269,14 @@ this.$.restAPI.saveChangeReviewed(e.detail.change._number, e.detail.reviewed); }, + + _createChangeTap() { + this.$.destinationDialog.open(); + }, + + _handleDestinationConfirm(e) { + this.$.commandsDialog.branch = e.detail.branch; + this.$.commandsDialog.open(); + }, }); })(); diff --git a/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view_test.html b/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view_test.html index cac262718d..21e917ab02 100644 --- a/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view_test.html +++ b/polygerrit-ui/app/elements/change-list/gr-dashboard-view/gr-dashboard-view_test.html @@ -257,6 +257,22 @@ limitations under the License. }); }); + test('preserve isOutgoing sections', () => { + const sections = [ + {name: 'test1', query: 'test1', isOutgoing: true}, + {name: 'test2', query: 'test2'}, + ]; + getChangesStub.restore(); + sandbox.stub(element.$.restAPI, 'getChanges') + .returns(Promise.resolve([[], []])); + + return element._fetchDashboardChanges({sections}).then(() => { + assert.equal(element._results.length, 2); + assert.isTrue(element._results[0].isOutgoing); + assert.isNotOk(element._results[1].isOutgoing); + }); + }); + test('_computeUserHeaderClass', () => { assert.equal(element._computeUserHeaderClass(undefined), ''); assert.equal(element._computeUserHeaderClass(''), ''); diff --git a/polygerrit-ui/app/styles/gr-change-list-styles.html b/polygerrit-ui/app/styles/gr-change-list-styles.html index 37e8bdcc73..51a3fe9a8c 100644 --- a/polygerrit-ui/app/styles/gr-change-list-styles.html +++ b/polygerrit-ui/app/styles/gr-change-list-styles.html @@ -207,6 +207,10 @@ limitations under the License. .size { max-width: none; } + .noChanges .cell { + display: block; + height: auto; + } } @media only screen and (min-width: 1450px) { :host { diff --git a/polygerrit-ui/app/test/index.html b/polygerrit-ui/app/test/index.html index a489627588..6a6fef0d09 100644 --- a/polygerrit-ui/app/test/index.html +++ b/polygerrit-ui/app/test/index.html @@ -56,6 +56,7 @@ limitations under the License. 'change-list/gr-change-list-item/gr-change-list-item_test.html', 'change-list/gr-change-list-view/gr-change-list-view_test.html', 'change-list/gr-change-list/gr-change-list_test.html', + 'change-list/gr-create-commands-dialog/gr-create-commands-dialog_test.html', 'change-list/gr-dashboard-view/gr-dashboard-view_test.html', 'change-list/gr-user-header/gr-user-header_test.html', 'change/gr-account-entry/gr-account-entry_test.html',