diff --git a/ACT/LibMC.xml b/ACT/LibMC.xml index 97f2939c..4096d0a7 100644 --- a/ACT/LibMC.xml +++ b/ACT/LibMC.xml @@ -703,6 +703,8 @@ + + diff --git a/ACT/LibMCData.xml b/ACT/LibMCData.xml index 2e4dbd0b..2e1ae470 100644 --- a/ACT/LibMCData.xml +++ b/ACT/LibMCData.xml @@ -438,7 +438,13 @@ - + + + + + + + @@ -1761,151 +1767,210 @@ - + - - + + - - - + + + - - + + + + - - - + + + + + + + + + - - + + - - + + - - - - - - + + + + + + - - - - - - + + + + + + + + - - - - + + + - - + + - - + + - - + + - - - + + + - - + + - - + + - - - - - + + + + + + + + + + + - - - - + + + + + + - - + + - - + + - - - + + + - - - + + + + + + + + + - - - + + - - - - + + + - - - - + + + + - - - + + + + - - - - + - - - - + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2003,6 +2068,10 @@ + + + + diff --git a/ACT/LibMCEnv.xml b/ACT/LibMCEnv.xml index fca39b4a..143e3f96 100644 --- a/ACT/LibMCEnv.xml +++ b/ACT/LibMCEnv.xml @@ -289,7 +289,7 @@ - + @@ -3339,6 +3339,12 @@ + + + + + + @@ -3347,6 +3353,12 @@ + + + + + + @@ -3355,6 +3367,12 @@ + + + + + + @@ -4755,105 +4773,235 @@ - + - - + + - - + + - - + + - - - - - - - - - - - + + + - - - + + + - - + - + - - + + - - + + + + + + - - + + - - - - - - - - - + + + + + - - - - - + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + - - - + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -5744,6 +5892,9 @@ + + + diff --git a/Artifacts/clientdist/_githash_client.txt b/Artifacts/clientdist/_githash_client.txt index 9e7b90b0..e7921c4c 100644 --- a/Artifacts/clientdist/_githash_client.txt +++ b/Artifacts/clientdist/_githash_client.txt @@ -1 +1 @@ -de4928052636939a11b8e223e2f440da41fb23e6 +7c8043df52519207935670d4934d1f88e3b36961 diff --git a/Artifacts/clientdist/clientpackage.zip b/Artifacts/clientdist/clientpackage.zip index 0f54e186..fcbf342e 100644 Binary files a/Artifacts/clientdist/clientpackage.zip and b/Artifacts/clientdist/clientpackage.zip differ diff --git a/Artifacts/clientdist/clientsourcepackage.zip b/Artifacts/clientdist/clientsourcepackage.zip index 1f43656d..c400fceb 100644 Binary files a/Artifacts/clientdist/clientsourcepackage.zip and b/Artifacts/clientdist/clientsourcepackage.zip differ diff --git a/Client/src/App.vue b/Client/src/App.vue index 387c82a5..f1944ffd 100644 --- a/Client/src/App.vue +++ b/Client/src/App.vue @@ -352,6 +352,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. uiOnTimer() { if (this.Application) { + this.Application.updateModules (); this.Application.updateContentItems (); } }, diff --git a/Client/src/common/AMCApplication.js b/Client/src/common/AMCApplication.js index f547526a..5a03c470 100644 --- a/Client/src/common/AMCApplication.js +++ b/Client/src/common/AMCApplication.js @@ -477,9 +477,75 @@ export default class AMCApplication extends Common.AMCObject { } + } + + updateModule(module) { + + // Early return if module is invalid + if (!module) + return; + + // Reset refresh flag before attempting update + module.refresh = false; + + if (module.isActive()) { + + // Prepare authorization headers (same policy as for content items) + let headers = {}; + let authToken = this.API.authToken; + + if (authToken != Common.nullToken()) + headers.Authorization = "Bearer " + authToken; + + // Optional state segment + let stateidstring = ""; + if (module.stateid > 0) + stateidstring = "/" + module.stateid; + + // Build request URL for modules + let url = this.API.baseURL + "/ui/module/" + Assert.UUIDValue(module.uuid) + stateidstring; + + Axios({ + method: "GET", + "headers": headers, + url: url + }) + .then(resultJSON => { + + // Update module from server payload (if present) + if (resultJSON.data) { + if (resultJSON.data.content) { + if (module && typeof module.updateFromJSON === "function") { + module.updateFromJSON(resultJSON.data.content); + } + } + } + + // Reset failure counter on success + this.unsuccessfulUpdateCounter = 0; + }) + .catch(err => { + + // Increment failure counter and react accordingly + this.unsuccessfulUpdateCounter = this.unsuccessfulUpdateCounter + 1; + if (this.unsuccessfulUpdateCounter > 5) { + this.setStatusToError(err.message); + } + }); + } } - - + + updateModules() { + + let uuid, module; + if (this.AppContent.ModuleMap) { + for ([uuid, module] of this.AppContent.ModuleMap) { + uuid; + this.updateModule(module); + } + } + } + onJobUploadChunkSuccess (application, uploadObject, chunkData, uploadOffset) { Assert.ObjectInstance (application, "amcApplication"); @@ -745,6 +811,11 @@ export default class AMCApplication extends Common.AMCObject { let pageString = String(page); this.AppState.activePage = pageString; + let pageObject = this.AppContent.PageMap.get(pageString); + if(pageObject) { + pageObject.setActive(); + } + if (this.AppState.appResizeEvent) this.AppState.appResizeEvent (); diff --git a/Client/src/common/AMCPage.js b/Client/src/common/AMCPage.js index b046a0fd..897b8812 100644 --- a/Client/src/common/AMCPage.js +++ b/Client/src/common/AMCPage.js @@ -45,6 +45,8 @@ export default class AMCApplicationPage extends Common.AMCObject { this.application = application; this.name = pageJSON.name; + this.uuid = pageJSON.uuid; + this.showevent = pageJSON.showevent || ""; this.modules = []; for (let moduleDefinitionJSON of pageJSON.modules) { @@ -87,4 +89,12 @@ export default class AMCApplicationPage extends Common.AMCObject { return false; } + + setActive () + { + if (this.showevent && typeof this.application.triggerUIEvent === "function") { + this.application.triggerUIEvent(this.showevent, this.uuid, {}, () => {}); + } + } + } diff --git a/Client/src/modules/AMCModule_Content.js b/Client/src/modules/AMCModule_Content.js index fc3cb0fb..ab7fb66d 100644 --- a/Client/src/modules/AMCModule_Content.js +++ b/Client/src/modules/AMCModule_Content.js @@ -43,6 +43,7 @@ import AMCApplicationItem_Content_Image from "./AMCModule_ContentItem_Image.js" import AMCApplicationItem_Content_Paragraph from "./AMCModule_ContentItem_Paragraph.js" import AMCApplicationItem_Content_ParameterList from "./AMCModule_ContentItem_ParameterList.js" import AMCApplicationItem_Content_Upload from "./AMCModule_ContentItem_Upload.js" +import AMCApplicationItem_Content_ConfigurationList from "./AMCModule_ContentItem_ConfigurationList.js" @@ -59,7 +60,9 @@ export default class AMCApplicationModule_Content extends Common.AMCApplicationM this.headline = Assert.StringValue (moduleJSON.headline); this.title = Assert.StringValue (moduleJSON.title); this.subtitle = Assert.StringValue (moduleJSON.subtitle); - + + this.visible = Assert.BoolValue (moduleJSON.visible); + this.items = []; @@ -96,6 +99,9 @@ export default class AMCApplicationModule_Content extends Common.AMCApplicationM if (itemJSON.type === "form") item = new AMCApplicationItem_Content_Form (this, itemJSON); + + if (itemJSON.type === "configurationlist") + item = new AMCApplicationItem_Content_ConfigurationList (this, itemJSON); if (item) { this.items.push (item); @@ -107,7 +113,14 @@ export default class AMCApplicationModule_Content extends Common.AMCApplicationM } } - + + updateFromJSON(updateJSON) { + + Assert.ObjectValue(updateJSON); + + if(updateJSON.visible !== undefined) + this.visible = Assert.BoolValue(updateJSON.visible); + } } diff --git a/Client/src/modules/AMCModule_Content.vue b/Client/src/modules/AMCModule_Content.vue index c48a6179..3fe1c27e 100644 --- a/Client/src/modules/AMCModule_Content.vue +++ b/Client/src/modules/AMCModule_Content.vue @@ -54,7 +54,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + + + @@ -74,6 +76,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import ContentItem_ParameterList from '../modules/AMCModule_ContentItem_ParameterList.vue'; import ContentItem_ButtonGroup from '../modules/AMCModule_ContentItem_ButtonGroup.vue'; import ContentItem_Form from '../modules/AMCModule_ContentItem_Form.vue'; + import ContentItem_ConfigurationList from '../modules/AMCModule_ContentItem_ConfigurationList.vue'; export default { @@ -89,7 +92,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ContentItem_AlertList, ContentItem_ParameterList, ContentItem_ButtonGroup, - ContentItem_Form + ContentItem_Form, + ContentItem_ConfigurationList } }; diff --git a/Client/src/modules/AMCModule_ContentItem_ConfigurationList.js b/Client/src/modules/AMCModule_ContentItem_ConfigurationList.js new file mode 100644 index 00000000..7185250e --- /dev/null +++ b/Client/src/modules/AMCModule_ContentItem_ConfigurationList.js @@ -0,0 +1,140 @@ +/*++ + +Copyright (C) 2021 Autodesk Inc. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of the Autodesk Inc. nor the +names of its contributors may be used to endorse or promote products +derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL AUTODESK INC. BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + */ + + +import * as Assert from "../common/AMCAsserts.js"; +import * as Common from "../common/AMCCommon.js" + + +export default class AMCApplicationItem_Content_ConfigurationList extends Common.AMCApplicationItem { + + constructor (moduleInstance, itemJSON) + { + Assert.ObjectValue (itemJSON); + super (moduleInstance, itemJSON.uuid, itemJSON.type); + this.registerClass ("amcItem_ConfigurationList"); + + this.entries = []; + + this.headers = []; + for (let header of itemJSON.headers) { + let checkedHeader = { + "text": header.text, + "value": header.value, + "sortable": header.sortable, + "width": header.width, + "align": header.align + } + + this.headers.push(checkedHeader); + } + + this.entrybuttons = []; + if (itemJSON.entrybuttons) { + for (let entrybutton of itemJSON.entrybuttons) { + + let checkedEntryButton = { + "uuid": entrybutton.uuid, + "caption": entrybutton.caption, + "color": entrybutton.color, + "cursor": entrybutton.cursor, + "selectevent": entrybutton.selectevent + } + + this.entrybuttons.push(checkedEntryButton); + } + } + + + this.loadingtext = ""; + this.selectevent = ""; + this.selectionvalueuuid = Common.nullUUID (); + this.buttonvalueuuid = Common.nullUUID (); + this.thumbnailaspectratio = 1.8; + this.thumbnailheight = "150pt"; + this.thumbnailwidth = ""; + this.entriesperpage = 5; + + /* this.entrybuttons = [ + { + uuid: "123", + caption: "Details", + color: "primary", + cursor: "cursor-pointer", + selectionvalueuuid: Common.nullUUID (), + selectevent: "12324353", + + }, + { + uuid: "234", + caption: "History", + color: "primary", + cursor: "cursor-pointer", + selectionvalueuuid: Common.nullUUID (), + selectevent: "12324353", + } + ]; */ + + this.updateFromJSON (itemJSON); + + this.setRefreshFlag (); + + } + + + updateFromJSON (updateJSON) + { + Assert.ObjectValue (updateJSON); + Assert.ArrayValue (updateJSON.entries); + + if (updateJSON.loadingtext) + this.loadingtext = Assert.StringValue (updateJSON.loadingtext); + if (updateJSON.selectevent) + this.selectevent = Assert.IdentifierString (updateJSON.selectevent); + if (updateJSON.selectionvalueuuid) + this.selectionvalueuuid = Assert.IdentifierString (updateJSON.selectionvalueuuid); + if (updateJSON.buttonvalueuuid) + this.buttonvalueuuid = Assert.IdentifierString (updateJSON.buttonvalueuuid); + if (updateJSON.entriesperpage) + this.entriesperpage = Assert.IntegerValue (updateJSON.entriesperpage); + + let oldEntryCount = this.entries.length; + for (let index = 0; index < oldEntryCount; index++) { + this.entries.pop(); + } + + for (let entry of updateJSON.entries) { + this.entries.push(entry); + } + + } + + +} diff --git a/Client/src/modules/AMCModule_ContentItem_ConfigurationList.vue b/Client/src/modules/AMCModule_ContentItem_ConfigurationList.vue new file mode 100644 index 00000000..2e221994 --- /dev/null +++ b/Client/src/modules/AMCModule_ContentItem_ConfigurationList.vue @@ -0,0 +1,143 @@ + + + + + \ No newline at end of file diff --git a/Client/src/modules/AMCModule_ContentItem_Form.js b/Client/src/modules/AMCModule_ContentItem_Form.js index 453211e0..6a03f622 100644 --- a/Client/src/modules/AMCModule_ContentItem_Form.js +++ b/Client/src/modules/AMCModule_ContentItem_Form.js @@ -41,6 +41,8 @@ export default class AMCApplicationItem_Content_Form extends Common.AMCApplicati super (moduleInstance, itemJSON.uuid, itemJSON.type); this.registerClass ("amcItem_Form"); + this.visible = true; + Assert.ArrayValue (itemJSON.entities); // TODO: parse input this.entities = itemJSON.entities; @@ -74,6 +76,8 @@ export default class AMCApplicationItem_Content_Form extends Common.AMCApplicati { Assert.ObjectValue (updateJSON); + this.setVisible(updateJSON.visible); + if (updateJSON.entities) { Assert.ArrayValue (updateJSON.entities); @@ -104,6 +108,8 @@ export default class AMCApplicationItem_Content_Form extends Common.AMCApplicati } - - + + setVisible(flag) { + this.visible = !!flag; + } } \ No newline at end of file diff --git a/Client/src/modules/AMCModule_ContentItem_Form.vue b/Client/src/modules/AMCModule_ContentItem_Form.vue index 4325fcd8..e45b8118 100644 --- a/Client/src/modules/AMCModule_ContentItem_Form.vue +++ b/Client/src/modules/AMCModule_ContentItem_Form.vue @@ -30,7 +30,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.