Merge "Add instructions for switching to old UI for admin view"
diff --git a/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.html b/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.html
new file mode 100644
index 0000000..0dee091
--- /dev/null
+++ b/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.html
@@ -0,0 +1,52 @@
+<!--
+Copyright (C) 2017 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<link rel="import" href="../../../bower_components/polymer/polymer.html">
+
+<dom-module id="gr-admin-view">
+ <template>
+ <style>
+ main {
+ margin: 2em auto;
+ max-width: 46em;
+ }
+ h1 {
+ margin-bottom: .1em;
+ }
+ @media only screen and (max-width: 67em) {
+ main {
+ margin: 2em 0 2em 15em;
+ }
+ }
+ @media only screen and (max-width: 53em) {
+ .loading {
+ padding: 0 var(--default-horizontal-margin);
+ }
+ main {
+ margin: 2em 1em;
+ }
+ </style>
+ <main>
+ <h1>Admin</h1>
+ <section>
+ This page is not yet implemented in PolyGerrit. View it in the
+ <a id="gwtLink" href$="/?polygerrit=0#[[path]]" rel="external">
+ Old UI</a>
+ </section>
+ </main>
+ </template>
+ <script src="gr-admin-view.js"></script>
+</dom-module>
diff --git a/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.js b/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.js
new file mode 100644
index 0000000..cb248e1
--- /dev/null
+++ b/polygerrit-ui/app/elements/admin/gr-admin-view/gr-admin-view.js
@@ -0,0 +1,24 @@
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+(function() {
+ 'use strict';
+
+ Polymer({
+ is: 'gr-admin-view',
+
+ properties: {
+ path: String,
+ },
+ });
+})();
diff --git a/polygerrit-ui/app/elements/core/gr-router/gr-router.js b/polygerrit-ui/app/elements/core/gr-router/gr-router.js
index 3819bfe..b439fc8 100644
--- a/polygerrit-ui/app/elements/core/gr-router/gr-router.js
+++ b/polygerrit-ui/app/elements/core/gr-router/gr-router.js
@@ -91,6 +91,17 @@
});
});
+ page('/admin/(.*)', loadUser, function(data) {
+ restAPI.getLoggedIn().then(function(loggedIn) {
+ if (loggedIn) {
+ data.params.view = 'gr-admin-view';
+ app.params = data.params;
+ } else {
+ page.redirect('/login/' + encodeURIComponent(data.canonicalPath));
+ }
+ });
+ });
+
function queryHandler(data) {
data.params.view = 'gr-change-list-view';
app.params = data.params;
diff --git a/polygerrit-ui/app/elements/gr-app.html b/polygerrit-ui/app/elements/gr-app.html
index 2b910e6..6499f08 100644
--- a/polygerrit-ui/app/elements/gr-app.html
+++ b/polygerrit-ui/app/elements/gr-app.html
@@ -18,6 +18,8 @@
<link rel="import" href="../behaviors/keyboard-shortcut-behavior/keyboard-shortcut-behavior.html">
<link rel="import" href="../styles/app-theme.html">
+<link rel="import" href="./admin/gr-admin-view/gr-admin-view.html">
+
<link rel="import" href="./core/gr-error-manager/gr-error-manager.html">
<link rel="import" href="./core/gr-keyboard-shortcuts-dialog/gr-keyboard-shortcuts-dialog.html">
<link rel="import" href="./core/gr-main-header/gr-main-header.html">
@@ -123,6 +125,9 @@
on-account-detail-update="_handleAccountDetailUpdate">
</gr-settings-view>
</template>
+ <template is="dom-if" if="[[_showAdminView]]" restamp="true">
+ <gr-admin-view path="[[_path]]"></gr-admin-view>
+ </template>
<div id="errorView" class="errorView" hidden>
<div class="errorEmoji">[[_lastError.emoji]]</div>
<div class="errorText">[[_lastError.text]]</div>
diff --git a/polygerrit-ui/app/elements/gr-app.js b/polygerrit-ui/app/elements/gr-app.js
index 72f5254..f38bb91 100644
--- a/polygerrit-ui/app/elements/gr-app.js
+++ b/polygerrit-ui/app/elements/gr-app.js
@@ -112,6 +112,7 @@
this.set('_showChangeView', view === 'gr-change-view');
this.set('_showDiffView', view === 'gr-diff-view');
this.set('_showSettingsView', view === 'gr-settings-view');
+ this.set('_showAdminView', view === 'gr-admin-view');
if (this.params.justRegistered) {
this.$.registration.open();
}