Skip to content

Commit

Permalink
Merge pull request #926 from singnet/staging
Browse files Browse the repository at this point in the history
Update metadata: description and keywords
  • Loading branch information
serbinadrian authored Jul 8, 2024
2 parents cc39101 + 039f258 commit 998333b
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 28 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ REACT_APP_SNET_SIGNER_ADDRESS=
REACT_APP_EXECUTOR_WALLET_ADDRESS=
REACT_APP_SNET_SUPPORT_MAIL=
REACT_APP_SENTRY_DSN=
REACT_APP_IS_ALL_SERVICES_AVAILIBLE=
REACT_APP_TRAINING_ENABLE=
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<link rel="icon-16" type="image/png" sizes="16x16" href="%PUBLIC_URL%/favicon-16x16.png">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="keywords" content="SingularityNET, SNET, AI, Marketplace, decentralized AI; pre-trained AI; AI solutions; artificial intelligence; AI development" />
<meta name="keywords" content="decentralized AI, pre-trained AI, AI solutions, artificial intelligence, SingularityNET, SNET, AI, Marketplace, pre-trained AI, AI development" />
<meta name="description" content="Revolutionize your workflows with next-gen AI solutions! Discover & utilize pre-trained models on SingularityNET, the decentralized AI marketplace. Build, share & monetize your AI models with ease. Explore ethical AI development & join the future of AI!">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link
Expand All @@ -27,7 +27,7 @@
<link rel="dns-prefetch" href="//fonts.googleapis.com">
<link rel="dns-prefetch" href="//fonts.gstatic.com">
<!-- End Prefetch external resource -->
<title>SingularityNET Beta Dapp</title>
<title>SingularityNET AI Marketplace: The Decentralized Marketplace for Next-Gen AI Services</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
27 changes: 25 additions & 2 deletions src/Redux/actionCreators/ServiceActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { APIEndpoints, APIPaths } from "../../config/APIEndpoints";
import { loaderActions, userActions } from "./";
import { LoaderContent } from "../../utility/constants/LoaderContent";
import { initializeAPIOptions } from "../../utility/API";
import { generateOrganizationsFilterObject } from "../../utility/constants/Pagination";
// import { cacheS3Url } from "../../utility/image";

export const UPDATE_SERVICE_LIST = "SET_SERVICE_LIST";
Expand Down Expand Up @@ -39,11 +40,33 @@ export const fetchServiceSuccess = (res) => (dispatch) => {
dispatch(loaderActions.stopAIServiceListLoader);
};

export const fetchUserOrganizationsList = () => async (dispatch) => {
const apiName = APIEndpoints.REGISTRY.name;
const apiPath = APIPaths.GET_USER_ORGS;
const { token } = await dispatch(userActions.fetchAuthenticatedUser());
const apiOptions = initializeAPIOptions(token);
return API.get(apiName, apiPath, apiOptions);
};

const onlyUserOrgsFilter = () => async (dispatch) => {
const userOrganizations = await dispatch(fetchUserOrganizationsList());
const userOrganizationsId = userOrganizations.data.map((organization) => organization.org_id);
const filterObj = generateOrganizationsFilterObject([
...userOrganizationsId,
process.env.REACT_APP_EXAMPLE_SERVICE_ORG_ID,
]);
return filterObj;
};

export const fetchService =
(pagination, filters = []) =>
(dispatch) => {
async (dispatch) => {
if (process.env.REACT_APP_IS_ALL_SERVICES_AVAILIBLE !== "true") {
// env variable is string
filters = await dispatch(onlyUserOrgsFilter());
}
dispatch(loaderActions.startAIServiceListLoader);
const url = new URL(`${APIEndpoints.CONTRACT.endpoint}/service`);
const url = new URL(APIEndpoints.CONTRACT.endpoint + APIPaths.GET_SERVICE_LIST);
return fetch(url, {
method: "POST",
body: JSON.stringify({ ...pagination, filters }),
Expand Down
41 changes: 17 additions & 24 deletions src/components/AiMarketplace/MainSection/Filter/ToolBar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import ServiceSortOptions from "./ServiceSortOptions";
import ViewToggler from "./ViewToggler";
import StyledDropdown from "../../../../common/StyledDropdown";
import { serviceActions } from "../../../../../Redux/actionCreators";
import { defaultPaginationParameters } from "../../../../../utility/constants/Pagination";
import {
defaultPaginationParameters,
generateOrganizationsFilterObject,
} from "../../../../../utility/constants/Pagination";

const ToolBar = ({
listView,
Expand Down Expand Up @@ -46,19 +49,7 @@ const ToolBar = ({
}
let filterObj = [];
if (value !== "default") {
filterObj = [
{
filter: [
{
filter_condition: {
attr: "org_id",
operator: "IN",
value: [value],
},
},
],
},
];
filterObj = generateOrganizationsFilterObject([value]);
}
setActiveOrgItem(value);

Expand All @@ -74,16 +65,18 @@ const ToolBar = ({
<Grid container spacing={24} className={classes.toolBar}>
<Grid item xs={6} sm={9} md={9} lg={6} className={classes.sortBySection}>
<ServiceSortOptions />
<div className={classes.organizationDropdownContainer}>
<span className={classes.sortbyTxt}>Organization</span>
<StyledDropdown
list={enhancedFilterData}
value={activeOrgItem}
labelTxt="All Organization"
name="org_id"
onChange={handleOrgFilterChange}
/>
</div>
{process.env.REACT_APP_IS_ALL_SERVICES_AVAILIBLE === "true" && (
<div className={classes.organizationDropdownContainer}>
<span className={classes.sortbyTxt}>Organization</span>
<StyledDropdown
list={enhancedFilterData}
value={activeOrgItem}
labelTxt="All Organization"
name="org_id"
onChange={handleOrgFilterChange}
/>
</div>
)}
</Grid>
<Grid item xs={6} sm={3} md={3} lg={6} className={classes.iconsContainer}>
<span className={classes.servicesCount}>{total_count} services</span>
Expand Down
5 changes: 5 additions & 0 deletions src/config/APIEndpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ export const APIEndpoints = {
name: "Orchestrator",
endpoint: process.env.REACT_APP_ORCHESTRATOR_ENDPOINT,
},
REGISTRY: {
name: "Registry",
endpoint: process.env.REACT_APP_REGISTRY_ENDPOINT,
},
};

export const APIPaths = {
Expand Down Expand Up @@ -53,4 +57,5 @@ export const APIPaths = {
USD_RATE: "/currency/USD/token",
FREE_CALL_TOKEN: "/free-call/token",
GET_CAROUSEL: "/uicontent/marketplacecarousel",
GET_USER_ORGS: "/org",
};
16 changes: 16 additions & 0 deletions src/utility/constants/Pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ export const filterTitles = {
org_id: "Organization",
};

export const generateOrganizationsFilterObject = (value) => {
return [
{
filter: [
{
filter_condition: {
attr: "org_id",
operator: "IN",
value,
},
},
],
},
];
};

export const generateFilterObject = (filterData) => {
const filterObject = [];
const filter = { filter: [] };
Expand Down

0 comments on commit 998333b

Please sign in to comment.