generated from mattermost/mattermost-plugin-starter-template
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:mattermost-community/mattermost-p…
…lugin-todo into fix_issue_216
- Loading branch information
Showing
10 changed files
with
199 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 2 | ||
updates: | ||
# Enable version updates for GOLang dependencies | ||
- package-ecosystem: "gomod" | ||
directory: "/" | ||
schedule: | ||
interval: "monthly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,10 @@ | ||
name: cd | ||
on: | ||
workflow_run: | ||
workflows: ["ci"] | ||
branches-ignore: ["*"] | ||
types: | ||
- completed | ||
push: | ||
tags: | ||
- "v*" | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
plugin-cd: | ||
uses: mattermost/actions-workflows/.github/workflows/plugin-cd.yml@main | ||
uses: mattermost/actions-workflows/.github/workflows/community-plugin-cd.yml@d9defa3e455bdbf889573e112ad8d05b91d66b4c | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,12 @@ | ||
name: ci | ||
on: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- "v*" | ||
pull_request: | ||
|
||
permissions: | ||
contents: read | ||
- main | ||
|
||
jobs: | ||
plugin-ci: | ||
uses: mattermost/actions-workflows/.github/workflows/plugin-ci.yml@main | ||
uses: mattermost/actions-workflows/.github/workflows/community-plugin-ci.yml@139a051e8651e6246e3764fe342297b73120e590 | ||
secrets: inherit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
import {test} from '@playwright/test'; | ||
import core from './todo_plugin.spec'; | ||
|
||
import '../support/init_test'; | ||
|
||
test.describe(core.connected); | ||
core.connected(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
import React, {useState, useCallback} from 'react'; | ||
import PropTypes from 'prop-types'; | ||
|
||
import AutocompleteSelector from '../user_selector/autocomplete_selector'; | ||
import Button from '../../widget/buttons/button'; | ||
import IconButton from '../../widget/iconButton/iconButton'; | ||
|
||
import CompassIcon from '../icons/compassIcons'; | ||
|
||
import {useEscapeKey} from '../../hooks/useEscapeKey'; | ||
|
||
const AssigneeForm = ( | ||
{ | ||
close, | ||
autocompleteUsers, | ||
theme, | ||
getAssignee, | ||
removeAssignee, | ||
removeEditingTodo, | ||
changeAssignee, | ||
editingTodo, | ||
}, | ||
) => { | ||
const [assignee, setAssignee] = useState(); | ||
useEscapeKey(close); | ||
const submit = useCallback(() => { | ||
if (editingTodo && assignee) { | ||
changeAssignee(editingTodo, assignee.username); | ||
removeEditingTodo(); | ||
} else if (assignee) { | ||
getAssignee(assignee); | ||
} else { | ||
removeAssignee(); | ||
} | ||
close(); | ||
}, [close, changeAssignee, removeAssignee, getAssignee, assignee, removeEditingTodo, editingTodo]); | ||
|
||
const closeModal = () => { | ||
removeEditingTodo(); | ||
close(); | ||
}; | ||
|
||
const changeAssigneeDropdown = (selected) => { | ||
setAssignee(selected); | ||
}; | ||
|
||
const style = getStyle(theme); | ||
|
||
return ( | ||
<div | ||
style={style.backdrop} | ||
> | ||
<div style={style.modal}> | ||
<h1 style={style.heading}>{'Assign todo to…'}</h1> | ||
<IconButton | ||
size='medium' | ||
style={style.closeIcon} | ||
onClick={closeModal} | ||
icon={<CompassIcon icon='close'/>} | ||
/> | ||
<AutocompleteSelector | ||
autoFocus={true} | ||
id='send_to_user' | ||
loadOptions={autocompleteUsers} | ||
onSelected={changeAssigneeDropdown} | ||
placeholder={''} | ||
theme={theme} | ||
/> | ||
<div | ||
className='todoplugin-button-container' | ||
style={style.buttons} | ||
> | ||
<Button | ||
emphasis='tertiary' | ||
size='medium' | ||
onClick={closeModal} | ||
> | ||
{'Cancel'} | ||
</Button> | ||
<Button | ||
emphasis='primary' | ||
size='medium' | ||
onClick={submit} | ||
disabled={!assignee} | ||
> | ||
{'Assign'} | ||
</Button> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
AssigneeForm.propTypes = { | ||
close: PropTypes.func.isRequired, | ||
theme: PropTypes.object.isRequired, | ||
autocompleteUsers: PropTypes.func.isRequired, | ||
getAssignee: PropTypes.func.isRequired, | ||
editingTodo: PropTypes.string.isRequired, | ||
removeAssignee: PropTypes.func.isRequired, | ||
removeEditingTodo: PropTypes.func.isRequired, | ||
changeAssignee: PropTypes.func.isRequired, | ||
}; | ||
|
||
const getStyle = (theme) => ({ | ||
backdrop: { | ||
position: 'absolute', | ||
display: 'flex', | ||
top: 0, | ||
left: 0, | ||
right: 0, | ||
bottom: 0, | ||
backgroundColor: 'rgba(0, 0, 0, 0.50)', | ||
zIndex: 2000, | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}, | ||
modal: { | ||
position: 'relative', | ||
width: 600, | ||
padding: 24, | ||
borderRadius: 8, | ||
maxWidth: '100%', | ||
color: theme.centerChannelColor, | ||
backgroundColor: theme.centerChannelBg, | ||
}, | ||
buttons: { | ||
marginTop: 24, | ||
}, | ||
heading: { | ||
fontSize: 20, | ||
fontWeight: 600, | ||
margin: '0 0 24px 0', | ||
}, | ||
closeIcon: { | ||
position: 'absolute', | ||
top: 8, | ||
right: 8, | ||
}, | ||
}); | ||
|
||
export default AssigneeForm; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.