Commit dbaf213f by Marcus Andersson Committed by GitHub

Variables: added __user.email to global variable (#28853)

* added email to global variable.

* forgot to increase the count.
parent deb88893
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
}, },
"id": 11, "id": 11,
"options": { "options": {
"content": "## Global variables\n\n* `__dashboard` = `${__dashboard}`\n* `__dashboard.name` = `${__dashboard.name}`\n* `__dashboard.uid` = `${__dashboard.uid}`\n* `__org.name` = `${__org.name}`\n* `__org.id` = `${__org.id}`\n* `__user.id` = `${__user.id}`\n* `__user.login` = `${__user.login}`\n \n## Formats\n\n* `Server:raw` = `${Server:raw}`\n* `Server:regex` = `${Server:regex}`\n* `Server:lucene` = `${Server:lucene}`\n* `Server:glob` = `${Server:glob}`\n* `Server:pipe` = `${Server:pipe}`\n* `Server:distributed` = `${Server:distributed}`\n* `Server:csv` = `${Server:csv}`\n* `Server:html` = `${Server:html}`\n* `Server:json` = `${Server:json}`\n* `Server:percentencode` = `${Server:percentencode}`\n* `Server:singlequote` = `${Server:singlequote}`\n* `Server:doublequote` = `${Server:doublequote}`\n* `Server:sqlstring` = `${Server:sqlstring}`\n* `Server:date` = `${Server:date}`\n* `Server:text` = `${Server:text}`\n\n", "content": "## Global variables\n\n* `__dashboard` = `${__dashboard}`\n* `__dashboard.name` = `${__dashboard.name}`\n* `__dashboard.uid` = `${__dashboard.uid}`\n* `__org.name` = `${__org.name}`\n* `__org.id` = `${__org.id}`\n* `__user.id` = `${__user.id}`\n* `__user.login` = `${__user.login}`\n* `__user.email` = `${__user.email}`\n \n## Formats\n\n* `Server:raw` = `${Server:raw}`\n* `Server:regex` = `${Server:regex}`\n* `Server:lucene` = `${Server:lucene}`\n* `Server:glob` = `${Server:glob}`\n* `Server:pipe` = `${Server:pipe}`\n* `Server:distributed` = `${Server:distributed}`\n* `Server:csv` = `${Server:csv}`\n* `Server:html` = `${Server:html}`\n* `Server:json` = `${Server:json}`\n* `Server:percentencode` = `${Server:percentencode}`\n* `Server:singlequote` = `${Server:singlequote}`\n* `Server:doublequote` = `${Server:doublequote}`\n* `Server:sqlstring` = `${Server:sqlstring}`\n* `Server:date` = `${Server:date}`\n* `Server:text` = `${Server:text}`\n\n",
"mode": "markdown" "mode": "markdown"
}, },
"pluginVersion": "7.1.0", "pluginVersion": "7.1.0",
......
...@@ -70,6 +70,7 @@ This variable is the ID of the current organization. ...@@ -70,6 +70,7 @@ This variable is the ID of the current organization.
`${__user.id}` is the ID of the current user. `${__user.id}` is the ID of the current user.
`${__user.login}` is the login handle of the current user. `${__user.login}` is the login handle of the current user.
`${__user.email}` is the email for the current user.
## $__range ## $__range
......
...@@ -19,6 +19,7 @@ e2e.scenario({ ...@@ -19,6 +19,7 @@ e2e.scenario({
'__org.id = 1', '__org.id = 1',
'__user.id = 1', '__user.id = 1',
'__user.login = admin', '__user.login = admin',
'__user.email = admin@localhost',
`Server:raw = A'A"A,BB\\B,CCC`, `Server:raw = A'A"A,BB\\B,CCC`,
`Server:regex = (A'A"A|BB\\\\B|CCC)`, `Server:regex = (A'A"A|BB\\\\B|CCC)`,
`Server:lucene = ("A'A\\"A" OR "BB\\\\B" OR "CCC")`, `Server:lucene = ("A'A\\"A" OR "BB\\\\B" OR "CCC")`,
...@@ -38,7 +39,7 @@ e2e.scenario({ ...@@ -38,7 +39,7 @@ e2e.scenario({
e2e() e2e()
.get('.markdown-html li') .get('.markdown-html li')
.should('have.length', 22) .should('have.length', 23)
.each(element => { .each(element => {
items.push(element.text()); items.push(element.text());
}) })
......
...@@ -16,6 +16,7 @@ export class User { ...@@ -16,6 +16,7 @@ export class User {
helpFlags1: number; helpFlags1: number;
lightTheme: boolean; lightTheme: boolean;
hasEditPermissionInFolders: boolean; hasEditPermissionInFolders: boolean;
email?: string;
constructor() { constructor() {
if (config.bootData.user) { if (config.bootData.user) {
......
...@@ -161,6 +161,7 @@ export const addSystemTemplateVariables = (dashboard: DashboardModel): ThunkResu ...@@ -161,6 +161,7 @@ export const addSystemTemplateVariables = (dashboard: DashboardModel): ThunkResu
value: { value: {
login: contextSrv.user.login, login: contextSrv.user.login,
id: contextSrv.user.id, id: contextSrv.user.id,
email: contextSrv.user.email,
toString: () => contextSrv.user.id.toString(), toString: () => contextSrv.user.id.toString(),
}, },
}, },
......
...@@ -110,6 +110,7 @@ export interface OrgVariableModel extends SystemVariable<OrgProps> {} ...@@ -110,6 +110,7 @@ export interface OrgVariableModel extends SystemVariable<OrgProps> {}
export interface UserProps { export interface UserProps {
login: string; login: string;
id: number; id: number;
email?: string;
toString: () => string; toString: () => string;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment