Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn users when project linked packages cannot satisfy the .zap file import/open #1322

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src-electron/db/query-impexp.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ const dbApi = require('./db-api')
const dbEnums = require('../../src-shared/db-enum')
const dbMapping = require('./db-mapping.js')
const queryUpgrade = require('../sdk/matter.js')
const sessionNotification = require('./query-session-notification')

/**
* Imports a single endpoint
* @param {} db
Expand Down Expand Up @@ -234,13 +236,15 @@ ORDER BY
* @param {*} sessionPartitionId
* @param {*} packageId
* @param {*} endpointType
* @param {*} sessionId
* @returns Promise of endpoint insertion.
*/
async function importEndpointType(
db,
sessionPartitionId,
packageIds,
endpointType
endpointType,
sessionId
) {
// Insert endpoint type
let endpointTypeId = await dbApi.dbInsert(
Expand Down Expand Up @@ -306,6 +310,18 @@ async function importEndpointType(
]
)

// Log an error message into the session notice table when device types being imported are not found
if (!rows || rows.length == 0) {
sessionNotification.setNotification(
db,
'ERROR',
'Device Types could not be found in the ZCL extensions linked to this project. Please make sure the zcl and template json files listed in your zap file exist.',
sessionId,
1,
1
)
}

// Associate deviceTypes with the endpointType
for (let row of rows) {
promises.push(
Expand Down
3 changes: 2 additions & 1 deletion src-electron/importexport/import-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,8 @@ async function importEndpointTypes(
db,
sessionPartitionInfo[0].sessionPartitionId,
allZclPackageIds,
endpointTypes[i]
endpointTypes[i],
sessionId
)
let endpointId = ''
if (sortedEndpoints[i]) {
Expand Down
Loading