Commit 01f01e4f authored by Joern jkuensem's avatar Joern jkuensem Committed by Jorrit Schaap

TMSS-135: Rename LSMR to TMSS

parent 0103d064
......@@ -179,7 +179,7 @@ if(NOT DEFINED LOFAR_PACKAGE_LIST_INCLUDED)
set(SpecificationServices_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/SpecificationServices)
set(XSD_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/XSD)
set(TBBAlertVOeventPublisher_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/TBBAlertVOeventPublisher)
set(LSMR_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/LSMR)
set(TMSS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/TMSS)
set(DataManagementCommon_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/DataManagement/DataManagementCommon)
set(StorageQueryService_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/DataManagement/StorageQueryService)
set(Cleanup_SOURCE_DIR ${CMAKE_SOURCE_DIR}/SAS/DataManagement/Cleanup)
......
......@@ -132,19 +132,19 @@ LOGGING = {
# Read Postgres DB settings
# this requires a config file in ~/.lofar/dbcredentials/lsmr.ini
# this requires a config file in ~/.lofar/dbcredentials/tmss.ini
# if no such file exists then it is automatically created.
# It is also possible to set another credentials-name via the LSMR_DBCREDENTIALS env-var for testing for example.
# It is also possible to set another credentials-name via the TMSS_DBCREDENTIALS env-var for testing for example.
#
# contents should be like this (adapt as needed):
#
# [database:mdb]
# type = postgresql
# host = localhost
# database = <your_lsmr_database_name>
# database = <your_tmss_database_name>
# port = 5432
# user = <your_lsmr_user_name>
# password = <your_lsmr_password>
# user = <your_tmss_user_name>
# password = <your_tmss_password>
creds_name = os.environ.get('MDB_DBCREDENTIALS', 'mdb')
django_db_credentials = dbcredentials.DBCredentials().get(creds_name)
......
......@@ -4,7 +4,7 @@
This allows running Django tests using a temporary postgres db (set up by tesing.postgresql) instead of using the
stock config in settings.py. Run as script to start postgres instance, returns PID to allow stopping it after use.
To use this in Django tests, run: '.../manage.py test lsmrapp --testrunner=postgres_testrunner.PostgresqlTestRunner'
To use this in Django tests, run: '.../manage.py test tmssapp --testrunner=postgres_testrunner.PostgresqlTestRunner'
"""
import testing.postgresql
......
......@@ -13,7 +13,7 @@ lofar_add_package(TriggerEmailService)
lofar_add_package(SpecificationServices)
lofar_add_package(XSD)
lofar_add_package(TBBAlertVOeventPublisher)
lofar_add_package(LSMR)
lofar_add_package(TMSS)
add_subdirectory(MoM)
add_subdirectory(ResourceAssignment)
......
lofar_package(LSMR 0.1 DEPENDS PyCommon)
lofar_package(TMSS 0.1 DEPENDS PyCommon)
add_subdirectory(src)
add_subdirectory(bin)
......
lofar_add_bin_scripts(lsmr)
lofar_add_bin_scripts(lsmr_testdatabase)
lofar_add_bin_scripts(lsmr_testldap)
\ No newline at end of file
lofar_add_bin_scripts(tmss)
lofar_add_bin_scripts(tmss_testdatabase)
lofar_add_bin_scripts(tmss_testldap)
\ No newline at end of file
......@@ -18,18 +18,18 @@
# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
# Startup script for the development LSMR server
# Startup script for the development TMSS server
#defaults
PORT=8000
CREDENTIALS="lsmr"
CREDENTIALS="tmss"
# Parse args:
while getopts "p:C:h" opt; do
case ${opt} in
p ) PORT=${OPTARG} ;;
C ) CREDENTIALS=${OPTARG} ;;
h ) echo "usage: lsmr [OPTIONS]"
h ) echo "usage: tmss [OPTIONS]"
echo " where options are:"
echo " -p <port> the port where django runs the rest http interface on. default=$PORT"
echo " -C <credentials-name> the name of the credentials in ~/.lofar/dbcredentials. default=$CREDENTIALS"
......@@ -38,19 +38,19 @@ while getopts "p:C:h" opt; do
esac
done
echo "!!! This lsmr application is for testing only, properly deploy in Nginx or Apache for production use !!!"
echo "!!! This tmss application is for testing only, properly deploy in Nginx or Apache for production use !!!"
echo "Using Django port=$PORT credentials=$CREDENTIALS"
export LSMR_DBCREDENTIALS=$CREDENTIALS
export TMSS_DBCREDENTIALS=$CREDENTIALS
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# run the django migration (is a noop when nothing changed)
/usr/bin/python3 $DIR/../lib*/python*/site-packages/lofar/sas/lsmr/manage.py migrate
/usr/bin/python3 $DIR/../lib*/python*/site-packages/lofar/sas/tmss/manage.py migrate
# fire up the django server in the background...
/usr/bin/python3 $DIR/../lib*/python*/site-packages/lofar/sas/lsmr/manage.py runserver 0.0.0.0:$PORT &
/usr/bin/python3 $DIR/../lib*/python*/site-packages/lofar/sas/tmss/manage.py runserver 0.0.0.0:$PORT &
SERVER_PID=$!
# setup propagation of signals to child processes
......
......@@ -20,7 +20,7 @@
# Script to create, setup, and run a temporary postgres instance for easy functional testing
from lofar.sas.lsmr.test.postgres_testrunner import main
from lofar.sas.tmss.test.postgres_testrunner import main
if __name__ == "__main__":
main()
......@@ -20,7 +20,7 @@
# Script to create, setup, and run a temporary ldap service with fixtures for easy functional testing
from lofar.sas.lsmr.test.ldap_test_service import main
from lofar.sas.tmss.test.ldap_test_service import main
if __name__ == "__main__":
main()
# LSMR {#lsmr}
# TMSS {#tmss}
......
/**
\ingroup SAS
\defgroup LSMR LSMR
\ref lsmr
The LSMR package will replace the current MoM as the central Lofar operational management software.
\defgroup TMSS TMSS
\ref tmss
The TMSS package will replace the current MoM as the central Lofar operational management software.
It is mainly a Django-based REST API with a complex underlying database model.
The name is a working title and subject to change.
......
......@@ -13,12 +13,12 @@ pipeline {
steps {
script {
dir ('SAS/LSMR/docker/lsmr'){
docker.build("lsmr", "--build-arg BRANCH=${env.BRANCH_NAME} .").tag("${env.DOCKER_TAG}")
dir ('SAS/TMSS/docker/tmss'){
docker.build("tmss", "--build-arg BRANCH=${env.BRANCH_NAME} .").tag("${env.DOCKER_TAG}")
}
dir ('SAS/LSMR/docker/lsmr-postgres'){
docker.build("lsmr-postgres").tag("${env.DOCKER_TAG}")
dir ('SAS/TMSS/docker/tmss-postgres'){
docker.build("tmss-postgres").tag("${env.DOCKER_TAG}")
}
}
......@@ -28,8 +28,8 @@ pipeline {
steps {
script {
withDockerRegistry(credentialsId: 'nexus', url: env.LOFAR_REGISTRY_URL) {
tag_and_push("lsmr:${env.DOCKER_TAG}", env.LOFAR_REGISTRY)
tag_and_push("lsmr-postgres:${env.DOCKER_TAG}")
tag_and_push("tmss:${env.DOCKER_TAG}", env.LOFAR_REGISTRY)
tag_and_push("tmss-postgres:${env.DOCKER_TAG}")
}
}
......
To build:
docker build -t lsmr-postgres lsmr-postgres
docker build -t lsmr [--build-arg BRANCH=LSMR-epic] [--build-arg UID=`id -u`] lsmr
docker build -t tmss-postgres tmss-postgres
docker build -t tmss [--build-arg BRANCH=TMSS-epic] [--build-arg UID=`id -u`] tmss
To start the PostgreSQL container:
docker run [-it] --name=postgres-$USER --rm lsmr-postgres
docker run [-it] --name=postgres-$USER --rm tmss-postgres
To start the LSMR container (exposing port 8001 to surf to) AND LSMR app:
To start the TMSS container (exposing port 8001 to surf to) AND TMSS app:
docker run [-it] --rm -p 0.0.0.0:8001:8000 --link=postgres-$USER:postgres lsmr
docker run [-it] --rm -p 0.0.0.0:8001:8000 --link=postgres-$USER:postgres tmss
To start the LSMR container (exposing port 8001 to surf to) for debugging/testing:
To start the TMSS container (exposing port 8001 to surf to) for debugging/testing:
docker run -it --rm -p 0.0.0.0:8001:8000 --link=postgres-$USER:postgres lsmr bash
docker run -it --rm -p 0.0.0.0:8001:8000 --link=postgres-$USER:postgres tmss bash
Note: "-it" allows one to abort the container with ^C.
CREATE USER lsmr WITH SUPERUSER PASSWORD 'lsmr';
CREATE DATABASE lsmr;
GRANT ALL PRIVILEGES ON DATABASE lsmr TO lsmr;
CREATE USER tmss WITH SUPERUSER PASSWORD 'tmss';
CREATE DATABASE tmss;
GRANT ALL PRIVILEGES ON DATABASE tmss TO tmss;
version: '3'
services:
lsmr_test:
tmss_test:
build:
context: .
dockerfile: lsmr_testenv_Dockerfile
container_name: lsmr_test
dockerfile: tmss_testenv_Dockerfile
container_name: tmss_test
ports:
- "8000:8000"
- "3000:3000"
lsmr_test_nginx:
tmss_test_nginx:
build:
context: .
dockerfile: lsmr_nginx_Dockerfile
container_name: lsmr_test_nginx
dockerfile: tmss_nginx_Dockerfile
container_name: tmss_test_nginx
ports:
- "5000:5000"
#
# This sets up a Docker image that runs the lsmr frontend for testing
# This sets up a Docker image that runs the tmss frontend for testing
#
FROM centos:7
......
#
# This sets up a Docker image that runs an nginx proxy for lsmr fronend testing
# Both the frontend as well as the API have to be served from the same origin (unless LSMR serves appropriate CORS headers).
# This sets up a Docker image that runs an nginx proxy for tmss fronend testing
# Both the frontend as well as the API have to be served from the same origin (unless TMSS serves appropriate CORS headers).
#
FROM centos:7
......
#
# This sets up a Docker image that runs lsmr for testing
# This sets up a Docker image that runs tmss for testing
#
FROM centos:7
......@@ -11,7 +11,7 @@ RUN yum -y groupinstall 'Development Tools' && \
n stable && \
npm install -g serve
RUN echo "Installing packages for LSMR..." && \
RUN echo "Installing packages for TMSS..." && \
yum -y install https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-3.noarch.rpm && \
yum -y install postgresql94-devel openldap-devel postgresql94-server which && \
pip3 install django-filter django-auth-ldap coreapi python-ldap-test django-jsonforms django-json-widget "git+git://github.com/nnseva/django-jsoneditor.git" psycopg2-binary markdown ldap3 drf-yasg flex swagger-spec-validator testing.postgresql
......@@ -23,7 +23,7 @@ RUN echo "Checking out code base" && \
cd lofar && \
git checkout LEI-40 && \
. CMake/gen_LofarPackageList_cmake.sh && \
PACKAGE=LSMR && \
PACKAGE=TMSS && \
VARIANT=gnucxx11_opt && \
echo "Building $PACKAGE..." && \
mkdir -p build/$VARIANT && \
......@@ -35,35 +35,35 @@ RUN echo "Checking out code base" && \
USER postgres
RUN mkdir -p ~postgres/.lofar/dbcredentials/ && \
echo -e '[database:lsmr_ldap_test]\n\
echo -e '[database:tmss_ldap_test]\n\
host=localhost\n\
user=lsmrldap\n\
password=lsmrldap\n\
user=tmssldap\n\
password=tmssldap\n\
type=unknown\n\
port=3389\n\
database=lsmr_ldap_test' > ~postgres/.lofar/dbcredentials/lsmr_ldap_test.ini && \
echo -e '[database:lsmr]\n\
database=tmss_ldap_test' > ~postgres/.lofar/dbcredentials/tmss_ldap_test.ini && \
echo -e '[database:tmss]\n\
type = postgresql\n\
host = localhost\n\
database = lsmr\n\
database = tmss\n\
port = 5432\n\
user = lsmrdb\n\
password = lsmrdb\n' > ~postgres/.lofar/dbcredentials/lsmr.ini
user = tmssdb\n\
password = tmssdb\n' > ~postgres/.lofar/dbcredentials/tmss.ini
ENV LSMR_DBCREDENTIALS=lsmr
ENV LSMR_LDAPCREDENTIALS=lsmr_ldap_test
ENV TMSS_DBCREDENTIALS=tmss
ENV TMSS_LDAPCREDENTIALS=tmss_ldap_test
ENTRYPOINT /bin/bash -c 'export VARIANT=gnucxx11_opt; \
source /lofar/build/$VARIANT/lofarinit.sh; \
cat /var/lib/pgsql/.lofar/dbcredentials/lsmr.ini; \
cat /var/lib/pgsql/.lofar/dbcredentials/lsmr_ldap_test.ini; \
lsmr_testldap & \
lsmr_testdatabase & \
cat /var/lib/pgsql/.lofar/dbcredentials/tmss.ini; \
cat /var/lib/pgsql/.lofar/dbcredentials/tmss_ldap_test.ini; \
tmss_testldap & \
tmss_testdatabase & \
sleep 15 && \
lsmr & \
tmss & \
cd /lofar/build/gnucxx11_opt/installed/share/www && \
serve -s . -p 3000'
# It also works to serve the dev server for interactive development as such:
# cd /lofar/build/gnucxx11_opt/SAS/LSMR/frontend/frontend_poc && \
# cd /lofar/build/gnucxx11_opt/SAS/TMSS/frontend/frontend_poc && \
# npm start
\ No newline at end of file
......@@ -18,22 +18,22 @@ http {
}
location @api_proxy {
proxy_pass http://lsmr_test:8000$uri;
proxy_pass http://tmss_test:8000$uri;
proxy_intercept_errors on;
recursive_error_pages on;
error_page 404 = @frontend_proxy;
}
location @frontend_proxy {
proxy_pass http://lsmr_test:3000$uri;
proxy_pass http://tmss_test:3000$uri;
}
location /api/ {
proxy_pass http://lsmr_test:8000;
proxy_pass http://tmss_test:8000;
}
location /frontend/ {
proxy_pass http://lsmr_test:3000;
proxy_pass http://tmss_test:3000;
}
}
}
\ No newline at end of file
FROM ubuntu:18.04
# LOFAR branch to build
ARG BRANCH=LSMR-epic
ARG BRANCH=TMSS-epic
# Export build-time variables to containters
ENV BRANCH=$BRANCH
......@@ -36,19 +36,19 @@ RUN cd /src && \
svn co -N https://svn.astron.nl/LOFAR/branches/$BRANCH/ && \
cd $BRANCH/ && \
svn up CMake
RUN mkdir -p /build/gnu_debug && cd /build/gnu_debug && cmake /src/$BRANCH/ -DBUILD_PACKAGES=LSMR -DCMAKE_INSTALL_PREFIX=/opt/lofar && make -j 8 && make -j 8 install
RUN mkdir -p /build/gnu_debug && cd /build/gnu_debug && cmake /src/$BRANCH/ -DBUILD_PACKAGES=TMSS -DCMAKE_INSTALL_PREFIX=/opt/lofar && make -j 8 && make -j 8 install
# Configure authentication
ADD dbcreds.ini /opt/lofar/etc/dbcredentials/lsmr.ini
RUN echo "REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES']=[]" >> /opt/lofar/lib/python3.6/site-packages/lofar/sas/lsmr/lsmr/settings.py
RUN echo "REST_FRAMEWORK['DEFAULT_PERMISSION_CLASSES']=[]" >> /opt/lofar/lib/python3.6/site-packages/lofar/sas/lsmr/lsmr/settings.py
ADD dbcreds.ini /opt/lofar/etc/dbcredentials/tmss.ini
RUN echo "REST_FRAMEWORK['DEFAULT_AUTHENTICATION_CLASSES']=[]" >> /opt/lofar/lib/python3.6/site-packages/lofar/sas/tmss/tmss/settings.py
RUN echo "REST_FRAMEWORK['DEFAULT_PERMISSION_CLASSES']=[]" >> /opt/lofar/lib/python3.6/site-packages/lofar/sas/tmss/tmss/settings.py
# Allow Django HTTP access
EXPOSE 8000
RUN echo "ALLOWED_HOSTS=['*']" >> /opt/lofar/lib/python3.6/site-packages/lofar/sas/lsmr/lsmr/settings.py
RUN echo "ALLOWED_HOSTS=['*']" >> /opt/lofar/lib/python3.6/site-packages/lofar/sas/tmss/tmss/settings.py
# Hot patches
# Run LOFAR app
CMD bash -c 'source /opt/lofar/lofarinit.sh && lsmr'
CMD bash -c 'source /opt/lofar/lofarinit.sh && tmss'
[database:lsmr]
[database:tmss]
host=postgres
user=lsmr
password=lsmr
database=lsmr
user=tmss
password=tmss
database=tmss
......@@ -10,7 +10,7 @@ headers.append('Content-Type', 'application/json');
var api_url = '/api/'
function lsmrGetList(url, component){
function tmssGetList(url, component){
console.log('Getting '+ url)
fetch(api_url+url, {headers: headers})
.then(response => response.json())
......@@ -19,7 +19,7 @@ function lsmrGetList(url, component){
.catch(err => console.log(err))
}
function lsmrGet(url, component){
function tmssGet(url, component){
console.log('Getting '+ url)
fetch(api_url+url, {headers: headers})
.then(response => response.json())
......@@ -28,7 +28,7 @@ function lsmrGet(url, component){
.catch(err => console.log(err))
}
function lsmrPost(url, data, callback, callback_arg){
function tmssPost(url, data, callback, callback_arg){
console.log('Posting '+ url)
var datastring = JSON.stringify(data);
fetch(api_url+url, {headers: headers, method: 'POST', body: datastring})
......@@ -36,14 +36,14 @@ function lsmrPost(url, data, callback, callback_arg){
.catch(err => console.log(err))
}
function lsmrPut(url, data){
function tmssPut(url, data){
console.log('Putting '+ url)
var datastring = JSON.stringify(data);
fetch(api_url+url, {headers: headers, method: 'PUT', body: datastring})
.catch(err => console.log(err))
}
function lsmrPatch(url, data, component){
function tmssPatch(url, data, component){
console.log('Patching '+ url)
var datastring = JSON.stringify(data);
fetch(api_url+url, {headers: headers, method: 'PATCH', body: datastring})
......@@ -51,7 +51,7 @@ function lsmrPatch(url, data, component){
.catch(err => console.log(err))
}
function lsmrDelete(url, callback, callback_arg){
function tmssDelete(url, callback, callback_arg){
console.log('Deleting '+ url)
fetch(api_url+url, {headers: headers, method: 'DELETE'})
.then(callback(callback_arg))
......@@ -84,7 +84,7 @@ class Cycle extends Component {
if(this.isnew){
this.setState({[p]: value});
}else{
lsmrPatch('cycle/'+this.state.name+'/', {[p]: value}, this);
tmssPatch('cycle/'+this.state.name+'/', {[p]: value}, this);
}
}
......@@ -113,10 +113,10 @@ class Cycle extends Component {
<td>{!this.isnew ?
<button className="btn btn-danger"onClick={() => {
console.log(this.index);
lsmrDelete('cycle/'+this.state.name, this.deleteItem, this.index);
tmssDelete('cycle/'+this.state.name, this.deleteItem, this.index);
}}>Delete</button> :
<button className="btn btn-primary"onClick={() => {
lsmrPost('cycle/', this.state, this.addItem, this.state);
tmssPost('cycle/', this.state, this.addItem, this.state);
}}>Create</button>}
</td>
</tr>
......@@ -132,7 +132,7 @@ class CycleList extends Component {
}
componentDidMount(){
lsmrGetList('cycle/', this);
tmssGetList('cycle/', this);
}
deleteItem = (index) => {
......
......@@ -11,7 +11,7 @@ headers.append('Content-Type', 'application/json');
var api_url = '/api/'
function lsmrGetList(url, component){
function tmssGetList(url, component){
console.log('Getting '+ url)
fetch(api_url+url, {headers: headers})
.then(response => response.json())
......@@ -20,7 +20,7 @@ function lsmrGetList(url, component){
.catch(err => console.log(err))
}
function lsmrGet(url, component){
function tmssGet(url, component){
console.log('Getting '+ url)
fetch(api_url+url, {headers: headers})
.then(response => response.json())
......@@ -29,14 +29,14 @@ function lsmrGet(url, component){
.catch(err => console.log(err))
}
function lsmrPost(url, data, component){
function tmssPost(url, data, component){
console.log('Posting '+ url)
fetch(api_url+url, {headers: headers, method: 'POST', body: data})
.then(ReactDOM.render(<ProjectList />, document.getElementById('root')))
.catch(err => console.log(err))
}
function lsmrPut(url, data, component){
function tmssPut(url, data, component){
console.log('Putting '+ url)
console.log(data)
fetch(api_url+url, {headers: headers, method: 'PUT', body: data})
......@@ -44,7 +44,7 @@ function lsmrPut(url, data, component){
.catch(err => console.log(err))
}
function lsmrPatch(url, data, component){
function tmssPatch(url, data, component){
console.log('Patching '+ url)
console.log(data)
fetch(api_url+url, {headers: headers, method: 'PATCH', body: data})
......@@ -52,7 +52,7 @@ function lsmrPatch(url, data, component){
.catch(err => console.log(err))
}
function lsmrDelete(url){
function tmssDelete(url){
console.log('Deleting '+ url)
fetch(api_url+url, {headers: headers, method: 'DELETE'})
.catch(err => console.log(err))
......@@ -79,7 +79,7 @@ const Project = props => (
<td>
<button className="btn btn-primary" onClick={() => ReactDOM.render(<EditProject project={props.project.name}/>, document.getElementById('root'))}>Edit</button>
<button className="btn btn-danger"onClick={() => {
lsmrDelete('project/'+props.project.name);
tmssDelete('project/'+props.project.name);
props.deleteItem(props.index);
}}>Delete</button>
</td>
......@@ -117,7 +117,7 @@ class EditProject extends Component {
componentDidMount() {
if(!this.state.isnew){
lsmrGet('project/'+this.state.project+'/', this);
tmssGet('project/'+this.state.project+'/', this);
}
}
......@@ -165,9 +165,9 @@ class EditProject extends Component {
expert: this.state.expert,
};
if(this.state.isnew){
lsmrPost('project/', JSON.stringify(data), this)
tmssPost('project/', JSON.stringify(data), this)
}else{
lsmrPut('project/'+this.props.project+'/', JSON.stringify(data), this)
tmssPut('project/'+this.props.project+'/', JSON.stringify(data), this)
}
}
......@@ -247,7 +247,7 @@ class ProjectList extends Component {
}
componentDidMount(){
lsmrGetList('project/', this);
tmssGetList('project/', this);
}
deleteItem = (index) => {
......
......@@ -6,7 +6,7 @@ var headers = new Headers();
headers.append('Authorization', 'Basic ' + btoa('paulus:pauluspass'));
headers.append('Content-Type', 'application/json');
function lsmrGetList(url, component){
function tmssGetList(url, component){
console.log('Getting '+ url)
var response = fetch('http://localhost:8000/'+url, {headers: headers})
.then(response => response.json())
......@@ -15,7 +15,7 @@ function lsmrGetList(url, component){
.catch(err => console.log(err))
}
function lsmrGet(url, component){
function tmssGet(url, component){
console.log('Getting '+ url)
var response = fetch('http://localhost:8000/'+url, {headers: headers})
.then(response => response.json())
......@@ -24,14 +24,14 @@ function lsmrGet(url, component){
.catch(err => console.log(err))
}
function lsmrPost(url, data, component){
function tmssPost(url, data, component){
console.log('Posting '+ url)
var response = fetch('http://localhost:8000/'+url, {headers: headers, method: 'POST', body: data})
.then(ReactDOM.render(<ProjectList />, domContainer))
.catch(err => console.log(err))
}
function lsmrPut(url, data, component){
function tmssPut(url, data, component){
console.log('Putting '+ url)
console.log(data)
var response = fetch('http://localhost:8000/'+url, {headers: headers, method: 'PUT', body: data})
......@@ -39,7 +39,7 @@ function lsmrPut(url, data, component){
.catch(err => console.log(err))
}
function lsmrPatch(url, data, component){
function tmssPatch(url, data, component){
console.log('Patching '+ url)
console.log(data)
var response = fetch('http://localhost:8000/'+url, {headers: headers, method: 'PATCH', body: data})
......@@ -47,7 +47,7 @@ function lsmrPatch(url, data, component){
.catch(err => console.log(err))
}
function lsmrDelete(url){
function tmssDelete(url){
console.log('Deleting '+ url)
var response = fetch('http://localhost:8000/'+url, {headers: headers, method: 'DELETE'})
.catch(err => console.log(err))
......@@ -74,7 +74,7 @@ const Project = props => (
<td>
<button className="btn btn-primary" onClick={() => ReactDOM.render(<EditProject project={props.project.name}/>, domContainer)}>Edit</button>
<button className="btn btn-danger"onClick={() => {
lsmrDelete('project/'+props.project.name);
tmssDelete('project/'+props.project.name);
props.deleteItem(props.index);
}}>Delete</button>
</td>
......@@ -112,7 +112,7 @@ class EditProject extends React.Component {
componentDidMount() {
if(!this.state.isnew){
lsmrGet('project/'+this.state.project+'/', this);
tmssGet('project/'+this.state.project+'/', this);
}
}
......@@ -154,9 +154,9 @@ class EditProject extends React.Component {
expert: this.state.expert,
};
if(this.state.isnew){
lsmrPost('project/', JSON.stringify(data), this)
tmssPost('project/', JSON.stringify(data), this)
}else{
lsmrPut('project/'+this.props.project+'/', JSON.stringify(data), this)
tmssPut('project/'+this.props.project+'/', JSON.stringify(data), this)
}
}
......@@ -228,7 +228,7 @@ class ProjectList extends React.Component {
}
componentDidMount(){
lsmrGetList('project/', this);
tmssGetList('project/', this);
}
deleteItem = (index) => {
......
......@@ -2,7 +2,7 @@
// Shared Procedures
function lsmrGet(url, component){
function tmssGet(url, component){
console.log('Fetching '+ url)
var headers = new Headers();
headers.append('Authorization', 'Basic ' + btoa('paulus:pauluspass'));
......@@ -13,7 +13,7 @@ function lsmrGet(url, component){
.catch(err => console.log(err))
}
function lsmrDelete(url){
function tmssDelete(url){
console.log('Deleting '+ url)
var headers = new Headers();
headers.append('Authorization', 'Basic ' + btoa('paulus:pauluspass'));
......@@ -45,7 +45,7 @@ const Project = props => (
<td>
<button onClick={() => console.log(props.index)}>Edit</button>
<button onClick={() => {
lsmrDelete('project/'+props.project.name);
tmssDelete('project/'+props.project.name);
props.deleteItem(props.index);
}}>Delete</button>
</td>
......@@ -223,7 +223,7 @@ class ProjectList extends React.Component {
}
componentDidMount(){
lsmrGet('project', this);