diff options
Diffstat (limited to 'polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.ts')
-rw-r--r-- | polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.ts | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.ts b/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.ts index 7fee4a0550..9b62743dab 100644 --- a/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.ts +++ b/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.ts @@ -1,18 +1,7 @@ /** * @license - * 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. + * Copyright 2017 Google LLC + * SPDX-License-Identifier: Apache-2.0 */ import {LitElement, PropertyValues} from 'lit'; import {customElement, property} from 'lit/decorators'; @@ -25,16 +14,10 @@ export class GrPluginHost extends LitElement { config?: ServerInfo; _configChanged(config: ServerInfo) { - const plugins = config.plugin; - const jsPlugins = (plugins && plugins.js_resource_paths) || []; - const shouldLoadTheme = !!config.default_theme; - // config.default_theme is defined when shouldLoadTheme is true - const themeToLoad: string[] = shouldLoadTheme - ? [config.default_theme!] - : []; - // Theme should be loaded first for better UX. - const pluginsPending = themeToLoad.concat(jsPlugins); - getPluginLoader().loadPlugins(pluginsPending); + const jsPlugins = config.plugin?.js_resource_paths ?? []; + const themes: string[] = config.default_theme ? [config.default_theme] : []; + const instanceId = config.gerrit?.instance_id; + getPluginLoader().loadPlugins([...themes, ...jsPlugins], instanceId); } override updated(changedProperties: PropertyValues<GrPluginHost>) { |