File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed
client/src/components/Tool Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change 11<script setup lang="ts">
2- import { faSave } from " @fortawesome/free-regular-svg-icons" ;
2+ import { faArrowAltCircleUp , faSave } from " @fortawesome/free-regular-svg-icons" ;
33import { FontAwesomeIcon } from " @fortawesome/vue-fontawesome" ;
44import { loader , useMonaco , VueMonacoEditor } from " @guolao/vue-monaco-editor" ;
55import * as monaco from " monaco-editor" ;
@@ -104,6 +104,25 @@ async function saveTool() {
104104 router .push (` /tools/editor/${data .uuid } ` );
105105 }
106106}
107+
108+ async function importFromUrl() {
109+ const url = prompt (" Enter the URL to import YAML from:" );
110+ if (! url ) {
111+ return ;
112+ }
113+
114+ try {
115+ const response = await fetch (url );
116+ if (! response .ok ) {
117+ throw new Error (" Failed to fetch YAML" );
118+ }
119+
120+ const yaml = await response .text ();
121+ yamlRepresentation .value = yaml ;
122+ } catch (error ) {
123+ errorMsg .value = { err_code: - 1 , err_msg: ` Couldn't import YAML from URL: ${error } ` };
124+ }
125+ }
107126 </script >
108127
109128<template >
@@ -113,6 +132,14 @@ async function saveTool() {
113132 </b-alert >
114133 <div class =" d-flex flex-gapx-1" >
115134 <Heading h1 separator inline size =" lg" class =" flex-grow-1 mb-2" >Tool Editor</Heading >
135+ <b-button
136+ variant =" secondary"
137+ size =" m"
138+ title =" Import from URL"
139+ data-description =" Import from a URL"
140+ @click =" importFromUrl"
141+ ><FontAwesomeIcon :icon =" faArrowAltCircleUp"
142+ /></b-button >
116143 <b-button
117144 variant =" primary"
118145 size =" m"
You can’t perform that action at this time.
0 commit comments