Brojd/get stack from backend on insights (#3654)
# What this PR does get stack from backend instead of parsing url ## Which issue(s) this PR fixes https://github.com/grafana/oncall-private/issues/2434 ## Checklist - [x] Unit, integration, and e2e (if applicable) tests updated - [x] Documentation added (or `pr:no public docs` PR label added if not required) - [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required)
This commit is contained in:
parent
d49af63d75
commit
54ccfb528e
2 changed files with 7 additions and 5 deletions
|
|
@ -13,6 +13,7 @@ export interface Organization {
|
|||
discussion_group_name: string;
|
||||
};
|
||||
name: string;
|
||||
stack_slug: string;
|
||||
slack_team_identity: {
|
||||
general_log_channel_id: string;
|
||||
general_log_channel_pk: string;
|
||||
|
|
|
|||
|
|
@ -39,11 +39,12 @@ import getTotalAlertGroupsScene from './scenes/TotalAlertGroups';
|
|||
import getTotalAlertGroupsByStateScene from './scenes/TotalAlertGroupsByState';
|
||||
import getVariables from './variables';
|
||||
|
||||
const getDefaultStackValue = (isOpenSource: boolean) =>
|
||||
isOpenSource ? 'self_hosted_stack' : location.host.split('.')[0];
|
||||
|
||||
const Insights = observer(() => {
|
||||
const { isOpenSource, insightsDatasource } = useStore();
|
||||
const {
|
||||
isOpenSource,
|
||||
insightsDatasource,
|
||||
organizationStore: { currentOrganization },
|
||||
} = useStore();
|
||||
const [showAllStackInfo, setShowAllStackInfo] = useState(false);
|
||||
const [datasource, setDatasource] = useState<string>();
|
||||
|
||||
|
|
@ -51,7 +52,7 @@ const Insights = observer(() => {
|
|||
() => ({
|
||||
isOpenSource,
|
||||
datasource: { uid: isOpenSource ? '$datasource' : insightsDatasource },
|
||||
stack: getDefaultStackValue(isOpenSource),
|
||||
stack: currentOrganization?.stack_slug,
|
||||
}),
|
||||
[]
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue