(id, schema)
| 56 | |
| 57 | // for pre-existing mappings, generate display label from schema id |
| 58 | getLabelFromId(id, schema) { |
| 59 | const schemaName = schema?.name; |
| 60 | if (!schemaName) { |
| 61 | return; |
| 62 | } |
| 63 | |
| 64 | const re = new RegExp(`^${schemaName}(?<index>([0-9]*))$`); |
| 65 | const match = id.match(re)?.groups; |
| 66 | if (!match) { |
| 67 | return; |
| 68 | } |
| 69 | |
| 70 | const label = `${schema.label} ${match.index}`.trim(); |
| 71 | if (label !== id) { |
| 72 | return label; |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | changeId(oldId, newId) { |
| 77 | const mapping = this.getMapping(oldId); |