Skip to content

Commit

Permalink
added github link and removed alerts (#26)
Browse files Browse the repository at this point in the history
* removing the alerts to display the erro as an element

* added github link

* fixed error box

* refactoring
  • Loading branch information
viveksinghggits authored and PrasadG193 committed Oct 16, 2019
1 parent 7a37188 commit 5489352
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 8 deletions.
22 changes: 16 additions & 6 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,23 @@
<div class="jumbotron d-flex">
<img src="https://raw.githubusercontent.com/PrasadG193/yaml2go/master/yaml2go.png" style="height: 102px">
<div class="infoData">
<p class="k2Go">
yaml2go
</p>
<p class="secondaryData">
Convert YAML specs to Go type definitions
</p>
<div>
<p class="k2Go">
yaml2go
</p>
<p class="secondaryData">
Convert YAML specs to Go type definitions
</p>
</div>
</div>
<div id="view-source">
<a id="view-source-link" href="https://github.com/PrasadG193/yaml2go"><i class="fa fa-github"></i> &nbsp;View Source</a>
</div>
</div>
<div id="error">
<span id="err-span">

</span>
</div>
<div class="container">
<!-- Example row of columns -->
Expand Down
11 changes: 9 additions & 2 deletions frontend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ window.generatorCall=function (){
'type' : 'POST',
'data' : yamlData,
'success' : function(data) {
document.getElementById("error").style.display="none"
document.getElementById("err-span").innerHTML="";
go.setValue(data)
},
'error' : function(jqXHR, request,error)
{
document.getElementById('yamlGenerator').style.border = "1px solid red"
if (jqXHR.status == 400) {
alert('Invalid yaml format')
displayError('Invalid yaml format')
} else {
alert('Something went wrong! Please report this to [email protected]')
displayError('Something went wrong! Please report this to [email protected]')
}
}
});
Expand Down Expand Up @@ -59,3 +61,8 @@ $(document).ready(function(){
mode: "text/x-go"
});
});

function displayError(err){
document.getElementById("err-span").innerHTML=err;
document.getElementById("error").style.display="block"
}
25 changes: 25 additions & 0 deletions frontend/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,29 @@ button:focus{

.CodeMirror {
border: 1px solid lavender !important;
}
#error{
width: 50%;
margin: auto;
border: 1px solid azure;
display: none;
padding: 10px;
text-align: center;
color: red;
}
#view-source{
margin-top: 50px;
margin-left: 470px;
}
#view-source-link{
border: 1px solid steelblue;
padding: 10px;
color: steelblue;

}
#view-source a{
text-decoration: none !important;
}
#view-source-link:hover{
background-color: white;
}

0 comments on commit 5489352

Please sign in to comment.