Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: issue manage only show table #3394

Merged
merged 5 commits into from
Dec 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions conf/dop/dop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,12 @@ component-protocol:
# components
component-protocol.components.issue-manage.content:
component-protocol.components.issue-manage.head:
component-protocol.components.issue-manage.issueAddButton:
component-protocol.components.issue-manage.issueExport:
component-protocol.components.issue-manage.issueFilter:
component-protocol.components.issue-manage.issueGantt:
component-protocol.components.issue-manage.issueImport:
component-protocol.components.issue-manage.issueKanban:
component-protocol.components.issue-manage.issueManage:
component-protocol.components.issue-manage.issueOperations:
component-protocol.components.issue-manage.issueTable:
component-protocol.components.issue-manage.issueViewGroup:
component-protocol.components.issue-manage.topHead:

component-protocol.components.code-coverage.treeMapChart:
component-protocol.components.code-coverage.codeCoverChart:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ require (
github.com/dsnet/compress v0.0.1 // indirect
github.com/dustin/go-humanize v1.0.0
github.com/elastic/cloud-on-k8s v0.0.0-20210205172912-5ce0eca90c60
github.com/erda-project/erda-infra v0.0.0-20211217035131-14a9f37bb4dd
github.com/erda-project/erda-infra v0.0.0-20211217090749-0ceead758b74
github.com/erda-project/erda-oap-thirdparty-protocol v0.0.0-20210907135609-15886a136d5b
github.com/erda-project/erda-proto-go v0.0.0
github.com/erda-project/erda-sourcecov v0.1.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,8 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7
github.com/erda-project/elastic v0.0.1-ex h1:5ajfxQ5S5YjpzFqY9LzL9hiKWCn6q/JDT4n8sNv7+pU=
github.com/erda-project/elastic v0.0.1-ex/go.mod h1:iAVsas6fcmt9pxtge1+dErMhecv+RLSXlD4rnZRJVW0=
github.com/erda-project/erda-infra v0.0.0-20211209074404-32e7888e4551/go.mod h1:JEXUFWDC/a97+3AgX/cL4xRlqL9vTDM+wVV3Ee5FXYI=
github.com/erda-project/erda-infra v0.0.0-20211217035131-14a9f37bb4dd h1:Eck8DpbYmjEP8ldYe0bZwjqGjAMKwNyZyvo+WYJ8d6E=
github.com/erda-project/erda-infra v0.0.0-20211217035131-14a9f37bb4dd/go.mod h1:JEXUFWDC/a97+3AgX/cL4xRlqL9vTDM+wVV3Ee5FXYI=
github.com/erda-project/erda-infra v0.0.0-20211217090749-0ceead758b74 h1:sMky2jlYdExMQaQ6xGaD0BnrqSil9yvEwP0fPOGGswc=
github.com/erda-project/erda-infra v0.0.0-20211217090749-0ceead758b74/go.mod h1:JEXUFWDC/a97+3AgX/cL4xRlqL9vTDM+wVV3Ee5FXYI=
github.com/erda-project/erda-oap-thirdparty-protocol v0.0.0-20210907135609-15886a136d5b h1:GWf2ChasZFerFwQoTokIvjJLWH57ligTSLD2hUb7UWk=
github.com/erda-project/erda-oap-thirdparty-protocol v0.0.0-20210907135609-15886a136d5b/go.mod h1:H/f81Thef2Tnz4nUeLt0r4VwHdOznthpyXBwT9vDWo0=
github.com/erda-project/erda-sourcecov v0.1.0 h1:iLvoMsQ1xX81KNOW98BKr85Vs7sSazrIDEphLYdmgP4=
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright (c) 2021 Terminus, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package gshelper

import (
"github.com/mitchellh/mapstructure"

"github.com/erda-project/erda-infra/providers/component-protocol/cptype"
"github.com/erda-project/erda/apistructs"
)

const (
keyIssuePagingRequest = "IssuePagingRequest"
)

type GSHelper struct {
gs *cptype.GlobalStateData
}

func NewGSHelper(gs *cptype.GlobalStateData) *GSHelper {
return &GSHelper{gs: gs}
}

func assign(src, dst interface{}) error {
if src == nil || dst == nil {
return nil
}

return mapstructure.Decode(src, dst)
}

func (h *GSHelper) SetIssuePagingRequest(req apistructs.IssuePagingRequest) {
if h.gs == nil {
return
}
(*h.gs)[keyIssuePagingRequest] = req
}

func (h *GSHelper) GetIssuePagingRequest() (*apistructs.IssuePagingRequest, bool) {
if h.gs == nil {
return nil, false
}
v, ok := (*h.gs)[keyIssuePagingRequest]
if !ok {
return nil, false
}
var req apistructs.IssuePagingRequest
_ = assign(v, &req)
return &req, true
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ import (
"github.com/erda-project/erda-infra/providers/component-protocol/cptype"
"github.com/erda-project/erda-infra/providers/component-protocol/utils/cputil"
"github.com/erda-project/erda/bundle"
"github.com/erda-project/erda/modules/dop/component-protocol/components/issue-manage/common/gshelper"
"github.com/erda-project/erda/modules/dop/component-protocol/types"
"github.com/erda-project/erda/modules/dop/services/issuefilterbm"
"github.com/erda-project/erda/modules/dop/services/issuestate"
)

func (f *ComponentFilter) InitFromProtocol(ctx context.Context, c *cptype.Component) error {
func (f *ComponentFilter) InitFromProtocol(ctx context.Context, c *cptype.Component, gs *cptype.GlobalStateData) error {
// component 序列化
b, err := json.Marshal(c)
if err != nil {
Expand All @@ -46,5 +47,8 @@ func (f *ComponentFilter) InitFromProtocol(ctx context.Context, c *cptype.Compon
return err
}

// gs
f.gsHelper = gshelper.NewGSHelper(gs)

return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/erda-project/erda-infra/providers/component-protocol/utils/cputil"
"github.com/erda-project/erda/apistructs"
"github.com/erda-project/erda/bundle"
"github.com/erda-project/erda/modules/dop/component-protocol/components/issue-manage/common/gshelper"
"github.com/erda-project/erda/modules/dop/services/issuefilterbm"
"github.com/erda-project/erda/modules/dop/services/issuestate"
"github.com/erda-project/erda/modules/openapi/component-protocol/components/base"
Expand All @@ -39,6 +40,7 @@ type ComponentFilter struct {
base.DefaultProvider
Bms []issuefilterbm.MyFilterBm `json:"-"` // bookmarks
FlushOptsFromBm string `json:"-"` // bm ID
gsHelper *gshelper.GSHelper
}

// FrontendConditions 前端支持的过滤参数
Expand Down Expand Up @@ -272,48 +274,6 @@ func (f *ComponentFilter) generateFrontendConditionProps(ctx context.Context, fi
})
}

v, ok := state.IssueViewGroupChildrenValue["kanban"]
if state.IssueViewGroupValue != "kanban" || !ok || v != "status" {
statesMap, err := f.issueStateSvc.GetIssueStatesMap(&apistructs.IssueStatesGetRequest{
ProjectID: f.InParams.ProjectID,
})
if err != nil {
return nil
}

status := filter.PropCondition{
Key: PropConditionKeyStates,
Label: cputil.I18n(ctx, "state"),
EmptyText: cputil.I18n(ctx, "all"),
Fixed: true,
ShowIndex: 3,
HaveFilter: false,
Type: filter.PropConditionTypeSelect,
Placeholder: "",
Options: func() []filter.PropConditionOption {
// open := filter.PropConditionOption{Label: cputil.I18n(ctx, "open"), Value: apistructs.IssueStateBelongOpen, Icon: ""}
// reopen := filter.PropConditionOption{Label: cputil.I18n(ctx, "reopen"), Value: apistructs.IssueStateBelongReopen, Icon: ""}
// resolved := filter.PropConditionOption{Label: cputil.I18n(ctx, "resolved"), Value: apistructs.IssueStateBelongResolved, Icon: ""}
// wontfix := filter.PropConditionOption{Label: cputil.I18n(ctx, "wontfix"), Value: apistructs.IssueStateBelongWontfix, Icon: ""}
// closed := filter.PropConditionOption{Label: cputil.I18n(ctx, "closed"), Value: apistructs.IssueStateBelongClosed, Icon: ""}
// working := filter.PropConditionOption{Label: cputil.I18n(ctx, "working"), Value: apistructs.IssueStateBelongWorking, Icon: ""}
// done := filter.PropConditionOption{Label: cputil.I18n(ctx, "done"), Value: apistructs.IssueStateBelongDone, Icon: ""}
switch fixedIssueType {
case "ALL":
return convertAllConditions(ctx, statesMap)
case apistructs.IssueTypeRequirement.String():
return convertConditions(statesMap[apistructs.IssueTypeRequirement])
case apistructs.IssueTypeTask.String():
return convertConditions(statesMap[apistructs.IssueTypeTask])
case apistructs.IssueTypeBug.String():
return convertConditions(statesMap[apistructs.IssueTypeBug])
}
return nil
}(),
}
conditionProps = append(conditionProps[:2], append([]filter.PropCondition{status}, conditionProps[2:]...)...)
}

return conditionProps
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,7 @@ func Test_convertAllConditions(t *testing.T) {

func Test_generateFrontendConditionProps(t *testing.T) {
ctx := context.WithValue(context.Background(), cptype.GlobalInnerKeyCtxSDK, &cptype.SDK{Tran: &MockTran{}})
f := ComponentFilter{State: State{
IssueViewGroupValue: "kanban",
IssueViewGroupChildrenValue: map[string]string{"kanban": "status"},
}}
f := ComponentFilter{State: State{}}
props := f.generateFrontendConditionProps(ctx, "ALL", f.State)
assert.True(t, len(props) > 0)
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func getMeta(ori map[string]interface{}, dst interface{}) error {

func (f *ComponentFilter) Render(ctx context.Context, c *cptype.Component, scenario cptype.Scenario, event cptype.ComponentEvent, gs *cptype.GlobalStateData) error {
// init filter
if err := f.InitFromProtocol(ctx, c); err != nil {
if err := f.InitFromProtocol(ctx, c, gs); err != nil {
return err
}

Expand Down Expand Up @@ -177,10 +177,11 @@ func (f *ComponentFilter) PostSetState() error {
// condition values

// issuePagingRequest
f.State.IssuePagingRequest, err = f.generateIssuePagingRequest()
issuePagingRequest, err := f.generateIssuePagingRequest()
if err != nil {
return err
}
f.gsHelper.SetIssuePagingRequest(issuePagingRequest)

return nil
}
Expand Down
Loading