Skip to content

Commit

Permalink
feat: allow sharing embedded dashboards
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikThePendric committed Feb 25, 2025
1 parent d68c85c commit b2fb2f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions components/sharing-dialog/src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export const DIALOG_TYPES = {
CATEGORY_OPTION_GROUP_SET: 'categoryOptionGroupSet',
CONSTANT: 'constant',
DASHBOARD: 'dashboard',
// This is an artifial type, should not be passed to the web api
DASHBOARD_EMBEDDED: 'DASHBOARD_EMBEDDED',
DATA_APPROVAL_LEVEL: 'dataApprovalLevel',
DATA_APPROVAL_WORKFLOW: 'dataApprovalWorkflow',
DATA_ELEMENT: 'dataElement',
Expand Down
8 changes: 6 additions & 2 deletions components/sharing-dialog/src/sharing-dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
ACCESS_VIEW_ONLY,
ACCESS_VIEW_AND_EDIT,
DIALOG_TYPES_LIST,
DIALOG_TYPES,
} from './constants.js'
import { FetchingContext } from './fetching-context/index.js'
import {
Expand All @@ -18,11 +19,14 @@ import {
import { Modal } from './modal/index.js'
import { TabbedContent } from './tabs/index.js'

const parseDialogType = (type) =>
type === DIALOG_TYPES.DASHBOARD_EMBEDDED ? DIALOG_TYPES.DASHBOARD : type

const query = {
sharing: {
resource: 'sharing',
params: ({ type, id }) => ({
type,
type: parseDialogType(type),
id,
}),
},
Expand All @@ -31,7 +35,7 @@ const query = {
const mutation = {
resource: 'sharing',
params: ({ type, id }) => ({
type,
type: parseDialogType(type),
id,
}),
type: 'update',
Expand Down

0 comments on commit b2fb2f0

Please sign in to comment.