@@ -24,9 +24,11 @@ import Confirm from "./Confirm.vue";
2424import HeaderNav from " ./HeaderNav.vue" ;
2525import StudentDropdown from " ./StudentDropdown.vue" ;
2626import toFilePath from " ./utils/toFilePath" ;
27+ import Alert from " ./Alert.vue" ;
2728
2829export default {
2930 components: {
31+ Alert,
3032 StudentDropdown,
3133 HeaderNav,
3234 Tour,
@@ -104,7 +106,9 @@ export default {
104106 currentExercise: {
105107 workshop: this .workshop ,
106108 exercise: this .exercise
107- }
109+ },
110+ showPackageAddError: false ,
111+ showPackageErrorTimerId: null
108112 }
109113 },
110114 computed: {
@@ -367,6 +371,20 @@ export default {
367371 fetch (' /cloud/composer-package/add?package=' + encodeURIComponent (this .newDependency ), opts)
368372 .then (response => response .json ())
369373 .then (json => {
374+ if (json .status === ' error' ) {
375+ this .loadingComposerAdd = false ;
376+ this .$refs .packageSearch .reset ();
377+
378+ this .showPackageAddError = true ;
379+
380+ if (this .showPackageErrorTimerId ) {
381+ clearInterval (this .showPackageErrorTimerId );
382+ }
383+
384+ this .showPackageErrorTimerId = setTimeout (() => this .showPackageAddError = false , 3000 );
385+ return ;
386+ }
387+
370388 this .composerDeps .push ({
371389 name: this .newDependency ,
372390 version: json .latest_version ,
@@ -426,6 +444,9 @@ export default {
426444 @close =" dismissPassNotification" >
427445 </pass-notification >
428446
447+ <alert type =" error" @close =" showPackageAddError= false" v-show =" showPackageAddError" message =" Package could not be added because it has no tagged version." ></alert >
448+
449+
429450 <div class =" h-full flex flex-col" >
430451 <div class =" flex flex-1 h-full relative" >
431452 <div class =" w-1/5 p-4 min-w-[300px]" >
0 commit comments