Skip to content

Commit

Permalink
fix: include application context in Tree
Browse files Browse the repository at this point in the history
  • Loading branch information
soofstad committed Jun 13, 2024
1 parent 3ba750e commit 266ff1b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/dm-core/src/ApplicationContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ export const DMApplicationProvider = (props: {

const dmssAPIOriginal = new DmssAPI(token, props.dmssBasePath)
const dmssAPI = new DmssAPI(token, props.dmssBasePath)
const tree: Tree = new Tree(dmssAPI, (t: Tree) => setTreeNodes([...t]))
const tree: Tree = new Tree(
dmssAPI,
(t: Tree) => setTreeNodes([...t]),
props.application.name
)

// @ts-ignore
dmssAPI.blueprintGet = async (requestParameters, options) => {
Expand Down
9 changes: 8 additions & 1 deletion packages/dm-core/src/domain/Tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export class TreeNode {
const parentBlueprint: TBlueprint = await this.tree.dmssApi
.blueprintGet({
typeRef: this.type,
context: this.tree.context,
})
.then((response: any) => response.data.blueprint)
this.tree.dmssApi
Expand Down Expand Up @@ -273,10 +274,16 @@ export class Tree {
index: TTreeMap = {}
dmssApi: DmssAPI
updateCallback: (t: Tree) => void
context: string | undefined

constructor(dmssAPI: DmssAPI, updateCallback: (t: Tree) => void) {
constructor(
dmssAPI: DmssAPI,
updateCallback: (t: Tree) => void,
context?: string
) {
this.dmssApi = dmssAPI
this.updateCallback = updateCallback
this.context = context
}

async init(path?: string[]) {
Expand Down

0 comments on commit 266ff1b

Please sign in to comment.