diff --git a/src/plugins/notebook/actions/ExportNotebookAsTextAction.js b/src/plugins/notebook/actions/ExportNotebookAsTextAction.js
index 42088cce43..93d4b583c7 100644
--- a/src/plugins/notebook/actions/ExportNotebookAsTextAction.js
+++ b/src/plugins/notebook/actions/ExportNotebookAsTextAction.js
@@ -105,14 +105,16 @@ export default class ExportNotebookAsTextAction {
if (changes.exportMetaData) {
const createdTimestamp = entry.createdOn;
const createdBy = this.getUserName(entry.createdBy);
+ const createdByRole = entry.createdByRole;
const modifiedBy = this.getUserName(entry.modifiedBy);
+ const modifiedByRole = entry.modifiedByRole;
const modifiedTimestamp = entry.modified ?? entry.created;
notebookAsText += `Created on ${this.formatTimeStamp(
createdTimestamp
- )} by user ${createdBy}\n\n`;
+ )} by user ${createdBy}${createdByRole ? `: ${createdByRole}` : ''}\n\n`;
notebookAsText += `Updated on ${this.formatTimeStamp(
modifiedTimestamp
- )} by user ${modifiedBy}\n\n`;
+ )} by user ${modifiedBy}${modifiedByRole ? `: ${modifiedByRole}` : ''}\n\n`;
}
if (changes.exportTags) {
diff --git a/src/plugins/notebook/components/NotebookEntry.vue b/src/plugins/notebook/components/NotebookEntry.vue
index a302bb85f7..e1d088826d 100644
--- a/src/plugins/notebook/components/NotebookEntry.vue
+++ b/src/plugins/notebook/components/NotebookEntry.vue
@@ -37,7 +37,10 @@
{{ createdOnDate }}
{{ createdOnTime }}
- {{ entry.createdBy }}
+
+ {{
+ entry.createdByRole ? `${entry.createdBy}: ${entry.createdByRole}` : entry.createdBy
+ }}
@@ -433,10 +436,17 @@ export default {
this.timestampAndUpdate();
},
async timestampAndUpdate() {
- const user = await this.openmct.user.getCurrentUser();
-
+ const [user, activeRole] = await Promise.all([
+ this.openmct.user.getCurrentUser(),
+ this.openmct.user.getActiveRole?.()
+ ]);
if (user === undefined) {
this.entry.modifiedBy = UNKNOWN_USER;
+ } else {
+ this.entry.modifiedBy = user.getName();
+ if (activeRole) {
+ this.entry.modifiedByRole = activeRole;
+ }
}
this.entry.modified = Date.now();
diff --git a/src/plugins/notebook/utils/notebook-entries.js b/src/plugins/notebook/utils/notebook-entries.js
index 8c7b388c2d..9dbf4a71d4 100644
--- a/src/plugins/notebook/utils/notebook-entries.js
+++ b/src/plugins/notebook/utils/notebook-entries.js
@@ -12,6 +12,15 @@ async function getUsername(openmct) {
return username;
}
+async function getActiveRole(openmct) {
+ let role = null;
+ if (openmct.user.hasProvider()) {
+ role = await openmct.user.getActiveRole?.();
+ }
+
+ return role;
+}
+
export const DEFAULT_CLASS = 'notebook-default';
const TIME_BOUNDS = {
START_BOUND: 'tc.startBound',
@@ -156,11 +165,15 @@ export async function addNotebookEntry(
const embeds = embed ? [embed] : [];
const id = `entry-${uuid()}`;
- const createdBy = await getUsername(openmct);
+ const [createdBy, createdByRole] = await Promise.all([
+ getUsername(openmct),
+ getActiveRole(openmct)
+ ]);
const entry = {
id,
createdOn: date,
createdBy,
+ createdByRole,
text: entryText,
embeds
};