BigW Consortium Gitlab

Commit 7e9100fc by Jacob Schatz

Gets parent directory after call to blob.

parent 2041ee57
let RepoHelper = {
isTree(data) {
return data.hasOwnProperty('blobs');
},
blobURLtoParent(url) {
const split = url.split('/');
split.pop();
const blobIndex = split.indexOf('blob');
if(blobIndex > -1) {
split[blobIndex] = 'tree';
}
return split.join('/');
}
};
......
......@@ -7,7 +7,10 @@ let RepoService = {
this.url = url;
},
getContent() {
getContent(url) {
if(url){
return axios.get(url);
}
return axios.get(this.url);
}
};
......
......@@ -2,7 +2,6 @@ import Service from './repo_service'
import Helper from './repo_helper'
import Vue from 'vue';
import Store from './repo_store'
export default class RepoSidebar {
constructor(url) {
this.url = url;
......@@ -16,7 +15,17 @@ export default class RepoSidebar {
let data = response.data;
Store.isTree = Helper.isTree(data);
if(!Store.isTree) {
// it's a blob
const parentURL = Helper.blobURLtoParent(Service.url);
Store.blobRaw = data.plain;
Service.getContent(parentURL + '/?format=json')
.then((response)=> {
console.log(response.data)
})
.catch((response)=> {
});
} else {
}
})
.catch((response)=> {
......
......@@ -8,5 +8,4 @@
= render "projects/blob/auxiliary_viewer", blob: blob
#blob-content-holder.blob-content-holder
%p hi
#ide{ data: { url: repo_url }, style: "height:400px;" }
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