Skip to content
Snippets Groups Projects
Commit 2505d94a authored by Tom Robinson's avatar Tom Robinson
Browse files

Make '?f=' optional on car/dash listing so that label filter works

parent 7fcd36f6
No related branches found
No related tags found
No related merge requests found
......@@ -48,7 +48,7 @@ export const setCardsFilter = createThunkAction(SET_CARDS_FILTER, function(filte
export const fetchCards = createThunkAction(FETCH_CARDS, function(filterMode, filterModelId) {
return async function(dispatch, getState) {
let cards = await CardApi.list({'filterMode' : filterMode, 'model_id' : filterModelId });
let cards = await CardApi.list({ f: filterMode, model_id: filterModelId });
for (var c of cards) {
c.created_at = moment(c.created_at);
c.updated_at = moment(c.updated_at);
......
......@@ -28,9 +28,7 @@ export default class AddToDashSelectDashModal extends Component {
};
async loadDashboardList() {
var dashboards = await this.props.dashboardApi.list({
'filterMode': 'all'
}).$promise;
var dashboards = await this.props.dashboardApi.list({ f: "all" }).$promise;
for (var dashboard of dashboards) {
dashboard.updated_at = moment(dashboard.updated_at);
}
......
......@@ -53,9 +53,7 @@ MetabaseControllers.controller('Nav', ['$scope', '$routeParams', '$location', '$
function refreshDashboards() {
if (AppState.model.currentUser) {
Dashboard.list({
'filterMode': 'all'
}, function (dashes) {
Dashboard.list({ f: "all" }, function (dashes) {
$scope.dashboards = dashes;
}, function (error) {
console.log('error getting dahsboards list', error);
......
......@@ -65,7 +65,7 @@ export const setDashCardAttributes = createAction(SET_DASHCARD_ATTRIBUTES);
export const fetchCards = createThunkAction(FETCH_CARDS, function(filterMode = "all") {
return async function(dispatch, getState) {
let cards = await CardApi.list({ filterMode });
let cards = await CardApi.list({ f: filterMode });
for (var c of cards) {
c.updated_at = moment(c.updated_at);
}
......
......@@ -84,7 +84,7 @@ export const testPulse = createThunkAction(TEST_PULSE, function(pulse) {
// NOTE: duplicated from dashboards/actions.js
export const fetchCards = createThunkAction(FETCH_CARDS, function(filterMode = "all") {
return async function(dispatch, getState) {
let cards = await Card.list({ filterMode });
let cards = await Card.list({ f: filterMode });
return normalize(cards, arrayOf(card));
};
});
......
......@@ -20,7 +20,7 @@ const Sidebar = ({ sections, topics, labels }) =>
*/}
<QuestionSidebarSectionTitle name="Labels" href="/questions/edit/labels" />
{labels.map(label =>
<QuestionSidebarItem key={label.id} href={"/questions/labels/"+label.slug} {...label} />
<QuestionSidebarItem key={label.id} href={"/questions/label/"+label.slug} {...label} />
)}
<li className={S.divider} />
<QuestionSidebarItem name="Archive" href="/questions/archived" icon="star" />
......
......@@ -26,22 +26,25 @@ export const selectSection = createThunkAction(SELECT_SECTION, (section = "all",
let response;
switch (section) {
case "all":
response = await CardApi.list({ filterMode: "all" });
response = await CardApi.list({ f: "all" });
break;
case "favorites":
response = await CardApi.list({ filterMode: "fav" });
response = await CardApi.list({ f: "fav" });
break;
case "saved":
response = await CardApi.list({ filterMode: "mine" });
response = await CardApi.list({ f: "mine" });
break;
case "popular":
response = await CardApi.list({ filterMode: "popular" });
response = await CardApi.list({ f: "popular" });
break;
case "recent":
response = await CardApi.list({ filterMode: "recent" });
response = await CardApi.list({ f: "recent" });
break;
case "archived":
response = await CardApi.list({ filterMode: "archived" });
response = await CardApi.list({ f: "archived" });
break;
case "label":
response = await CardApi.list({ label: slug });
break;
default:
console.warn("unknown section " + section);
......
......@@ -279,7 +279,7 @@ CoreServices.factory('Activity', ['$resource', '$cookies', function($resource, $
CoreServices.factory('Card', ['$resource', '$cookies', function($resource, $cookies) {
return $resource('/api/card/:cardId', {}, {
list: {
url: '/api/card/?f=:filterMode',
url: '/api/card',
method: 'GET',
isArray: true
},
......@@ -340,7 +340,7 @@ CoreServices.factory('Card', ['$resource', '$cookies', function($resource, $cook
CoreServices.factory('Dashboard', ['$resource', '$cookies', function($resource, $cookies) {
return $resource('/api/dashboard/:dashId', {}, {
list: {
url:'/api/dashboard?f=:filterMode',
url:'/api/dashboard',
method:'GET',
isArray:true
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment