A new capability to include in tm1Ui a read/update/delete json files in a specified folder directory inside WEB-INF/conf/... folder
Is your feature request related to a problem? Please describe. No Problem. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
In tm1Ui exists a function that would look into the tasks folder and read and update json files from the tasks folder via the front-end GUI. We would like to extend this feature and have the same capability available to read a folder besides tasks more precisely the folder name that was passed with in the function query
Describe the solution you'd like
A clear and concise description of what you want to happen. I would like to use the following function from the webApp js to retrieve and update the existing json file in specific folder I guess for example WEB-INF/conf/options/
$tm1Ui.getJsonFromFolder("options").then((filesFromFolder) => {
// use the json data returned
})
$tm1Ui.saveJsonToFolder("options").then((result) => {
if(result.success){
// update the file do something
}else{
// not saved error
}
})
Describe alternatives you've considered using the tm1Ui.tasks to retrieve a set of json files with a specific prefixed id from files and remove unwanted json id objects used from the result for the front-end list, but this will have two tasks and default options happening with in the one folder. A clear and concise description of any alternative solutions or features you've considered.
Additional context Request New Function in tm1Ui see below (similar to Tasks but for a passed folder and more describing the getJson files not dependent on the specific tasks folder)
(function() {
var b = angular.module("tm1Ui");
b.service("$tm1UiGetJson", ["$rootScope", "$http", "$q", "tm1UiSettings", "$tm1UiHelper", "$log", function(o, j, m, a, n, l,d) {
var k = this;
k.debug = false;
k.serviceID = n.generateUUID();
k.log = function(c, d) {
if (k.debug) {
l.debug("$tm1Ui - " + c);
l.debug(d);
o.$broadcast(a.frameworkLogID, {
id: k.serviceID,
name: "$tm1UiGetJson",
message: c,
object: d
})
}
};
k.getJsonFiles = function(folder) {
var c = j.get("api/admin/"+folder);
var d = d || m.defer();
c.then(function(e) {
d.resolve(e.data)
}, function(e) {
d.reject(e)
});
return d.promise
};
k.getJsonRunStatus = function(e, folder) {
if (_.isEmpty(e)) {
throw "$tm1UiGetJson: ID is EMPTY"
}
var c = j.get("api/admin/"+folder+"/" + encodeURIComponent(e.trim()) + "/status");
var d = d || m.defer();
c.then(function(f) {
d.resolve(f.data)
}, function(f) {
d.reject(f)
});
return d.promise
};
k.getJson = function(e, folder) {
if (_.isEmpty(e)) {
throw "$tm1UiGetJson: ID is EMPTY"
}
var c = j.get("api/admin/"+folder+"/" + encodeURIComponent(e.trim()));
var d = d || m.defer();
c.then(function(f) {
d.resolve(f.data)
}, function(f) {
d.reject(f)
});
return d.promise
};
k.saveOrUpdateJson = function(e, folder) {
if (_.isEmpty(e)) {
throw "$tm1UiGetJson: Nothing to save"
}
var c = j.post("api/admin/"+folder, e);
var d = d || m.defer();
c.then(function(f) {
d.resolve({
success: n.isSuccessful(f),
message: f.data
})
}, function(f) {
d.reject(f)
});
return d.promise
};
k.deleteJson = function(e, folder) {
if (_.isEmpty(e)) {
throw "$tm1UiGetJson: ID is EMPTY"
}
var c = j({
method: "POST",
url: "api/admin/"+folder+"/" + encodeURIComponent(e.trim()) + "/delete"
});
var d = d || m.defer();
c.then(function(f) {
d.resolve({
success: n.isSuccessful(f),
message: f.data
})
}, function(f) {
d.reject(f)
});
return d.promise
}
}])
})();
Add any other context or screenshots about the feature request here.