-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #312 from credebl/create-and-edit-ecosystems
feat:Create and Edit Ecosystems
- Loading branch information
Showing
13 changed files
with
642 additions
and
478 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { axiosPost, axiosPut } from "../services/apiRequests" | ||
import { apiRoutes } from "../config/apiRoutes"; | ||
import { getFromLocalStorage } from "./Auth"; | ||
import { storageKeys } from "../config/CommonConstant"; | ||
|
||
interface datapayload{ | ||
data:object | ||
} | ||
export const createEcosystems = async (Datapayload:datapayload) => { | ||
|
||
const url = apiRoutes.ecosystem.create | ||
const payload = Datapayload | ||
const token = await getFromLocalStorage(storageKeys.TOKEN) | ||
|
||
const config = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}` | ||
} | ||
} | ||
const axiosPayload = { | ||
url, | ||
payload, | ||
config | ||
} | ||
|
||
try { | ||
return await axiosPost(axiosPayload); | ||
} | ||
catch (error) { | ||
const err = error as Error | ||
return err?.message | ||
} | ||
} | ||
|
||
export const updateEcosystem = async (data: object, orgId:string) => { | ||
|
||
const url = `${apiRoutes.organizations.update}/${orgId}` | ||
const payload = data | ||
const token = await getFromLocalStorage(storageKeys.TOKEN) | ||
|
||
const config = { | ||
headers: { | ||
'Content-Type': 'application/json', | ||
Authorization: `Bearer ${token}` | ||
} | ||
} | ||
const axiosPayload = { | ||
url, | ||
payload, | ||
config | ||
} | ||
|
||
try { | ||
return await axiosPut(axiosPayload); | ||
} | ||
catch (error) { | ||
const err = error as Error | ||
return err?.message | ||
} | ||
} | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
'use client'; | ||
import { useState } from 'react'; | ||
import BreadCrumbs from '../BreadCrumbs'; | ||
import { EmptyListMessage } from '../EmptyListComponent'; | ||
import PopupModal from '../PopupModal'; | ||
import React from 'react'; | ||
|
||
|
||
|
||
const initialPageState = { | ||
pageNumber: 1, | ||
pageSize: 9, | ||
total: 100, | ||
}; | ||
|
||
const Dashboard = () => { | ||
const [openModal, setOpenModal,] = useState<boolean>(false); | ||
const [editEcosystemModal, setEditEcosystemModal] = useState<boolean>(false); | ||
const props = { openModal, setOpenModal, editEcosystemModal, setEditEcosystemModal }; | ||
|
||
|
||
const createEcosystemModel = () => { | ||
props.setOpenModal(true) | ||
} | ||
|
||
const EditEcosystemsModel = () => { | ||
props.setEditEcosystemModal(true); | ||
}; | ||
|
||
return ( | ||
<div> | ||
<div className="pl-6 mb-4 col-span-full xl:mb-2"> | ||
<BreadCrumbs /> | ||
<h1 className="ml-1 text-xl font-semibold text-gray-900 sm:text-2xl dark:text-white"> | ||
Ecosystems | ||
</h1> | ||
</div> | ||
<div | ||
className="p-4 bg-white border border-gray-200 rounded-lg shadow-sm 2xl:col-span-2 dark:border-gray-700 sm:p-6 dark:bg-gray-800" | ||
> | ||
<div className="flex items-center justify-center mb-4"> | ||
|
||
<PopupModal | ||
openModal={props.openModal} | ||
setOpenModal={props.setOpenModal} setMessage={function (message: string): void { | ||
throw new Error('Function not implemented.'); | ||
}} | ||
isorgModal={false} | ||
/> | ||
|
||
|
||
<EmptyListMessage | ||
|
||
message={'No Ecosystem found'} | ||
description={'Get started by creating an ecosystem'} | ||
buttonContent={'Create Ecosystem'} | ||
svgComponent={<svg className='pr-2 mr-1' xmlns="http://www.w3.org/2000/svg" width="24" height="15" fill="none" viewBox="0 0 24 24"> | ||
<path fill="#fff" d="M21.89 9.89h-7.78V2.11a2.11 2.11 0 1 0-4.22 0v7.78H2.11a2.11 2.11 0 1 0 0 4.22h7.78v7.78a2.11 2.11 0 1 0 4.22 0v-7.78h7.78a2.11 2.11 0 1 0 0-4.22Z" /> | ||
</svg>} | ||
onClick={createEcosystemModel} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default Dashboard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export interface Ecosystem { | ||
id: number | ||
createDateTime: string | ||
createdBy: number | ||
lastChangedDateTime: string | ||
lastChangedBy: number | ||
name: string | ||
description: string | ||
logoUrl: string | ||
website: string | ||
roles: string[] | ||
|
||
} |
Oops, something went wrong.