Skip to content

Commit

Permalink
Preprod to main for feature release v1.6.3 (#537)
Browse files Browse the repository at this point in the history
  • Loading branch information
loleg authored Apr 19, 2024
1 parent 839a02f commit e067196
Show file tree
Hide file tree
Showing 26 changed files with 512 additions and 152 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version: 2.1
parameters:
golang-tag:
type: string
default: "1.21"
default: "1.22"
nodejs-ver:
type: integer
default: 16
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SHELL:= /bin/bash
DEBUG_FLAG?=false
GO_VERSION=1.21
GO_VERSION=1.22

ifeq ($(DEBUG), "true")
BINDATA_OPTS="-debug"
Expand Down Expand Up @@ -159,7 +159,8 @@ fmt:

.PHONY: test
test: generate
go test $(COVERAGE_OPTS) ./main/... ./sys/... ./storage/... ./service/...
go test $(COVERAGE_OPTS) ./main/... ./sys/... ./storage/... ./service/...; ret=$$?; \
echo $$ret

.PHONY: test-integration
test-integration:
Expand Down
Binary file modified demo/restore_db/i18n
Binary file not shown.
16 changes: 9 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module github.com/ProxeusApp/proxeus-core

go 1.20
go 1.21

toolchain go1.22.0

require (
github.com/SparkPost/gosparkpost v0.2.0
Expand Down Expand Up @@ -30,8 +32,8 @@ require (
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
go.etcd.io/bbolt v1.3.8 // indirect
golang.org/x/crypto v0.21.0
golang.org/x/net v0.22.0
golang.org/x/crypto v0.22.0
golang.org/x/net v0.24.0
gopkg.in/gavv/httpexpect.v2 v2.16.0
)

Expand All @@ -43,7 +45,7 @@ require (
github.com/gorilla/context v1.1.2 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/klauspost/compress v1.17.3 // indirect
github.com/labstack/echo-contrib v0.15.0
github.com/labstack/echo-contrib v0.17.0
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
Expand All @@ -59,7 +61,7 @@ require (

require (
github.com/labstack/echo/v4 v4.11.4
go.mongodb.org/mongo-driver v1.14.0
go.mongodb.org/mongo-driver v1.15.0
)

require (
Expand All @@ -78,7 +80,7 @@ require (
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/pprof v0.0.0-20231101202521-4ca4178f5c7a // indirect
Expand All @@ -102,7 +104,7 @@ require (
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.16.1 // indirect
Expand Down
84 changes: 64 additions & 20 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion main/www/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func redirectToLogin(c echo.Context) error {
if isAjax {
return echo.ErrUnauthorized
}
return c.Redirect(http.StatusTemporaryRedirect, "/login")
return c.Redirect(http.StatusTemporaryRedirect, "/login?redirect="+req.URL.Path)
}

func getURI(host, url string) string {
Expand Down
2 changes: 1 addition & 1 deletion service/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
59 changes: 58 additions & 1 deletion sys/workflow/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,9 @@ func (me *Engine) setupNodes(ctx *context) error {
if len(me.nodeImpls) == 0 {
return ErrNodeImplementationNotProvided
}

for _, item := range ctx.flow.Nodes {
item.internalNode = item.isCondition() || item.isWorkflow()
item.internalNode = item.isCondition() || item.isWorkflow() || item.isPlaceholder()
if !item.internalNode {
if s, ok := me.nodeImpls[item.Type]; ok && s.InitImplFunc != nil {
item.new = s.InitImplFunc
Expand All @@ -319,6 +320,62 @@ func (me *Engine) setupNodes(ctx *context) error {
return nil
}

func (me *Engine) removeUselessNodes(ctx *context) error {
uselessConnections := make(map[string]*Connection, 0)

for name, item := range ctx.flow.Nodes {
if !item.isPlaceholder() {
continue
}

for _, conn := range item.Connections {
correctConnection := conn
currentNode := ctx.flow.Nodes[correctConnection.NodeID]

for currentNode.isPlaceholder() {
if len(currentNode.Connections) > 0 {
correctConnection = currentNode.Connections[0]
currentNode = ctx.flow.Nodes[correctConnection.NodeID]
} else {
break
}
}

uselessConnections[name] = correctConnection
}
}

for _, item := range ctx.flow.Nodes {
if item.isPlaceholder() {
continue
}

for i := 0; i < len(item.Connections); i++ {
conn := item.Connections[i]

if val, ok := uselessConnections[conn.NodeID]; ok {
item.Connections[i] = val
}
}
}

if val, ok := uselessConnections[ctx.flow.Start.NodeID]; ok {
ctx.flow.Start.NodeID = val.NodeID
}

filteredNodes := make(map[string]*Node, 0)

for name, item := range ctx.flow.Nodes {
if !item.isPlaceholder() {
filteredNodes[name] = item
}
}

ctx.flow.Nodes = filteredNodes

return nil
}

func (me *Engine) execute(nn *Node, considerSteps bool) (proceed bool, err error) {
nn.focus()
if nn.internalNode {
Expand Down
4 changes: 4 additions & 0 deletions sys/workflow/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ func (n *Node) isWorkflow() bool {
return n.Type == "workflow"
}

func (n *Node) isPlaceholder() bool {
return n.Type == "placeholder"
}

func (me *Node) getImpl() (NodeIF, error) {
//instance is still valid for reuse
if me.impl != nil {
Expand Down
13 changes: 12 additions & 1 deletion sys/workflow/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ func newWorkflow(wf *Workflow, engine *Engine, parent *context) (*context, error
if wf == nil {
return nil, ErrWorkflowMissing
}

if wf.Flow == nil || wf.Flow.Start == nil || wf.Flow.Start.NodeID == "" {
return nil, ErrStartNodeMissing
}

me := context{
id: "root",
flow: wf.Flow,
Expand All @@ -84,11 +86,18 @@ func newWorkflow(wf *Workflow, engine *Engine, parent *context) (*context, error
engine: engine,
}

err := engine.setupNodes(&me)
err := engine.removeUselessNodes(&me)
if err != nil {
return nil, err
}

err = engine.setupNodes(&me)
if err != nil {
return nil, err
}

me.start()

return &me, nil
}

Expand Down Expand Up @@ -122,6 +131,8 @@ func (me *context) resolve(n *Node) error {
return err
}
return me.resolve(nn)
} else if n.isPlaceholder() {
return nil
} else if n.isWorkflow() {
return me.stepIntoWorkflow(n)
}
Expand Down
6 changes: 5 additions & 1 deletion test/e2e/cypress/integration/0_powerup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', '/');
})

})
})
2 changes: 1 addition & 1 deletion test/e2e/cypress/integration/1_user.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ describe(`User signup & login at ${url}`, () => {

it('should remove account and logout when clicking again', () => {
cy.get('.btn-danger').click()
cy.url().should('eq', `${url}/login`)
cy.url().should('eq', `${url}/login?redirect=%2Fadmin%2Fworkflow`)
})
})
})
Expand Down
6 changes: 3 additions & 3 deletions ui/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"bootstrap-vue": "2.0.0-rc.12",
"brace": "^0.11.1",
"codemirror": "^5.39.2",
"core-js": "^3.36.0",
"core-js": "^3.36.1",
"ethereumjs-util": "^7.1.5",
"flatpickr": "^4.5.1",
"font-awesome": "^4.7.0",
Expand All @@ -38,7 +38,7 @@
"js-sha3": "^0.9.3",
"moment": "^2.30.1",
"popper.js": "^1.14.4",
"sass": "^1.72.0",
"sass": "^1.75.0",
"sortablejs": "^1.15.2",
"tippy.js": "^6.3.7",
"underscore": "^1.8.3",
Expand Down Expand Up @@ -67,7 +67,7 @@
"vue-range-slider": "^0.6.0",
"vue-router": "^3.0.1",
"vue-scrollto": "^2.11.0",
"vue-select": "^2.4.0",
"vue-select": "^3.20.3",
"vue-tour": "^2.0.0",
"vuedraggable": "^2.16.0",
"vuep": "^0.8.1",
Expand Down
4 changes: 4 additions & 0 deletions ui/core/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ export default {
window.$root = this.$root
this.$root.$on('service-on', this.onServiceOn)
this.$root.$on('service-off', this.onServiceOff)
if (!this.app.checkUserHasSession()) {
this.app.redirectToLogin(window.location.pathname)
}
},
beforeDestroy () {
this.$root.$off('service-on', this.onServiceOn)
Expand Down
14 changes: 12 additions & 2 deletions ui/core/src/DocumentApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export default {
created () {
this.$root.$on('service-on', this.onServiceOn)
this.$root.$on('service-off', this.onServiceOff)
if (!this.app.checkUserHasSession()) {
this.app.redirectToLogin(window.location.pathname)
}
},
beforeDestroy () {
this.$root.$off('service-on', this.onServiceOn)
Expand Down Expand Up @@ -107,13 +111,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);
}
}
Expand Down
Loading

0 comments on commit e067196

Please sign in to comment.