diff --git a/frontend-js/.idea/workspace.xml b/frontend-js/.idea/workspace.xml index e327a54b8b22d4167be336019058d762aa4579f9..c9767306e07baa61fe56607f97d84ffec3e6d411 100644 --- a/frontend-js/.idea/workspace.xml +++ b/frontend-js/.idea/workspace.xml @@ -6,8 +6,7 @@ </component> <component name="ChangeListManager"> <list default="true" id="c119f0dd-fdda-4d02-a51e-86bc6ef7e50c" name="Default" comment=""> - <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/js/gui/leftPanel/PublicationListDialog.js" afterPath="$PROJECT_DIR$/src/main/js/gui/leftPanel/PublicationListDialog.js" /> - <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/js/map/CustomMap.js" afterPath="$PROJECT_DIR$/src/main/js/map/CustomMap.js" /> + <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/js/gui/LoginDialog.js" afterPath="$PROJECT_DIR$/src/main/js/gui/LoginDialog.js" /> </list> <ignored path="$PROJECT_DIR$/.tmp/" /> <ignored path="$PROJECT_DIR$/temp/" /> @@ -21,11 +20,41 @@ </component> <component name="FileEditorManager"> <leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> - <file leaf-file-name="PublicationListDialog.js" pinned="false" current-in-tab="true"> + <file leaf-file-name="PublicationListDialog.js" pinned="false" current-in-tab="false"> <entry file="file://$PROJECT_DIR$/src/main/js/gui/leftPanel/PublicationListDialog.js"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="48"> - <caret line="119" column="7" lean-forward="false" selection-start-line="119" selection-start-column="7" selection-end-line="119" selection-end-column="7" /> + <state relative-caret-position="65"> + <caret line="6" column="47" lean-forward="false" selection-start-line="6" selection-start-column="47" selection-end-line="6" selection-end-column="47" /> + <folding /> + </state> + </provider> + </entry> + </file> + <file leaf-file-name="AbstractGuiElement.js" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/src/main/js/gui/AbstractGuiElement.js"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="306"> + <caret line="18" column="6" lean-forward="false" selection-start-line="18" selection-start-column="6" selection-end-line="18" selection-end-column="6" /> + <folding /> + </state> + </provider> + </entry> + </file> + <file leaf-file-name="LoginDialog.js" pinned="false" current-in-tab="true"> + <entry file="file://$PROJECT_DIR$/src/main/js/gui/LoginDialog.js"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="438"> + <caret line="101" column="5" lean-forward="true" selection-start-line="101" selection-start-column="5" selection-end-line="101" selection-end-column="5" /> + <folding /> + </state> + </provider> + </entry> + </file> + <file leaf-file-name="ObjectWithListeners.js" pinned="false" current-in-tab="false"> + <entry file="file://$PROJECT_DIR$/src/main/js/ObjectWithListeners.js"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="170"> + <caret line="10" column="9" lean-forward="false" selection-start-line="10" selection-start-column="9" selection-end-line="10" selection-end-column="9" /> <folding /> </state> </provider> @@ -131,7 +160,6 @@ <option value="$PROJECT_DIR$/src/main/js/gui/AddOverlayDialog.js" /> <option value="$PROJECT_DIR$/src/test/js/GuiConnector-mock.js" /> <option value="$PROJECT_DIR$/src/main/js/gui/Header.js" /> - <option value="$PROJECT_DIR$/src/main/js/gui/LoginDialog.js" /> <option value="$PROJECT_DIR$/src/main/js/gui/leftPanel/ChemicalPanel.js" /> <option value="$PROJECT_DIR$/src/main/js/gui/leftPanel/DrugPanel.js" /> <option value="$PROJECT_DIR$/src/main/js/gui/leftPanel/MiRnaPanel.js" /> @@ -165,6 +193,7 @@ <option value="$PROJECT_DIR$/src/test/js/GuiConnector-test.js" /> <option value="$PROJECT_DIR$/src/main/js/map/CustomMap.js" /> <option value="$PROJECT_DIR$/src/main/js/gui/leftPanel/PublicationListDialog.js" /> + <option value="$PROJECT_DIR$/src/main/js/gui/LoginDialog.js" /> </list> </option> </component> @@ -222,54 +251,6 @@ <item name="coverage" type="462c0819:PsiDirectoryNode" /> <item name="lcov-report" type="462c0819:PsiDirectoryNode" /> </path> - <path> - <item name="frontend-js" type="b2602c69:ProjectViewProjectNode" /> - <item name="frontend-js" type="462c0819:PsiDirectoryNode" /> - <item name="src" type="462c0819:PsiDirectoryNode" /> - </path> - <path> - <item name="frontend-js" type="b2602c69:ProjectViewProjectNode" /> - <item name="frontend-js" type="462c0819:PsiDirectoryNode" /> - <item name="src" type="462c0819:PsiDirectoryNode" /> - <item name="main" type="462c0819:PsiDirectoryNode" /> - </path> - <path> - <item name="frontend-js" type="b2602c69:ProjectViewProjectNode" /> - <item name="frontend-js" type="462c0819:PsiDirectoryNode" /> - <item name="src" type="462c0819:PsiDirectoryNode" /> - <item name="main" type="462c0819:PsiDirectoryNode" /> - <item name="js" type="462c0819:PsiDirectoryNode" /> - </path> - <path> - <item name="frontend-js" type="b2602c69:ProjectViewProjectNode" /> - <item name="frontend-js" type="462c0819:PsiDirectoryNode" /> - <item name="src" type="462c0819:PsiDirectoryNode" /> - <item name="main" type="462c0819:PsiDirectoryNode" /> - <item name="js" type="462c0819:PsiDirectoryNode" /> - <item name="gui" type="462c0819:PsiDirectoryNode" /> - </path> - <path> - <item name="frontend-js" type="b2602c69:ProjectViewProjectNode" /> - <item name="frontend-js" type="462c0819:PsiDirectoryNode" /> - <item name="src" type="462c0819:PsiDirectoryNode" /> - <item name="main" type="462c0819:PsiDirectoryNode" /> - <item name="js" type="462c0819:PsiDirectoryNode" /> - <item name="gui" type="462c0819:PsiDirectoryNode" /> - <item name="leftPanel" type="462c0819:PsiDirectoryNode" /> - </path> - <path> - <item name="frontend-js" type="b2602c69:ProjectViewProjectNode" /> - <item name="frontend-js" type="462c0819:PsiDirectoryNode" /> - <item name="src" type="462c0819:PsiDirectoryNode" /> - <item name="test" type="462c0819:PsiDirectoryNode" /> - </path> - <path> - <item name="frontend-js" type="b2602c69:ProjectViewProjectNode" /> - <item name="frontend-js" type="462c0819:PsiDirectoryNode" /> - <item name="src" type="462c0819:PsiDirectoryNode" /> - <item name="test" type="462c0819:PsiDirectoryNode" /> - <item name="js" type="462c0819:PsiDirectoryNode" /> - </path> </expand> <select /> </subPane> @@ -280,7 +261,7 @@ </component> <component name="PropertiesComponent"> <property name="WebServerToolWindowFactoryState" value="false" /> - <property name="last_opened_file_path" value="$PROJECT_DIR$" /> + <property name="last_opened_file_path" value="$PROJECT_DIR$/isolate-000000000032F7A0-v8.log" /> <property name="nodejs_interpreter_path" value="C:/Program Files/nodejs/node" /> <property name="HbShouldOpenHtmlAsHb" value="" /> <property name="nodejs.mocha.mocha_node_package_dir" value="$PROJECT_DIR$/node_modules/mocha" /> @@ -424,7 +405,7 @@ <workItem from="1503501472332" duration="132000" /> <workItem from="1503501772627" duration="21000" /> <workItem from="1503502231792" duration="5017000" /> - <workItem from="1503560609163" duration="15230000" /> + <workItem from="1503560609163" duration="15860000" /> </task> <servers /> </component> @@ -461,22 +442,21 @@ </history-entry> </component> <component name="TimeTrackingManager"> - <option name="totallyTimeSpent" value="20400000" /> + <option name="totallyTimeSpent" value="21030000" /> </component> <component name="ToolWindowManager"> <frame x="-8" y="-8" width="1936" height="1176" extended-state="6" /> - <editor active="true" /> <layout> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.5679475" sideWeight="0.33802083" order="7" side_tool="true" content_ui="tabs" /> <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" /> - <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.33833176" sideWeight="0.49791667" order="10" side_tool="false" content_ui="tabs" x="-170" y="502" width="1920" height="493" /> + <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33833176" sideWeight="0.49791667" order="10" side_tool="false" content_ui="tabs" x="-170" y="502" width="1920" height="493" /> <window_info id="npm" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" /> <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" /> <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.18020834" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="Inspection Results" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3298969" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" /> <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> - <window_info id="V8 CPU Profiling" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.34489223" sideWeight="0.66197914" order="0" side_tool="false" content_ui="tabs" /> + <window_info id="V8 CPU Profiling" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.34489223" sideWeight="0.66197914" order="0" side_tool="false" content_ui="tabs" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="true" content_ui="tabs" /> <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> @@ -499,14 +479,6 @@ <watches-manager /> </component> <component name="editorHistoryManager"> - <entry file="file://$PROJECT_DIR$/src/main/js/gui/leftPanel/SubmapPanel.js"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="2397"> - <caret line="141" column="11" lean-forward="false" selection-start-line="141" selection-start-column="11" selection-end-line="141" selection-end-column="11" /> - <folding /> - </state> - </provider> - </entry> <entry file="file://$PROJECT_DIR$/src/main/js/gui/leftPanel/ProjectInfoPanel.js"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="6086"> @@ -539,14 +511,6 @@ </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/src/main/js/ObjectWithListeners.js"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="208"> - <caret line="93" column="3" lean-forward="false" selection-start-line="93" selection-start-column="3" selection-end-line="93" selection-end-column="3" /> - <folding /> - </state> - </provider> - </entry> <entry file="file://$PROJECT_DIR$/src/main/js/gui/Header.js"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="412"> @@ -559,14 +523,6 @@ </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/src/main/js/gui/LoginDialog.js"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="303"> - <caret line="118" column="40" lean-forward="false" selection-start-line="118" selection-start-column="33" selection-end-line="118" selection-end-column="40" /> - <folding /> - </state> - </provider> - </entry> <entry file="file://$PROJECT_DIR$/src/main/js/gui/leftPanel/AbstractDbPanel.js"> <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="0"> @@ -934,10 +890,34 @@ </state> </provider> </entry> + <entry file="file://$PROJECT_DIR$/src/main/js/ObjectWithListeners.js"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="170"> + <caret line="10" column="9" lean-forward="false" selection-start-line="10" selection-start-column="9" selection-end-line="10" selection-end-column="9" /> + <folding /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/src/main/js/gui/AbstractGuiElement.js"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="306"> + <caret line="18" column="6" lean-forward="false" selection-start-line="18" selection-start-column="6" selection-end-line="18" selection-end-column="6" /> + <folding /> + </state> + </provider> + </entry> <entry file="file://$PROJECT_DIR$/src/main/js/gui/leftPanel/PublicationListDialog.js"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="48"> - <caret line="119" column="7" lean-forward="false" selection-start-line="119" selection-start-column="7" selection-end-line="119" selection-end-column="7" /> + <state relative-caret-position="65"> + <caret line="6" column="47" lean-forward="false" selection-start-line="6" selection-start-column="47" selection-end-line="6" selection-end-column="47" /> + <folding /> + </state> + </provider> + </entry> + <entry file="file://$PROJECT_DIR$/src/main/js/gui/LoginDialog.js"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="438"> + <caret line="101" column="5" lean-forward="true" selection-start-line="101" selection-start-column="5" selection-end-line="101" selection-end-column="5" /> <folding /> </state> </provider> diff --git a/frontend-js/src/main/js/gui/LoginDialog.js b/frontend-js/src/main/js/gui/LoginDialog.js index f62450a22e35b3fe01a963bdfeb053eb7db56c6f..253170dfc2ce109dc4e34f3e91d43be0b588a17b 100644 --- a/frontend-js/src/main/js/gui/LoginDialog.js +++ b/frontend-js/src/main/js/gui/LoginDialog.js @@ -11,29 +11,25 @@ var Functions = require('../functions'); var logger = require('../logger'); function LoginDialog(params) { - AbstractGuiElement.call(this, params); - var self = this; - self._createLoginTab(); - $(self.getElement()).dialog({ - autoOpen: false, - resizable: false, + AbstractGuiElement.call(this, params); + var self = this; + self._createLoginTab(); + + var loginButton = self.getControlElement(PanelControlElementType.USER_TAB_LOGIN_BUTTON); + loginButton.onclick = function () { + var login = self.getControlElement(PanelControlElementType.USER_TAB_LOGIN_INPUT_TEXT).value; + var password = self.getControlElement(PanelControlElementType.USER_TAB_PASSOWRD_INPUT_TEXT).value; + + return ServerConnector.login(login, password).then(function () { + window.location.reload(false); + }).then(null, function (error) { + if (error instanceof InvalidCredentialsError) { + GuiConnector.alert("invalid credentials"); + } else { + GuiConnector.alert(error); + } }); - - var loginButton = self.getControlElement(PanelControlElementType.USER_TAB_LOGIN_BUTTON); - loginButton.onclick = function () { - var login = self.getControlElement(PanelControlElementType.USER_TAB_LOGIN_INPUT_TEXT).value; - var password = self.getControlElement(PanelControlElementType.USER_TAB_PASSOWRD_INPUT_TEXT).value; - - return ServerConnector.login(login, password).then(function () { - window.location.reload(false); - }).then(null, function (error) { - if (error instanceof InvalidCredentialsError) { - GuiConnector.alert("invalid credentials"); - } else { - GuiConnector.alert(error); - } - }); - }; + }; } @@ -41,82 +37,93 @@ LoginDialog.prototype = Object.create(AbstractGuiElement.prototype); LoginDialog.prototype.constructor = LoginDialog; LoginDialog.prototype.createTableRow = function (elements) { - var row = Functions.createElement({ - type: "div", - style: "display: table-row;" + var row = Functions.createElement({ + type: "div", + style: "display: table-row;" + }); + + for (var i = 0; i < elements.length; i++) { + var cell = Functions.createElement({ + type: "div", + style: "display: table-cell;" }); - - for (var i = 0; i < elements.length; i++) { - var cell = Functions.createElement({ - type: "div", - style: "display: table-cell;" - }); - cell.appendChild(elements[i]); - row.appendChild(cell); - } - return row; + cell.appendChild(elements[i]); + row.appendChild(cell); + } + return row; }; LoginDialog.prototype._createLoginTab = function () { - var self = this; - - var authorizationFormTab = Functions.createElement({ - type: "div", - style: "width:100%;display: table;border-spacing: 10px;" - }); - this.getElement().appendChild(authorizationFormTab); - - var loginLabel = Functions.createElement({ - type: "div", - content: "LOGIN:" - }); - var loginInput = Functions.createElement({ - type: "input", - inputType: "text", - style: "width:100%", - name: "loginText" - }); - this.setControlElement(PanelControlElementType.USER_TAB_LOGIN_INPUT_TEXT, loginInput); - - authorizationFormTab.appendChild(self.createTableRow([loginLabel, loginInput])); - - var passwordLabel = Functions.createElement({ - type: "div", - content: "PASSWORD:" - }); - var passwordInput = Functions.createElement({ - type: "input", - inputType: "password", - style: "width:100%", - name: "passwordText" - }); - this.setControlElement(PanelControlElementType.USER_TAB_PASSOWRD_INPUT_TEXT, passwordInput); - - authorizationFormTab.appendChild(self.createTableRow([passwordLabel, passwordInput])); - - var centerTag = Functions.createElement({ - type: "center" - }); - this.getElement().appendChild(centerTag); - - var loginButton = Functions.createElement({ - type: "button", - name: "loginButton", - content: "LOGIN" - }); - centerTag.appendChild(loginButton); - this.setControlElement(PanelControlElementType.USER_TAB_LOGIN_BUTTON, loginButton); + var self = this; + + var authorizationFormTab = Functions.createElement({ + type: "div", + style: "width:100%;display: table;border-spacing: 10px;" + }); + this.getElement().appendChild(authorizationFormTab); + + var loginLabel = Functions.createElement({ + type: "div", + content: "LOGIN:" + }); + var loginInput = Functions.createElement({ + type: "input", + inputType: "text", + style: "width:100%", + name: "loginText" + }); + this.setControlElement(PanelControlElementType.USER_TAB_LOGIN_INPUT_TEXT, loginInput); + + authorizationFormTab.appendChild(self.createTableRow([loginLabel, loginInput])); + + var passwordLabel = Functions.createElement({ + type: "div", + content: "PASSWORD:" + }); + var passwordInput = Functions.createElement({ + type: "input", + inputType: "password", + style: "width:100%", + name: "passwordText" + }); + this.setControlElement(PanelControlElementType.USER_TAB_PASSOWRD_INPUT_TEXT, passwordInput); + + authorizationFormTab.appendChild(self.createTableRow([passwordLabel, passwordInput])); + + var centerTag = Functions.createElement({ + type: "center" + }); + this.getElement().appendChild(centerTag); + + var loginButton = Functions.createElement({ + type: "button", + name: "loginButton", + content: "LOGIN" + }); + centerTag.appendChild(loginButton); + this.setControlElement(PanelControlElementType.USER_TAB_LOGIN_BUTTON, loginButton); }; LoginDialog.prototype.open = function () { - var self = this; - $(self.getElement()).dialog('option', 'title', 'AUTHORIZATION FORM'); - $(self.getElement()).dialog("open"); + var self = this; + var div = self.getElement(); + if (!$(div).hasClass("ui-dialog-content")) { + $(div).dialog({ + autoOpen: false, + resizable: false, + }); + } + + $(div).dialog('option', 'title', 'AUTHORIZATION FORM'); + $(div).dialog("open"); }; LoginDialog.prototype.destroy = function () { - $(this.getElement()).dialog("destroy"); + var self = this; + if ($(self.getElement()).hasClass("ui-dialog-content")) { + $(self.getElement()).dialog("destroy"); + } }; module.exports = LoginDialog;