Skip to content

Commit

Permalink
Merge branch 'main' into feat/aws_server_deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
yk-eukarya committed Jun 27, 2023
2 parents c839b81 + 4b79e9d commit 9273df8
Show file tree
Hide file tree
Showing 27 changed files with 331 additions and 110 deletions.
56 changes: 2 additions & 54 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,58 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
":semanticCommits",
":semanticCommitScopeDisabled",
":maintainLockFilesWeekly",
":enableVulnerabilityAlertsWithLabel(security)"
],
"postUpdateOptions": [
"gomodTidy",
"gomodUpdateImportPaths"
],
"packageRules": [
{
"enabledManagers": [
"gomod"
],
"matchPackagePatterns": [
"*"
],
"groupName": "dependencies",
"groupSlug": "gomod",
"semanticCommitType": "chore",
"schedule": [
"before 3:00 am on the 4th day of the month"
]
},
{
"enabledManagers": [
"dockerfile",
"docker-compose"
],
"matchPackagePatterns": [
"*"
],
"groupName": "docker dependencies",
"groupSlug": "docker",
"semanticCommitType": "chore",
"schedule": [
"before 3:00 am on the 4th day of the month"
]
},
{
"enabledManagers": [
"github-actions"
],
"matchPackagePatterns": [
"*"
],
"groupName": "github actions dependencies",
"groupSlug": "github-actions",
"semanticCommitType": "ci",
"schedule": [
"before 3:00 am on the 4th day of the month"
]
}
"github>reearth/renovate-config"
]
}
9 changes: 5 additions & 4 deletions .github/workflows/ci_server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ jobs:
runs-on: ubuntu-latest
if: github.event_name != 'push' || !startsWith(github.event.head_commit.message, 'v')
steps:
- name: checkout
uses: actions/checkout@v3
- name: set up
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache: false
- name: checkout
uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand All @@ -32,12 +32,13 @@ jobs:
ports:
- 27017:27017
steps:
- name: checkout
uses: actions/checkout@v3
- name: set up
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- name: checkout
uses: actions/checkout@v3
cache-dependency-path: server/go.sum
- name: test
run: go test ./... -v -race -coverprofile=coverage.txt -covermode=atomic -timeout 10m
env:
Expand Down
2 changes: 1 addition & 1 deletion server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ require (
cloud.google.com/go/storage v1.22.1
github.com/99designs/gqlgen v0.17.12
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/trace v1.8.3
github.com/auth0/go-jwt-middleware/v2 v2.0.1
github.com/avast/retry-go/v4 v4.0.4
github.com/aws/aws-sdk-go-v2 v1.18.0
github.com/aws/aws-sdk-go-v2/config v1.18.25
Expand Down Expand Up @@ -67,6 +66,7 @@ require (
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 // indirect
github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a // indirect
github.com/andybalholm/brotli v1.0.2 // indirect
github.com/auth0/go-jwt-middleware/v2 v2.0.1 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.10 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.13.24 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.3 // indirect
Expand Down
7 changes: 6 additions & 1 deletion server/internal/adapter/gql/loader_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/reearth/reearth/server/internal/adapter/gql/gqldataloader"
"github.com/reearth/reearth/server/internal/adapter/gql/gqlmodel"
"github.com/reearth/reearth/server/internal/usecase/interfaces"
"github.com/reearth/reearth/server/pkg/log"
"github.com/reearth/reearthx/util"
)

Expand All @@ -23,7 +24,11 @@ func (c *PluginLoader) Fetch(ctx context.Context, ids []gqlmodel.ID) ([]*gqlmode
return nil, []error{err}
}

res, err := c.usecase.Fetch(ctx, ids2, getOperator(ctx))
op := getOperator(ctx)
log.Infof("TEMP: PluginLoader.Fetch op: %#v", op)
log.Infof("TEMP: PluginLoader.Fetch ids: %v", ids)

res, err := c.usecase.Fetch(ctx, ids2, op)
if err != nil {
return nil, []error{err}
}
Expand Down
7 changes: 6 additions & 1 deletion server/internal/adapter/gql/loader_property.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/reearth/reearth/server/internal/adapter/gql/gqlmodel"
"github.com/reearth/reearth/server/internal/usecase/interfaces"
"github.com/reearth/reearth/server/pkg/id"
"github.com/reearth/reearth/server/pkg/log"
"github.com/reearth/reearthx/util"
)

Expand All @@ -24,7 +25,11 @@ func (c *PropertyLoader) Fetch(ctx context.Context, ids []gqlmodel.ID) ([]*gqlmo
return nil, []error{err}
}

res, err := c.usecase.Fetch(ctx, ids2, getOperator(ctx))
op := getOperator(ctx)
log.Infof("TEMP: PropertyLoader.Fetch op: %#v", op)
log.Infof("TEMP: PropertyLoader.Fetch ids: %v", ids)

res, err := c.usecase.Fetch(ctx, ids2, op)
if err != nil {
return nil, []error{err}
}
Expand Down
10 changes: 10 additions & 0 deletions server/internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func initEcho(ctx context.Context, cfg *ServerConfig) *echo.Echo {

func errorHandler(next func(error, echo.Context)) func(error, echo.Context) {
return func(err error, c echo.Context) {
ctx := c.Request().Context()
if c.Response().Committed {
return
}
Expand All @@ -147,6 +148,15 @@ func errorHandler(next func(error, echo.Context)) func(error, echo.Context) {
err = rerror.ErrNotFound
}

if err := rerror.UnwrapErrInternal(err); err != nil {
au := adapter.GetAuthInfo(ctx)
u := adapter.User(ctx)
op := adapter.Operator(ctx)
c.Echo().Logger.Errorf("AUTH: %#v", au)
c.Echo().Logger.Errorf("USER: %#v", u)
c.Echo().Logger.Errorf("OP: %#v", op)
}

code, msg := errorMessage(err, func(f string, args ...interface{}) {
c.Echo().Logger.Errorf(f, args...)
})
Expand Down
2 changes: 0 additions & 2 deletions server/internal/app/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package app
import (
"context"
"fmt"
"time"

"github.com/reearth/reearth/server/internal/app/config"
"github.com/reearth/reearth/server/internal/infrastructure/auth0"
Expand Down Expand Up @@ -32,7 +31,6 @@ func initReposAndGateways(ctx context.Context, conf *config.Config, debug bool)
ctx,
options.Client().
ApplyURI(conf.DB).
SetConnectTimeout(time.Second*10).
SetMonitor(otelmongo.NewMonitor()),
)
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions server/internal/infrastructure/mongo/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/reearth/reearth/server/pkg/builtin"
"github.com/reearth/reearth/server/pkg/id"
"github.com/reearth/reearth/server/pkg/plugin"
"github.com/reearth/reearthx/log"
"github.com/reearth/reearthx/mongox"
"github.com/reearth/reearthx/rerror"
)
Expand Down Expand Up @@ -76,12 +77,16 @@ func (r *Plugin) FindByIDs(ctx context.Context, ids []id.PluginID) ([]*plugin.Pl
var err error

if len(ids2) > 0 {
log.Infof("TEMP: plugin mongo find by ids %v", ids2)

res, err = r.find(ctx, bson.M{
"id": bson.M{"$in": id.PluginIDsToStrings(ids2)},
})
if err != nil {
return nil, err
}

log.Infof("TEMP: plugin mongo find by ids OK")
}

return res.Concat(b.List()).MapToIDs(ids), nil
Expand Down
6 changes: 6 additions & 0 deletions server/internal/infrastructure/mongo/property.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/reearth/reearth/server/internal/usecase/repo"
"github.com/reearth/reearth/server/pkg/id"
"github.com/reearth/reearth/server/pkg/property"
"github.com/reearth/reearthx/log"
"github.com/reearth/reearthx/mongox"
"github.com/reearth/reearthx/rerror"
"go.mongodb.org/mongo-driver/bson"
Expand Down Expand Up @@ -68,6 +69,8 @@ func (r *Property) FindByIDs(ctx context.Context, ids id.PropertyIDList) (proper
return nil, nil
}

log.Infof("TEMP: property mongo find by ids %v", ids)

filter := bson.M{
"id": bson.M{
"$in": ids.Strings(),
Expand All @@ -77,6 +80,9 @@ func (r *Property) FindByIDs(ctx context.Context, ids id.PropertyIDList) (proper
if err != nil {
return nil, err
}

log.Infof("TEMP: property mongo find by ids OK")

return filterProperties(ids, res), nil
}

Expand Down
3 changes: 3 additions & 0 deletions web/src/beta/components/Icon/Icons/arrowToggle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions web/src/beta/components/Icon/Icons/square.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions web/src/beta/components/Icon/Icons/two-rectangle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions web/src/beta/components/Icon/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import ArrowRight from "./Icons/arrowRight.svg";
import ArrowLongLeft from "./Icons/arrowLongLeft.svg";
import ArrowLongRight from "./Icons/arrowLongRight.svg";
import ArrowDown from "./Icons/arrowDown.svg";
import ArrowToggle from "./Icons/arrowToggle.svg";

// Indicator
import Crosshair from "./Icons/crosshair.svg";
Expand Down Expand Up @@ -45,6 +46,10 @@ import Logout from "./Icons/logout.svg";
import WorkspaceAdd from "./Icons/workspaceAdd.svg";
import Workspaces from "./Icons/workspaces.svg";

// Square
import Square from "./Icons/square.svg";
import TwoRectangle from "./Icons/two-rectangle.svg";

export default {
file: File,
dl: InfoTable,
Expand All @@ -60,13 +65,16 @@ export default {
arrowLongLeft: ArrowLongLeft,
arrowLongRight: ArrowLongRight,
arrowDown: ArrowDown,
arrowToggle: ArrowToggle,
cancel: Cancel,
crosshair: Crosshair,
plusSquare: PlusSquare,
ellipse: Ellipse,
playRight: PlayRight,
playLeft: PlayLeft,
square: Square,
timeline: Timeline,
twoRectangle: TwoRectangle,
actionbutton: ActionButton,
dashboard: Dashboard,
help: Help,
Expand Down
24 changes: 24 additions & 0 deletions web/src/beta/components/SidePanelSectionField/index.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Meta, StoryObj } from "@storybook/react";

import Component from ".";

const meta: Meta<typeof Component> = {
component: Component,
};

export default meta;

type Story = StoryObj<typeof Component>;

export const Default: Story = {
args: {
title: "Title",
children: <p>Item</p>,
},
};

export const Empty: Story = {
args: {
title: "Title",
},
};
55 changes: 55 additions & 0 deletions web/src/beta/components/SidePanelSectionField/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { useState, ReactNode } from "react";

import { styled, useTheme } from "@reearth/services/theme";

import Icon from "../Icon";
import Text from "../Text";

const SidePanelSectionField: React.FC<{
title: string;
children?: ReactNode;
}> = ({ title, children }) => {
const theme = useTheme();
const [opened, setOpened] = useState(false);

return (
<Field>
<Header onClick={() => setOpened(!opened)}>
<Text
size="footnote"
color={theme.general.content.strong}
otherProperties={{ height: "16px" }}>
{title}
</Text>
<ArrowIcon
icon="arrowToggle"
size={12}
color={theme.general.content.main}
opened={opened}
/>
</Header>
{opened && children}
</Field>
);
};

const Field = styled.div`
box-sizing: border-box;
border-bottom: 1px solid ${props => props.theme.general.bg.weak};
`;
const Header = styled.div`
box-sizing: border-box;
display: flex;
justify-content: space-between;
align-items: center;
padding: 8px;
height: 32px;
cursor: pointer;
`;
const ArrowIcon = styled(Icon)<{ opened: boolean }>`
transform: rotate(${props => (props.opened ? 90 : 180)}deg);
`;

export default SidePanelSectionField;
Loading

0 comments on commit 9273df8

Please sign in to comment.