From 49fbc67d294b11dbdcf6892fc324217f7b59e941 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 8 Jul 2021 17:25:48 +0200 Subject: [PATCH] Governance Tab Implemented --- .../UI/Spaces/Docs-Space/DocsSpace.js | 9 +--- .../UI/Spaces/Chat-Space/ChatSpace.js | 29 +++++------ .../UI/Spaces/Side-Space/SidePanelTab.js | 2 +- .../UI/Spaces/Side-Space/SideSpace.js | 52 ++++++++++++++++--- .../Spaces/Workspace-Space/WorkspaceSpace.js | 9 +--- Projects/Governance/UI/Globals/Reports.js | 6 +++ .../Assets.js => Reports-Space/Reports.js} | 32 +++++++----- Projects/ProjectsSchema.json | 16 ++++-- 8 files changed, 101 insertions(+), 54 deletions(-) create mode 100644 Projects/Governance/UI/Globals/Reports.js rename Projects/Governance/UI/Spaces/{Assets-Space/Assets.js => Reports-Space/Reports.js} (75%) diff --git a/Projects/Education/UI/Spaces/Docs-Space/DocsSpace.js b/Projects/Education/UI/Spaces/Docs-Space/DocsSpace.js index b4053b0e3..bc35e0c59 100644 --- a/Projects/Education/UI/Spaces/Docs-Space/DocsSpace.js +++ b/Projects/Education/UI/Spaces/Docs-Space/DocsSpace.js @@ -171,11 +171,8 @@ function newEducationDocSpace() { } function setupSidePanelTab() { - thisObject.sidePanelTab = newSidePanelTab() - thisObject.sidePanelTab.container.connectToParent(thisObject.container, false, false) - thisObject.sidePanelTab.tabIcon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName('Education', 'docs-tab') - thisObject.sidePanelTab.tabLabel = 'Docs' - thisObject.sidePanelTab.initialize('right') + thisObject.sidePanelTab = UI.projects.foundations.spaces.sideSpace.createSidePanelTab(thisObject.container, 'Education', 'docs-tab', 'Docs', 'right') + openingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('opening', onOpening) closingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('closing', onClosing) @@ -437,7 +434,6 @@ function newEducationDocSpace() { } function physics() { - thisObject.sidePanelTab.physics() docsAppDivPhysics() function docsAppDivPhysics() { @@ -461,7 +457,6 @@ function newEducationDocSpace() { if (CAN_SPACES_DRAW === false) { return } if (isInitialized === false) { return } borders() - thisObject.sidePanelTab.draw() } function borders() { diff --git a/Projects/Foundations/UI/Spaces/Chat-Space/ChatSpace.js b/Projects/Foundations/UI/Spaces/Chat-Space/ChatSpace.js index d4450a10d..5df19ec8f 100644 --- a/Projects/Foundations/UI/Spaces/Chat-Space/ChatSpace.js +++ b/Projects/Foundations/UI/Spaces/Chat-Space/ChatSpace.js @@ -31,10 +31,9 @@ function newFoundationsChatSpace() { return thisObject function initialize() { - - thisObject.sidePanelTab = newSidePanelTab() - thisObject.sidePanelTab.container.connectToParent(thisObject.container, false, false) - thisObject.sidePanelTab.initialize('right', 1) + return + thisObject.sidePanelTab = UI.projects.foundations.spaces.sideSpace.createSidePanelTab(thisObject.container, 'Education', 'docs-tab', 'Docs', 'right') + openingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('opening', onOpening) closingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('closing', onClosing) @@ -89,15 +88,14 @@ function newFoundationsChatSpace() { return thisObject.container } else { UI.projects.foundations.spaces.chartingSpace.viewport.onMouseWheel(event) - return + return } } else { - return + return } } function physics() { - thisObject.sidePanelTab.physics() chatAppDivPhysics() iFramePhysics() @@ -108,18 +106,18 @@ function newFoundationsChatSpace() { y: 0 } chatAppDivPosition = thisObject.container.frame.frameThisPoint(chatAppDivPosition) - chatAppDiv.style = ' ' + - 'position:fixed; top:' + chatAppDivPosition.y + 'px; ' + - 'left:' + chatAppDivPosition.x + 'px; z-index:1; ' + - 'width: ' + thisObject.container.frame.width + 'px;' + - 'height: ' + thisObject.container.frame.height + 'px' + chatAppDiv.style = ' ' + + 'position:fixed; top:' + chatAppDivPosition.y + 'px; ' + + 'left:' + chatAppDivPosition.x + 'px; z-index:1; ' + + 'width: ' + thisObject.container.frame.width + 'px;' + + 'height: ' + thisObject.container.frame.height + 'px' } function iFramePhysics() { let docIFrame = document.getElementById('chatIFrame') - docIFrame.style = ' ' + - 'width: ' + thisObject.container.frame.width + 'px;' + - 'height: ' + thisObject.container.frame.height + 'px' + docIFrame.style = ' ' + + 'width: ' + thisObject.container.frame.width + 'px;' + + 'height: ' + thisObject.container.frame.height + 'px' } } @@ -127,7 +125,6 @@ function newFoundationsChatSpace() { if (CAN_SPACES_DRAW === false) { return } if (isInitialized === false) { return } borders() - thisObject.sidePanelTab.draw() } function borders() { diff --git a/Projects/Foundations/UI/Spaces/Side-Space/SidePanelTab.js b/Projects/Foundations/UI/Spaces/Side-Space/SidePanelTab.js index 2c54d5fe4..bee2650a1 100644 --- a/Projects/Foundations/UI/Spaces/Side-Space/SidePanelTab.js +++ b/Projects/Foundations/UI/Spaces/Side-Space/SidePanelTab.js @@ -126,7 +126,7 @@ function newSidePanelTab() { } function positionPhysics() { - thisObject.container.frame.position.y = browserCanvas.height / 2 - TAB_HEIGHT / 2 + thisObject.container.frame.position.y = browserCanvas.height / 2 - TAB_HEIGHT / 2 + thisObject.index * (TAB_HEIGHT - 1) } function draw() { diff --git a/Projects/Foundations/UI/Spaces/Side-Space/SideSpace.js b/Projects/Foundations/UI/Spaces/Side-Space/SideSpace.js index 94f12f696..7912addc1 100644 --- a/Projects/Foundations/UI/Spaces/Side-Space/SideSpace.js +++ b/Projects/Foundations/UI/Spaces/Side-Space/SideSpace.js @@ -2,9 +2,11 @@ function newFoundationsSideSpace() { let thisObject = { sidePanelTab: undefined, container: undefined, + leftTabs: undefined, + rightTabs: undefined, physics: physics, draw: draw, - getSidePanelTab, getSidePanelTab, + createSidePanelTab, createSidePanelTab, getContainer: getContainer, initialize: initialize, finalize: finalize @@ -13,15 +15,39 @@ function newFoundationsSideSpace() { return thisObject function initialize() { - + leftTabs = [] + rightTabs = [] } function finalize() { - + leftTabs = undefined + rightTabs = undefined } - function getSidePanelTab() { + function createSidePanelTab(container, porject, iconName, label, side) { + let sidePanel + + sidePanel = newSidePanelTab() + sidePanel.container.connectToParent(container, false, false) + sidePanel.tabIcon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName(porject, iconName) + sidePanel.tabLabel = label + sidePanel.initialize(side) + + switch (side) { + case 'left': { + leftTabs.push(sidePanel) + sidePanel.index = leftTabs.length + break + } + case 'right': { + rightTabs.push(sidePanel) + sidePanel.index = rightTabs.length + break + } + } + + return sidePanel } function getContainer(point, purpose) { @@ -29,10 +55,24 @@ function newFoundationsSideSpace() { } function physics() { - + for (let i = 0; i < leftTabs.length; i++) { + let sideTab = leftTabs[i] + sideTab.physics() + } + for (let i = 0; i < rightTabs.length; i++) { + let sideTab = rightTabs[i] + sideTab.physics() + } } function draw() { - + for (let i = 0; i < leftTabs.length; i++) { + let sideTab = leftTabs[i] + sideTab.draw() + } + for (let i = 0; i < rightTabs.length; i++) { + let sideTab = rightTabs[i] + sideTab.draw() + } } } diff --git a/Projects/Foundations/UI/Spaces/Workspace-Space/WorkspaceSpace.js b/Projects/Foundations/UI/Spaces/Workspace-Space/WorkspaceSpace.js index 7eff61a9a..e90711410 100644 --- a/Projects/Foundations/UI/Spaces/Workspace-Space/WorkspaceSpace.js +++ b/Projects/Foundations/UI/Spaces/Workspace-Space/WorkspaceSpace.js @@ -30,11 +30,8 @@ function newFoundationsWorkspaceSpace() { return thisObject function initialize() { - thisObject.sidePanelTab = newSidePanelTab() - thisObject.sidePanelTab.tabIcon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName('Foundations', 'workspace') - thisObject.sidePanelTab.tabLabel = 'Workspaces' - thisObject.sidePanelTab.container.connectToParent(thisObject.container, false, false) - thisObject.sidePanelTab.initialize('left') + + thisObject.sidePanelTab = UI.projects.foundations.spaces.sideSpace.createSidePanelTab(thisObject.container, 'Foundations', 'workspace', 'Workspaces', 'left') browserResizedEventSubscriptionId = canvas.eventHandler.listenToEvent('Browser Resized', resize) @@ -89,7 +86,6 @@ function newFoundationsWorkspaceSpace() { } function physics() { - thisObject.sidePanelTab.physics() listView.physics() } @@ -97,7 +93,6 @@ function newFoundationsWorkspaceSpace() { if (CAN_SPACES_DRAW === false) { return } if (isInitialized === false) { return } borders() - thisObject.sidePanelTab.draw() listView.draw() } diff --git a/Projects/Governance/UI/Globals/Reports.js b/Projects/Governance/UI/Globals/Reports.js new file mode 100644 index 000000000..1315a1ec9 --- /dev/null +++ b/Projects/Governance/UI/Globals/Reports.js @@ -0,0 +1,6 @@ +function newGovernanceGlobalsReports() { + let thisObject = { + REPORTS_SPACE_WIDTH: 900 + } + return thisObject +} \ No newline at end of file diff --git a/Projects/Governance/UI/Spaces/Assets-Space/Assets.js b/Projects/Governance/UI/Spaces/Reports-Space/Reports.js similarity index 75% rename from Projects/Governance/UI/Spaces/Assets-Space/Assets.js rename to Projects/Governance/UI/Spaces/Reports-Space/Reports.js index 68a1d86f5..7484a22ba 100644 --- a/Projects/Governance/UI/Spaces/Assets-Space/Assets.js +++ b/Projects/Governance/UI/Spaces/Reports-Space/Reports.js @@ -1,5 +1,5 @@ -function newGobernanceAssetsSpace() { - const MODULE_NAME = 'Assets Space' +function newGobernanceReportsSpace() { + const MODULE_NAME = 'Reports Space' let thisObject = { container: undefined, @@ -12,8 +12,18 @@ function newGobernanceAssetsSpace() { } thisObject.container = newContainer() - thisObject.container.initialize(MODULE_NAME) + thisObject.container.name = MODULE_NAME + thisObject.container.initialize() + thisObject.container.isClickeable = true thisObject.container.isDraggeable = false + thisObject.container.detectMouseOver = true + thisObject.container.status = 'hidden' + + resize() + + let browserResizedEventSubscriptionId + let openingEventSubscriptionId + let closingEventSubscriptionId return thisObject @@ -27,15 +37,13 @@ function newGobernanceAssetsSpace() { } function initialize() { - + setupSidePanelTab() function setupSidePanelTab() { - thisObject.sidePanelTab = newSidePanelTab() - thisObject.sidePanelTab.container.connectToParent(thisObject.container, false, false) - thisObject.sidePanelTab.tabIcon = UI.projects.foundations.spaces.designSpace.getIconByProjectAndName('Governance', 'governance-tab') - thisObject.sidePanelTab.tabLabel = 'Governance' - thisObject.sidePanelTab.initialize('right') + + thisObject.sidePanelTab = UI.projects.foundations.spaces.sideSpace.createSidePanelTab(thisObject.container, 'Governance', 'governance-tab', 'Governance', 'right') + openingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('opening', onOpening) closingEventSubscriptionId = thisObject.sidePanelTab.container.eventHandler.listenToEvent('closing', onClosing) @@ -44,7 +52,7 @@ function newGobernanceAssetsSpace() { } function resize() { - thisObject.container.frame.width = UI.projects.education.globals.docs.DOCS_SPACE_WIDTH + thisObject.container.frame.width = UI.projects.governance.globals.reports.REPORTS_SPACE_WIDTH thisObject.container.frame.height = browserCanvas.height // - TOP_SPACE_HEIGHT thisObject.container.frame.position.x = browserCanvas.width thisObject.container.frame.position.y = 0 // TOP_SPACE_HEIGHT @@ -56,7 +64,7 @@ function newGobernanceAssetsSpace() { function physics() { if (UI.projects.foundations.spaces.designSpace.workspace === undefined) { return } - thisObject.sidePanelTab.physics() + } function getContainer(point, purpose) { @@ -82,6 +90,6 @@ function newGobernanceAssetsSpace() { } function draw() { - thisObject.sidePanelTab.draw() + } } diff --git a/Projects/ProjectsSchema.json b/Projects/ProjectsSchema.json index 69e09a1d7..38bf41a33 100644 --- a/Projects/ProjectsSchema.json +++ b/Projects/ProjectsSchema.json @@ -969,7 +969,13 @@ "name": "Governance", "propertyName": "governance", "UI": { - "globals": [], + "globals": [ + { + "name": "Reports", + "propertyName": "reports", + "functionName": "newGovernanceGlobalsReports" + } + ], "functionLibraries": [ { "name": "Assets", @@ -1079,10 +1085,10 @@ "onMouseDownIndex": 0 }, { - "name": "Assets Space", - "folderName": "Assets-Space", - "propertyName": "assetsSpace", - "functionName": "newGobernanceAssetsSpace", + "name": "Reports Space", + "folderName": "Reports-Space", + "propertyName": "reportsSpace", + "functionName": "newGobernanceReportsSpace", "initializationIndex": 1, "animationPhysicsIndex": 1, "animationDrawIndex": 1,