Commit 47639756 authored by svilayphiou's avatar svilayphiou
Browse files

cleaning js

parent abd9d112
// TEST VUE COMPONENTS
//var filterTree = new Vue({
// el: '#filter-tree',
// data: {
......@@ -16,12 +17,17 @@
// }
//})
// T R E E
const hiddenFile = /^\./;
var fileList = [];
var formerTree = [];
var blobHistory = [];
var treeURL = "https://gitlab.constantvzw.org/api/v4/projects/" + repoID + "/repository/tree?per_page=100";
var treeURL = gitlabApiURL + repoID + "/repository/tree?per_page=100";
fetch(treeURL).then(function(resp){ return resp.json(); })
.then(function(data){
return data.map(function(file) {
......@@ -46,7 +52,7 @@ var treeApp = new Vue({
if (type == "tree") {
currentPath = path;
var treeURL = "https://gitlab.constantvzw.org/api/v4/projects/" + repoID + "/repository/tree?per_page=100&path="+ path;
var treeURL = gitlabApiURL + repoID + "/repository/tree?per_page=100&path="+ path;
vm.fileList.splice(0);
fetch(treeURL).then(function(resp){ return resp.json(); })
.then(function(data){
......@@ -60,7 +66,7 @@ var treeApp = new Vue({
upPath = currentPath.split("/");
upPath.pop();
currentPath = upPath.join("");
var treeURL = "https://gitlab.constantvzw.org/api/v4/projects/" + repoID + "/repository/tree?per_page=100&path="+ upPath;
var treeURL = gitlabApiURL + repoID + "/repository/tree?per_page=100&path="+ upPath;
vm.fileList.splice(0);
fetch(treeURL).then(function(resp){ return resp.json(); })
.then(function(data){
......@@ -72,7 +78,7 @@ var treeApp = new Vue({
})
} else if (type == "blob") {
let blobURL = "https://gitlab.constantvzw.org/api/v4/projects/" + repoID + "/repository/blobs/" + blobID + "/raw";
let blobURL = gitlabApiURL + repoID + "/repository/blobs/" + blobID + "/raw";
fetch(blobURL).then((resp) => resp.blob())
.then(function(data){
// FILENAME
......@@ -90,13 +96,13 @@ var treeApp = new Vue({
if(mime == "image/png" | mime == "image/jpeg" | mime == "image/jpg" | mime == "image/gif") {
// DIFF: SHOWS ALL VERSIONS OF ONE PICTURE ////////////////////////////////////
const file_commits_url = "https://gitlab.constantvzw.org/api/v4/projects/" + repoID + "/repository/commits?path=" + path;
const file_commits_url = gitlabApiURL + repoID + "/repository/commits?path=" + path;
fetch(file_commits_url)
.then((resp) => resp.json())
.then(function(data){
return data.map(function(file) {
blob_id = file.id;
const commit_url = "https://gitlab.constantvzw.org/api/v4/projects/" + repoID + "/repository/files/" + path.replace(/\//g, "%2F") + "?ref=" + blob_id;
const commit_url = gitlabApiURL + repoID + "/repository/files/" + path.replace(/\//g, "%2F") + "?ref=" + blob_id;
fetch(commit_url)
.then((resp) => resp.json())
.then(function(data){
......@@ -128,11 +134,16 @@ log(blobHistory)
}
})
// I M A G E S
var icebergList = [];
var processusList = [];
let icebergURL = "https://gitlab.constantvzw.org/api/v4/projects/" + repoID + "/repository/tree?path=iceberg";
let processusURL = "https://gitlab.constantvzw.org/api/v4/projects/" + repoID + "/repository/tree?path=processus";
let icebergURL = gitlabApiURL + repoID + "/repository/tree?path=iceberg";
let processusURL = gitlabApiURL + repoID + "/repository/tree?path=processus";
getImages(repoID, icebergURL, icebergList);
getImages(repoID, processusURL, processusList);
......
......@@ -81,7 +81,8 @@
{% block script %}
<script type="text/javascript" charset="utf-8">
var gitlabURL = "http://gitlab.constantvzw.org";
var gitlabURL = "https://gitlab.constantvzw.org";
var gitlabApiURL = "https://gitlab.constantvzw.org/api/v4/projects/";
var user_name = "osp";
var repoID = {{ project.id }};
var projectName = "{{ project.name }}";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment