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

HLM-1098 | View inbuilt attributes #1348

Merged
merged 4 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 5 additions & 5 deletions docker-compose-vc-issuance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
vc-registry:
image: dockerhub/sunbird-rc-core:v0.0.9-3
image: dockerhub/sunbird-rc-core:v0.0.10-1
volumes:
- ./vc-registry:/home/sunbirdrc/config/public/_schemas
environment:
Expand Down Expand Up @@ -164,7 +164,7 @@ services:
retries: 4
# VC Issuance as a platform
vc-certification-service:
image: divoc/vc-certification-service:3.0.0-alpha
image: divoc/vc-certification-service:3.1.0-generic
ports:
- "7654:7654"
environment:
Expand All @@ -183,7 +183,7 @@ services:
condition: service_started

vc-management-service:
image: divoc/vc-management-service:3.0.0-alpha
image: divoc/vc-management-service:3.1.0-generic
ports:
- "7655:7655"
environment:
Expand Down Expand Up @@ -230,10 +230,10 @@ services:
image: divoc/tenant-portal

verification-app:
image: divoc/verification-app
image: divoc/vc-verification-webapp:3.1.0-generic

vc-certify-consumer:
image: divoc/vc-certify-consumer:3.0.0-alpha
image: divoc/vc-certify-consumer:3.1.0-generic
environment:
SUNBIRD_REGISTRY_URL: "http://vc-registry:8081"
KAFKA_BOOTSTRAP_SERVERS: kafka:9092
Expand Down
15 changes: 15 additions & 0 deletions tenant-portal/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,20 @@
"text": "Make sure to store this safely. Once you leave this page, you will not be able to access this token again",
"imptext":"This token is valid for 1 year."
}
},

"inbuiltAtrributesPage": {
"label": "Label",
"fieldType": "Field Type",
"mandatory": "Mandatory",
"indexed": "Indexed",
"unique": "Unique",
"description": "Description",
"action": "Action",
"inbuiltAttributes": "Inbuilt Attributes",
"inbuiltAttributesHeading1": "View the inuilt attributes below that are required as a part of W3C standards.",
"inbuiltAttributesHeading2": "These inbuilt attributes are common across schemas and no new fields can be added and existing fields be deleted.",
"fields": "Fields",
"backButton": "Back to Manage Schema"
}
}
15 changes: 15 additions & 0 deletions tenant-portal/public/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,20 @@
"text": "इसे सुरक्षित रूप से स्टोर करना सुनिश्चित करें। एक बार जब आप इस पेज को छोड़ देते हैं, तो आप इस टोकन को दोबारा एक्सेस नहीं कर पाएंगे",
"imptext":"यह टोकन 1 वर्ष के लिए वैध है."
}
},

"inbuiltAtrributesPage": {
"label": "लेबल",
"fieldType": "क्षेत्र के जैसा",
"mandatory": "अनिवार्य",
"indexed": "इंडेक्स किए गए",
"unique": "अद्वितीय",
"description": "विवरण",
"action": "गतिविधि",
"inbuiltAttributes": "इनबिल्ट गुण",
"inbuiltAttributesHeading1": "W3C मानकों के एक भाग के रूप में आवश्यक इनबिल्ट विशेषताओं को नीचे देखें।",
"inbuiltAttributesHeading2": "स्कीमा में ये अंतर्निहित विशेषताएँ सामान्य हैं और कोई नया फ़ील्ड नहीं जोड़ा जा सकता है और मौजूदा फ़ील्ड हटा दिए जा सकते हैं।",
"fields": "खेत",
"backButton": "मैनेज स्कीमा पर वापस"
}
}
31 changes: 31 additions & 0 deletions tenant-portal/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,35 @@
cursor: default;
pointer-events: none;
color: #484646;
}

.table-heading {
font-family: Open Sans, sans-serif;
font-size: 18px;
font-weight: 700;
line-height: 25px;
text-align: left;
}

.table-col-header {
font-family: Open Sans, sans-serif;
font-size: 16px;
font-weight: 700;
line-height: 22px;
text-align: left;
background-color: #F3F3F3;
color: #484646;
}

/*table tr {*/

/*}*/

table tbody tr td {
font-family: Open Sans, sans-serif;
font-size: 14px;
font-weight: 400;
line-height: 19px;
padding: 5px 0;
color: #484646;
}
9 changes: 9 additions & 0 deletions tenant-portal/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import ToastComponent from './components/Toast/Toast';
import axios from 'axios';
import './i18n';
import BreadcrumbComponent from "./components/BreadcrumbComponent/BreadcrumbComponent";
import InbuiltAttributesComponent from "./components/InbuiltAttributesComponent/InbuiltAttributesComponent";

function App() {
const { initialized, keycloak } = useKeycloak();
Expand Down Expand Up @@ -75,6 +76,14 @@ function App() {
}
>
</Route>
<Route path={config.urlPath + "/manage-schema/view-inbuilt-attributes"}
element={
<PrivateRoute>
<InbuiltAttributesComponent />
</PrivateRoute>
}
>
</Route>
</Routes>
</div>
<ToastComponent/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import {useTranslation} from "react-i18next";
import SchemaAttribute from "../SchemaAttribute/SchemaAttribute";
import {INBUILT_ATTRIBUTES} from "../../constants"
import config from "../../config.json";
import GenericButton from "../GenericButton/GenericButton";
import {Link} from "react-router-dom";
import React from "react";
import styles from "./InbuiltAttributesComponent.module.css";

function InbuiltAttributesComponent() {
const { t } = useTranslation();
return(
<div className="d-flex flex-column justify-content-between">
<div className={styles["inbuiltAttributes"]}>
<p className="title">{t('inbuiltAtrributesPage.inbuiltAttributes')}</p>
<p className="mb-0">{t('inbuiltAtrributesPage.inbuiltAttributesHeading1')}</p>
<p>{t('inbuiltAtrributesPage.inbuiltAttributesHeading2')}</p>
<div className="p-3 border overflow-auto d-xxl-inline-block">
<p className="table-heading">{t('inbuiltAtrributesPage.fields')}</p>
<table className={styles["inbuiltAttributesTable"]}>
<thead className="table-col-header">
<th>{t('inbuiltAtrributesPage.label')}</th>
<th>{t('inbuiltAtrributesPage.fieldType')}</th>
<th className="text-center">{t('inbuiltAtrributesPage.mandatory')}</th>
<th className="text-center">{t('inbuiltAtrributesPage.indexed')}</th>
<th className="text-center">{t('inbuiltAtrributesPage.unique')}</th>
<th>{t('inbuiltAtrributesPage.description')}</th>
</thead>
<tbody>
{
INBUILT_ATTRIBUTES.map((attribute) => {
return <SchemaAttribute schemaAttribute={attribute}></SchemaAttribute>
})
}
</tbody>
</table>
</div>
</div>
<div>
<hr/>
<div className="d-flex justify-content-center justify-content-md-end px-md-4 px-lg-5">
<Link to={`${config.urlPath}/manage-schema`}>
<GenericButton img='' text={t('inbuiltAtrributesPage.backButton')} type='primary' />
</Link>
</div>
</div>
</div>
);
}

export default InbuiltAttributesComponent;
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
.inbuiltAttributes {
margin: 2rem
}

.inbuiltAttributesTable {
width: 1000px;
}

@media (min-width:768px) {
.inbuiltAttributes {
margin: 2rem 3rem
}
}

@media (min-width: 992px) {
.inbuiltAttributes {
margin: 2rem 5rem
}

.inbuiltAttributesTable {
max-width: 100%;
}
}

@media (min-width: 1200px) {
.inbuiltAttributes {
margin: 2rem 5rem 2rem 10rem
}
}

@media (min-width: 1400px) {
.inbuiltAttributes {
margin: 2rem 5rem 2rem 15rem
}
}
50 changes: 50 additions & 0 deletions tenant-portal/src/components/SchemaAttribute/SchemaAttribute.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import {useTranslation} from "react-i18next";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this reusable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. This component takes in a json object and render it as a table row


function SchemaAttribute(props) {

const { t } = useTranslation();
const attributeTypes = [
{"label": "Text", "value":"string"},
{"label": "Number", "value":"integer"},
{"label": "Date/Time", "value":"date"}
]
return(
<tr>
<td>
{
props.schemaAttribute.readOnly ? props.schemaAttribute.label :
<input type="text" defaultValue={props.schemaAttribute.label} readOnly={props.schemaAttribute.readOnly}/>
}
</td>
<td>
{
props.schemaAttribute.readOnly ? props.schemaAttribute.type :
<select defaultValue={props.schemaAttribute.type}>
{
attributeTypes.map(function(attributeType) {
return <option value={attributeType.value}>{attributeType.label}</option>
})
}
</select>
}
</td>
<td className="text-center">
<input type="checkbox" id="mandatoryAttribute" name="mandatoryAttribute" readOnly={props.schemaAttribute.readOnly} checked={props.schemaAttribute.isMandatory}/>
</td>
<td className="text-center">
<input type="checkbox" id="indexedAttribute" name="indexedAttribute" readOnly={props.schemaAttribute.readOnly} checked={props.schemaAttribute.indexed}/>
</td>
<td className="text-center">
<input type="checkbox" id="uniqueAttribute" name="uniqueAttribute" readOnly={props.schemaAttribute.readOnly} checked={props.schemaAttribute.unique}/>
</td>
<td>
{
props.schemaAttribute.readOnly ? props.schemaAttribute.description :
<input type="text" defaultValue={props.schemaAttribute.description} readOnly={props.schemaAttribute.readOnly}/>
}
</td>
</tr>
);
}

export default SchemaAttribute;
56 changes: 56 additions & 0 deletions tenant-portal/src/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
export const INBUILT_ATTRIBUTES = [
{
"label": "Name",
"type": "string",
"isMandatory": true,
"indexed": false,
"unique": false,
"description": "Name of the holder",
"readOnly": true
},
{
"label": "Issued on",
"type": "string",
"isMandatory": true,
"indexed": false,
"unique": false,
"description": "Date certificate issued on",
"readOnly": true
},
{
"label": "Issuer",
"type": "string",
"isMandatory": true,
"indexed": false,
"unique": false,
"description": "Name of the issuing authority",
"readOnly": true
},
{
"label": "Certificate ID",
"type": "string",
"isMandatory": true,
"indexed": true,
"unique": true,
"description": "The unique Certificate ID",
"readOnly": true
},
{
"label": "Valid From",
"type": "string",
"isMandatory": false,
"indexed": false,
"unique": false,
"description": "The date from which the credential is valid from",
"readOnly": true
},
{
"label": "Valid To",
"type": "string",
"isMandatory": false,
"indexed": false,
"unique": false,
"description": "The date until which the credential is valid to",
"readOnly": true
}
]