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,25 +15,22 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<script>
|
||||
if (!window.POLYMER2) {
|
||||
// This must be set prior to loading Polymer for the first time.
|
||||
if (localStorage.getItem('USE_SHADOW_DOM') === 'true') {
|
||||
window.Polymer = {
|
||||
dom: 'shadow',
|
||||
passiveTouchGestures: true,
|
||||
};
|
||||
} else if (!window.Polymer) {
|
||||
window.Polymer = {
|
||||
passiveTouchGestures: true,
|
||||
};
|
||||
}
|
||||
// This must be set prior to loading Polymer for the first time.
|
||||
if (localStorage.getItem('USE_SHADOW_DOM') === 'true') {
|
||||
window.Polymer = {
|
||||
dom: 'shadow',
|
||||
passiveTouchGestures: true,
|
||||
};
|
||||
} else if (!window.Polymer) {
|
||||
window.Polymer = {
|
||||
passiveTouchGestures: true,
|
||||
};
|
||||
}
|
||||
window.Gerrit = window.Gerrit || {};
|
||||
</script>
|
||||
|
||||
<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/lib/legacy/legacy-data-mixin.html">
|
||||
<link rel="import" href="../behaviors/safe-types-behavior/safe-types-behavior.html">
|
||||
<script>
|
||||
security.polymer_resin.install({
|
||||
|
@@ -21,9 +21,7 @@
|
||||
// requestAnimationFrame.)
|
||||
// @see https://github.com/Polymer/polymer/issues/3851
|
||||
// @see Issue 4699
|
||||
if (!window.POLYMER2) {
|
||||
Polymer.RenderStatus._makeReady();
|
||||
}
|
||||
Polymer.RenderStatus._makeReady();
|
||||
|
||||
Polymer({
|
||||
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="stylesheet" href="{$staticResourcePath}/styles/fonts.css">{\n}
|
||||
<link rel="stylesheet" href="{$staticResourcePath}/styles/main.css">{\n}
|
||||
<script src="{$staticResourcePath}/bower_components/webcomponentsjs/webcomponents-lite.js"></script>{\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}
|
||||
{/if}
|
||||
|
||||
// Content between webcomponents-lite and the load of the main app element
|
||||
// run before polymer-resin is installed so may have security consequences.
|
||||
// Contact your local security engineer if you have any questions, and
|
||||
@@ -90,9 +96,18 @@
|
||||
<link rel="import" href="{$assetsPath}/{$assetsBundle}">{\n}
|
||||
{/if}
|
||||
|
||||
<link rel="preload" href="{$staticResourcePath}/elements/gr-app.js" as="script" crossorigin="anonymous">{\n}
|
||||
<link rel="import" href="{$staticResourcePath}/elements/gr-app.html">{\n}
|
||||
{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="import" href="{$staticResourcePath}/elements/gr-app.html">{\n}
|
||||
{/if}
|
||||
|
||||
<body unresolved>{\n}
|
||||
<gr-app id="app"></gr-app>{\n}
|
||||
{if $polymer2}
|
||||
<gr-app-p2 id="app"></gr-app-p2>{\n}
|
||||
{else}
|
||||
<gr-app id="app"></gr-app>{\n}
|
||||
{/if}
|
||||
{/template}
|
||||
|
Reference in New Issue
Block a user