MM-53115 Fix ridiculous Babel bug by removing unused code (#23696)
* MM-53115 Fix ridiculous Babel bug by removing unused code * Fix Playbooks clean script missing some files * Turn on typescript-eslint/no-unused-vars ESLint rule for Playbooks
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
adb248497d
Коммит
b9f52126c2
@@ -649,6 +649,13 @@
|
|||||||
"@typescript-eslint/ban-ts-ignore": 0,
|
"@typescript-eslint/ban-ts-ignore": 0,
|
||||||
"@typescript-eslint/ban-types": 1,
|
"@typescript-eslint/ban-types": 1,
|
||||||
"@typescript-eslint/ban-ts-comment": 0,
|
"@typescript-eslint/ban-ts-comment": 0,
|
||||||
|
"@typescript-eslint/no-unused-vars": [
|
||||||
|
2,
|
||||||
|
{
|
||||||
|
"vars": "all",
|
||||||
|
"args": "after-used"
|
||||||
|
}
|
||||||
|
],
|
||||||
"@typescript-eslint/no-var-requires": 0,
|
"@typescript-eslint/no-var-requires": 0,
|
||||||
"@typescript-eslint/prefer-interface": 0,
|
"@typescript-eslint/prefer-interface": 0,
|
||||||
"@typescript-eslint/explicit-function-return-type": 0,
|
"@typescript-eslint/explicit-function-return-type": 0,
|
||||||
|
|||||||
@@ -107,6 +107,6 @@
|
|||||||
"report-unused-exports": "ts-prune",
|
"report-unused-exports": "ts-prune",
|
||||||
"start:product": "webpack --mode=development --watch",
|
"start:product": "webpack --mode=development --watch",
|
||||||
"deploy:product": "node scripts/deploy.js",
|
"deploy:product": "node scripts/deploy.js",
|
||||||
"clean": "rm -rf node_modules"
|
"clean": "rm -rf dist node_modules .eslintcache"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,10 +102,9 @@ export function startPlaybookRun(teamId: string, postId?: string) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function openUpdateRunNameModal(playbookRunId: string, teamId: string, type: PlaybookRunType, onSubmit: (newName: string) => void) {
|
export function openUpdateRunNameModal(playbookRunId: string, onSubmit: (newName: string) => void) {
|
||||||
return modals.openModal(makeUpdateRunNameModalDefinition({
|
return modals.openModal(makeUpdateRunNameModalDefinition({
|
||||||
playbookRunId,
|
playbookRunId,
|
||||||
teamId,
|
|
||||||
onSubmit,
|
onSubmit,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -352,8 +351,8 @@ export const setChecklistItemsFilter = (key: string, nextState: ChecklistItemsFi
|
|||||||
nextState,
|
nextState,
|
||||||
});
|
});
|
||||||
|
|
||||||
export function openTaskActionsModal(onTaskActionsChange: (newTaskActions: TaskActionType[]) => void, taskActions?: TaskActionType[] | null, playbookRunId?: string) {
|
export function openTaskActionsModal(onTaskActionsChange: (newTaskActions: TaskActionType[]) => void, taskActions?: TaskActionType[] | null) {
|
||||||
return modals.openModal(makeTaskActionsModalDefinition(onTaskActionsChange, taskActions, playbookRunId));
|
return modals.openModal(makeTaskActionsModalDefinition(onTaskActionsChange, taskActions));
|
||||||
}
|
}
|
||||||
|
|
||||||
export const closeBackstageRHS = (): CloseBackstageRHS => ({
|
export const closeBackstageRHS = (): CloseBackstageRHS => ({
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {useIntl} from 'react-intl';
|
import {useIntl} from 'react-intl';
|
||||||
|
|
||||||
import {useFloatingPortalNode} from '@floating-ui/react-dom-interactions';
|
|
||||||
|
|
||||||
import {usePlaybook, usePlaybooksCrud} from 'src/hooks';
|
import {usePlaybook, usePlaybooksCrud} from 'src/hooks';
|
||||||
|
|
||||||
import MarkdownTextbox from 'src/components/markdown_textbox';
|
import MarkdownTextbox from 'src/components/markdown_textbox';
|
||||||
@@ -49,7 +47,6 @@ interface OptionType {
|
|||||||
|
|
||||||
export const RunPlaybookChildren = ({playbookId, onUpdate, editable}: RunPlaybookProps) => {
|
export const RunPlaybookChildren = ({playbookId, onUpdate, editable}: RunPlaybookProps) => {
|
||||||
const {formatMessage} = useIntl();
|
const {formatMessage} = useIntl();
|
||||||
const portalEl = useFloatingPortalNode();
|
|
||||||
const [playbook] = usePlaybook(playbookId);
|
const [playbook] = usePlaybook(playbookId);
|
||||||
const {playbooks, params, setSearchTerm} = usePlaybooksCrud({sort: 'title'}, {infinitePaging: false});
|
const {playbooks, params, setSearchTerm} = usePlaybooksCrud({sort: 'title'}, {infinitePaging: false});
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import React from 'react';
|
|||||||
|
|
||||||
import Svg from 'src/components/assets/svg';
|
import Svg from 'src/components/assets/svg';
|
||||||
|
|
||||||
const BugSearch = (props: {className?: string}) => (
|
const BugSearch = () => (
|
||||||
<Svg
|
<Svg
|
||||||
width='65'
|
width='65'
|
||||||
height='68'
|
height='68'
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import React from 'react';
|
|||||||
|
|
||||||
import Svg from 'src/components/assets/svg';
|
import Svg from 'src/components/assets/svg';
|
||||||
|
|
||||||
const DumpsterFire = (props: {className?: string}) => (
|
const DumpsterFire = () => (
|
||||||
<Svg
|
<Svg
|
||||||
width='60'
|
width='60'
|
||||||
height='72'
|
height='72'
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import React from 'react';
|
|||||||
|
|
||||||
import Svg from 'src/components/assets/svg';
|
import Svg from 'src/components/assets/svg';
|
||||||
|
|
||||||
const Gears = (props: {className?: string}) => (
|
const Gears = () => (
|
||||||
<Svg
|
<Svg
|
||||||
width='74'
|
width='74'
|
||||||
height='69'
|
height='69'
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import React from 'react';
|
|||||||
|
|
||||||
import Svg from 'src/components/assets/svg';
|
import Svg from 'src/components/assets/svg';
|
||||||
|
|
||||||
const Handshake = (props: {className?: string}) => (
|
const Handshake = () => (
|
||||||
<Svg
|
<Svg
|
||||||
width='96'
|
width='96'
|
||||||
height='61'
|
height='61'
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import React from 'react';
|
|||||||
|
|
||||||
import Svg from 'src/components/assets/svg';
|
import Svg from 'src/components/assets/svg';
|
||||||
|
|
||||||
const LightBulb = (props: {className?: string}) => (
|
const LightBulb = () => (
|
||||||
<Svg
|
<Svg
|
||||||
width='48'
|
width='48'
|
||||||
height='72'
|
height='72'
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import React from 'react';
|
|||||||
|
|
||||||
import Svg from 'src/components/assets/svg';
|
import Svg from 'src/components/assets/svg';
|
||||||
|
|
||||||
const RocketMan = (props: {className?: string}) => (
|
const RocketMan = () => (
|
||||||
<Svg
|
<Svg
|
||||||
width='176'
|
width='176'
|
||||||
height='170'
|
height='170'
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import React from 'react';
|
|||||||
|
|
||||||
import Svg from 'src/components/assets/svg';
|
import Svg from 'src/components/assets/svg';
|
||||||
|
|
||||||
const Rocket = (props: {className?: string}) => (
|
const Rocket = () => (
|
||||||
<Svg
|
<Svg
|
||||||
width='60'
|
width='60'
|
||||||
height='68'
|
height='68'
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import React from 'react';
|
|||||||
|
|
||||||
import Svg from 'src/components/assets/svg';
|
import Svg from 'src/components/assets/svg';
|
||||||
|
|
||||||
const Search = (props: {className?: string}) => (
|
const Search = () => (
|
||||||
|
|
||||||
<Svg
|
<Svg
|
||||||
width='180'
|
width='180'
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import React from 'react';
|
|||||||
|
|
||||||
import Svg from 'src/components/assets/svg';
|
import Svg from 'src/components/assets/svg';
|
||||||
|
|
||||||
const SmileySunglasses = (props: {className?: string}) => (
|
const SmileySunglasses = () => (
|
||||||
<Svg
|
<Svg
|
||||||
width='62'
|
width='62'
|
||||||
height='60'
|
height='60'
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ export const useFileDragDetection = () => {
|
|||||||
setIsDraggingFile(dragDepth > 0);
|
setIsDraggingFile(dragDepth > 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDragEnter = (e: DragEvent) => {
|
const handleDragEnter = () => {
|
||||||
dragDepth++;
|
dragDepth++;
|
||||||
updateIsDraggingFile();
|
updateIsDraggingFile();
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDragLeave = (e: DragEvent) => {
|
const handleDragLeave = () => {
|
||||||
dragDepth--;
|
dragDepth--;
|
||||||
updateIsDraggingFile();
|
updateIsDraggingFile();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
import React, {useCallback} from 'react';
|
||||||
|
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import {Scrollbars} from 'react-custom-scrollbars';
|
import {Scrollbars} from 'react-custom-scrollbars';
|
||||||
@@ -26,11 +26,17 @@ const ThumbVertical = styled.div`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
const MenuList = <T extends OptionTypeBase>(props: MenuListComponentProps<T, false>) => {
|
const MenuList = <T extends OptionTypeBase>(props: MenuListComponentProps<T, false>) => {
|
||||||
|
const renderThumbVertical = useCallback((thumbProps) => {
|
||||||
|
const thumbPropsWithoutStyle = {...thumbProps};
|
||||||
|
Reflect.deleteProperty(thumbPropsWithoutStyle, 'style');
|
||||||
|
return <ThumbVertical {...thumbPropsWithoutStyle}/>;
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MenuListWrapper>
|
<MenuListWrapper>
|
||||||
<StyledScrollbars
|
<StyledScrollbars
|
||||||
autoHeight={true}
|
autoHeight={true}
|
||||||
renderThumbVertical={({style, ...thumbProps}) => <ThumbVertical {...thumbProps}/>}
|
renderThumbVertical={renderThumbVertical}
|
||||||
>
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
</StyledScrollbars>
|
</StyledScrollbars>
|
||||||
|
|||||||
@@ -154,20 +154,6 @@ const LegacyActionsEdit = ({playbook}: Props) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleToggleCategorizePlaybookRun = () => {
|
|
||||||
updatePlaybook({
|
|
||||||
categorizeChannelEnabled: !playbook.categorize_channel_enabled,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleCategoryNameChange = (categoryName: string) => {
|
|
||||||
if (playbook.category_name !== categoryName) {
|
|
||||||
updatePlaybook({
|
|
||||||
categoryName,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<StyledSection>
|
<StyledSection>
|
||||||
|
|||||||
@@ -64,10 +64,6 @@ const OwnerControlComponent = (ownProps: ControlProps<ProfileOption, boolean>) =
|
|||||||
return controlComponent(ownProps, 'owners');
|
return controlComponent(ownProps, 'owners');
|
||||||
};
|
};
|
||||||
|
|
||||||
const TeamControlComponent = (ownProps: ControlProps<TeamOption, boolean>) => {
|
|
||||||
return controlComponent(ownProps, 'teams');
|
|
||||||
};
|
|
||||||
|
|
||||||
const PlaybookControlComponent = (ownProps: ControlProps<PlaybookOption, boolean>) => {
|
const PlaybookControlComponent = (ownProps: ControlProps<PlaybookOption, boolean>) => {
|
||||||
return controlComponent(ownProps, 'playbooks');
|
return controlComponent(ownProps, 'playbooks');
|
||||||
};
|
};
|
||||||
@@ -75,7 +71,6 @@ const PlaybookControlComponent = (ownProps: ControlProps<PlaybookOption, boolean
|
|||||||
const Filters = ({fetchParams, setFetchParams, fixedPlaybook, fixedFinished}: Props) => {
|
const Filters = ({fetchParams, setFetchParams, fixedPlaybook, fixedFinished}: Props) => {
|
||||||
const {formatMessage} = useIntl();
|
const {formatMessage} = useIntl();
|
||||||
const [profileSelectorToggle, setProfileSelectorToggle] = useState(false);
|
const [profileSelectorToggle, setProfileSelectorToggle] = useState(false);
|
||||||
const [teamSelectorToggle, setTeamSelectorToggle] = useState(false);
|
|
||||||
const [playbookSelectorToggle, setPlaybookSelectorToggle] = useState(false);
|
const [playbookSelectorToggle, setPlaybookSelectorToggle] = useState(false);
|
||||||
const currentTeamId = useSelector(getCurrentTeamId);
|
const currentTeamId = useSelector(getCurrentTeamId);
|
||||||
|
|
||||||
@@ -92,12 +87,6 @@ const Filters = ({fetchParams, setFetchParams, fixedPlaybook, fixedFinished}: Pr
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const setTeamId = (teamId?: string) => {
|
|
||||||
setFetchParams((oldParams) => {
|
|
||||||
return {...oldParams, team_id: teamId, page: 0};
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const setPlaybookId = (playbookId?: string) => {
|
const setPlaybookId = (playbookId?: string) => {
|
||||||
setFetchParams((oldParams) => {
|
setFetchParams((oldParams) => {
|
||||||
return {...oldParams, playbook_id: playbookId, page: 0};
|
return {...oldParams, playbook_id: playbookId, page: 0};
|
||||||
@@ -122,11 +111,6 @@ const Filters = ({fetchParams, setFetchParams, fixedPlaybook, fixedFinished}: Pr
|
|||||||
setProfileSelectorToggle(!profileSelectorToggle);
|
setProfileSelectorToggle(!profileSelectorToggle);
|
||||||
};
|
};
|
||||||
|
|
||||||
const resetTeam = () => {
|
|
||||||
setTeamId();
|
|
||||||
setTeamSelectorToggle(!teamSelectorToggle);
|
|
||||||
};
|
|
||||||
|
|
||||||
const resetPlaybook = () => {
|
const resetPlaybook = () => {
|
||||||
setPlaybookId();
|
setPlaybookId();
|
||||||
setPlaybookSelectorToggle(!playbookSelectorToggle);
|
setPlaybookSelectorToggle(!playbookSelectorToggle);
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ const StatsView = (props: Props) => {
|
|||||||
<GraphBox>
|
<GraphBox>
|
||||||
<LineGraph
|
<LineGraph
|
||||||
title={formatMessage({defaultMessage: 'TOTAL RUNS started per week over the last 12 weeks'})}
|
title={formatMessage({defaultMessage: 'TOTAL RUNS started per week over the last 12 weeks'})}
|
||||||
labels={props.stats.runs_started_per_week_times.map(([start, _]) => DateTime.fromMillis(start).toLocaleString(DateTimeFormats.DATE_MED_NO_YEAR))}
|
labels={props.stats.runs_started_per_week_times.map(([start]) => DateTime.fromMillis(start).toLocaleString(DateTimeFormats.DATE_MED_NO_YEAR))}
|
||||||
data={props.stats.runs_started_per_week}
|
data={props.stats.runs_started_per_week}
|
||||||
tooltipTitleCallback={(date) => formatMessage({defaultMessage: 'Week of {date}'}, {date})}
|
tooltipTitleCallback={(date) => formatMessage({defaultMessage: 'Week of {date}'}, {date})}
|
||||||
tooltipLabelCallback={(numTotalRuns) => formatMessage({defaultMessage: '{numTotalRuns, plural, =0 {no runs started} =1 {# run started} other {# runs started}}'}, {numTotalRuns})}
|
tooltipLabelCallback={(numTotalRuns) => formatMessage({defaultMessage: '{numTotalRuns, plural, =0 {no runs started} =1 {# run started} other {# runs started}}'}, {numTotalRuns})}
|
||||||
@@ -159,7 +159,7 @@ const StatsView = (props: Props) => {
|
|||||||
<GraphBox>
|
<GraphBox>
|
||||||
<BarGraph
|
<BarGraph
|
||||||
title={formatMessage({defaultMessage: 'ACTIVE RUNS per day over the last 14 days'})}
|
title={formatMessage({defaultMessage: 'ACTIVE RUNS per day over the last 14 days'})}
|
||||||
labels={props.stats.active_runs_per_day_times.map(([start, _]) => DateTime.fromMillis(start).toLocaleString(DateTimeFormats.DATE_MED_NO_YEAR))}
|
labels={props.stats.active_runs_per_day_times.map(([start]) => DateTime.fromMillis(start).toLocaleString(DateTimeFormats.DATE_MED_NO_YEAR))}
|
||||||
data={props.stats.active_runs_per_day}
|
data={props.stats.active_runs_per_day}
|
||||||
tooltipTitleCallback={(date) => formatMessage({defaultMessage: 'Day: {date}'}, {date})}
|
tooltipTitleCallback={(date) => formatMessage({defaultMessage: 'Day: {date}'}, {date})}
|
||||||
tooltipLabelCallback={(numActiveRuns) => formatMessage({defaultMessage: '{numActiveRuns, plural, =0 {no active runs} =1 {# active run} other {# active runs}}'}, {numActiveRuns})}
|
tooltipLabelCallback={(numActiveRuns) => formatMessage({defaultMessage: '{numActiveRuns, plural, =0 {no active runs} =1 {# active run} other {# active runs}}'}, {numActiveRuns})}
|
||||||
@@ -169,7 +169,7 @@ const StatsView = (props: Props) => {
|
|||||||
<GraphBox>
|
<GraphBox>
|
||||||
<BarGraph
|
<BarGraph
|
||||||
title={formatMessage({defaultMessage: 'ACTIVE PARTICIPANTS per day over the last 14 days'})}
|
title={formatMessage({defaultMessage: 'ACTIVE PARTICIPANTS per day over the last 14 days'})}
|
||||||
labels={props.stats.active_participants_per_day_times.map(([start, _]) => DateTime.fromMillis(start).toLocaleString(DateTimeFormats.DATE_MED_NO_YEAR))}
|
labels={props.stats.active_participants_per_day_times.map(([start]) => DateTime.fromMillis(start).toLocaleString(DateTimeFormats.DATE_MED_NO_YEAR))}
|
||||||
data={props.stats.active_participants_per_day}
|
data={props.stats.active_participants_per_day}
|
||||||
color={'--center-channel-color-40'}
|
color={'--center-channel-color-40'}
|
||||||
tooltipTitleCallback={(date) => formatMessage({defaultMessage: 'Day: {date}'}, {date})}
|
tooltipTitleCallback={(date) => formatMessage({defaultMessage: 'Day: {date}'}, {date})}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import GenericModal, {DefaultFooterContainer} from 'src/components/widgets/gener
|
|||||||
import {postMessageToAdmins} from 'src/client';
|
import {postMessageToAdmins} from 'src/client';
|
||||||
import UpgradeModalFooter from 'src/components/backstage/upgrade_modal_footer';
|
import UpgradeModalFooter from 'src/components/backstage/upgrade_modal_footer';
|
||||||
|
|
||||||
import {getAdminAnalytics, isCurrentUserAdmin, isTeamEdition} from 'src/selectors';
|
import {isCurrentUserAdmin, isTeamEdition} from 'src/selectors';
|
||||||
|
|
||||||
import {AdminNotificationType} from 'src/constants';
|
import {AdminNotificationType} from 'src/constants';
|
||||||
import {isCloud} from 'src/license';
|
import {isCloud} from 'src/license';
|
||||||
@@ -33,9 +33,6 @@ const UpgradeModal = (props: Props) => {
|
|||||||
|
|
||||||
const [actionState, setActionState] = useState(ModalActionState.Uninitialized);
|
const [actionState, setActionState] = useState(ModalActionState.Uninitialized);
|
||||||
|
|
||||||
const analytics = useSelector(getAdminAnalytics);
|
|
||||||
const serverTotalUsers = analytics?.TOTAL_USERS || 0;
|
|
||||||
|
|
||||||
const requestLicenseSelfHosted = async () => {
|
const requestLicenseSelfHosted = async () => {
|
||||||
if (actionState === ModalActionState.Loading) {
|
if (actionState === ModalActionState.Loading) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -280,7 +280,6 @@ export const ChecklistItem = (props: ChecklistItemProps): React.ReactElement =>
|
|||||||
<TaskActions
|
<TaskActions
|
||||||
editable={isEditing || (!props.readOnly && !isSkipped())}
|
editable={isEditing || (!props.readOnly && !isSkipped())}
|
||||||
taskActions={taskActions}
|
taskActions={taskActions}
|
||||||
playbookRunId={props.playbookRunId}
|
|
||||||
onTaskActionsChange={onTaskActionsChange}
|
onTaskActionsChange={onTaskActionsChange}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import {openTaskActionsModal} from 'src/actions';
|
|||||||
interface TaskActionsProps {
|
interface TaskActionsProps {
|
||||||
taskActions?: TaskActionType[] | null
|
taskActions?: TaskActionType[] | null
|
||||||
onTaskActionsChange: (newTaskActions: TaskActionType[]) => void;
|
onTaskActionsChange: (newTaskActions: TaskActionType[]) => void;
|
||||||
playbookRunId?: string;
|
|
||||||
editable: boolean;
|
editable: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,7 +32,7 @@ const TaskActions = (props: TaskActionsProps) => {
|
|||||||
isPlaceholder={!(lenTasks > 0 && enabledAction)}
|
isPlaceholder={!(lenTasks > 0 && enabledAction)}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (props.editable) {
|
if (props.editable) {
|
||||||
dispatch(openTaskActionsModal(props.onTaskActionsChange, props.taskActions, props.playbookRunId));
|
dispatch(openTaskActionsModal(props.onTaskActionsChange, props.taskActions));
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -21,11 +21,10 @@ const MarkItemAsDoneActionType = 'mark_item_as_done';
|
|||||||
export const makeTaskActionsModalDefinition = (
|
export const makeTaskActionsModalDefinition = (
|
||||||
onTaskActionsChange: (newTaskActions: TaskActionType[]) => void,
|
onTaskActionsChange: (newTaskActions: TaskActionType[]) => void,
|
||||||
taskActions?: TaskActionType[] | null,
|
taskActions?: TaskActionType[] | null,
|
||||||
playbookRunId?: string,
|
|
||||||
) => ({
|
) => ({
|
||||||
modalId: ID,
|
modalId: ID,
|
||||||
dialogType: TaskActionsModal,
|
dialogType: TaskActionsModal,
|
||||||
dialogProps: {taskActions, onTaskActionsChange, playbookRunId},
|
dialogProps: {taskActions, onTaskActionsChange},
|
||||||
});
|
});
|
||||||
|
|
||||||
type KeywordsTriggerPayload = {keywords: string[]; user_ids: string[];}
|
type KeywordsTriggerPayload = {keywords: string[]; user_ids: string[];}
|
||||||
@@ -49,10 +48,9 @@ const markAsDonePayloadFromTaskAction = (taskAction: TaskActionType): MarkAsDone
|
|||||||
type Props = {
|
type Props = {
|
||||||
onTaskActionsChange: (newTaskActions: TaskActionType[]) => void,
|
onTaskActionsChange: (newTaskActions: TaskActionType[]) => void,
|
||||||
taskActions?: TaskActionType[] | null,
|
taskActions?: TaskActionType[] | null,
|
||||||
playbookRunId?: string,
|
|
||||||
} & Partial<ComponentProps<typeof GenericModal>>;
|
} & Partial<ComponentProps<typeof GenericModal>>;
|
||||||
|
|
||||||
const TaskActionsModal = ({onTaskActionsChange, taskActions, playbookRunId, ...modalProps}: Props) => {
|
const TaskActionsModal = ({onTaskActionsChange, taskActions, ...modalProps}: Props) => {
|
||||||
const {formatMessage} = useIntl();
|
const {formatMessage} = useIntl();
|
||||||
const emptyTask = {} as TaskActionType;
|
const emptyTask = {} as TaskActionType;
|
||||||
const taskAction = (taskActions && (taskActions.length > 0)) ? taskActions[0] : emptyTask;
|
const taskAction = (taskActions && (taskActions.length > 0)) ? taskActions[0] : emptyTask;
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ export const makePlaybookCreateModal = (props: PlaybookCreateModalProps) => ({
|
|||||||
|
|
||||||
export type PlaybookCreateModalProps = {
|
export type PlaybookCreateModalProps = {
|
||||||
startingName?: string
|
startingName?: string
|
||||||
startingTeamId?: string
|
|
||||||
startingTemplate?: string
|
startingTemplate?: string
|
||||||
startingDescription?: string
|
startingDescription?: string
|
||||||
startingPublic?: boolean
|
startingPublic?: boolean
|
||||||
@@ -45,7 +44,7 @@ const Body = styled.div`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const PlaybookCreateModal = ({startingName, startingTeamId, startingTemplate, startingDescription, startingPublic, ...modalProps}: PlaybookCreateModalProps) => {
|
const PlaybookCreateModal = ({startingName, startingTemplate, startingDescription, startingPublic, ...modalProps}: PlaybookCreateModalProps) => {
|
||||||
const {formatMessage} = useIntl();
|
const {formatMessage} = useIntl();
|
||||||
const [name, setName] = useState(startingName);
|
const [name, setName] = useState(startingName);
|
||||||
const teamId = useSelector(getCurrentTeamId);
|
const teamId = useSelector(getCurrentTeamId);
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ describe('durationFromQuery', () => {
|
|||||||
Settings.defaultLocale = locale;
|
Settings.defaultLocale = locale;
|
||||||
|
|
||||||
const duration = Duration.fromObject(durationObj);
|
const duration = Duration.fromObject(durationObj);
|
||||||
const [long, short, narrow] = [...queries].map((query) => durationFromQuery(locale, query));
|
const [long/*, short, narrow*/] = [...queries].map((query) => durationFromQuery(locale, query));
|
||||||
|
|
||||||
expect(long?.toMillis()).toBe(duration.toMillis());
|
expect(long?.toMillis()).toBe(duration.toMillis());
|
||||||
|
|
||||||
|
|||||||
@@ -27,14 +27,6 @@ interface DurationProps {
|
|||||||
truncate?: TruncateBehavior;
|
truncate?: TruncateBehavior;
|
||||||
}
|
}
|
||||||
|
|
||||||
const label = (num: number, style: FormatStyle, narrow: string, singular: string, plural: string) => {
|
|
||||||
if (style === 'narrow') {
|
|
||||||
return narrow;
|
|
||||||
}
|
|
||||||
|
|
||||||
return num >= 2 ? plural : singular;
|
|
||||||
};
|
|
||||||
|
|
||||||
const UNITS: DurationUnit[] = ['years', 'days', 'hours', 'minutes'];
|
const UNITS: DurationUnit[] = ['years', 'days', 'hours', 'minutes'];
|
||||||
|
|
||||||
export const formatDuration = (value: Duration, style: FormatStyle = 'narrow', truncate: TruncateBehavior = 'none') => {
|
export const formatDuration = (value: Duration, style: FormatStyle = 'narrow', truncate: TruncateBehavior = 'none') => {
|
||||||
|
|||||||
@@ -44,15 +44,6 @@ const UpdateRunModal = ({
|
|||||||
}
|
}
|
||||||
}, [run, run?.channel_id]);
|
}, [run, run?.channel_id]);
|
||||||
|
|
||||||
const header = (
|
|
||||||
<Header>
|
|
||||||
{isPlaybookRun ? formatMessage({defaultMessage: 'Link run to a different channel'}) : formatMessage({defaultMessage: 'Link checklist to a different channel'})}
|
|
||||||
<ModalSubheading>
|
|
||||||
{run?.name}
|
|
||||||
</ModalSubheading>
|
|
||||||
</Header>
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledGenericModal
|
<StyledGenericModal
|
||||||
cancelButtonText={formatMessage({defaultMessage: 'Cancel'})}
|
cancelButtonText={formatMessage({defaultMessage: 'Cancel'})}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ const ID = 'playbook_run_update';
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
playbookRunId: string;
|
playbookRunId: string;
|
||||||
teamId: string;
|
|
||||||
onSubmit: (newName: string) => void;
|
onSubmit: (newName: string) => void;
|
||||||
} & Partial<ComponentProps<typeof GenericModal>>;
|
} & Partial<ComponentProps<typeof GenericModal>>;
|
||||||
|
|
||||||
@@ -26,7 +25,6 @@ export const makeModalDefinition = (props: Props) => ({
|
|||||||
|
|
||||||
const UpdateRunModal = ({
|
const UpdateRunModal = ({
|
||||||
playbookRunId,
|
playbookRunId,
|
||||||
teamId,
|
|
||||||
onSubmit,
|
onSubmit,
|
||||||
...modalProps
|
...modalProps
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ const RHSHome = () => {
|
|||||||
telemetryEventForTemplate(template.title, 'use_template_option');
|
telemetryEventForTemplate(template.title, 'use_template_option');
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch(displayPlaybookCreateModal({startingTemplate: template?.title, startingTeamId: currentTeamId}));
|
dispatch(displayPlaybookCreateModal({startingTemplate: template?.title}));
|
||||||
};
|
};
|
||||||
|
|
||||||
const headerContent = (
|
const headerContent = (
|
||||||
|
|||||||
@@ -808,7 +808,7 @@ const ContextMenu = (props: ContextMenuProps) => {
|
|||||||
<FormattedMessage defaultMessage='Link run to a different channel'/>
|
<FormattedMessage defaultMessage='Link run to a different channel'/>
|
||||||
</StyledDropdownMenuItem>
|
</StyledDropdownMenuItem>
|
||||||
<StyledDropdownMenuItem
|
<StyledDropdownMenuItem
|
||||||
onClick={() => dispatch(openUpdateRunNameModal(props.playbookRunID, props.teamID, PlaybookRunType.Playbook, props.onUpdateName))}
|
onClick={() => dispatch(openUpdateRunNameModal(props.playbookRunID, props.onUpdateName))}
|
||||||
disabled={!props.canEditRun}
|
disabled={!props.canEditRun}
|
||||||
disabledAltText={formatMessage({defaultMessage: 'You do not have permission to edit this run'})}
|
disabledAltText={formatMessage({defaultMessage: 'You do not have permission to edit this run'})}
|
||||||
>
|
>
|
||||||
@@ -871,7 +871,7 @@ const ChannelChecklistContextMenu = (props: ChannelChecklistContextMenuProps) =>
|
|||||||
<FormattedMessage defaultMessage='Link checklist to a different channel'/>
|
<FormattedMessage defaultMessage='Link checklist to a different channel'/>
|
||||||
</StyledDropdownMenuItem>
|
</StyledDropdownMenuItem>
|
||||||
<StyledDropdownMenuItem
|
<StyledDropdownMenuItem
|
||||||
onClick={() => dispatch(openUpdateRunNameModal(props.playbookRunID, props.teamID, PlaybookRunType.ChannelChecklist, props.onUpdateName))}
|
onClick={() => dispatch(openUpdateRunNameModal(props.playbookRunID, props.onUpdateName))}
|
||||||
disabled={!props.canEditRun}
|
disabled={!props.canEditRun}
|
||||||
disabledAltText={formatMessage({defaultMessage: 'You do not have permission to edit this checklist'})}
|
disabledAltText={formatMessage({defaultMessage: 'You do not have permission to edit this checklist'})}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import General from 'mattermost-redux/constants/general';
|
|||||||
import {FormattedMessage} from 'react-intl';
|
import {FormattedMessage} from 'react-intl';
|
||||||
|
|
||||||
import LoadingSpinner from 'src/components/assets/loading_spinner';
|
import LoadingSpinner from 'src/components/assets/loading_spinner';
|
||||||
import {getAdminAnalytics, isTeamEdition} from 'src/selectors';
|
import {isTeamEdition} from 'src/selectors';
|
||||||
import StartTrialNotice from 'src/components/backstage/start_trial_notice';
|
import StartTrialNotice from 'src/components/backstage/start_trial_notice';
|
||||||
import ConvertEnterpriseNotice from 'src/components/backstage/convert_enterprise_notice';
|
import ConvertEnterpriseNotice from 'src/components/backstage/convert_enterprise_notice';
|
||||||
import {postMessageToAdmins} from 'src/client';
|
import {postMessageToAdmins} from 'src/client';
|
||||||
@@ -127,9 +127,6 @@ const UpgradeBanner = (props: Props) => {
|
|||||||
const isServerTeamEdition = useSelector(isTeamEdition);
|
const isServerTeamEdition = useSelector(isTeamEdition);
|
||||||
const openTrialFormModal = useOpenStartTrialFormModal();
|
const openTrialFormModal = useOpenStartTrialFormModal();
|
||||||
|
|
||||||
const analytics = useSelector(getAdminAnalytics);
|
|
||||||
const serverTotalUsers = analytics?.TOTAL_USERS || 0;
|
|
||||||
|
|
||||||
const endUserMainAction = async () => {
|
const endUserMainAction = async () => {
|
||||||
if (actionState === ActionState.Loading) {
|
if (actionState === ActionState.Loading) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* eslint-disable */
|
||||||
import {TypedDocumentNode as DocumentNode, ResultOf} from '@graphql-typed-document-node/core';
|
import {TypedDocumentNode as DocumentNode, ResultOf} from '@graphql-typed-document-node/core';
|
||||||
|
|
||||||
export type FragmentType<TDocumentType extends DocumentNode<any, any>> = TDocumentType extends DocumentNode<
|
export type FragmentType<TDocumentType extends DocumentNode<any, any>> = TDocumentType extends DocumentNode<
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ describe('useEnsureProfile', () => {
|
|||||||
useDispatchSpy.mockReturnValue(mockDispatchFn);
|
useDispatchSpy.mockReturnValue(mockDispatchFn);
|
||||||
|
|
||||||
const userId = 'unknown';
|
const userId = 'unknown';
|
||||||
const {rerender} = renderHook(() => {
|
renderHook(() => {
|
||||||
useEnsureProfile(userId);
|
useEnsureProfile(userId);
|
||||||
});
|
});
|
||||||
expect(mockDispatchFn).toHaveBeenCalledTimes(1);
|
expect(mockDispatchFn).toHaveBeenCalledTimes(1);
|
||||||
@@ -184,7 +184,7 @@ describe('useEnsureProfiles', () => {
|
|||||||
useDispatchSpy.mockReturnValue(mockDispatchFn);
|
useDispatchSpy.mockReturnValue(mockDispatchFn);
|
||||||
|
|
||||||
const userIds = ['user1', 'user2', 'unknown'];
|
const userIds = ['user1', 'user2', 'unknown'];
|
||||||
const {rerender} = renderHook(() => {
|
renderHook(() => {
|
||||||
useEnsureProfiles(userIds);
|
useEnsureProfiles(userIds);
|
||||||
});
|
});
|
||||||
expect(mockDispatchFn).toHaveBeenCalledTimes(1);
|
expect(mockDispatchFn).toHaveBeenCalledTimes(1);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {render, unmountComponentAtNode} from 'react-dom';
|
|||||||
import {Store, Unsubscribe} from 'redux';
|
import {Store, Unsubscribe} from 'redux';
|
||||||
import {Redirect, useLocation, useRouteMatch} from 'react-router-dom';
|
import {Redirect, useLocation, useRouteMatch} from 'react-router-dom';
|
||||||
import {GlobalState} from '@mattermost/types/store';
|
import {GlobalState} from '@mattermost/types/store';
|
||||||
import {getConfig} from 'mattermost-redux/selectors/entities/general';
|
|
||||||
import {Client4} from 'mattermost-redux/client';
|
import {Client4} from 'mattermost-redux/client';
|
||||||
import WebsocketEvents from 'mattermost-redux/constants/websocket';
|
import WebsocketEvents from 'mattermost-redux/constants/websocket';
|
||||||
import {General} from 'mattermost-redux/constants';
|
import {General} from 'mattermost-redux/constants';
|
||||||
@@ -203,7 +202,6 @@ export default class Plugin {
|
|||||||
|
|
||||||
// App Bar icon
|
// App Bar icon
|
||||||
if (registry.registerAppBarComponent) {
|
if (registry.registerAppBarComponent) {
|
||||||
const siteUrl = getConfig(store.getState())?.SiteURL || '';
|
|
||||||
registry.registerAppBarComponent(appIcon, boundToggleRHSAction, ChannelHeaderTooltip);
|
registry.registerAppBarComponent(appIcon, boundToggleRHSAction, ChannelHeaderTooltip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,10 +93,6 @@ export interface RunMetricData {
|
|||||||
value: number | null;
|
value: number | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isString(arg: any): arg is string {
|
|
||||||
return Boolean(typeof arg === 'string');
|
|
||||||
}
|
|
||||||
|
|
||||||
export function playbookRunIsActive(playbookRun: PlaybookRun): boolean {
|
export function playbookRunIsActive(playbookRun: PlaybookRun): boolean {
|
||||||
return playbookRun.current_status === PlaybookRunStatus.InProgress;
|
return playbookRun.current_status === PlaybookRunStatus.InProgress;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ export function globalSettingsSetDefaults(globalSettings?: Partial<GlobalSetting
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Strip bad values from partial
|
// Strip bad values from partial
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
const fixedGlobalSettings = Object.fromEntries(Object.entries(globalSettings).filter(([_, value]) => value !== null));
|
const fixedGlobalSettings = Object.fromEntries(Object.entries(globalSettings).filter(([_, value]) => value !== null));
|
||||||
|
|
||||||
return {...defaults, ...fixedGlobalSettings};
|
return {...defaults, ...fixedGlobalSettings};
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user