Skip to content

Commit

Permalink
Outsourcing smNotFound
Browse files Browse the repository at this point in the history
  • Loading branch information
seicke committed Oct 30, 2024
1 parent 0d55468 commit c6d51be
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 76 deletions.
48 changes: 10 additions & 38 deletions aas-web-ui/src/components/AASTreeview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -251,47 +251,19 @@
}
return submodel;
} else {
let submodel = {
id: submodelId,
idShort: 'Submodel not found',
modelType: 'Submodel',
semanticId: null,
description: [],
displayName: [],
submodelElements: [],
isActive: false,
path: path,
};
this.navigationStore.dispatchSnackbar({
status: true,
timeout: 60000,
color: 'error',
btnColor: 'buttonText',
text: "Submodel '" + submodelId + "' not found in SubmodelRepository",
});
return submodel;
return this.smNotFound(
submodelId,
path,
"Submodel '" + submodelId + "' not found in SubmodelRepository"
);
}
});
} else {
let submodel = {
id: submodelId,
idShort: 'Submodel not found',
modelType: 'Submodel',
semanticId: null,
description: [],
displayName: [],
submodelElements: [],
isActive: false,
path: path,
};
this.navigationStore.dispatchSnackbar({
status: true,
timeout: 60000,
color: 'error',
btnColor: 'buttonText',
text: "Submodel '" + submodelId + "' not found in SubmodelRegistry",
});
return submodel;
return this.smNotFound(
submodelId,
path,
"Submodel '" + submodelId + "' not found in SubmodelRegistry"
);
}
}
});
Expand Down
48 changes: 10 additions & 38 deletions aas-web-ui/src/components/SubmodelList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -259,47 +259,19 @@
submodel.path = path;
return submodel;
} else {
let submodel = {
id: submodelId,
idShort: 'Submodel not found',
modelType: 'Submodel',
semanticId: null,
description: [],
displayName: [],
submodelElements: [],
isActive: false,
path: path,
};
this.navigationStore.dispatchSnackbar({
status: true,
timeout: 60000,
color: 'error',
btnColor: 'buttonText',
text: "Submodel '" + submodelId + "' not found in SubmodelRepository",
});
return submodel;
return this.smNotFound(
submodelId,
path,
"Submodel '" + submodelId + "' not found in SubmodelRepository"
);
}
});
} else {
let submodel = {
id: submodelId,
idShort: 'Submodel not found',
modelType: 'Submodel',
semanticId: null,
description: [],
displayName: [],
submodelElements: [],
isActive: false,
path: path,
};
this.navigationStore.dispatchSnackbar({
status: true,
timeout: 60000,
color: 'error',
btnColor: 'buttonText',
text: "Submodel '" + submodelId + "' not found in SubmodelRegistry",
});
return submodel;
return this.smNotFound(
submodelId,
path,
"Submodel '" + submodelId + "' not found in SubmodelRegistry"
);
}
}
});
Expand Down
24 changes: 24 additions & 0 deletions aas-web-ui/src/mixins/SubmodelElementHandling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -646,5 +646,29 @@ export default defineComponent({
});
return endpoint?.protocolInformation?.href ? endpoint.protocolInformation.href : '';
},

smNotFound(submodelId: string, path: string, text: string) {
if (text.trim().length > 0) {
this.navigationStore.dispatchSnackbar({
status: true,
timeout: 60000,
color: 'error',
btnColor: 'buttonText',
text: text,
});
}
const submodel = {
id: submodelId,
idShort: 'Submodel not found',
modelType: 'Submodel',
semanticId: null,
description: [],
displayName: [],
submodelElements: [],
isActive: false,
path: path,
};
return submodel;
},
},
});

0 comments on commit c6d51be

Please sign in to comment.