2019-06-05 18:03:30 -04:00
|
|
|
import invalidUrl from '~/lib/utils/invalid_url';
|
2021-02-01 10:08:56 -05:00
|
|
|
import { defaultTimeRange } from '~/vue_shared/constants';
|
2020-07-09 08:08:56 -04:00
|
|
|
import { dashboardEmptyStates } from '../constants';
|
2021-02-14 13:09:20 -05:00
|
|
|
import { timezones } from '../format_date';
|
2019-06-05 18:03:30 -04:00
|
|
|
|
2019-05-27 18:30:36 -04:00
|
|
|
export default () => ({
|
2020-02-07 07:09:13 -05:00
|
|
|
// API endpoints
|
2019-05-27 18:30:36 -04:00
|
|
|
deploymentsEndpoint: null,
|
2019-06-05 18:03:30 -04:00
|
|
|
dashboardEndpoint: invalidUrl,
|
2020-05-22 14:08:21 -04:00
|
|
|
dashboardsEndpoint: invalidUrl,
|
2020-08-04 14:09:49 -04:00
|
|
|
panelPreviewEndpoint: invalidUrl,
|
2020-02-07 07:09:13 -05:00
|
|
|
|
|
|
|
// Dashboard request parameters
|
|
|
|
timeRange: null,
|
2020-06-17 20:08:35 -04:00
|
|
|
/**
|
|
|
|
* 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-02-07 07:09:13 -05:00
|
|
|
currentDashboard: null,
|
|
|
|
|
|
|
|
// Dashboard data
|
2020-06-17 14:09:08 -04:00
|
|
|
hasDashboardValidationWarnings: false,
|
2020-07-15 05:09:34 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* {?String} If set, dashboard should display a global
|
|
|
|
* empty state, there is no way to interact (yet)
|
|
|
|
* with the dashboard.
|
|
|
|
*/
|
2020-07-09 08:08:56 -04:00
|
|
|
emptyState: dashboardEmptyStates.GETTING_STARTED,
|
2019-07-22 08:01:42 -04:00
|
|
|
showErrorBanner: true,
|
2020-05-12 11:10:33 -04:00
|
|
|
isUpdatingStarredValue: false,
|
2019-11-04 04:06:21 -05:00
|
|
|
dashboard: {
|
2020-02-26 19:09:19 -05:00
|
|
|
panelGroups: [],
|
2019-11-04 04:06:21 -05:00
|
|
|
},
|
2020-04-29 11:09:58 -04:00
|
|
|
/**
|
|
|
|
* 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-02-07 07:09:13 -05:00
|
|
|
allDashboards: [],
|
2020-05-21 17:08:31 -04:00
|
|
|
/**
|
|
|
|
* User-defined custom variables are passed
|
2020-05-29 17:08:35 -04:00
|
|
|
* via the dashboard yml file.
|
2020-05-21 17:08:31 -04:00
|
|
|
*/
|
2020-07-03 05:08:53 -04:00
|
|
|
variables: [],
|
2020-05-29 17:08:35 -04:00
|
|
|
/**
|
|
|
|
* User-defined custom links are passed
|
|
|
|
* via the dashboard yml file.
|
|
|
|
*/
|
2020-06-09 14:08:28 -04:00
|
|
|
links: [],
|
2020-07-30 05:09:36 -04:00
|
|
|
|
|
|
|
// Panel editor / builder
|
|
|
|
panelPreviewYml: '',
|
|
|
|
panelPreviewIsLoading: false,
|
|
|
|
panelPreviewGraphData: null,
|
|
|
|
panelPreviewError: null,
|
2020-08-10 20:10:18 -04:00
|
|
|
panelPreviewTimeRange: defaultTimeRange,
|
|
|
|
panelPreviewIsShown: false,
|
2020-07-30 05:09:36 -04:00
|
|
|
|
2020-02-07 07:09:13 -05:00
|
|
|
// Other project data
|
2020-06-04 05:08:01 -04:00
|
|
|
dashboardTimezone: timezones.LOCAL,
|
2020-04-14 11:09:44 -04:00
|
|
|
annotations: [],
|
2019-05-27 18:30:36 -04:00
|
|
|
deploymentData: [],
|
|
|
|
environments: [],
|
2020-01-22 04:08:39 -05:00
|
|
|
environmentsSearchTerm: '',
|
2020-01-29 04:08:49 -05:00
|
|
|
environmentsLoading: false,
|
2020-05-22 14:08:21 -04:00
|
|
|
currentEnvironmentName: null,
|
2020-02-07 07:09:13 -05:00
|
|
|
|
|
|
|
// GitLab paths to other pages
|
2020-08-10 08:09:55 -04:00
|
|
|
externalDashboardUrl: '',
|
2019-07-10 17:12:46 -04:00
|
|
|
projectPath: null,
|
2020-07-09 05:09:27 -04:00
|
|
|
operationsSettingsPath: '',
|
2020-02-07 07:09:13 -05:00
|
|
|
logsPath: invalidUrl,
|
2020-08-05 08:09:45 -04:00
|
|
|
addDashboardDocumentationPath: '',
|
2020-06-17 20:08:35 -04:00
|
|
|
|
|
|
|
// static paths
|
|
|
|
customDashboardBasePath: '',
|
2020-07-09 05:09:27 -04:00
|
|
|
|
|
|
|
// current user data
|
|
|
|
/**
|
|
|
|
* Flag that denotes if the currently logged user can access
|
|
|
|
* the project Settings -> Operations
|
|
|
|
*/
|
|
|
|
canAccessOperationsSettings: false,
|
2019-05-27 18:30:36 -04:00
|
|
|
});
|