Skip to content

Commit

Permalink
Merge branch 'develop' into unit-tests-coverage
Browse files Browse the repository at this point in the history
# Conflicts:
#	inji-web/src/pages/IssuerPage/CertificateList.js
shiva-beehyv committed Apr 12, 2024
2 parents c8d07b0 + 02b8e69 commit b2acc48
Showing 11 changed files with 81 additions and 20 deletions.
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Inji-Web
Injiweb is a web interface for users who does not have access to smartphone for accessing and using digital credentials. A user should be able to do primariliy 4 key actions - fetch, download, store, share.

---
# Installations:

Node 18 - Can be installed using [nvm](https://github.com/nvm-sh/nvm). Run following commands to install node

```
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
$ nvm install 18
```
---
# Configuration:
Inji web connects with a backend-for-frontend service called Mimoto. URLs to connect with this service can be updated in the config file by running the following command:
```
$ nano ./inji-web/src/utils/config.js
```
Once the config file is updated run following commands to save the updates:

`ctrl + o` and then `y` to save the changes

`ctrl + x` to exit

---

# Folder Structure:

* **helm:** folder contains helm charts required to deploy on K8S

* **inji-web:** contains the source code and Dockerfile

---

# Run Inji Web:

* Run following commands to start the application:

```
$ cd ./inji-web
$ npm install
$ npm start
```
Run `npm test` to run tests


- Build and run Docker for a service:
```
$ cd ./inji-web
$ docker build -t <dockerImageName>:<tag> .
$ docker run -it -d -p 3000:3000 <dockerImageName>:<tag>
```

- Open URL http://localhost:3000

12 changes: 12 additions & 0 deletions inji-web/Dockerfile
Original file line number Diff line number Diff line change
@@ -19,6 +19,18 @@ RUN npm run build
# Use an official Nginx image as the final production image
FROM nginx:latest

# Add the ARGs as environment variables
ARG SOURCE
ARG COMMIT_HASH
ARG COMMIT_ID
ARG BUILD_TIME

# Copy labels from build stage
LABEL source=${SOURCE}
LABEL commit_hash=${COMMIT_HASH}
LABEL commit_id=${COMMIT_ID}
LABEL build_time=${BUILD_TIME}

# Copy the built React app from the build container to the Nginx container
COPY --from=build /app/build /usr/share/nginx/html

2 changes: 0 additions & 2 deletions inji-web/README.md

This file was deleted.

Binary file modified inji-web/src/assets/inji-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions inji-web/src/components/molecules/GridComponent.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import * as React from 'react';
import { experimentalStyled as styled } from '@mui/material/styles';
import {experimentalStyled as styled} from '@mui/material/styles';
import Box from '@mui/material/Box';
import Paper from '@mui/material/Paper';
import Grid from '@mui/material/Grid';
import InteractiveCard from '../atoms/Card';
import CustonDownloadButton from '../atoms/CustomDownloadButton';
import { useNavigate } from 'react-router-dom';


const Item = styled(Paper)(({ theme }) => ({
backgroundColor: theme.palette.mode === 'dark' ? '#1A2027' : '#fff',
2 changes: 1 addition & 1 deletion inji-web/src/pages/Home/SearchIssuers.js
Original file line number Diff line number Diff line change
@@ -106,7 +106,7 @@ function SearchIssuers() {
setFormatedOptions(response?.data?.response?.issuers
.map((option) => {
return {
label: option?.display[0].name,
label: option?.display[0].title,
value: option?.credential_issuer,
clientId: option?.client_id,
title: option?.display[0].title
2 changes: 1 addition & 1 deletion inji-web/src/pages/Home/index.js
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ export default function Home(props) {
_axios.get(FETCH_ISSUERS_URL)
.then(response => {
if (response?.data?.response?.issuers) {
setIssuersList(response?.data?.response?.issuers?.filter(issuer => removeUinAndESignetIssuers(issuer.display[0].name)));
setIssuersList(response?.data?.response?.issuers?.filter(issuer => removeUinAndESignetIssuers(issuer.display[0].title)));
}
setLoading(false);
})
2 changes: 1 addition & 1 deletion inji-web/src/pages/IssuerPage/CertificateList.js
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ const getCardsData = (issuerId, issuerDisplayName, authEndpoint, credentialList,
state: state,
clientId: clientId
}));
window.location.replace(getESignetRedirectURL(authEndpoint, cred.scope, clientId, codeChallenge, state));
window.location.assign(getESignetRedirectURL(authEndpoint, cred.scope, clientId, codeChallenge, state));
},
clickable: true
}
10 changes: 4 additions & 6 deletions inji-web/src/pages/IssuerPage/Header.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import React, {useEffect, useState} from 'react';
import {Grid, IconButton, Typography, Autocomplete, TextField, CircularProgress} from "@mui/material";
import {Autocomplete, CircularProgress, Grid, IconButton, TextField, Typography} from "@mui/material";
import styled from "@emotion/styled";
import Box from "@mui/material/Box";
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
import { useNavigate, useParams } from 'react-router-dom';
import {
getCertificatesAutoCompleteOptions
} from "../../utils/misc";
import {useNavigate} from 'react-router-dom';
import {getCertificatesAutoCompleteOptions} from "../../utils/misc";

export const StyledHeader = styled(Box)`
background-color: #F2FBFF;
@@ -74,7 +72,7 @@ function Header({issuerDisplayName, loading, credentialsList, updateCredentialsL
} else {
updateCredentialsList(defaultOptions)
}

}}
onClick={(event) => {
if (!event?.target?.value) {
9 changes: 4 additions & 5 deletions inji-web/src/pages/PageTemplate/Navbar.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import * as React from 'react';
import Box from '@mui/material/Box';
import Container from '@mui/material/Container';
import Button from '@mui/material/Button';
import Tooltip from '@mui/material/Tooltip';
import {Grid, Link, Typography} from "@mui/material";
import {Grid} from "@mui/material";

import {DownloadButton, InjiNavbar, StyledGridItem, StyledLink, StyledToolbar} from "./styles";
import { useNavigate } from 'react-router-dom';
import {InjiNavbar, StyledGridItem, StyledLink, StyledToolbar} from "./styles";
import {useNavigate} from 'react-router-dom';
import logo from "../../assets/inji-logo.png";
import DownloadAppStore from '../../assets/DownloadAppStore.svg';
import DownloadFromGooglePlay from '../../assets/DownloadFromPlay.svg';
@@ -22,7 +21,7 @@ function Navbar(props) {
<StyledToolbar disableGutters>
<Grid container style={{justifyItems: 'end'}}>
<StyledGridItem item xs={3} onClick={() => {navigate('/')}}>
<img src={logo} alt='logo' width='116px' height='28px'/>
<img src={logo} alt='logo' width='140px' height='70px'/>
</StyledGridItem>
<StyledGridItem item xs={5.5} style={{justifyContent: 'end'}}>
<Box>
2 changes: 1 addition & 1 deletion inji-web/src/utils/misc.js
Original file line number Diff line number Diff line change
@@ -75,4 +75,4 @@ export const downloadCredentials = async (issuerId, certificateId, token) => {
};

// Not present in this list
export const removeUinAndESignetIssuers = (name) => ["UIN, VID, AID", "e-Signet"].indexOf(name) === -1;
export const removeUinAndESignetIssuers = (name) => ["Download MOSIP Credentials via OTP", "Download MOSIP Credentials"].indexOf(name) === -1;

0 comments on commit b2acc48

Please sign in to comment.