Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
reearth-app[bot] committed Oct 18, 2024
2 parents ae1bf5e + cf26d01 commit f4d8c2d
Show file tree
Hide file tree
Showing 18 changed files with 162 additions and 98 deletions.
File renamed without changes.
5 changes: 2 additions & 3 deletions .github/workflows/build_server.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: server-build
on:
workflow_run:
workflows: [ci-server]
types: [completed]
push:
branches: [main, release]
paths: [server/**, .github/workflows/build_server.yml]
concurrency:
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch }}
cancel-in-progress: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: web-build
on:
workflow_run:
workflows: [ci-web]
types: [completed]
branches: [main, release]
push:
branches: [ main, release ]
paths: [ web/**, .github/workflows/build_web.yml ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch }}
cancel-in-progress: true
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/build_worker.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: worker-build
on:
workflow_run:
workflows: [ci-worker]
types: [completed]
push:
branches: [main, release]
paths: [worker/**, .github/workflows/build_worker.yml]
concurrency:
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch }}
cancel-in-progress: true
Expand Down
3 changes: 2 additions & 1 deletion server/internal/usecase/interactor/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package interactor
import (
"context"
"errors"

"github.com/reearth/reearth-cms/server/internal/usecase"
"github.com/reearth/reearth-cms/server/internal/usecase/gateway"
"github.com/reearth/reearth-cms/server/internal/usecase/interfaces"
Expand Down Expand Up @@ -62,7 +63,7 @@ func (i *Project) Create(ctx context.Context, p interfaces.CreateProjectParam, o
if len(p.RequestRoles) > 0 {
pb = pb.RequestRoles(p.RequestRoles)
} else {
pb = pb.RequestRoles([]workspace.Role{workspace.RoleOwner, workspace.RoleMaintainer, workspace.RoleWriter, workspace.RoleReader})
pb = pb.RequestRoles([]workspace.Role{})
}

proj, err := pb.Build()
Expand Down
2 changes: 2 additions & 0 deletions web/src/components/atoms/Icon/icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
MenuFoldOutlined,
MenuUnfoldOutlined,
FolderOutlined,
FolderOpenOutlined,
LinkOutlined,
UserAddOutlined,
ClearOutlined,
Expand Down Expand Up @@ -137,6 +138,7 @@ export default {
panelToggleLeft: MenuFoldOutlined,
panelToggleRight: MenuUnfoldOutlined,
folder: FolderOutlined,
folderOpen: FolderOpenOutlined,
dot: Dot,
userAdd: UserAddOutlined,
clear: ClearOutlined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,15 @@ const UnzipFileList: React.FC<Props> = ({
) : (
treeData && (
<Tree
switcherIcon={<Icon icon="caretDown" />}
switcherIcon={({ expanded }) => (
<SwitcherIcon icon={expanded ? "folderOpen" : "folder"} size={14} />
)}
defaultExpandedKeys={["0-0"]}
selectedKeys={selectedKeys}
onSelect={handleSelect}
treeData={treeData}
multiple={false}
showLine
showLine={{ showLeafIcon: true }}
titleRender={({ title, key, path }) => {
return (
<>
Expand Down Expand Up @@ -144,4 +146,10 @@ const CopyIcon = styled(Icon)`
}
`;

const SwitcherIcon = styled(Icon)`
svg {
transform: none !important;
}
`;

export default UnzipFileList;
7 changes: 6 additions & 1 deletion web/src/components/molecules/Asset/AssetListTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,12 @@ const AssetListTable: React.FC<Props> = ({
onClick={props.onCleanSelected}>
{t("Deselect")}
</Button>
<DownloadButton displayDefaultIcon type="link" selected={props.selectedRows} />
<DownloadButton
displayDefaultIcon
size="small"
type="link"
selected={props.selectedRows}
/>
<Button
type="link"
size="small"
Expand Down
39 changes: 21 additions & 18 deletions web/src/components/molecules/Common/Form/AssetItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,19 +148,21 @@ const AssetItem: React.FC<Props> = ({
<>
<AssetDetailsWrapper>
<AssetButton enabled={!!asset} disabled={disabled} onClick={handleClick}>
<div>
<Icon icon="folder" size={24} />
<AssetName>{asset?.fileName ?? value}</AssetName>
</div>
<Icon icon="folder" size={24} />
<AssetName>{asset?.fileName ?? value}</AssetName>
</AssetButton>
<Tooltip title={asset?.fileName}>
<Link
to={`/workspace/${workspaceId}/project/${projectId}/asset/${value}`}
target="_blank">
<AssetLinkedName enabled={!!asset} type="link">
{asset?.fileName ?? value + " (removed)"}
{asset ? (
<Link
to={`/workspace/${workspaceId}/project/${projectId}/asset/${value}`}
target="_blank">
<AssetLinkedName type="link">{asset.fileName}</AssetLinkedName>
</Link>
) : (
<AssetLinkedName type="link" disabled>
{`${value} (removed)`}
</AssetLinkedName>
</Link>
)}
</Tooltip>
</AssetDetailsWrapper>
<Space />
Expand All @@ -181,10 +183,8 @@ const AssetItem: React.FC<Props> = ({
</>
) : (
<AssetButton disabled={disabled} onClick={handleClick}>
<div>
<Icon icon="linkSolid" size={14} />
<AssetButtonTitle>{t("Asset")}</AssetButtonTitle>
</div>
<Icon icon="linkSolid" size={14} />
<AssetButtonTitle>{t("Asset")}</AssetButtonTitle>
</AssetButton>
)}
{uploadUrl && setUploadUrl && (
Expand Down Expand Up @@ -225,6 +225,8 @@ const AssetButton = styled(Button)<{ enabled?: boolean }>`
border: 1px dashed;
border-color: ${({ enabled }) => (enabled ? "#d9d9d9" : "#00000040")};
color: ${({ enabled }) => (enabled ? "#000000D9" : "#00000040")};
padding: 0 5px;
flex-flow: column;
`;

const Space = styled.div`
Expand All @@ -247,9 +249,8 @@ const AssetLink = styled(Button)`
}
`;

const AssetLinkedName = styled(Button)<{ enabled?: boolean }>`
color: #1890ff;
color: ${({ enabled }) => (enabled ? "#1890ff" : "#00000040")};
const AssetLinkedName = styled(Button)<{ disabled?: boolean }>`
color: ${({ disabled }) => (disabled ? "#00000040" : "#1890ff")};
margin-left: 12px;
span {
text-align: start;
Expand All @@ -268,8 +269,10 @@ const AssetDetailsWrapper = styled.div`
`;

const AssetName = styled.div`
margin-top: 8px;
width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
`;

const AssetButtonTitle = styled.div`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@ const GeometryItem: React.FC<Props> = ({
: [GEO_TYPE_MAP[supportedTypes]];
if (convertedTypes.includes(valueJson.type)) {
handleErrorDelete();
} else {
handleErrorAdd();
return;
}
}
throw new Error();
} catch (_) {
return;
handleErrorAdd();
}
} else {
handleErrorDelete();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ const MultiValueGeometry: React.FC<Props> = ({
return index !== key;
}),
);
errorDelete?.(key);
},
[onChange, value],
[errorDelete, onChange, value],
);

return (
Expand Down
8 changes: 3 additions & 5 deletions web/src/components/molecules/Content/Form/SidebarWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,20 @@ const ContentSidebarWrapper: React.FC<Props> = ({ item, onNavigateToRequest }) =

const DataRow = styled.div`
display: flex;
margin: 0 -4px;
align-items: center;
justify-content: space-between;
gap: 8px;
padding: 4px 0;
line-height: 22px;
`;

const DataTitle = styled.div`
font-size: 14px;
line-height: 22px;
padding: 4px;
`;

const DataText = styled.div`
color: #00000073;
font-size: 12px;
line-height: 22px;
padding: 4px;
`;

const StyledTag = styled(Tag)`
Expand Down
71 changes: 46 additions & 25 deletions web/src/components/molecules/Content/Table/DropdownRender/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Dayjs } from "dayjs";
import dayjs, { Dayjs } from "dayjs";
import { useRef, useEffect, useCallback, useMemo, useState, Dispatch, SetStateAction } from "react";

import { DatePickerProps } from "@reearth-cms/components/atoms/DatePicker";
Expand Down Expand Up @@ -38,15 +38,34 @@ export default (
const t = useT();
const [form] = Form.useForm();

const defaultValueGet = useCallback(() => {
switch (filter.type) {
case "Select":
case "Tag":
case "Person":
case "Bool":
case "Checkbox":
return defaultValue?.value?.toString();
case "Date":
return defaultValue && defaultValue.value !== "" ? dayjs(defaultValue.value) : undefined;
default:
return defaultValue?.value;
}
}, [defaultValue, filter.type]);

useEffect(() => {
if (open && !defaultValue) {
form.resetFields();
setIsShowInputField(true);
if (!isFilter && filterOption.current) {
filterOption.current.value = "ASC";
if (open) {
if (defaultValue) {
form.setFieldsValue({ condition: defaultValue.operator, value: defaultValueGet() });
} else {
form.resetFields();
setIsShowInputField(true);
if (!isFilter && filterOption.current) {
filterOption.current.value = "ASC";
}
}
}
}, [open, form, defaultValue, isFilter]);
}, [open, form, defaultValue, isFilter, defaultValueGet]);

const options = useMemo(() => {
const result: {
Expand Down Expand Up @@ -236,31 +255,33 @@ export default (
const filterValue = useRef<string>();

useEffect(() => {
let isShow = true;
if (defaultValue) {
const { operator, operatorType, value } = defaultValue;
filterOption.current = {
value: defaultValue.operator,
operatorType: defaultValue.operatorType,
value: operator,
operatorType,
};
filterValue.current = defaultValue.value;
filterValue.current = value;
if (
operatorType === "nullable" ||
operator === TimeOperator.OfThisWeek ||
operator === TimeOperator.OfThisMonth ||
operator === TimeOperator.OfThisYear
) {
isShow = false;
}
} else {
const { value, operatorType } = options[0];
filterOption.current = {
value: options[0].value,
operatorType: options[0].operatorType,
value,
operatorType,
};
if (operatorType === "nullable") {
isShow = false;
}
}

if (defaultValue?.operatorType === "nullable") {
setIsShowInputField(false);
} else if (
defaultValue?.operator === TimeOperator.OfThisWeek ||
defaultValue?.operator === TimeOperator.OfThisMonth ||
defaultValue?.operator === TimeOperator.OfThisYear
) {
setIsShowInputField(false);
defaultValue.value = "";
} else {
setIsShowInputField(true);
}
setIsShowInputField(isShow);
}, [defaultValue, options]);

const confirm = useCallback(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import styled from "@emotion/styled";
import dayjs from "dayjs";
import { Dispatch, SetStateAction } from "react";

import Button from "@reearth-cms/components/atoms/Button";
Expand Down Expand Up @@ -77,7 +76,7 @@ const DropdownRender: React.FC<Props> = ({
style={{ width: 160 }}
options={options}
onSelect={onFilterSelect}
defaultValue={defaultValue?.operator ?? options[0].value}
defaultValue={options[0].value}
getPopupContainer={trigger => trigger.parentNode}
/>
</StyledFormItem>
Expand All @@ -91,7 +90,6 @@ const DropdownRender: React.FC<Props> = ({
<Select
placeholder="Select the value"
onSelect={onValueSelect}
defaultValue={defaultValue?.value?.toString()}
getPopupContainer={trigger => trigger.parentNode}>
{valueOptions.map(option => (
<Option key={option.value} value={option.value} label={option.label}>
Expand All @@ -107,7 +105,6 @@ const DropdownRender: React.FC<Props> = ({
<InputNumber
onChange={onNumberChange}
stringMode
defaultValue={defaultValue?.value}
style={{ width: "100%" }}
placeholder="Enter the value"
/>
Expand All @@ -117,16 +114,9 @@ const DropdownRender: React.FC<Props> = ({
style={{ width: "100%" }}
placeholder="Select the date"
showNow={false}
defaultValue={
defaultValue && defaultValue.value !== "" ? dayjs(defaultValue.value) : undefined
}
/>
) : (
<Input
onChange={onInputChange}
defaultValue={defaultValue?.value}
placeholder="Enter the value"
/>
<Input onChange={onInputChange} placeholder="Enter the value" />
)}
</StyledFormItem>
)}
Expand Down
Loading

0 comments on commit f4d8c2d

Please sign in to comment.