Skip to content

Commit

Permalink
working code needs cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
paulr34 committed Sep 11, 2024
1 parent 90091a6 commit a294972
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
1 change: 0 additions & 1 deletion src-electron/db/query-endpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ ORDER BY E1.ENDPOINT_IDENTIFIER
* @returns {Promise<Array>} - A promise that resolves to an array of rows containing DEVICE_TYPE_REF.
*/
async function getRootNode(db, packageIds) {
console.log(packageIds)
const query = `
SELECT DEVICE_TYPE_REF
FROM ENDPOINT_COMPOSITION
Expand Down
2 changes: 1 addition & 1 deletion src-electron/rest/endpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ function httpGetRootNode(db) {
)
let packageIds = packages.map((item) => item.pkg.id)
let rootNode = await queryEndpoint.getRootNode(db, packageIds)
response.status(StatusCodes.OK).json({ rootNode: rootNode })
response.status(StatusCodes.OK).json(rootNode)
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { defineComponent } from 'vue'
import { QSpinnerGears } from 'quasar'
import ZclTour from './tutorials/ZclTour.vue'
import CommonMixin from './util/common-mixin'
import uiOptions from '../util/ui-options'
const rendApi = require(`../src-shared/rend-api.js`)
const restApi = require(`../src-shared/rest-api.js`)
Expand Down Expand Up @@ -136,7 +137,7 @@ export default defineComponent({
components: {
ZclTour
},
mixins: [CommonMixin],
mixins: [CommonMixin, uiOptions],
computed: {
showExceptionIcon() {
return this.$store.state.zap.showExceptionIcon
Expand Down
17 changes: 14 additions & 3 deletions src/store/zap/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,12 +328,23 @@ export function loadComposition(context) {
axiosRequests
.$serverGet(restApi.uri.rootNode)
.then((res) => {
const dataArray = { deviceTypeRef: res.data }
console.log(dataArray)
console.log(res.data)
const dataArray = {
deviceTypeRef: res.data,
deviceIdentifier: 1,
deviceVersion: 1,
name: 'rootNode'
}
return addEndpointType(context, dataArray) // Call addEndpointType with the array containing deviceTypeRef
})
.then((endpointTypeData) => {
return addEndpoint(context, endpointTypeData) // Call addEndpoint with the data returned from addEndpointType
return addEndpoint(context, {
endpointId: 0,
networkId: 0,
profileId: null,
parentEndpointIdentifier: null,
endpointType: endpointTypeData.id
}) // Call addEndpoint with the data returned from addEndpointType
})
.catch((error) => {
console.error('Error loading composition:', error)
Expand Down

0 comments on commit a294972

Please sign in to comment.