Skip to content

Commit

Permalink
Merge pull request #92 from openmsupply/#84-Hide-development-folder's…
Browse files Browse the repository at this point in the history
…-panel

#84 Hide development folder's panel from New and edit schedule pages
  • Loading branch information
sworup authored Aug 29, 2022
2 parents 5502397 + e5a378a commit b0a8b0c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/api/getPanels.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,19 @@ export const getPanels = async (datasourceID: number): Promise<Panel[]> => {

export const getDashboards = async () => {
const dashboardMeta = await searchForDashboards();
const dashboardResponses = await Promise.all<DashboardResponse>(dashboardMeta.map(({ uid }) => getDashboard(uid)));
const newDashboardMeta = dashboardMeta.filter(({ folderTitle, type }) =>
type !== 'dash-folder' && !!folderTitle ? folderTitle.toLowerCase() !== 'develop' : true
);
const dashboardResponses = await Promise.all<DashboardResponse>(newDashboardMeta.map(({ uid }) => getDashboard(uid)));
return dashboardResponses.map(({ dashboard }) => dashboard);
};

export const getDashboard = async (uuid: string): Promise<DashboardResponse> => {
return getBackendSrv().get(`./api/dashboards/uid/${uuid}`);
return await getBackendSrv().get(`./api/dashboards/uid/${uuid}`);
};

export const searchForDashboards = async (): Promise<DashboardMeta[]> => {
return getBackendSrv().get('./api/search');
return await getBackendSrv().get('./api/search');
};

export const refreshPanelOptions = async (
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ export type DashboardResponse = {

export type DashboardMeta = {
uid: string;
folderTitle: string;
type: string;
};

/**
Expand Down

0 comments on commit b0a8b0c

Please # to comment.