2019-09-04 21:01:54 +05:30
|
|
|
import invalidUrl from '~/lib/utils/invalid_url';
|
2020-10-24 23:57:45 +05:30
|
|
|
import { defaultTimeRange } from '~/vue_shared/constants';
|
2021-03-11 19:13:27 +05:30
|
|
|
import { dashboardEmptyStates } from '../constants';
|
|
|
|
import { timezones } from '../format_date';
|
2019-09-04 21:01:54 +05:30
|
|
|
|
|
|
|
export default () => ({
|
2020-03-13 15:44:24 +05:30
|
|
|
// API endpoints
|
2019-09-04 21:01:54 +05:30
|
|
|
deploymentsEndpoint: null,
|
|
|
|
dashboardEndpoint: invalidUrl,
|
2020-06-23 00:09:42 +05:30
|
|
|
dashboardsEndpoint: invalidUrl,
|
2020-10-24 23:57:45 +05:30
|
|
|
panelPreviewEndpoint: invalidUrl,
|
2020-03-13 15:44:24 +05:30
|
|
|
|
|
|
|
// Dashboard request parameters
|
|
|
|
timeRange: null,
|
2020-07-28 23:09:34 +05:30
|
|
|
/**
|
|
|
|
* Currently selected dashboard. For custom dashboards,
|
|
|
|
* this could be the filename or the file path.
|
|
|
|
*
|
|
|
|
* If this is the filename and full path is required,
|
|
|
|
* getters.fullDashboardPath should be used.
|
|
|
|
*/
|
2020-03-13 15:44:24 +05:30
|
|
|
currentDashboard: null,
|
|
|
|
|
|
|
|
// Dashboard data
|
2020-07-28 23:09:34 +05:30
|
|
|
hasDashboardValidationWarnings: false,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* {?String} If set, dashboard should display a global
|
|
|
|
* empty state, there is no way to interact (yet)
|
|
|
|
* with the dashboard.
|
|
|
|
*/
|
|
|
|
emptyState: dashboardEmptyStates.GETTING_STARTED,
|
2019-10-12 21:52:04 +05:30
|
|
|
showErrorBanner: true,
|
2020-05-24 23:13:21 +05:30
|
|
|
isUpdatingStarredValue: false,
|
2019-12-26 22:10:19 +05:30
|
|
|
dashboard: {
|
2020-04-08 14:13:33 +05:30
|
|
|
panelGroups: [],
|
2019-12-26 22:10:19 +05:30
|
|
|
},
|
2020-05-24 23:13:21 +05:30
|
|
|
/**
|
|
|
|
* Panel that is currently "zoomed" in as
|
|
|
|
* a single panel in view.
|
|
|
|
*/
|
|
|
|
expandedPanel: {
|
|
|
|
/**
|
|
|
|
* {?String} Panel's group name.
|
|
|
|
*/
|
|
|
|
group: null,
|
|
|
|
/**
|
|
|
|
* {?Object} Panel content from `dashboard`
|
|
|
|
* null when no panel is expanded.
|
|
|
|
*/
|
|
|
|
panel: null,
|
|
|
|
},
|
2020-03-13 15:44:24 +05:30
|
|
|
allDashboards: [],
|
2020-06-23 00:09:42 +05:30
|
|
|
/**
|
|
|
|
* User-defined custom variables are passed
|
|
|
|
* via the dashboard yml file.
|
|
|
|
*/
|
2020-07-28 23:09:34 +05:30
|
|
|
variables: [],
|
2020-06-23 00:09:42 +05:30
|
|
|
/**
|
|
|
|
* User-defined custom links are passed
|
|
|
|
* via the dashboard yml file.
|
|
|
|
*/
|
|
|
|
links: [],
|
2020-10-24 23:57:45 +05:30
|
|
|
|
|
|
|
// Panel editor / builder
|
|
|
|
panelPreviewYml: '',
|
|
|
|
panelPreviewIsLoading: false,
|
|
|
|
panelPreviewGraphData: null,
|
|
|
|
panelPreviewError: null,
|
|
|
|
panelPreviewTimeRange: defaultTimeRange,
|
|
|
|
panelPreviewIsShown: false,
|
|
|
|
|
2020-03-13 15:44:24 +05:30
|
|
|
// Other project data
|
2020-06-23 00:09:42 +05:30
|
|
|
dashboardTimezone: timezones.LOCAL,
|
2020-04-22 19:07:51 +05:30
|
|
|
annotations: [],
|
2019-09-04 21:01:54 +05:30
|
|
|
deploymentData: [],
|
|
|
|
environments: [],
|
2020-03-13 15:44:24 +05:30
|
|
|
environmentsSearchTerm: '',
|
|
|
|
environmentsLoading: false,
|
2020-06-23 00:09:42 +05:30
|
|
|
currentEnvironmentName: null,
|
2020-03-13 15:44:24 +05:30
|
|
|
|
|
|
|
// GitLab paths to other pages
|
2020-10-24 23:57:45 +05:30
|
|
|
externalDashboardUrl: '',
|
2019-09-30 21:07:59 +05:30
|
|
|
projectPath: null,
|
2020-07-28 23:09:34 +05:30
|
|
|
operationsSettingsPath: '',
|
2020-10-24 23:57:45 +05:30
|
|
|
addDashboardDocumentationPath: '',
|
2020-07-28 23:09:34 +05:30
|
|
|
|
|
|
|
// static paths
|
|
|
|
customDashboardBasePath: '',
|
|
|
|
|
|
|
|
// current user data
|
|
|
|
/**
|
|
|
|
* Flag that denotes if the currently logged user can access
|
|
|
|
* the project Settings -> Operations
|
|
|
|
*/
|
|
|
|
canAccessOperationsSettings: false,
|
2019-09-04 21:01:54 +05:30
|
|
|
});
|