# HG changeset patch # User Sascha L. Teichmann # Date 1570026427 -7200 # Node ID 81b0f1cf2d41e7fe669f42b6ffdbd4e34ed3b7d5 # Parent 92515c49c566341900f60745b574f6ff8e2dcf13# Parent e020e6e34ad7ebc76e68fea340bc2dc54916a6da Merged default into 'iso-areas' branch. diff -r 92515c49c566 -r 81b0f1cf2d41 README.md --- a/README.md Wed Oct 02 11:01:17 2019 +0200 +++ b/README.md Wed Oct 02 16:27:07 2019 +0200 @@ -18,6 +18,9 @@ - To only build the SPA-Client in demo mode you can use `make clientdemo`. +Check [client/README](client/README.md) for details, especially +if you want to do a production setup. + For further details see [docs/DEVELOPMENT](docs/DEVELOPMENT.md). diff -r 92515c49c566 -r 81b0f1cf2d41 client/README.md --- a/client/README.md Wed Oct 02 11:01:17 2019 +0200 +++ b/client/README.md Wed Oct 02 16:27:07 2019 +0200 @@ -35,6 +35,11 @@ * Build `yarn build` builds the production ready assets to `web` folder. + This is what the `../Makefile` will call, which you should use anyway. + + For a real production use, edit the `title` tag in `public/index.html` + to something matching your installation. + * Build `yarn build-demo` sets the hg revision as a node env var and builds the production ready assets to `web` folder. diff -r 92515c49c566 -r 81b0f1cf2d41 client/src/components/fairway/BottleneckDialogue.vue --- a/client/src/components/fairway/BottleneckDialogue.vue Wed Oct 02 11:01:17 2019 +0200 +++ b/client/src/components/fairway/BottleneckDialogue.vue Wed Oct 02 16:27:07 2019 +0200 @@ -155,6 +155,32 @@
+ Custom Depth: + +
+ + +
+ Saved cross profiles:
@@ -342,6 +368,22 @@ profilesLable() { return this.$gettext("Bottleneck Surveys"); }, + useCustomDepth: { + get() { + return this.$store.state.fairwayprofile.useCustomDepth; + }, + set(value) { + this.$store.commit("fairwayprofile/setUseCustomDepth", value); + } + }, + depth: { + get() { + return this.$store.state.fairwayprofile.depth; + }, + set(value) { + this.$store.commit("fairwayprofile/setDepth", value); + } + }, selectedBottleneck: { get() { return this.$store.state.bottlenecks.selectedBottleneck; @@ -476,6 +518,10 @@ }, selectedCut(cut) { if (cut) { + if (cut.depth) { + this.depth = cut.depth; + this.useCustomDepth = true; + } this.applyCoordinates(cut.coordinates); } } @@ -618,7 +664,8 @@ label: this.cutLabel, bottleneckName: this.selectedBottleneck, coordinates: [...this.startPoint, ...this.endPoint], - timestamp: new Date().getTime() + timestamp: new Date().getTime(), + depth: this.depth }; const existingEntry = previousCuts.find(cut => { return JSON.stringify(cut) === JSON.stringify(newEntry); diff -r 92515c49c566 -r 81b0f1cf2d41 client/src/components/fairway/Fairwayprofile.vue --- a/client/src/components/fairway/Fairwayprofile.vue Wed Oct 02 11:01:17 2019 +0200 +++ b/client/src/components/fairway/Fairwayprofile.vue Wed Oct 02 16:27:07 2019 +0200 @@ -183,7 +183,9 @@ "endPoint", "fairwayData", "maxAlt", - "selectedWaterLevel" + "selectedWaterLevel", + "depth", + "useCustomDepth" ]), ...mapState("bottlenecks", ["selectedSurvey", "selectedBottleneck"]), ...mapState("application", ["paneSetup"]), @@ -236,6 +238,13 @@ } }, watch: { + depth() { + if (!this.useCustomDepth) return; + this.drawDiagram(); + }, + useCustomDepth() { + this.drawDiagram(); + }, currentData() { this.drawDiagram(); }, @@ -465,7 +474,10 @@ }); graph .append("path") - .datum([{ x: startPoint, y: depth }, { x: endPoint, y: depth }]) + .datum([ + { x: startPoint, y: this.useCustomDepth ? this.depth : depth }, + { x: endPoint, y: this.useCustomDepth ? this.depth : depth } + ]) .attr("fill", `${this.getLayerStyle(data.los).fillColor}`) .attr("fill-opacity", this.getLayerStyle(data.los).fillOpacity) .attr("stroke", `${this.getLayerStyle(data.los).strokeColor}`) diff -r 92515c49c566 -r 81b0f1cf2d41 client/src/store/fairwayprofile.js --- a/client/src/store/fairwayprofile.js Wed Oct 02 11:01:17 2019 +0200 +++ b/client/src/store/fairwayprofile.js Wed Oct 02 16:27:07 2019 +0200 @@ -35,7 +35,9 @@ previousCuts: [], profileLoading: false, selectedCut: null, - differencesLoading: false + differencesLoading: false, + depth: 2.5, + useCustomDepth: true }; }; @@ -55,6 +57,12 @@ } }, mutations: { + setDepth: (state, value) => { + state.depth = value; + }, + setUseCustomDepth: (state, flag) => { + state.useCustomDepth = flag; + }, additionalSurvey: (state, additionalSurvey) => { state.additionalSurvey = additionalSurvey; }, diff -r 92515c49c566 -r 81b0f1cf2d41 pkg/controllers/search.go --- a/pkg/controllers/search.go Wed Oct 02 11:01:17 2019 +0200 +++ b/pkg/controllers/search.go Wed Oct 02 16:27:07 2019 +0200 @@ -45,8 +45,10 @@ s := mw.JSONInput(req).(*models.SearchRequest) if len(s.SearchString) == 0 { - err = mw.JSONError{http.StatusBadRequest, - "error: empty search string"} + err = mw.JSONError{ + Code: http.StatusBadRequest, + Message: "error: empty search string", + } return } diff -r 92515c49c566 -r 81b0f1cf2d41 pkg/controllers/system.go --- a/pkg/controllers/system.go Wed Oct 02 11:01:17 2019 +0200 +++ b/pkg/controllers/system.go Wed Oct 02 16:27:07 2019 +0200 @@ -68,8 +68,10 @@ // able to inject a verbatim '/' via the middleware, but better be on // the safe site... if strings.Contains(fileName, "/") { - err = mw.JSONError{http.StatusBadRequest, - "error: no slashes allowed in file name"} + err = mw.JSONError{ + Code: http.StatusBadRequest, + Message: "error: no slashes allowed in file name", + } return } @@ -79,8 +81,10 @@ case "apache2", "postgresql": path = "/var/log/" + serviceName + "/" + fileName default: - err = mw.JSONError{http.StatusBadRequest, - "error: invalid service: " + serviceName} + err = mw.JSONError{ + Code: http.StatusBadRequest, + Message: "error: invalid service: " + serviceName, + } return } diff -r 92515c49c566 -r 81b0f1cf2d41 pkg/controllers/user.go --- a/pkg/controllers/user.go Wed Oct 02 11:01:17 2019 +0200 +++ b/pkg/controllers/user.go Wed Oct 02 16:27:07 2019 +0200 @@ -103,13 +103,19 @@ user := mux.Vars(req)["user"] if !models.UserName(user).IsValid() { - err = mw.JSONError{http.StatusBadRequest, "error: user invalid"} + err = mw.JSONError{ + Code: http.StatusBadRequest, + Message: "error: user invalid", + } return } session, _ := auth.GetSession(req) if session.User == user { - err = mw.JSONError{http.StatusBadRequest, "error: cannot delete yourself"} + err = mw.JSONError{ + Code: http.StatusBadRequest, + Message: "error: cannot delete yourself", + } return } @@ -152,7 +158,10 @@ user := models.UserName(mux.Vars(req)["user"]) if !user.IsValid() { - err = mw.JSONError{http.StatusBadRequest, "error: user invalid"} + err = mw.JSONError{ + Code: http.StatusBadRequest, + Message: "error: user invalid", + } return } @@ -189,7 +198,10 @@ } } else { if newUser.Extent == nil { - err = mw.JSONError{http.StatusBadRequest, "extent is mandatory"} + err = mw.JSONError{ + Code: http.StatusBadRequest, + Message: "extent is mandatory", + } return } res, err = db.ExecContext( @@ -313,7 +325,10 @@ user := models.UserName(mux.Vars(req)["user"]) if !user.IsValid() { - err = mw.JSONError{http.StatusBadRequest, "error: user invalid"} + err = mw.JSONError{ + Code: http.StatusBadRequest, + Message: "error: user invalid", + } return } @@ -349,7 +364,10 @@ user := models.UserName(mux.Vars(req)["user"]) if !user.IsValid() { - err = mw.JSONError{http.StatusBadRequest, "error: user invalid"} + err = mw.JSONError{ + Code: http.StatusBadRequest, + Message: "error: user invalid", + } return } diff -r 92515c49c566 -r 81b0f1cf2d41 pkg/imports/gm.go --- a/pkg/imports/gm.go Wed Oct 02 11:01:17 2019 +0200 +++ b/pkg/imports/gm.go Wed Oct 02 16:27:07 2019 +0200 @@ -161,11 +161,11 @@ client := nts.NewINtSMessageService(gm.URL, gm.Insecure, nil) mt := nts.Message_type_typeWRM - var dis []*nts.Date_pair - dis = append(dis, &nts.Date_pair{ - Date_start: nts.Date{Time: time.Now().Add(time.Duration(-24) * time.Hour)}, - Date_end: nts.Date{Time: time.Now()}, - }) + now := time.Now() + dis := []*nts.Date_pair{{ + Date_start: nts.Date{Time: now.AddDate(0, 0, -1)}, + Date_end: nts.Date{Time: now.AddDate(0, 0, +1)}, + }} req := &nts.Get_messages_query{ Message_type: &mt, diff -r 92515c49c566 -r 81b0f1cf2d41 pkg/imports/stsh.go --- a/pkg/imports/stsh.go Wed Oct 02 11:01:17 2019 +0200 +++ b/pkg/imports/stsh.go Wed Oct 02 16:27:07 2019 +0200 @@ -341,7 +341,7 @@ From: lower, To: upper, ObjNam: objnam, - Date: models.Date{date}, + Date: models.Date{Time: date}, Countries: countries, }