File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 303303 }
304304 }
305305
306+ async function duplicateConfig(slug : string ) {
307+ try {
308+ const response = await fetch (` /api/configs/${slug } ` );
309+ const data = await response .json ();
310+ const source = data .config ;
311+ openModal ({
312+ ... source ,
313+ id: ' ' ,
314+ slug: ' ' ,
315+ name: source .name + ' (Copy)' ,
316+ alias: null
317+ });
318+ editingSlug = ' ' ;
319+ } catch (e ) {
320+ alert (' Failed to duplicate configuration' );
321+ }
322+ }
323+
306324 function copyToClipboard(text : string , configId : string ) {
307325 navigator .clipboard .writeText (text );
308326 copiedId = configId ;
451469 </div >
452470 <div class ="config-actions" onclick ={(e ) => e .stopPropagation ()}>
453471 <Button variant ="secondary" onclick ={() => editConfig (config .slug )}>Edit</Button >
472+ <Button variant ="secondary" onclick ={() => duplicateConfig (config .slug )}>Duplicate</Button >
454473 <Button variant ="danger" onclick ={() => deleteConfig (config .slug )}>Delete</Button >
455474 </div >
456475 </div >
You can’t perform that action at this time.
0 commit comments