Skip to content

Commit

Permalink
Minor changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
C0rbz committed Jul 19, 2016
1 parent f9bac84 commit e96909a
Showing 1 changed file with 30 additions and 31 deletions.
61 changes: 30 additions & 31 deletions components/addInstance.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,32 @@ var vm = new Vue({

methods : {

verif : function (technicalName) {

var data = {
'technicalName' : technicalName
};

vm.$http.get('/-/v1/instances/verif', data).then(function (result) {

if (result.status == 200) {
document.getElementById('technicalNameExists').style.display = 'none';
document.getElementById('save').style.display = 'block';
document.getElementById('saveTechnicalExists').style.display = 'none';
}

}, function (error) {

if (error.status == 409) {
document.getElementById('technicalNameExists').style.display = 'block';
document.getElementById('save').style.display = 'none';
document.getElementById('saveTechnicalExists').style.display = 'block';
}

});

},

displayFormAddInstance : function (event) {
document.getElementById('modal-add-instance').style.display = 'block';
},
Expand Down Expand Up @@ -131,7 +157,7 @@ vm.$watch('project', function(project) {
else { this.technicalName = this.project + '-' + this.study + '-' + this.version; }

this.urlPreview = 'http://'+this.technicalName+'.'+publicDomain;
verif(this.technicalName);
this.verif(this.technicalName);

});

Expand All @@ -146,7 +172,7 @@ vm.$watch('study', function (study) {
else { this.technicalName = this.project + '-' + this.study + '-' + this.version; }

this.urlPreview = 'http://'+this.technicalName+'.'+publicDomain;
verif(this.technicalName);
this.verif(this.technicalName);

});

Expand All @@ -161,33 +187,6 @@ vm.$watch('version', function (version) {
else { this.technicalName = this.project + '-' + this.study + '-' + this.version; }

this.urlPreview = 'http://'+this.technicalName+'.'+publicDomain;
verif(this.technicalName);

});


function verif (tn) {

var data = {
'technicalName' : tn
};

vm.$http.get('/-/v1/instances/verif', data).then(function (result) {

if (result.status == 200) {
document.getElementById('technicalNameExists').style.display = 'none';
document.getElementById('save').style.display = 'block';
document.getElementById('saveTechnicalExists').style.display = 'none';
}

}, function (error) {

if (error.status == 409) {
document.getElementById('technicalNameExists').style.display = 'block';
document.getElementById('save').style.display = 'none';
document.getElementById('saveTechnicalExists').style.display = 'block';
}

});
this.verif(this.technicalName);

}
});

0 comments on commit e96909a

Please sign in to comment.