-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(data): added data results preview in various formats
AB#45
- Loading branch information
Showing
13 changed files
with
176 additions
and
14 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,12 @@ | ||
package constants | ||
|
||
const ( | ||
DataFieldTypeGeneral = "general" | ||
DataFieldTypeNumeric = "numeric" | ||
DataFieldTypeDate = "date" | ||
DataFieldTypeCurrency = "currency" | ||
DataFieldTypeUrl = "url" | ||
DataFieldTypeImage = "image" | ||
DataFieldTypeAudio = "audio" | ||
DataFieldTypeVideo = "video" | ||
) |
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 |
---|---|---|
@@ -1,3 +1,71 @@ | ||
package controllers | ||
|
||
var DataCollectionController ListController | ||
import ( | ||
"github.com/crawlab-team/crawlab-core/interfaces" | ||
"github.com/crawlab-team/crawlab-core/models/service" | ||
"go.uber.org/dig" | ||
) | ||
|
||
var DataCollectionController *dataCollectionController | ||
|
||
func getDataCollectionActions() []Action { | ||
//ctx := newDataCollectionContext() | ||
return []Action{} | ||
} | ||
|
||
type dataCollectionController struct { | ||
ListActionControllerDelegate | ||
d ListActionControllerDelegate | ||
ctx *dataCollectionContext | ||
} | ||
|
||
type dataCollectionContext struct { | ||
modelSvc service.ModelService | ||
resultSvc interfaces.ResultService | ||
} | ||
|
||
var _dataCollectionCtx *dataCollectionContext | ||
|
||
func newDataCollectionContext() *dataCollectionContext { | ||
if _dataCollectionCtx != nil { | ||
return _dataCollectionCtx | ||
} | ||
|
||
// context | ||
ctx := &dataCollectionContext{} | ||
|
||
// dependency injection | ||
c := dig.New() | ||
if err := c.Provide(service.NewService); err != nil { | ||
panic(err) | ||
} | ||
if err := c.Invoke(func( | ||
modelSvc service.ModelService, | ||
) { | ||
ctx.modelSvc = modelSvc | ||
}); err != nil { | ||
panic(err) | ||
} | ||
|
||
_dataCollectionCtx = ctx | ||
|
||
return ctx | ||
} | ||
|
||
func newDataCollectionController() *dataCollectionController { | ||
actions := getDataCollectionActions() | ||
modelSvc, err := service.GetService() | ||
if err != nil { | ||
panic(err) | ||
} | ||
|
||
ctr := NewListPostActionControllerDelegate(ControllerIdDataCollection, modelSvc.GetBaseService(interfaces.ModelIdDataCollection), actions) | ||
d := NewListPostActionControllerDelegate(ControllerIdDataCollection, modelSvc.GetBaseService(interfaces.ModelIdDataCollection), actions) | ||
ctx := newDataCollectionContext() | ||
|
||
return &dataCollectionController{ | ||
ListActionControllerDelegate: *ctr, | ||
d: *d, | ||
ctx: ctx, | ||
} | ||
} |
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
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,6 @@ | ||
package entity | ||
|
||
type DataField struct { | ||
Key string `json:"key" bson:"key"` | ||
Type string `json:"type" bson:"type"` | ||
} |
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
This file was deleted.
Oops, something went wrong.
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