mirror of
https://github.com/grafana/grafana.git
synced 2025-02-10 15:45:43 -06:00
I18n: Translate Dashboard Starred notification (#59138)
This commit is contained in:
parent
7d82a27835
commit
f180bb46f8
@ -1,7 +1,9 @@
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
|
||||
import { AppEvents } from '@grafana/data';
|
||||
import { BackendSrvRequest } from '@grafana/runtime';
|
||||
import { appEvents } from 'app/core/app_events';
|
||||
import { t } from 'app/core/internationalization';
|
||||
import { getBackendSrv } from 'app/core/services/backend_srv';
|
||||
import { saveDashboard } from 'app/features/manage-dashboards/state/actions';
|
||||
import { DashboardMeta } from 'app/types';
|
||||
@ -92,23 +94,27 @@ export class DashboardSrv {
|
||||
|
||||
starDashboard(dashboardId: string, isStarred: boolean) {
|
||||
const backendSrv = getBackendSrv();
|
||||
let promise;
|
||||
|
||||
if (isStarred) {
|
||||
promise = backendSrv.delete('/api/user/stars/dashboard/' + dashboardId).then(() => {
|
||||
return false;
|
||||
});
|
||||
} else {
|
||||
promise = backendSrv.post('/api/user/stars/dashboard/' + dashboardId).then(() => {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
const request = {
|
||||
showSuccessAlert: false,
|
||||
url: '/api/user/stars/dashboard/' + dashboardId,
|
||||
method: isStarred ? 'DELETE' : 'POST',
|
||||
};
|
||||
|
||||
return promise.then((res: boolean) => {
|
||||
if (this.dashboard && this.dashboard.id === dashboardId) {
|
||||
this.dashboard.meta.isStarred = res;
|
||||
return backendSrv.request(request).then(() => {
|
||||
const newIsStarred = !isStarred;
|
||||
|
||||
if (this.dashboard?.id === dashboardId) {
|
||||
this.dashboard.meta.isStarred = newIsStarred;
|
||||
}
|
||||
return res;
|
||||
|
||||
const message = newIsStarred
|
||||
? t('notifications.starred-dashboard', 'Dashboard starred')
|
||||
: t('notifications.unstarred-dashboard', 'Dashboard unstarred');
|
||||
|
||||
appEvents.emit(AppEvents.alertSuccess, [message]);
|
||||
|
||||
return newIsStarred;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -318,6 +318,10 @@
|
||||
"news": {
|
||||
"title": "Das Neueste aus dem Blog"
|
||||
},
|
||||
"notifications": {
|
||||
"starred-dashboard": "",
|
||||
"unstarred-dashboard": ""
|
||||
},
|
||||
"panel": {
|
||||
"header-menu": {
|
||||
"hide-legend": "",
|
||||
|
@ -318,6 +318,10 @@
|
||||
"news": {
|
||||
"title": "Latest from the blog"
|
||||
},
|
||||
"notifications": {
|
||||
"starred-dashboard": "Dashboard starred",
|
||||
"unstarred-dashboard": "Dashboard unstarred"
|
||||
},
|
||||
"panel": {
|
||||
"header-menu": {
|
||||
"hide-legend": "Hide legend",
|
||||
|
@ -318,6 +318,10 @@
|
||||
"news": {
|
||||
"title": "Últimas entradas del blog"
|
||||
},
|
||||
"notifications": {
|
||||
"starred-dashboard": "",
|
||||
"unstarred-dashboard": ""
|
||||
},
|
||||
"panel": {
|
||||
"header-menu": {
|
||||
"hide-legend": "",
|
||||
|
@ -318,6 +318,10 @@
|
||||
"news": {
|
||||
"title": "Dernières nouvelles sur le blog"
|
||||
},
|
||||
"notifications": {
|
||||
"starred-dashboard": "",
|
||||
"unstarred-dashboard": ""
|
||||
},
|
||||
"panel": {
|
||||
"header-menu": {
|
||||
"hide-legend": "",
|
||||
|
@ -318,6 +318,10 @@
|
||||
"news": {
|
||||
"title": "Ŀäŧęşŧ ƒřőm ŧĥę þľőģ"
|
||||
},
|
||||
"notifications": {
|
||||
"starred-dashboard": "Đäşĥþőäřđ şŧäřřęđ",
|
||||
"unstarred-dashboard": "Đäşĥþőäřđ ūʼnşŧäřřęđ"
|
||||
},
|
||||
"panel": {
|
||||
"header-menu": {
|
||||
"hide-legend": "Ħįđę ľęģęʼnđ",
|
||||
|
@ -318,6 +318,10 @@
|
||||
"news": {
|
||||
"title": "最新博客"
|
||||
},
|
||||
"notifications": {
|
||||
"starred-dashboard": "",
|
||||
"unstarred-dashboard": ""
|
||||
},
|
||||
"panel": {
|
||||
"header-menu": {
|
||||
"hide-legend": "",
|
||||
|
Loading…
Reference in New Issue
Block a user