100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Fix asset invalid error persisting on asset switch (#2410)
Koen1274acd79eb5
diff --git a/ui/app/manager/test/assets.test.ts b/ui/app/manager/test/assets.test.tsindex 1005746a1..8eae897c9 100644--- a/ui/app/manager/test/assets.test.ts+++ b/ui/app/manager/test/assets.test.ts@@ -27,8 +27,8 @@ assets.forEach(({ type, name, attributes }) => {await assetsPage.addAsset(assetMap[name!], name!);await page.click(`#list-container >> text=${name}`);await assetViewer.switchMode("modify");- await assetViewer.setAttributeValue(attribute1, value1);- await assetViewer.setAttributeValue(attribute2, value2);+ await assetViewer.getAttributeValueLocator(attribute1).fill(value1);+ await assetViewer.getAttributeValueLocator(attribute2).fill(value2);const saveBtn = page.getByRole("button", { name: "Save" });await saveBtn.click();await expect(saveBtn).toBeDisabled();diff --git a/ui/component/or-asset-viewer/build.gradle b/ui/component/or-asset-viewer/build.gradleindex 715a0847b..558835f57 100644--- a/ui/component/or-asset-viewer/build.gradle+++ b/ui/component/or-asset-viewer/build.gradle@@ -24,3 +24,19 @@ tasks.register('prepareUi') {tasks.register('publishUi') {dependsOn clean, npmPublish}++tasks.register('npmBuild', Exec) {+ mustRunAfter npmClean+ dependsOn getYarnInstallTask()+ commandLine npmCommand("yarn"), "run", "build"+}++tasks.register('npmTest', Exec) {+ dependsOn getYarnInstallTask()+ commandLine npmCommand("yarn"), "run", "test"+}++tasks.register('npmTestUI', Exec) {+ dependsOn getYarnInstallTask()+ commandLine npmCommand("yarn"), "run", "test", "--ui"+}diff --git a/ui/component/or-asset-viewer/package.json b/ui/component/or-asset-viewer/package.jsonindex 702d55e70..3ca2ed70b 100644--- a/ui/component/or-asset-viewer/package.json+++ b/ui/component/or-asset-viewer/package.json@@ -15,7 +15,7 @@"types": "lib/index.d.ts","scripts": {"analyze": "npx cem analyze --config ../custom-elements-manifest.config.mjs",- "test": "echo \"No tests\" && exit 0",+ "test": "npx tsc -b && npx playwright test","prepack": "npx rspack"},"author": "OpenRemote",diff --git a/ui/component/or-asset-viewer/playwright.config.ts b/ui/component/or-asset-viewer/playwright.config.tsnew file mode 100644index 000000000..94d454129--- /dev/null+++ b/ui/component/or-asset-viewer/playwright.config.ts@@ -0,0 +1,3 @@+import { defineCtConfig } from "@openremote/test/component.config";++export default defineCtConfig(__dirname);diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.tsindex 78a108928..fe12a1916 100644--- a/ui/component/or-asset-viewer/src/index.ts+++ b/ui/component/or-asset-viewer/src/index.ts@@ -1200,6 +1200,7 @@ export class OrAssetViewer extends subscribe(manager)(translate(i18next)(LitElemif (changedProperties.has("assetId")) {this._assetInfo = undefined;this.asset = undefined;+ this._validationResults = [];// Set asset ID on mixin which will go and load the assetif (this.assetId) {diff --git a/ui/component/or-asset-viewer/test/asset-viewer.test.ts b/ui/component/or-asset-viewer/test/asset-viewer.test.tsnew file mode 100644index 000000000..90d6c76d3--- /dev/null+++ b/ui/component/or-asset-viewer/test/asset-viewer.test.ts@@ -0,0 +1,50 @@+import { ct } from "./fixtures";+import { expect } from "@openremote/test";+import { OrAssetViewer } from "@openremote/or-asset-viewer";+import { validAsset, invalidAsset } from "./fixtures/data/asset";++ct.beforeEach(async ({ shared }) => {+ await shared.locales();+ await shared.fonts();+ await shared.registerAssets([validAsset, invalidAsset]);+});++// Due to how the component tests resolve imports, imported data with an object reference gets+// confused for a component that is meant to be registered in the playwright component test app.+// Which causes the data to be transformed to an intermediate object referencing the data.+//+// So we can use a "cloned" variable outside the test (but in the same test file) to avoid this.+const validId = validAsset.id;+ct("Should not show asset invalid error", async ({ mount }) => {+ const component = await mount(OrAssetViewer, {+ props: { assetId: validId, editMode: true },+ });+ await expect(component).not.toContainText("Asset is not valid");+});++// Due to how the component tests resolve imports, imported data with an object reference gets+// confused for a component that is meant to be registered in the playwright component test app.+// Which causes the data to be transformed to an intermediate object referencing the data.+//+// So we can use a "cloned" variable outside the test (but in the same test file) to avoid this.+const invalidId = invalidAsset.id;+ct("Should show asset invalid error", async ({ mount, assetViewer }) => {+ const component = await mount(OrAssetViewer, {+ props: { assetId: invalidId, editMode: true },+ });+ await assetViewer.getAttributeValueLocator("invalid").fill("0.1");+ await assetViewer.getAttributeValueLocator("invalid").press("Enter");+ await expect(component).toContainText("Asset is not valid");+});++ct("Should not show asset invalid error after switching assets", async ({ mount, assetViewer }) => {+ const component = await mount(OrAssetViewer, {+ props: { assetId: invalidId, editMode: true },+ });+ await assetViewer.getAttributeValueLocator("invalid").fill("0.1");+ await assetViewer.getAttributeValueLocator("invalid").press("Enter");+ await expect(component).toContainText("Asset is not valid");++ await component.update({ props: { assetId: validId, editMode: true } });+ await expect(component).not.toContainText("Asset is not valid");+});diff --git a/ui/component/or-asset-viewer/test/fixtures/data/asset.ts b/ui/component/or-asset-viewer/test/fixtures/data/asset.tsnew file mode 100644index 000000000..f83ffc9cd--- /dev/null+++ b/ui/component/or-asset-viewer/test/fixtures/data/asset.ts@@ -0,0 +1,19 @@+import type { Asset } from "@openremote/model";++export const notes = { name: "notes", type: "text" };+export const location = { name: "location", type: "GEO_JSONPoint" };+export const commonAttrs = { notes, location };+export const validAsset: Asset = {+ id: "validAsset",+ name: "Thing",+ realm: "master",+ type: "ThingAsset",+ attributes: { ...commonAttrs },+};+export const invalidAsset: Asset = {+ id: "invalidAsset",+ name: "Thing",+ realm: "master",+ type: "ThingAsset",+ attributes: { ...commonAttrs, invalid: { name: "invalid", type: "integer" } },+};diff --git a/ui/component/or-asset-viewer/test/fixtures/index.ts b/ui/component/or-asset-viewer/test/fixtures/index.tsindex 9b20e4178..a83cfc6fb 100644--- a/ui/component/or-asset-viewer/test/fixtures/index.ts+++ b/ui/component/or-asset-viewer/test/fixtures/index.ts@@ -1,4 +1,11 @@-import { expect, type Locator, type Page } from "@openremote/test";+import {+ ct as base,+ expect,+ withPage,+ type SharedComponentTestFixtures,+ type Locator,+ type Page,+} from "@openremote/test";import type { WellknownMetaItems } from "@openremote/model";import * as Util from "@openremote/core/lib/util";@@ -32,12 +39,11 @@ export class AssetViewer {}/**- * Set a value for a given attribute.+ * Get a locator to the specified attribute value input.* @param attribute The attribute name- * @param value The value to set*/- async setAttributeValue(attribute: string, value: string) {- await this.getAttributeLocator(attribute).locator("input").fill(value);+ getAttributeValueLocator(attribute: string | Locator) {+ return (typeof attribute === "string" ? this.getAttributeLocator(attribute) : attribute).locator("input");}/**@@ -105,3 +111,11 @@ export class AssetViewer {return configItemLocator;}}++interface ComponentFixtures extends SharedComponentTestFixtures {+ assetViewer: AssetViewer;+}++export const ct = base.extend<ComponentFixtures>({+ assetViewer: withPage(AssetViewer),+});diff --git a/ui/component/or-icon/@types/mdi.d.ts b/ui/component/or-icon/@types/mdi.d.tsnew file mode 100644index 000000000..251e54d9b--- /dev/null+++ b/ui/component/or-icon/@types/mdi.d.ts@@ -0,0 +1,24 @@+/*+ * Copyright 2025, OpenRemote Inc.+ *+ * See the CONTRIBUTORS.txt file in the distribution for a+ * full listing of individual contributors.+ *+ * This program is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as+ * published by the Free Software Foundation, either version 3 of the+ * License, or (at your option) any later version.+ *+ * This program is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */++declare module "@mdi/font/css/materialdesignicons.min.css" {+ const css: string;+ export default css;+}diff --git a/ui/component/or-icon/src/index.ts b/ui/component/or-icon/src/index.tsindex f1a572786..9b1dac468 100644--- a/ui/component/or-icon/src/index.ts+++ b/ui/component/or-icon/src/index.ts@@ -3,10 +3,10 @@ import {unsafeSVG} from 'lit/directives/unsafe-svg.js';import {customElement, property, state} from "lit/decorators.js";import {AssetDescriptor, AssetModelUtil, WellknownAssets} from "@openremote/model";+import mdiFontStyle from "@mdi/font/css/materialdesignicons.min.css";import OrIconSet from "./or-icon-set";export {OrIconSet};-const mdiFontStyle = require("@mdi/font/css/materialdesignicons.min.css");export class IconSetAddedEvent extends CustomEvent<void> {diff --git a/ui/component/or-icon/tsconfig.json b/ui/component/or-icon/tsconfig.jsonindex 3436fc50f..3ad9678c7 100644--- a/ui/component/or-icon/tsconfig.json+++ b/ui/component/or-icon/tsconfig.json@@ -2,10 +2,12 @@"extends": "../../tsconfig","compilerOptions": {"outDir": "./lib",- "rootDir": "src"+ "rootDir": "src",+ "typeRoots": ["./@types"]},"include": [- "./src"+ "./src",+ "./@types"],"references": [{ "path": "../model" }diff --git a/ui/test/fixtures/component.ts b/ui/test/fixtures/component.tsindex caf8b1eb6..dec5f082b 100644--- a/ui/test/fixtures/component.ts+++ b/ui/test/fixtures/component.ts@@ -1,6 +1,18 @@+import path from "node:path";+import type { Locator } from "@playwright/experimental-ct-core";import { Shared } from "./shared";+import type { i18n, Resource } from "i18next";+import type { Asset } from "@openremote/model";++declare global {+ interface Window {+ _i18next: i18n;+ _assets: Asset[];+ }+}+type ComponentProps<Component extends HTMLElement> = Partial<Component>;type ComponentSlot = number | string | ComponentSlot[];type ComponentSlots = Record<string, ComponentSlot> & { default?: ComponentSlot };@@ -25,7 +37,7 @@ export interface MountResult<Component extends HTMLElement> extends Locator {export class CtShared extends Shared {/**- * Allows the test to wait for event to be fired+ * Allows the test to wait for an event to be fired* @returns A promise that waits for the handler to be called*/promiseEventDispatch<T extends CustomEvent>(): [@@ -36,4 +48,61 @@ export class CtShared extends Shared {const promise = new Promise<T>((resolve) => (resolver = resolve));return [promise, (detail: T["detail"]) => resolver(detail)];}++ /**+ * Init shared fonts to be served for material design icons.+ */+ async fonts() {+ await this.page.route("**/shared/fonts/**", async (route, request) => {+ await route.fulfill({ path: this.urlPathToFsPath(request.url()) });+ });+ }++ /**+ * Init shared translations to be served for i18next.+ * @param resources The custom translations to add+ */+ async locales(resources?: Resource) {+ await this.page.route("**/shared/locales/**", async (route, request) => {+ await route.fulfill({ path: this.urlPathToFsPath(request.url()) });+ });+ await this.page.evaluate(async (resources) => {+ await window._i18next.init({+ lng: "en",+ fallbackLng: "en",+ defaultNS: "test",+ fallbackNS: "or",+ ns: ["or"],+ backend: {+ loadPath: "/shared/locales/{{lng}}/{{ns}}.json",+ },+ });+ if (resources) {+ Object.entries(resources).forEach(([locale, r]) =>+ Object.entries(r).forEach(([ns, translations]) => {+ window._i18next.addResourceBundle(locale, ns, translations);+ })+ );+ }+ }, resources);+ }++ /**+ * Register assets to the window object to be resolved by components+ * subscribed to the `manager` instance from `@openremote/core`.+ * @param assets The assets to register for component tests.+ */+ async registerAssets(assets: Asset[]) {+ await this.page.evaluate(async (assets) => {+ window._assets = assets;+ }, assets);+ }++ /**+ * Resolves a request URL to a local filesystem path.+ * @param url The incoming request URL to resolve+ */+ private urlPathToFsPath(url: string) {+ return path.resolve(__dirname, decodeURI(`../../app${new URL(url).pathname}`));+ }}diff --git a/ui/test/fixtures/data.ts b/ui/test/fixtures/data.tsnew file mode 100644index 000000000..3df9853b3--- /dev/null+++ b/ui/test/fixtures/data.ts@@ -0,0 +1,272 @@+/**+ * Well known meta items as of OpenRemote 1.13.1+ */+export const metaItemDescriptors = {+ accessRestrictedRead: {+ name: "accessRestrictedRead",+ type: "boolean",+ },+ momentary: {+ name: "momentary",+ type: "boolean",+ },+ accessRestrictedWrite: {+ name: "accessRestrictedWrite",+ type: "boolean",+ },+ agentLink: {+ name: "agentLink",+ type: "agentLink",+ },+ agentLinkConfig: {+ name: "agentLinkConfig",+ type: "JSONObject",+ },+ format: {+ name: "format",+ type: "valueFormat",+ },+ readOnly: {+ name: "readOnly",+ type: "boolean",+ },+ forecast: {+ name: "forecast",+ type: "forecastConfiguration",+ },+ ruleResetImmediate: {+ name: "ruleResetImmediate",+ type: "boolean",+ },+ label: {+ name: "label",+ type: "text",+ },+ units: {+ name: "units",+ type: "text[]",+ },+ secret: {+ name: "secret",+ type: "boolean",+ },+ constraints: {+ name: "constraints",+ type: "valueConstraint[]",+ },+ hasPredictedDataPoints: {+ name: "hasPredictedDataPoints",+ type: "boolean",+ },+ dataPointsMaxAgeDays: {+ name: "dataPointsMaxAgeDays",+ type: "positiveInteger",+ },+ ruleState: {+ name: "ruleState",+ type: "boolean",+ },+ storeDataPoints: {+ name: "storeDataPoints",+ type: "boolean",+ },+ accessPublicWrite: {+ name: "accessPublicWrite",+ type: "boolean",+ },+ userConnected: {+ name: "userConnected",+ type: "text",+ },+ showOnDashboard: {+ name: "showOnDashboard",+ type: "boolean",+ },+ accessPublicRead: {+ name: "accessPublicRead",+ type: "boolean",+ },+ multiline: {+ name: "multiline",+ type: "boolean",+ },+ attributeLinks: {+ name: "attributeLinks",+ type: "attributeLink[]",+ },+};++export const valueDescriptors = {+ bigNumber: {+ name: "bigNumber",+ type: "java.math.BigDecimal",+ jsonType: "number",+ },+ agentLink: {+ name: "agentLink",+ type: "org.openremote.model.asset.agent.AgentLink",+ metaUseOnly: true,+ jsonType: "object",+ },+ negativeNumber: {+ name: "negativeNumber",+ type: "java.lang.Double",+ constraints: [+ {+ type: "max",+ max: 0,+ message: "{ValueConstraint.Max.message}",+ },+ ],+ jsonType: "number",+ },+ integer: {+ name: "integer",+ type: "java.lang.Integer",+ jsonType: "number",+ },+ positiveNumber: {+ name: "positiveNumber",+ type: "java.lang.Double",+ constraints: [+ {+ type: "min",+ min: 0,+ message: "{ValueConstraint.Min.message}",+ },+ ],+ jsonType: "number",+ },+ usernameAndPassword: {+ name: "usernameAndPassword",+ type: "org.openremote.model.auth.UsernamePassword",+ jsonType: "object",+ },+ number: {+ name: "number",+ type: "java.lang.Double",+ jsonType: "number",+ },+ negativeInteger: {+ name: "negativeInteger",+ type: "java.lang.Integer",+ constraints: [+ {+ type: "max",+ max: 0,+ message: "{ValueConstraint.Max.message}",+ },+ ],+ jsonType: "number",+ },+ text: {+ name: "text",+ type: "java.lang.String",+ jsonType: "string",+ },+ bigInteger: {+ name: "bigInteger",+ type: "java.math.BigInteger",+ jsonType: "bigint",+ },+ colourRGB: {+ name: "colourRGB",+ type: "org.openremote.model.value.impl.ColourRGB",+ jsonType: "object",+ },+ JSONObject: {+ name: "JSONObject",+ type: "org.openremote.model.value.ValueType$ObjectMap",+ jsonType: "object",+ },+ JSON: {+ name: "JSON",+ type: "java.lang.Object",+ jsonType: "unknown",+ },+ long: {+ name: "long",+ type: "java.lang.Long",+ jsonType: "number",+ },+ integerMap: {+ name: "integerMap",+ type: "org.openremote.model.value.ValueType$IntegerMap",+ jsonType: "object",+ },+ dateAndTime: {+ name: "dateAndTime",+ type: "java.util.Date",+ jsonType: "date",+ },+ booleanMap: {+ name: "booleanMap",+ type: "org.openremote.model.value.ValueType$BooleanMap",+ jsonType: "object",+ },+ GEO_JSONPoint: {+ name: "GEO_JSONPoint",+ type: "org.openremote.model.geo.GeoJSONPoint",+ jsonType: "object",+ },+ boolean: {+ name: "boolean",+ type: "java.lang.Boolean",+ jsonType: "boolean",+ },+ positiveInteger: {+ name: "positiveInteger",+ type: "java.lang.Integer",+ constraints: [+ {+ type: "min",+ min: 0,+ message: "{ValueConstraint.Min.message}",+ },+ ],+ jsonType: "number",+ },+};++export const thingAssetInfo = {+ assetDescriptor: {+ descriptorType: "asset",+ name: "ThingAsset",+ icon: "cube-outline",+ },+ attributeDescriptors: [+ {+ name: "notes",+ type: "text",+ format: {+ multiline: true,+ },+ },+ {+ name: "location",+ type: "GEO_JSONPoint",+ },+ {+ name: "model",+ type: "text",+ optional: true,+ },+ {+ name: "email",+ type: "email",+ optional: true,+ },+ {+ name: "tags",+ type: "text[]",+ optional: true,+ },+ {+ name: "manufacturer",+ type: "text",+ optional: true,+ },+ ],+ metaItemDescriptors: Object.keys(metaItemDescriptors),+ valueDescriptors: Object.keys(valueDescriptors),+};diff --git a/ui/test/fixtures/shared.ts b/ui/test/fixtures/shared.tsindex 32b011430..7f529b057 100644--- a/ui/test/fixtures/shared.ts+++ b/ui/test/fixtures/shared.ts@@ -1,13 +1,5 @@-import path from "node:path";+import { type Page } from "@playwright/test";-import type { i18n, Resource } from "i18next";-import type { Page } from "@playwright/test";--declare global {- interface Window {- _i18next: i18n;- }-}export interface BasePage {goto(): Promise<void>;@@ -59,50 +51,4 @@ export class Shared {{ times: 1 });}-- /**- * Init shared fonts to be served for material design icons.- */- async fonts() {- await this.page.route("**/shared/fonts/**", async (route, request) => {- await route.fulfill({ path: this.urlPathToFsPath(request.url()) });- });- }-- /**- * Init shared translations to be served for i18next.- * @param resources The custom translations to add- */- async locales(resources?: Resource) {- await this.page.route("**/shared/locales/**", async (route, request) => {- await route.fulfill({ path: this.urlPathToFsPath(request.url()) });- });- await this.page.evaluate(async (resources) => {- await window._i18next.init({- lng: "en",- fallbackLng: "en",- defaultNS: "test",- fallbackNS: "or",- ns: ["or"],- backend: {- loadPath: "/shared/locales/{{lng}}/{{ns}}.json",- },- });- if (resources) {- Object.entries(resources).forEach(([locale, r]) =>- Object.entries(r).forEach(([ns, translations]) => {- window._i18next.addResourceBundle(locale, ns, translations);- })- );- }- }, resources);- }-- /**- * Resolves a request URL to a local filesystem path.- * @param url The incoming request URL to resolve- */- private urlPathToFsPath(url: string) {- return path.resolve(__dirname, decodeURI(`../../app${new URL(url).pathname}`));- }}diff --git a/ui/test/package.json b/ui/test/package.jsonindex bde79a807..c217c8e03 100644--- a/ui/test/package.json+++ b/ui/test/package.json@@ -1,12 +1,13 @@{"name": "@openremote/test",- "version": "1.3.3",+ "version": "1.14.0-snapshot","description": "Test Util","author": "OpenRemote","module": "index.js","private": true,"exports": {".": "./index.ts",+ "./data": "./fixtures/data.ts","./app.config": "./app.config.ts","./component.config": "./component.config.ts"},diff --git a/ui/test/playwright/index.js b/ui/test/playwright/index.jsindex cbaa1505b..d9e5c2c18 100644--- a/ui/test/playwright/index.js+++ b/ui/test/playwright/index.js@@ -1,9 +1,65 @@+import manager from "@openremote/core";+import { thingAssetInfo, metaItemDescriptors, valueDescriptors } from "@openremote/test/data";+import i18next from "i18next";import HttpBackend from "i18next-http-backend";import { IconSets, OrIconSet, createMdiIconSet, createSvgIconSet } from "@openremote/or-icon";+import { AssetEventCause, AssetModelUtil, ClientRole } from "@openremote/model";IconSets.addIconSet("mdi", createMdiIconSet(""));IconSets.addIconSet("or", createSvgIconSet(OrIconSet.size, OrIconSet.icons));window._i18next = i18next.use(HttpBackend);++/**+ * Mimics subscribing to asset events without connecting to an actual WebSocket.+ * @param {string[] | AttributeRef[] | undefined} ids - The asset ids to consider+ * @param {boolean} requestCurrentValues - Not implemented+ * @param {(event: import("@openremote/model").AssetEvent) => void} callback - Calls the `_onEvent` of a subscribed component+ * @returns {string} The subscriptionId+ */+function subscribeAssetEvents(ids, requestCurrentValues, callback) {+ if (window._assets && window._assets.length) {+ const assetEvent = {+ eventType: "asset",+ asset: window._assets.find(({ id }) => id === ids[0]),+ cause: AssetEventCause.READ,+ };+ callback(assetEvent);+ } else {+ console.warn("No assets to subscribe to");+ }+ return "test"; // Currently not handling multiple subscriptions+}++// TODO: consider rewriting this to use a mock `WebSocketEventProvider` so we can test @openremote/core and other components+manager.init = async () => {+ manager._basicIdentity = {+ // token: string | undefined,+ // user: User | undefined,+ roles: [ClientRole.WRITE_ASSETS, ClientRole.WRITE_ATTRIBUTES],+ };+ manager._config = {+ clientId: "openremote",+ autoLogin: false,+ consoleAutoEnable: false,+ };+ manager._events = {+ subscribeAssetEvents,+ subscribeAttributeEvents: async () => "",+ subscribeStatusChange: () => null,+ unsubscribe: async () => "",+ unsubscribeStatusChange: () => null,+ };+ // Similar to `manager.doDescriptorsInit`, but without requesting the API+ AssetModelUtil._assetTypeInfos = [thingAssetInfo];+ AssetModelUtil._metaItemDescriptors = Object.values(metaItemDescriptors);+ AssetModelUtil._valueDescriptors = Object.values(valueDescriptors);++ return true;+};++manager.init({}).then((success) => {+ window._initialized = success;+});