Fork a Polymer 2 version of gr-app
The webserver can then serve both versions depending on e.g. a URL parameter. Change-Id: I385a1937357077a6c8fa1d54818ab0afb827728b
This commit is contained in:
40
polygerrit-ui/app/elements/gr-app-p2.html
Normal file
40
polygerrit-ui/app/elements/gr-app-p2.html
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<!--
|
||||||
|
@license
|
||||||
|
Copyright (C) 2019 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.
|
||||||
|
-->
|
||||||
|
<script>
|
||||||
|
window.Gerrit = window.Gerrit || {};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<link rel="import" href="/bower_components/polymer/polymer.html">
|
||||||
|
<link rel="import" href="/bower_components/polymer-resin/polymer-resin.html">
|
||||||
|
<link rel="import" href="/bower_components/polymer/lib/legacy/legacy-data-mixin.html">
|
||||||
|
<link rel="import" href="/bower_components/shadycss/apply-shim.html">
|
||||||
|
<link rel="import" href="../behaviors/safe-types-behavior/safe-types-behavior.html">
|
||||||
|
<script>
|
||||||
|
security.polymer_resin.install({
|
||||||
|
allowedIdentifierPrefixes: [''],
|
||||||
|
reportHandler: security.polymer_resin.CONSOLE_LOGGING_REPORT_HANDLER,
|
||||||
|
safeTypesBridge: Gerrit.SafeTypes.safeTypesBridge,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<link rel="import" href="./gr-app-element.html">
|
||||||
|
<dom-module id="gr-app-p2">
|
||||||
|
<template>
|
||||||
|
<gr-app-element id="app-element"></gr-app-element>
|
||||||
|
</template>
|
||||||
|
<script src="gr-app-p2.js" crossorigin="anonymous"></script>
|
||||||
|
</dom-module>
|
23
polygerrit-ui/app/elements/gr-app-p2.js
Normal file
23
polygerrit-ui/app/elements/gr-app-p2.js
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/**
|
||||||
|
* @license
|
||||||
|
* Copyright (C) 2019 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-app-p2',
|
||||||
|
});
|
||||||
|
})();
|
@@ -15,7 +15,6 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<script>
|
<script>
|
||||||
if (!window.POLYMER2) {
|
|
||||||
// This must be set prior to loading Polymer for the first time.
|
// This must be set prior to loading Polymer for the first time.
|
||||||
if (localStorage.getItem('USE_SHADOW_DOM') === 'true') {
|
if (localStorage.getItem('USE_SHADOW_DOM') === 'true') {
|
||||||
window.Polymer = {
|
window.Polymer = {
|
||||||
@@ -27,13 +26,11 @@ limitations under the License.
|
|||||||
passiveTouchGestures: true,
|
passiveTouchGestures: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
window.Gerrit = window.Gerrit || {};
|
window.Gerrit = window.Gerrit || {};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<link rel="import" href="/bower_components/polymer/polymer.html">
|
<link rel="import" href="/bower_components/polymer/polymer.html">
|
||||||
<link rel="import" href="/bower_components/polymer-resin/standalone/polymer-resin.html">
|
<link rel="import" href="/bower_components/polymer-resin/standalone/polymer-resin.html">
|
||||||
<link rel="import" href="/bower_components/polymer/lib/legacy/legacy-data-mixin.html">
|
|
||||||
<link rel="import" href="../behaviors/safe-types-behavior/safe-types-behavior.html">
|
<link rel="import" href="../behaviors/safe-types-behavior/safe-types-behavior.html">
|
||||||
<script>
|
<script>
|
||||||
security.polymer_resin.install({
|
security.polymer_resin.install({
|
||||||
|
@@ -21,9 +21,7 @@
|
|||||||
// requestAnimationFrame.)
|
// requestAnimationFrame.)
|
||||||
// @see https://github.com/Polymer/polymer/issues/3851
|
// @see https://github.com/Polymer/polymer/issues/3851
|
||||||
// @see Issue 4699
|
// @see Issue 4699
|
||||||
if (!window.POLYMER2) {
|
|
||||||
Polymer.RenderStatus._makeReady();
|
Polymer.RenderStatus._makeReady();
|
||||||
}
|
|
||||||
|
|
||||||
Polymer({
|
Polymer({
|
||||||
is: 'gr-app',
|
is: 'gr-app',
|
||||||
|
@@ -79,7 +79,13 @@
|
|||||||
<link rel="preload" href="{$staticResourcePath}/fonts/Roboto-Medium.woff" as="font" type="font/woff" crossorigin="anonymous">{\n}
|
<link rel="preload" href="{$staticResourcePath}/fonts/Roboto-Medium.woff" as="font" type="font/woff" crossorigin="anonymous">{\n}
|
||||||
<link rel="stylesheet" href="{$staticResourcePath}/styles/fonts.css">{\n}
|
<link rel="stylesheet" href="{$staticResourcePath}/styles/fonts.css">{\n}
|
||||||
<link rel="stylesheet" href="{$staticResourcePath}/styles/main.css">{\n}
|
<link rel="stylesheet" href="{$staticResourcePath}/styles/main.css">{\n}
|
||||||
|
|
||||||
|
{if $polymer2}
|
||||||
|
<script src="{$staticResourcePath}/bower_components/webcomponentsjs-p2/webcomponents-lite.js"></script>{\n}
|
||||||
|
{else}
|
||||||
<script src="{$staticResourcePath}/bower_components/webcomponentsjs/webcomponents-lite.js"></script>{\n}
|
<script src="{$staticResourcePath}/bower_components/webcomponentsjs/webcomponents-lite.js"></script>{\n}
|
||||||
|
{/if}
|
||||||
|
|
||||||
// Content between webcomponents-lite and the load of the main app element
|
// Content between webcomponents-lite and the load of the main app element
|
||||||
// run before polymer-resin is installed so may have security consequences.
|
// run before polymer-resin is installed so may have security consequences.
|
||||||
// Contact your local security engineer if you have any questions, and
|
// Contact your local security engineer if you have any questions, and
|
||||||
@@ -90,9 +96,18 @@
|
|||||||
<link rel="import" href="{$assetsPath}/{$assetsBundle}">{\n}
|
<link rel="import" href="{$assetsPath}/{$assetsBundle}">{\n}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
{if $polymer2}
|
||||||
|
<link rel="preload" href="{$staticResourcePath}/elements/gr-app-p2.js" as="script" crossorigin="anonymous">{\n}
|
||||||
|
<link rel="import" href="{$staticResourcePath}/elements/gr-app-p2.html">{\n}
|
||||||
|
{else}
|
||||||
<link rel="preload" href="{$staticResourcePath}/elements/gr-app.js" as="script" crossorigin="anonymous">{\n}
|
<link rel="preload" href="{$staticResourcePath}/elements/gr-app.js" as="script" crossorigin="anonymous">{\n}
|
||||||
<link rel="import" href="{$staticResourcePath}/elements/gr-app.html">{\n}
|
<link rel="import" href="{$staticResourcePath}/elements/gr-app.html">{\n}
|
||||||
|
{/if}
|
||||||
|
|
||||||
<body unresolved>{\n}
|
<body unresolved>{\n}
|
||||||
|
{if $polymer2}
|
||||||
|
<gr-app-p2 id="app"></gr-app-p2>{\n}
|
||||||
|
{else}
|
||||||
<gr-app id="app"></gr-app>{\n}
|
<gr-app id="app"></gr-app>{\n}
|
||||||
|
{/if}
|
||||||
{/template}
|
{/template}
|
||||||
|
Reference in New Issue
Block a user