Skip to content

Commit

Permalink
Labotel: Do not persist filter category
Browse files Browse the repository at this point in the history
  • Loading branch information
ThiefMaster committed Jan 21, 2025
1 parent 6e2eb18 commit 943897e
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 63 deletions.
3 changes: 1 addition & 2 deletions labotel/indico_labotel/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@

from indico.core.plugins import IndicoPluginBlueprint

from indico_labotel.controllers import RHDivisions, RHLabotelStats, RHLabotelStatsCSV, RHUserDivision
from indico_labotel.controllers import RHDivisions, RHLabotelStats, RHLabotelStatsCSV


blueprint = IndicoPluginBlueprint('labotel', __name__, url_prefix='/rooms')

blueprint.add_url_rule('/api/divisions', 'divisions', RHDivisions)
blueprint.add_url_rule('/api/user/division', 'user_division', RHUserDivision, methods=('GET', 'POST'))
blueprint.add_url_rule('/api/labotel-stats', 'stats', RHLabotelStats)
blueprint.add_url_rule('/labotel-stats.csv', 'stats_csv', RHLabotelStatsCSV)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// the LICENSE file for more details.

import divisionsURL from 'indico-url:plugin_labotel.divisions';
import defaultDivisionURL from 'indico-url:plugin_labotel.user_division';

import PropTypes from 'prop-types';
import React from 'react';
Expand All @@ -16,19 +15,13 @@ import {Form, Button, Checkbox} from 'semantic-ui-react';
import {selectors as userSelectors} from 'indico/modules/rb/common/user';
import {useIndicoAxios} from 'indico/react/hooks';
import {Translate} from 'indico/react/i18n';
import {indicoAxios, handleAxiosError} from 'indico/utils/axios';

export default function BootstrapOptions({options: {division}, setOptions}) {
const userHasFavorites = useSelector(userSelectors.hasFavoriteRooms);
const {data: divisions} = useIndicoAxios(divisionsURL());

const handleDivisionClick = async newDivision => {
setOptions({division: newDivision});
try {
await indicoAxios.post(defaultDivisionURL(), {value: newDivision});
} catch (error) {
handleAxiosError(error);
}
};

return (
Expand Down
35 changes: 0 additions & 35 deletions labotel/indico_labotel/client/js/components/LabotelLanding.jsx

This file was deleted.

2 changes: 0 additions & 2 deletions labotel/indico_labotel/client/js/overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@

import BootstrapOptions from './components/BootstrapOptions';
import ExtraFilters from './components/ExtraFilters';
import LabotelLanding from './components/LabotelLanding';

export default {
'Landing': LabotelLanding,
'Landing.bootstrapOptions': BootstrapOptions,
'RoomFilterBar.extraFilters': ExtraFilters,
};
13 changes: 0 additions & 13 deletions labotel/indico_labotel/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,6 @@ def _process(self):
return jsonify(sorted(div for div, in db.session.query(Room.division.distinct()) if div))


class RHUserDivision(RHProtected):
def _process_GET(self):
from indico_labotel.plugin import LabotelPlugin
return jsonify(value=LabotelPlugin.user_settings.get(session.user, 'default_division'))

@use_kwargs({
'value': fields.String(allow_none=True)
})
def _process_POST(self, value):
from indico_labotel.plugin import LabotelPlugin
LabotelPlugin.user_settings.set(session.user, 'default_division', value)


class RHLabotelStats(RHProtected):
@use_kwargs({
'start_month': fields.DateTime('%Y-%m'),
Expand Down
4 changes: 0 additions & 4 deletions labotel/indico_labotel/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ class LabotelPlugin(IndicoPlugin):
Provides labotel-specific functionality
"""

default_user_settings = {
'default_division': None,
}

def init(self):
super().init()
current_app.before_request(self._before_request)
Expand Down

0 comments on commit 943897e

Please sign in to comment.