Version zu Ende April 2023
This commit is contained in:
22
goMetrix/app.wasm/Makefile
Normal file
22
goMetrix/app.wasm/Makefile
Normal file
@@ -0,0 +1,22 @@
|
||||
# Basic Go makefile
|
||||
|
||||
GOCMD=GOOS=js GOARCH=wasm go
|
||||
GOBUILD=$(GOCMD) build
|
||||
GOCLEAN=$(GOCMD) clean
|
||||
GOTEST=$(GOCMD) test
|
||||
GOGET=$(GOCMD) get
|
||||
|
||||
all: build transmit
|
||||
|
||||
build:
|
||||
$(GOBUILD) -o app.wasm -v
|
||||
dbg-build:
|
||||
$(GOBUILD) -v -gcflags=all="-N -l" -tags debug
|
||||
test:
|
||||
$(GOTEST) -v ./...
|
||||
clean:
|
||||
$(GOCLEAN)
|
||||
transmit:
|
||||
scp -r app.wasm root@10.23.45.27:/srv/Data/ArchiumToolbox/Toolbox/static/wasm/
|
||||
# scp -r app.wasm root@10.23.45.26:/srv/Data/ArchiumToolbox/Toolbox/static/wasm/
|
||||
|
BIN
goMetrix/app.wasm/app.wasm
Executable file
BIN
goMetrix/app.wasm/app.wasm
Executable file
Binary file not shown.
174
goMetrix/app.wasm/aux.go
Normal file
174
goMetrix/app.wasm/aux.go
Normal file
@@ -0,0 +1,174 @@
|
||||
package main
|
||||
|
||||
// Tux
|
||||
const imageByteArrayAsBase64 = `
|
||||
iVBORw0KGgoAAAANSUhEUgAAAJgAAAC0CAMAAABfch
|
||||
VeAAAC/VBMVEUGAwkBAg8ABgkEAAYLBAIIBQsCCQwICwYMCQ4GDA8QCggTCgEVDg
|
||||
ULERMPEQ0SDxMUDw4aEgMQFBYTFBIWGBUgFwYbGBcaGBsaHBknGwUgHiEeIB0iHh
|
||||
0tHgMiJCEvIgkoJCMnJSg1JQYmKCU8KgcrLSovKyo+KBMrLS87LBBBLgU3LxtHLg
|
||||
gwMzUyNDE3MzJMMgVJNwk4OTdMOQJSNgM4Oz0+Ojk8PDVYNwdVOQdSPAg+QD1ePA
|
||||
RDPz9YQgVTQRpBQ0JeQAZlQgJ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P+gshqLkIGKkdAuoOb8zwCySgSgImiosO+bZgwt3789
|
||||
Vpt2MwkpNJvUDbEF6QGCvELZrl+UDF4qiL4j/zLjH+WfHh4gmCoVMTWnFEtsNbvH
|
||||
DeOYUXjCiQ9JmC/Lx1tjeWweueYhIulPGyCYOJQ6DsicLbbbThpx0HEgLrdjjJzF
|
||||
/wQ5IjfRsTRO0sKYA4d6GM3EiulIVIJZKJgYlDlSpluoNWyXg6R6plXFkjidH6AS
|
||||
dxrDV4meX90ipt03kWVRei8Di1KlIeqYyNjZxFD5Zdp+1L5i66ddFcKbSV2nQ7S6
|
||||
dOdC5HOn+QGN4loTMDGipw98F48xN1YKRkR4pYFqlSRigk4jBFhDI2Pj52/nUfRp
|
||||
LOW73r1aOvPnaHVCxfmj5AClSGJZenvSSyMQ/jl7xZau8kLxDDopU4UrHtztDIaO
|
||||
HAg0gSFhWnTdYorhMsYdvLdWaLxXh0w0zx7HveddL8yPpPKDAYG9ics976InCyAR
|
||||
r3VMZERIX6V66hMcmp6jnXd7Ag97UG8wVYluMPSkWK9fVummpw/hOCLQITQggv5H
|
||||
YqO9arSogUX/8d1v/+Yl70sFG/VLNeO//6wEpqmlouULKZoghNpYujhSpNMixVJR
|
||||
2QMXiITbthGoGF2pb9+3/9J1rvP/b9wCPr4gg1mmVcD5jeUGvqsAhkM0RhQMYIOZ
|
||||
LHWRlMDoORKpoXGih4iYyLOU5oxj3/bepGh9a7374jECwkVhU7Z8EPr4cLnaM2E7
|
||||
ALlrfBzsJUhXa0xYYLGooHKQnN1lnS2WEx+jI89VCE/PVJ46efoXOyhwOP0osUyu
|
||||
gI+Ya3z18H2JHqRkFiFy6YX10tFUtVOQN45wGXfFgcOPKz3okdyadC+mY5Wldy/N
|
||||
c1deau7s8+630h8Fy4eHakVLroydYrV8bLVVRiqG00WSyUrKvt6SUSsSQ21eqmEY
|
||||
H2RO4haHj9jD+w8vfmVAAzWS582tv65IJAMIlIPPPBE71XrlwcryLRSX1Bk4js1G
|
||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s2rk
|
||||
0Yr40lbNyRuR/93g5sHdDFNUE0RdLK02Vex4h/547dgJeRkZGl268DPgglBjC7Wu
|
||||
QSSPyl+oL9e3dsuf/uZdf0ypsx2ILla7fv3Z9XVIpmg3gR2yrQZW693tNGW3du37
|
||||
lz9x4iP8QGZgdqra4uP1KifxZxbUxMuEUynq2Wm6ULlidu2ZOxP09fcgT9io6qqo
|
||||
pjpaDE3Mx9277VsclNGzdu2YrEh9wiD6kV1qEiEP8e4Fq7asnM8d4nvGzVxh17s/
|
||||
YTv4d1CA3Jsh7Z+e24CByi274bS04Hhper02Xs3bEVuEBg8vG+y5KEtSCyLGq36N
|
||||
cD7Ndl7tyyboJ3siSuBbadu3fvfSRz7969e3aAuNYl3p2wfPzv8P1lq+7fuicjM0
|
||||
uHrBY+XFbGvp2bEifhPi7EtnXr1u3bd2zdumXLxvsTVy7/3vX8/LLlq9Zu2b4nMy
|
||||
MT/Z+ZuW/nlk2TdK/gqsS1a9dtROv++9cmrky49fp+fNmyhMR1SO579+3ZvXP7ln
|
||||
WJCZN2e2VCwt2JeN29MmHZ9677x5ctT0gEwW/cuGnd2vtWLb9pUlcCXsuXfbufXg
|
||||
Y/u3LlqpXw103fre/WjbD+HzRGTE72Fay5AAAAAElFTkSuQmCC
|
||||
`
|
162
goMetrix/app.wasm/echarts.go
Normal file
162
goMetrix/app.wasm/echarts.go
Normal file
@@ -0,0 +1,162 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"Toolbox/goDataverseStrict/metrics"
|
||||
"errors"
|
||||
"syscall/js"
|
||||
|
||||
"git.archium.org/archium_public/ebkTools/wasm"
|
||||
archiumwasm "git.archium.org/archium_public/ebkTools/wasm"
|
||||
)
|
||||
|
||||
const ca0 = `<canvas id="barChart"></canvas>`
|
||||
|
||||
const insebody0 = ` const ctx = document.getElementById('barChart');
|
||||
|
||||
//var labelsa = ['A','B','C','D','E','F','G','H'];
|
||||
//var dataaa = [860,1140,1060,1060,1070,1110,1330,2210,7830,2478];
|
||||
//var dataab = [1600,1700,1700,1900,2000,2700,4000,5000,6000,7000];
|
||||
|
||||
var dataa = {
|
||||
labels: [], //labelsa,
|
||||
datasets: [{
|
||||
label: "Gesamtanzahl",
|
||||
data: [], //[1,11,10,60,10,70,111,13],
|
||||
borderColor: "red",
|
||||
backgroundColor: "red",
|
||||
borderWidth: 1,
|
||||
fill: true
|
||||
},{
|
||||
label: "Differenz",
|
||||
data: [], //[16,17,17,19,20,27,40,50],
|
||||
borderColor: "blue",
|
||||
backgroundColor: "blue",
|
||||
borderWidth: 1,
|
||||
fill: false
|
||||
}]
|
||||
};
|
||||
|
||||
|
||||
var fubagchart = new Chart(ctx, {
|
||||
type: 'bar',
|
||||
data: dataa,
|
||||
options: {
|
||||
scales: {
|
||||
y: {
|
||||
beginAtZero: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
`
|
||||
|
||||
func helpTpGetLevelStatus(injectpoint js.Value, meisleisz *[]metrics.OneJumpPointSet, level int8) (result0 []wasm.Checkerboard, result1 string) {
|
||||
a, _ := metrics.FilterStacklist(*meisleisz, level)
|
||||
var b []string
|
||||
for _, v := range a {
|
||||
b = append(b, metrics.IDRequestCriteriaPrefix+v)
|
||||
}
|
||||
|
||||
result0 = wasm.GetStatusFromBulkOfIds(injectpoint, b)
|
||||
|
||||
for _, v := range wasm.GetStatusFromBulkOfIds(injectpoint, b) {
|
||||
if v.Checked {
|
||||
result1 = v.Value
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (gothis *lokalRequestType) changeTicker(s string, l int8) {
|
||||
dombase := js.Global().Get("document")
|
||||
|
||||
//closureGetIdWhichJustChanged := getIdWhichJustChanged()
|
||||
//log.Println("DIE BACK:", s, l)
|
||||
//s, l := closureGetIdWhichJustChanged(dombase, metrics.OneJumpPoints)
|
||||
|
||||
//FIXME: Aktivierung und Deaktivierung von Datensätzen pro Level funktioniert nicht mehr!? Neu machen, im Moment ignoriere ich das, damit Elfrun arbeiten kann.
|
||||
actualizeForms(dombase, metrics.OneJumpPoints, int8(l), s)
|
||||
//actualizeForms(dombase, metrics.OneJumpPoints, 2, s)
|
||||
|
||||
}
|
||||
|
||||
func (gothis *lokalRequestType) pseudoSubmit(jsthis js.Value, args []js.Value) any {
|
||||
dombase := js.Global().Get("document")
|
||||
|
||||
gothis.Level0MetricsType, gothis.Level1MetricsDataCountType, gothis.Level2SearchType, gothis.Level21UserInput, gothis.Level3ReturnformatType = func() string {
|
||||
_, b := helpTpGetLevelStatus(dombase, &metrics.OneJumpPoints, 0)
|
||||
return b
|
||||
}(),
|
||||
func() string {
|
||||
_, b := helpTpGetLevelStatus(dombase, &metrics.OneJumpPoints, 1)
|
||||
return b
|
||||
}(),
|
||||
func() string {
|
||||
_, b := helpTpGetLevelStatus(dombase, &metrics.OneJumpPoints, 2)
|
||||
return b
|
||||
}(),
|
||||
func() string {
|
||||
_, b := helpTpGetLevelStatus(dombase, &metrics.OneJumpPoints, 2)
|
||||
switch b {
|
||||
case string(metrics.ST1total):
|
||||
return ""
|
||||
default:
|
||||
//case string(metrics.ST2_tomonth):
|
||||
//case string(metrics.ST3_pastdays):
|
||||
//case string(metrics.ST4_monthly):
|
||||
//case string(metrics.ST5_tree):
|
||||
return dombase.Call(archiumwasm.DOCUMENTS_METHOD_getElementById, metrics.IDRequestTextPrefix+b).Get("value").String()
|
||||
}
|
||||
}(),
|
||||
func() string {
|
||||
_, b := helpTpGetLevelStatus(dombase, &metrics.OneJumpPoints, 3)
|
||||
return b
|
||||
}()
|
||||
|
||||
//triggerResultprintation(metrics.MetricsType(checked_type), metrics.ReturnformatType(checked_result), newcheckers, bodyInject)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func removeAllDataGo(this js.Value, args []js.Value) interface{} {
|
||||
chart := args[0]
|
||||
//log.Println(len(args))
|
||||
//log.Printf("%v\n", args)
|
||||
//_ = js.Global().Call("alert", countDatasets)
|
||||
|
||||
for datasetCounter, countDatasets, countDatas := 0, chart.Get("data").Get("datasets").Index(0).Get("data").Get("length").Int(), chart.Get("data").Get("datasets").Get("length").Int(); datasetCounter < countDatasets; datasetCounter++ {
|
||||
|
||||
chart.Get("data").Get("labels").Call("pop")
|
||||
|
||||
for i := 0; i < countDatas; i++ {
|
||||
chart.Get("data").Get("datasets").Index(i).Get("data").Call("pop")
|
||||
}
|
||||
}
|
||||
|
||||
chart.Call("update")
|
||||
return nil
|
||||
}
|
||||
|
||||
func addAllDataGo(this js.Value, args []js.Value) any {
|
||||
chart, newdata := args[0], args[1]
|
||||
|
||||
var numberOfValues int
|
||||
|
||||
if numberOfValues = newdata.Index(0).Get("length").Int(); numberOfValues != newdata.Index(0).Get("length").Int() || numberOfValues != newdata.Index(2).Get("length").Int() {
|
||||
return errors.New("Inconsistent input data array!")
|
||||
} else {
|
||||
for i := 0; i < numberOfValues; i++ {
|
||||
chart.Get("data").Get("labels").Call("push", newdata.Index(0).Index(i))
|
||||
chart.Get("data").Get("datasets").Index(0).Get("data").Call("push", newdata.Index(1).Index(i))
|
||||
chart.Get("data").Get("datasets").Index(1).Get("data").Call("push", newdata.Index(2).Index(i))
|
||||
}
|
||||
|
||||
//log.Println(chart, newdata)
|
||||
//log.Println(newdata.Index(0), newdata.Index(0).Index(0))
|
||||
|
||||
chart.Call("update")
|
||||
return nil
|
||||
}
|
||||
}
|
252
goMetrix/app.wasm/main.go
Normal file
252
goMetrix/app.wasm/main.go
Normal file
@@ -0,0 +1,252 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"strings"
|
||||
"syscall/js"
|
||||
"time"
|
||||
|
||||
"Toolbox/goDataverseStrict/metrics"
|
||||
|
||||
"git.archium.org/archium_public/ebkTools/wasm"
|
||||
archiumwasm "git.archium.org/archium_public/ebkTools/wasm"
|
||||
//_ nwa "git.archium.org/archium_public/ebkTools/nhooyrioWebsocketAddons"
|
||||
//"Toolbox/goDataverseStrict/metrics"
|
||||
)
|
||||
|
||||
// Setze und lese aus ID
|
||||
const (
|
||||
//ENHANCErecords = false
|
||||
//ENHANCEebenen = false
|
||||
DEBUG = true
|
||||
LOOPTAKT = "0.6s" //Kontschi sagt "0.7s"
|
||||
PDPURL = "https://pdp.archium.org" //"http://localhost:8080"
|
||||
SPANSEPARATOR = "bis"
|
||||
)
|
||||
|
||||
/*
|
||||
var signal = make(chan int)
|
||||
|
||||
func keepAlive() {
|
||||
for {
|
||||
<-signal
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func getIdWhichJustChanged() func(js.Value, []metrics.OneJumpPointSet) (string, int8) {
|
||||
var oldIds, newIds []wasm.Checkerboard
|
||||
|
||||
internalClosureFunction := func(injectpoint js.Value, ojpsdata []metrics.OneJumpPointSet) (string, int8) {
|
||||
var founditS string
|
||||
var founditI int8 = -1 //Default
|
||||
|
||||
var tmpIdsS []string
|
||||
var tmpIdsI []int8
|
||||
|
||||
for l := int8(0); l <= 3; l++ {
|
||||
a, _ := metrics.FilterStacklist(ojpsdata, l)
|
||||
|
||||
for _, v := range a {
|
||||
tmpIdsS = append(tmpIdsS, metrics.IDRequestCriteriaPrefix+v)
|
||||
tmpIdsI = append(tmpIdsI, l)
|
||||
}
|
||||
}
|
||||
|
||||
//log.Println(tmpIdsS)
|
||||
newIds = wasm.GetStatusFromBulkOfIds(injectpoint, tmpIdsS)
|
||||
|
||||
if len(oldIds) > 0 && !reflect.DeepEqual(oldIds, newIds) {
|
||||
for i, n := range newIds {
|
||||
if oldIds[i].Checked != n.Checked && !oldIds[i].Checked && n.Checked { //newIds[i].Checked
|
||||
founditS = strings.TrimPrefix(n.Id, metrics.IDRequestCriteriaPrefix)
|
||||
founditI = tmpIdsI[i]
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
oldIds = newIds
|
||||
|
||||
return founditS, founditI
|
||||
|
||||
}
|
||||
return internalClosureFunction
|
||||
}
|
||||
|
||||
func barseTuration(s string) time.Duration {
|
||||
d, err := time.ParseDuration(s)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
var (
|
||||
dombase, bodyInject, scriptarea, chartarea, submitbutton js.Value
|
||||
//dombase, body, body2, butt, , bodyDatabase, bodyTectonics, js.Value
|
||||
|
||||
/*TODO: WICHTIG nicht löschen
|
||||
oldcheckers, newcheckers []archiumwasm.Checkerboard
|
||||
checked_type, oldchecked_type, checked_result string
|
||||
*/
|
||||
)
|
||||
|
||||
closureGetIdWhichJustChanged := getIdWhichJustChanged()
|
||||
|
||||
//log.Println("started")
|
||||
|
||||
//connectionReceive, _, errReceive := websocket.Dial(ctx, "ws://"+configs["websockeIp"]+":"+configs["websocketPort0S"], nil)
|
||||
//connectionSend, _, errSend := websocket.Dial(ctx, "ws://"+configs["websockeIp"]+":"+configs["websocketPort1R"], nil)
|
||||
|
||||
dombase = js.Global().Get("document")
|
||||
|
||||
//bodyDatabase = dombase.Call("getElementById", vectorIdDatabase) //.Index(0)
|
||||
//bodyTectonics = dombase.Call("getElementById", vectorIdDescription)
|
||||
bodyInject = dombase.Call(wasm.DOCUMENTS_METHOD_getElementById, "injectarea")
|
||||
scriptarea = dombase.Call(wasm.DOCUMENTS_METHOD_getElementById, "scriptarea")
|
||||
//formarea = dombase.Call("getElementById", "formarea")
|
||||
//testarea = dombase.Call(wasm.DOCUMENTS_METHOD_getElementById, "testarea")
|
||||
|
||||
chartarea = dombase.Call(archiumwasm.DOCUMENTS_METHOD_getElementById, "chartarea")
|
||||
submitbutton = dombase.Call(archiumwasm.DOCUMENTS_METHOD_getElementById, metrics.IDFormSubmit)
|
||||
|
||||
var oldPseudoSubmitData, pseudoSubmitData lokalRequestType
|
||||
|
||||
//butt = dombase.Call("getElementById", "runButton")
|
||||
//lmog.Println(butt)
|
||||
|
||||
// tmpRohtext := bodyDatabase.Get("innerText").String()
|
||||
//tmpRohtextTectonics := bodyTectonics.Get("innerText").String()
|
||||
|
||||
//bodyInject.Set("innerText", fmt.Sprintf("%v", os.Args))
|
||||
|
||||
if DEBUG { // Zeige Pinguin als Zeichen dafür, daß das Programm vollständig durchlaufen wurde
|
||||
image := dombase.Call("createElement", "img")
|
||||
image.Set("src", "data:image/png;base64,"+imageByteArrayAsBase64)
|
||||
bodyInject.Call("appendChild", image)
|
||||
}
|
||||
|
||||
//image2 := dombase.Call("createElement", "img")
|
||||
//image2.Set("src", "data:image/png;base64,"+imageByteArrayAsBase64)
|
||||
//body2.Call("appendChild", image)
|
||||
|
||||
//js.Global().Get("console").Call("log", "Just another way to send a string to console-log!")
|
||||
//js.Global().Get("document").Call("getElementsByTagName", "body").Index(0).Set("innerText", time.Now().String())
|
||||
|
||||
//keepAlive()
|
||||
/*
|
||||
fmt.Println("HIER")
|
||||
fmt.Println(js.Global().Get("dataaa").Index(1))
|
||||
fmt.Println("BIER")
|
||||
fmt.Println(windowbase.Get("dataaa"))
|
||||
|
||||
dataaaJS := windowbase.Get("dataaa")
|
||||
var bb []byte
|
||||
fmt.Println(dataaaJS)
|
||||
fmt.Println(bb)
|
||||
|
||||
// windowbase.Set("dataaa", js.ValueOf([]interface{}{1, 2, 3, 4, 5, 6, 7, 9}))
|
||||
fmt.Println("GIER")
|
||||
*/
|
||||
//chartarea.Set("innerHTML", "")
|
||||
chartarea.Set("innerHTML", ca0)
|
||||
scriptarea.Set("innerHTML", insebody0)
|
||||
|
||||
js.Global().Set("removeAllData", js.FuncOf(removeAllDataGo))
|
||||
js.Global().Set("addAllData", js.FuncOf(addAllDataGo))
|
||||
js.Global().Set("pseudoSubmit", js.FuncOf(pseudoSubmitData.pseudoSubmit))
|
||||
//log.Println( submitbutton Set("onclick", "pseudoSubmit"))
|
||||
submitbutton.Call(archiumwasm.ELEMENTS_METHOD_setAttribute, "onclick", "pseudoSubmit()")
|
||||
|
||||
/*TODO: WICHTIG nicht löschen
|
||||
_, _, checked_result = archiumwasm.GetCheckedRadioOrCheckbox(dombase.Call(archiumwasm.DOCUMENTS_METHOD_getElementsByName, "form_results_radio")) //Ändert sich nach neuer Arbeitsweise ja nicht mehr.
|
||||
var firstTimeEqual bool
|
||||
*/
|
||||
|
||||
for ; true; time.Sleep(barseTuration(LOOPTAKT)) {
|
||||
s, l := closureGetIdWhichJustChanged(dombase, metrics.OneJumpPoints)
|
||||
|
||||
//log.Println("Websocket loop started")
|
||||
|
||||
//botz := dombase.Call("getElementById", "input_"+string(metrics.MT1dataverses))
|
||||
//botz := dombase.Call("getElementById", "form_types") //.Get("innerHTML")
|
||||
//dombase.Call("getElementById", "form_types")
|
||||
//botz.Call("createAttribute", "checked")
|
||||
//botz.Call("setAttribute", "checked", "true")
|
||||
//fmt.Println(botz.Call("getAttribute", "checked").String())
|
||||
|
||||
// log.Println(botz.Index(0).Get("checked"))
|
||||
// log.Println(botz.Index(1).Get("checked"))
|
||||
// log.Println(botz.Index(2).IsUndefined())
|
||||
|
||||
//log.Println(dombase.Call(archiumwasm.DOCUMENTS_METHOD_getElementById, "input_"+string(metrics.ST1_total)).Get("value").String())
|
||||
|
||||
/*FIXME: Wichtig Nicht löschen
|
||||
|
||||
_, _, checked_type = archiumwasm.GetCheckedRadioOrCheckbox(dombase.Call(archiumwasm.DOCUMENTS_METHOD_getElementsByName, "form_types_radio"))
|
||||
newcheckers = archiumwasm.GetStatusFromBulkOfIds(dombase, []string{
|
||||
//"input_" + string(metrics.MT1dataverses),
|
||||
//"input_" + string(metrics.MT2datasets),
|
||||
//"input_" + string(metrics.MT3files),
|
||||
//"input_" + string(metrics.MT4downloads),
|
||||
//"input_" + string(metrics.MT5filedownloads),
|
||||
//"input_" + string(metrics.MT6uniquefiledownloads),
|
||||
//"input_" + string(metrics.RT1json),
|
||||
//"input_" + string(metrics.RT2csv),
|
||||
"input_" + string(metrics.ST1_total),
|
||||
"input_" + string(metrics.ST2_tomonth),
|
||||
"input_" + string(metrics.ST3_pastdays),
|
||||
"input_" + string(metrics.ST4_monthly),
|
||||
"input_" + string(metrics.ST5_tree),
|
||||
})
|
||||
*/
|
||||
|
||||
//dombase.Call("getElementById", metrics.IDRequestCriteriaPrefix+metrics.MT1dataverses).Call("setAttribute", "checked", "true")
|
||||
//wasm.GetStatusFromBulkOfIds(dombase, metrics.FilterStacklist(metrics.OneJumpPoints, 0))
|
||||
|
||||
//testarea.Set("innerHTML", fmt.Sprintf("OneJumpPointSet: %v<br><br>", "TEST"))
|
||||
|
||||
//log.Println(oldcheckers)
|
||||
//log.Println(newcheckers)
|
||||
//log.Println(reflect.DeepEqual(oldcheckers, newcheckers))
|
||||
|
||||
/*TODO: Wichtig nicht löschen
|
||||
if reflect.DeepEqual(oldcheckers, newcheckers) && oldchecked_type == checked_type {
|
||||
if !firstTimeEqual {
|
||||
firstTimeEqual = true
|
||||
|
||||
//_, _, checked_type = archiumwasm.GetCheckedRadioOrCheckbox(dombase.Call(archiumwasm.DOCUMENTS_METHOD_getElementsByName, "form_types_radio"))
|
||||
//_, _, checked_result = archiumwasm.GetCheckedRadioOrCheckbox(dombase.Call(archiumwasm.DOCUMENTS_METHOD_getElementsByName, "form_results_radio"))
|
||||
|
||||
triggerResultprintation(metrics.MetricsType(checked_type), metrics.ReturnformatType(checked_result), newcheckers, bodyInject)
|
||||
|
||||
}
|
||||
//windowbase.Set("dataaa", js.ValueOf([]interface{}{9, 2, 3, 8, 5, 6, 2, 1}))
|
||||
// _ = windowbase.Get("fubagchart").Call("update", "")
|
||||
} else {
|
||||
oldcheckers = newcheckers
|
||||
oldchecked_type = checked_type
|
||||
firstTimeEqual = false
|
||||
//scriptarea.Set("innerHTML", insebody0)
|
||||
|
||||
//dataaaJS := windowbase.Get("fubagchart")
|
||||
//_ = dataaaJS.Call("update", "")
|
||||
|
||||
//_ =js.Global().Call("alert", 123)
|
||||
//windowbase.Set("dataaa", js.ValueOf([]interface{}{1, 2, 3, 4, 5, 6, 7, 9}))
|
||||
//_ = windowbase.Get("fubagchart").Call("update", "")
|
||||
}
|
||||
*/
|
||||
|
||||
pseudoSubmitData.changeTicker(s, l)
|
||||
|
||||
if !reflect.DeepEqual(oldPseudoSubmitData, pseudoSubmitData) {
|
||||
pseudoSubmitData.triggerResultprintationGedöhnz(bodyInject)
|
||||
}
|
||||
oldPseudoSubmitData = pseudoSubmitData
|
||||
}
|
||||
|
||||
}
|
267
goMetrix/app.wasm/output.go
Normal file
267
goMetrix/app.wasm/output.go
Normal file
@@ -0,0 +1,267 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"Toolbox/goDataverseStrict/metrics"
|
||||
"fmt"
|
||||
"log"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall/js"
|
||||
"time"
|
||||
|
||||
"git.archium.org/archium_public/ebkTools/wasm"
|
||||
)
|
||||
|
||||
type lokalRequestType metrics.RequestComponentsType
|
||||
|
||||
func metricsSelectDispatcher(server_url, api_token string, rcs metrics.RequestComponentsType) (mdat []byte, mres string) {
|
||||
var err error
|
||||
var mtypeOrMdctypeCombi string
|
||||
|
||||
//var header map[string]string
|
||||
header := make(map[string]string)
|
||||
|
||||
if len(api_token) > 0 {
|
||||
header["X-Dataverse-key"] = api_token
|
||||
}
|
||||
if len(rcs.Level3ReturnformatType) > 0 {
|
||||
header["Accept"] = string(rcs.Level3ReturnformatType)
|
||||
}
|
||||
|
||||
switch rcs.Level0MetricsType {
|
||||
case string(metrics.MT7makeDataCount):
|
||||
mtypeOrMdctypeCombi = rcs.Level0MetricsType + "/" + rcs.Level1MetricsDataCountType
|
||||
default:
|
||||
mtypeOrMdctypeCombi = rcs.Level0MetricsType
|
||||
}
|
||||
|
||||
switch rcs.Level2SearchType {
|
||||
case string(metrics.ST1total):
|
||||
mdat, mres = metrics.MetricsTotal(PDPURL, "", metrics.ReturnformatType(rcs.Level3ReturnformatType), mtypeOrMdctypeCombi)
|
||||
case string(metrics.ST2tomonth):
|
||||
ts, _ := time.Parse("2006-01", rcs.Level21UserInput)
|
||||
mdat, mres = metrics.MetricsToMonth(PDPURL, "", metrics.ReturnformatType(rcs.Level3ReturnformatType), mtypeOrMdctypeCombi, ts)
|
||||
case string(metrics.ST3pastdays):
|
||||
mdat, mres = metrics.MetricsPastDays(PDPURL, "", metrics.ReturnformatType(rcs.Level3ReturnformatType), mtypeOrMdctypeCombi, func() int {
|
||||
r, _ := strconv.Atoi(rcs.Level21UserInput)
|
||||
return r
|
||||
}())
|
||||
case string(metrics.ST4monthly):
|
||||
if len(rcs.Level21UserInput) >= 17 && strings.ContainsAny(strings.ToLower(rcs.Level21UserInput), strings.ToLower(SPANSEPARATOR)) {
|
||||
ts := func(s string) [2]time.Time {
|
||||
defer recover()
|
||||
rowvalues := make([]string, 2, 2)
|
||||
rowvalues = strings.SplitN(s, strings.ToLower(SPANSEPARATOR), 2)
|
||||
|
||||
return [2]time.Time{func() (r time.Time) {
|
||||
r, _ = time.Parse("2006-01", strings.TrimSpace(rowvalues[0]))
|
||||
return
|
||||
}(), func() (r time.Time) {
|
||||
r, _ = time.Parse("2006-01", strings.TrimSpace(rowvalues[1]))
|
||||
return
|
||||
}()}
|
||||
}(strings.ToLower(rcs.Level21UserInput))
|
||||
|
||||
mdat, mres = metrics.MetricsReallyMonthlySpan(PDPURL, "", metrics.ReturnformatType(rcs.Level3ReturnformatType), mtypeOrMdctypeCombi, ts)
|
||||
} else {
|
||||
mdat, mres = metrics.MetricsReallyMonthly(PDPURL, "", metrics.ReturnformatType(rcs.Level3ReturnformatType), mtypeOrMdctypeCombi)
|
||||
}
|
||||
case string(metrics.ST5tree):
|
||||
ts, _ := time.Parse("2006-01", rcs.Level21UserInput)
|
||||
mdat, mres = metrics.MetricsTree(PDPURL, "", metrics.ReturnformatType(rcs.Level3ReturnformatType), ts)
|
||||
}
|
||||
|
||||
//log.Println("DEBUG:", mtypeOrMdctypeCombi)
|
||||
|
||||
//res := metrics.MonthlyJsonData{}
|
||||
//json.Unmarshal([]byte(data), &res)
|
||||
//log.Println("TIE BREAK", metrics.JsonStructSelector(mdat))
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *lokalRequestType) triggerResultprintationGedöhnz(injectpoint js.Value) {
|
||||
|
||||
injectpoint.Set("innerHTML", fmt.Sprintf("%v<br>%v<br>%v %v<br>%v<br><br>", this.Level0MetricsType, this.Level1MetricsDataCountType, this.Level2SearchType, this.Level21UserInput, this.Level3ReturnformatType))
|
||||
|
||||
data, request := metricsSelectDispatcher(PDPURL, "", metrics.RequestComponentsType(*this))
|
||||
|
||||
//res := metrics.MonthlyJsonData{}
|
||||
//log.Println(json.Unmarshal(data, &res))
|
||||
//fmt.Println(res)
|
||||
|
||||
htmlstring := fmt.Sprintf("DIE BAQUE %s<br> %s<br><br>", request, data)
|
||||
//log.Println("DIE BAQUE", htmlstring)
|
||||
|
||||
//res := metrics.MonthlyJsonData{}
|
||||
//json.Unmarshal([]byte(data), &res)
|
||||
//log.Println("TIE BREAK", metrics.LinkifyDoiDoi(data))
|
||||
|
||||
//https://planetary-data-portal.org/file.xhtml?persistentId=
|
||||
|
||||
//var htmlstring string
|
||||
//windowbase := js.Global().Get("window")
|
||||
|
||||
injectpoint.Set("innerHTML", time.Now().String()+"<br>"+htmlstring)
|
||||
//res := metrics.MonthlyJsonData{}
|
||||
/*
|
||||
|
||||
json.Unmarshal(md, &res)
|
||||
|
||||
label := make([]interface{}, len(res.Data), len(res.Data))
|
||||
bar0 := make([]any, len(res.Data), len(res.Data))
|
||||
bar1 := make([]any, len(res.Data), len(res.Data))
|
||||
for i := 0; i < len(res.Data); i++ {
|
||||
label[i] = res.Data[i].Date
|
||||
bar0[i] = res.Data[i].Counttotal
|
||||
bar1[i] = res.Data[i].Countmonth
|
||||
}
|
||||
//log.Println(res.Data[0].)
|
||||
|
||||
_ = windowbase.Call("removeAllData", windowbase.Get("fubagchart"))
|
||||
//_ = windowbase.Call("addAllData", windowbase.Get("fubagchart"), js.ValueOf([]interface{}{[]interface{}{"Aa", "Bb"}, []interface{}{9, 2}, []interface{}{2, 9}}))
|
||||
|
||||
_ = windowbase.Call("addAllData", windowbase.Get("fubagchart"), js.ValueOf([]interface{}{label, bar0, bar1}))
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
func triggerResultprintation(teip metrics.MetricsType, riesaltformat metrics.ReturnformatType, deineCheckers []archiumwasm.Checkerboard, injectpoint js.Value) {
|
||||
|
||||
var htmlstring string
|
||||
var windowbase js.Value
|
||||
|
||||
windowbase = js.Global().Get("window")
|
||||
|
||||
for _, v := range deineCheckers {
|
||||
if v.Disabled == false { //= the single one, that is enabled
|
||||
switch v.Id {
|
||||
case "input_" + string(metrics.ST1total):
|
||||
md, me := metrics.MetricsTotal(PDPURL, "", riesaltformat, teip)
|
||||
htmlstring = fmt.Sprintf("%s<br> %s<br><br>", me, md)
|
||||
case "input_" + string(metrics.ST2tomonth):
|
||||
ts, _ := time.Parse("2006-01", v.Value)
|
||||
md, me := metrics.MetricsToMonth(PDPURL, "", riesaltformat, teip, ts)
|
||||
htmlstring = fmt.Sprintf("%s<br> %s<br><br>", me, md)
|
||||
case "input_" + string(metrics.ST3pastdays):
|
||||
md, me := metrics.MetricsPastDays(PDPURL, "", riesaltformat, teip, func() int {
|
||||
r, _ := strconv.Atoi(v.Value)
|
||||
return r
|
||||
}())
|
||||
htmlstring = fmt.Sprintf("%s<br> %s<br><br>", me, md)
|
||||
case "input_" + string(metrics.ST4monthly):
|
||||
var me string
|
||||
var md []byte
|
||||
|
||||
if len(v.Value) >= 17 && strings.ContainsAny(strings.ToLower(v.Value), strings.ToLower(SPANSEPARATOR)) {
|
||||
ts := func(s string) [2]time.Time {
|
||||
defer recover()
|
||||
rowvalues := make([]string, 2, 2)
|
||||
rowvalues = strings.SplitN(s, strings.ToLower(SPANSEPARATOR), 2)
|
||||
|
||||
return [2]time.Time{func() (r time.Time) {
|
||||
r, _ = time.Parse("2006-01", strings.TrimSpace(rowvalues[0]))
|
||||
return
|
||||
}(), func() (r time.Time) {
|
||||
r, _ = time.Parse("2006-01", strings.TrimSpace(rowvalues[1]))
|
||||
return
|
||||
}()}
|
||||
}(strings.ToLower(v.Value))
|
||||
|
||||
md, me = metrics.MetricsReallyMonthlySpan(PDPURL, "", riesaltformat, teip, ts)
|
||||
} else {
|
||||
md, me = metrics.MetricsReallyMonthly(PDPURL, "", riesaltformat, teip)
|
||||
}
|
||||
|
||||
res := metrics.MonthlyJsonData{}
|
||||
json.Unmarshal(md, &res)
|
||||
|
||||
label := make([]interface{}, len(res.Data), len(res.Data))
|
||||
bar0 := make([]any, len(res.Data), len(res.Data))
|
||||
bar1 := make([]any, len(res.Data), len(res.Data))
|
||||
for i := 0; i < len(res.Data); i++ {
|
||||
label[i] = res.Data[i].Date
|
||||
bar0[i] = res.Data[i].Counttotal
|
||||
bar1[i] = res.Data[i].Countmonth
|
||||
}
|
||||
//log.Println(res.Data[0].)
|
||||
|
||||
_ = windowbase.Call("removeAllData", windowbase.Get("fubagchart"))
|
||||
//_ = windowbase.Call("addAllData", windowbase.Get("fubagchart"), js.ValueOf([]interface{}{[]interface{}{"Aa", "Bb"}, []interface{}{9, 2}, []interface{}{2, 9}}))
|
||||
|
||||
_ = windowbase.Call("addAllData", windowbase.Get("fubagchart"), js.ValueOf([]interface{}{label, bar0, bar1}))
|
||||
|
||||
htmlstring = fmt.Sprintf("%s<br> %s<br><br>", me, md)
|
||||
case "input_" + string(metrics.ST5tree):
|
||||
ts, _ := time.Parse("2006-01", v.Value)
|
||||
md, me := metrics.MetricsTree(PDPURL, "", riesaltformat, ts)
|
||||
htmlstring = fmt.Sprintf("%s<br> %s<br><br>", me, md)
|
||||
}
|
||||
|
||||
//md, me := metrics.MetricsTree("https://pdp.archium.org", "", metrics.RT1json, time.Time{})
|
||||
injectpoint.Set("innerHTML", time.Now().String()+"<br>"+htmlstring)
|
||||
//log.Printf("WASM: %s<br> %s<br><br>", me, md)
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func actualizeForms[dings metrics.MetricsType | metrics.MetricsDataCountType | metrics.SearchType | metrics.ReturnformatType | string](injectpoint js.Value, ojpsdata []metrics.OneJumpPointSet, startlevel int8, startindex dings) {
|
||||
//disable all
|
||||
//log.Println(startlevel)
|
||||
//log.Println("HIER")
|
||||
if startlevel >= 0 {
|
||||
for i := int8(startlevel) + 1; i <= 3; i++ {
|
||||
list, _ := metrics.FilterStacklist(ojpsdata, i)
|
||||
for _, idmark := range list {
|
||||
injectpoint.Call(wasm.DOCUMENTS_METHOD_getElementById, metrics.IDRequestCriteriaPrefix+idmark).Call(wasm.ELEMENTS_METHOD_setAttribute, "disabled", "")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
for i := 0; i < len(ojpsdata); i++ {
|
||||
log.Println(startlevel, ojpsdata[i], startindex)
|
||||
}
|
||||
*/
|
||||
|
||||
//enable any
|
||||
for i := 0; i < len(ojpsdata); i++ {
|
||||
if ojpsdata[i].Active {
|
||||
switch startlevel {
|
||||
case 0:
|
||||
injectpoint.Call(wasm.DOCUMENTS_METHOD_getElementById, metrics.IDRequestCriteriaPrefix+string(ojpsdata[i].Level0)).Call(wasm.ELEMENTS_METHOD_removeAttribute, "disabled", "")
|
||||
fallthrough
|
||||
case 1:
|
||||
if startindex == dings(ojpsdata[i].Level0) {
|
||||
injectpoint.Call(wasm.DOCUMENTS_METHOD_getElementById, metrics.IDRequestCriteriaPrefix+string(ojpsdata[i].Level1)).Call(wasm.ELEMENTS_METHOD_removeAttribute, "disabled", "")
|
||||
}
|
||||
fallthrough
|
||||
case 2:
|
||||
if startindex == dings(ojpsdata[i].Level0) || startindex == dings(ojpsdata[i].Level1) {
|
||||
injectpoint.Call(wasm.DOCUMENTS_METHOD_getElementById, metrics.IDRequestCriteriaPrefix+string(ojpsdata[i].Level2)).Call(wasm.ELEMENTS_METHOD_removeAttribute, "disabled", "")
|
||||
}
|
||||
fallthrough
|
||||
default: // ist in diesem Fall identisch mit case 3:
|
||||
if startindex == dings(ojpsdata[i].Level0) || startindex == dings(ojpsdata[i].Level1) || startindex == dings(ojpsdata[i].Level2) {
|
||||
injectpoint.Call(wasm.DOCUMENTS_METHOD_getElementById, metrics.IDRequestCriteriaPrefix+string(ojpsdata[i].Level3)).Call(wasm.ELEMENTS_METHOD_removeAttribute, "disabled", "")
|
||||
}
|
||||
}
|
||||
}
|
||||
// for idindex, idmark := range list {
|
||||
// if activity[idindex] {
|
||||
// injectpoint.Call(wasm.DOCUMENTS_METHOD_getElementById, metrics.IDRequestCriteriaPrefix+idmark).Call(wasm.ELEMENTS_METHOD_removeAttribute, "disabled", "")
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
injectpoint.Call(wasm.DOCUMENTS_METHOD_getElementById, metrics.IDRequestCriteriaPrefix+string(metrics.MDCT2viewsTotalRegular)).Call(wasm.ELEMENTS_METHOD_setAttribute, "disabled", "")
|
||||
injectpoint.Call(wasm.DOCUMENTS_METHOD_getElementById, metrics.IDRequestCriteriaPrefix+string(metrics.MDCT2viewsTotalRegular)).Call(wasm.ELEMENTS_METHOD_removeAttribute, "disabled", "")
|
||||
*/
|
||||
}
|
626
goMetrix/app.wasm/wasm_exec.js
Normal file
626
goMetrix/app.wasm/wasm_exec.js
Normal file
@@ -0,0 +1,626 @@
|
||||
// Copyright 2018 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
(() => {
|
||||
// Map multiple JavaScript environments to a single common API,
|
||||
// preferring web standards over Node.js API.
|
||||
//
|
||||
// Environments considered:
|
||||
// - Browsers
|
||||
// - Node.js
|
||||
// - Electron
|
||||
// - Parcel
|
||||
// - Webpack
|
||||
|
||||
if (typeof global !== "undefined") {
|
||||
// global already exists
|
||||
} else if (typeof window !== "undefined") {
|
||||
window.global = window;
|
||||
} else if (typeof self !== "undefined") {
|
||||
self.global = self;
|
||||
} else {
|
||||
throw new Error("cannot export Go (neither global, window nor self is defined)");
|
||||
}
|
||||
|
||||
if (!global.require && typeof require !== "undefined") {
|
||||
global.require = require;
|
||||
}
|
||||
|
||||
if (!global.fs && global.require) {
|
||||
const fs = require("fs");
|
||||
if (typeof fs === "object" && fs !== null && Object.keys(fs).length !== 0) {
|
||||
global.fs = fs;
|
||||
}
|
||||
}
|
||||
|
||||
const enosys = () => {
|
||||
const err = new Error("not implemented");
|
||||
err.code = "ENOSYS";
|
||||
return err;
|
||||
};
|
||||
|
||||
if (!global.fs) {
|
||||
let outputBuf = "";
|
||||
global.fs = {
|
||||
constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 }, // unused
|
||||
writeSync(fd, buf) {
|
||||
outputBuf += decoder.decode(buf);
|
||||
const nl = outputBuf.lastIndexOf("\n");
|
||||
if (nl != -1) {
|
||||
console.log(outputBuf.substr(0, nl));
|
||||
outputBuf = outputBuf.substr(nl + 1);
|
||||
}
|
||||
return buf.length;
|
||||
},
|
||||
write(fd, buf, offset, length, position, callback) {
|
||||
if (offset !== 0 || length !== buf.length || position !== null) {
|
||||
callback(enosys());
|
||||
return;
|
||||
}
|
||||
const n = this.writeSync(fd, buf);
|
||||
callback(null, n);
|
||||
},
|
||||
chmod(path, mode, callback) { callback(enosys()); },
|
||||
chown(path, uid, gid, callback) { callback(enosys()); },
|
||||
close(fd, callback) { callback(enosys()); },
|
||||
fchmod(fd, mode, callback) { callback(enosys()); },
|
||||
fchown(fd, uid, gid, callback) { callback(enosys()); },
|
||||
fstat(fd, callback) { callback(enosys()); },
|
||||
fsync(fd, callback) { callback(null); },
|
||||
ftruncate(fd, length, callback) { callback(enosys()); },
|
||||
lchown(path, uid, gid, callback) { callback(enosys()); },
|
||||
link(path, link, callback) { callback(enosys()); },
|
||||
lstat(path, callback) { callback(enosys()); },
|
||||
mkdir(path, perm, callback) { callback(enosys()); },
|
||||
open(path, flags, mode, callback) { callback(enosys()); },
|
||||
read(fd, buffer, offset, length, position, callback) { callback(enosys()); },
|
||||
readdir(path, callback) { callback(enosys()); },
|
||||
readlink(path, callback) { callback(enosys()); },
|
||||
rename(from, to, callback) { callback(enosys()); },
|
||||
rmdir(path, callback) { callback(enosys()); },
|
||||
stat(path, callback) { callback(enosys()); },
|
||||
symlink(path, link, callback) { callback(enosys()); },
|
||||
truncate(path, length, callback) { callback(enosys()); },
|
||||
unlink(path, callback) { callback(enosys()); },
|
||||
utimes(path, atime, mtime, callback) { callback(enosys()); },
|
||||
};
|
||||
}
|
||||
|
||||
if (!global.process) {
|
||||
global.process = {
|
||||
getuid() { return -1; },
|
||||
getgid() { return -1; },
|
||||
geteuid() { return -1; },
|
||||
getegid() { return -1; },
|
||||
getgroups() { throw enosys(); },
|
||||
pid: -1,
|
||||
ppid: -1,
|
||||
umask() { throw enosys(); },
|
||||
cwd() { throw enosys(); },
|
||||
chdir() { throw enosys(); },
|
||||
}
|
||||
}
|
||||
|
||||
if (!global.crypto && global.require) {
|
||||
const nodeCrypto = require("crypto");
|
||||
global.crypto = {
|
||||
getRandomValues(b) {
|
||||
nodeCrypto.randomFillSync(b);
|
||||
},
|
||||
};
|
||||
}
|
||||
if (!global.crypto) {
|
||||
throw new Error("global.crypto is not available, polyfill required (getRandomValues only)");
|
||||
}
|
||||
|
||||
if (!global.performance) {
|
||||
global.performance = {
|
||||
now() {
|
||||
const [sec, nsec] = process.hrtime();
|
||||
return sec * 1000 + nsec / 1000000;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
if (!global.TextEncoder && global.require) {
|
||||
global.TextEncoder = require("util").TextEncoder;
|
||||
}
|
||||
if (!global.TextEncoder) {
|
||||
throw new Error("global.TextEncoder is not available, polyfill required");
|
||||
}
|
||||
|
||||
if (!global.TextDecoder && global.require) {
|
||||
global.TextDecoder = require("util").TextDecoder;
|
||||
}
|
||||
if (!global.TextDecoder) {
|
||||
throw new Error("global.TextDecoder is not available, polyfill required");
|
||||
}
|
||||
|
||||
// End of polyfills for common API.
|
||||
|
||||
const encoder = new TextEncoder("utf-8");
|
||||
const decoder = new TextDecoder("utf-8");
|
||||
|
||||
global.Go = class {
|
||||
constructor() {
|
||||
this.argv = ["js"];
|
||||
this.env = {};
|
||||
this.exit = (code) => {
|
||||
if (code !== 0) {
|
||||
console.warn("exit code:", code);
|
||||
}
|
||||
};
|
||||
this._exitPromise = new Promise((resolve) => {
|
||||
this._resolveExitPromise = resolve;
|
||||
});
|
||||
this._pendingEvent = null;
|
||||
this._scheduledTimeouts = new Map();
|
||||
this._nextCallbackTimeoutID = 1;
|
||||
|
||||
const setInt64 = (addr, v) => {
|
||||
this.mem.setUint32(addr + 0, v, true);
|
||||
this.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);
|
||||
}
|
||||
|
||||
const getInt64 = (addr) => {
|
||||
const low = this.mem.getUint32(addr + 0, true);
|
||||
const high = this.mem.getInt32(addr + 4, true);
|
||||
return low + high * 4294967296;
|
||||
}
|
||||
|
||||
const loadValue = (addr) => {
|
||||
const f = this.mem.getFloat64(addr, true);
|
||||
if (f === 0) {
|
||||
return undefined;
|
||||
}
|
||||
if (!isNaN(f)) {
|
||||
return f;
|
||||
}
|
||||
|
||||
const id = this.mem.getUint32(addr, true);
|
||||
return this._values[id];
|
||||
}
|
||||
|
||||
const storeValue = (addr, v) => {
|
||||
const nanHead = 0x7FF80000;
|
||||
|
||||
if (typeof v === "number" && v !== 0) {
|
||||
if (isNaN(v)) {
|
||||
this.mem.setUint32(addr + 4, nanHead, true);
|
||||
this.mem.setUint32(addr, 0, true);
|
||||
return;
|
||||
}
|
||||
this.mem.setFloat64(addr, v, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (v === undefined) {
|
||||
this.mem.setFloat64(addr, 0, true);
|
||||
return;
|
||||
}
|
||||
|
||||
let id = this._ids.get(v);
|
||||
if (id === undefined) {
|
||||
id = this._idPool.pop();
|
||||
if (id === undefined) {
|
||||
id = this._values.length;
|
||||
}
|
||||
this._values[id] = v;
|
||||
this._goRefCounts[id] = 0;
|
||||
this._ids.set(v, id);
|
||||
}
|
||||
this._goRefCounts[id]++;
|
||||
let typeFlag = 0;
|
||||
switch (typeof v) {
|
||||
case "object":
|
||||
if (v !== null) {
|
||||
typeFlag = 1;
|
||||
}
|
||||
break;
|
||||
case "string":
|
||||
typeFlag = 2;
|
||||
break;
|
||||
case "symbol":
|
||||
typeFlag = 3;
|
||||
break;
|
||||
case "function":
|
||||
typeFlag = 4;
|
||||
break;
|
||||
}
|
||||
this.mem.setUint32(addr + 4, nanHead | typeFlag, true);
|
||||
this.mem.setUint32(addr, id, true);
|
||||
}
|
||||
|
||||
const loadSlice = (addr) => {
|
||||
const array = getInt64(addr + 0);
|
||||
const len = getInt64(addr + 8);
|
||||
return new Uint8Array(this._inst.exports.mem.buffer, array, len);
|
||||
}
|
||||
|
||||
const loadSliceOfValues = (addr) => {
|
||||
const array = getInt64(addr + 0);
|
||||
const len = getInt64(addr + 8);
|
||||
const a = new Array(len);
|
||||
for (let i = 0; i < len; i++) {
|
||||
a[i] = loadValue(array + i * 8);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
const loadString = (addr) => {
|
||||
const saddr = getInt64(addr + 0);
|
||||
const len = getInt64(addr + 8);
|
||||
return decoder.decode(new DataView(this._inst.exports.mem.buffer, saddr, len));
|
||||
}
|
||||
|
||||
const timeOrigin = Date.now() - performance.now();
|
||||
this.importObject = {
|
||||
go: {
|
||||
// Go's SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)
|
||||
// may synchronously trigger a Go event handler. This makes Go code get executed in the middle of the imported
|
||||
// function. A goroutine can switch to a new stack if the current stack is too small (see morestack function).
|
||||
// This changes the SP, thus we have to update the SP used by the imported function.
|
||||
|
||||
// func wasmExit(code int32)
|
||||
"runtime.wasmExit": (sp) => {
|
||||
sp >>>= 0;
|
||||
const code = this.mem.getInt32(sp + 8, true);
|
||||
this.exited = true;
|
||||
delete this._inst;
|
||||
delete this._values;
|
||||
delete this._goRefCounts;
|
||||
delete this._ids;
|
||||
delete this._idPool;
|
||||
this.exit(code);
|
||||
},
|
||||
|
||||
// func wasmWrite(fd uintptr, p unsafe.Pointer, n int32)
|
||||
"runtime.wasmWrite": (sp) => {
|
||||
sp >>>= 0;
|
||||
const fd = getInt64(sp + 8);
|
||||
const p = getInt64(sp + 16);
|
||||
const n = this.mem.getInt32(sp + 24, true);
|
||||
fs.writeSync(fd, new Uint8Array(this._inst.exports.mem.buffer, p, n));
|
||||
},
|
||||
|
||||
// func resetMemoryDataView()
|
||||
"runtime.resetMemoryDataView": (sp) => {
|
||||
sp >>>= 0;
|
||||
this.mem = new DataView(this._inst.exports.mem.buffer);
|
||||
},
|
||||
|
||||
// func nanotime1() int64
|
||||
"runtime.nanotime1": (sp) => {
|
||||
sp >>>= 0;
|
||||
setInt64(sp + 8, (timeOrigin + performance.now()) * 1000000);
|
||||
},
|
||||
|
||||
// func walltime1() (sec int64, nsec int32)
|
||||
"runtime.walltime1": (sp) => {
|
||||
sp >>>= 0;
|
||||
const msec = (new Date).getTime();
|
||||
setInt64(sp + 8, msec / 1000);
|
||||
this.mem.setInt32(sp + 16, (msec % 1000) * 1000000, true);
|
||||
},
|
||||
|
||||
// func scheduleTimeoutEvent(delay int64) int32
|
||||
"runtime.scheduleTimeoutEvent": (sp) => {
|
||||
sp >>>= 0;
|
||||
const id = this._nextCallbackTimeoutID;
|
||||
this._nextCallbackTimeoutID++;
|
||||
this._scheduledTimeouts.set(id, setTimeout(
|
||||
() => {
|
||||
this._resume();
|
||||
while (this._scheduledTimeouts.has(id)) {
|
||||
// for some reason Go failed to register the timeout event, log and try again
|
||||
// (temporary workaround for https://github.com/golang/go/issues/28975)
|
||||
console.warn("scheduleTimeoutEvent: missed timeout event");
|
||||
this._resume();
|
||||
}
|
||||
},
|
||||
getInt64(sp + 8) + 1, // setTimeout has been seen to fire up to 1 millisecond early
|
||||
));
|
||||
this.mem.setInt32(sp + 16, id, true);
|
||||
},
|
||||
|
||||
// func clearTimeoutEvent(id int32)
|
||||
"runtime.clearTimeoutEvent": (sp) => {
|
||||
sp >>>= 0;
|
||||
const id = this.mem.getInt32(sp + 8, true);
|
||||
clearTimeout(this._scheduledTimeouts.get(id));
|
||||
this._scheduledTimeouts.delete(id);
|
||||
},
|
||||
|
||||
// func getRandomData(r []byte)
|
||||
"runtime.getRandomData": (sp) => {
|
||||
sp >>>= 0;
|
||||
crypto.getRandomValues(loadSlice(sp + 8));
|
||||
},
|
||||
|
||||
// func finalizeRef(v ref)
|
||||
"syscall/js.finalizeRef": (sp) => {
|
||||
sp >>>= 0;
|
||||
const id = this.mem.getUint32(sp + 8, true);
|
||||
this._goRefCounts[id]--;
|
||||
if (this._goRefCounts[id] === 0) {
|
||||
const v = this._values[id];
|
||||
this._values[id] = null;
|
||||
this._ids.delete(v);
|
||||
this._idPool.push(id);
|
||||
}
|
||||
},
|
||||
|
||||
// func stringVal(value string) ref
|
||||
"syscall/js.stringVal": (sp) => {
|
||||
sp >>>= 0;
|
||||
storeValue(sp + 24, loadString(sp + 8));
|
||||
},
|
||||
|
||||
// func valueGet(v ref, p string) ref
|
||||
"syscall/js.valueGet": (sp) => {
|
||||
sp >>>= 0;
|
||||
const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));
|
||||
sp = this._inst.exports.getsp() >>> 0; // see comment above
|
||||
storeValue(sp + 32, result);
|
||||
},
|
||||
|
||||
// func valueSet(v ref, p string, x ref)
|
||||
"syscall/js.valueSet": (sp) => {
|
||||
sp >>>= 0;
|
||||
Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));
|
||||
},
|
||||
|
||||
// func valueDelete(v ref, p string)
|
||||
"syscall/js.valueDelete": (sp) => {
|
||||
sp >>>= 0;
|
||||
Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));
|
||||
},
|
||||
|
||||
// func valueIndex(v ref, i int) ref
|
||||
"syscall/js.valueIndex": (sp) => {
|
||||
sp >>>= 0;
|
||||
storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));
|
||||
},
|
||||
|
||||
// valueSetIndex(v ref, i int, x ref)
|
||||
"syscall/js.valueSetIndex": (sp) => {
|
||||
sp >>>= 0;
|
||||
Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));
|
||||
},
|
||||
|
||||
// func valueCall(v ref, m string, args []ref) (ref, bool)
|
||||
"syscall/js.valueCall": (sp) => {
|
||||
sp >>>= 0;
|
||||
try {
|
||||
const v = loadValue(sp + 8);
|
||||
const m = Reflect.get(v, loadString(sp + 16));
|
||||
const args = loadSliceOfValues(sp + 32);
|
||||
const result = Reflect.apply(m, v, args);
|
||||
sp = this._inst.exports.getsp() >>> 0; // see comment above
|
||||
storeValue(sp + 56, result);
|
||||
this.mem.setUint8(sp + 64, 1);
|
||||
} catch (err) {
|
||||
storeValue(sp + 56, err);
|
||||
this.mem.setUint8(sp + 64, 0);
|
||||
}
|
||||
},
|
||||
|
||||
// func valueInvoke(v ref, args []ref) (ref, bool)
|
||||
"syscall/js.valueInvoke": (sp) => {
|
||||
sp >>>= 0;
|
||||
try {
|
||||
const v = loadValue(sp + 8);
|
||||
const args = loadSliceOfValues(sp + 16);
|
||||
const result = Reflect.apply(v, undefined, args);
|
||||
sp = this._inst.exports.getsp() >>> 0; // see comment above
|
||||
storeValue(sp + 40, result);
|
||||
this.mem.setUint8(sp + 48, 1);
|
||||
} catch (err) {
|
||||
storeValue(sp + 40, err);
|
||||
this.mem.setUint8(sp + 48, 0);
|
||||
}
|
||||
},
|
||||
|
||||
// func valueNew(v ref, args []ref) (ref, bool)
|
||||
"syscall/js.valueNew": (sp) => {
|
||||
sp >>>= 0;
|
||||
try {
|
||||
const v = loadValue(sp + 8);
|
||||
const args = loadSliceOfValues(sp + 16);
|
||||
const result = Reflect.construct(v, args);
|
||||
sp = this._inst.exports.getsp() >>> 0; // see comment above
|
||||
storeValue(sp + 40, result);
|
||||
this.mem.setUint8(sp + 48, 1);
|
||||
} catch (err) {
|
||||
storeValue(sp + 40, err);
|
||||
this.mem.setUint8(sp + 48, 0);
|
||||
}
|
||||
},
|
||||
|
||||
// func valueLength(v ref) int
|
||||
"syscall/js.valueLength": (sp) => {
|
||||
sp >>>= 0;
|
||||
setInt64(sp + 16, parseInt(loadValue(sp + 8).length));
|
||||
},
|
||||
|
||||
// valuePrepareString(v ref) (ref, int)
|
||||
"syscall/js.valuePrepareString": (sp) => {
|
||||
sp >>>= 0;
|
||||
const str = encoder.encode(String(loadValue(sp + 8)));
|
||||
storeValue(sp + 16, str);
|
||||
setInt64(sp + 24, str.length);
|
||||
},
|
||||
|
||||
// valueLoadString(v ref, b []byte)
|
||||
"syscall/js.valueLoadString": (sp) => {
|
||||
sp >>>= 0;
|
||||
const str = loadValue(sp + 8);
|
||||
loadSlice(sp + 16).set(str);
|
||||
},
|
||||
|
||||
// func valueInstanceOf(v ref, t ref) bool
|
||||
"syscall/js.valueInstanceOf": (sp) => {
|
||||
sp >>>= 0;
|
||||
this.mem.setUint8(sp + 24, (loadValue(sp + 8) instanceof loadValue(sp + 16)) ? 1 : 0);
|
||||
},
|
||||
|
||||
// func copyBytesToGo(dst []byte, src ref) (int, bool)
|
||||
"syscall/js.copyBytesToGo": (sp) => {
|
||||
sp >>>= 0;
|
||||
const dst = loadSlice(sp + 8);
|
||||
const src = loadValue(sp + 32);
|
||||
if (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) {
|
||||
this.mem.setUint8(sp + 48, 0);
|
||||
return;
|
||||
}
|
||||
const toCopy = src.subarray(0, dst.length);
|
||||
dst.set(toCopy);
|
||||
setInt64(sp + 40, toCopy.length);
|
||||
this.mem.setUint8(sp + 48, 1);
|
||||
},
|
||||
|
||||
// func copyBytesToJS(dst ref, src []byte) (int, bool)
|
||||
"syscall/js.copyBytesToJS": (sp) => {
|
||||
sp >>>= 0;
|
||||
const dst = loadValue(sp + 8);
|
||||
const src = loadSlice(sp + 16);
|
||||
if (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) {
|
||||
this.mem.setUint8(sp + 48, 0);
|
||||
return;
|
||||
}
|
||||
const toCopy = src.subarray(0, dst.length);
|
||||
dst.set(toCopy);
|
||||
setInt64(sp + 40, toCopy.length);
|
||||
this.mem.setUint8(sp + 48, 1);
|
||||
},
|
||||
|
||||
"debug": (value) => {
|
||||
console.log(value);
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
async run(instance) {
|
||||
if (!(instance instanceof WebAssembly.Instance)) {
|
||||
throw new Error("Go.run: WebAssembly.Instance expected");
|
||||
}
|
||||
this._inst = instance;
|
||||
this.mem = new DataView(this._inst.exports.mem.buffer);
|
||||
this._values = [ // JS values that Go currently has references to, indexed by reference id
|
||||
NaN,
|
||||
0,
|
||||
null,
|
||||
true,
|
||||
false,
|
||||
global,
|
||||
this,
|
||||
];
|
||||
this._goRefCounts = new Array(this._values.length).fill(Infinity); // number of references that Go has to a JS value, indexed by reference id
|
||||
this._ids = new Map([ // mapping from JS values to reference ids
|
||||
[0, 1],
|
||||
[null, 2],
|
||||
[true, 3],
|
||||
[false, 4],
|
||||
[global, 5],
|
||||
[this, 6],
|
||||
]);
|
||||
this._idPool = []; // unused ids that have been garbage collected
|
||||
this.exited = false; // whether the Go program has exited
|
||||
|
||||
// Pass command line arguments and environment variables to WebAssembly by writing them to the linear memory.
|
||||
let offset = 4096;
|
||||
|
||||
const strPtr = (str) => {
|
||||
const ptr = offset;
|
||||
const bytes = encoder.encode(str + "\0");
|
||||
new Uint8Array(this.mem.buffer, offset, bytes.length).set(bytes);
|
||||
offset += bytes.length;
|
||||
if (offset % 8 !== 0) {
|
||||
offset += 8 - (offset % 8);
|
||||
}
|
||||
return ptr;
|
||||
};
|
||||
|
||||
const argc = this.argv.length;
|
||||
|
||||
const argvPtrs = [];
|
||||
this.argv.forEach((arg) => {
|
||||
argvPtrs.push(strPtr(arg));
|
||||
});
|
||||
argvPtrs.push(0);
|
||||
|
||||
const keys = Object.keys(this.env).sort();
|
||||
keys.forEach((key) => {
|
||||
argvPtrs.push(strPtr(`${key}=${this.env[key]}`));
|
||||
});
|
||||
argvPtrs.push(0);
|
||||
|
||||
const argv = offset;
|
||||
argvPtrs.forEach((ptr) => {
|
||||
this.mem.setUint32(offset, ptr, true);
|
||||
this.mem.setUint32(offset + 4, 0, true);
|
||||
offset += 8;
|
||||
});
|
||||
|
||||
this._inst.exports.run(argc, argv);
|
||||
if (this.exited) {
|
||||
this._resolveExitPromise();
|
||||
}
|
||||
await this._exitPromise;
|
||||
}
|
||||
|
||||
_resume() {
|
||||
if (this.exited) {
|
||||
throw new Error("Go program has already exited");
|
||||
}
|
||||
this._inst.exports.resume();
|
||||
if (this.exited) {
|
||||
this._resolveExitPromise();
|
||||
}
|
||||
}
|
||||
|
||||
_makeFuncWrapper(id) {
|
||||
const go = this;
|
||||
return function () {
|
||||
const event = { id: id, this: this, args: arguments };
|
||||
go._pendingEvent = event;
|
||||
go._resume();
|
||||
return event.result;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
typeof module !== "undefined" &&
|
||||
global.require &&
|
||||
global.require.main === module &&
|
||||
global.process &&
|
||||
global.process.versions &&
|
||||
!global.process.versions.electron
|
||||
) {
|
||||
if (process.argv.length < 3) {
|
||||
console.error("usage: go_js_wasm_exec [wasm binary] [arguments]");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const go = new Go();
|
||||
go.argv = process.argv.slice(2);
|
||||
go.env = Object.assign({ TMPDIR: require("os").tmpdir() }, process.env);
|
||||
go.exit = process.exit;
|
||||
WebAssembly.instantiate(fs.readFileSync(process.argv[2]), go.importObject).then((result) => {
|
||||
process.on("exit", (code) => { // Node.js exits if no event handler is pending
|
||||
if (code === 0 && !go.exited) {
|
||||
// deadlock, make Go print error and stack traces
|
||||
go._pendingEvent = { id: 0 };
|
||||
go._resume();
|
||||
}
|
||||
});
|
||||
return go.run(result.instance);
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
})();
|
282
goMetrix/goMetrix.go
Normal file
282
goMetrix/goMetrix.go
Normal file
@@ -0,0 +1,282 @@
|
||||
package goMetrix
|
||||
|
||||
import (
|
||||
"Toolbox/goDataverseStrict/metrics"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"sort"
|
||||
)
|
||||
|
||||
const (
|
||||
addr = "localhost:8008"
|
||||
dir = ""
|
||||
//PLATZHALTER = "Þłæŧ←ħæłŧ€¶"
|
||||
)
|
||||
|
||||
func sortMyDingse[dings metrics.MetricsType | metrics.MetricsDataCountType | metrics.SearchType | metrics.ReturnformatType, bums metrics.InputLevel0 | metrics.InputLevel1 | metrics.InputLevel2 | metrics.InputLevel3 | bool](dstring map[dings]bums) (raus []dings) {
|
||||
var klaus []string
|
||||
|
||||
for i, _ := range dstring {
|
||||
klaus = append(klaus, string(i))
|
||||
}
|
||||
|
||||
sort.Strings(klaus)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func Handler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var a [4]string
|
||||
|
||||
for i := int8(0); i <= 3; i++ {
|
||||
tmp, _ := metrics.FilterStacklist(metrics.OneJumpPoints, i)
|
||||
for j, v := range tmp {
|
||||
if i == 3 || (i < 3 && len(v) > 0) {
|
||||
log.Println("Hallo", j, v, len(v))
|
||||
}
|
||||
|
||||
a[i] += fmt.Sprintf("<span id=\"%s\" %s>", metrics.IDRequestHideDisplayPrefix+string(v), func() string {
|
||||
if i < 3 && len(v) > 0 {
|
||||
return ""
|
||||
} else { // i == 3 Resolve-Format ist vorerst nicht verhandelbar, nur zu DEBUG-Zwecken sichtbar machen.
|
||||
return "class=\"element-hide\""
|
||||
}
|
||||
}())
|
||||
|
||||
a[i] += fmt.Sprintf("<input type=\"radio\" id=\"%s\" name=\"form_types_radio\" value=\"%s\" %s/><label for=\"%s\"><b>%s</b></label>",
|
||||
metrics.IDRequestCriteriaPrefix+string(v),
|
||||
string(v),
|
||||
func() string {
|
||||
if j == 0 && v != "" {
|
||||
return "checked"
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
}(),
|
||||
metrics.IDRequestCriteriaPrefix+string(v),
|
||||
string(v))
|
||||
if i == 2 {
|
||||
switch v {
|
||||
default: //Total ist default //case string(metrics.ST1_tota
|
||||
//a[i] += ""
|
||||
case string(metrics.ST2tomonth):
|
||||
a[i] += `<label for="` + metrics.IDRequestTextPrefix + string(metrics.ST2tomonth) + `"> Bis <yyyy-mm> (inklusive)</label>
|
||||
<input name="form_searches" type="text" size="10" id="` + metrics.IDRequestTextPrefix + string(metrics.ST2tomonth) + `" value="2022-03" onSelect="this.enabled;getElementById('` + metrics.IDRequestTextPrefix + string(metrics.ST1total) + `').checked=false" onchange="checkoneuncheckany(ids,'` + metrics.IDRequestTextPrefix + string(metrics.ST2tomonth) + `')" onmouseover="enableonedisableany(ids, '` + metrics.IDRequestTextPrefix + string(metrics.ST2tomonth) + `')">`
|
||||
case string(metrics.ST3pastdays):
|
||||
a[i] += `<label for="` + metrics.IDRequestTextPrefix + string(metrics.ST3pastdays) + `"> Die letzten Tage</label>
|
||||
<input name="form_searches" type="text" size="10" id="` + metrics.IDRequestTextPrefix + string(metrics.ST3pastdays) + `" value="30" onchange="checkoneuncheckany(ids,'` + metrics.IDRequestTextPrefix + string(metrics.ST3pastdays) + `')" onmouseover="enableonedisableany(ids, '` + metrics.IDRequestTextPrefix + string(metrics.ST3pastdays) + `')">`
|
||||
case string(metrics.ST4monthly):
|
||||
a[i] += `<label for="` + metrics.IDRequestTextPrefix + string(metrics.ST4monthly) + `"> <yyyy-mm> bis <yyyy-mm></label>
|
||||
<input name="form_searches" type="text" size="25" id="` + metrics.IDRequestTextPrefix + string(metrics.ST4monthly) + `" value="2020-11 bis 2021-08" onchange="checkoneuncheckany(ids,'` + metrics.IDRequestTextPrefix + string(metrics.ST4monthly) + `')" onmouseover="enableonedisableany(ids, '` + metrics.IDRequestTextPrefix + string(metrics.ST4monthly) + `')">
|
||||
`
|
||||
case string(metrics.ST5tree):
|
||||
a[i] += `<label for="` + metrics.IDRequestTextPrefix + string(metrics.ST5tree) + `"></label>
|
||||
<input name="form_searches" type="text" size="10" id="` + metrics.IDRequestTextPrefix + string(metrics.ST5tree) + `" value="2022-12" onchange="checkoneuncheckany(ids,'` + metrics.IDRequestTextPrefix + string(metrics.ST5tree) + `')" onmouseover="enableonedisableany(ids, '` + metrics.IDRequestTextPrefix + string(metrics.ST5tree) + `')">`
|
||||
}
|
||||
}
|
||||
a[i] += `<br></span>`
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
<label for="`+metrics.IDRequestTextPrefix+string(metrics.ST1_total)+`">Total</label>
|
||||
<input name="form_searches" type="checkbox" id="`+metrics.IDRequestTextPrefix+string(metrics.ST1_total)+`" onchange="checkoneuncheckany(ids,'`+metrics.IDRequestTextPrefix+string(metrics.ST1_total)+`')" onmouseover="enableonedisableany(ids, '`+metrics.IDRequestTextPrefix+string(metrics.ST1_total)+`')" checked>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
//for i1, v1 := range metrics.OneJumpPointSet {
|
||||
for _, i1 := range sortMyDingse(metrics.OldOneJumpPointSet) {
|
||||
v1 := metrics.OldOneJumpPointSet[i1]
|
||||
|
||||
s1 += fmt.Sprintf("<input type=\"radio\" id=\"input_%s\" name=\"form_types_radio\" value=\"%s\"><label for=\"input_%s\">%s</label><br>", string(i1), string(i1), string(i1), string(i1))
|
||||
if !done2 {
|
||||
done2 = true
|
||||
//for i2, v2 := range v1 {
|
||||
for _, i2 := range sortMyDingse(v1) {
|
||||
v2 := v1[i2]
|
||||
|
||||
s2 += fmt.Sprintf("<input type=\"radio\" id=\"input_%s\" name=\"form_types_radio\" value=\"%s\" disabled><label for=\"input_%s\">%s</label><br>", string(i2), string(i2), string(i2), string(i2))
|
||||
if !done3 {
|
||||
done3 = true
|
||||
//for i3, v3 := range v2 {
|
||||
for _, i3 := range sortMyDingse(v2) {
|
||||
v3 := v2[i3]
|
||||
|
||||
s3 += fmt.Sprintf("<input type=\"radio\" id=\"input_%s\" name=\"form_types_radio\" value=\"%s\" disabled><label for=\"input_%s\">%s</label><br>", string(i3), string(i3), string(i3), string(i3))
|
||||
if !done4 {
|
||||
done4 = true
|
||||
//for i4, _ := range v3 {
|
||||
for _, i4 := range sortMyDingse(v3) {
|
||||
//v4 := v3[i4]
|
||||
|
||||
s4 += fmt.Sprintf("<input type=\"radio\" id=\"input_%s\" name=\"form_types_radio\" value=\"%s\" disabled><label for=\"input_%s\">%s</label><br>", string(i4), string(i4), string(i4), string(i4))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
fmt.Fprintf(w, `<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>goMetrix</title>
|
||||
<link rel="stylesheet" href="/css/metrics.css">
|
||||
<script src="https://golang.org/misc/wasm/wasm_exec.js"></script>
|
||||
<script>
|
||||
if (!WebAssembly.instantiateStreaming) {
|
||||
// polyfill
|
||||
WebAssembly.instantiateStreaming = async (resp, importObject) => {
|
||||
const source = await (await resp).arrayBuffer();
|
||||
return await WebAssembly.instantiate(source, importObject);
|
||||
};
|
||||
}
|
||||
|
||||
const go = new Go();
|
||||
let mod, inst;
|
||||
WebAssembly.instantiateStreaming(fetch("/wasm/app.wasm"), go.importObject)
|
||||
.then((result) => {
|
||||
go.run(result.instance);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
const ids = new Array(
|
||||
"`+metrics.IDRequestTextPrefix+string(metrics.ST1total)+`",
|
||||
"`+metrics.IDRequestTextPrefix+string(metrics.ST2tomonth)+`",
|
||||
"`+metrics.IDRequestTextPrefix+string(metrics.ST3pastdays)+`",
|
||||
"`+metrics.IDRequestTextPrefix+string(metrics.ST4monthly)+`",
|
||||
"`+metrics.IDRequestTextPrefix+string(metrics.ST5tree)+`"
|
||||
);
|
||||
|
||||
function pseudoSubmit2(){
|
||||
alert("läuft");
|
||||
}
|
||||
|
||||
function enableonedisableany(ids, id) {
|
||||
for (let i = 0; i < ids.length; i++){
|
||||
//alert(ids[i]);
|
||||
//document.getElementById(ids[i]).checked = false;
|
||||
document.getElementById(ids[i]).disabled = true;
|
||||
}
|
||||
document.getElementById(id).disabled = false;
|
||||
}
|
||||
|
||||
function checkoneuncheckany(ids,id){
|
||||
for (let i = 0; i < ids.length; i++){
|
||||
document.getElementById(ids[i]).checked = false;
|
||||
}
|
||||
document.getElementById(id).checked = true;
|
||||
}
|
||||
</script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="formarea">
|
||||
<p>
|
||||
<table><tr>
|
||||
<td valign="top" width="20%"><form id="form_metrictype">`+a[0]+`</form></td>
|
||||
<td valign="top" width="20%"><form id="form_metricsdatacount">`+a[1]+`</form></td>
|
||||
<td valign="top" width="50%"><form id="form_searchtype">`+a[2]+`</form></td>
|
||||
<td valign="top" width="5%"><form id="form_returnformat">`+a[3]+`</form></td>
|
||||
<td valign="top" width="5%"><input type="submit" onclick="pseudoSubmit2();" id="`+metrics.IDFormSubmit+`" value="Ok" /></td>
|
||||
</td></tr></table>
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<!--<p>
|
||||
<form id="form_results">
|
||||
<input type="hidden" name="form_results_radio" value="`+string(metrics.RT1json)+`" checked>
|
||||
<input type="radio" id="`+metrics.IDRequestTextPrefix+string(metrics.RT1json)+`" name="form_results_radio" value="`+string(metrics.RT1json)+`" checked>
|
||||
<label for="`+metrics.IDRequestTextPrefix+string(metrics.RT1json)+`">`+string(metrics.RT1json)+`</label><br>
|
||||
<input type="radio" id="`+metrics.IDRequestTextPrefix+string(metrics.RT2csv)+`" name="form_results_radio" value="`+string(metrics.RT2csv)+`">
|
||||
<label for="`+metrics.IDRequestTextPrefix+string(metrics.RT2csv)+`">`+string(metrics.RT2csv)+`</label><br>
|
||||
</form>
|
||||
</p>-->
|
||||
<!--<p>
|
||||
<form id="form_searches">
|
||||
<label for="`+metrics.IDRequestTextPrefix+string(metrics.ST1total)+`">Total</label>
|
||||
<input name="form_searches" type="checkbox" id="`+metrics.IDRequestTextPrefix+string(metrics.ST1total)+`" onchange="checkoneuncheckany(ids,'`+metrics.IDRequestTextPrefix+string(metrics.ST1total)+`')" onmouseover="enableonedisableany(ids, '`+metrics.IDRequestTextPrefix+string(metrics.ST1total)+`')" checked>
|
||||
<label for="`+metrics.IDRequestTextPrefix+string(metrics.ST2tomonth)+`">Bis <yyyy-mm> (inklusive)</label>
|
||||
<input name="form_searches" type="text" size="10" id="`+metrics.IDRequestTextPrefix+string(metrics.ST2tomonth)+`" value="2022-03" onSelect="this.enabled;getElementById('`+metrics.IDRequestTextPrefix+string(metrics.ST1total)+`').checked=false" onchange="checkoneuncheckany(ids,'`+metrics.IDRequestTextPrefix+string(metrics.ST2tomonth)+`')" onmouseover="enableonedisableany(ids, '`+metrics.IDRequestTextPrefix+string(metrics.ST2tomonth)+`')">
|
||||
<label for="`+metrics.IDRequestTextPrefix+string(metrics.ST3pastdays)+`">Die letzten Tage</label>
|
||||
<input name="form_searches" type="text" size="10" id="`+metrics.IDRequestTextPrefix+string(metrics.ST3pastdays)+`" value="30" onchange="checkoneuncheckany(ids,'`+metrics.IDRequestTextPrefix+string(metrics.ST3pastdays)+`')" onmouseover="enableonedisableany(ids, '`+metrics.IDRequestTextPrefix+string(metrics.ST3pastdays)+`')">
|
||||
<label for="`+metrics.IDRequestTextPrefix+string(metrics.ST4monthly)+`"><yyyy-mm> bis <yyyy-mm></label>
|
||||
<input name="form_searches" type="text" size="25" id="`+metrics.IDRequestTextPrefix+string(metrics.ST4monthly)+`" value="2020-11 bis 2021-08" onchange="checkoneuncheckany(ids,'`+metrics.IDRequestTextPrefix+string(metrics.ST4monthly)+`')" onmouseover="enableonedisableany(ids, '`+metrics.IDRequestTextPrefix+string(metrics.ST4monthly)+`')">
|
||||
<label for="`+metrics.IDRequestTextPrefix+string(metrics.ST5tree)+`">Tree</label>
|
||||
<input name="form_searches" type="text" size="10" id="`+metrics.IDRequestTextPrefix+string(metrics.ST5tree)+`" value="2022-12" onchange="checkoneuncheckany(ids,'`+metrics.IDRequestTextPrefix+string(metrics.ST5tree)+`')" onmouseover="enableonedisableany(ids, '`+metrics.IDRequestTextPrefix+string(metrics.ST5tree)+`')">
|
||||
</form>
|
||||
</p>-->
|
||||
</div>
|
||||
<!--<div id="testarea"></div>-->
|
||||
<div id="injectarea">🐧<!--🐧--></div>
|
||||
<div id="chartarea"></div>
|
||||
<script id="scriptarea"></script>
|
||||
</body>
|
||||
</html>`)
|
||||
|
||||
/*
|
||||
DEBUG:
|
||||
|
||||
fmt.Fprintf(w, "😱<br>")
|
||||
|
||||
md, me := metrics.MetricsTotal("http://localhost:8080", "f6933c5d-8e97-4e7a-b21a-c57447cca421", metrics.RT1json, metrics.MT1dataverses)
|
||||
fmt.Fprintf(w, "%s<br> %s<br><br>", me, md)
|
||||
|
||||
md, me = metrics.MetricsTotal("http://localhost:8080", "f6933c5d-8e97-4e7a-b21a-c57447cca421", metrics.RT2csv, metrics.MT4downloads)
|
||||
fmt.Fprintf(w, "%s<br> %s<br><br>", me, md)
|
||||
|
||||
md, me = metrics.MetricsTotal("http://localhost:8080", "f6933c5d-8e97-4e7a-b21a-c57447cca421", metrics.RT1json, metrics.MT2datasets)
|
||||
fmt.Fprintf(w, "%s<br> %s<br><br>", me, md)
|
||||
|
||||
md, me = metrics.MetricsTotal("http://localhost:8080", "f6933c5d-8e97-4e7a-b21a-c57447cca421", metrics.RT2csv, metrics.MT3files)
|
||||
fmt.Fprintf(w, "%s<br> %s<br><br>", me, md)
|
||||
|
||||
ts, _ := time.Parse("2006-01", "2021-06")
|
||||
md, me = metrics.MetricsToMonth("http://localhost:8080", "", metrics.RT2csv, metrics.MT2datasets, ts)
|
||||
fmt.Fprintf(w, "%s<br> %s<br><br>", me, md)
|
||||
|
||||
md, me = metrics.MetricsToMonth("http://localhost:8080", "", metrics.RT2csv, metrics.MT4downloads, ts)
|
||||
fmt.Fprintf(w, "%s<br> %s<br><br>", me, md)
|
||||
|
||||
md, me = metrics.MetricsPastDays("http://localhost:8080", "", metrics.RT2csv, metrics.MT2datasets, 30)
|
||||
fmt.Fprintf(w, "%s<br> %s<br><br>", me, md)
|
||||
|
||||
md, me = metrics.MetricsMonthly("http://localhost:8080", "", metrics.RT2csv, metrics.MT4downloads)
|
||||
fmt.Fprintf(w, "%s<br> %s<br><br>", me, md)
|
||||
|
||||
md, me = metrics.MetricsMonthly("http://localhost:8080", "", metrics.RT1json, metrics.MT4downloads)
|
||||
fmt.Fprintf(w, "%s<br> %s<br><br>", me, md)
|
||||
|
||||
md, me = metrics.MetricsReallyMonthly("http://localhost:8080", "", metrics.RT1json, metrics.MT4downloads)
|
||||
fmt.Fprintf(w, "%s<br> %s<br><br>", me, md)
|
||||
|
||||
//fmt.Println(metrics.ListUsers("http://localhost:8080", "f6933c5d-8e97-4e7a-b21a-c57447cca421", true))
|
||||
|
||||
ts, _ = time.Parse("2006-01", "2020-12")
|
||||
md, me = metrics.MetricsTree("http://localhost:8080", "", metrics.RT1json, ts)
|
||||
fmt.Fprintf(w, "%s<br> %s<br><br>", me, md)
|
||||
|
||||
md, me = metrics.MetricsTree("http://localhost:8080", "", metrics.RT1json, time.Time{})
|
||||
fmt.Fprintf(w, "%s<br> %s<br><br>", me, md)
|
||||
|
||||
//fmt.Fprintf(w, "%v", time.Now().Format("2006-02"))
|
||||
*/
|
||||
}
|
Reference in New Issue
Block a user