Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
teodosii committed May 30, 2024
1 parent b644dc7 commit cc19c2a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 38 deletions.
10 changes: 3 additions & 7 deletions grafana-plugin/src/components/Policy/EscalationPolicy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { Schedule } from 'models/schedule/schedule.types';
import { UserHelper } from 'models/user/user.helpers';
import { UserGroup } from 'models/user_group/user_group.types';
import { ApiSchemas } from 'network/oncall-api/api.types';
import { SelectOption, WithStoreProps } from 'state/types';
import { WithStoreProps } from 'state/types';
import { withMobXProviderContext } from 'state/withStore';
import { UserActions } from 'utils/authorization/authorization';

Expand All @@ -44,7 +44,6 @@ interface ElementSortableProps extends WithStoreProps {
interface EscalationPolicyBaseProps {
data: EscalationPolicyType;
isDisabled?: boolean;
numMinutesInWindowOptions: SelectOption[];
channels?: any[];
onChange: (id: EscalationPolicyType['id'], value: Partial<EscalationPolicyType>) => void;
onDelete: (data: EscalationPolicyType) => void;
Expand Down Expand Up @@ -315,7 +314,7 @@ class _EscalationPolicy extends React.Component<EscalationPolicyProps, any> {
}

renderNumMinutesInWindowOptions() {
const { data, isDisabled, numMinutesInWindowOptions = [], theme } = this.props;
const { data, isDisabled, theme } = this.props;
const { num_minutes_in_window } = data;
const styles = getEscalationPolicyStyles(theme);

Expand All @@ -337,10 +336,7 @@ class _EscalationPolicy extends React.Component<EscalationPolicyProps, any> {
onChange={this.getOnSelectChangeHandler('num_minutes_in_window')}
allowCustomValue
onCreateOption={(option) => this.onCreateOption('num_minutes_in_window', option)}
options={numMinutesInWindowOptions.map((waitDelay: SelectOption) => ({
value: waitDelay.value,
label: waitDelay.display_name,
}))}
options={options}
/>
</WithPermissionControlTooltip>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ export const EscalationChainSteps = observer((props: EscalationChainStepsProps)

useEffect(() => {
escalationPolicyStore.updateWebEscalationPolicyOptions();
escalationPolicyStore.fetchEscalationPolicySilenceOptions();
escalationPolicyStore.fetchEscalationPolicyNumMinutesInWindowOptions();
}, []);

const handleSortEnd = useCallback(
Expand Down Expand Up @@ -106,7 +104,6 @@ export const EscalationChainSteps = observer((props: EscalationChainStepsProps)
data={escalationPolicy}
number={index + offset + 1}
escalationChoices={escalationPolicyStore.webEscalationChoices}
numMinutesInWindowOptions={escalationPolicyStore.numMinutesInWindowOptions}
onChange={escalationPolicyStore.saveEscalationPolicy.bind(escalationPolicyStore)}
onDelete={escalationPolicyStore.deleteEscalationPolicy.bind(escalationPolicyStore)}
isSlackInstalled={isSlackInstalled}
Expand Down
28 changes: 0 additions & 28 deletions grafana-plugin/src/models/escalation_policy/escalation_policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ export class EscalationPolicyStore extends BaseStore {
@observable
escalationChoices: any = [];

@observable
silenceOptions: SilenceOption[] = [];

@observable
numMinutesInWindowOptions: SilenceOption[] = [];

@observable
webEscalationChoices: any = [];

Expand All @@ -51,28 +45,6 @@ export class EscalationPolicyStore extends BaseStore {
});
}

@action.bound
async fetchEscalationPolicySilenceOptions() {
const response = await makeRequest('/escalation_policies/delay_options', {
method: 'GET',
});

runInAction(() => {
this.silenceOptions = response;
});
}

@action.bound
async fetchEscalationPolicyNumMinutesInWindowOptions() {
const response = await makeRequest('/escalation_policies/num_minutes_in_window_options', {
method: 'GET',
});

runInAction(() => {
this.numMinutesInWindowOptions = response;
});
}

@action.bound
async updateEscalationPolicies(escalationChainId: EscalationChain['id']) {
const response = await makeRequest(this.path, {
Expand Down

0 comments on commit cc19c2a

Please sign in to comment.