diff --git a/demo/restore-demo.sh b/demo/restore-demo.sh index cacc5d809..927981831 100755 --- a/demo/restore-demo.sh +++ b/demo/restore-demo.sh @@ -7,7 +7,7 @@ destinationDataDir="/data/hosted/" echo "Removing $destinationDataDir" -rm -R ${destinationDataDir} +rm -R ${destinationDataDir}* echo "Resetting to initial status from $originDataDir.." cp -R ${originDataDir} ${destinationDataDir} diff --git a/deploy/digitalocean/README.md b/deploy/digitalocean/README.md index 9708d8bff..31c7088bb 100644 --- a/deploy/digitalocean/README.md +++ b/deploy/digitalocean/README.md @@ -9,15 +9,28 @@ This script is maintained for the community by Proxeus Association ## Instructions -1. Create fresh DO droplet with Ubuntu v.20+ with any basic Provision configuration -2. You will need to have your API keys for Infura and Sparkpost handy - see the root README for further details. -3. add executive permission for deploy.sh ( chmod +x deploy.sh ) -4. run $PWD/proxeus-core/deploy/digitalocean/deploy.sh -5. It takes a few minutes for the server to boot and install, then you should be able to open `http://:1323/init` -6. A configuration screen will be shown where you can set up an admin account and check settings. - -Once your server is running, visit the [User Handbook](https://github.com/ProxeusApp/community/blob/master/handbook/handbook.md) to get started. +1. Create fresh DO droplet with Ubuntu v.20+ with any basic Provision configuration. [Here](https://docs.digitalocean.com/products/droplets/getting-started/recommended-droplet-setup) you can find some help how to set up a production-ready droplet. +2. Make sure your API keys for Infura and Sparkpost. +3. Get the deployment script and make it executable: +```bash +wget https://raw.githubusercontent.com/ProxeusApp/proxeus-core/main/deploy/digitalocean/deploy.sh && chmod +x deploy.sh +``` +4. Enter all the necessary variables, where **FQDN** - domain name for the future server, **INFURA** - your Infura API key, **SPARKPOST** - your SparkPost API key, **ADMINEMAIL** - admin email (in format like admin@proxeus.org). It can be done by editing the script file directly or by shell "export" command: +```bash +export FQDN=[value] +export INFURA=[value] +export SPARKPOST=[value] +export ADMINEMAIL=[value] +``` +5. Run deployment process (go through it carefully, it may ask you any additional confirmation): +```bash +./deploy.sh +``` +7. It takes a few minutes for the server to boot and install, then you should be able to open `http://:1323/init` +8. A configuration screen will be shown where you can set up an admin account and check settings. + +Once your server is running, visit the [User Handbook](https://doc.proxeus.org/#/handbook) to get started. To view the logs connect to your droplet using an SSH client program. Then paste this into the console to see the logs being updated in real time: -`cd /srv/proxeus && docker-compose logs -f` +`cd /srv/proxeus && docker-compose logs -f` \ No newline at end of file diff --git a/deploy/digitalocean/deploy.sh b/deploy/digitalocean/deploy.sh index b9c458831..b1161b03f 100644 --- a/deploy/digitalocean/deploy.sh +++ b/deploy/digitalocean/deploy.sh @@ -1,12 +1,18 @@ #!/bin/bash -#specify values for local variables +# Specify values for local variables #FQDN= #INFURA= #SPARKPOST= #ADMINEMAIL= +## Performing the installation +exec 1> >(tee -a "/var/log/stackscript.log") 2>&1 +function log { + echo "### $1 -- `date '+%D %T'`" +} + log "Configuring System Updates" apt-get -o Acquire::ForceIPv4=true update -y DEBIAN_FRONTEND=noninteractive apt-get -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" install grub-pc @@ -109,11 +115,11 @@ cd /srv/proxeus # make init server-docker log "Starting cloud deployment via docker-compose" -docker-compose --env-file .env -f docker-compose.yml -f docker-compose-cloud.override.yml up -d & +docker-compose --env-file .env -f docker-compose.yml -f docker-compose-cloud.override.yml up -d >/dev/null 2>&1 # Open http://$FQDN:1323/init to configure your server log "After a minute, open: http://$FQDN:1323/init" ## ---------------------------------------------- -echo "Installation complete!" +echo "Installation complete!" \ No newline at end of file diff --git a/service/document.go b/service/document.go index 7a486aac3..af0bde3d9 100644 --- a/service/document.go +++ b/service/document.go @@ -87,7 +87,7 @@ func (me *DefaultDocumentService) Edit(auth model.Auth, userId string, formInput if !ok { return ErrUnableToEdit } - if len(fName) >= 80 || !filenameRegex.MatchString(fName) { + if len(fName) > 80 || !filenameRegex.MatchString(fName) { return ErrUnableToEdit } usrDataItem, err := userDataDB().Get(auth, userId) diff --git a/test/e2e/cypress/integration/0_powerup.js b/test/e2e/cypress/integration/0_powerup.js index ab5d3059c..fa9f384a4 100644 --- a/test/e2e/cypress/integration/0_powerup.js +++ b/test/e2e/cypress/integration/0_powerup.js @@ -17,6 +17,10 @@ describe(`Power up on ${url}`, () => { it('should bring to home page after saving with default values', () => { cy.get('button.btn-primary').eq(2).click() + + cy.location('pathname', { + timeout: 60000 + }).should('eq', '/'); }) -}) +}) \ No newline at end of file diff --git a/ui/core/src/DocumentApp.vue b/ui/core/src/DocumentApp.vue index 9eb4c6dde..9e220f31c 100644 --- a/ui/core/src/DocumentApp.vue +++ b/ui/core/src/DocumentApp.vue @@ -107,13 +107,19 @@ export default { color: $primary; } + body { + overflow: hidden; + } + .navbar h1 { margin-bottom: 0; } .app-main { - @media (max-width: 767px) { - max-width: 100% !important; + max-width: calc(100% - 265px); + + @media (max-width: 979px) { + max-width: calc(100% - 80px); } } diff --git a/ui/core/src/baseApp.js b/ui/core/src/baseApp.js index 024cbaf2b..240b8b2a8 100644 --- a/ui/core/src/baseApp.js +++ b/ui/core/src/baseApp.js @@ -1,7 +1,7 @@ import WalletInterface from './libs/WalletAdapter' export default { - data () { + data() { return { me: null, meta: null, @@ -16,7 +16,7 @@ export default { } }, methods: { - makeURL (uri) { + makeURL(uri) { let origin = location.origin if (/.*\/$/.test(origin)) { origin = origin.substring(0, origin.length - 1) @@ -26,7 +26,7 @@ export default { } return origin + uri }, - isLangAvailable (lang) { + isLangAvailable(lang) { if (this.meta && this.meta.activeLangs) { for (let i = 0; i < this.meta.activeLangs.length; i++) { if (this.meta.activeLangs[i] && @@ -37,37 +37,37 @@ export default { } return false }, - userIsRoot () { + userIsRoot() { if (this.me) { return this.me.role === 100 } return false }, - userIsSuperAdmin () { + userIsSuperAdmin() { if (this.me) { return this.me.role > 10 } return false }, - userIsAdminOrHigher () { + userIsAdminOrHigher() { if (this.me) { return this.me.role >= 10 } return false }, - userIsCreatorOrHigher () { + userIsCreatorOrHigher() { if (this.me) { return this.me.role >= 7 } return false }, - userIsUserOrHigher () { + userIsUserOrHigher() { if (this.me) { return this.me.role >= 5 } return false }, - amIWriteGrantedFor (item) { + amIWriteGrantedFor(item) { try { // check authority if (this.me.role >= 100) { @@ -110,7 +110,7 @@ export default { } catch (e) {} return false }, - handleError (o) { + handleError(o) { if (this.isConToServerLostError(o)) { // couldn't reach the server if (!this.intervalID) { @@ -119,7 +119,7 @@ export default { } } }, - isConToServerLostError (o) { + isConToServerLostError(o) { let txt = '' try { txt = o.data || o.request.response || o.request.responseText @@ -127,7 +127,7 @@ export default { return (o.request && !o.response) || (window.webpackHotUpdate && /^.*\(ECONNREFUSED\)\.$/m.test(txt)) }, - pingService () { + pingService() { console.log('pingService') axios.get('/api/config').then((r) => { if (r.data) { @@ -142,10 +142,10 @@ export default { this.handleError(err) }) }, - getSelectedLang () { + getSelectedLang() { return this.$cookie.get('lang') || this.fallbackLang() }, - setSelectedLang (lang) { + setSelectedLang(lang) { if (lang) { this.$cookie.set('lang', lang, { expires: '1Y' @@ -156,16 +156,16 @@ export default { this.$i18n.set(this.fallbackLang()) } }, - checkUserHasSession () { + checkUserHasSession() { return !!localStorage.getItem('userhassession') }, - initUserHasSession () { + initUserHasSession() { localStorage.setItem('userhassession', true) }, - deleteUserHasSession () { + deleteUserHasSession() { localStorage.removeItem('userhassession') }, - loadMe (clb) { + loadMe(clb) { if (!this.checkUserHasSession()) { return } @@ -185,7 +185,7 @@ export default { this.handleError(err) }) }, - loadLastExportResults (clb, delParams) { + loadLastExportResults(clb, delParams) { let url = '/api/export/results' if (delParams) { url += '?' + delParams @@ -204,7 +204,7 @@ export default { this.handleError(err) }) }, - loadLastImportResults (clb, delParams) { + loadLastImportResults(clb, delParams) { let url = '/api/import/results' if (delParams) { url += '?' + delParams @@ -223,7 +223,7 @@ export default { this.handleError(err) }) }, - exportData (params, cb, url, name) { + exportData(params, cb, url, name) { if (!url) { url = '/api/export?include=' + params } else { @@ -278,7 +278,7 @@ export default { }) }) }, - importData (file, skipExisting, cb) { + importData(file, skipExisting, cb) { if (!file) { return } @@ -316,10 +316,10 @@ export default { this.handleError(err) }) }, - async validateSessionCookie () { + async validateSessionCookie() { return axios.get('/api/session/validate') }, - loadMeta (clb) { + loadMeta(clb) { axios.get('/api/i18n/meta').then((response) => { this.meta = response.data if (this.meta && this.meta.langFallback) { @@ -338,7 +338,7 @@ export default { this.handleError(err) }) }, - updateLangLabel () { + updateLangLabel() { if (this.meta && this.meta.activeLangs) { for (let i = 0; i < this.meta.activeLangs.length; i++) { this.meta.activeLangs[i].label = this.$t( @@ -347,13 +347,13 @@ export default { return this.meta.activeLangs } }, - fallbackLang () { + fallbackLang() { if (this.meta) { return this.meta.langFallback } return null }, - getSelectedLangIndex () { + getSelectedLangIndex() { if (this.meta && this.meta.activeLangs) { for (let i = 0; i < this.meta.activeLangs.length; i++) { if (this.meta.activeLangs[i].Code === this.getSelectedLang()) { @@ -363,7 +363,7 @@ export default { } return null }, - reloadI18n () { + reloadI18n() { axios.get('/api/i18n/all').then( (response) => { this.$i18n.add(this.getSelectedLang(), response.data) @@ -374,7 +374,7 @@ export default { this.handleError(err) }) }, - loadConfig () { + loadConfig() { axios.get('/api/config').then(r => { if (r.data) { this.setConfig(r.data) @@ -383,7 +383,7 @@ export default { this.handleError(err) }) }, - async setConfig (d) { + async setConfig(d) { if (d.blockchainNet) { this.blockchainNet = d.blockchainNet } @@ -399,7 +399,7 @@ export default { await this.wallet.validateUserNetwork(() => this.$root.$emit('service-off'), () => this.$root.$emit('service-on')) } }, - acknowledgeFirstLogin () { + acknowledgeFirstLogin() { // Show the following overlays starting now (they can be delayed) localStorage.setItem('showFirstLoginMessageOn-documents', new Date()) if (this.userIsCreatorOrHigher()) { @@ -409,13 +409,13 @@ export default { }, computed: { app: { - get () { + get() { return this.$root.$children[0] }, - set (a) {} + set(a) {} } }, - created () { + created() { const tmpLangToPreventFromWarnings = 'en' this.$i18n.fallback(tmpLangToPreventFromWarnings) this.$i18n.set(tmpLangToPreventFromWarnings) diff --git a/ui/core/src/components/NameAndDetailInput.vue b/ui/core/src/components/NameAndDetailInput.vue index 3047cffde..279b633fa 100644 --- a/ui/core/src/components/NameAndDetailInput.vue +++ b/ui/core/src/components/NameAndDetailInput.vue @@ -2,10 +2,10 @@
- +
- +
@@ -32,6 +32,12 @@ export default { displayPrice: { type: Boolean, default: false + }, + maxNameLength: { + type: Number + }, + maxDetailLength: { + type: Number } } } diff --git a/ui/core/src/components/document/VerificationFileEntry.vue b/ui/core/src/components/document/VerificationFileEntry.vue index 2b5d8c181..cff6ad654 100644 --- a/ui/core/src/components/document/VerificationFileEntry.vue +++ b/ui/core/src/components/document/VerificationFileEntry.vue @@ -295,7 +295,13 @@ export default { this.isFileInvalidated = false - const result = await this.wallet().verifyHash(this.hash) + let result + + try { + result = await this.wallet().verifyHash(this.hash) + } catch (e) { + throw new Error('UNABLE_TO_VERIFY_HASH') + } const transaction = await this.wallet().web3.eth.getTransaction(result) this.creator = transaction.from @@ -330,6 +336,8 @@ export default { if (this.wallet().isPublicRPCUsing) { this.errorPublicRPC = true + } else if (e?.message === 'UNABLE_TO_VERIFY_HASH') { + this.validationException = false } else { this.errorValidating = true } diff --git a/ui/core/src/libs/legacy/formbuilder.js b/ui/core/src/libs/legacy/formbuilder.js index 147ce8341..994e918a7 100644 --- a/ui/core/src/libs/legacy/formbuilder.js +++ b/ui/core/src/libs/legacy/formbuilder.js @@ -29,20 +29,17 @@ var FT_FormBuilder = function (jqEl, options) { }) options = $.extend({ file: { - requestTypes: function (callback) { - } + requestTypes: function (callback) {} }, component: { - requestComp: function (id, callback) { - }, - searchComp: function (text, callback) { - }, - storeComp: function (comp, callback) { - }, - deleteComp: function (id, callback) { - } + requestComp: function (id, callback) {}, + searchComp: function (text, callback) {}, + storeComp: function (comp, callback) {}, + deleteComp: function (id, callback) {} + }, + componentsTab: { + components: {} }, - componentsTab: { components: {} }, vars: [] }, options) this.fbid = this.randomId() @@ -137,16 +134,21 @@ var FT_FormBuilder = function (jqEl, options) { if (e.keyCode == fb.ctrlKey || e.keyCode == fb.cmdKey){} });**/ } - this.adjustHeight = function (t, scrollOffset) { - } + this.adjustHeight = function (t, scrollOffset) {} this.calcContainerHeight = function (t, force) { if (t.el.is(':visible')) { if (force || !t.containerHeightWithoutInnerBody) { if (!t.innerBody || !t.innerBody.length) { t.innerBody = t.el.find('.fb-inner-body') - t.innerBody.css({ 'height': '0', 'min-height': '0' }) + t.innerBody.css({ + 'height': '0', + 'min-height': '0' + }) t.containerHeightWithoutInnerBody = t.el.children('.panel').outerHeight(true) - t.innerBody.css({ 'height': '', 'min-height': '' }) + t.innerBody.css({ + 'height': '', + 'min-height': '' + }) } this.adjustHeight(t, 0) } @@ -310,17 +312,35 @@ var FT_Workspace = function (fb, jqEl, comps) { workspaceTab.selectComponent(null, $trigger) if ($trigger.hasClass('fbc-grp-parent')) { items = { - 'paste': { name: 'Paste', icon: 'paste' }, - 'delete': { name: 'Delete', icon: 'delete' } + 'paste': { + name: 'Paste', + icon: 'paste' + }, + 'delete': { + name: 'Delete', + icon: 'delete' + } } } else { items = { - 'copy': { name: 'Copy', icon: 'copy' }, - 'paste': { name: 'Paste', icon: 'paste' }, - 'delete': { name: 'Delete', icon: 'delete' } + 'copy': { + name: 'Copy', + icon: 'copy' + }, + 'paste': { + name: 'Paste', + icon: 'paste' + }, + 'delete': { + name: 'Delete', + icon: 'delete' + } } if (workspaceTab.fb.options.userAllowedToEditComponents) { - items.copyToComp = { name: 'Copy to Components', icon: 'copy' } + items.copyToComp = { + name: 'Copy to Components', + icon: 'copy' + } } } if (!localStorage.getItem('ws-clipboard')) { @@ -403,7 +423,8 @@ var FT_Workspace = function (fb, jqEl, comps) { } } this.updateMetaData = function (compSettings, metaData, updateOrderOfAll) { - var c = this.fb.compiler; var compMain + var c = this.fb.compiler; + var compMain if (compSettings && metaData) { compMain = c.getCompMainObject(compSettings) if (metaData.compId) { @@ -414,11 +435,14 @@ var FT_Workspace = function (fb, jqEl, comps) { } } if (updateOrderOfAll) { - var ws = this; var $fbComp + var ws = this; + var $fbComp c.compsLoop(this.components, function (compId, comp) { compMain = c.getCompMainObject(comp) $fbComp = ws.getActiveBody().find('#' + compId) - ws.updateMetaData(ws.components[compId], { order: $fbComp.index() }, null) + ws.updateMetaData(ws.components[compId], { + order: $fbComp.index() + }, null) return true }) } @@ -436,33 +460,31 @@ var FT_Workspace = function (fb, jqEl, comps) { } if (jsonSettings && this.fb.compiler.sizeOf(jsonSettings) > 0) { // workspace.reInitDragAndDropEvent() - this.recompileWorkspace(htmlStr, jsonSettings - , function (compId) { - return workspace.fb.componentsTab.getComponentById(compId) - }, function (compiled) { - // workspace.compiledWorkspaceData = compiled; - workspace.fb.htmlRenderer(compiled, jsonSettings, function (renderedWorkspaceData) { - var $renderedWorkspace = $(renderedWorkspaceData) - workspace.beforeInserting($renderedWorkspace) - workspace.body.html($renderedWorkspace) - workspace.form = workspace.body.children('form:first') - workspace.form.addClass('fbc-dz fws-main') - workspace.fb.settingsTab.clearBody() - workspace.checkFormChilds() - workspace.form.find('.fb-component').each(function () { - this.addEventListener('click', function (e) { - return workspace.selectComponent(e, $(this)) - }, false) - }) - - setTimeout(function () { - workspace.setStuffWeDontNeedToStore(workspace.form) - }, 600) - workspace.reInitDragAndDropEvent() - workspace.afterInserting(workspace.body) + this.recompileWorkspace(htmlStr, jsonSettings, function (compId) { + return workspace.fb.componentsTab.getComponentById(compId) + }, function (compiled) { + // workspace.compiledWorkspaceData = compiled; + workspace.fb.htmlRenderer(compiled, jsonSettings, function (renderedWorkspaceData) { + var $renderedWorkspace = $(renderedWorkspaceData) + workspace.beforeInserting($renderedWorkspace) + workspace.body.html($renderedWorkspace) + workspace.form = workspace.body.children('form:first') + workspace.form.addClass('fbc-dz fws-main') + workspace.fb.settingsTab.clearBody() + workspace.checkFormChilds() + workspace.form.find('.fb-component').each(function () { + this.addEventListener('click', function (e) { + return workspace.selectComponent(e, $(this)) + }, false) }) - } - ) + + setTimeout(function () { + workspace.setStuffWeDontNeedToStore(workspace.form) + }, 600) + workspace.reInitDragAndDropEvent() + workspace.afterInserting(workspace.body) + }) + }) } else { this.renderNew() } @@ -635,7 +657,8 @@ var FT_Workspace = function (fb, jqEl, comps) { } var $eles, i $eles = $fbComp.find('.fb-drop-here') - var $fbDropHere; var hasDrops = false + var $fbDropHere; + var hasDrops = false for (i = 0; i < $eles.length; ++i) { $fbDropHere = $($eles[i]) var $compChildsHolder = $fbDropHere.parent() @@ -885,7 +908,10 @@ var FT_Workspace = function (fb, jqEl, comps) { handlePercentX: 0, handlePercentY: 0 }, - mousePos: { x: 0, y: 0 }, + mousePos: { + x: 0, + y: 0 + }, _setDim: function ($t, startPos) { this.dim.mt = parseFloat($t.css('marginTop')) this.dim.ml = parseFloat($t.css('marginLeft')) @@ -902,8 +928,15 @@ var FT_Workspace = function (fb, jqEl, comps) { this.dim.handleX = this.dim.handlePercentX * this.dim.w / 100 this.dim.handleY = this.dim.handlePercentY * this.dim.h / 100 }, - tl: { x: 0, y: 0 }, - dragCompPosition: { scrollOffsetY: 0, top: 0, left: 0 }, + tl: { + x: 0, + y: 0 + }, + dragCompPosition: { + scrollOffsetY: 0, + top: 0, + left: 0 + }, _updateOrgPos: function (target) { if (!target) { target = this.$dragComp @@ -1182,7 +1215,9 @@ var FT_Workspace = function (fb, jqEl, comps) { this.updateDfsId = function (oldId, newId) { var visibleFbComp = this.body.find(".fb-component[data-dfsId='" + oldId + "']") visibleFbComp.attr('data-dfsId', newId) - this.updateMetaData(this.components[visibleFbComp.attr('id')], { compId: newId }) + this.updateMetaData(this.components[visibleFbComp.attr('id')], { + compId: newId + }) } this.componentChanged = function (dfsId, component) { var _ = this @@ -1196,7 +1231,9 @@ var FT_Workspace = function (fb, jqEl, comps) { } this.updateComponentWithSettingsMerge = function (workspaceCompEl, dfsId, component) { var compId = workspaceCompEl.attr('id') - this.fb.settingsTab.currentCompId({ release: true })// to ensure the settings on the ui are created fresh + this.fb.settingsTab.currentCompId({ + release: true + }) // to ensure the settings on the ui are created fresh var newSettings = this.fb.deepCopySettings(component.settings, this.components[compId]) this.body.find('.fb-component.selected').removeClass('selected') this.updateComponent(compId, newSettings) @@ -1268,7 +1305,8 @@ var FT_Workspace = function (fb, jqEl, comps) { } } this.addComponent = function (jqEl, isNew, index) { - var compId = jqEl.attr('id'); var dfsId = jqEl.attr('data-dfsId') + var compId = jqEl.attr('id'); + var dfsId = jqEl.attr('data-dfsId') var p = jqEl.nextParentWithClass('fbc-grp') if (p && p.length) { jqEl.data('lastFbcGrpIndex', p.attr('data-index')) @@ -1277,7 +1315,10 @@ var FT_Workspace = function (fb, jqEl, comps) { index = jqEl.index() } if (!isNew && compId && compId.length > 5) { - this.updateMetaData(this.components[compId], { compId: dfsId, order: index }, true) + this.updateMetaData(this.components[compId], { + compId: dfsId, + order: index + }, true) return } if (!compId || compId.length < 5) { @@ -1300,7 +1341,10 @@ var FT_Workspace = function (fb, jqEl, comps) { }, false) }) - this.updateMetaData(this.components[compId], { compId: dfsId, order: index }, true) + this.updateMetaData(this.components[compId], { + compId: dfsId, + order: index + }, true) this.beforeInserting(jqEl, this.form) this.afterInserting(jqEl, this.form) } @@ -1438,7 +1482,10 @@ var FT_Workspace = function (fb, jqEl, comps) { var dfsId = compMain['_compId'] var template = this.fb.componentsTab.getTemplateById(dfsId) if (dfsId && template) { - var component = { template: template, settings: pastedCompJson } + var component = { + template: template, + settings: pastedCompJson + } var _ = this success = true this.fb.componentsTab.componentTojqElement(dfsId, component, function (newJqEl) { @@ -1469,7 +1516,9 @@ var FT_Workspace = function (fb, jqEl, comps) { return _.selectComponent(e, $(this)) }, false) }) - _.updateMetaData(pastedCompJson, { compId: dfsId }, true) + _.updateMetaData(pastedCompJson, { + compId: dfsId + }, true) _.afterInserting(newJqEl, _.form) _.actionManager.mayShow(_.body) }) @@ -1622,12 +1671,12 @@ var FT_Workspace = function (fb, jqEl, comps) { var t = $(this) var id = t.attr('data-dfsid') var c = '.hcbuild-main .fb-workspace .fb-component[data-dfsid="' + id + '"] {' + - 'border-right: 2px solid ' + _.getRandomColor(id) + ';' + - '}' + 'border-right: 2px solid ' + _.getRandomColor(id) + ';' + + '}' _.addLocalCss(c) c = '.hcbuild-main .htmlComponents .fb-component[data-dfsid="' + id + '"]{' + - 'border-left: 2px solid ' + _.getRandomColor(id) + ';' + - '}' + 'border-left: 2px solid ' + _.getRandomColor(id) + ';' + + '}' _.addLocalCss(c) var startId t = t.findVisibleInputOrRefElement() @@ -1741,16 +1790,16 @@ var FT_Workspace = function (fb, jqEl, comps) { if (!this.localCssEl) { var c = '' c = '.hcbuild-main .fb-workspace .fb-component {' + - 'border-right: 2px solid #c3c3c3;' + - '}' + 'border-right: 2px solid #c3c3c3;' + + '}' this.localCssMap[c] = 1 c = '.hcbuild-main .htmlComponents .fb-component {' + - 'border-left: 2px solid #c3c3c3;' + - '}' + 'border-left: 2px solid #c3c3c3;' + + '}' this.localCssMap[c] = 1 c = '.hcbuild-main .am-endpoint-main>i {' + - 'border-right: none !important;' + - '}' + 'border-right: none !important;' + + '}' this.localCssMap[c] = 1 this.localCssEl = $('') this.fb.el.append(this.localCssEl) @@ -1758,7 +1807,8 @@ var FT_Workspace = function (fb, jqEl, comps) { if (css) { this.localCssMap[css] = 1 } - var allCss = ''; var key + var allCss = ''; + var key for (key in this.localCssMap) { if (this.localCssMap.hasOwnProperty(key)) { allCss += key @@ -1805,7 +1855,9 @@ var FT_Workspace = function (fb, jqEl, comps) { _colorAlreadySet: {}, getRandomColor: function (id) { if (!this._randomColor[id]) { - var tryCount = 6; var i = 0; var color + var tryCount = 6; + var i = 0; + var color for (; i < tryCount; ++i) { color = this.colorSet[this.fb.randomIntBetween(0, this.colorSet.length - 1)] if (!this._colorAlreadySet[color]) { @@ -1834,7 +1886,7 @@ var FT_Workspace = function (fb, jqEl, comps) { } return this.getRandomLineOffsetForMap[id] } - }// end of connectionManager + } // end of connectionManager /** "action":{ "source":[{"_destComp":"", "_index":"", "regex":"regex"}], @@ -1965,7 +2017,9 @@ var FT_Workspace = function (fb, jqEl, comps) { var srcComp = this.ws.components[data.srcCompId] var srcCompFieldObj = this.ws.fb.compiler.getCompFieldObjectByName(srcComp, data.name) if (!srcCompFieldObj.action) { - srcCompFieldObj.action = { source: [data.source] } + srcCompFieldObj.action = { + source: [data.source] + } } else { if (!$.isArray(srcCompFieldObj.action['source'])) { srcCompFieldObj.action['source'] = [] @@ -1980,10 +2034,16 @@ var FT_Workspace = function (fb, jqEl, comps) { var destComp = this.ws.components[data.source._destCompId] var destCompFieldObj = this.ws.fb.compiler.getCompMainObject(destComp) if (!destCompFieldObj.action) { - destCompFieldObj.action = { 'destination': { 'transition': this.transition } } + destCompFieldObj.action = { + 'destination': { + 'transition': this.transition + } + } } else { if (!destCompFieldObj.action['destination'] || !destCompFieldObj.action['destination']['transition']) { - destCompFieldObj.action['destination'] = { 'transition': this.transition } + destCompFieldObj.action['destination'] = { + 'transition': this.transition + } } } var settignsCompId = this.ws.fb.settingsTab.currentCompId() @@ -2052,7 +2112,8 @@ var FT_Workspace = function (fb, jqEl, comps) { return data.destCounter > 1 }, _drawPointerAndLines: function ($target) { - var _ = this; var key + var _ = this; + var key if ($target.hasClass('fb-component')) { this.update($target.nextAll('.fb-component').addBack()) } else { @@ -2142,8 +2203,7 @@ var FT_Workspace = function (fb, jqEl, comps) { lines.splice(l, 1) } } - } catch (e) { - } + } catch (e) {} $line.remove() } t.remove() @@ -2191,7 +2251,9 @@ var FT_Workspace = function (fb, jqEl, comps) { _index: _index, compId: compId } - var sourceItems; var $endpoint; var psel + var sourceItems; + var $endpoint; + var psel psel = "i[compRef='" + compId + "'][_index='" + _index + "'][_name='" + comp.name + "']" sourceItems = this._getSourceItemsFromComp(comp, _index) var hasSrcConnections = false @@ -2316,7 +2378,10 @@ var FT_Workspace = function (fb, jqEl, comps) { let $t = $(target) if ($t.hasClass('am-endpoint')) { _.$targetEndpoint = $t - _.intrDz.ondragenter({ target: _.$targetEndpoint[0], relatedTarget: _.$dragPointer[0] }) + _.intrDz.ondragenter({ + target: _.$targetEndpoint[0], + relatedTarget: _.$dragPointer[0] + }) } }, _dragleave: function (e) { @@ -2324,19 +2389,25 @@ var FT_Workspace = function (fb, jqEl, comps) { return } if (_.$targetEndpoint) { - _.intrDz.ondragleave({ target: _.$targetEndpoint[0], relatedTarget: _.$dragPointer[0] }) + _.intrDz.ondragleave({ + target: _.$targetEndpoint[0], + relatedTarget: _.$dragPointer[0] + }) _.$targetEndpoint = null } }, _dropcheck: function () { if (_.$targetEndpoint && _.$targetEndpoint.length && _._isInside(_.$targetEndpoint[0].getBoundingClientRect())) { - _.intrDz.ondrop({ target: _.$targetEndpoint[0], relatedTarget: _.$dragPointer[0] }) + _.intrDz.ondrop({ + target: _.$targetEndpoint[0], + relatedTarget: _.$dragPointer[0] + }) } }, - _isInside (r) { + _isInside(r) { return r && this.lastY > r.top && this.lastY < r.bottom && this.lastX > r.left && this.lastX < r.right }, - _enableDropzoneEntpoints (pointer) { + _enableDropzoneEntpoints(pointer) { var _ = this var $endpoints = this.ws.body.find('.fws-main:first') $endpoints = $endpoints.find('.am-endpoint') @@ -2348,10 +2419,13 @@ var FT_Workspace = function (fb, jqEl, comps) { // this.addEventListener("touchmove", _._dragenter, false); this.addEventListener('mouseover', _._dragenter, false) this.addEventListener('mouseout', _._dragleave, false) - _.intrDz.ondropactivate({ target: this, relatedTarget: pointer }) + _.intrDz.ondropactivate({ + target: this, + relatedTarget: pointer + }) }) }, - _disableDropzoneEntpoints (pointer) { + _disableDropzoneEntpoints(pointer) { var _ = this var $endpoints = this.ws.body.find('.fws-main:first') $endpoints = $endpoints.find('.am-endpoint') @@ -2359,7 +2433,10 @@ var FT_Workspace = function (fb, jqEl, comps) { // this.removeEventListener("touchmove", _._dragenter, false); this.removeEventListener('mouseover', _._dragenter, false) this.removeEventListener('mouseout', _._dragleave, false) - _.intrDz.ondropdeactivate({ target: this, relatedTarget: pointer }) + _.intrDz.ondropdeactivate({ + target: this, + relatedTarget: pointer + }) }) }, _initDropzone: function () { @@ -2595,7 +2672,10 @@ var FT_Workspace = function (fb, jqEl, comps) { if (!_._removeIfStartPointerExists($pointer)) { e.target.style.webkitTransform = e.target.style.transform = 'translate(0, 0)' var pos = $pointer.data('src').positionOfUnderlying(_.$pointLayer) - $pointer.css({ top: pos.y + 'px', left: pos.x + 'px' }) + $pointer.css({ + top: pos.y + 'px', + left: pos.x + 'px' + }) $pointer.data('line').attr('visibility', 'hidden') $pointer.data('lastEndpoint', null) } @@ -2632,8 +2712,7 @@ var FT_Workspace = function (fb, jqEl, comps) { lines.splice(l, 1) } } - } catch (e) { - } + } catch (e) {} $line.remove() $pointer.remove() return true @@ -2711,7 +2790,10 @@ var FT_Workspace = function (fb, jqEl, comps) { height: h + 'px', width: w + 'px' }) - $pointer.css({ top: startPos.y + 'px', left: startPos.x + 'px' }) + $pointer.css({ + top: startPos.y + 'px', + left: startPos.x + 'px' + }) $pointer.data('line').attr('visibility', 'hidden') $pointer.data('connected', false) @@ -2781,9 +2863,10 @@ var FT_Workspace = function (fb, jqEl, comps) { } return true } - }// end of actionManager + } // end of actionManager this.sizeOf = function (obj) { - var size = 0; var key + var size = 0; + var key for (key in obj) { if (obj.hasOwnProperty(key)) size++ } @@ -2928,7 +3011,7 @@ var FT_Workspace = function (fb, jqEl, comps) { } this.fb = null this.el = null - this.components = {}/** {"compId":{..settings..}**/ + this.components = {} /** {"compId":{..settings..}**/ this.init(fb, jqEl, comps) } @@ -2975,11 +3058,23 @@ var FT_ComponentsTab = function (fb, jqEl) { } }, items: { - 'edit': { name: 'Edit', icon: 'edit' }, + 'edit': { + name: 'Edit', + icon: 'edit' + }, // "cut": {name: "Cut", icon: "cut"}, - 'copy': { name: 'Copy', icon: 'copy' }, - 'paste': { name: 'Paste', icon: 'paste' }, - 'delete': { name: 'Delete', icon: 'delete' } + 'copy': { + name: 'Copy', + icon: 'copy' + }, + 'paste': { + name: 'Paste', + icon: 'paste' + }, + 'delete': { + name: 'Delete', + icon: 'delete' + } } }) } @@ -2997,7 +3092,7 @@ var FT_ComponentsTab = function (fb, jqEl) { var index = 1 while (!fbComponent.hasClass('fb-component')) { fbComponent = fbComponent.parent() - ++index + ++index if (maxIndex < index) { break } @@ -3035,10 +3130,10 @@ var FT_ComponentsTab = function (fb, jqEl) { } data[key].settings = _.fb.deepCopySettings(data[key].settings, _.getDefaultSettingsDescriptor()) searchedComponents[key] = { - template: data[key].template, - settings: data[key].settings - } - ++compsCount + template: data[key].template, + settings: data[key].settings + } + ++compsCount } } if (compsCount > 0) { @@ -3080,10 +3175,10 @@ var FT_ComponentsTab = function (fb, jqEl) { // data[key].settings.action = ""; // } componentsTab.components[key] = { - template: data[key].template, - settings: data[key].settings - } - ++count + template: data[key].template, + settings: data[key].settings + } + ++count } } } @@ -3113,7 +3208,7 @@ var FT_ComponentsTab = function (fb, jqEl) { this.el = null this.templates = null this.copiedComponentDfsId = null - this.components = {}// {"someDfsId":{template:"", settings:{}}}; + this.components = {} // {"someDfsId":{template:"", settings:{}}}; // same as components but this one is not being emptied when searching for components // it is needed to prevent from compile issues when re-rending components on the workspace this.backupComponents = {} @@ -3137,7 +3232,11 @@ var FT_ComponentsTab = function (fb, jqEl) { if (this.storeQueue.hasOwnProperty(key)) { if (this.components[key]) { var updateComp = this.components[key] - var newComp = { id: key, template: updateComp.template, settings: updateComp.settings } + var newComp = { + id: key, + template: updateComp.template, + settings: updateComp.settings + } this.fb.options.component.storeComp(newComp, function (data) { if (data && data.oldId && data.newId) { componentsTab.updateDfsId(data.oldId, data.newId) @@ -3250,7 +3349,11 @@ var FT_ComponentsTab = function (fb, jqEl) { for (var i = 0; i < deliveredCollector.length; ++i) { $refComp = $(deliveredCollector[i]) _.body.append($refComp) - try { _.fb.workspace.dragAndDropManager.attachDragEvent($refComp, true) } catch (eee) { console.log(eee) } + try { + _.fb.workspace.dragAndDropManager.attachDragEvent($refComp, true) + } catch (eee) { + console.log(eee) + } } setTimeout(function () { _.fb.workspace.connectionManager.update() @@ -3262,7 +3365,8 @@ var FT_ComponentsTab = function (fb, jqEl) { } } this.sizeOf = function (obj) { - var size = 0; var key + var size = 0; + var key for (key in obj) { if (obj.hasOwnProperty(key)) size++ } @@ -3327,218 +3431,200 @@ var FT_SettingsTab = function (fb, jqEl) { this.templates = { settings: { label: '', - hiddenField: - '{{#ifEq type "checkbox"}}' + - '' + - '{{else}}' + - '' + - '{{/ifEq}}', - field: - ' ' + - ' ' + - ' {{#if createI18nEl}}' + - ' ' + - ' {{/if}}' + - ' ' + - ' ' + - '
' + - ' ' + - ' ' + - ' {{#ifEq type "checkbox"}}' + - ' ' + - ' {{else}}' + - ' ' + - ' {{/ifEq}}' + - '
', - enumField: - ' ' + - ' ' + - ' ' + - ' ' + - '
' + - ' {{#each val.all}}' + - '
' + - ' ' + - ' ' + - '
' + - ' {{/each}}' + - ' {{#each val.all}}' + - ' ' + - ' {{/each}}' + - '
', - enumFieldSelect: - ' ' + - ' ' + - ' {{#ifEq label "file"}}{{/ifEq}}' + - ' ' + - ' ' + - '
exact' + - ' ' + - '
' + - ' ' + - ' {{#each val.all}}' + - ' ' + - ' {{/each}}' + - '
' + hiddenField: '{{#ifEq type "checkbox"}}' + + '' + + '{{else}}' + + '' + + '{{/ifEq}}', + field: ' ' + + ' ' + + ' {{#if createI18nEl}}' + + ' ' + + ' {{/if}}' + + ' ' + + ' ' + + '
' + + ' ' + + ' ' + + ' {{#ifEq type "checkbox"}}' + + ' ' + + ' {{else}}' + + ' ' + + ' {{/ifEq}}' + + '
', + enumField: ' ' + + ' ' + + ' ' + + ' ' + + '
' + + ' {{#each val.all}}' + + '
' + + ' ' + + ' ' + + '
' + + ' {{/each}}' + + ' {{#each val.all}}' + + ' ' + + ' {{/each}}' + + '
', + enumFieldSelect: ' ' + + ' ' + + ' {{#ifEq label "file"}}{{/ifEq}}' + + ' ' + + ' ' + + '
exact' + + ' ' + + '
' + + ' ' + + ' {{#each val.all}}' + + ' ' + + ' {{/each}}' + + '
' } } this.templates.startIndention = - '
' + + '
' this.templates.enumRowSingle = - '
' + - ' {{#if label}}' + - '
' + - this.templates.settings.label + - '
' + - ' {{/if}}' + - '
{{#if select}}' + - this.templates.settings.enumFieldSelect + '{{else}}' + this.templates.settings.enumField + - ' {{/if}}
' + - ' {{#unless select}}{{#if label}}' + - ' ' + - ' {{/if}}{{/unless}}' + - '
' + '
' + + ' {{#if label}}' + + '
' + + this.templates.settings.label + + '
' + + ' {{/if}}' + + '
{{#if select}}' + + this.templates.settings.enumFieldSelect + '{{else}}' + this.templates.settings.enumField + + ' {{/if}}
' + + ' {{#unless select}}{{#if label}}' + + ' {{/if}}{{/unless}}' + + '
' this.templates.inputRowSingleDate = - '
' + - '
' + - '
' + - '
' + - this.templates.settings.label + - '
' + - '
' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - '
' + - ' ' + - ' ' + - ' ' + - ' ' + - '
' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - '
' + - ' ' + - '
' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - '
' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - '
' + - ' ' + - '
' + - '
' + - '
' + - '
' + - '
' + '
' + + '
' + + '
' + + '
' + + this.templates.settings.label + + '
' + + '
' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '
' + + ' ' + + ' ' + + ' ' + + ' ' + + '
' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '
' + + ' ' + + '
' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '
' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + ' ' + + '
' + + ' ' + + '
' + + '
' + + '
' + + '
' + + '
' this.templates.inputRowSingle = - '
' + - ' {{#if label}}' + - '
' + - this.templates.settings.label + - '
' + - ' {{/if}}' + - '
' + - this.templates.settings.field + - '
' + - ' {{#if label}}' + - ' ' + - ' {{/if}}' + - '
' + '
' + + ' {{#if label}}' + + '
' + + this.templates.settings.label + + '
' + + ' {{/if}}' + + '
' + + this.templates.settings.field + + '
' + + ' {{#if label}}' + + ' {{/if}}' + + '
' this.templates.inputRowMultiple = - '
' + - ' {{#if label}}' + - '
' + - this.templates.settings.label + - '
' + - ' {{/if}}' + - '
' + - this.templates.settings.field + - '
' + - '
' + '
' + + ' {{#if label}}' + + '
' + + this.templates.settings.label + + '
' + + ' {{/if}}' + + '
' + + this.templates.settings.field + + '
' + + '
' this.templates.array = { item: { - start: - '
', - end: - '' + - '' + - '' + - '
' + start: '
', + end: '' + + '' + + '' + + '
' } } this.templates.validate = { - dropDown: - '', - dropDownLi: - '
  • ' + - ' {{key}}' + - '
  • ', - deleteBtn: - '' + + ' ' + + '
    ', + dropDownLi: '
  • ' + + ' {{key}}' + + '
  • ', + deleteBtn: '' } @@ -3627,17 +3713,26 @@ var FT_SettingsTab = function (fb, jqEl) { val = _.validate.dropdown.defaults[key] if (typeof val === 'boolean') { type = 'checkbox' - htmlStr = _.transformer.json.createInputRow({ fb: fb, val: val }, key, path, type, true) + htmlStr = _.transformer.json.createInputRow({ + fb: fb, + val: val + }, key, path, type, true) } else if (key === 'file' || fb.isEnum(val)) { if (!val) { val = {} } val.exact = _this.attr('data-exact') val.kind = _this.attr('data-kind') - htmlStr = _.transformer.json.enumToHtmlInput({ fb: fb, val: val }, key, path) - } else /* if(typeof val === 'string') */{ + htmlStr = _.transformer.json.enumToHtmlInput({ + fb: fb, + val: val + }, key, path) + } else /* if(typeof val === 'string') */ { type = 'text' - htmlStr = _.transformer.json.createInputRow({ fb: fb, val: val }, key, path, type, true) + htmlStr = _.transformer.json.createInputRow({ + fb: fb, + val: val + }, key, path, type, true) } var newEl = $(htmlStr) _.validate.file.createExactSwitchEvent(fb, newEl) @@ -3662,7 +3757,9 @@ var FT_SettingsTab = function (fb, jqEl) { if (_t.data('exact')) { try { _t.attr('title', fb.fileTypes['Exact'][selected]['MIME']['Value']) - } catch (e) { console.log(e) } + } catch (e) { + console.log(e) + } } else { try { var arr = fb.fileTypes['Vague'][selected] @@ -3675,7 +3772,9 @@ var FT_SettingsTab = function (fb, jqEl) { } } _t.attr('title', t) - } catch (e) { console.log(e) } + } catch (e) { + console.log(e) + } } }, createExactSwitchEvent: function (fb, el) { @@ -3686,8 +3785,13 @@ var FT_SettingsTab = function (fb, jqEl) { var exact = _this.is(':checked') var path = _this.attr('data-path') var key = 'file' - var val = { exact: exact } - var hStr = _.transformer.json.enumToHtmlInput({ fb: fb, val: val }, key, path) + var val = { + exact: exact + } + var hStr = _.transformer.json.enumToHtmlInput({ + fb: fb, + val: val + }, key, path) var newEl = $(hStr) var fileExactSwitch = newEl.find('input.file-exact') fileExactSwitch.click(fileExactClickEvent) @@ -3763,7 +3867,9 @@ var FT_SettingsTab = function (fb, jqEl) { addDeleteButton: function (fb, path, el) { var _ = fb.settingsTab if (el.find('.validation-del').length === 0) { - var htmlStr = fb.compileTemplate(_.templates.validate.deleteBtn, { path: path }, 'templates.validate.deleteBtn') + var htmlStr = fb.compileTemplate(_.templates.validate.deleteBtn, { + path: path + }, 'templates.validate.deleteBtn') var newDelEl = $(htmlStr) // _.validate.deleteButton.createDeleteEvent(fb, newDelEl); el.after(newDelEl) @@ -3855,11 +3961,25 @@ var FT_SettingsTab = function (fb, jqEl) { } }, toHtmlInput: function (fb, json) { - var buffer = { html: '', objPath: '' } + var buffer = { + html: '', + objPath: '' + } if ($.isArray(json)) { - this.arrayToHtmlInput({ fb: fb, key: '', val: json, buffer: buffer, rootWrap: true }, '') + this.arrayToHtmlInput({ + fb: fb, + key: '', + val: json, + buffer: buffer, + rootWrap: true + }, '') } else { - this.objectToHtmlInput({ fb: fb, key: '', val: json, buffer: buffer }, '') + this.objectToHtmlInput({ + fb: fb, + key: '', + val: json, + buffer: buffer + }, '') } var $html = $(buffer.html) fb.settingsTab.validate.dropdown.replaceLabel(json, fb, $html) @@ -3937,13 +4057,12 @@ var FT_SettingsTab = function (fb, jqEl) { _thisNameEl.addClass('var-name') _thisNameEl.attr('autocomplete', 'off') _thisNameEl.attr('spellcheck', 'false') - _thisNameEl.typeahead( - { - minLength: 0, - autoSelect: true, - source: _fbOptions.varNameFunction ? _fbOptions.varNameFunction : _fbOptions.vars, - items: 20 - }) + _thisNameEl.typeahead({ + minLength: 0, + autoSelect: true, + source: _fbOptions.varNameFunction ? _fbOptions.varNameFunction : _fbOptions.vars, + items: 20 + }) }) var connectorSelector = 'input.connector' @@ -3952,13 +4071,12 @@ var FT_SettingsTab = function (fb, jqEl) { var _thisNameEl = $(this) _thisNameEl.attr('autocomplete', 'off') _thisNameEl.attr('spellcheck', 'false') - _thisNameEl.typeahead( - { - minLength: 0, - autoSelect: true, - source: _fbOptions.varConnectorsFunction, - items: 20 - }) + _thisNameEl.typeahead({ + minLength: 0, + autoSelect: true, + source: _fbOptions.varConnectorsFunction, + items: 20 + }) $(_thisNameEl).on('click', function () { $(_thisNameEl).typeahead('lookup').focus() }) @@ -3997,7 +4115,7 @@ var FT_SettingsTab = function (fb, jqEl) { settingsTab.settingsChanged(arrayAddEl, 'click') }) - function moveArrayItem (target, direction) { + function moveArrayItem(target, direction) { let $arrayMoveUpEl = target let _arrayItem = $arrayMoveUpEl.parent() @@ -4045,8 +4163,7 @@ var FT_SettingsTab = function (fb, jqEl) { var arrayDelBtn = $(this) var _arrayItem = arrayDelBtn.parent() if (!arrayDelBtn.hasClass('simple-item')) { - if (_arrayItem.is(':last-child')) { - } else { + if (_arrayItem.is(':last-child')) {} else { var _arrayIndention = _arrayItem.nextParentWithClass('indention') var arrayAddBtn = _arrayIndention.find('.array-add') var _arrayParentPath = arrayAddBtn.attr('name') @@ -4131,7 +4248,9 @@ var FT_SettingsTab = function (fb, jqEl) { if (iHideIt) { o.isParentHidden = false } else { - if (key) { o.buffer.html += this.endIndention(o) } + if (key) { + o.buffer.html += this.endIndention(o) + } } return o.buffer }, @@ -4364,20 +4483,20 @@ var FT_SettingsTab = function (fb, jqEl) { return true } if (!event.ctrlKey && (code > 46 || code < 9 || - (code !== 9 && - code !== 16 && - code !== 17 && - code !== 18 && - code !== 33 && - code !== 34 && - code !== 35 && - code !== 36 && - code !== 37 && - code !== 38 && - code !== 39 && - code !== 40 && - code !== 45 && - code !== 46))) { + (code !== 9 && + code !== 16 && + code !== 17 && + code !== 18 && + code !== 33 && + code !== 34 && + code !== 35 && + code !== 36 && + code !== 37 && + code !== 38 && + code !== 39 && + code !== 40 && + code !== 45 && + code !== 46))) { settingsTab.settingsChanged(t, 'keyup') } } @@ -4397,12 +4516,12 @@ var FT_SettingsTab = function (fb, jqEl) { }, html: { /** - * data-dval ["undefined" = don't assign, "null" assign empty, "some val" assign with this if empty] - * @param fb - * @param jqEl - * @param o - * @returns {*} - */ + * data-dval ["undefined" = don't assign, "null" assign empty, "some val" assign with this if empty] + * @param fb + * @param jqEl + * @param o + * @returns {*} + */ toJsonSettings: function (fb, jqEl, o) { if (!o) { o = $.isArray(fb.settingsTab.currentSettings) ? [] : {} @@ -4510,7 +4629,10 @@ var FT_SettingsTab = function (fb, jqEl) { fb.compiler.deepLoopOverJson(o, { 'object': function (value, keyOrIndex, obj) { if (keyOrIndex === 'file' && value && value.all) { - obj.file = { exact: value.exact, kind: value.all[value.selected] } + obj.file = { + exact: value.exact, + kind: value.all[value.selected] + } } return true } @@ -4545,8 +4667,7 @@ var FT_SettingsTab = function (fb, jqEl) { } try { arrayIndex = parseInt(strArray[i].match(/(\d+)/g)[0]) - } catch (e) { - } + } catch (e) {} } else if (strArray[i] === '.') { // object if (arrayPointer) { if (typeof o[arrayIndex] !== 'object') { @@ -4575,7 +4696,8 @@ var FT_SettingsTab = function (fb, jqEl) { } } this.sizeOf = function (obj) { - var size = 0; var key + var size = 0; + var key for (key in obj) { if (obj.hasOwnProperty(key)) size++ } @@ -4586,26 +4708,26 @@ var FT_SettingsTab = function (fb, jqEl) { var notifEle = this.body.find(selector) if (!notifEle || notifEle.length === 0) { var template = - '
    ' + - '
    ' + - '
    ' + - '
    ' + - ' ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + '
    ' + + '
    ' + + '
    ' + + '
    ' + + ' ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' var htmlStr = this.fb.compileTemplate(template, obj) this.body.prepend(htmlStr) } else { var alertTemplate = - ' ' + ' ' notifEle.html(this.fb.compileTemplate(alertTemplate, obj)) } } @@ -4720,8 +4842,7 @@ var FT_SettingsTab = function (fb, jqEl) { this.fb.workspace.unHighlightComponent(this.compId) this.fb.workspace.connectionManager.update() } - this.focusInput = function () { - } + this.focusInput = function () {} this.init(fb, jqEl) } @@ -4740,28 +4861,23 @@ var FT_BuilderTab = function (fb, jqEl) { if (!splitLayoutMain.attr('id')) { splitLayoutMain.attr('id', this.fb.randomId()) } - this.layout = splitLayoutMain.layout( - { - closable: false, // pane can open & close - resizable: true, // when open, pane can be resized - slidable: true, // when closed, pane can 'slide' open over other panes - closes on mouse-out - livePaneResizing: true, - stateManagement__enabled: true, // automatic cookie load & save enabled by default - showDebugMessages: false, // log and/or display messages from debugging & testing code - minSize: 0.1, - size: 0.5, - maxSize: 0.9, - west: { - }, - center: { - } - } - ) + this.layout = splitLayoutMain.layout({ + closable: false, // pane can open & close + resizable: true, // when open, pane can be resized + slidable: true, // when closed, pane can 'slide' open over other panes - closes on mouse-out + livePaneResizing: true, + stateManagement__enabled: true, // automatic cookie load & save enabled by default + showDebugMessages: false, // log and/or display messages from debugging & testing code + minSize: 0.1, + size: 0.5, + maxSize: 0.9, + west: {}, + center: {} + }) } catch (exceptionWhenInitSplitPane) { console.log(exceptionWhenInitSplitPane) this.layout = { - resizeAll: function () { - } + resizeAll: function () {} } } @@ -4878,8 +4994,12 @@ var FT_BuilderTab = function (fb, jqEl) { } } fullscreenTarget.removeClass('fullscreen') - fullscreenTarget.css({ 'height': '' }) - fullscreenTarget.find('.panel-body').css({ 'height': '' }) + fullscreenTarget.css({ + 'height': '' + }) + fullscreenTarget.find('.panel-body').css({ + 'height': '' + }) fullscreenBtn.find('span.glyphicon').removeClass('glyphicon-resize-small') fullscreenBtn.find('span.glyphicon').addClass('glyphicon-fullscreen') } else { @@ -4956,7 +5076,9 @@ var FT_BuilderTab = function (fb, jqEl) { this.possibleToStore = true this.enableSaveBtn(true) return - } catch (e) { console.log(e) } + } catch (e) { + console.log(e) + } } } this.possibleToStore = false @@ -4973,7 +5095,10 @@ var FT_BuilderTab = function (fb, jqEl) { var settings = $.parseJSON(this.settingsEditor.getValue()) var template = this.templateEditor.getValue() this.fb.compiler.cacheTemplate(this.dfsId, template) - this.fb.componentsTab.addComponent(this.dfsId, { template: template, settings: settings }) + this.fb.componentsTab.addComponent(this.dfsId, { + template: template, + settings: settings + }) this.editMode() this.editorsValueSaved() } @@ -5043,8 +5168,7 @@ var FT_BuilderTab = function (fb, jqEl) { saveBtn.addClass('hcb-changed') try { _.aceEditorResize($(editor.container)) - } catch (eee) { - } + } catch (eee) {} } this.enableSaveBtn = function (enable) { var saveBtn = this.el.find('.build-btn') @@ -5082,14 +5206,13 @@ var FT_BuilderTab = function (fb, jqEl) { aceEditorEl.width(stretchEditorWidth) aceEditorEl.height(stretchEditorHeight) } - this.tabHidden = function () { - } + this.tabHidden = function () {} this.init(fb, jqEl) } var formBuilderHtmlConstruct = - '
    ' + - ' ' + + '
    ' + + ' ' + `
    ` + '
    ' + -' ' + -'
    ' + - ' ' + - '
    ' + - '
    ' + - ' ' + - ' ' + - ' ' + - ' ' + - '
    ' + - ' ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - ' ' + - ' ' + - '
    ' + - '
    ' + - '
    ' + - ' ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - ' ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + - ' ' + - '
    ' + - '
    ' + - '
    ' + - '
    ' + ' ' + + '
    ' + + ' ' + + '
    ' + + '
    ' + + ' ' + + ' ' + + ' ' + + ' ' + + '
    ' + + ' ' + + '' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + ' ' + + ' ' + + '
    ' + + '
    ' + + '
    ' + + ' ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + ' ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + ' ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' if (!String.prototype.startsWith) { (function () { @@ -5250,7 +5373,9 @@ if (typeof String.prototype.endsWith !== 'function') { } } String.prototype.toUniqueHash = function () { - var hash = 0; var i; var chr + var hash = 0; + var i; + var chr if (this.length === 0) return hash for (i = 0; i < this.length; i++) { chr = this.charCodeAt(i) @@ -5271,7 +5396,7 @@ $.fn.nextParentWithClass = function (attrClass) { var parent = this.parent() while (!parent.hasClass(attrClass)) { parent = parent.parent() - ++index + ++index if (maxIndex < index) { return $([]) } @@ -5316,7 +5441,8 @@ $.fn.findVisibleInputOrRefElement = function () { } } $.fn.positionOfUnderlying = function (ctxEl) { - var start = this.offset(); var mainLayer = ctxEl.offset() + var start = this.offset(); + var mainLayer = ctxEl.offset() return { x: start.left + 0.5 * this.outerWidth() - mainLayer.left, y: start.top + 0.5 * this.outerHeight() - mainLayer.top @@ -5349,8 +5475,7 @@ $.fn.renameAttr = function (oldName, newName) { var fbDefaultComponents = { 'HC1': { - 'template': - ` + 'template': `

    {{label}}

    @@ -5364,8 +5489,7 @@ var fbDefaultComponents = { } }, 'HC2': { - 'template': - ` + 'template': `
    @@ -5389,8 +5513,7 @@ var fbDefaultComponents = { } }, 'HC3': { - 'template': - ` + 'template': `
    \t
    \t @@ -5420,18 +5543,15 @@ var fbDefaultComponents = { 'validate': { 'required': true }, - 'values': [ - { - 'help': '', - 'label': '...', - 'value': 'val' - } - ] + 'values': [{ + 'help': '', + 'label': '...', + 'value': 'val' + }] } }, 'HC5': { - 'template': - ` + 'template': `
    \t
    @@ -5475,18 +5595,15 @@ var fbDefaultComponents = { 'validate': { 'required': true }, - 'values': [ - { - 'help': '', - 'label': '...', - 'value': '1' - } - ] + 'values': [{ + 'help': '', + 'label': '...', + 'value': '1' + }] } }, 'HC7': { - 'template': - ` + 'template': `
    @@ -5509,8 +5626,7 @@ var fbDefaultComponents = { } }, 'HC8': { - 'template': - ` + 'template': `
    @@ -5536,8 +5652,7 @@ var fbDefaultComponents = { 'validate': { 'required': true }, - 'values': [ - { + 'values': [{ 'label': 'Select', 'value': 'val1' }, @@ -5549,8 +5664,7 @@ var fbDefaultComponents = { } }, 'HC9': { - 'template': - ` + 'template': `
    @@ -5587,8 +5701,7 @@ var fbDefaultComponents = { } }, 'HC10': { - 'template': - ` + 'template': `
    \t
    \t\t
    @@ -5718,8 +5831,7 @@ var fbDefaultComponents = { \t
    `, - 'settings': [ - { + 'settings': [{ 'columnClass': { 'all': [ 'auto', @@ -5731,12 +5843,10 @@ var fbDefaultComponents = { ], 'selected': 0 }, - 'dropdownValues': [ - { - 'label': 'Label', - 'value': 'Value' - } - ], + 'dropdownValues': [{ + 'label': 'Label', + 'value': 'Value' + }], 'help': 'help text', 'initialRows': 1, 'label': 'Dynamic List', @@ -5756,12 +5866,10 @@ var fbDefaultComponents = { } }, { - 'dropdownValues': [ - { - 'label': 'Label', - 'value': 'Value' - } - ], + 'dropdownValues': [{ + 'label': 'Label', + 'value': 'Value' + }], 'name': '', 'placeholder': 'Placeholder', 'type': { @@ -5780,8 +5888,7 @@ var fbDefaultComponents = { ] }, 'HC11': { - 'template': - ` + 'template': `
    \t {{#each this}} \t
    @@ -5791,22 +5898,19 @@ var fbDefaultComponents = { \t {{/each}}
    `, - 'settings': [ - { - 'autocomplete': 'on', - 'help': 'help text', - 'label': 'Grouped simple fields', - 'name': '', - 'placeholder': 'Placeholder', - 'validate': { - 'required': true - } + 'settings': [{ + 'autocomplete': 'on', + 'help': 'help text', + 'label': 'Grouped simple fields', + 'name': '', + 'placeholder': 'Placeholder', + 'validate': { + 'required': true } - ] + }] }, 'HC12': { - 'template': - ` + 'template': `
    {{#eachCount rows}} @@ -5840,26 +5944,24 @@ var fbDefaultComponents = { }, '_searchHelper': 'group,parent,grp,container,box', 'access': {}, - 'column': [ - { - 'all': [ - 'auto', - '8%', - '16%', - '25%', - '33%', - '42%', - '50%', - '58%', - '67%', - '75%', - '84%', - '92%', - '100%' - ], - 'selected': 12 - } - ], + 'column': [{ + 'all': [ + 'auto', + '8%', + '16%', + '25%', + '33%', + '42%', + '50%', + '58%', + '67%', + '75%', + '84%', + '92%', + '100%' + ], + 'selected': 12 + }], 'rows': 1 } } diff --git a/ui/core/src/views/DocumentViewer.vue b/ui/core/src/views/DocumentViewer.vue index 92a97078c..5b7ee0331 100644 --- a/ui/core/src/views/DocumentViewer.vue +++ b/ui/core/src/views/DocumentViewer.vue @@ -13,7 +13,7 @@
    - +

    diff --git a/ui/core/src/views/RegisterRequest.vue b/ui/core/src/views/RegisterRequest.vue index e340a0fc0..ed3dc726c 100644 --- a/ui/core/src/views/RegisterRequest.vue +++ b/ui/core/src/views/RegisterRequest.vue @@ -147,36 +147,48 @@ export default { await window.ethereum.enable() await this.app.wallet.wallet.setupDefaultAccount() } catch (e) { - console.log(e) + this.app.deleteUserHasSession() this.walletErrorMessage = this.$t('Please grant access to MetaMask.') return } } else { + this.app.deleteUserHasSession() this.walletErrorMessage = this.$t('Please grant access to MetaMask.') return } + this.account = this.app.wallet.getCurrentAddress() + if (this.account === undefined) { + this.app.deleteUserHasSession() this.walletErrorMessage = this.$t('Please sign in to MetaMask.') return } + if (this.checkTermsAndConditions()) { - this.app.wallet.signMessage(this.challenge, this.account).then((signature) => { - axios.post('/api/login', { signature }).then((res) => { - this.challenge = '' - if (res.status >= 200 && res.status <= 299) { - window.location = res.data.location || '/admin/workflow' - } else { - this.walletErrorMessage = this.$t('Could not verify signature.') - } - }, (err) => { - this.challenge = '' - this.app.handleError(err) - this.walletErrorMessage = this.$t('Could not verify signature.') + this.app.wallet.signMessage(this.challenge, this.account) + .then((signature) => { + axios.post('/api/login', { signature }) + .then((res) => { + this.challenge = '' + + if (res.status >= 200 && res.status <= 299) { + this.app.initUserHasSession() + window.location = res.data.location || '/admin/workflow' + } else { + this.app.deleteUserHasSession() + this.walletErrorMessage = this.$t('Could not verify signature.') + } + }, (err) => { + this.challenge = '' + this.app.deleteUserHasSession() + this.app.handleError(err) + this.walletErrorMessage = this.$t('Could not verify signature.') + }) + }).catch(() => { + this.app.deleteUserHasSession() + this.walletErrorMessage = this.$t('Could not Sign Message.') }) - }).catch(() => { - this.walletErrorMessage = this.$t('Could not Sign Message.') - }) } } }