refactor graph-explorer

Signed-off-by: Christian Richter <crichter@owncloud.com>
This commit is contained in:
Christian Richter
2022-04-12 10:18:35 +02:00
parent 4d821cdc9d
commit 1932e594d1
42 changed files with 233 additions and 52 deletions

View File

@@ -1,27 +1,27 @@
SHELL := bash
NAME := graph-explorer
include ../.make/recursion.mk
include ../../.make/recursion.mk
############ tooling ############
ifneq (, $(shell which go 2> /dev/null)) # suppress `command not found warnings` for non go targets in CI
include ../.bingo/Variables.mk
include ../../.bingo/Variables.mk
endif
############ go tooling ############
include ../.make/go.mk
include ../../.make/go.mk
############ release ############
include ../.make/release.mk
include ../../.make/release.mk
############ docs generate ############
include ../.make/docs.mk
include ../../.make/docs.mk
.PHONY: docs-generate
docs-generate: config-docs-generate
############ generate ############
include ../.make/generate.mk
include ../../.make/generate.mk
.PHONY: ci-go-generate
ci-go-generate: # CI runs ci-node-generate automatically before this target

View File

@@ -0,0 +1,50 @@
<!-- Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information. -->
<!DOCTYPE html>
<html>
<head>
<!-- Graph explorer depends on ACE editor -->
<!-- Must be inclued separetely -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.0/ace.js"></script>
<!--hello.js-->
<script src="node_modules/hellojs/dist/hello.all.js"></script>
<!--Fabric-->
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-js/1.4.0/css/fabric.min.css">
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-js/1.4.0/css/fabric.components.min.css">
<script src="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-js/1.4.0/js/fabric.min.js"></script>
<!-- MWF -->
<link rel="stylesheet"
href="https://www.microsoft.com/mwf/css/bundle/1.57.4/west-european/default/mwf-main.min.css?apiVersion=1.0">
<script src="https://mwf-service.akamaized.net/mwf/js/bundle/1.57.4/mwf-auto-init-main.var.min.js"></script>
<link rel="stylesheet" href="src/custom.css" />
<!-- moment js -->
<script src="node_modules/moment/min/moment-with-locales.min.js"></script>
<!-- jQuery -->
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<!-- clientId, scopes, redirectUrl -->
<script src="secrets.js"></script>
<script src="config.js"></script>
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
</head>
<body>
<api-explorer></api-explorer>
<script src="dist/explorer.js"></script>
</body>
</html>

View File

@@ -0,0 +1,131 @@
/* ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------*/
.ace_editor {
box-shadow: none !important;
position: relative;
}
#response-viewer-labels {
margin-top: 10px;
}
.ms-Pivot-link:focus {
outline: none;
}
#jsonViewer, #response-header-viewer {
height: 50vh;
border: 1px solid #ccc;
}
.ace_link_marker {
position: absolute;
border-bottom: 1px solid blue;
}
.ace-tm .ace_invalid {
color: inherit;
background-color: inherit;
}
#graph-version-select #-Other {
display: none;
}
api-explorer button {
min-width: initial;
}
.ms-Spinner-circle {
background-color: white !important;
}
api-explorer .c-select-menu>a:after, api-explorer .c-select-menu>button:after {
position: absolute;
font-size: 8px;
color: rgba(0,0,0,.8);
font-weight: 700;
background: white;
height: 100%;
padding-right: 5px;
right: 0px;
top: 0px;
padding-top: 14px;
padding-left: 5px;
}
#httpMethodSelect button {
color: white;
width: 85px;
text-align: center;
}
#httpMethodSelect.GET .c-select-menu.f-border button {
background-color: #000fdf;
}
#httpMethodSelect.POST .c-select-menu.f-border button {
background-color: #008412;
}
#httpMethodSelect.PATCH .c-select-menu.f-border button {
background-color: #be8b00;
}
#httpMethodSelect.DELETE .c-select-menu.f-border button {
background-color: #a10000;
}
#httpMethodSelect.PUT .c-select-menu.f-border button {
background-color: #5C005C;
}
.m-auto-suggest .c-menu-item strong {
font-weight: normal;
}
/*override mwf*/
.fixed-with-mwf-menu ul.c-menu {
width: 100px !important;
}
/* frontdoor */
.ms-PanelHost {
z-index: 3000002;
}
#deltaUi {
display: none;
}
.ms-Overlay.is-visible {
z-index: 990;
}
.c-menu-item {
margin-bottom: 0px;
}
.ms-Panel.is-open {
z-index: 999;
}
.c-search input[type=search] {
padding: 7px;
max-height: 32px;
padding-right: 0px;
}
.ms-Dialog {
z-index: 999;
}
*:focus {
outline: 2px solid #4fc3f7;
}
.link {
color: #006cd8 !important;
}

View File

@@ -0,0 +1,14 @@
package main
import (
"os"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/command"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/config/defaults"
)
func main() {
if err := command.Execute(defaults.DefaultConfig()); err != nil {
os.Exit(1)
}
}

View File

@@ -3,8 +3,8 @@ package assets
import (
"net/http"
graphexplorer "github.com/owncloud/ocis/graph-explorer"
"github.com/owncloud/ocis/graph-explorer/pkg/config"
graphexplorer "github.com/owncloud/ocis/extensions/graph-explorer"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/config"
"github.com/owncloud/ocis/ocis-pkg/assetsfs"
"github.com/owncloud/ocis/ocis-pkg/log"
)

View File

@@ -4,9 +4,9 @@ import (
"fmt"
"net/http"
"github.com/owncloud/ocis/graph-explorer/pkg/config"
"github.com/owncloud/ocis/graph-explorer/pkg/config/parser"
"github.com/owncloud/ocis/graph-explorer/pkg/logging"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/config"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/config/parser"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/logging"
"github.com/urfave/cli/v2"
)

View File

@@ -4,7 +4,7 @@ import (
"context"
"os"
"github.com/owncloud/ocis/graph-explorer/pkg/config"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/config"
"github.com/owncloud/ocis/ocis-pkg/clihelper"
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/thejerf/suture/v4"

View File

@@ -5,13 +5,13 @@ import (
"fmt"
"github.com/oklog/run"
"github.com/owncloud/ocis/graph-explorer/pkg/config"
"github.com/owncloud/ocis/graph-explorer/pkg/config/parser"
"github.com/owncloud/ocis/graph-explorer/pkg/logging"
"github.com/owncloud/ocis/graph-explorer/pkg/metrics"
"github.com/owncloud/ocis/graph-explorer/pkg/server/debug"
"github.com/owncloud/ocis/graph-explorer/pkg/server/http"
"github.com/owncloud/ocis/graph-explorer/pkg/tracing"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/config"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/config/parser"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/logging"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/metrics"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/server/debug"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/server/http"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/tracing"
"github.com/owncloud/ocis/ocis-pkg/version"
"github.com/urfave/cli/v2"
)

View File

@@ -8,7 +8,7 @@ import (
"github.com/owncloud/ocis/ocis-pkg/version"
tw "github.com/olekukonko/tablewriter"
"github.com/owncloud/ocis/graph-explorer/pkg/config"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/config"
"github.com/urfave/cli/v2"
)

View File

@@ -3,7 +3,7 @@ package defaults
import (
"strings"
"github.com/owncloud/ocis/graph-explorer/pkg/config"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/config"
)
func FullDefaultConfig() *config.Config {

View File

@@ -3,8 +3,8 @@ package parser
import (
"errors"
"github.com/owncloud/ocis/graph-explorer/pkg/config"
"github.com/owncloud/ocis/graph-explorer/pkg/config/defaults"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/config"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/config/defaults"
ociscfg "github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config/envdecode"

View File

@@ -1,7 +1,7 @@
package logging
import (
"github.com/owncloud/ocis/graph-explorer/pkg/config"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/config"
"github.com/owncloud/ocis/ocis-pkg/log"
)

View File

@@ -3,7 +3,7 @@ package debug
import (
"context"
"github.com/owncloud/ocis/graph-explorer/pkg/config"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/config"
"github.com/owncloud/ocis/ocis-pkg/log"
)

View File

@@ -4,7 +4,7 @@ import (
"io"
"net/http"
"github.com/owncloud/ocis/graph-explorer/pkg/config"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/config"
"github.com/owncloud/ocis/ocis-pkg/service/debug"
"github.com/owncloud/ocis/ocis-pkg/version"
)

View File

@@ -3,8 +3,8 @@ package http
import (
"context"
"github.com/owncloud/ocis/graph-explorer/pkg/config"
"github.com/owncloud/ocis/graph-explorer/pkg/metrics"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/config"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/metrics"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/urfave/cli/v2"
)

View File

@@ -2,7 +2,7 @@ package http
import (
chimiddleware "github.com/go-chi/chi/v5/middleware"
svc "github.com/owncloud/ocis/graph-explorer/pkg/service/v0"
svc "github.com/owncloud/ocis/extensions/graph-explorer/pkg/service/v0"
"github.com/owncloud/ocis/ocis-pkg/middleware"
"github.com/owncloud/ocis/ocis-pkg/service/http"
"github.com/owncloud/ocis/ocis-pkg/version"

View File

@@ -3,7 +3,7 @@ package svc
import (
"net/http"
"github.com/owncloud/ocis/graph-explorer/pkg/metrics"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/metrics"
)
// NewInstrument returns a service that instruments metrics.

View File

@@ -3,7 +3,7 @@ package svc
import (
"net/http"
"github.com/owncloud/ocis/graph-explorer/pkg/config"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/config"
"github.com/owncloud/ocis/ocis-pkg/log"
)

View File

@@ -7,8 +7,8 @@ import (
"strings"
"github.com/go-chi/chi/v5"
"github.com/owncloud/ocis/graph-explorer/pkg/assets"
"github.com/owncloud/ocis/graph-explorer/pkg/config"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/assets"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/config"
"github.com/owncloud/ocis/ocis-pkg/log"
)

View File

@@ -1,7 +1,7 @@
package tracing
import (
"github.com/owncloud/ocis/graph-explorer/pkg/config"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/config"
pkgtrace "github.com/owncloud/ocis/ocis-pkg/tracing"
"go.opentelemetry.io/otel/trace"
)

View File

@@ -1,14 +0,0 @@
package main
import (
"os"
"github.com/owncloud/ocis/graph-explorer/pkg/command"
"github.com/owncloud/ocis/graph-explorer/pkg/config/defaults"
)
func main() {
if err := command.Execute(defaults.DefaultConfig()); err != nil {
os.Exit(1)
}
}

View File

@@ -6,8 +6,8 @@ import (
audit "github.com/owncloud/ocis/audit/pkg/config"
accounts "github.com/owncloud/ocis/extensions/accounts/pkg/config"
glauth "github.com/owncloud/ocis/extensions/glauth/pkg/config"
graphExplorer "github.com/owncloud/ocis/extensions/graph-explorer/pkg/config"
graph "github.com/owncloud/ocis/extensions/graph/pkg/config"
graphExplorer "github.com/owncloud/ocis/graph-explorer/pkg/config"
idm "github.com/owncloud/ocis/idm/pkg/config"
idp "github.com/owncloud/ocis/idp/pkg/config"
nats "github.com/owncloud/ocis/nats/pkg/config"

View File

@@ -4,8 +4,8 @@ import (
audit "github.com/owncloud/ocis/audit/pkg/config/defaults"
accounts "github.com/owncloud/ocis/extensions/accounts/pkg/config/defaults"
glauth "github.com/owncloud/ocis/extensions/glauth/pkg/config/defaults"
graphExplorer "github.com/owncloud/ocis/extensions/graph-explorer/pkg/config/defaults"
graph "github.com/owncloud/ocis/extensions/graph/pkg/config/defaults"
graphExplorer "github.com/owncloud/ocis/graph-explorer/pkg/config/defaults"
idm "github.com/owncloud/ocis/idm/pkg/config/defaults"
idp "github.com/owncloud/ocis/idp/pkg/config/defaults"
nats "github.com/owncloud/ocis/nats/pkg/config/defaults"

View File

@@ -1,7 +1,7 @@
package command
import (
"github.com/owncloud/ocis/graph-explorer/pkg/command"
"github.com/owncloud/ocis/extensions/graph-explorer/pkg/command"
"github.com/owncloud/ocis/ocis-pkg/config"
"github.com/owncloud/ocis/ocis-pkg/config/parser"
"github.com/owncloud/ocis/ocis/pkg/register"

View File

@@ -21,8 +21,8 @@ import (
accounts "github.com/owncloud/ocis/extensions/accounts/pkg/command"
glauth "github.com/owncloud/ocis/extensions/glauth/pkg/command"
graphExplorer "github.com/owncloud/ocis/extensions/graph-explorer/pkg/command"
graph "github.com/owncloud/ocis/extensions/graph/pkg/command"
graphExplorer "github.com/owncloud/ocis/graph-explorer/pkg/command"
idm "github.com/owncloud/ocis/idm/pkg/command"
idp "github.com/owncloud/ocis/idp/pkg/command"
nats "github.com/owncloud/ocis/nats/pkg/command"