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

fix: multiple bug fixes and features #28

Merged
merged 42 commits into from
May 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
2c7471e
fix: add loading while searching and reset the state of packages
henilp105 Apr 25, 2023
6b2d6a5
fix: ordering of versions
henilp105 Apr 25, 2023
2fb5f17
Merge branch 'main' of https://github.com/henilp105/registry
henilp105 Apr 25, 2023
528c053
fix: tests for user_identifier
henilp105 Apr 26, 2023
f22d090
Merge branch 'fortran-lang:main' into main
henilp105 Apr 27, 2023
ed4c9df
Merge branch 'fortran-lang:main' into main
henilp105 Apr 29, 2023
40e92da
add : semantic version based sorting and links for version and padding
henilp105 Apr 29, 2023
bbdb89d
feat: added toast for namespace create
henilp105 Apr 29, 2023
a89af68
feat:packages api fix and font size
henilp105 Apr 29, 2023
2913954
feat: add react toastify
henilp105 Apr 29, 2023
3a692c0
feat : fix the docker conatiner outputs
henilp105 Apr 29, 2023
9e4f81d
feat: add test cases verification
henilp105 Apr 29, 2023
0735511
feat: add test cases verification
henilp105 Apr 29, 2023
f4ae36e
feat: add test cases verification
henilp105 Apr 29, 2023
3318040
feat: add test cases verification
henilp105 Apr 29, 2023
8d69a78
feat: add test cases verification
henilp105 Apr 29, 2023
81e32f2
feat: add test cases verification
henilp105 Apr 29, 2023
de82098
fix: mutiple search loading states
henilp105 May 1, 2023
a3bc67c
fix: user page fonts and adding
henilp105 May 1, 2023
8c1cc66
update workflow
henilp105 May 1, 2023
da41317
fix: states for the redux dtates for react toastify
henilp105 May 1, 2023
b860570
set: the CONTAINER ID for the workflows
henilp105 May 1, 2023
e7550e4
set: the CONTAINER ID for the workflows
henilp105 May 1, 2023
e4f83a0
set: the CONTAINER ID for the workflows
henilp105 May 1, 2023
fd2b7a4
set: flask 2.2.4 for flasgger bug #562
henilp105 May 1, 2023
f6b58d5
set: mongo_uri and user and password for tests
henilp105 May 1, 2023
51cf2aa
set: mongo_uri and user and password for tests
henilp105 May 1, 2023
b8017ad
set: mongo_uri and user and password for tests
henilp105 May 1, 2023
0b89b74
feat: rename the actions
henilp105 May 2, 2023
06a4e6b
feat: fix tests
henilp105 May 2, 2023
8c88b3e
fix: support mobile view and fix padding and unsed variables
henilp105 May 2, 2023
bdfc2a1
feat: tests to chcek for tests
henilp105 May 3, 2023
16d27b8
feat: notify the user for spdx license
henilp105 May 3, 2023
3e998c2
feat: notify the user for spdx license
henilp105 May 3, 2023
82130c5
feat: tests to check for tests
henilp105 May 3, 2023
584b428
fix: docker compose files
henilp105 May 3, 2023
cd11f35
fix: apidocs for the flasgger
henilp105 May 6, 2023
80e2175
fix:actions
henilp105 May 6, 2023
6f0d719
fix:actions
henilp105 May 6, 2023
d60b0f5
fix: CI
henilp105 May 7, 2023
eff86b5
fix: CI
henilp105 May 7, 2023
97875e0
Merge branch 'fortran-lang:main' into main
henilp105 May 7, 2023
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
23 changes: 23 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Run Tests for Backend

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout page source
uses: actions/checkout@v3

- name: Build the Docker image and run tests
run: docker compose -f "compose.test.yaml" up -d

- name: Print Logs for Container
run: |
export CONTAINER_ID=$(docker ps -aqf "name=ci")
`docker logs -f $CONTAINER_ID` | grep -i "FAILED" && exit 1 || exit 0
21 changes: 0 additions & 21 deletions .github/workflows/docker-image.yml

This file was deleted.

12 changes: 10 additions & 2 deletions compose.test.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
services:
test:
test_ci:
build:
context: flask
target: builder
Expand All @@ -10,9 +10,17 @@ services:
- ./flask:/src
depends_on:
- tests_db
environment:
environment: # these are the test environment variables.
- MONGO_DB_NAME=testregistry
- MONGO_URI=mongodb://mongo:27017/testregistry
- MONGO_USER_NAME=testuser
- MONGO_PASSWORD=testpassword
- SALT=MYSALT
- HOST=localhost
- RESET_EMAIL=reset@localhost.com
- RESET_PASSWORD=reset
- SUDO_PASSWORD=fortran

tests_db:
image: mongo

Expand Down
18 changes: 17 additions & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,31 @@ services:
# flask requires SIGINT to stop gracefully
# (default stop signal from Compose is SIGTERM)
stop_signal: SIGINT
environment:
environment: # these are the test environment variables.
- FLASK_SERVER_PORT=9091
- MONGO_DB_NAME=registry
- MONGO_URI=mongodb://mongo:27017/fpmregistry
- SALT=MYSALT
- MONGO_DB_NAME=fpmregistry
- SUDO_PASSWORD=fortran
- MONGO_USER_NAME=fortran
- MONGO_PASSWORD=fortran
- HOST=localhost
- RESET_EMAIL=reset@localhost.com
- RESET_PASSWORD=reset

volumes:
- ./flask:/src
depends_on:
- mongo

validate_package:
build:
context: flask
dockerfile: validate_package.Dockerfile
stop_signal: SIGINT
volumes:
- ./flask:/src

mongo:
image: mongo
2 changes: 1 addition & 1 deletion flask/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def upload():

# Check whether license identifier is valid or not.
if not is_valid_license_identifier(license_str=package_license):
return jsonify({"code": 400, "message": "Invalid license identifier"})
return jsonify({"code": 400, "message": f"Invalid license identifier {package_license}. Please check the SPDX license identifier list."})

# Find the document that contains the upload token.
namespace_doc = db.namespaces.find_one({"upload_tokens": {"$elemMatch": {"token": upload_token}}})
Expand Down
2 changes: 1 addition & 1 deletion flask/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pymongo
flask
flask==2.2.4
python-dateutil
python-dotenv
bcrypt
Expand Down
3 changes: 0 additions & 3 deletions flask/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ def delete_user():


@app.route("/users/account", methods=["POST"])
@swag_from("documentation/account.yaml", methods=["POST"])
def account():
uuid = request.form.get("uuid")
if not uuid:
Expand All @@ -176,7 +175,6 @@ def account():


@app.route("/users/admin", methods=["POST"])
@swag_from("documentation/admin.yaml", methods=["POST"])
def admin():
uuid = request.form.get("uuid")
if not uuid:
Expand All @@ -197,7 +195,6 @@ def admin():


@app.route("/users/admin/transfer", methods=["POST"])
@swag_from("documentation/admin.yaml", methods=["POST"])
def transfer_account():
uuid = request.form.get("uuid")
if not uuid:
Expand Down
31 changes: 22 additions & 9 deletions registry/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 registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"react-redux": "^8.0.5",
"react-router-dom": "^6.7.0",
"react-scripts": "5.0.1",
"react-toastify": "^9.1.2",
"redux": "^4.2.1",
"redux-persist": "^6.0.0",
"styled-components": "^5.3.6",
Expand Down
31 changes: 16 additions & 15 deletions registry/src/components/packageItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const PackageItem = ({ packageEntity }) => {

return (
<MDBListGroupItem id="list-item">
<Row>
<Row style={{ padding: "5px" }}>
<Col md={1}>
<Image
src="https://fortran-lang.org/en/_static/fortran-logo-256x256.png"
Expand All @@ -43,25 +43,26 @@ const PackageItem = ({ packageEntity }) => {
height={60}
/>
</Col>
<Col md={4}>
<div>
<h5 id="list-item-package-name">
<a
href={`/packages/${packageEntity.namespace}/${packageEntity.name}`}
style={{ textDecoration: "none" }}
>
{packageEntity.name}
</a>
</h5>
</div>
<Col md={4} style={{ padding: "10px" }}>
<h5 id="list-item-package-name">
<a
href={`/packages/${packageEntity.namespace}/${packageEntity.name}`}
style={{ textDecoration: "none" }}
>
{packageEntity.name}
</a>
</h5>
<h6 className="mb-2 text-muted">
Namespace {packageEntity.namespace}
</h6>
<label className="mb-2 text-muted">{packageEntity.description}</label>
<label className="mb-2 text-muted" style={{ fontSize: "18px" }}>
{packageEntity.description}
</label>
</Col>
<Col md={1} style={{ flex: 1, textAlign: "right" }}>
<h6>By {packageEntity.author}</h6>
<label>{formatDate(packageEntity.updatedAt)}</label>
<label style={{ fontSize: "16px" }}>
Last released {formatDate(packageEntity.updatedAt)}
</label>
</Col>
</Row>
</MDBListGroupItem>
Expand Down
38 changes: 33 additions & 5 deletions registry/src/pages/createNamespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import Spinner from "react-bootstrap/Spinner";
import Button from "react-bootstrap/Button";
import Form from "react-bootstrap/Form";
import { Card } from "react-bootstrap";
import { ToastContainer, toast } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";

const NamespaceForm = () => {
const dispatch = useDispatch();
Expand All @@ -14,6 +16,26 @@ const NamespaceForm = () => {
const isLoading = useSelector((state) => state.createNamespace.isLoading);
const message = useSelector((state) => state.createNamespace.message);
const statuscode = useSelector((state) => state.createNamespace.statuscode);
const toast_css = {
position: "top-center",
autoClose: 5000,
hideProgressBar: false,
closeOnClick: true,
pauseOnHover: true,
draggable: true,
progress: undefined,
theme: "light",
};

useEffect(() => {
henilp105 marked this conversation as resolved.
Show resolved Hide resolved
if (statuscode === 200) {
toast.success(message, {
onClose: () => navigate("/manage/projects")
});
} else if (statuscode !== 0 && statuscode !== 200) {
toast.error(message, toast_css);
}
}, [statuscode]);

useEffect(() => {
if (uuid === null) {
Expand All @@ -40,6 +62,17 @@ const NamespaceForm = () => {
return !isLoading ? (
<Card id="create-namespace-card">
<h3>Create a namespace</h3>
<ToastContainer
position="top-center"
autoClose={5000}
hideProgressBar={false}
newestOnTop={false}
closeOnClick
rtl={false}
pauseOnFocusLoss
pauseOnHover
theme="light"
/>
<Form onSubmit={handleSubmit}>
<Form.Group
className="mb-3"
Expand Down Expand Up @@ -82,11 +115,6 @@ const NamespaceForm = () => {
Submit
</Button>
</Form>
{statuscode === 200 ? (
<p className="success">{message}</p>
) : (
<p className="error">{message}</p>
)}
</Card>
) : (
<div className="d-flex justify-content-center">
Expand Down
2 changes: 1 addition & 1 deletion registry/src/pages/namespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const NamespacePage = () => {
{" Namespace: " + namespace}
</MDBIcon>
<MDBIcon style={{ marginTop: "5px" }} far icon="calendar-alt">
{" Joined " + Date(dateJoined).slice(4, 15)}
{" Created " + Date(dateJoined).slice(4, 15)}
</MDBIcon>

</Row>
Expand Down
Loading