MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / showModal

Function showModal

web/pgadmin/static/js/helpers/ModalProvider.jsx:134–149  ·  view source on GitHub ↗
(title, content, modalOptions)

Source from the content-addressed store, hash-verified

132export default function ModalProvider({ children }) {
133 const [modals, setModals] = React.useState([]);
134 const showModal = (title, content, modalOptions) => {
135 let id = getEpoch().toString() + crypto.getRandomValues(new Uint8Array(4));
136 if(modalOptions?.id){
137 id = modalOptions.id;
138 }
139 setModals((prev) => {
140 if(prev?.find(modal=> modal.id === modalOptions?.id)){
141 return prev;
142 }
143 return [...prev, {
144 id: id,
145 title: title,
146 content: content,
147 ...modalOptions,
148 }];});
149 };
150
151 const closeModal = (id) => {
152 setModals((prev) => {

Callers

nothing calls this directly

Calls 2

getEpochFunction · 0.90
findMethod · 0.80

Tested by

no test coverage detected