Commit 86794957 authored by Florent Chehab's avatar Florent Chehab

Updated names and generation of frontend

parent d569450d
Pipeline #26848 passed with stages
in 2 minutes and 5 seconds
# THIS FILE IS USED TO GENERATE OTHER VERY IMPORTANT FILES
# BOTH IN THE FRONTEND AND IN THE BACKEND !
# TAKE CARE WHEN MODYFING IT ;)
# model : the model name (may be null)
# viewset : the viewset name for the api
# api_end_pont : the main part of the url for making request to the api
# This string will also be used for naming variables in JS !!
# So no weird characters there please...
# versionned: boolean to specify wether this model is versionned or not
# api_attr : to specify some attributes that may be captured
# and used in the viewset
# requires_testing: boolean to tell if this viewset is only availble in
# a testing environment.
- model: Country
viewset: CountryViewSet
import_location: location
......@@ -23,7 +39,7 @@
- model: UserData
viewset: UserDataViewSet
import_location: user
api_end_point: user_data
api_end_point: userData
api_name: user-data-detail
......@@ -62,19 +78,19 @@
- model: CountryTaggedItem
viewset: CountryTaggedItemViewSet
import_location: location
api_end_point: countries_tagged_items
api_end_point: countriesTaggedItems
versionned: true
- model: CountryScholarship
viewset: CountryScholarshipViewSet
import_location: location
api_end_point: countries_scholarships
api_end_point: countriesScholarships
versionned: true
- model: CountryDri
viewset: CountryDriViewSet
import_location: location
api_end_point: countries_dri
api_end_point: countriesDri
versionned: true
......@@ -82,7 +98,7 @@
- model: CityTaggedItem
viewset: CityTaggedItemViewSet
import_location: location
api_end_point: cities_tagged_items
api_end_point: citiesTaggedItems
versionned: true
......@@ -90,37 +106,37 @@
- model: UniversityTaggedItem
viewset: UniversityTaggedItemViewSet
import_location: university
api_end_point: universities_tagged_items
api_end_point: universitiesTaggedItems
versionned: true
- model: UniversityScholarship
viewset: UniversityScholarshipViewSet
import_location: university
api_end_point: universities_scholarships
api_end_point: universitiesScholarships
versionned: true
- model: UniversityInfo
viewset: UniversityInfoViewSet
import_location: university
api_end_point: universities_info
api_end_point: universitiesInfo
versionned: true
- model: UniversitySemestersDates
viewset: UniversitySemestersDatesViewSet
import_location: university
api_end_point: universities_semesters_dates
api_end_point: universitiesSemestersDates
versionned: true
- model: UniversityDri
viewset: UniversityDriViewSet
import_location: university
api_end_point: universities_dri
api_end_point: universitiesDri
versionned: true
- model: null
viewset: UniversityModulesViewSet
import_location: university
api_end_point: university_all
api_end_point: universitiesAll
api_attr: (?P<univ_id>[0-9]+)
api_name: university_details
......@@ -129,13 +145,13 @@
- model: CampusTaggedItem
viewset: CampusTaggedItemViewSet
import_location: university
api_end_point: campuses_tagged_items
api_end_point: campusesTaggedItems
versionned: true
- model: null
viewset: MainCampusViewSet
import_location: university
api_end_point: main_campuses
api_end_point: mainCampuses
read_only: true
......@@ -143,36 +159,36 @@
- model: Recommendation
viewset: RecommendationViewSet
import_location: user
api_end_point: user_recommendations
api_end_point: userRecommendations
- model: RecommendationList
viewset: RecommendationListViewSet
import_location: user
api_end_point: user_recommendation_lists
api_end_point: userRecommendationLists
- model: PreviousDeparture
viewset: PreviousDepartureViewSet
import_location: user
api_end_point: universities_previous_departures
api_end_point: universitiesPreviousDepartures
- model: PreviousDepartureFeedback
viewset: PreviousDepartureFeedbackViewSet
import_location: user
api_end_point: universities_previous_departure_feedback
api_end_point: universitiesPreviousDepartureFeedback
- model: PendingModeration
viewset: PendingModerationViewSet
import_location: my_model
api_end_point: pending_moderation
api_end_point: pendingModeration
- model: Version
viewset: VersionViewSet
import_location: my_model
api_end_point: version
api_end_point: versions
api_attr: (?P<content_type_id>[0-9]+)/(?P<object_pk>[0-9A-Za-z]+)
api_name: versions-list
api_name: versionsList
ignore_in_admin: true
- model: ForTestingModeration
......
......@@ -44,11 +44,13 @@ with open(join(current_dir, '../../backend/generate/api_config.yml'), 'r') as f:
contexts = []
for api in api_config:
if "requires_testing" in api and api["requires_testing"]:
continue
name = api['viewset'].split('ViewSet')[0]
name = name[0].lower() + name[1:]
contexts.append({
"name": name,
"api_end_point": API_BASE + api["api_end_point"] + '/'
"name": api["api_end_point"],
"api_end_point": API_BASE + api["api_end_point"] + '/',
})
......
......@@ -27,7 +27,7 @@ import {
} from 'react-router-dom';
import {
countryFetchData,
countriesFetchData,
} from '../generated/actions';
......@@ -181,7 +181,7 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
fetchData: {
countries: () => dispatch(countryFetchData())
countries: () => dispatch(countriesFetchData())
}
};
};
......
......@@ -7,8 +7,8 @@ import { Map, TileLayer, Marker, Popup, LayersControl, FeatureGroup, Circle, Lay
import {
universitiesFetchData,
universitiesInvalidated,
mainCampusFetchData,
mainCampusInvalidated
mainCampusesFetchData,
mainCampusesInvalidated
} from '../../generated/actions';
......@@ -18,11 +18,11 @@ class UnivMarkers extends Component {
render() {
let universities = this.props.universities.fetched.data;
let mainCampus = this.props.mainCampus.fetched.data;
let mainCampuses = this.props.mainCampuses.fetched.data;
let selected_main_campus = [];
for (let main_campus_pk in mainCampus) {
let campus = mainCampus[main_campus_pk]
for (let main_campus_pk in mainCampuses) {
let campus = mainCampuses[main_campus_pk]
let univ = universities[campus.university]
if (univ && campus) {
selected_main_campus.push({
......@@ -51,7 +51,7 @@ class UnivMarkers extends Component {
const mapStateToProps = (state) => {
return {
universities: state.universities,
mainCampus: state.mainCampus
mainCampuses: state.mainCampuses
};
};
......
import React from 'react';
import MyComponent from '../MyComponent'
import { connect } from "react-redux";
import Loading from '../other/Loading';
import { Map, TileLayer, Marker, Popup, LayersControl, FeatureGroup, Circle, LayerGroup } from 'react-leaflet';
// import MarkerClusterGroup from 'react-leaflet-markercluster';
import { Map, TileLayer, LayersControl, LayerGroup } from 'react-leaflet';
import {
universityFetchData,
mainCampusFetchData,
universitiesFetchData,
mainCampusesFetchData,
} from '../../generated/actions';
import UnivMarkers from './UnivMakers';
......@@ -107,7 +106,7 @@ class UnivMap extends MyComponent {
const mapStateToProps = (state) => {
return {
universities: state.universities,
mainCampus: state.mainCampus,
mainCampuses: state.mainCampuses,
map: state.app.mainMap
};
};
......@@ -115,8 +114,8 @@ const mapStateToProps = (state) => {
const mapDispatchToProps = (dispatch) => {
return {
fetchData: {
universities: () => dispatch(universityFetchData()),
mainCampus: () => dispatch(mainCampusFetchData())
universities: () => dispatch(universitiesFetchData()),
mainCampuses: () => dispatch(mainCampusesFetchData())
},
saveMainMap: (pos) => dispatch(saveMainMapPosition(pos)),
};
......
import { combineReducers } from 'redux';
import {
universityReducers,
mainCampusReducers,
countryReducers,
countryElReducers,
universityElReducers
universitiesReducers,
mainCampusesReducers,
countriesReducers,
countriesElReducers,
universitiesElReducers
} from '../generated/combinedReducers';
import {
......@@ -17,11 +17,11 @@ const appReducers = combineReducers({
})
const rootReducer = combineReducers({
countries: countryReducers,
countryEl: countryElReducers,
universities: universityReducers,
universityEl: universityElReducers,
mainCampus: mainCampusReducers,
countries: countriesReducers,
countriesEl: countriesElReducers,
universities: universitiesReducers,
universitiesEl: universitiesElReducers,
mainCampuses: mainCampusesReducers,
app: appReducers
})
......
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