Revert "Collection of bugs" (#1671)

Reverts grafana/oncall#1600 as it makes Slack links not working
correctly with the plugin UI.
This commit is contained in:
Vadim Stepanov 2023-03-30 12:44:41 +01:00 committed by GitHub
parent 9fca66d869
commit 83504b15e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 43 additions and 79 deletions

View file

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v1.2.5 (2023-03-30)
### Fixed
- Fixed a bug with Slack links not working in the plugin UI ([#1671](https://github.com/grafana/oncall/pull/1671))
## v1.2.4 (2023-03-30)
### Added

View file

@ -66,7 +66,7 @@ const Tutorial: FC<TutorialProps> = (props) => {
</div>
<Arrow />
<div className={cx('step')}>
<PluginLink query={{ page: 'alert-groups' }}>
<PluginLink query={{ page: 'incidents' }}>
<div className={cx('icon', { icon_active: step === TutorialStep.Incidents })}>
<img src={bellIcon} />
</div>

View file

@ -65,7 +65,7 @@ const AlertReceiveChannelCard = observer((props: AlertReceiveChannelCardProps) =
</Text>
{alertReceiveChannelCounter && (
<PluginLink
query={{ page: 'alert-groups', integration: alertReceiveChannel.id }}
query={{ page: 'incidents', integration: alertReceiveChannel.id }}
className={cx('alertsInfoText')}
>
<Badge

View file

@ -70,7 +70,7 @@ interface AlertRulesState {
const Notification: React.FC = () => (
<div>
Demo alert was generated. Find it on the
<PluginLink query={{ page: 'alert-groups' }}> "Alert Groups" </PluginLink>
<PluginLink query={{ page: 'incidents' }}> "Alert Groups" </PluginLink>
page and make sure it didn't freak out your colleagues 😉
</div>
);

View file

@ -63,15 +63,15 @@ const AttachIncidentForm = observer(({ id, onUpdate, onHide }: AttachIncidentFor
title={
<HorizontalGroup>
<Icon size="lg" name="link" />
<Text.Title level={4}>Attach to another alert group</Text.Title>
<Text.Title level={4}>Attach to another incident</Text.Title>
</HorizontalGroup>
}
className={cx('root')}
onDismiss={onHide}
>
<Field
label="Alert group to be attached with"
description="Linking alert groups together can help the team investigate the underlying issue."
label="Incident to be attached with"
description="Linking incidents together can help the team investigate the underlying issue."
>
<WithPermissionControlTooltip userAction={UserActions.AlertGroupsWrite}>
<GSelect

View file

@ -101,7 +101,7 @@ const IncidentMatcher = observer((props: IncidentMatcherProps) => {
{selectedAlertItem ? (
<SourceCode noMaxHeight>{JSON.stringify(selectedAlertItem, null, 2)}</SourceCode>
) : (
<Text type="secondary"> Select alert group first</Text>
<Text type="secondary"> Select incident first</Text>
)}
</div>
</div>

View file

@ -59,7 +59,6 @@ const IntegrationSettings = observer((props: IntegrationSettingsProps) => {
const [expanded, _setExpanded] = useState(false);
const handleSwitchToTemplate = (templateName: string) => {
setActiveTab(IntegrationSettingsTab.Templates);
setSelectedTemplate(templateName);
};

View file

@ -34,12 +34,7 @@
padding: 4px 8px;
margin-top: 8px;
min-width: 500px;
width: 620px;
}
.autoresolve-div {
display: flex;
align-items: baseline;
width: 520px;
}
.warning-icon-color {

View file

@ -150,7 +150,7 @@ const Autoresolve = ({ alertReceiveChannelId, onSwitchToTemplate, alertGroupId }
<Label>
<div className={cx('settings-label')}>
Autoresolve
<Text type="secondary">How should this integration resolve alert groups?</Text>
<Text type="secondary">How should this integration resolve incidents?</Text>
</div>
</Label>
<div className={cx('team-select')}>
@ -172,9 +172,9 @@ const Autoresolve = ({ alertReceiveChannelId, onSwitchToTemplate, alertGroupId }
{autoresolveSelected && (
<>
<Block shadowed bordered className={cx('autoresolve-block')}>
<div className={cx('autoresolve-div')}>
<div>
<Text type="secondary" size="small">
<Icon name="info-circle" /> Alert group will be automatically resolved when it matches{' '}
<Icon name="info-circle" /> Incident will be automatically resolved when it matches{' '}
</Text>
<Button fill="text" size="sm" onClick={handleGoToTemplateSettingsCllick}>
autoresolve condition

View file

@ -36,7 +36,7 @@ export const form: { name: string; fields: FormItem[] } = {
},
{
value: MaintenanceMode.Maintenance,
label: 'Maintenance (collect everything in one alert group)',
label: 'Maintenance (collect everything in one incident)',
},
],
},

View file

@ -12,8 +12,7 @@
}
.draggable {
top: 10%;
position: absolute;
top: 0;
/* transition: transform 300ms ease; */
}

View file

@ -72,7 +72,6 @@ class EscalationChainsPage extends React.Component<EscalationChainsPageProps, Es
.loadItem(id, true)
.catch((error) => this.setState({ errorData: { ...getWrongTeamResponseInfo(error) } }));
await escalationChainStore.updateEscalationChainDetails(id);
if (!escalationChain) {
return;
}

View file

@ -144,7 +144,7 @@ class IncidentPage extends React.Component<IncidentPageProps, IncidentPageState>
<VerticalGroup spacing="lg" align="center">
<Text.Title level={1}>404</Text.Title>
<Text.Title level={4}>Alert group not found</Text.Title>
<PluginLink query={{ page: 'alert-groups', cursor, start, perpage }}>
<PluginLink query={{ page: 'incidents', cursor, start, perpage }}>
<Button variant="secondary" icon="arrow-left" size="md">
Go to Alert Groups page
</Button>
@ -244,7 +244,7 @@ class IncidentPage extends React.Component<IncidentPageProps, IncidentPageState>
<VerticalGroup>
<HorizontalGroup justify="space-between">
<HorizontalGroup className={cx('title')}>
<PluginLink query={{ page: 'alert-groups', cursor, start, perpage }}>
<PluginLink query={{ page: 'incidents', cursor, start, perpage }}>
<IconButton name="arrow-left" size="xxl" />
</PluginLink>
{/* @ts-ignore*/}
@ -256,12 +256,12 @@ class IncidentPage extends React.Component<IncidentPageProps, IncidentPageState>
{incident.root_alert_group && (
<Text type="secondary">
Attached to{' '}
<PluginLink query={{ page: 'alert-groups', id: incident.root_alert_group.pk }}>
<PluginLink query={{ page: 'incident', id: incident.root_alert_group.pk }}>
#{incident.root_alert_group.inside_organization_number}{' '}
{incident.root_alert_group.render_for_web.title}
</PluginLink>{' '}
<WithPermissionControlTooltip userAction={UserActions.AlertGroupsWrite}>
<Button variant="secondary" onClick={() => this.getUnattachClickHandler(incident.pk)} size="sm">
<Button variant="secondary" onClick={this.getUnattachClickHandler(incident.pk)} size="sm">
Unattach
</Button>
</WithPermissionControlTooltip>
@ -421,7 +421,9 @@ class IncidentPage extends React.Component<IncidentPageProps, IncidentPageState>
getUnattachClickHandler = (pk: Alert['pk']) => {
const { store } = this.props;
return store.alertGroupStore.unattachAlert(pk).then(this.update);
return () => {
store.alertGroupStore.unattachAlert(pk).then(this.update);
};
};
renderTimeline = () => {
@ -760,7 +762,7 @@ function AttachedIncidentsList({
{alerts.map((incident) => {
return (
<HorizontalGroup key={incident.pk} justify={'space-between'}>
<PluginLink query={{ page: 'alert-groups', id: incident.pk }}>
<PluginLink query={{ page: 'incident', id: incident.pk }}>
#{incident.inside_organization_number} {incident.render_for_web.title}
</PluginLink>
<WithPermissionControlTooltip userAction={UserActions.AlertGroupsWrite}>

View file

@ -127,7 +127,7 @@ class Incidents extends React.Component<IncidentsPageProps, IncidentsPageState>
this.setState({ showAddAlertGroupForm: false });
}}
onCreate={(id: Alert['pk']) => {
history.push(`${PLUGIN_ROOT}/alert-groups/${id}`);
history.push(`${PLUGIN_ROOT}/incidents/${id}`);
}}
/>
)}
@ -557,13 +557,7 @@ class Incidents extends React.Component<IncidentsPageProps, IncidentsPageState>
<VerticalGroup spacing="none" justify="center">
<div className={'table__wrap-column'}>
<PluginLink
query={{
page: 'alert-groups',
id: record.pk,
cursor: incidentsCursor,
perpage: incidentsItemsPerPage,
start,
}}
query={{ page: 'incidents', id: record.pk, cursor: incidentsCursor, perpage: incidentsItemsPerPage, start }}
>
<Tooltip placement="top" content={record.render_for_web.title}>
<span>{record.render_for_web.title}</span>

View file

@ -27,24 +27,24 @@ function getPath(name = '') {
export const pages: { [id: string]: PageDefinition } = [
{
icon: 'bell',
id: 'alert-groups',
id: 'incidents',
hideFromBreadcrumbs: true,
text: 'Alert Groups',
hideTitle: true,
path: getPath('alert-groups'),
path: getPath('incidents'),
action: UserActions.AlertGroupsRead,
},
{
icon: 'bell',
id: 'alert-group',
id: 'incident',
text: '',
hideFromTabs: true,
hideFromBreadcrumbs: true,
parentItem: {
text: 'Alert Group',
url: `${PLUGIN_ROOT}/alert-groups`,
text: 'Incident',
url: `${PLUGIN_ROOT}/incidents`,
},
path: getPath('alert-groups'),
path: getPath('incident'),
action: UserActions.AlertGroupsRead,
},
{
@ -189,8 +189,8 @@ export const pages: { [id: string]: PageDefinition } = [
}, {});
export const ROUTES = {
'alert-groups': ['alert-groups'],
'alert-group': ['alert-groups/:id'],
incidents: ['incidents'],
incident: ['incidents/:id'],
users: ['users', 'users/:id'],
integrations: ['integrations', 'integrations/:id'],
escalations: ['escalations', 'escalations/:id'],
@ -205,10 +205,6 @@ export const ROUTES = {
'live-settings': ['live-settings'],
cloud: ['cloud'],
test: ['test'],
// backwards compatible to redirect to new alert-groups
incident: ['incidents/:id'],
incidents: ['incidents'],
};
export const getRoutesForPage = (name: string) => {

View file

@ -41,7 +41,7 @@
{
"type": "page",
"name": "Alert Groups",
"path": "/a/grafana-oncall-app/alert-groups",
"path": "/a/grafana-oncall-app/incidents",
"role": "Viewer",
"action": "grafana-oncall-app.alert-groups:read",
"addToNav": true

View file

@ -14,7 +14,7 @@ import weekday from 'dayjs/plugin/weekday';
import { observer, Provider } from 'mobx-react';
import Header from 'navbar/Header/Header';
import LegacyNavTabsBar from 'navbar/LegacyNavTabsBar';
import { Redirect, Route, Switch, useLocation } from 'react-router-dom';
import { Route, Switch, useLocation } from 'react-router-dom';
import { AppRootProps } from 'types';
import Unauthorized from 'components/Unauthorized';
@ -138,10 +138,10 @@ export const Root = observer((props: AppRootProps) => {
>
{userHasAccess ? (
<Switch>
<Route path={getRoutesForPage('alert-groups')} exact>
<Route path={getRoutesForPage('incidents')} exact>
<Incidents query={query} />
</Route>
<Route path={getRoutesForPage('alert-group')} exact>
<Route path={getRoutesForPage('incident')} exact>
<Incident query={query} />
</Route>
<Route path={getRoutesForPage('users')} exact>
@ -183,32 +183,6 @@ export const Root = observer((props: AppRootProps) => {
<Route path={getRoutesForPage('cloud')} exact>
<CloudPage />
</Route>
<Route
path={getRoutesForPage('incident')}
exact
render={({ location }) => (
<Redirect
to={{
...location,
pathname: location.pathname.replace(/incident/, 'alert-group'),
}}
></Redirect>
)}
></Route>
<Route
path={getRoutesForPage('incidents')}
exact
render={({ location }) => (
<Redirect
to={{
...location,
pathname: location.pathname.replace(/incidents/, 'alert-groups'),
}}
></Redirect>
)}
></Route>
<Route path="*">
<NoMatch />
</Route>

View file

@ -11,7 +11,7 @@ export const GRAFANA_LICENSE_OSS = 'OpenSource';
export const BREAKPOINT_TABS = 1024;
// Default redirect page
export const DEFAULT_PAGE = 'alert-groups';
export const DEFAULT_PAGE = 'incidents';
export const PLUGIN_ROOT = '/a/grafana-oncall-app';

View file

@ -22,7 +22,7 @@ export function getPathFromQueryParams(query: ParsedQuery<string>) {
path += `/${normalizedQuery.page}`;
if (normalizedQuery.id) {
if (normalizedQuery.page === 'alert-group' || normalizedQuery.page === 'schedule') {
if (normalizedQuery.page === 'incident' || normalizedQuery.page === 'schedule') {
path += 's';
}