Cleanup model imports
This commit is contained in:
parent
a7f88c1103
commit
30e912c3f9
13 changed files with 57 additions and 62 deletions
|
@ -2,9 +2,7 @@
|
|||
// See LICENSE.txt for license information.
|
||||
import {Utils} from '../utils'
|
||||
|
||||
import {IBlock} from '../blocks/block'
|
||||
|
||||
import {MutableBlock} from './block'
|
||||
import {IBlock, MutableBlock} from './block'
|
||||
|
||||
type PropertyType = 'text' | 'number' | 'select' | 'multiSelect' | 'date' | 'person' | 'file' | 'checkbox' | 'url' | 'email' | 'phone' | 'createdTime' | 'createdBy' | 'updatedTime' | 'updatedBy'
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
import {IBlock} from '../blocks/block'
|
||||
import {FilterGroup} from '../filterGroup'
|
||||
import {Utils} from '../utils'
|
||||
|
||||
import {MutableBlock} from './block'
|
||||
import {IBlock, MutableBlock} from './block'
|
||||
import {FilterGroup} from './filterGroup'
|
||||
|
||||
type IViewType = 'board' | 'table' // | 'calendar' | 'list' | 'gallery'
|
||||
type ISortOption = { propertyId: '__title' | string, reversed: boolean }
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
import {Utils} from '../utils'
|
||||
import {IBlock} from '../blocks/block'
|
||||
|
||||
import {MutableBlock} from './block'
|
||||
import {IBlock, MutableBlock} from './block'
|
||||
|
||||
interface Card extends IBlock {
|
||||
readonly icon: string
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
import {IBlock} from '../blocks/block'
|
||||
|
||||
import {MutableBlock} from './block'
|
||||
import {IBlock, MutableBlock} from './block'
|
||||
|
||||
type CommentBlock = IBlock
|
||||
|
||||
|
|
|
@ -12,4 +12,3 @@ class MutableDividerBlock extends MutableContentBlock implements DividerBlock {
|
|||
}
|
||||
|
||||
export {DividerBlock, MutableDividerBlock}
|
||||
|
27
webapp/src/blocks/filterClause.ts
Normal file
27
webapp/src/blocks/filterClause.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
import {Utils} from '../utils'
|
||||
|
||||
type FilterCondition = 'includes' | 'notIncludes' | 'isEmpty' | 'isNotEmpty'
|
||||
|
||||
class FilterClause {
|
||||
propertyId: string
|
||||
condition: FilterCondition
|
||||
values: string[]
|
||||
|
||||
constructor(o: any = {}) {
|
||||
this.propertyId = o.propertyId || ''
|
||||
this.condition = o.condition || 'includes'
|
||||
this.values = o.values?.slice() || []
|
||||
}
|
||||
|
||||
isEqual(o: FilterClause): boolean {
|
||||
return (
|
||||
this.propertyId === o.propertyId &&
|
||||
this.condition === o.condition &&
|
||||
Utils.arraysEqual(this.values, o.values)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export {FilterClause, FilterCondition}
|
|
@ -2,8 +2,8 @@
|
|||
// See LICENSE.txt for license information.
|
||||
import {IPropertyTemplate} from './blocks/board'
|
||||
import {Card} from './blocks/card'
|
||||
import {FilterClause} from './filterClause'
|
||||
import {FilterGroup} from './filterGroup'
|
||||
import {FilterClause} from './blocks/filterClause'
|
||||
import {FilterGroup} from './blocks/filterGroup'
|
||||
import {Utils} from './utils'
|
||||
|
||||
class CardFilter {
|
||||
|
|
|
@ -4,9 +4,10 @@ import React from 'react'
|
|||
import {FormattedMessage, injectIntl, IntlShape} from 'react-intl'
|
||||
|
||||
import {IPropertyTemplate} from '../blocks/board'
|
||||
import {FilterClause, FilterCondition} from '../filterClause'
|
||||
import {FilterGroup} from '../filterGroup'
|
||||
import {FilterClause, FilterCondition} from '../blocks/filterClause'
|
||||
import {FilterGroup} from '../blocks/filterGroup'
|
||||
import mutator from '../mutator'
|
||||
import {OctoUtils} from '../octoUtils'
|
||||
import {Utils} from '../utils'
|
||||
import {BoardTree} from '../viewModel/boardTree'
|
||||
import Button from '../widgets/buttons/button'
|
||||
|
@ -91,7 +92,7 @@ class FilterComponent extends React.Component<Props> {
|
|||
</Menu>
|
||||
</MenuWrapper>
|
||||
<MenuWrapper>
|
||||
<Button>{FilterClause.filterConditionDisplayString(filter.condition, intl)}</Button>
|
||||
<Button>{OctoUtils.filterConditionDisplayString(filter.condition, intl)}</Button>
|
||||
<Menu>
|
||||
<Menu.Text
|
||||
id='includes'
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
import {IntlShape} from 'react-intl'
|
||||
|
||||
import {Utils} from './utils'
|
||||
|
||||
type FilterCondition = 'includes' | 'notIncludes' | 'isEmpty' | 'isNotEmpty'
|
||||
|
||||
class FilterClause {
|
||||
propertyId: string
|
||||
condition: FilterCondition
|
||||
values: string[]
|
||||
|
||||
static filterConditionDisplayString(filterCondition: FilterCondition, intl: IntlShape): string {
|
||||
switch (filterCondition) {
|
||||
case 'includes': return intl.formatMessage({id: 'Filter.includes', defaultMessage: 'includes'})
|
||||
case 'notIncludes': return intl.formatMessage({id: 'Filter.not-includes', defaultMessage: 'doesn\'t include'})
|
||||
case 'isEmpty': return intl.formatMessage({id: 'Filter.is-empty', defaultMessage: 'is empty'})
|
||||
case 'isNotEmpty': return intl.formatMessage({id: 'Filter.is-not-empty', defaultMessage: 'is not empty'})
|
||||
default: {
|
||||
Utils.assertFailure()
|
||||
return '(unknown)'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
constructor(o: any = {}) {
|
||||
this.propertyId = o.propertyId || ''
|
||||
this.condition = o.condition || 'includes'
|
||||
this.values = o.values?.slice() || []
|
||||
}
|
||||
|
||||
isEqual(o: FilterClause): boolean {
|
||||
return (
|
||||
this.propertyId === o.propertyId &&
|
||||
this.condition === o.condition &&
|
||||
Utils.arraysEqual(this.values, o.values)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export {FilterClause, FilterCondition}
|
|
@ -5,8 +5,8 @@ import {IBlock, MutableBlock} from './blocks/block'
|
|||
import {Board, IPropertyOption, IPropertyTemplate, MutableBoard, PropertyType} from './blocks/board'
|
||||
import {BoardView, ISortOption, MutableBoardView} from './blocks/boardView'
|
||||
import {Card, MutableCard} from './blocks/card'
|
||||
import {FilterGroup} from './blocks/filterGroup'
|
||||
import {MutableImageBlock} from './blocks/imageBlock'
|
||||
import {FilterGroup} from './filterGroup'
|
||||
import octoClient from './octoClient'
|
||||
import {OctoUtils} from './octoUtils'
|
||||
import undoManager from './undomanager'
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import {IntlShape} from 'react-intl'
|
||||
|
||||
import {IBlock, MutableBlock} from './blocks/block'
|
||||
import {IPropertyTemplate, MutableBoard} from './blocks/board'
|
||||
import {MutableBoardView} from './blocks/boardView'
|
||||
|
@ -9,6 +11,7 @@ import {MutableCommentBlock} from './blocks/commentBlock'
|
|||
import {MutableDividerBlock} from './blocks/dividerBlock'
|
||||
import {MutableImageBlock} from './blocks/imageBlock'
|
||||
import {MutableTextBlock} from './blocks/textBlock'
|
||||
import {FilterCondition} from './blocks/filterClause'
|
||||
import {Utils} from './utils'
|
||||
|
||||
class OctoUtils {
|
||||
|
@ -141,6 +144,19 @@ class OctoUtils {
|
|||
const newSourceBlock = newBlocks.find((block) => block.id === newSourceBlockId)!
|
||||
return [newBlocks, newSourceBlock, idMap]
|
||||
}
|
||||
|
||||
static filterConditionDisplayString(filterCondition: FilterCondition, intl: IntlShape): string {
|
||||
switch (filterCondition) {
|
||||
case 'includes': return intl.formatMessage({id: 'Filter.includes', defaultMessage: 'includes'})
|
||||
case 'notIncludes': return intl.formatMessage({id: 'Filter.not-includes', defaultMessage: 'doesn\'t include'})
|
||||
case 'isEmpty': return intl.formatMessage({id: 'Filter.is-empty', defaultMessage: 'is empty'})
|
||||
case 'isNotEmpty': return intl.formatMessage({id: 'Filter.is-not-empty', defaultMessage: 'is not empty'})
|
||||
default: {
|
||||
Utils.assertFailure()
|
||||
return '(unknown)'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {OctoUtils}
|
||||
|
|
|
@ -6,10 +6,10 @@ import {MutableBoardView} from '../blocks/boardView'
|
|||
import {Card, MutableCard} from '../blocks/card'
|
||||
import {MutableCommentBlock} from '../blocks/commentBlock'
|
||||
import {DividerBlock, MutableDividerBlock} from '../blocks/dividerBlock'
|
||||
import {FilterClause} from '../blocks/filterClause'
|
||||
import {FilterGroup} from '../blocks/filterGroup'
|
||||
import {ImageBlock, MutableImageBlock} from '../blocks/imageBlock'
|
||||
import {MutableTextBlock, TextBlock} from '../blocks/textBlock'
|
||||
import {FilterClause} from '../filterClause'
|
||||
import {FilterGroup} from '../filterGroup'
|
||||
|
||||
class TestBlockFactory {
|
||||
static createBoard(): MutableBoard {
|
||||
|
|
Loading…
Reference in a new issue