Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into PLATE-838
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitabelonogov authored Jan 31, 2024
2 parents 2b5743a + 0df716f commit 7cee29b
Show file tree
Hide file tree
Showing 15 changed files with 120 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- name: Configure yarn cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ env.CACHE_NAME_PREFIX }}-${{ runner.os }}-node-${{ env.NODE }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/yarn.lock') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- name: Configure yarn cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ env.CACHE_NAME_PREFIX }}-${{ runner.os }}-node-${{ env.NODE }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/yarn.lock') }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/git-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: hmarr/[email protected]

- name: Add Workflow link to command comment
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
Expand Down Expand Up @@ -50,7 +50,7 @@ jobs:
echo "merge_conflict=$(git merge-tree $(git merge-base HEAD origin/$SLASH_COMMAND_ARG_BRANCH) origin/$SLASH_COMMAND_ARG_BRANCH HEAD | grep '<<')" >> $GITHUB_OUTPUT
- name: Add reaction to command comment on merge conflict
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
if: ${{ steps.check-conflict.outputs.merge_conflict }}
with:
token: ${{ secrets.GIT_PAT }}
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
- name: Add reaction to command comment on nothing to do
if: ${{ !steps.check-conflict.outputs.merge_conflict && steps.commit_and_push.outputs.changes == 'no' }}
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
Expand All @@ -92,7 +92,7 @@ jobs:

- name: Add reaction to command comment on success
if: ${{ !steps.check-conflict.outputs.merge_conflict && steps.commit_and_push.outputs.changes == 'yes' }}
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
Expand All @@ -103,7 +103,7 @@ jobs:
reactions: "+1"

- name: Add reaction to command comment on failure
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
if: failure()
with:
token: ${{ secrets.GIT_PAT }}
Expand All @@ -119,7 +119,7 @@ jobs:
timeout-minutes: 1
steps:
- name: Update comment
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/help-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- name: Update comment if empty
if: ${{ github.event.client_payload.slash_command.args.all == '' }}
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/jira-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: hmarr/[email protected]

- name: Add Workflow link to command comment
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
type: ${{ github.event.client_payload.slash_command.args.unnamed.arg2 || 'task' }}

- name: Add reaction to command comment on success
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
Expand All @@ -74,7 +74,7 @@ jobs:
reactions: "+1"

- name: Add reaction to command comment on failure
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
if: failure()
with:
token: ${{ secrets.GIT_PAT }}
Expand All @@ -91,7 +91,7 @@ jobs:
timeout-minutes: 1
steps:
- name: Update comment
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/slash-command-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:

- name: Edit comment with error message
if: ${{ steps.determine_command.outputs.command_state == 'unknown' }}
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ github.event.comment.id }}
body: |
Expand Down
4 changes: 2 additions & 2 deletions src/components/CellViews/DateTimeCell.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { format, isValid } from "date-fns";
export const dateTimeFormat = "MMM dd yyyy, HH:mm:ss";

export const DateTimeCell = (column) => {
const date = new Date(column.value);
const dateFormat = "MMM dd yyyy, HH:mm:ss";

return column.value ? (
<div style={{ whiteSpace: "nowrap" }}>
{isValid(date) ? format(date, dateFormat) : ""}
{isValid(date) ? format(date, dateTimeFormat) : ""}
</div>
) : (
""
Expand Down
45 changes: 45 additions & 0 deletions src/components/CellViews/ProjectCell.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { getRoot } from "mobx-state-tree";
import { Fragment } from "react";

const ProjectLink = ({ project }) => {
const projectID = project.id;
const onClick = (e) => {
e.stopPropagation();

};

return (
<a href={`/projects/${projectID}/data`} onClick={onClick}>
{project.title}
</a>
);
};

export const ProjectCell = (cell) => {
const { original, value } = cell;
const root = getRoot(original);
const projectList = value
.map(projectRef => root.taskStore.associatedList.find(proj => proj.id === projectRef.project_id))
.filter(Boolean);

return (
<div
style={{
maxHeight: "100%",
overflow: "hidden",
fontSize: 12,
lineHeight: "16px",
}}
>
{projectList && (
projectList
.map((projectRef, index) => (
<Fragment key={projectRef.project_id}>
{index > 0 && ", "}
<ProjectLink project={projectRef} />
</Fragment>
))
)}
</div>
);
};
29 changes: 18 additions & 11 deletions src/components/CellViews/StringCell.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
const valueToString = (value) => {
import { format, isValid } from "date-fns";
import { dateTimeFormat } from "./DateTimeCell";

export const valueToString = (value) => {
if (typeof value === "string") return value;
/* if undefined or null we'll treat it as empty string */
if (value === undefined || value === null) return "";
if (value instanceof Date && isValid(value)) return format(value, dateTimeFormat);

try {
/* JSON.stringify will handle JSON and non-strings, non-null, non-undefined */
return JSON.stringify(value);
} catch {
return value.toString();
return 'Error: Invalid JSON';
}
};

export const StringCell = ({ value }) => {
const style = {
maxHeight: "100%",
overflow: "hidden",
fontSize: 12,
lineHeight: "16px",
};

return (
<div
style={{
maxHeight: "100%",
overflow: "hidden",
fontSize: 12,
lineHeight: "16px",
}}
>
{value ? valueToString(value) : ""}
<div style={style}>
{valueToString(value)}
</div>
);
};
2 changes: 2 additions & 0 deletions src/components/CellViews/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ export { NumberCell as Number } from "./NumberCell";
export { StringCell as String } from "./StringCell";
export { StringCell as Text } from "./StringCell";
export { VideoCell as Video } from "./VideoCell";
export { ProjectCell as Project } from './ProjectCell';

7 changes: 5 additions & 2 deletions src/components/Common/Table/TableHead/TableHead.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { TableContext, TableElem } from "../TableContext";
import { getStyle } from "../utils";
import "./TableHead.styl";
import { FF_DEV_2984, FF_DEV_3873, FF_LOPS_E_10, isFF } from "../../../../utils/feature-flags";
import { getRoot } from "mobx-state-tree";

const { Block, Elem } = BemWithSpecifiContext();

Expand Down Expand Up @@ -120,9 +121,11 @@ const ColumnRenderer = observer(
);
}

const root = getRoot(column.original);
const isDE = root.SDK.type === "DE";
const canOrder = sortingEnabled && column.original?.canOrder;
const Decoration = decoration?.get?.(column);
const extra = columnHeaderExtra
const extra = !isDE && columnHeaderExtra
? columnHeaderExtra(column, Decoration)
: null;
const content = Decoration?.content
Expand Down Expand Up @@ -158,7 +161,7 @@ const ColumnRenderer = observer(
onResizeFinished={(width) => onResize?.(column, width)}
onReset={() => onReset?.(column)}
>
{column.parent ? (
{!isDE && column.parent ? (
<DropdownWrapper
column={column}
cellViews={cellViews}
Expand Down
7 changes: 5 additions & 2 deletions src/components/Common/TableOld/TableHead/TableHead.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { TableContext, TableElem } from "../TableContext";
import { getStyle } from "../utils";
import "./TableHead.styl";
import { FF_DEV_2984, FF_DEV_3873, isFF } from "../../../../utils/feature-flags";
import { getRoot } from "mobx-state-tree";

const { Block, Elem } = BemWithSpecifiContext();

Expand Down Expand Up @@ -110,9 +111,11 @@ const ColumnRenderer = observer(
);
}

const root = getRoot(column.original);
const isDE = root.SDK.type === "DE";
const canOrder = sortingEnabled && column.original?.canOrder;
const Decoration = decoration?.get?.(column);
const extra = columnHeaderExtra
const extra = !isDE && columnHeaderExtra
? columnHeaderExtra(column, Decoration)
: null;
const content = Decoration?.content
Expand Down Expand Up @@ -148,7 +151,7 @@ const ColumnRenderer = observer(
onResizeFinished={(width) => onResize?.(column, width)}
onReset={() => onReset?.(column)}
>
{column.parent ? (
{!isDE && column.parent ? (
<DropdownWrapper
column={column}
cellViews={cellViews}
Expand Down
6 changes: 5 additions & 1 deletion src/components/MainView/DataView/DataView.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,13 @@ export const DataView = injector(
},
},
{
resolver: (col) => col.type === "Image",
resolver: (col) => col.type === "Image" && col.original && getRoot(col.original)?.SDK?.type !== 'DE',
style: { width: 150, justifyContent: "center" },
},
{
resolver: (col) => col.type === "Image" && col.original && getRoot(col.original)?.SDK?.type === 'DE',
style: { width: 150 },
},
{
resolver: (col) => ["Date", "Datetime"].includes(col.type),
style: { width: 240 },
Expand Down
8 changes: 6 additions & 2 deletions src/components/MainView/DataViewOld/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const DataView = injector(
} else if (e.metaKey || e.ctrlKey) {
window.open(`./?task=${itemID}`, "_blank");
} else {
if (isFF(FF_OPTIC_2)) await store._sdk.lsf?.saveDraft();
if (isFF(FF_OPTIC_2)) store._sdk.lsf?.saveDraft();
getRoot(view).startLabeling(item);
}
},
Expand Down Expand Up @@ -247,9 +247,13 @@ export const DataView = injector(
},
},
{
resolver: (col) => col.type === "Image",
resolver: (col) => col.type === "Image" && col.original && getRoot(col.original)?.SDK?.type !== 'DE',
style: { width: 150, justifyContent: "center" },
},
{
resolver: (col) => col.type === "Image" && col.original && getRoot(col.original)?.SDK?.type === 'DE',
style: { width: 150 },
},
{
resolver: (col) => ["Date", "Datetime"].includes(col.type),
style: { width: 240 },
Expand Down
Loading

0 comments on commit 7cee29b

Please sign in to comment.