Skip to content

Commit

Permalink
Début d'implémentation des métadonnées associées à la localisation. #9
Browse files Browse the repository at this point in the history
  • Loading branch information
koromodako committed Jun 7, 2016
1 parent 643d7c7 commit 247921c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
18 changes: 14 additions & 4 deletions deployment/deploy_openshift.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,32 @@
#!/bin/bash
# -------------------------------------------------------------------
# CONFIGURATION
# -------------------------------------------------------------------
INI_DIR=app-root/runtime/repo/
INI_FILE=mapif.ini
APP=mapif
BRANCH=master

# -------------------------------------------------------------------
# FUNCTIONS
# -------------------------------------------------------------------
colecho() { echo -e "\033[${1}m[deploy_openshift]> ${2}\033[0m"; }
becho() { colecho 34 "${1}"; }
gecho() { colecho 32 "${1}"; }
recho() { colecho 31 "${1}"; }
ok() { gecho "done."; }
ko() { recho "failed!"; }

# -------------------------------------------------------------------
# MAIN SCRIPT
# -------------------------------------------------------------------
becho "calling git to push latest commit to openshift..."
(git push openshift ${BRANCH} && ok) ||ko
becho "calling rhc to stop app..."
(sudo rhc app stop -a ${APP} && ok) ||ko
becho "calling rhc to deploy app..."
(sudo rhc deploy ${BRANCH} -a ${APP} && ok) ||ko
becho "calling rhc to send configuration file to openshift..."
(sudo rhc scp ${APP} upload ${INI_FILE} ${INI_DIR} && ok) ||ko
becho "calling rhc to restart application..."
(sudo rhc app restart -a ${APP} && ok) ||ko
#becho "calling rhc to restart application..."
#(sudo rhc app restart -a ${APP} && ok) ||ko
becho "calling rhc to read logs after deployement..."
(sudo rhc tail -a ${APP} && ok) ||ko
3 changes: 2 additions & 1 deletion src/mapif.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,8 @@ def location_create():
content['osm_id'] = "Le champ osm_id doit être un identifiant numérique !"
if validator.is_empty(osm_type):
content['osm_type'] = "Le champ osm_type ne doit pas être vide !"
# aucune validation concernant les métadonnées (explicite)
if metadata['reason'] not in ['no', 'internship', 'exchange', 'dd', 'job']:
content['meta']['reason'] = "La valeur de la métadonnée raison est invalide."
if len(content.keys()) == 0:
# create user - location mapping record in db
content = "L'ajout de la localisation a échoué. La localisation n'a pas été confirmée par Nominatim."
Expand Down
6 changes: 3 additions & 3 deletions src/static/js/modules/AjaxModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ var AjaxModule = {
location.reload(true);
}
else{
alert("une erreur est survenue has_error")
UtilsModule.handleServerError("N0M1N4T1M."+osm_id);
}
},
error: function(resp, statut, erreur){
jsonResp = JSON.parse(resp.responseText);
UtilsModule.handleServerError(jsonResp.code)
UtilsModule.handleServerError(jsonResp.code);
UtilsModule.logger("AJAX NOK");
},
complete: function(){
Expand Down Expand Up @@ -170,4 +170,4 @@ var AjaxModule = {
}
});
}
};
};
4 changes: 2 additions & 2 deletions src/templates/modals/addPositionModal.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h5>Votre position actuelle est {{ loc.location.city }} {{ loc.location.country
<label for="position-add-reason" class="control-label">Pour qu'elle raison êtes vous là ?</label>
<select class="form-control" id="position-add-reason" name="reason" required="required">
<option value="no" selected>Je ne sais pas...</option>
<option value="stage">Stage</option>
<option value="internship">Stage</option>
<option value="exchange">&Eacute;change</option>
<option value="dd">Double Diplôme</option>
<option value="job">Emploi</option>
Expand All @@ -41,4 +41,4 @@ <h5>Votre position actuelle est {{ loc.location.city }} {{ loc.location.country
</div>
</div>
</div>
</div>
</div>

0 comments on commit 247921c

Please sign in to comment.