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:
Dominik Broj 2024-01-11 21:12:03 +01:00 committed by GitHub
parent d49af63d75
commit 54ccfb528e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View file

@ -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;

View file

@ -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,
}),
[]
);