Skip to content

Commit 83504b1

Browse files
authored
Revert "Collection of bugs" (#1671)
Reverts #1600 as it makes Slack links not working correctly with the plugin UI.
1 parent 9fca66d commit 83504b1

File tree

19 files changed

+43
-79
lines changed

19 files changed

+43
-79
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## v1.2.5 (2023-03-30)
9+
10+
### Fixed
11+
12+
- Fixed a bug with Slack links not working in the plugin UI ([#1671](https://github.com/grafana/oncall/pull/1671))
13+
814
## v1.2.4 (2023-03-30)
915

1016
### Added

grafana-plugin/src/components/Tutorial/Tutorial.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ const Tutorial: FC<TutorialProps> = (props) => {
6666
</div>
6767
<Arrow />
6868
<div className={cx('step')}>
69-
<PluginLink query={{ page: 'alert-groups' }}>
69+
<PluginLink query={{ page: 'incidents' }}>
7070
<div className={cx('icon', { icon_active: step === TutorialStep.Incidents })}>
7171
<img src={bellIcon} />
7272
</div>

grafana-plugin/src/containers/AlertReceiveChannelCard/AlertReceiveChannelCard.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const AlertReceiveChannelCard = observer((props: AlertReceiveChannelCardProps) =
6565
</Text>
6666
{alertReceiveChannelCounter && (
6767
<PluginLink
68-
query={{ page: 'alert-groups', integration: alertReceiveChannel.id }}
68+
query={{ page: 'incidents', integration: alertReceiveChannel.id }}
6969
className={cx('alertsInfoText')}
7070
>
7171
<Badge

grafana-plugin/src/containers/AlertRules/AlertRules.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ interface AlertRulesState {
7070
const Notification: React.FC = () => (
7171
<div>
7272
Demo alert was generated. Find it on the
73-
<PluginLink query={{ page: 'alert-groups' }}> "Alert Groups" </PluginLink>
73+
<PluginLink query={{ page: 'incidents' }}> "Alert Groups" </PluginLink>
7474
page and make sure it didn't freak out your colleagues 😉
7575
</div>
7676
);

grafana-plugin/src/containers/AttachIncidentForm/AttachIncidentForm.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ const AttachIncidentForm = observer(({ id, onUpdate, onHide }: AttachIncidentFor
6363
title={
6464
<HorizontalGroup>
6565
<Icon size="lg" name="link" />
66-
<Text.Title level={4}>Attach to another alert group</Text.Title>
66+
<Text.Title level={4}>Attach to another incident</Text.Title>
6767
</HorizontalGroup>
6868
}
6969
className={cx('root')}
7070
onDismiss={onHide}
7171
>
7272
<Field
73-
label="Alert group to be attached with"
74-
description="Linking alert groups together can help the team investigate the underlying issue."
73+
label="Incident to be attached with"
74+
description="Linking incidents together can help the team investigate the underlying issue."
7575
>
7676
<WithPermissionControlTooltip userAction={UserActions.AlertGroupsWrite}>
7777
<GSelect

grafana-plugin/src/containers/IncidentMatcher/IncidentMatcher.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const IncidentMatcher = observer((props: IncidentMatcherProps) => {
101101
{selectedAlertItem ? (
102102
<SourceCode noMaxHeight>{JSON.stringify(selectedAlertItem, null, 2)}</SourceCode>
103103
) : (
104-
<Text type="secondary">← Select alert group first</Text>
104+
<Text type="secondary">← Select incident first</Text>
105105
)}
106106
</div>
107107
</div>

grafana-plugin/src/containers/IntegrationSettings/IntegrationSettings.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ const IntegrationSettings = observer((props: IntegrationSettingsProps) => {
5959
const [expanded, _setExpanded] = useState(false);
6060

6161
const handleSwitchToTemplate = (templateName: string) => {
62-
setActiveTab(IntegrationSettingsTab.Templates);
6362
setSelectedTemplate(templateName);
6463
};
6564

grafana-plugin/src/containers/IntegrationSettings/parts/Autoresolve.module.css

+1-6
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,7 @@
3434
padding: 4px 8px;
3535
margin-top: 8px;
3636
min-width: 500px;
37-
width: 620px;
38-
}
39-
40-
.autoresolve-div {
41-
display: flex;
42-
align-items: baseline;
37+
width: 520px;
4338
}
4439

4540
.warning-icon-color {

grafana-plugin/src/containers/IntegrationSettings/parts/Autoresolve.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ const Autoresolve = ({ alertReceiveChannelId, onSwitchToTemplate, alertGroupId }
150150
<Label>
151151
<div className={cx('settings-label')}>
152152
Autoresolve
153-
<Text type="secondary">How should this integration resolve alert groups?</Text>
153+
<Text type="secondary">How should this integration resolve incidents?</Text>
154154
</div>
155155
</Label>
156156
<div className={cx('team-select')}>
@@ -172,9 +172,9 @@ const Autoresolve = ({ alertReceiveChannelId, onSwitchToTemplate, alertGroupId }
172172
{autoresolveSelected && (
173173
<>
174174
<Block shadowed bordered className={cx('autoresolve-block')}>
175-
<div className={cx('autoresolve-div')}>
175+
<div>
176176
<Text type="secondary" size="small">
177-
<Icon name="info-circle" /> Alert group will be automatically resolved when it matches{' '}
177+
<Icon name="info-circle" /> Incident will be automatically resolved when it matches{' '}
178178
</Text>
179179
<Button fill="text" size="sm" onClick={handleGoToTemplateSettingsCllick}>
180180
autoresolve condition

grafana-plugin/src/containers/MaintenanceForm/MaintenanceForm.config.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const form: { name: string; fields: FormItem[] } = {
3636
},
3737
{
3838
value: MaintenanceMode.Maintenance,
39-
label: 'Maintenance (collect everything in one alert group)',
39+
label: 'Maintenance (collect everything in one incident)',
4040
},
4141
],
4242
},

grafana-plugin/src/containers/RotationForm/RotationForm.module.css

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
}
1313

1414
.draggable {
15-
top: 10%;
16-
position: absolute;
15+
top: 0;
1716

1817
/* transition: transform 300ms ease; */
1918
}

grafana-plugin/src/pages/escalation-chains/EscalationChains.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ class EscalationChainsPage extends React.Component<EscalationChainsPageProps, Es
7272
.loadItem(id, true)
7373
.catch((error) => this.setState({ errorData: { ...getWrongTeamResponseInfo(error) } }));
7474

75-
await escalationChainStore.updateEscalationChainDetails(id);
7675
if (!escalationChain) {
7776
return;
7877
}

grafana-plugin/src/pages/incident/Incident.tsx

+8-6
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class IncidentPage extends React.Component<IncidentPageProps, IncidentPageState>
144144
<VerticalGroup spacing="lg" align="center">
145145
<Text.Title level={1}>404</Text.Title>
146146
<Text.Title level={4}>Alert group not found</Text.Title>
147-
<PluginLink query={{ page: 'alert-groups', cursor, start, perpage }}>
147+
<PluginLink query={{ page: 'incidents', cursor, start, perpage }}>
148148
<Button variant="secondary" icon="arrow-left" size="md">
149149
Go to Alert Groups page
150150
</Button>
@@ -244,7 +244,7 @@ class IncidentPage extends React.Component<IncidentPageProps, IncidentPageState>
244244
<VerticalGroup>
245245
<HorizontalGroup justify="space-between">
246246
<HorizontalGroup className={cx('title')}>
247-
<PluginLink query={{ page: 'alert-groups', cursor, start, perpage }}>
247+
<PluginLink query={{ page: 'incidents', cursor, start, perpage }}>
248248
<IconButton name="arrow-left" size="xxl" />
249249
</PluginLink>
250250
{/* @ts-ignore*/}
@@ -256,12 +256,12 @@ class IncidentPage extends React.Component<IncidentPageProps, IncidentPageState>
256256
{incident.root_alert_group && (
257257
<Text type="secondary">
258258
Attached to{' '}
259-
<PluginLink query={{ page: 'alert-groups', id: incident.root_alert_group.pk }}>
259+
<PluginLink query={{ page: 'incident', id: incident.root_alert_group.pk }}>
260260
#{incident.root_alert_group.inside_organization_number}{' '}
261261
{incident.root_alert_group.render_for_web.title}
262262
</PluginLink>{' '}
263263
<WithPermissionControlTooltip userAction={UserActions.AlertGroupsWrite}>
264-
<Button variant="secondary" onClick={() => this.getUnattachClickHandler(incident.pk)} size="sm">
264+
<Button variant="secondary" onClick={this.getUnattachClickHandler(incident.pk)} size="sm">
265265
Unattach
266266
</Button>
267267
</WithPermissionControlTooltip>
@@ -421,7 +421,9 @@ class IncidentPage extends React.Component<IncidentPageProps, IncidentPageState>
421421
getUnattachClickHandler = (pk: Alert['pk']) => {
422422
const { store } = this.props;
423423

424-
return store.alertGroupStore.unattachAlert(pk).then(this.update);
424+
return () => {
425+
store.alertGroupStore.unattachAlert(pk).then(this.update);
426+
};
425427
};
426428

427429
renderTimeline = () => {
@@ -760,7 +762,7 @@ function AttachedIncidentsList({
760762
{alerts.map((incident) => {
761763
return (
762764
<HorizontalGroup key={incident.pk} justify={'space-between'}>
763-
<PluginLink query={{ page: 'alert-groups', id: incident.pk }}>
765+
<PluginLink query={{ page: 'incident', id: incident.pk }}>
764766
#{incident.inside_organization_number} {incident.render_for_web.title}
765767
</PluginLink>
766768
<WithPermissionControlTooltip userAction={UserActions.AlertGroupsWrite}>

grafana-plugin/src/pages/incidents/Incidents.tsx

+2-8
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class Incidents extends React.Component<IncidentsPageProps, IncidentsPageState>
127127
this.setState({ showAddAlertGroupForm: false });
128128
}}
129129
onCreate={(id: Alert['pk']) => {
130-
history.push(`${PLUGIN_ROOT}/alert-groups/${id}`);
130+
history.push(`${PLUGIN_ROOT}/incidents/${id}`);
131131
}}
132132
/>
133133
)}
@@ -557,13 +557,7 @@ class Incidents extends React.Component<IncidentsPageProps, IncidentsPageState>
557557
<VerticalGroup spacing="none" justify="center">
558558
<div className={'table__wrap-column'}>
559559
<PluginLink
560-
query={{
561-
page: 'alert-groups',
562-
id: record.pk,
563-
cursor: incidentsCursor,
564-
perpage: incidentsItemsPerPage,
565-
start,
566-
}}
560+
query={{ page: 'incidents', id: record.pk, cursor: incidentsCursor, perpage: incidentsItemsPerPage, start }}
567561
>
568562
<Tooltip placement="top" content={record.render_for_web.title}>
569563
<span>{record.render_for_web.title}</span>

grafana-plugin/src/pages/index.tsx

+8-12
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,24 @@ function getPath(name = '') {
2727
export const pages: { [id: string]: PageDefinition } = [
2828
{
2929
icon: 'bell',
30-
id: 'alert-groups',
30+
id: 'incidents',
3131
hideFromBreadcrumbs: true,
3232
text: 'Alert Groups',
3333
hideTitle: true,
34-
path: getPath('alert-groups'),
34+
path: getPath('incidents'),
3535
action: UserActions.AlertGroupsRead,
3636
},
3737
{
3838
icon: 'bell',
39-
id: 'alert-group',
39+
id: 'incident',
4040
text: '',
4141
hideFromTabs: true,
4242
hideFromBreadcrumbs: true,
4343
parentItem: {
44-
text: 'Alert Group',
45-
url: `${PLUGIN_ROOT}/alert-groups`,
44+
text: 'Incident',
45+
url: `${PLUGIN_ROOT}/incidents`,
4646
},
47-
path: getPath('alert-groups'),
47+
path: getPath('incident'),
4848
action: UserActions.AlertGroupsRead,
4949
},
5050
{
@@ -189,8 +189,8 @@ export const pages: { [id: string]: PageDefinition } = [
189189
}, {});
190190

191191
export const ROUTES = {
192-
'alert-groups': ['alert-groups'],
193-
'alert-group': ['alert-groups/:id'],
192+
incidents: ['incidents'],
193+
incident: ['incidents/:id'],
194194
users: ['users', 'users/:id'],
195195
integrations: ['integrations', 'integrations/:id'],
196196
escalations: ['escalations', 'escalations/:id'],
@@ -205,10 +205,6 @@ export const ROUTES = {
205205
'live-settings': ['live-settings'],
206206
cloud: ['cloud'],
207207
test: ['test'],
208-
209-
// backwards compatible to redirect to new alert-groups
210-
incident: ['incidents/:id'],
211-
incidents: ['incidents'],
212208
};
213209

214210
export const getRoutesForPage = (name: string) => {

grafana-plugin/src/plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
{
4242
"type": "page",
4343
"name": "Alert Groups",
44-
"path": "/a/grafana-oncall-app/alert-groups",
44+
"path": "/a/grafana-oncall-app/incidents",
4545
"role": "Viewer",
4646
"action": "grafana-oncall-app.alert-groups:read",
4747
"addToNav": true

grafana-plugin/src/plugin/GrafanaPluginRootPage.tsx

+3-29
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import weekday from 'dayjs/plugin/weekday';
1414
import { observer, Provider } from 'mobx-react';
1515
import Header from 'navbar/Header/Header';
1616
import LegacyNavTabsBar from 'navbar/LegacyNavTabsBar';
17-
import { Redirect, Route, Switch, useLocation } from 'react-router-dom';
17+
import { Route, Switch, useLocation } from 'react-router-dom';
1818
import { AppRootProps } from 'types';
1919

2020
import Unauthorized from 'components/Unauthorized';
@@ -138,10 +138,10 @@ export const Root = observer((props: AppRootProps) => {
138138
>
139139
{userHasAccess ? (
140140
<Switch>
141-
<Route path={getRoutesForPage('alert-groups')} exact>
141+
<Route path={getRoutesForPage('incidents')} exact>
142142
<Incidents query={query} />
143143
</Route>
144-
<Route path={getRoutesForPage('alert-group')} exact>
144+
<Route path={getRoutesForPage('incident')} exact>
145145
<Incident query={query} />
146146
</Route>
147147
<Route path={getRoutesForPage('users')} exact>
@@ -183,32 +183,6 @@ export const Root = observer((props: AppRootProps) => {
183183
<Route path={getRoutesForPage('cloud')} exact>
184184
<CloudPage />
185185
</Route>
186-
187-
<Route
188-
path={getRoutesForPage('incident')}
189-
exact
190-
render={({ location }) => (
191-
<Redirect
192-
to={{
193-
...location,
194-
pathname: location.pathname.replace(/incident/, 'alert-group'),
195-
}}
196-
></Redirect>
197-
)}
198-
></Route>
199-
<Route
200-
path={getRoutesForPage('incidents')}
201-
exact
202-
render={({ location }) => (
203-
<Redirect
204-
to={{
205-
...location,
206-
pathname: location.pathname.replace(/incidents/, 'alert-groups'),
207-
}}
208-
></Redirect>
209-
)}
210-
></Route>
211-
212186
<Route path="*">
213187
<NoMatch />
214188
</Route>

grafana-plugin/src/utils/consts.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const GRAFANA_LICENSE_OSS = 'OpenSource';
1111
export const BREAKPOINT_TABS = 1024;
1212

1313
// Default redirect page
14-
export const DEFAULT_PAGE = 'alert-groups';
14+
export const DEFAULT_PAGE = 'incidents';
1515

1616
export const PLUGIN_ROOT = '/a/grafana-oncall-app';
1717

grafana-plugin/src/utils/url.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export function getPathFromQueryParams(query: ParsedQuery<string>) {
2222
path += `/${normalizedQuery.page}`;
2323

2424
if (normalizedQuery.id) {
25-
if (normalizedQuery.page === 'alert-group' || normalizedQuery.page === 'schedule') {
25+
if (normalizedQuery.page === 'incident' || normalizedQuery.page === 'schedule') {
2626
path += 's';
2727
}
2828

0 commit comments

Comments
 (0)