Skip to content

Commit

Permalink
Merge pull request #354 from aesirxio/develop
Browse files Browse the repository at this point in the history
Deploy to master
  • Loading branch information
NguyenBao10 authored Aug 23, 2024
2 parents 147aca5 + d8500c5 commit ee0f178
Show file tree
Hide file tree
Showing 22 changed files with 2,774 additions and 547 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
path = packages/aesirx-lib
url = https://github.com/aesirxio/aesirx-lib.git
branch = master
[submodule "packages/aesirx-sso"]
path = packages/aesirx-sso
url = https://github.com/aesirxio/sso.git
branch = master
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Find out more in [https://dam.aesirx.io](https://dam.aesirx.io)
3. Run `yarn prepare` to build the dependencies.
2. Rename the `.env.dist` file to `.env` on `packages/aesirx-dam-app` folder.
3. Replace license keys in the `.env` file with the one provided in your profile account.
1. `REACT_APP_SSO_CLIENT_ID` replace this with the provided `REACT_APP_SSO_CLIENT_ID` from https://dapp.shield.aesirx.io/
2. `REACT_APP_SSO_CLIENT_SECRET` replace this with the provided `REACT_APP_SSO_CLIENT_SECRET` from https://dapp.shield.aesirx.io/
1. `REACT_APP_SSO_CLIENT_ID` replace this with the provided `SSO CLIENT ID` from https://dapp.shield.aesirx.io/licenses
2. `REACT_APP_SSO_CLIENT_SECRET` replace this with the provided `SSO CLIENT SECRET` from https://dapp.shield.aesirx.io/licenses
3. `PORT` change the port. Default is 3000

5. Run `yarn dev`
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
"jsdom": "^16",
"json5": "^2",
"postcss": "^8",
"nth-check":"^2.0.1"
"nth-check": "^2.0.1",
"clipboardy": "3.0.0",
"tsup": "6",
"@types/react": "^18"
},
"scripts": {
"prepare": "nx run-many -t build -p aesirx-uikit aesirx-lib && nx run-many -t build:lib --exclude aesirx-uikit aesirx-lib",
"prepare": "nx run aesirx-lib:build && nx run aesirx-sso:build && nx run aesirx-uikit:build && nx run-many -t build:lib --exclude aesirx-uikit aesirx-lib",
"dev": "nx run-many -t dev",
"dev:lib": "nx run aesirx-dam-app:dev:lib",
"build": "nx run aesirx-dam-app:build",
Expand Down
5 changes: 3 additions & 2 deletions packages/aesirx-dam-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
"@fortawesome/free-solid-svg-icons": "^6.4.0",
"@fortawesome/react-fontawesome": "^0.2.0",
"@toast-ui/react-image-editor": "^3.15.2",
"aesirx-lib": "^1.11.1",
"aesirx-uikit": "^1.1.5",
"aesirx-lib": "*",
"aesirx-uikit": "*",
"aesirx-sso": "*",
"file-saver": "^2.0.5",
"mobx": "^6.9.0",
"mobx-react": "^7.6.0",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/aesirx-dam-app/public/assets/images/SSO.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 41 additions & 41 deletions packages/aesirx-dam-app/src/components/Storage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,23 @@ import { DAM_SUBSCIPTION_FIELD_KEY } from 'aesirx-lib';
import DamStore from 'store/DamStore/DamStore';
import storage from './storage.svg';

const gigabyte = 1000000000;
const mbToByte = 1000000;

function formatBytes(bytes, decimals = 2) {
if (!+bytes) return 0;

const k = 1000;
const dm = decimals < 0 ? 0 : decimals;
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];

const i = Math.floor(Math.log(bytes) / Math.log(k));
return {
usageValue: parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) ?? 0,
usageType: sizes[i] ?? 'KB',
};
}

const calculatorPercentage = (a, b) => {
return (a / b) * 100 ?? 0;
};
Expand All @@ -25,14 +42,21 @@ const Storage = () => {
const getSubscription = async () => {
try {
const store = new DamStore();
const subscriptionFromLibrary = await store.getSubscription();
if (subscriptionFromLibrary) {
const damSubscirption = subscriptionFromLibrary?.find((item) => {
if (item[DAM_SUBSCIPTION_FIELD_KEY.PRODUCT]?.type === 'product-aesirx-dam') {
return item;
}
const subscriptionDetail = await store.getSubscription();
const usage = subscriptionDetail[DAM_SUBSCIPTION_FIELD_KEY.PRODUCT_STORAGE_USAGE];
const limit = subscriptionDetail[DAM_SUBSCIPTION_FIELD_KEY.PACKAGE_STORAGE_LIMIT];
if (usage != undefined && limit != undefined) {
const percentage = calculatorPercentage(usage, limit);
const isGb = limit >= gigabyte;
const convertUsage = formatBytes(usage);
const convertLimit = isGb ? limit / gigabyte : limit / mbToByte;
setSubscription({
[DAM_SUBSCIPTION_FIELD_KEY.PRODUCT_STORAGE_USAGE]: convertUsage.usageValue,
[DAM_SUBSCIPTION_FIELD_KEY.PACKAGE_STORAGE_LIMIT]: convertLimit,
limit_type: isGb ? 'GB' : 'MB',
usage_type: convertUsage.usageType,
percentage: percentage,
});
setSubscription(damSubscirption);
}
} catch (error) {
console.log(error);
Expand All @@ -59,54 +83,30 @@ const Storage = () => {
className="progress-bar bg-cyan"
role="progressbar"
style={{
width: `${calculatorPercentage(
subscription?.[DAM_SUBSCIPTION_FIELD_KEY.PRODUCT]?.[
DAM_SUBSCIPTION_FIELD_KEY.PRODUCT_STORAGE_USAGE
],
subscription?.[DAM_SUBSCIPTION_FIELD_KEY.PACKAGE]?.[
DAM_SUBSCIPTION_FIELD_KEY.PACKAGE_STORAGE_LIMIT
]
)}%`,
width: `${subscription?.percentage ?? 0}%`,
}}
aria-label="Basic example"
aria-valuenow={calculatorPercentage(
subscription?.[DAM_SUBSCIPTION_FIELD_KEY.PRODUCT]?.[
DAM_SUBSCIPTION_FIELD_KEY.PRODUCT_STORAGE_USAGE
],
subscription?.[DAM_SUBSCIPTION_FIELD_KEY.PACKAGE]?.[
DAM_SUBSCIPTION_FIELD_KEY.PACKAGE_STORAGE_LIMIT
]
)}
aria-valuenow={subscription?.percentage ?? 0}
aria-valuemin="0"
aria-valuemax="100"
></div>
</div>
<p className="mb-0 d-flex flex-wrap ">
<span className="text-white fs-14">
{subscription?.[DAM_SUBSCIPTION_FIELD_KEY.PRODUCT]?.[
DAM_SUBSCIPTION_FIELD_KEY.PRODUCT_STORAGE_USAGE
]
? subscription?.[DAM_SUBSCIPTION_FIELD_KEY.PRODUCT]?.[
DAM_SUBSCIPTION_FIELD_KEY.PRODUCT_STORAGE_USAGE
]
{subscription?.[DAM_SUBSCIPTION_FIELD_KEY.PRODUCT_STORAGE_USAGE]
? subscription?.[DAM_SUBSCIPTION_FIELD_KEY.PRODUCT_STORAGE_USAGE]
: 0}
{'MB '}
{t('txt_of')}{' '}
{subscription?.[DAM_SUBSCIPTION_FIELD_KEY.PACKAGE]?.[
DAM_SUBSCIPTION_FIELD_KEY.PACKAGE_STORAGE_LIMIT
]
? subscription?.[DAM_SUBSCIPTION_FIELD_KEY.PACKAGE]?.[
DAM_SUBSCIPTION_FIELD_KEY.PACKAGE_STORAGE_LIMIT
]
{subscription?.usage_type ?? 'MB'} {t('txt_of')}{' '}
{subscription?.[DAM_SUBSCIPTION_FIELD_KEY.PACKAGE_STORAGE_LIMIT]
? subscription?.[DAM_SUBSCIPTION_FIELD_KEY.PACKAGE_STORAGE_LIMIT]
: 0}
{'MB '}
{t('txt_used')}
{/* {subscription?.[DAM_SUBSCIPTION_FIELD_KEY.PACKAGE]?.[
{subscription?.limit_type ?? 'MB'} {t('txt_used')}
{/* {subscription?.[
DAM_SUBSCIPTION_FIELD_KEY.PACKAGE_STORAGE_LIMIT
] ?? 'Unlimited'} */}
</span>
<a
href="https://dam.aesirx.io/#packages"
href="https://dapp.shield.aesirx.io/licenses"
className="text-cyan text-decoration-underline fs-14 d-inline-block ps-1"
target="_blank"
rel="noreferrer"
Expand Down
2 changes: 1 addition & 1 deletion packages/aesirx-dam-app/src/components/Table/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const Table = ({
const limitStart =
listViewModel.dataFilter['list[limit]'] + listViewModel.dataFilter['list[start]'];

console.log('limitStart', limitStart, listViewModel.totalAsset)
console.log('limitStart', limitStart, listViewModel.totalAsset);

if (limitStart < listViewModel.totalAsset) {
const collectionId = history.location.pathname.split('/');
Expand Down
15 changes: 12 additions & 3 deletions packages/aesirx-dam-app/src/routes/menu.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { faUser } from '@fortawesome/free-solid-svg-icons/faUser';

const settingMenu = [
{
name: 'profile',
text: 'txt_menu_profile',
link: '/profile',
icons_fa: faUser,
icons_color: '/assets/images/Profile.png',
},
{
name: 'SSO',
text: 'txt_sso',
link: '/sso',
icons_color: '/assets/images/SSO.png',
},
];

Expand All @@ -15,6 +19,11 @@ const profileMenu = [
text: 'txt_profile',
link: '/profile',
},
{
key: 2,
text: 'txt_sso',
link: '/sso',
},
];

export { profileMenu, settingMenu };
9 changes: 8 additions & 1 deletion packages/aesirx-dam-app/src/routes/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import React, { lazy } from 'react';
import { LoginPage, ProfilePage } from 'aesirx-uikit';
import { Redirect } from 'react-router-dom';

const SSOConfig = lazy(() =>
import('aesirx-sso').then((module) => ({ default: module.SSOConfig }))
);
const DashboardPage = lazy(() => import('../containers/Homepage'));

const authRoutes = [
Expand Down Expand Up @@ -36,6 +38,11 @@ const settingRoutes = [
exact: false,
main: () => <ProfilePage />,
},
{
path: '/sso',
exact: false,
main: () => <SSOConfig />,
},
];

export { authRoutes, mainRoutes, settingRoutes };
3 changes: 2 additions & 1 deletion packages/aesirx-dam-app/src/translations/dk/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,6 @@
"txt_keywords": "Søgeord",
"txt_tags" : "Tags",
"double_click_to_edit" : "Dobbeltklik for at redigere",
"right-click_to_get_a_list_of_actions" : "Højreklik for at få en liste over handlinger"
"right-click_to_get_a_list_of_actions" : "Højreklik for at få en liste over handlinger",
"txt_sso" : "Single Sign On"
}
3 changes: 2 additions & 1 deletion packages/aesirx-dam-app/src/translations/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,6 @@
"txt_keywords": "Keywords",
"txt_tags" : "Tags",
"double_click_to_edit" : "Double click to edit",
"right-click_to_get_a_list_of_actions" : "Right click to get a list of actions"
"right-click_to_get_a_list_of_actions" : "Right click to get a list of actions",
"txt_sso" : "Single Sign On"
}
3 changes: 2 additions & 1 deletion packages/aesirx-dam-app/src/translations/es/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,6 @@
"txt_keywords": "Palabras clave",
"txt_tags": "Etiquetas",
"double_click_to_edit": "Doble clic para editar",
"right-click_to_get_a_list_of_actions": "Haz clic derecho para obtener una lista de acciones"
"right-click_to_get_a_list_of_actions": "Haz clic derecho para obtener una lista de acciones",
"txt_sso": "Inicio de sesión único"
}
3 changes: 2 additions & 1 deletion packages/aesirx-dam-app/src/translations/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,6 @@
"txt_keywords": "Mots clés",
"txt_tags" : "Balises",
"double_click_to_edit" : "Double-cliquez pour éditer",
"right-click_to_get_a_list_of_actions" : "Cliquez avec le bouton droit pour obtenir une liste d'actions"
"right-click_to_get_a_list_of_actions" : "Cliquez avec le bouton droit pour obtenir une liste d'actions",
"txt_sso" : "Authentification unique"
}
3 changes: 2 additions & 1 deletion packages/aesirx-dam-app/src/translations/hr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,6 @@
"txt_keywords": "Ključne riječi",
"txt_tags" : "Oznake",
"double_click_to_edit" : "Dvaput kliknite za uređivanje",
"right-click_to_get_a_list_of_actions" : "Desni klik za dobivanje popisa radnji"
"right-click_to_get_a_list_of_actions" : "Desni klik za dobivanje popisa radnji",
"txt_sso" : "Jednostruka prijava"
}
3 changes: 2 additions & 1 deletion packages/aesirx-dam-app/src/translations/th/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@
"txt_keywords": "คำหลัก",
"txt_tags" : "แท็ก",
"double_click_to_edit": "ดับเบิลคลิกเพื่อแก้ไข",
"right-click_to_get_a_list_of_actions": "คลิกขวาเพื่อดูรายการการกระทำ"
"right-click_to_get_a_list_of_actions": "คลิกขวาเพื่อดูรายการการกระทำ",
"txt_sso" : "การลงชื่อเพียงครั้งเดียว"
}
3 changes: 2 additions & 1 deletion packages/aesirx-dam-app/src/translations/ua/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@
"txt_keywords": "Ключові слова",
"txt_tags" : "Теги",
"double_click_to_edit" : "Двічі клацніть, щоб редагувати",
"right-click_to_get_a_list_of_actions" : "Клацніть правою кнопкою миші, щоб отримати список дій"
"right-click_to_get_a_list_of_actions" : "Клацніть правою кнопкою миші, щоб отримати список дій",
"txt_sso" : "Єдиний вхід"
}
3 changes: 2 additions & 1 deletion packages/aesirx-dam-app/src/translations/vi/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@
"txt_keywords": "Từ khóa",
"txt_tags" : "Thẻ",
"double_click_to_edit" : "Nhấp đúp để chỉnh sửa",
"right-click_to_get_a_list_of_actions" : "Nhấp chuột phải để xem danh sách hành động"
"right-click_to_get_a_list_of_actions" : "Nhấp chuột phải để xem danh sách hành động",
"txt_sso" : "Đăng nhập một lần"
}
2 changes: 1 addition & 1 deletion packages/aesirx-lib
Submodule aesirx-lib updated 40 files
+3 −3 .github/workflows/codeql-analysis.yml
+3 −3 .github/workflows/release.yml
+2 −2 .github/workflows/test.yml
+17 −15 package.json
+5 −0 src/Authentication/Authentication.ts
+1 −1 src/Authentication/Logout.ts
+14 −0 src/Bi/Bi.test.ts
+516 −7 src/Bi/Bi.ts
+966 −0 src/Bi/BiModel.ts
+315 −17 src/Bi/BiRoute.ts
+152 −0 src/Constant/BiConstant.ts
+4 −1 src/Constant/Constant.ts
+2 −0 src/Constant/MemberConstant.ts
+29 −3 src/Constant/OrganizationContent.ts
+3 −14 src/Dam/Dam.ts
+2 −2 src/Dam/DamRoute.ts
+6 −4 src/Gateway/Instance.ts
+2 −0 src/Member/MemberModel.ts
+101 −0 src/Organization/MemberRole/Model.ts
+69 −0 src/Organization/MemberRole/Route.ts
+122 −0 src/Organization/MemberRole/index.test.ts
+101 −0 src/Organization/MemberRole/index.ts
+82 −0 src/Organization/Permission/Model.ts
+69 −0 src/Organization/Permission/Route.ts
+17 −0 src/Organization/Permission/index.test.ts
+99 −0 src/Organization/Permission/index.ts
+38 −6 src/Organization/Role/Model.ts
+39 −4 src/Organization/Role/Route.ts
+49 −1 src/Organization/Role/index.test.ts
+63 −1 src/Organization/Role/index.ts
+14 −14 src/Pim/PimFilteringFieldset/Model.ts
+14 −14 src/Pim/PimProductFieldValue/Model.ts
+3 −3 src/Project/Project.ts
+9 −1 src/env.ts
+5 −1 src/index.ts
+68 −0 src/lib/envHelper.ts
+240 −0 src/lib/fingerpint.lib.ts
+18 −0 src/lib/fingerprint.ts
+55 −0 src/lib/utils.ts
+1,903 −1,128 yarn.lock
1 change: 1 addition & 0 deletions packages/aesirx-sso
Submodule aesirx-sso added at 92e0cc
2 changes: 1 addition & 1 deletion packages/aesirx-uikit
Submodule aesirx-uikit updated 94 files
+19 −2 .eslintrc
+3 −3 .github/workflows/codeql-analysis.yml
+3 −3 .github/workflows/release.yml
+5 −5 .github/workflows/test.yml
+22 −10 package.json
+ src/assets/images/copy_icon.png
+ src/assets/images/payment/aesirx.png
+ src/assets/images/payment/bnb.png
+ src/assets/images/payment/concordium.png
+ src/assets/images/payment/debit.png
+ src/assets/images/payment/usdt.png
+ src/assets/images/payment/visa.png
+4 −0 src/assets/images/sign_out.svg
+31 −0 src/components/ButtonCopy.tsx
+5 −0 src/components/CreateMarkup.tsx
+1 −1 src/components/DatePicker/index.scss
+5 −5 src/components/DatePicker/index.tsx
+62 −1 src/components/Form/Helper.tsx
+1 −0 src/components/GlobalFilter/index.tsx
+1 −1 src/components/Header/index.scss
+3 −4 src/components/Header/index.tsx
+24 −0 src/components/ImageIcon.tsx
+4 −2 src/components/LanguagesSwitcher/index.tsx
+20 −11 src/components/Menu/index.tsx
+8 −6 src/components/Profile/index.tsx
+3 −3 src/components/PublishOptions/PublishOptions.tsx
+30 −12 src/components/Select/customStyles.ts
+14 −2 src/components/Select/index.tsx
+128 −0 src/components/Table/RowSubComponent.tsx
+7 −0 src/components/Table/index.scss
+52 −26 src/components/Table/index.tsx
+41 −26 src/components/TableBar/index.tsx
+1 −1 src/components/ThemesSwitcher/index.tsx
+2 −2 src/components/Thumb/index.tsx
+6 −2 src/layouts/MainLayout/index.tsx
+2 −2 src/layouts/SettingLayout/index.tsx
+47 −0 src/pages/Licenses/CollapseItems.tsx
+169 −0 src/pages/Licenses/Payments.tsx
+31 −0 src/pages/Licenses/TooltipNote.tsx
+129 −0 src/pages/Licenses/UpdateLicense.tsx
+297 −0 src/pages/Licenses/UpgradeLicense.tsx
+323 −0 src/pages/Licenses/index.tsx
+3 −1 src/pages/Login/index.scss
+23 −18 src/pages/Login/index.tsx
+233 −0 src/pages/MemberRole/ListMemberRole.tsx
+159 −0 src/pages/MemberRole/MemberRoleEdit/Component/MemberRoleInformation.tsx
+199 −0 src/pages/MemberRole/MemberRoleEdit/index.tsx
+141 −0 src/pages/MemberRole/MemberRoleViewModel/MemberRoleDetailViewModel.ts
+174 −0 src/pages/MemberRole/MemberRoleViewModel/MemberRoleListViewModel.ts
+25 −0 src/pages/MemberRole/MemberRoleViewModel/MemberRoleViewModel.ts
+34 −0 src/pages/MemberRole/MemberRoleViewModel/MemberRoleViewModelContextProvider.tsx
+23 −0 src/pages/MemberRole/edit.tsx
+24 −0 src/pages/MemberRole/index.tsx
+83 −0 src/pages/MemberRole/store.ts
+2 −2 src/pages/Members/MemberEdit/Component/MemberInformation.tsx
+30 −0 src/pages/Members/MemberViewModel/MemberListViewModel.ts
+11 −0 src/pages/Members/store.ts
+261 −0 src/pages/Permission/ListPermission.tsx
+57 −0 src/pages/Permission/PermissionEdit/Component/PermissionInformation.tsx
+199 −0 src/pages/Permission/PermissionEdit/index.tsx
+128 −0 src/pages/Permission/PermissionViewModel/PermissionDetailViewModel.ts
+256 −0 src/pages/Permission/PermissionViewModel/PermissionListViewModel.ts
+25 −0 src/pages/Permission/PermissionViewModel/PermissionViewModel.ts
+34 −0 src/pages/Permission/PermissionViewModel/PermissionViewModelContextProvider.tsx
+23 −0 src/pages/Permission/edit.tsx
+24 −0 src/pages/Permission/index.tsx
+84 −0 src/pages/Permission/store.ts
+4 −5 src/pages/Profile/General.tsx
+173 −0 src/pages/Roles/ListRole.tsx
+57 −0 src/pages/Roles/RoleEdit/Component/RoleInformation.tsx
+195 −0 src/pages/Roles/RoleEdit/index.tsx
+128 −0 src/pages/Roles/RoleViewModel/RoleDetailViewModel.ts
+202 −0 src/pages/Roles/RoleViewModel/RoleListViewModel.ts
+25 −0 src/pages/Roles/RoleViewModel/RoleViewModel.ts
+34 −0 src/pages/Roles/RoleViewModel/RoleViewModelContextProvider.tsx
+23 −0 src/pages/Roles/edit.tsx
+24 −0 src/pages/Roles/index.tsx
+84 −0 src/pages/Roles/store.ts
+6 −0 src/pages/index.ts
+8 −3 src/providers/AppProvider.tsx
+91 −0 src/providers/global.tsx
+117 −0 src/providers/user.tsx
+158 −0 src/providers/web3.tsx
+9 −0 src/scss/app.scss
+19 −8 src/scss/utils/mixin.scss
+24 −1 src/scss/utils/utilities.scss
+4 −0 src/scss/utils/variables.scss
+291 −0 src/store/UtilsStore/aesirx.ts
+220 −0 src/store/UtilsStore/concordium.ts
+22 −0 src/store/UtilsStore/config.ts
+693 −0 src/store/UtilsStore/web3.ts
+21 −8 src/translations/en/common.json
+6 −6 src/translations/fr/common.json
+3,432 −2,161 yarn.lock
Loading

0 comments on commit ee0f178

Please sign in to comment.