Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta Release #2645

Merged
merged 24 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
cda7c62
task: use react-number-format
finnar-bin Feb 13, 2024
af4ce52
Merge branch 'master' of github.com:zesty-io/manager-ui into enhancem…
finnar-bin Feb 15, 2024
827c203
Merge branch 'master' into enhancement/number-field-revamp
finnar-bin Feb 21, 2024
45cf9d4
task: add decrement and increment buttons
finnar-bin Feb 22, 2024
da20b56
task: simplify increment/decrement functions
finnar-bin Feb 22, 2024
428790f
task: default to 0
finnar-bin Feb 22, 2024
5038ee1
task: preserve cursor location when value defaults to 0
finnar-bin Feb 22, 2024
4776588
task: created separate FieldTypeNumber component
finnar-bin Feb 22, 2024
bd7cf88
chore: cleanup
finnar-bin Feb 22, 2024
bb797ce
task: update test
finnar-bin Feb 25, 2024
54a6393
task: change increment/decrement logic
finnar-bin Feb 27, 2024
978835e
Merge branch 'master' into enhancement/number-field-revamp
finnar-bin Feb 29, 2024
1837749
pluralize uploadal text
glespinosa Mar 13, 2024
682afbe
Merge branch 'master' into enhancement/number-field-revamp
finnar-bin Mar 15, 2024
5045420
task: treat number values as numbers instead of strings
finnar-bin Mar 15, 2024
19de103
Merge branch 'master' into enhancement/number-field-revamp
finnar-bin Mar 20, 2024
60ed58b
Merge branch 'master' into enhancement/number-field-revamp
finnar-bin Mar 20, 2024
501a39d
Merge branch 'dev' into enhancement/number-field-revamp
shrunyan Mar 25, 2024
8aceff2
cleanup workflows
shrunyan Mar 27, 2024
bae09be
tighten up deploy message
shrunyan Mar 27, 2024
9ad14c2
Number field revamp (#2566)
shrunyan Mar 27, 2024
a6aa618
Stage Release (#2644)
shrunyan Mar 27, 2024
e286266
fix: Media: Upload Modal - Title does not become plural (#2589)
shrunyan Mar 27, 2024
554191b
Stage Release (#2646)
shrunyan Mar 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/cd-beta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
# SLACK_COLOR: "#FF0000"
# SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png
# SLACK_MESSAGE: "PR merge by ${{ github.actor }} failed to deploy."
# SLACK_TITLE: FAILED Beta Deployment for manager-ui
# SLACK_TITLE: FAILED: Beta Deployment for manager-ui
# SLACK_USERNAME: Deploy Bot
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

Expand All @@ -73,7 +73,7 @@ jobs:
# SLACK_COLOR: "#FF0000"
# SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png
# SLACK_MESSAGE: "PR merge by ${{ github.actor }} has been deployed to stage."
# SLACK_TITLE: Beta Deployment for manager-ui
# SLACK_TITLE: BETA:manager-ui
# SLACK_USERNAME: Deploy Bot
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cd-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ jobs:
SLACK_COLOR: "#75BF43"
SLACK_ICON: https://brand.zesty.io/zesty-io-logo.svg
# SLACK_MESSAGE: "PR merge by ${{ github.actor }} has been deployed to stage."
SLACK_TITLE: "SUCCESS: Dev Deployment of manager-ui"
SLACK_TITLE: "DEV:manager-ui"
SLACK_USERNAME: Deploy Bot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

# create_stage_release:
# create_release:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout Repo
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cd-stable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
# SLACK_COLOR: "#FF0000"
# SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png
# SLACK_MESSAGE: "PR merge by ${{ github.actor }} failed to deploy."
# SLACK_TITLE: FAILED Stable Deployment for manager-ui
# SLACK_TITLE: FAILED: Stable Deployment for manager-ui
# SLACK_USERNAME: Deploy Bot
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

Expand All @@ -73,6 +73,6 @@ jobs:
# SLACK_COLOR: "#FF0000"
# SLACK_ICON: https://clipart.world/wp-content/uploads/2021/06/Rocket-Ship-clipart-png.png
# SLACK_MESSAGE: "PR merge by ${{ github.actor }} has been deployed to stage."
# SLACK_TITLE: Stable Deployment for manager-ui
# SLACK_TITLE: STABLE:manager-ui
# SLACK_USERNAME: Deploy Bot
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
38 changes: 1 addition & 37 deletions .github/workflows/cd-stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
SLACK_COLOR: "#75BF43"
SLACK_ICON: https://brand.zesty.io/zesty-io-logo.svg
# SLACK_MESSAGE: "PR merge by ${{ github.actor }} has been deployed to stage."
SLACK_TITLE: "SUCCESS: Stage Deployment of manager-ui"
SLACK_TITLE: "STAGE:manager-ui"
SLACK_USERNAME: Deploy Bot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}

Expand Down Expand Up @@ -103,39 +103,3 @@ jobs:
run: gh pr create -B beta -H stage --title 'Beta Release' --body 'Created by Github action'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# unify_dev_history:
# runs-on: ubuntu-latest
# # needs: [deploy_stage]
# steps:
# - name: Checkout Repo
# uses: actions/checkout@v4

# - name: Check if PR exists
# id: check
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# prs=$(gh pr list \
# --repo "$GITHUB_REPOSITORY" \
# --head 'stage' \
# --base 'dev' \
# --json title \
# --jq 'length')
# if ((prs > 0)); then
# echo "skip=true" >> "$GITHUB_OUTPUT"
# fi

# - name: Merge Stage Release to Dev
# if: "!steps.check.outputs.skip"
# run: gh pr create -B dev -H stage --title 'Merge Stage:Dev' --body 'Created by Github action'
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# unify_dev_history:
# runs-on: ubuntu-latest
# steps:
# - id: create-dev-pr
# run: gh pr create -B dev -H stage --title 'Merge Stage:Dev' --body 'Update dev history with stage release. PR created and merged by Github action'
# - id: merge-dev-pr
# run: gh pr merge --auto --squash ${{steps.create-dev-pr.}}
2 changes: 1 addition & 1 deletion cypress/e2e/content/content.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ describe("Content Specs", () => {
it("Number Field", () => {
// NOTE: the timestamp is too large for the 'small int' column in the DB
// limit is 4294967295
cy.get("#12-9b96ec-tll2gn input[type=number]")
cy.get("#12-9b96ec-tll2gn input[type=text]")
.focus()
/*
input type='number 'cannot be empty so rather than whitespace, it'd have a value of 0
Expand Down
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"react-flatpickr": "^3.10.7",
"react-measure": "^2.5.2",
"react-monaco-editor": "^0.47.0",
"react-number-format": "^5.3.1",
"react-redux": "^7.2.4",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import {
import { FieldTypeDate } from "../../../../../../../shell/components/FieldTypeDate";
import { FieldTypeDateTime } from "../../../../../../../shell/components/FieldTypeDateTime";
import { FieldTypeSort } from "../../../../../../../shell/components/FieldTypeSort";
import { FieldTypeNumber } from "../../../../../../../shell/components/FieldTypeNumber";

import styles from "./Field.less";
import { MemoryRouter } from "react-router";
Expand Down Expand Up @@ -859,16 +860,12 @@ export const Field = ({
case "number":
return (
<FieldShell settings={fieldData} errors={errors}>
<TextField
size="small"
variant="outlined"
type="number"
fullWidth
value={value ? value.toString() : "0"}
<FieldTypeNumber
value={+value || 0}
name={name}
required={required}
onChange={(evt) => onChange(evt.target.value, name)}
error={errors && Object.values(errors)?.some((error) => !!error)}
onChange={onChange}
hasError={errors && Object.values(errors)?.some((error) => !!error)}
/>
</FieldShell>
);
Expand Down
5 changes: 4 additions & 1 deletion src/apps/media/src/app/components/UploadModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { DnDProvider } from "./DnDProvider";
import { UploadButton } from "./UploadButton";
import CloseIcon from "@mui/icons-material/Close";
import { mediaManagerApi } from "../../../../../shell/services/mediaManager";
import pluralizeWord from "../../../../../utility/pluralizeWord";

export const UploadModal: FC = () => {
const dispatch = useDispatch();
Expand Down Expand Up @@ -227,7 +228,9 @@ const UploadHeaderText = ({ uploads }: UploadHeaderTextProps) => {
{filesUploading?.length > 0
? filesUploading.length
: filesUploaded.length}{" "}
File{filesUploading.length > 1 && "s"}{" "}
{filesUploading?.length > 0
? pluralizeWord("File", filesUploading.length)
: pluralizeWord("File", filesUploaded.length)}{" "}
{filesUploading?.length > 0 ? "Uploading" : "Uploaded"}
</Typography>
</Stack>
Expand Down
93 changes: 93 additions & 0 deletions src/shell/components/FieldTypeNumber.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import { useEffect, useRef } from "react";
import { IconButton, Stack, TextField } from "@mui/material";
import RemoveRoundedIcon from "@mui/icons-material/RemoveRounded";
import AddRoundedIcon from "@mui/icons-material/AddRounded";

import { NumberFormatInput } from "./NumberFormatInput";

type FieldTypeNumberProps = {
required: boolean;
name: string;
value: number;
onChange: (value: number, name: string) => void;
hasError: boolean;
};
export const FieldTypeNumber = ({
required,
value,
onChange,
name,
hasError,
}: FieldTypeNumberProps) => {
const numberInputRef = useRef(null);

useEffect(() => {
if (value === 0) {
numberInputRef.current?.setSelectionRange(1, 1);
}
}, [value]);

const modifyNumberValue = (action: "increment" | "decrement") => {
if (value.toString().includes("e")) return;

const integerFractionalSplit = value.toString().split(".");

switch (action) {
case "increment":
integerFractionalSplit[0] = (+integerFractionalSplit[0] + 1).toString();
break;

case "decrement":
integerFractionalSplit[0] = (+integerFractionalSplit[0] - 1).toString();
break;

default:
break;
}

onChange(+integerFractionalSplit.join("."), name);
};

return (
<TextField
inputRef={numberInputRef}
variant="outlined"
fullWidth
value={value || 0}
name={name}
required={required}
onChange={(evt) => {
onChange(+evt.target.value?.toString()?.replace(/^0+/, "") ?? 0, name);
}}
onKeyDown={(evt) => {
if ((evt.key === "Backspace" || evt.key === "Delete") && value === 0) {
evt.preventDefault();
}
}}
error={hasError}
InputProps={{
endAdornment: (
<Stack direction="row" gap={1}>
<IconButton
size="small"
onClick={() => modifyNumberValue("decrement")}
>
<RemoveRoundedIcon fontSize="small" />
</IconButton>
<IconButton
size="small"
onClick={() => modifyNumberValue("increment")}
>
<AddRoundedIcon fontSize="small" />
</IconButton>
</Stack>
),
inputComponent: NumberFormatInput as any,
inputProps: {
thousandSeparator: true,
valueIsNumericString: true,
},
}}
/>
);
};
32 changes: 32 additions & 0 deletions src/shell/components/NumberFormatInput/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { forwardRef } from "react";
import {
NumericFormatProps,
InputAttributes,
NumericFormat,
} from "react-number-format";

type NumberFormatInputProps = {
onChange: (event: { target: { name: string; value: number } }) => void;
name: string;
};
export const NumberFormatInput = forwardRef<
NumericFormatProps<InputAttributes>,
NumberFormatInputProps
>((props, ref) => {
const { onChange, ...other } = props;

return (
<NumericFormat
{...other}
getInputRef={ref}
onValueChange={(values) => {
onChange({
target: {
name: props.name,
value: values.floatValue || 0,
},
});
}}
/>
);
});
Loading