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("", 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("", 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] += ` ` case string(metrics.ST3pastdays): a[i] += ` ` case string(metrics.ST4monthly): a[i] += ` ` case string(metrics.ST5tree): a[i] += ` ` } } a[i] += `
` } } /* */ /* //for i1, v1 := range metrics.OneJumpPointSet { for _, i1 := range sortMyDingse(metrics.OldOneJumpPointSet) { v1 := metrics.OldOneJumpPointSet[i1] s1 += fmt.Sprintf("
", 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("
", 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("
", 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("
", string(i4), string(i4), string(i4), string(i4)) } } } } } } } */ fmt.Fprintf(w, ` goMetrix

`+a[0]+`
`+a[1]+`
`+a[2]+`
`+a[3]+`

🐧
`) /* DEBUG: fmt.Fprintf(w, "😱
") md, me := metrics.MetricsTotal("http://localhost:8080", "f6933c5d-8e97-4e7a-b21a-c57447cca421", metrics.RT1json, metrics.MT1dataverses) fmt.Fprintf(w, "%s
%s

", me, md) md, me = metrics.MetricsTotal("http://localhost:8080", "f6933c5d-8e97-4e7a-b21a-c57447cca421", metrics.RT2csv, metrics.MT4downloads) fmt.Fprintf(w, "%s
%s

", me, md) md, me = metrics.MetricsTotal("http://localhost:8080", "f6933c5d-8e97-4e7a-b21a-c57447cca421", metrics.RT1json, metrics.MT2datasets) fmt.Fprintf(w, "%s
%s

", me, md) md, me = metrics.MetricsTotal("http://localhost:8080", "f6933c5d-8e97-4e7a-b21a-c57447cca421", metrics.RT2csv, metrics.MT3files) fmt.Fprintf(w, "%s
%s

", 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
%s

", me, md) md, me = metrics.MetricsToMonth("http://localhost:8080", "", metrics.RT2csv, metrics.MT4downloads, ts) fmt.Fprintf(w, "%s
%s

", me, md) md, me = metrics.MetricsPastDays("http://localhost:8080", "", metrics.RT2csv, metrics.MT2datasets, 30) fmt.Fprintf(w, "%s
%s

", me, md) md, me = metrics.MetricsMonthly("http://localhost:8080", "", metrics.RT2csv, metrics.MT4downloads) fmt.Fprintf(w, "%s
%s

", me, md) md, me = metrics.MetricsMonthly("http://localhost:8080", "", metrics.RT1json, metrics.MT4downloads) fmt.Fprintf(w, "%s
%s

", me, md) md, me = metrics.MetricsReallyMonthly("http://localhost:8080", "", metrics.RT1json, metrics.MT4downloads) fmt.Fprintf(w, "%s
%s

", 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
%s

", me, md) md, me = metrics.MetricsTree("http://localhost:8080", "", metrics.RT1json, time.Time{}) fmt.Fprintf(w, "%s
%s

", me, md) //fmt.Fprintf(w, "%v", time.Now().Format("2006-02")) */ }