BigW Consortium Gitlab

Commit 9e74d936 by Filipa Lacerda Committed by Grzegorz Bizon

Adds folder_path to frontend

parent 54ede0b8
......@@ -111,11 +111,11 @@ export default {
},
methods: {
toggleFolder(folder, folderUrl) {
toggleFolder(folder) {
this.store.toggleFolder(folder);
if (!folder.isOpen) {
this.fetchChildEnvironments(folder, folderUrl, true);
this.fetchChildEnvironments(folder, true);
}
},
......@@ -143,10 +143,10 @@ export default {
.catch(this.errorCallback);
},
fetchChildEnvironments(folder, folderUrl, showLoader = false) {
fetchChildEnvironments(folder, showLoader = false) {
this.store.updateEnvironmentProp(folder, 'isLoadingFolderContent', showLoader);
this.service.getFolderContent(folderUrl)
this.service.getFolderContent(folder.folder_path)
.then(resp => resp.json())
.then(response => this.store.setfolderContent(folder, response.environments))
.then(() => this.store.updateEnvironmentProp(folder, 'isLoadingFolderContent', false))
......@@ -174,10 +174,7 @@ export default {
const openFolders = this.store.getOpenFolders();
if (openFolders.length) {
openFolders.forEach((folder) => {
// TODO - Move this to the backend
const folderUrl = `${window.location.pathname}/folders/${folder.folderName}`;
return this.fetchChildEnvironments(folder, folderUrl);
return this.fetchChildEnvironments(folder);
});
}
},
......
......@@ -410,20 +410,11 @@ export default {
this.hasStopAction ||
this.canRetry;
},
/**
* Constructs folder URL based on the current location and the folder id.
*
* @return {String}
*/
folderUrl() {
return `${window.location.pathname}/folders/${this.model.folderName}`;
},
},
methods: {
onClickFolder() {
eventHub.$emit('toggleFolder', this.model, this.folderUrl);
eventHub.$emit('toggleFolder', this.model);
},
},
};
......
......@@ -26,5 +26,9 @@ class EnvironmentEntity < Grape::Entity
terminal_project_environment_path(environment.project, environment)
end
expose :folder_path do |environment|
# folder_project_environments_path(environment.project, environment)
end
expose :created_at, :updated_at
end
---
title: Adds folder_path in API response
merge_request:
author:
......@@ -16,6 +16,10 @@ describe EnvironmentEntity do
expect(subject).to include(:id, :name, :state, :environment_path)
end
it 'exposes folder path' do
expect(subject).to include(:folder_path)
end
context 'metrics disabled' do
before do
allow(environment).to receive(:has_metrics?).and_return(false)
......
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