(api-refactor): Refactored GQL server APIs and updated frontend dir (#3579)

* Updated GQL Schema naming convention and docs (#3434)

* schema fix for naming convention and doc

Signed-off-by: Soumya Ghosh Dastidar <gdsoumya@gmail.com>

* splitted the schema into multiple gql files

Signed-off-by: arkajyotiMukherjee <arko@chaosnative.com>

* rearranged queries

Signed-off-by: arkajyotiMukherjee <arko@chaosnative.com>

* added comments

Signed-off-by: arkajyotiMukherjee <arko@chaosnative.com>

* Updated chaoshub code docs and removed unused models

Signed-off-by: Amit Kumar Das <amit@chaosnative.com>

* userClusterReg -> registerCluster

Signed-off-by: arkajyotiMukherjee <arko@chaosnative.com>

* added cluster mutation API changes

Signed-off-by: arkajyotiMukherjee <arko@chaosnative.com>

* Interfaces + queries updated, pages WIP

Signed-off-by: Vansh Bhatia <vansh@chaosnative.com>

* frontend queries refactored

Signed-off-by: Vansh Bhatia <vansh.bhatia@harness.io>

* more mutation changes

Signed-off-by: Arkajyoti Mukherjee <arkajyoti31@gmail.com>

* more mutation changes

Signed-off-by: Arkajyoti Mukherjee <arkajyoti31@gmail.com>

* mutations refactored

Signed-off-by: Vansh Bhatia <vansh.bhatia@harness.io>

* Fixed handler name

Signed-off-by: Vansh Bhatia <vansh.bhatia@harness.io>

* All errors fixed, frontend compiling, LogSwitcher fix WIP

Signed-off-by: Vansh Bhatia <vansh.bhatia@harness.io>

* Log Switcher fixed

Signed-off-by: Vansh Bhatia <vansh.bhatia@harness.io>

* linter fixes

Signed-off-by: Vansh Bhatia <vansh.bhatia@harness.io>

* Updated ChaosHub mutations

Signed-off-by: Amit Kumar Das <amit@chaosnative.com>

* Changed query names and parameter accordint to convention in backend

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* Changed query names and parameters in FE

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* chaosHub fixes

Signed-off-by: Vansh Bhatia <vansh.bhatia@harness.io>

* Updated subscriber schema and minor refactoring

Signed-off-by: Amit Kumar Das <amit@chaosnative.com>

* frontend fixes

Signed-off-by: Vansh Bhatia <vansh.bhatia@harness.io>

* Renamed get to list in queries

Signed-off-by: SarthakJain26 <sarthak@chaosnative.com>

* Fixed enums issue

Signed-off-by: Amit Kumar Das <amit@chaosnative.com>

* Fixed workflow related schemas in FE and minor change in ENUMs

Signed-off-by: Amit Kumar Das <amit@chaosnative.com>

* Added FE integration for workflow creation

Signed-off-by: Amit Kumar Das <amit@chaosnative.com>

* Updated analytics queries in FE

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* Updated chaoshub queries in FE

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* Updated workflows, logs and template queries and mutations in FE

Signed-off-by: Amit Kumar Das <amit@chaosnative.com>

* Deepscan fix

Signed-off-by: Vansh Bhatia <vansh.bhatia@harness.io>

* Fixed analytics, myhub, usage and project related queries

Signed-off-by: Amit Kumar Das <amit@chaosnative.com>

* fixed workflow stats page

Signed-off-by: Amit Kumar Das <amit@chaosnative.com>

* Updated payload data type in subscriber

Signed-off-by: Amit Kumar Das <amit@chaosnative.com>

* minor fix

Signed-off-by: Amit Kumar Das <amit@chaosnative.com>

* Fixed analytics and delete workflow issue

Signed-off-by: Amit Kumar Das <amit@chaosnative.com>

* Fixed usage stats schema in frontend and backend

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* Added fix username fetching issue in usage table

Signed-off-by: Saranya-jena <saranya.jena@harness.io>

* Added query for agent details

Signed-off-by: Amit Kumar Das <amit@chaosnative.com>

* Updated go mod in auth svr

Signed-off-by: Amit Kumar Das <amit@chaosnative.com>

Co-authored-by: Soumya Ghosh Dastidar <44349253+gdsoumya@users.noreply.github.com>
Co-authored-by: arkajyotiMukherjee <arko@chaosnative.com>
Co-authored-by: Vansh Bhatia <vansh@chaosnative.com>
Co-authored-by: Vansh Bhatia <vansh.bhatia@harness.io>
Co-authored-by: Arkajyoti Mukherjee <arkajyoti31@gmail.com>
Co-authored-by: Saranya-jena <saranya.jena@harness.io>
Co-authored-by: SarthakJain26 <sarthak@chaosnative.com>
This commit is contained in:
Amit Kumar Das 2022-05-11 11:26:12 +05:30 committed by GitHub
parent 4d71cea292
commit 3f8021f09b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
194 changed files with 50910 additions and 19789 deletions

View File

@ -12,7 +12,7 @@ require (
github.com/kelseyhightower/envconfig v1.4.0 github.com/kelseyhightower/envconfig v1.4.0
github.com/sirupsen/logrus v1.4.2 github.com/sirupsen/logrus v1.4.2
go.mongodb.org/mongo-driver v1.5.3 go.mongodb.org/mongo-driver v1.5.3
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f
google.golang.org/grpc v1.32.0 google.golang.org/grpc v1.32.0
google.golang.org/protobuf v1.27.1 google.golang.org/protobuf v1.27.1

View File

@ -254,8 +254,8 @@ golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc= golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd h1:XcWmESyNjXJMLahc3mqVQJcgSTDxFxhETVlfk9uGc38=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@ -313,8 +313,8 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@ -364,16 +364,19 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=

View File

@ -12,7 +12,7 @@ type Project struct {
} }
type Owner struct { type Owner struct {
UserId string `bson:"user_id"` UserID string `bson:"user_id"`
Username string `bson:"username"` Username string `bson:"username"`
} }
type MemberStat struct { type MemberStat struct {
@ -22,7 +22,7 @@ type MemberStat struct {
type ProjectStats struct { type ProjectStats struct {
Name string `bson:"name"` Name string `bson:"name"`
ProjectId string `bson:"_id"` ProjectID string `bson:"_id"`
Members *MemberStat `bson:"memberStat"` Members *MemberStat `bson:"memberStat"`
} }

View File

@ -72,7 +72,7 @@ func getChaosData(nodeStatus v1alpha13.NodeStatus, engineName, engineNS string,
return cd, nil return cd, nil
} }
// util function, checks if event is a chaos-exp event, if so - extract the chaos data //CheckChaosData util function, checks if event is a chaos-exp event, if so - extract the chaos data
func CheckChaosData(nodeStatus v1alpha13.NodeStatus, workflowNS string, chaosClient *v1alpha12.LitmuschaosV1alpha1Client) (string, *types.ChaosData, error) { func CheckChaosData(nodeStatus v1alpha13.NodeStatus, workflowNS string, chaosClient *v1alpha12.LitmuschaosV1alpha1Client) (string, *types.ChaosData, error) {
nodeType := string(nodeStatus.Type) nodeType := string(nodeStatus.Type)
var cd *types.ChaosData = nil var cd *types.ChaosData = nil
@ -115,7 +115,7 @@ func getNameFromLog(log string) string {
return name[1] return name[1]
} }
// converts unix timestamp to string //StrConvTime converts unix timestamp to string
func StrConvTime(time int64) string { func StrConvTime(time int64) string {
if time < 0 { if time < 0 {
return "" return ""
@ -147,9 +147,9 @@ func GetWorkflowObj(uid string) (*v1alpha1.Workflow, error) {
return nil, nil return nil, nil
} }
// generate graphql mutation payload for events event //GenerateWorkflowPayload generate graphql mutation payload for events event
func GenerateWorkflowPayload(cid, accessKey, version, completed string, wfEvent types.WorkflowEvent) ([]byte, error) { func GenerateWorkflowPayload(cid, accessKey, version, completed string, wfEvent types.WorkflowEvent) ([]byte, error) {
clusterID := `{cluster_id: \"` + cid + `\", version: \"` + version + `\", access_key: \"` + accessKey + `\"}` clusterID := `{clusterID: \"` + cid + `\", version: \"` + version + `\", accessKey: \"` + accessKey + `\"}`
for id, event := range wfEvent.Nodes { for id, event := range wfEvent.Nodes {
event.Message = strings.Replace(event.Message, `"`, ``, -1) event.Message = strings.Replace(event.Message, `"`, ``, -1)
@ -160,7 +160,7 @@ func GenerateWorkflowPayload(cid, accessKey, version, completed string, wfEvent
if err != nil { if err != nil {
return nil, err return nil, err
} }
mutation := `{ workflow_id: \"` + wfEvent.WorkflowID + `\", workflow_run_id: \"` + wfEvent.UID + `\", completed: ` + completed + `, workflow_name:\"` + wfEvent.Name + `\", cluster_id: ` + clusterID + `, executed_by:\"` + wfEvent.ExecutedBy + `\", execution_data:\"` + processed[1:len(processed)-1] + `\"}` mutation := `{ workflowID: \"` + wfEvent.WorkflowID + `\", workflowRunID: \"` + wfEvent.UID + `\", completed: ` + completed + `, workflowName:\"` + wfEvent.Name + `\", clusterID: ` + clusterID + `, executedBy:\"` + wfEvent.ExecutedBy + `\", executionData:\"` + processed[1:len(processed)-1] + `\"}`
var payload = []byte(`{"query":"mutation { chaosWorkflowRun(workflowData:` + mutation + ` )}"}`) var payload = []byte(`{"query":"mutation { chaosWorkflowRun(request:` + mutation + ` )}"}`)
return payload, nil return payload, nil
} }

View File

@ -38,7 +38,7 @@ var (
ClusterID = os.Getenv("CLUSTER_ID") ClusterID = os.Getenv("CLUSTER_ID")
) )
// initializes the Argo Workflow event watcher //WorkflowEventWatcher initializes the Argo Workflow event watcher
func WorkflowEventWatcher(stopCh chan struct{}, stream chan types.WorkflowEvent, clusterData map[string]string) { func WorkflowEventWatcher(stopCh chan struct{}, stream chan types.WorkflowEvent, clusterData map[string]string) {
startTime, err := strconv.Atoi(clusterData["START_TIME"]) startTime, err := strconv.Atoi(clusterData["START_TIME"])
if err != nil { if err != nil {
@ -48,17 +48,21 @@ func WorkflowEventWatcher(stopCh chan struct{}, stream chan types.WorkflowEvent,
if err != nil { if err != nil {
logrus.WithError(err).Fatal("Could not get kube config") logrus.WithError(err).Fatal("Could not get kube config")
} }
// ClientSet to create Informer // ClientSet to create Informer
clientSet, err := versioned.NewForConfig(cfg) clientSet, err := versioned.NewForConfig(cfg)
if err != nil { if err != nil {
logrus.WithError(err).Fatal("Could not generate dynamic client for config") logrus.WithError(err).Fatal("Could not generate dynamic client for config")
} }
// Create a factory object to watch workflows depending on default scope // Create a factory object to watch workflows depending on default scope
f := externalversions.NewSharedInformerFactoryWithOptions(clientSet, resyncPeriod, f := externalversions.NewSharedInformerFactoryWithOptions(clientSet, resyncPeriod,
externalversions.WithTweakListOptions(func(list *v1.ListOptions) { externalversions.WithTweakListOptions(func(list *v1.ListOptions) {
list.LabelSelector = fmt.Sprintf("cluster_id=%s,workflows.argoproj.io/controller-instanceid=%s", ClusterID, ClusterID) list.LabelSelector = fmt.Sprintf("cluster_id=%s,workflows.argoproj.io/controller-instanceid=%s", ClusterID, ClusterID)
})) }))
informer := f.Argoproj().V1alpha1().Workflows().Informer() informer := f.Argoproj().V1alpha1().Workflows().Informer()
if AgentScope == "namespace" { if AgentScope == "namespace" {
f = externalversions.NewSharedInformerFactoryWithOptions(clientSet, resyncPeriod, externalversions.WithNamespace(AgentNamespace), f = externalversions.NewSharedInformerFactoryWithOptions(clientSet, resyncPeriod, externalversions.WithNamespace(AgentNamespace),
externalversions.WithTweakListOptions(func(list *v1.ListOptions) { externalversions.WithTweakListOptions(func(list *v1.ListOptions) {
@ -70,7 +74,7 @@ func WorkflowEventWatcher(stopCh chan struct{}, stream chan types.WorkflowEvent,
go startWatchWorkflow(stopCh, informer, stream, int64(startTime)) go startWatchWorkflow(stopCh, informer, stream, int64(startTime))
} }
// handles the different events events - add, update and delete //startWatchWorkflow handles the different events events - add, update and delete
func startWatchWorkflow(stopCh <-chan struct{}, s cache.SharedIndexInformer, stream chan types.WorkflowEvent, startTime int64) { func startWatchWorkflow(stopCh <-chan struct{}, s cache.SharedIndexInformer, stream chan types.WorkflowEvent, startTime int64) {
handlers := cache.ResourceEventHandlerFuncs{ handlers := cache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) { AddFunc: func(obj interface{}) {
@ -99,7 +103,7 @@ func startWatchWorkflow(stopCh <-chan struct{}, s cache.SharedIndexInformer, str
s.Run(stopCh) s.Run(stopCh)
} }
// responsible for extracting the required data from the event and streaming //WorkflowEventHandler responsible for extracting the required data from the event and streaming
func WorkflowEventHandler(workflowObj *v1alpha1.Workflow, eventType string, startTime int64) (types.WorkflowEvent, error) { func WorkflowEventHandler(workflowObj *v1alpha1.Workflow, eventType string, startTime int64) (types.WorkflowEvent, error) {
if workflowObj.Labels["workflow_id"] == "" { if workflowObj.Labels["workflow_id"] == "" {
logrus.WithFields(map[string]interface{}{ logrus.WithFields(map[string]interface{}{

View File

@ -29,7 +29,7 @@ func SendRequest(server string, payload []byte) (string, error) {
return string(body), nil return string(body), nil
} }
// process event data into proper format acceptable by graphql // MarshalGQLData processes event data into proper format acceptable by graphql
func MarshalGQLData(gqlData interface{}) (string, error) { func MarshalGQLData(gqlData interface{}) (string, error) {
data, err := json.Marshal(gqlData) data, err := json.Marshal(gqlData)
if err != nil { if err != nil {

View File

@ -10,7 +10,7 @@ import (
var KubeConfig *string var KubeConfig *string
//getKubeConfig setup the config for access cluster resource // GetKubeConfig sets up the config for access cluster resource
func GetKubeConfig() (*rest.Config, error) { func GetKubeConfig() (*rest.Config, error) {
// Use in-cluster config if kubeconfig path is not specified // Use in-cluster config if kubeconfig path is not specified
if *KubeConfig == "" { if *KubeConfig == "" {
@ -28,7 +28,7 @@ func GetGenericK8sClient() (*kubernetes.Clientset, error) {
return kubernetes.NewForConfig(config) return kubernetes.NewForConfig(config)
} }
//This function returns dynamic client and discovery client // GetDynamicAndDiscoveryClient returns dynamic client and discovery client
func GetDynamicAndDiscoveryClient() (discovery.DiscoveryInterface, dynamic.Interface, error) { func GetDynamicAndDiscoveryClient() (discovery.DiscoveryInterface, dynamic.Interface, error) {
// returns a config object which uses the service account kubernetes gives to pods // returns a config object which uses the service account kubernetes gives to pods
config, err := GetKubeConfig() config, err := GetKubeConfig()

View File

@ -52,7 +52,7 @@ func GetLogs(podName, namespace, container string) (string, error) {
return str, nil return str, nil
} }
// create pod log for normal pods and chaos-engine pods //CreatePodLog creates pod log for normal pods and chaos-engine pods
func CreatePodLog(podLog types.PodLogRequest) (types.PodLog, error) { func CreatePodLog(podLog types.PodLogRequest) (types.PodLog, error) {
logDetails := types.PodLog{} logDetails := types.PodLog{}
mainLog, err := GetLogs(podLog.PodName, podLog.PodNamespace, "main") mainLog, err := GetLogs(podLog.PodName, podLog.PodNamespace, "main")
@ -109,7 +109,7 @@ func SendPodLogs(clusterData map[string]string, podLog types.PodLogRequest) {
} }
func GenerateLogPayload(cid, accessKey, version string, podLog types.PodLogRequest) ([]byte, error) { func GenerateLogPayload(cid, accessKey, version string, podLog types.PodLogRequest) ([]byte, error) {
clusterID := `{cluster_id: \"` + cid + `\", version: \"` + version + `\", access_key: \"` + accessKey + `\"}` clusterID := `{clusterID: \"` + cid + `\", version: \"` + version + `\", accessKey: \"` + accessKey + `\"}`
processed := " Could not get logs " processed := " Could not get logs "
// get the logs // get the logs
@ -122,8 +122,8 @@ func GenerateLogPayload(cid, accessKey, version string, podLog types.PodLogReque
} }
} }
mutation := `{ cluster_id: ` + clusterID + `, request_id:\"` + podLog.RequestID + `\", workflow_run_id: \"` + podLog.WorkflowRunID + `\", pod_name: \"` + podLog.PodName + `\", pod_type: \"` + podLog.PodType + `\", log:\"` + processed[1:len(processed)-1] + `\"}` mutation := `{ clusterID: ` + clusterID + `, requestID:\"` + podLog.RequestID + `\", workflowRunID: \"` + podLog.WorkflowRunID + `\", podName: \"` + podLog.PodName + `\", podType: \"` + podLog.PodType + `\", log:\"` + processed[1:len(processed)-1] + `\"}`
var payload = []byte(`{"query":"mutation { podLog(log:` + mutation + ` )}"}`) var payload = []byte(`{"query":"mutation { podLog(request:` + mutation + ` )}"}`)
return payload, nil return payload, nil
} }

View File

@ -28,7 +28,7 @@ func GetKubernetesObjects(request types.KubeObjRequest) ([]*types.KubeObject, er
if err != nil { if err != nil {
return nil, err return nil, err
} }
clientset, err := kubernetes.NewForConfig(conf) clientSet, err := kubernetes.NewForConfig(conf)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -55,7 +55,7 @@ func GetKubernetesObjects(request types.KubeObjRequest) ([]*types.KubeObject, er
} }
ObjData = append(ObjData, KubeObj) ObjData = append(ObjData, KubeObj)
} else { } else {
namespace, err := clientset.CoreV1().Namespaces().List(context.TODO(), metav1.ListOptions{}) namespace, err := clientSet.CoreV1().Namespaces().List(context.TODO(), metav1.ListOptions{})
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -73,7 +73,7 @@ func GetKubernetesObjects(request types.KubeObjRequest) ([]*types.KubeObject, er
ObjData = append(ObjData, KubeObj) ObjData = append(ObjData, KubeObj)
} }
} else { } else {
return nil, errors.New("No namespace available") return nil, errors.New("no namespace available")
} }
} }
@ -108,9 +108,9 @@ func GetObjectDataByNamespace(namespace string, dynamicClient dynamic.Interface,
return kubeObjects, nil return kubeObjects, nil
} }
func GenerateKubeObject(cid string, accessKey, version string, kubeobjectrequest types.KubeObjRequest) ([]byte, error) { func GenerateKubeObject(cid string, accessKey, version string, kubeObjectRequest types.KubeObjRequest) ([]byte, error) {
clusterID := `{cluster_id: \"` + cid + `\", version: \"` + version + `\", access_key: \"` + accessKey + `\"}` clusterID := `{clusterID: \"` + cid + `\", version: \"` + version + `\", accessKey: \"` + accessKey + `\"}`
kubeObj, err := GetKubernetesObjects(kubeobjectrequest) kubeObj, err := GetKubernetesObjects(kubeObjectRequest)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -118,16 +118,16 @@ func GenerateKubeObject(cid string, accessKey, version string, kubeobjectrequest
if err != nil { if err != nil {
return nil, err return nil, err
} }
mutation := `{ cluster_id: ` + clusterID + `, request_id:\"` + kubeobjectrequest.RequestID + `\", kube_obj:\"` + processed[1:len(processed)-1] + `\"}` mutation := `{ clusterID: ` + clusterID + `, requestID:\"` + kubeObjectRequest.RequestID + `\", kubeObj:\"` + processed[1:len(processed)-1] + `\"}`
var payload = []byte(`{"query":"mutation { kubeObj(kubeData:` + mutation + ` )}"}`) var payload = []byte(`{"query":"mutation { kubeObj(request:` + mutation + ` )}"}`)
return payload, nil return payload, nil
} }
//SendKubeObjects generates graphql mutation to send kubernetes objects data to graphql server //SendKubeObjects generates graphql mutation to send kubernetes objects data to graphql server
func SendKubeObjects(clusterData map[string]string, kubeobjectrequest types.KubeObjRequest) error { func SendKubeObjects(clusterData map[string]string, kubeObjectRequest types.KubeObjRequest) error {
// generate graphql payload // generate graphql payload
payload, err := GenerateKubeObject(clusterData["CLUSTER_ID"], clusterData["ACCESS_KEY"], clusterData["VERSION"], kubeobjectrequest) payload, err := GenerateKubeObject(clusterData["CLUSTER_ID"], clusterData["ACCESS_KEY"], clusterData["VERSION"], kubeObjectRequest)
if err != nil { if err != nil {
logrus.WithError(err).Print("Error while getting KubeObject Data") logrus.WithError(err).Print("Error while getting KubeObject Data")
return err return err

View File

@ -208,7 +208,7 @@ func applyRequest(requestType string, obj *unstructured.Unstructured) (*unstruct
if requestType == "create" { if requestType == "create" {
response, err := dr.Create(ctx, obj, metav1.CreateOptions{}) response, err := dr.Create(ctx, obj, metav1.CreateOptions{})
if k8s_errors.IsAlreadyExists(err) { if k8s_errors.IsAlreadyExists(err) {
// This doesnt ever happen even if it does already exist // This doesn't ever happen even if it does already exist
logrus.Info("Already exists") logrus.Info("Already exists")
return nil, nil return nil, nil
} }
@ -222,7 +222,7 @@ func applyRequest(requestType string, obj *unstructured.Unstructured) (*unstruct
} else if requestType == "update" { } else if requestType == "update" {
getObj, err := dr.Get(ctx, obj.GetName(), metav1.GetOptions{}) getObj, err := dr.Get(ctx, obj.GetName(), metav1.GetOptions{})
if k8s_errors.IsNotFound(err) { if k8s_errors.IsNotFound(err) {
// This doesnt ever happen even if it is already deleted or not found // This doesn't ever happen even if it is already deleted or not found
logrus.Info("%v not found", obj.GetName()) logrus.Info("%v not found", obj.GetName())
return nil, nil return nil, nil
} }
@ -243,7 +243,7 @@ func applyRequest(requestType string, obj *unstructured.Unstructured) (*unstruct
} else if requestType == "delete" { } else if requestType == "delete" {
err := dr.Delete(ctx, obj.GetName(), metav1.DeleteOptions{}) err := dr.Delete(ctx, obj.GetName(), metav1.DeleteOptions{})
if k8s_errors.IsNotFound(err) { if k8s_errors.IsNotFound(err) {
// This doesnt ever happen even if it is already deleted or not found // This doesn't ever happen even if it is already deleted or not found
logrus.Info("%v not found", obj.GetName()) logrus.Info("%v not found", obj.GetName())
return nil, nil return nil, nil
} }
@ -257,7 +257,7 @@ func applyRequest(requestType string, obj *unstructured.Unstructured) (*unstruct
} else if requestType == "get" { } else if requestType == "get" {
response, err := dr.Get(ctx, obj.GetName(), metav1.GetOptions{}) response, err := dr.Get(ctx, obj.GetName(), metav1.GetOptions{})
if k8s_errors.IsNotFound(err) { if k8s_errors.IsNotFound(err) {
// This doesnt ever happen even if it is already deleted or not found // This doesn't ever happen even if it is already deleted or not found
logrus.Info("%v not found", obj.GetName()) logrus.Info("%v not found", obj.GetName())
return nil, nil return nil, nil
} }
@ -287,7 +287,7 @@ func addCustomLabels(obj *unstructured.Unstructured, customLabels map[string]str
obj.SetLabels(newLabels) obj.SetLabels(newLabels)
} }
// This function handles cluster operations // ClusterOperations handles cluster operations
func ClusterOperations(clusterAction types.Action) (*unstructured.Unstructured, error) { func ClusterOperations(clusterAction types.Action) (*unstructured.Unstructured, error) {
// Converting JSON to YAML and store it in yamlStr variable // Converting JSON to YAML and store it in yamlStr variable
@ -333,7 +333,7 @@ func ClusterOperations(clusterAction types.Action) (*unstructured.Unstructured,
} }
func ClusterConfirm(clusterData map[string]string) ([]byte, error) { func ClusterConfirm(clusterData map[string]string) ([]byte, error) {
payload := `{"query":"mutation{ clusterConfirm(identity: {cluster_id: \"` + clusterData["CLUSTER_ID"] + `\", version: \"` + clusterData["VERSION"] + `\", access_key: \"` + clusterData["ACCESS_KEY"] + `\"}){isClusterConfirmed newAccessKey cluster_id}}"}` payload := `{"query":"mutation{ confirmClusterRegistration(request: {clusterID: \"` + clusterData["CLUSTER_ID"] + `\", version: \"` + clusterData["VERSION"] + `\", accessKey: \"` + clusterData["ACCESS_KEY"] + `\"}){isClusterConfirmed newAccessKey clusterID}}"}`
resp, err := graphql.SendRequest(clusterData["SERVER_ADDR"], []byte(payload)) resp, err := graphql.SendRequest(clusterData["SERVER_ADDR"], []byte(payload))
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -15,7 +15,7 @@ import (
) )
func ClusterConnect(clusterData map[string]string) { func ClusterConnect(clusterData map[string]string) {
query := `{"query":"subscription {\n clusterConnect(clusterInfo: {cluster_id: \"` + clusterData["CLUSTER_ID"] + `\", version: \"` + clusterData["VERSION"] + `\", access_key: \"` + clusterData["ACCESS_KEY"] + `\"}) {\n \t project_id,\n action{\n k8s_manifest,\n external_data,\n request_type\n username\n namespace\n }\n }\n}\n"}` query := `{"query":"subscription {\n clusterConnect(clusterInfo: {clusterID: \"` + clusterData["CLUSTER_ID"] + `\", version: \"` + clusterData["VERSION"] + `\", accessKey: \"` + clusterData["ACCESS_KEY"] + `\"}) {\n \t projectID,\n action{\n k8sManifest,\n externalData,\n requestType\n username\n namespace\n }\n }\n}\n"}`
serverURL, err := url.Parse(clusterData["SERVER_ADDR"]) serverURL, err := url.Parse(clusterData["SERVER_ADDR"])
if err != nil { if err != nil {
logrus.WithError(err).Fatal("Failed to parse URL") logrus.WithError(err).Fatal("Failed to parse URL")
@ -72,7 +72,6 @@ func ClusterConnect(clusterData map[string]string) {
if err != nil { if err != nil {
logrus.WithError(err).Fatal("Failed to read message") logrus.WithError(err).Fatal("Failed to read message")
} }
var r types.RawData var r types.RawData
err = json.Unmarshal(message, &r) err = json.Unmarshal(message, &r)
if err != nil { if err != nil {
@ -90,7 +89,6 @@ func ClusterConnect(clusterData map[string]string) {
logrus.Error("Error response from the server : ", string(message)) logrus.Error("Error response from the server : ", string(message))
continue continue
} }
err = RequestProcessor(clusterData, r) err = RequestProcessor(clusterData, r)
if err != nil { if err != nil {
logrus.WithError(err).Error("Error on processing request") logrus.WithError(err).Error("Error on processing request")
@ -103,7 +101,6 @@ func RequestProcessor(clusterData map[string]string, r types.RawData) error {
KubeObjRequest := types.KubeObjRequest{ KubeObjRequest := types.KubeObjRequest{
RequestID: r.Payload.Data.ClusterConnect.ProjectID, RequestID: r.Payload.Data.ClusterConnect.ProjectID,
} }
err := json.Unmarshal([]byte(r.Payload.Data.ClusterConnect.Action.ExternalData), &KubeObjRequest) err := json.Unmarshal([]byte(r.Payload.Data.ClusterConnect.Action.ExternalData), &KubeObjRequest)
if err != nil { if err != nil {
return errors.New("failed to json unmarshal: " + err.Error()) return errors.New("failed to json unmarshal: " + err.Error())

View File

@ -19,43 +19,30 @@ type Payload struct {
} }
type Data struct { type Data struct {
ClusterConfirm ClusterConfirm `json:"clusterConfirm"` ClusterConfirm ClusterConfirm `json:"confirmClusterRegistration"`
ClusterConnect ClusterConnect `json:"clusterConnect"` ClusterConnect ClusterConnect `json:"clusterConnect"`
} }
type ClusterConfirm struct { type ClusterConfirm struct {
IsClusterConfirmed bool `json:isClusterConfirmed` IsClusterConfirmed bool `json:"isClusterConfirmed"`
NewAccessKey string `json:newAccessKey` NewAccessKey string `json:"newAccessKey"`
ClusterID string `json:cluster_id` ClusterID string `json:"clusterID"`
} }
type ClusterConnect struct { type ClusterConnect struct {
ProjectID string `json:"project_id"` ProjectID string `json:"projectID"`
Action Action `json:"action"` Action Action `json:"action"`
} }
type KubeObjRequest struct {
RequestID string
ClusterID string `json:"cluster_id"`
ObjectType string `json:"object_type"`
KubeGVRRequest KubeGVRRequest `json:"kube_obj_request"`
}
type KubeGVRRequest struct {
Group string `json:"group"`
Version string `json:"version"`
Resource string `json:"resource"`
}
type Action struct { type Action struct {
K8SManifest string `json:"k8s_manifest"` K8SManifest string `json:"k8sManifest"`
ExternalData string `json:"external_data"` ExternalData string `json:"externalData"`
RequestType string `json:"request_type"` RequestType string `json:"requestType"`
Username string `json:"username"` Username string `json:"username"`
Namespace string `json:"namespace"` Namespace string `json:"namespace"`
} }
type WorkflowSyncExternalData struct { type WorkflowSyncExternalData struct {
WorkflowID string `json:"workflow_id"` WorkflowID string `json:"workflowID"`
WorkflowRunID string `json:"workflow_run_id"` WorkflowRunID string `json:"workflowRunID"`
} }

View File

@ -2,11 +2,11 @@ package types
import "github.com/litmuschaos/chaos-operator/pkg/apis/litmuschaos/v1alpha1" import "github.com/litmuschaos/chaos-operator/pkg/apis/litmuschaos/v1alpha1"
// events data // WorkflowEvent consists of workflow related data
type WorkflowEvent struct { type WorkflowEvent struct {
WorkflowType string `json:"workflow_type"` WorkflowType string `json:"workflowType"`
WorkflowID string `json:"-"` WorkflowID string `json:"-"`
EventType string `json:"event_type"` EventType string `json:"eventType"`
UID string `json:"-"` UID string `json:"-"`
Namespace string `json:"namespace"` Namespace string `json:"namespace"`
Name string `json:"name"` Name string `json:"name"`
@ -16,10 +16,10 @@ type WorkflowEvent struct {
StartedAt string `json:"startedAt"` StartedAt string `json:"startedAt"`
FinishedAt string `json:"finishedAt"` FinishedAt string `json:"finishedAt"`
Nodes map[string]Node `json:"nodes"` Nodes map[string]Node `json:"nodes"`
ExecutedBy string `json:"executed_by"` ExecutedBy string `json:"executedBy"`
} }
// each node/step data // Node consist of node/step data
type Node struct { type Node struct {
Name string `json:"name"` Name string `json:"name"`
Phase string `json:"phase"` Phase string `json:"phase"`
@ -31,7 +31,7 @@ type Node struct {
ChaosExp *ChaosData `json:"chaosData,omitempty"` ChaosExp *ChaosData `json:"chaosData,omitempty"`
} }
// chaos data // ChaosData consists of ChaosEngine related data
type ChaosData struct { type ChaosData struct {
EngineUID string `json:"engineUID"` EngineUID string `json:"engineUID"`
EngineContext string `json:"engineContext"` EngineContext string `json:"engineContext"`

View File

@ -6,19 +6,34 @@ import (
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
) )
type KubeObjRequest struct {
RequestID string
ClusterID string `json:"clusterID"`
ObjectType string `json:"objectType"`
KubeGVRRequest KubeGVRRequest `json:"kubeObjRequest"`
}
type KubeGVRRequest struct {
Group string `json:"group"`
Version string `json:"version"`
Resource string `json:"resource"`
}
//KubeObject consists of all the namespaces and its related K8S object details
type KubeObject struct { type KubeObject struct {
Namespace string `json:"namespace"` Namespace string `json:"namespace"`
Data []ObjectData `json:"data"` Data []ObjectData `json:"data"`
} }
//ObjectData consists of Kubernetes Objects related details
type ObjectData struct { type ObjectData struct {
Name string `json:"name"` Name string `json:"name"`
UID types.UID `json:"uid"` UID types.UID `json:"uid"`
Namespace string `json:"namespace"` Namespace string `json:"namespace"`
APIVersion string `json:"api_version"` APIVersion string `json:"apiVersion"`
CreationTimestamp metav1.Time `json:"creation_timestamp"` CreationTimestamp metav1.Time `json:"creationTimestamp"`
Containers []v1.Container `json:"containers"` Containers []v1.Container `json:"containers"`
TerminationGracePeriods *int64 `json:"termination_grace_periods"` TerminationGracePeriods *int64 `json:"terminationGracePeriods"`
Volumes []v1.Volume `json:"volumes"` Volumes []v1.Volume `json:"volumes"`
Labels map[string]string `json:"labels"` Labels map[string]string `json:"labels"`
} }

View File

@ -2,17 +2,18 @@ package types
type PodLogRequest struct { type PodLogRequest struct {
RequestID string RequestID string
ClusterID string `json:"cluster_id"` ClusterID string `json:"clusterID"`
WorkflowRunID string `json:"workflow_run_id"` WorkflowRunID string `json:"workflowRunID"`
PodName string `json:"pod_name"` PodName string `json:"podName"`
PodNamespace string `json:"pod_namespace"` PodNamespace string `json:"podNamespace"`
PodType string `json:"pod_type"` PodType string `json:"podType"`
ExpPod *string `json:"exp_pod"` ExpPod *string `json:"expPod"`
RunnerPod *string `json:"runner_pod"` RunnerPod *string `json:"runnerPod"`
ChaosNamespace *string `json:"chaos_namespace"` ChaosNamespace *string `json:"chaosNamespace"`
} }
// PodLog consists logs from Chaos related pods and experiment pods
type PodLog struct { type PodLog struct {
MainPod string `json:"main_logs"` MainPod string `json:"mainLogs"`
ChaosPod map[string]string `json:"chaos_logs",omitempty` ChaosPod map[string]string `json:"chaosLogs",omitempty`
} }

File diff suppressed because it is too large Load Diff

View File

@ -73,7 +73,7 @@ const LocalQuickActionCard: React.FC<LocalQuickActionCardProps> = ({
// TODO: settings only accessible by Owner // TODO: settings only accessible by Owner
(homePage || returningHome || community || observability) && (homePage || returningHome || community || observability) &&
getProjectRole() === Role.owner getProjectRole() === Role.OWNER
? { ? {
src: './icons/teamMember.svg', src: './icons/teamMember.svg',
alt: 'team', alt: 'team',

View File

@ -161,7 +161,7 @@ const SideBar: React.FC = () => {
</CustomisedListItem> </CustomisedListItem>
)} )}
{role === UserRole.admin && projectRole === 'Owner' && ( {role === UserRole.ADMIN && projectRole === 'Owner' && (
<CustomisedListItem <CustomisedListItem
key="usage-statistics" key="usage-statistics"
handleClick={() => { handleClick={() => {

View File

@ -27,12 +27,12 @@ const UsefulLinks: React.FC<UsefulLinkProps> = ({
</Typography> </Typography>
</div> </div>
{maintainers?.map((m: Maintainer) => ( {maintainers?.map((m: Maintainer) => (
<div className={classes.maintainerField} key={m.Name}> <div className={classes.maintainerField} key={m.name}>
<Typography className={classes.maintainerlinks}> <Typography className={classes.maintainerlinks}>
{m.Name} {m.name}
</Typography> </Typography>
<Typography className={classes.maintainerlinks}> <Typography className={classes.maintainerlinks}>
{m.Email} {m.email}
</Typography> </Typography>
</div> </div>
))} ))}
@ -50,15 +50,15 @@ const UsefulLinks: React.FC<UsefulLinkProps> = ({
</div> </div>
{data?.map( {data?.map(
(d: Link) => (d: Link) =>
d.Url && ( d.url && (
<div key={d.Name}> <div key={d.name}>
<a <a
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
href={d.Url} href={d.url}
className={classes.createLinkText} className={classes.createLinkText}
> >
<Typography className={classes.linkType}>{d.Name}</Typography> <Typography className={classes.linkType}>{d.name}</Typography>
</a> </a>
</div> </div>
) )

View File

@ -206,7 +206,7 @@ const Routes: React.FC = () => {
<Route exact path="/create-workflow" component={CreateWorkflow} /> <Route exact path="/create-workflow" component={CreateWorkflow} />
<Route <Route
exact exact
path="/workflows/:workflowRunId" path="/workflows/:workflowRunID"
component={WorkflowDetails} component={WorkflowDetails}
/> />
<Route <Route
@ -221,7 +221,7 @@ const Routes: React.FC = () => {
/> />
<Route <Route
exact exact
path="/analytics/workflowStatistics/:workflowId" path="/analytics/workflowStatistics/:workflowID"
component={WorkflowInfoStats} component={WorkflowInfoStats}
/> />
<Route exact path="/community" component={Community} /> <Route exact path="/community" component={Community} />
@ -244,7 +244,7 @@ const Routes: React.FC = () => {
}} }}
/> />
)} )}
{role === UserRole.admin ? ( {role === UserRole.ADMIN ? (
<Route path="/usage-statistics" component={UsageStatistics} /> <Route path="/usage-statistics" component={UsageStatistics} />
) : ( ) : (
<Redirect <Redirect

View File

@ -1,320 +0,0 @@
import { gql } from '@apollo/client';
export const CREATE_WORKFLOW = gql`
mutation createChaosWorkFlow($ChaosWorkFlowInput: ChaosWorkFlowInput!) {
createChaosWorkFlow(input: $ChaosWorkFlowInput) {
workflow_id
cronSyntax
workflow_name
workflow_description
isCustomWorkflow
}
}
`;
export const ADD_WORKFLOW_TEMPLATE = gql`
mutation addWorkflowTemplate($data: TemplateInput!) {
createManifestTemplate(templateInput: $data) {
template_name
template_id
}
}
`;
export const DELETE_WORKFLOW_TEMPLATE = gql`
mutation deleteManifestTemplate($projectID: String!, $data: String!) {
deleteManifestTemplate(projectID: $projectID, template_id: $data)
}
`;
export const UPDATE_USER_STATE = gql`
mutation updateUserState($uid: String!, $isDeactivate: Boolean!) {
updateUserState(uid: $uid, isDeactivate: $isDeactivate)
}
`;
export const UPDATE_SCHEDULE = gql`
mutation updateChaos($ChaosWorkFlowInput: ChaosWorkFlowInput!) {
updateChaosWorkflow(input: $ChaosWorkFlowInput) {
workflow_id
workflow_name
workflow_description
isCustomWorkflow
cronSyntax
}
}
`;
export const UPDATE_DETAILS = gql`
mutation updateUser($user: UpdateUserInput!) {
updateUser(user: $user)
}
`;
export const USER_CLUSTER_REG = gql`
mutation userCluster($ClusterInput: ClusterInput!) {
userClusterReg(clusterInput: $ClusterInput) {
token
cluster_id
cluster_name
}
}
`;
export const ADD_MY_HUB = gql`
mutation addMyHub($MyHubDetails: CreateMyHub!, $projectID: String!) {
addMyHub(myhubInput: $MyHubDetails, projectID: $projectID) {
HubName
RepoURL
RepoBranch
}
}
`;
export const SAVE_MY_HUB = gql`
mutation saveMyHub($MyHubDetails: CreateMyHub!, $projectID: String!) {
saveMyHub(myhubInput: $MyHubDetails, projectID: $projectID) {
HubName
RepoURL
RepoBranch
}
}
`;
export const UPDATE_MY_HUB = gql`
mutation updateMyHub($MyHubDetails: UpdateMyHub!, $projectID: String!) {
updateMyHub(myhubInput: $MyHubDetails, projectID: $projectID) {
HubName
RepoURL
RepoBranch
}
}
`;
export const SYNC_REPO = gql`
mutation syncHub($id: ID!, $projectID: String!) {
syncHub(id: $id, projectID: $projectID) {
id
RepoURL
RepoBranch
IsAvailable
TotalExp
HubName
}
}
`;
export const DELETE_HUB = gql`
mutation deleteMyHub($hub_id: String!, $projectID: String!) {
deleteMyHub(hub_id: $hub_id, projectID: $projectID)
}
`;
export const GENERATE_SSH = gql`
mutation generateSSHKey {
generaterSSHKey {
privateKey
publicKey
}
}
`;
export const DELETE_CLUSTERS = gql`
mutation deleteClusters($projectID: String!, $cluster_ids: [String]!) {
deleteClusters(projectID: $projectID, cluster_ids: $cluster_ids)
}
`;
export const ENABLE_GITOPS = gql`
mutation enableGitOps($gitConfig: GitConfig!) {
enableGitOps(config: $gitConfig)
}
`;
export const UPDATE_GITOPS = gql`
mutation updateGitOps($gitConfig: GitConfig!) {
updateGitOps(config: $gitConfig)
}
`;
export const DISABLE_GITOPS = gql`
mutation disableGitOPs($data: String!) {
disableGitOps(project_id: $data)
}
`;
export const RERUN_CHAOS_WORKFLOW = gql`
mutation rerunChaosWorkflow($projectID: String!, $data: String!) {
reRunChaosWorkFlow(projectID: $projectID, workflowID: $data)
}
`;
export const LEAVE_PROJECT = gql`
mutation LeaveProject($data: MemberInput!) {
leaveProject(member: $data)
}
`;
export const CREATE_DATASOURCE = gql`
mutation createDataSource($DSInput: DSInput) {
createDataSource(datasource: $DSInput) {
ds_id
ds_name
ds_type
ds_url
access_type
auth_type
basic_auth_username
basic_auth_password
scrape_interval
query_timeout
http_method
project_id
health_status
}
}
`;
export const UPDATE_DATASOURCE = gql`
mutation updateDataSource($DSInput: DSInput!) {
updateDataSource(datasource: $DSInput) {
ds_id
ds_name
ds_type
ds_url
access_type
auth_type
basic_auth_username
basic_auth_password
scrape_interval
query_timeout
http_method
project_id
}
}
`;
export const DELETE_DATASOURCE = gql`
mutation deleteDataSource(
$projectID: String!
$deleteDSInput: deleteDSInput!
) {
deleteDataSource(projectID: $projectID, input: $deleteDSInput)
}
`;
export const CREATE_DASHBOARD = gql`
mutation createDashBoard($createDBInput: createDBInput) {
createDashBoard(dashboard: $createDBInput) {
db_id
}
}
`;
export const UPDATE_DASHBOARD = gql`
mutation updateDashboard(
$projectID: String!
$updateDBInput: updateDBInput!
$chaosQueryUpdate: Boolean!
) {
updateDashboard(
projectID: $projectID
dashboard: $updateDBInput
chaosQueryUpdate: $chaosQueryUpdate
)
}
`;
export const DELETE_DASHBOARD = gql`
mutation deleteDashboard($projectID: String!, $dbID: String) {
deleteDashboard(projectID: $projectID, db_id: $dbID)
}
`;
export const UPDATE_PANEL = gql`
mutation updatePanel($panelInput: [panel]) {
updatePanel(panelInput: $panelInput)
}
`;
export const ADD_IMAGE_REGISTRY = gql`
mutation createImageRegistry(
$projectID: String!
$imageRegistryInfo: imageRegistryInput!
) {
createImageRegistry(
project_id: $projectID
imageRegistryInfo: $imageRegistryInfo
) {
image_registry_info {
image_repo_name
image_registry_name
image_registry_type
is_default
}
}
}
`;
export const UPDATE_IMAGE_REGISTRY = gql`
mutation updateImageRegistry(
$imageRegistryID: String!
$projectID: String!
$imageRegistryInfo: imageRegistryInput!
) {
updateImageRegistry(
image_registry_id: $imageRegistryID
project_id: $projectID
imageRegistryInfo: $imageRegistryInfo
) {
image_registry_info {
image_repo_name
image_registry_name
image_registry_type
is_default
}
}
}
`;
export const SYNC_WORKFLOW = gql`
mutation syncWorkflow(
$projectID: String!
$workflowID: String!
$workflow_run_id: String!
) {
syncWorkflow(
projectID: $projectID
workflowID: $workflowID
workflow_run_id: $workflow_run_id
)
}
`;
export const DELETE_WORKFLOW = gql`
mutation deleteWorkflow(
$projectID: String!
$workflowID: String
$workflow_run_id: String
) {
deleteChaosWorkflow(
projectID: $projectID
workflowID: $workflowID
workflow_run_id: $workflow_run_id
)
}
`;
export const TERMINATE_WORKFLOW = gql`
mutation terminateWorkflow(
$projectID: String!
$workflowID: String
$workflow_run_id: String
) {
terminateChaosWorkflow(
projectID: $projectID
workflowID: $workflowID
workflow_run_id: $workflow_run_id
)
}
`;

View File

@ -0,0 +1,83 @@
import { gql } from '@apollo/client';
export const CREATE_DATASOURCE = gql`
mutation createDataSource($DSInput: DSInput) {
createDataSource(datasource: $DSInput) {
dsID
dsName
dsType
dsURL
accessType
authType
basicAuthUsername
basicAuthPassword
scrapeInterval
queryTimeout
httpMethod
projectID
healthStatus
}
}
`;
export const UPDATE_DATASOURCE = gql`
mutation updateDataSource($DSInput: DSInput!) {
updateDataSource(datasource: $DSInput) {
dsID
dsName
dsType
dsURL
accessType
authType
basicAuthUsername
basicAuthPassword
scrapeInterval
queryTimeout
httpMethod
projectID
}
}
`;
export const DELETE_DATASOURCE = gql`
mutation deleteDataSource(
$projectID: String!
$deleteDSInput: deleteDSInput!
) {
deleteDataSource(projectID: $projectID, input: $deleteDSInput)
}
`;
export const CREATE_DASHBOARD = gql`
mutation createDashBoard($dashboard: CreateDBInput!) {
createDashBoard(dashboard: $dashboard) {
dbID
}
}
`;
export const UPDATE_DASHBOARD = gql`
mutation updateDashboard(
$projectID: String!
$dashboard: UpdateDBInput!
$chaosQueryUpdate: Boolean!
) {
updateDashboard(
projectID: $projectID
dashboard: $dashboard
chaosQueryUpdate: $chaosQueryUpdate
)
}
`;
export const DELETE_DASHBOARD = gql`
mutation deleteDashboard($projectID: String!, $dbID: String) {
deleteDashboard(projectID: $projectID, dbID: $dbID)
}
`;
export const UPDATE_PANEL = gql`
mutation updatePanel($panelInput: [panel]) {
updatePanel(panelInput: $panelInput)
}
`;

View File

@ -0,0 +1,50 @@
import { gql } from '@apollo/client';
// chaosHub (Change mutation name to add_chaos_hub)
export const ADD_MY_HUB = gql`
mutation addChaosHub($request: CreateChaosHubRequest!) {
addChaosHub(request: $request) {
hubName
repoURL
repoBranch
}
}
`;
export const UPDATE_MY_HUB = gql`
mutation updateChaosHub($request: UpdateChaosHubRequest!) {
updateChaosHub(request: $request) {
hubName
repoURL
repoBranch
}
}
`;
export const SYNC_REPO = gql`
mutation syncChaosHub($id: ID!, $projectID: String!) {
syncChaosHub(id: $id, projectID: $projectID) {
id
repoURL
repoBranch
isAvailable
totalExp
hubName
}
}
`;
export const DELETE_HUB = gql`
mutation deleteChaosHub($hubID: String!, $projectID: String!) {
deleteChaosHub(hubID: $hubID, projectID: $projectID)
}
`;
export const GENERATE_SSH = gql`
mutation generateSSHKey {
generaterSSHKey {
privateKey
publicKey
}
}
`;

View File

@ -0,0 +1,20 @@
import { gql } from '@apollo/client';
// gitOps
export const ENABLE_GITOPS = gql`
mutation enableGitOps($config: GitConfigResponse!) {
enableGitOps(config: $config)
}
`;
export const UPDATE_GITOPS = gql`
mutation updateGitOps($config: GitConfigResponse!) {
updateGitOps(config: $config)
}
`;
export const DISABLE_GITOPS = gql`
mutation disableGitOps($projectID: String!) {
disableGitOps(projectID: $data)
}
`;

View File

@ -0,0 +1,42 @@
import { gql } from '@apollo/client';
// ImageResgistry
export const ADD_IMAGE_REGISTRY = gql`
mutation createImageRegistry(
$projectID: String!
$imageRegistryInfo: imageRegistryInput!
) {
createImageRegistry(
projectID: $projectID
imageRegistryInfo: $imageRegistryInfo
) {
imageRegistryInfo {
imageRepoName
imageRegistryName
imageRegistryType
isDefault
}
}
}
`;
export const UPDATE_IMAGE_REGISTRY = gql`
mutation updateImageRegistry(
$imageRegistryID: String!
$projectID: String!
$imageRegistryInfo: ImageRegistryInput!
) {
updateImageRegistry(
imageRegistryID: $imageRegistryID
projectID: $projectID
imageRegistryInfo: $imageRegistryInfo
) {
imageRegistryInfo {
imageRepoName
imageRegistryName
imageRegistryType
isDefault
}
}
}
`;

View File

@ -0,0 +1,6 @@
export * from './analytics';
export * from './chaosHub';
export * from './gitOps';
export * from './imageRegistry';
export * from './template';
export * from './workflows';

View File

@ -0,0 +1,22 @@
import { gql } from '@apollo/client';
export const ADD_WORKFLOW_TEMPLATE = gql`
mutation createWorkflowTemplate($request: TemplateInput!) {
createWorkflowTemplate(request: $request) {
templateName
templateID
}
}
`;
export const DELETE_WORKFLOW_TEMPLATE = gql`
mutation deleteWorkflowTemplate($projectID: String!, $templateID: String!) {
deleteWorkflowTemplate(projectID: $projectID, templateID: $templateID)
}
`;
export const DELETE_CLUSTERS = gql`
mutation deleteClusters($projectID: String!, $clusterIDs: [String]!) {
deleteClusters(projectID: $projectID, clusterIDs: $clusterIDs)
}
`;

View File

@ -0,0 +1,74 @@
import { gql } from '@apollo/client';
// Workflow
export const CREATE_WORKFLOW = gql`
mutation createChaosWorkFlow($request: ChaosWorkFlowRequest!) {
createChaosWorkFlow(request: $request) {
workflowID
cronSyntax
workflowName
workflowDescription
isCustomWorkflow
}
}
`;
export const UPDATE_SCHEDULE = gql`
mutation updateChaosWorkflow($ChaosWorkFlowInput: ChaosWorkFlowInput!) {
updateChaosWorkflow(input: $ChaosWorkFlowInput) {
workflowID
cronSyntax
workflowName
workflowDescription
isCustomWorkflow
}
}
`;
export const RERUN_CHAOS_WORKFLOW = gql`
mutation reRunChaosWorkflow($projectID: String!, $workflowID: String!) {
reRunChaosWorkFlow(projectID: $projectID, workflowID: $workflowID)
}
`;
export const SYNC_WORKFLOW = gql`
mutation syncWorkflow(
$projectID: String!
$workflowID: String!
$workflowRunID: String!
) {
syncWorkflow(
projectID: $projectID
workflowID: $workflowID
workflowRunID: $workflowRunID
)
}
`;
export const DELETE_WORKFLOW = gql`
mutation deleteChaosWorkflow(
$projectID: String!
$workflowID: String
$workflowRunID: String
) {
deleteChaosWorkflow(
projectID: $projectID
workflowID: $workflowID
workflowRunID: $workflowRunID
)
}
`;
export const TERMINATE_WORKFLOW = gql`
mutation terminateWorkflow(
$projectID: String!
$workflowID: String
$workflowRunID: String
) {
terminateChaosWorkflow(
projectID: $projectID
workflowID: $workflowID
workflowRunID: $workflowRunID
)
}
`;

View File

@ -1,648 +0,0 @@
import { gql } from '@apollo/client';
export const WORKFLOW_DETAILS_WITH_EXEC_DATA = gql`
query workflowDetails($workflowRunsInput: GetWorkflowRunsInput!) {
getWorkflowRuns(workflowRunsInput: $workflowRunsInput) {
total_no_of_workflow_runs
workflow_runs {
workflow_id
workflow_name
workflow_run_id
cluster_name
last_updated
cluster_id
phase
execution_data
resiliency_score
isRemoved
executed_by
}
}
}
`;
export const WORKFLOW_DETAILS = gql`
query workflowDetails($workflowRunsInput: GetWorkflowRunsInput!) {
getWorkflowRuns(workflowRunsInput: $workflowRunsInput) {
total_no_of_workflow_runs
workflow_runs {
workflow_run_id
workflow_id
cluster_name
last_updated
project_id
cluster_id
workflow_name
cluster_type
phase
resiliency_score
experiments_passed
experiments_failed
experiments_awaited
experiments_stopped
experiments_na
total_experiments
isRemoved
executed_by
}
}
}
`;
export const WORKFLOW_RUN_DETAILS = gql`
query workflowDetails($workflowRunsInput: GetWorkflowRunsInput!) {
getWorkflowRuns(workflowRunsInput: $workflowRunsInput) {
total_no_of_workflow_runs
workflow_runs {
weightages {
experiment_name
weightage
}
workflow_id
workflow_name
workflow_run_id
cluster_name
execution_data
last_updated
phase
resiliency_score
experiments_passed
total_experiments
isRemoved
executed_by
}
}
}
`;
export const WORKFLOW_STATS = gql`
query getWorkflowStats(
$filter: TimeFrequency!
$project_id: ID!
$show_workflow_runs: Boolean!
) {
getWorkflowStats(
filter: $filter
project_id: $project_id
show_workflow_runs: $show_workflow_runs
) {
date
value
}
}
`;
export const STACKED_BAR_GRAPH = gql`
query workflowDetails($workflowRunsInput: GetWorkflowRunsInput!) {
getWorkflowRuns(workflowRunsInput: $workflowRunsInput) {
total_no_of_workflow_runs
workflow_runs {
workflow_run_id
workflow_name
last_updated
total_experiments
experiments_passed
resiliency_score
}
}
}
`;
export const WORKFLOW_LIST_DETAILS = gql`
query workflowListDetails($workflowInput: ListWorkflowsInput!) {
ListWorkflow(workflowInput: $workflowInput) {
total_no_of_workflows
workflows {
workflow_id
workflow_manifest
cronSyntax
cluster_name
workflow_name
workflow_description
weightages {
experiment_name
weightage
}
isCustomWorkflow
updated_at
created_at
project_id
cluster_id
cluster_type
isRemoved
last_updated_by
}
}
}
`;
export const WORKFLOW_LIST_DETAILS_FOR_MANIFEST = gql`
query workflowListDetails($projectID: String!, $workflowIDs: [ID]) {
ListWorkflow(project_id: $projectID, workflow_ids: $workflowIDs) {
workflow_id
workflow_manifest
workflow_name
}
}
`;
export const GET_WORKFLOW_RUNS_STATS = gql`
query getWorkflowRunStats(
$workflowRunStatsRequest: WorkflowRunStatsRequest!
) {
getWorkflowRunStats(workflowRunStatsRequest: $workflowRunStatsRequest) {
total_workflow_runs
succeeded_workflow_runs
failed_workflow_runs
running_workflow_runs
workflow_run_succeeded_percentage
workflow_run_failed_percentage
average_resiliency_score
passed_percentage
failed_percentage
total_experiments
experiments_passed
experiments_failed
experiments_awaited
experiments_stopped
experiments_na
}
}
`;
export const GET_CLUSTER = gql`
query getClusters($project_id: String!, $cluster_type: String) {
getCluster(project_id: $project_id, cluster_type: $cluster_type) {
cluster_id
cluster_name
description
is_active
is_registered
is_cluster_confirmed
updated_at
created_at
cluster_type
no_of_schedules
no_of_workflows
token
last_workflow_timestamp
agent_namespace
agent_scope
version
}
}
`;
export const GET_CLUSTER_LENGTH = gql`
query getClusters($project_id: String!) {
getCluster(project_id: $project_id) {
cluster_id
}
}
`;
export const GET_CLUSTER_NAMES = gql`
query getClusters($project_id: String!) {
getCluster(project_id: $project_id) {
cluster_name
}
}
`;
export const ALL_USERS = gql`
query allUsers {
users {
id
name
username
email
created_at
deactivated_at
}
}
`;
export const CORE_CHART_FIELDS = gql`
fragment CoreChartFields on Chart {
ApiVersion
Kind
Metadata {
Name
Version
Annotations {
Categories
Vendor
CreatedAt
Repository
Support
ChartDescription
}
}
Spec {
DisplayName
CategoryDescription
Keywords
Maturity
Experiments
Maintainers {
Name
Email
}
MinKubeVersion
Provider
Links {
Name
Url
}
ChaosExpCRDLink
Platforms
ChaosType
}
PackageInfo {
PackageName
Experiments {
Name
CSV
Desc
}
}
}
`;
export const GET_CHARTS_DATA = gql`
${CORE_CHART_FIELDS}
query getCharts($HubName: String!, $projectID: String!) {
getCharts(HubName: $HubName, projectID: $projectID) {
...CoreChartFields
}
}
`;
export const GET_EXPERIMENT_DATA = gql`
${CORE_CHART_FIELDS}
query getExperiment($data: ExperimentInput!) {
getHubExperiment(experimentInput: $data) {
...CoreChartFields
}
}
`;
export const GET_HUB_STATUS = gql`
query getHubStatus($data: String!) {
getHubStatus(projectID: $data) {
id
HubName
RepoBranch
RepoURL
TotalExp
IsAvailable
AuthType
IsPrivate
Token
UserName
Password
SSHPrivateKey
SSHPublicKey
LastSyncedAt
}
}
`;
export const GET_ENGINE_YAML = gql`
query getEngineData($experimentInput: ExperimentInput!) {
getYAMLData(experimentInput: $experimentInput)
}
`;
export const GET_EXPERIMENT_YAML = gql`
query getExperimentData($experimentInput: ExperimentInput!) {
getYAMLData(experimentInput: $experimentInput)
}
`;
export const GET_GITOPS_DATA = gql`
query gitOPsData($data: String!) {
getGitOpsDetails(project_id: $data) {
Enabled
ProjectID
Branch
RepoURL
AuthType
Token
UserName
Password
SSHPrivateKey
}
}
`;
export const LIST_MANIFEST_TEMPLATE = gql`
query ListManifestTemplate($data: String!) {
ListManifestTemplate(project_id: $data) {
template_id
manifest
project_name
template_description
template_name
isCustomWorkflow
}
}
`;
export const LIST_DATASOURCE = gql`
query listDataSource($projectID: String!) {
ListDataSource(project_id: $projectID) {
ds_id
ds_name
ds_type
ds_url
access_type
auth_type
basic_auth_username
basic_auth_password
scrape_interval
query_timeout
http_method
project_id
created_at
updated_at
health_status
}
}
`;
export const LIST_DATASOURCE_OVERVIEW = gql`
query listDataSource($projectID: String!) {
ListDataSource(project_id: $projectID) {
ds_id
}
}
`;
export const GET_PORTAL_DASHBOARDS = gql`
query getPortalDashboards($projectID: String!, $hubName: String!) {
PortalDashboardData(project_id: $projectID, hub_name: $hubName) {
name
dashboard_data
}
}
`;
export const LIST_DASHBOARD = gql`
query listDashboard($projectID: String!, $clusterID: String, $dbID: String) {
ListDashboard(
project_id: $projectID
cluster_id: $clusterID
db_id: $dbID
) {
db_id
ds_id
db_name
cluster_name
ds_name
ds_type
ds_url
ds_health_status
db_type_id
db_type_name
db_information
chaos_event_query_template
chaos_verdict_query_template
application_metadata_map {
namespace
applications {
kind
names
}
}
panel_groups {
panels {
panel_id
created_at
prom_queries {
queryid
prom_query_name
legend
resolution
minstep
line
close_area
}
panel_options {
points
grids
left_axis
}
panel_name
y_axis_left
y_axis_right
x_axis_down
unit
}
panel_group_name
panel_group_id
}
end_time
start_time
refresh_rate
project_id
cluster_id
viewed_at
}
}
`;
export const LIST_DASHBOARD_OVERVIEW = gql`
query listDashboard($projectID: String!, $clusterID: String, $dbID: String) {
ListDashboard(
project_id: $projectID
cluster_id: $clusterID
db_id: $dbID
) {
db_id
db_name
db_type_id
db_type_name
cluster_name
cluster_id
viewed_at
db_information
chaos_event_query_template
chaos_verdict_query_template
application_metadata_map {
namespace
applications {
kind
names
}
}
panel_groups {
panels {
panel_id
created_at
prom_queries {
queryid
prom_query_name
legend
resolution
minstep
line
close_area
}
panel_options {
points
grids
left_axis
}
panel_name
y_axis_left
y_axis_right
x_axis_down
unit
}
panel_group_name
panel_group_id
}
}
}
`;
export const PROM_QUERY = gql`
query PrometheusQuery($prometheusInput: promInput) {
GetPromQuery(query: $prometheusInput) {
metricsResponse {
queryid
legends
tsvs {
date
value
}
}
annotationsResponse {
queryid
legends
tsvs {
date
value
}
}
}
}
`;
export const PROM_LABEL_VALUES = gql`
query PrometheusLabelValues($prometheusInput: promSeriesInput) {
GetPromLabelNamesAndValues(series: $prometheusInput) {
series
labelValues {
label
values {
name
}
}
}
}
`;
export const PROM_SERIES_LIST = gql`
query PrometheusSeriesList($prometheusDSInput: dsDetails) {
GetPromSeriesList(ds_details: $prometheusDSInput) {
seriesList
}
}
`;
export const GET_TEMPLATE_BY_ID = gql`
query GetManifestTemplate($projectID: String!, $data: String!) {
GetTemplateManifestByID(projectID: $projectID, template_id: $data) {
template_id
template_name
template_description
manifest
}
}
`;
export const GET_PREDEFINED_WORKFLOW_LIST = gql`
query GetPredefinedWorkflowList($hubname: String!, $projectid: String!) {
GetPredefinedWorkflowList(HubName: $hubname, projectID: $projectid)
}
`;
export const GET_PREDEFINED_EXPERIMENT_YAML = gql`
query GetPredefinedExperimentYAML($experimentInput: ExperimentInput!) {
GetPredefinedExperimentYAML(experimentInput: $experimentInput)
}
`;
export const LIST_IMAGE_REGISTRY = gql`
query ListImageRegistry($data: String!) {
ListImageRegistry(project_id: $data) {
image_registry_info {
enable_registry
is_default
}
image_registry_id
}
}
`;
export const GET_IMAGE_REGISTRY = gql`
query GetImageRegistry($registryid: String!, $projectid: String!) {
GetImageRegistry(image_registry_id: $registryid, project_id: $projectid) {
image_registry_info {
is_default
enable_registry
secret_name
secret_namespace
image_registry_name
image_repo_name
image_registry_type
}
image_registry_id
}
}
`;
export const GET_GLOBAL_STATS = gql`
query getGlobalStats($query: UsageQuery!) {
UsageQuery(query: $query) {
TotalCount {
Workflows {
Runs
ExpRuns
Schedules
}
Agents {
Ns
Cluster
Total
}
Projects
Users
}
}
}
`;
export const GLOBAL_PROJECT_DATA = gql`
query getStats($query: UsageQuery!) {
UsageQuery(query: $query) {
TotalCount {
Projects
}
Projects {
ProjectId
Workflows {
Schedules
ExpRuns
Runs
}
Agents {
Total
Ns
Cluster
}
}
}
}
`;

View File

@ -0,0 +1,108 @@
import { gql } from '@apollo/client';
// listHubStatus
export const CORE_CHART_FIELDS = gql`
fragment CoreChartFields on Chart {
apiVersion
kind
metadata {
name
version
annotations {
categories
vendor
createdAt
repository
support
chartDescription
}
}
spec {
displayName
categoryDescription
keywords
maturity
experiments
maintainers {
name
email
}
minKubeVersion
provider {
name
}
links {
name
url
}
chaosExpCRDLink
platforms
chaosType
}
packageInfo {
packageName
experiments {
name
CSV
desc
}
}
}
`;
export const GET_CHARTS_DATA = gql`
${CORE_CHART_FIELDS}
query listCharts($hubName: String!, $projectID: String!) {
listCharts(hubName: $hubName, projectID: $projectID) {
...CoreChartFields
}
}
`;
export const GET_EXPERIMENT_DATA = gql`
${CORE_CHART_FIELDS}
query getHubExperiment($request: ExperimentRequest!) {
getHubExperiment(request: $request) {
...CoreChartFields
}
}
`;
export const GET_HUB_STATUS = gql`
query listHubStatus($projectID: String!) {
listHubStatus(projectID: $projectID) {
id
hubName
repoBranch
repoURL
totalExp
isAvailable
authType
isPrivate
token
userName
password
sshPrivateKey
sshPublicKey
lastSyncedAt
}
}
`;
export const GET_PREDEFINED_EXPERIMENT_YAML = gql`
query getPredefinedExperimentYAML($request: ExperimentRequest!) {
getPredefinedExperimentYAML(request: $request)
}
`;
export const GET_ENGINE_YAML = gql`
query getEngineData($request: ExperimentRequest!) {
getYAMLData(request: $request)
}
`;
export const GET_EXPERIMENT_YAML = gql`
query getYAMLData($request: ExperimentRequest!) {
getYAMLData(request: $request)
}
`;

View File

@ -0,0 +1,40 @@
import { gql } from '@apollo/client';
export const GET_CLUSTER = gql`
query listClusters($projectID: String!, $clusterType: String) {
listClusters(projectID: $projectID, clusterType: $clusterType) {
clusterID
clusterName
description
isActive
isRegistered
isClusterConfirmed
updatedAt
createdAt
clusterType
noOfSchedules
noOfWorkflows
token
lastWorkflowTimestamp
agentNamespace
agentScope
version
}
}
`;
export const GET_CLUSTER_LENGTH = gql`
query listClusters($projectID: String!) {
listClusters(projectID: $projectID) {
clusterID
}
}
`;
export const GET_CLUSTER_NAMES = gql`
query listClusters($projectID: String!) {
listClusters(projectID: $projectID) {
clusterName
}
}
`;

View File

@ -0,0 +1,18 @@
import { gql } from '@apollo/client';
// getGitOpsDetails
export const GET_GITOPS_DATA = gql`
query getGitOpsDetails($projectID: String!) {
getGitOpsDetails(projectID: $projectID) {
enabled
projectID
branch
repoURL
authType
token
userName
password
sshPrivateKey
}
}
`;

View File

@ -0,0 +1,32 @@
import { gql } from '@apollo/client';
// GetImageRegistry
export const LIST_IMAGE_REGISTRY_BY_PROJECT_ID = gql`
query listImageRegistry($data: String!) {
listImageRegistry(projectID: $data) {
imageRegistryInfo {
enableRegistry
isDefault
}
imageRegistryID
}
}
`;
// getImageRegistry
export const GET_IMAGE_REGISTRY = gql`
query getImageRegistry($imageRegistryID: String!, $projectID: String!) {
getImageRegistry(imageRegistryID: $imageRegistryID, projectID: $projectID) {
imageRegistryInfo {
isDefault
enableRegistry
secretName
secretNamespace
imageRegistryName
imageRepoName
imageRegistryType
}
imageRegistryID
}
}
`;

View File

@ -0,0 +1,8 @@
export * from './chaosHub';
export * from './cluster';
export * from './gitops';
export * from './imageRegistry';
export * from './manifest';
export * from './observability';
export * from './usage';
export * from './workflows';

View File

@ -0,0 +1,26 @@
import { gql } from '@apollo/client';
// GetManifestTemplate
export const GET_MANIFEST_TEMPLATE = gql`
query listWorkflowManifests($projectID: String!) {
listWorkflowManifests(projectID: $projectID) {
templateID
manifest
projectName
templateDescription
templateName
isCustomWorkflow
}
}
`;
export const GET_TEMPLATE_BY_ID = gql`
query getWorkflowManifestByID($projectID: String!, $templateID: String!) {
getWorkflowManifestByID(templateID: $templateID, projectID: $projectID) {
templateID
templateName
templateDescription
manifest
}
}
`;

View File

@ -0,0 +1,202 @@
import { gql } from '@apollo/client';
// GetDataSource
export const GET_DATASOURCE = gql`
query listDataSource($projectID: String!) {
listDataSource(projectID: $projectID) {
dsID
dsName
dsType
dsURL
accessType
authType
basicAuthUsername
basicAuthPassword
scrapeInterval
queryTimeout
httpMethod
projectID
healthStatus
createdAt
updatedAt
}
}
`;
export const GET_DATASOURCE_OVERVIEW = gql`
query listDataSource($projectID: String!) {
listDataSource(projectID: $projectID) {
dsID
}
}
`;
// portalDashboardData
export const GET_PORTAL_DASHBOARDS = gql`
query listPortalDashboardData($projectID: String!, $hubName: String!) {
listPortalDashboardData(projectID: $projectID, hubName: $hubName) {
name
dashboardData
}
}
`;
// listDashboard
export const GET_DASHBOARD = gql`
query listDashboard($projectID: String!, $clusterID: String, $dbID: String) {
listDashboard(projectID: $projectID, clusterID: $clusterID, dbID: $dbID) {
dbID
dsID
dbName
clusterName
dsName
dsType
dsURL
dsHealthStatus
dbTypeID
dbTypeName
dbInformation
chaosEventQueryTemplate
chaosVerdictQueryTemplate
applicationMetadataMap {
namespace
applications {
kind
names
}
}
panelGroups {
panels {
panelID
createdAt
promQueries {
queryID
promQueryName
legend
resolution
minstep
line
closeArea
}
panelOptions {
points
grIDs
leftAxis
}
panelName
yAxisLeft
yAxisRight
xAxisDown
unit
}
panelGroupName
panelGroupID
}
endTime
startTime
refreshRate
projectID
clusterID
viewedAt
}
}
`;
export const GET_DASHBOARD_OVERVIEW = gql`
query listDashboard($projectID: String!, $clusterID: String, $dbID: String) {
listDashboard(projectID: $projectID, clusterID: $clusterID, dbID: $dbID) {
dbID
dbName
dbTypeID
dbTypeName
clusterName
clusterID
viewedAt
dbInformation
chaosEventQueryTemplate
chaosVerdictQueryTemplate
applicationMetadataMap {
namespace
applications {
kind
names
}
}
panelGroups {
panels {
panelID
createdAt
promQueries {
queryID
promQueryName
legend
resolution
minstep
line
closeArea
}
panelOptions {
points
grIDs
leftAxis
}
panelName
yAxisLeft
yAxisRight
xAxisDown
unit
}
panelGroupName
panelGroupID
}
}
}
`;
// getPromQuery
export const PROM_QUERY = gql`
query PrometheusQuery($request: PrometheusDataRequest!) {
getPrometheusData(request: $request) {
metricsResponse {
queryID
legends
tsvs {
date
value
}
}
annotationsResponse {
queryID
legends
tsvs {
date
value
}
}
}
}
`;
// getPromLabelNamesAndValues
export const PROM_LABEL_VALUES = gql`
query PrometheusLabelValues($request: PromSeriesInput) {
getPromLabelNamesAndValues(request: $request) {
series
labelValues {
label
values {
name
}
}
}
}
`;
// getPromSeriesList
export const PROM_SERIES_LIST = gql`
query getPromSeriesList($request: DsDetails) {
getPromSeriesList(request: $request) {
seriesList
}
}
`;

View File

@ -0,0 +1,58 @@
import { gql } from '@apollo/client';
// usageQuery
export const GET_GLOBAL_STATS = gql`
query getGlobalStats($request: UsageDataRequest!) {
getUsageData(request: $request) {
totalCount {
projects
users
agents {
ns
cluster
total
}
workflows {
schedules
runs
expRuns
}
}
}
}
`;
// projectId -> projectID needs to be updated in backend
export const GLOBAL_PROJECT_DATA = gql`
query getStats($request: UsageDataRequest!) {
getUsageData(request: $request) {
totalCount {
projects
agents {
ns
total
cluster
active
}
workflows {
schedules
runs
expRuns
}
}
projects {
projectID
workflows {
schedules
runs
expRuns
}
agents {
ns
cluster
total
}
}
}
}
`;

View File

@ -0,0 +1,154 @@
import { gql } from '@apollo/client';
// GetWorkflowRuns
export const WORKFLOW_DETAILS_WITH_EXEC_DATA = gql`
query listWorkflowRuns($request: ListWorkflowRunsRequest!) {
listWorkflowRuns(request: $request) {
totalNoOfWorkflowRuns
workflowRuns {
workflowID
workflowName
workflowRunID
clusterName
lastUpdated
clusterID
phase
executionData
resiliencyScore
isRemoved
}
}
}
`;
export const WORKFLOW_DETAILS = gql`
query listWorkflowRuns($request: ListWorkflowRunsRequest!) {
listWorkflowRuns(request: $request) {
totalNoOfWorkflowRuns
workflowRuns {
workflowRunID
workflowID
clusterName
lastUpdated
projectID
clusterID
workflowName
clusterType
phase
resiliencyScore
experimentsPassed
experimentsFailed
experimentsAwaited
experimentsStopped
experimentsNa
totalExperiments
isRemoved
executedBy
}
}
}
`;
export const WORKFLOW_RUN_DETAILS = gql`
query listWorkflowRuns($request: ListWorkflowRunsRequest!) {
listWorkflowRuns(request: $request) {
totalNoOfWorkflowRuns
workflowRuns {
weightages {
experimentName
weightage
}
workflowID
workflowName
workflowRunID
clusterName
executionData
lastUpdated
phase
resiliencyScore
experimentsPassed
totalExperiments
isRemoved
}
}
}
`;
// getWorkflowStats
export const WORKFLOW_STATS = gql`
query listWorkflowStats(
$projectID: ID!
$filter: TimeFrequency!
$showWorkflowRuns: Boolean!
) {
listWorkflowStats(
projectID: $projectID
filter: $filter
showWorkflowRuns: $showWorkflowRuns
) {
date
value
}
}
`;
// ListWorkflow
export const GET_WORKFLOW_DETAILS = gql`
query listWorkflows($request: ListWorkflowsRequest!) {
listWorkflows(request: $request) {
totalNoOfWorkflows
workflows {
workflowID
workflowManifest
cronSyntax
clusterName
workflowName
workflowDescription
weightages {
experimentName
weightage
}
isCustomWorkflow
updatedAt
createdAt
projectID
clusterID
clusterType
isRemoved
lastUpdatedBy
}
}
}
`;
// getWorkflowRunStats
export const GET_WORKFLOW_RUNS_STATS = gql`
query getWorkflowRunStats(
$workflowRunStatsRequest: WorkflowRunStatsRequest!
) {
getWorkflowRunStats(workflowRunStatsRequest: $workflowRunStatsRequest) {
totalWorkflowRuns
succeededWorkflowRuns
failedWorkflowRuns
runningWorkflowRuns
workflowRunSucceededPercentage
workflowRunFailedPercentage
averageResiliencyScore
passedPercentage
failedPercentage
totalExperiments
experimentsPassed
experimentsFailed
experimentsAwaited
experimentsStopped
experimentsNa
}
}
`;
// getPredefinedWorkflowList
export const GET_PREDEFINED_WORKFLOW_LIST = gql`
query listPredefinedWorkflows($hubName: String!, $projectID: String!) {
listPredefinedWorkflows(hubName: $hubName, projectID: $projectID)
}
`;

View File

@ -1,73 +1,73 @@
import { gql } from '@apollo/client'; import { gql } from '@apollo/client';
export const WORKFLOW_EVENTS_WITH_EXEC_DATA = gql` export const WORKFLOW_EVENTS_WITH_EXEC_DATA = gql`
subscription workflowEvents($projectID: String!) { subscription getWorkflowEvents($projectID: String!) {
workflowEventListener(project_id: $projectID) { getWorkflowEvents(projectID: $projectID) {
workflow_id workflowID
workflow_name workflowName
workflow_run_id workflowRunID
cluster_name clusterName
last_updated lastUpdated
cluster_id clusterID
phase phase
execution_data executionData
resiliency_score resiliencyScore
} }
} }
`; `;
export const WORKFLOW_EVENTS = gql` export const WORKFLOW_EVENTS = gql`
subscription workflowEvents($projectID: String!) { subscription getWorkflowEvents($projectID: String!) {
workflowEventListener(project_id: $projectID) { getWorkflowEvents(projectID: $projectID) {
workflow_id workflowID
workflow_name workflowName
workflow_run_id workflowRunID
cluster_name clusterName
last_updated lastUpdated
phase phase
resiliency_score resiliencyScore
experiments_passed experimentsPassed
total_experiments totalExperiments
} }
} }
`; `;
export const WORKFLOW_LOGS = gql` export const WORKFLOW_LOGS = gql`
subscription podLog($podDetails: PodLogRequest!) { subscription podLog($request: PodLogRequest!) {
getPodLog(podDetails: $podDetails) { getPodLog(request: $request) {
log log
} }
} }
`; `;
export const KUBE_OBJ = gql` export const KUBE_OBJ = gql`
subscription getKubeObject($data: KubeObjectRequest!) { subscription getKubeObject($request: KubeObjectRequest!) {
getKubeObject(kubeObjectRequest: $data) { getKubeObject(request: $request) {
cluster_id clusterID
kube_obj kubeObj
} }
} }
`; `;
export const VIEW_DASHBOARD = gql` export const VIEW_DASHBOARD = gql`
subscription viewDashboard( subscription viewDashboard(
$dbID: String $dashboardID: String
$prometheusQueries: [promQueryInput!]! $promQueries: [PromQueryInput!]!
$queryMap: [queryMapForPanelGroup!]! $dashboardQueryMap: [QueryMapForPanelGroup!]!
$dataVarMap: dataVars! $dataVariables: DataVars!
) { ) {
viewDashboard( viewDashboard(
dashboardID: $dbID dashboardID: $dashboardID
promQueries: $prometheusQueries promQueries: $promQueries
dashboardQueryMap: $queryMap dashboardQueryMap: $dashboardQueryMap
dataVariables: $dataVarMap dataVariables: $dataVariables
) { ) {
dashboardMetricsResponse { dashboardMetricsResponse {
panelGroupID panelGroupID
panelGroupMetricsResponse { panelGroupMetricsResponse {
panelID panelID
PanelMetricsResponse { panelMetricsResponse {
queryid queryID
legends legends
tsvs { tsvs {
date date
@ -77,7 +77,7 @@ export const VIEW_DASHBOARD = gql`
} }
} }
annotationsResponse { annotationsResponse {
queryid queryID
legends legends
tsvs { tsvs {
date date

View File

@ -1,14 +1,14 @@
import { BrushPostitionProps, GraphMetric } from 'litmus-ui'; import { BrushPostitionProps, GraphMetric } from 'litmus-ui';
import { import {
ApplicationMetadata, ApplicationMetadata,
ListDashboardResponse, GetDashboardResponse,
Panel, Panel,
PanelGroup, PanelGroup,
PanelGroupResponse, PanelGroupResponse,
PanelOption, PanelOption,
PanelResponse, PanelResponse,
PromQuery, PromQuery,
updatePanelGroupInput, UpdatePanelGroupRequest,
} from './graphql/dashboardsDetails'; } from './graphql/dashboardsDetails';
import { promQueryInput } from './graphql/prometheus'; import { promQueryInput } from './graphql/prometheus';
@ -74,7 +74,7 @@ export interface DashboardDetails {
agentID?: string; agentID?: string;
information?: string; information?: string;
panelGroups?: PanelGroupDetails[]; panelGroups?: PanelGroupDetails[];
panelGroupMap?: updatePanelGroupInput[]; panelGroupMap?: UpdatePanelGroupRequest[];
selectedPanelGroupMap?: PanelGroupMap[]; selectedPanelGroupMap?: PanelGroupMap[];
applicationMetadataMap?: ApplicationMetadata[]; applicationMetadataMap?: ApplicationMetadata[];
selectedPanels?: PanelDetails[]; selectedPanels?: PanelDetails[];
@ -165,8 +165,8 @@ export interface SelectedDashboardInformation {
chaosEventQueryTemplate: string; chaosEventQueryTemplate: string;
chaosVerdictQueryTemplate: string; chaosVerdictQueryTemplate: string;
applicationMetadataMap: ApplicationMetadata[]; applicationMetadataMap: ApplicationMetadata[];
dashboardListForAgent: ListDashboardResponse[]; dashboardListForAgent: GetDashboardResponse[];
metaData: ListDashboardResponse | undefined; metaData: GetDashboardResponse | undefined;
closedAreaQueryIDs: string[]; closedAreaQueryIDs: string[];
dashboardKey: string; dashboardKey: string;
panelNameAndIDList: PanelNameAndID[]; panelNameAndIDList: PanelNameAndID[];
@ -187,9 +187,9 @@ export interface PromQueryDetails extends PromQuery {
} }
export interface PanelDetails extends Panel { export interface PanelDetails extends Panel {
ds_url?: string; dsURL?: string;
panel_group_name?: string; panelGroupName?: string;
prom_queries: PromQueryDetails[]; promQueries: PromQueryDetails[];
} }
export interface PanelGroupDetails extends PanelGroup { export interface PanelGroupDetails extends PanelGroup {

View File

@ -0,0 +1,44 @@
export interface SSHKey {
privateKey: string;
publicKey: string;
}
export interface SSHKeys {
generaterSSHKey: SSHKey;
}
export interface MyHubRequest {
id?: string;
hubName: string;
repoURL: string;
repoBranch: string;
isPrivate: Boolean;
authType: MyHubType;
token?: string;
userName?: string;
password?: string;
sshPrivateKey?: string;
sshPublicKey?: string;
projectID: string;
}
export interface MyHubData {
id: string;
repoURL: string;
repoBranch: string;
projectID: string;
hubName: string;
createdAt: string;
updatedAt: string;
}
export interface CreateMyHub {
request: MyHubRequest;
}
export enum MyHubType {
BASIC = 'BASIC',
TOKEN = 'TOKEN',
SSH = 'SSH',
NONE = 'NONE',
}

View File

@ -1,62 +1,52 @@
export interface Cluster { export interface Cluster {
cluster_id: string; clusterID: string;
project_id: string; projectID: string;
cluster_name: string; clusterName: string;
description: string; description: string;
platform_name: string; platformName: string;
access_key: string; accessKey: string;
is_registered: boolean; isRegistered: boolean;
is_cluster_confirmed: boolean; isClusterConfirmed: boolean;
is_active: boolean; isActive: boolean;
updated_at: string; updatedAt: string;
created_at: string; createdAt: string;
cluster_type: string; clusterType: string;
no_of_workflows: number; noOfWorkflows: number;
no_of_schedules: number; noOfSchedules: number;
token: string; token: string;
agent_namespace: string; agentNamespace: string;
serviceaccount: string; serviceAccount: string;
agent_scope: string; agentScope: string;
agent_ns_exists: boolean; agentNSExists: boolean;
agent_sa_exists: boolean; agentSAExists: boolean;
last_workflow_timestamp: string; lastWorkflowTimestamp: string;
version: string; version: string;
} }
export interface Clusters { export interface Clusters {
getCluster: Cluster[]; listClusters: Cluster[];
} }
export interface CreateClusterInput { export interface CreateClusterRequest {
ClusterInput: { request: {
cluster_name: string; clusterName: string;
description: string; description: string;
platform_name: string; platformName: string;
project_id: string; projectID: string;
cluster_type: string; clusterType: string;
agent_namespace: string; agentNamespace: string;
serviceaccount: string; serviceAccount: string;
agent_scope: string; agentScope: string;
agent_ns_exists: boolean; agentNSExists: boolean;
agent_sa_exists: boolean; agentSAExists: boolean;
}; };
} }
export interface clusterRegResponse { export interface ClusterRequest {
token: string; projectID: string;
cluster_id: string;
cluster_name: string;
}
export interface CreateClusterInputResponse {
userClusterReg: clusterRegResponse;
}
export interface ClusterVars {
project_id: string;
} }
export interface DeleteClusters { export interface DeleteClusters {
projectID: string; projectID: string;
cluster_ids: string; clusterIDs: string;
} }

View File

@ -1,32 +1,33 @@
export interface WeightMap { export interface WeightMap {
experiment_name: string; experimentName: string;
weightage: number; weightage: number;
} }
export interface CreateWorkFlowInput {
ChaosWorkFlowInput: { export interface CreateWorkFlowRequest {
workflow_id?: string; request: {
workflow_manifest: string; workflowID?: string;
workflowManifest: string;
cronSyntax: string; cronSyntax: string;
workflow_name: string; workflowName: string;
workflow_description: string; workflowDescription: string;
isCustomWorkflow: boolean; isCustomWorkflow: boolean;
weightages: WeightMap[]; weightages: WeightMap[];
project_id: string; projectID: string;
cluster_id: string; clusterID: string;
}; };
} }
export interface UpdateWorkflowResponse { export interface UpdateWorkflowResponse {
workflow_id: string; workflowID: string;
workflow_name: string; workflowName: string;
workflow_description: string; workflowDescription: string;
isCustomWorkflow: string; isCustomWorkflow: string;
cronSyntax: string; cronSyntax: string;
} }
export interface CreateWorkflowResponse { export interface CreateWorkflowResponse {
cluster_id: string; clusterID: string;
is_active: boolean; isActive: boolean;
} }
export interface GVRRequest { export interface GVRRequest {
@ -36,28 +37,28 @@ export interface GVRRequest {
} }
export interface KubeObjRequest { export interface KubeObjRequest {
data: { request: {
cluster_id: string; clusterID: string;
object_type: string; objectType: string;
kube_obj_request: GVRRequest; kubeObjRequest: GVRRequest;
}; };
} }
export interface KubeObjResponse { export interface KubeObjResponse {
getKubeObject: { getKubeObject: {
cluster_id: string; clusterID: string;
kube_obj: string; kubeObj: string;
}; };
} }
export interface KubeObjResource { export interface KubeObjResource {
api_version: string; apiVersion: string;
containers: object; containers: object;
creation_timestamp: string; creationTimestamp: string;
labels: string; labels: string;
name: string; name: string;
namespace: string; namespace: string;
termination_grace_periods: string; terminationGracePeriods: string;
uid: string; uid: string;
volumes: object; volumes: object;
} }

View File

@ -1,54 +1,54 @@
export interface PanelOption { export interface PanelOption {
points: boolean; points: boolean;
grids: boolean; grIDs: boolean;
left_axis: boolean; leftAxis: boolean;
} }
export interface PromQuery { export interface PromQuery {
queryid: string; queryID: string;
prom_query_name: string; promQueryName: string;
legend: string; legend: string;
resolution: string; resolution: string;
minstep: string; minstep: string;
line: boolean; line: boolean;
close_area: boolean; closeArea: boolean;
} }
export interface Panel { export interface Panel {
panel_id?: string; panelID?: string;
created_at?: string; createdAt?: string;
panel_group_id?: string; panelGroupID?: string;
prom_queries: PromQuery[]; promQueries: PromQuery[];
panel_options: PanelOption; panelOptions: PanelOption;
panel_name: string; panelName: string;
y_axis_left: string; yAxisLeft: string;
y_axis_right: string; yAxisRight: string;
x_axis_down: string; xAxisDown: string;
unit: string; unit: string;
} }
export interface PanelGroup { export interface PanelGroup {
panel_group_id?: string; panelGroupID?: string;
panel_group_name: string; panelGroupName: string;
panels: Panel[]; panels: Panel[];
} }
export interface PanelResponse { export interface PanelResponse {
panel_id: string; panelID: string;
created_at: string; createdAt: string;
prom_queries: PromQuery[]; promQueries: PromQuery[];
panel_options: PanelOption; panelOptions: PanelOption;
panel_name: string; panelName: string;
y_axis_left: string; yAxisLeft: string;
y_axis_right: string; yAxisRight: string;
x_axis_down: string; xAxisDown: string;
unit: string; unit: string;
} }
export interface PanelGroupResponse { export interface PanelGroupResponse {
panels: PanelResponse[]; panels: PanelResponse[];
panel_group_name: string; panelGroupName: string;
panel_group_id: string; panelGroupID: string;
} }
export interface Resource { export interface Resource {
@ -61,73 +61,73 @@ export interface ApplicationMetadata {
applications: Resource[]; applications: Resource[];
} }
export interface CreateDashboardInput { export interface CreateDashboardRequest {
createDBInput: { request: {
ds_id: string; dsID: string;
db_name: string; dbName: string;
db_type_id: string; dbTypeID: string;
db_type_name: string; dbTypeName: string;
db_information: string; dbInformation: string;
chaos_event_query_template: string; chaosEventQueryTemplate: string;
chaos_verdict_query_template: string; chaosVerdictQueryTemplate: string;
application_metadata_map: ApplicationMetadata[]; applicationMetadataMap: ApplicationMetadata[];
panel_groups: PanelGroup[]; panelGroups: PanelGroup[];
end_time: string; endTime: string;
start_time: string; startTime: string;
project_id: string; projectID: string;
cluster_id: string; clusterID: string;
refresh_rate: string; refreshRate: string;
}; };
createDashBoard?: ListDashboardResponse; createDashBoard?: GetDashboardResponse;
} }
export interface updatePanelGroupInput { export interface UpdatePanelGroupRequest {
panel_group_name: string; panelGroupID: string;
panel_group_id: string; panelGroupName: string;
panels: Panel[]; panels: Panel[];
} }
export interface UpdateDashboardInput { export interface UpdateDashboardRequest {
updateDBInput: { request: {
db_id: string; dbID: string;
ds_id?: string; dsID?: string;
db_name?: string; dbName?: string;
db_type_id?: string; dbTypeID?: string;
db_type_name?: string; dbTypeName?: string;
db_information?: string; dbInformation?: string;
chaos_event_query_template?: string; chaosEventQueryTemplate?: string;
chaos_verdict_query_template?: string; chaosVerdictQueryTemplate?: string;
application_metadata_map?: ApplicationMetadata[]; applicationMetadataMap?: ApplicationMetadata[];
end_time?: string; endTime?: string;
start_time?: string; startTime?: string;
cluster_id?: string; clusterID?: string;
refresh_rate?: string; refreshRate?: string;
panel_groups?: updatePanelGroupInput[]; panelGroups?: UpdatePanelGroupRequest[];
}; };
chaosQueryUpdate: boolean; chaosQueryUpdate: boolean;
} }
export interface DeleteDashboardInput { export interface DeleteDashboardRequest {
projectID: string; projectID: string;
dbID: string; dbID: string;
} }
export interface UpdatePanelInput { export interface UpdatePanelRequest {
panelInput: Panel[]; request: Panel[];
} }
export interface PortalDashboardsVars { export interface PortalDashboardsRequest {
projectID: string; projectID: string;
hubName: string; hubName: string;
} }
export interface PortalDashboardsResponse { export interface PortalDashboardsResponse {
name: string; name: string;
dashboard_data: string; dashboardData: string;
} }
export interface PortalDashboardList { export interface GetPortalDashboard {
PortalDashboardData: PortalDashboardsResponse[]; listPortalDashboardData: PortalDashboardsResponse[];
} }
export interface ResourceResponse { export interface ResourceResponse {
@ -140,39 +140,39 @@ export interface ApplicationMetadataResponse {
applications: ResourceResponse[]; applications: ResourceResponse[];
} }
export interface ListDashboardResponse { export interface GetDashboardResponse {
db_id: string; dbID: string;
ds_id: string; dsID: string;
db_name: string; dbName: string;
db_type: string; dbType: string;
cluster_name: string; clusterName: string;
ds_name: string; dsName: string;
ds_type: string; dsType: string;
ds_url: string; dsURL: string;
ds_health_status: string; dsHealthStatus: string;
db_type_id: string; dbTypeID: string;
db_type_name: string; dbTypeName: string;
db_information: string; dbInformation: string;
chaos_event_query_template: string; chaosEventQueryTemplate: string;
chaos_verdict_query_template: string; chaosVerdictQueryTemplate: string;
application_metadata_map: ApplicationMetadataResponse[]; applicationMetadataMap: ApplicationMetadataResponse[];
panel_groups: PanelGroupResponse[]; panelGroups: PanelGroupResponse[];
end_time: string; endTime: string;
start_time: string; startTime: string;
refresh_rate: string; refreshRate: string;
project_id: string; projectID: string;
cluster_id: string; clusterID: string;
created_at: string; createdAt: string;
updated_at: string; updatedAt: string;
viewed_at: string; viewedAt: string;
} }
export interface ListDashboardVars { export interface GetDashboardRequest {
projectID: string; projectID: string;
clusterID?: string; clusterID?: string;
dbID?: string; dbID?: string;
} }
export interface DashboardList { export interface GetDashboard {
ListDashboard: ListDashboardResponse[]; listDashboard: GetDashboardResponse[];
} }

View File

@ -1,41 +1,41 @@
export interface CreateDataSourceInput { export interface CreateDataSourceInput {
DSInput: { DSInput: {
ds_id?: string; dsID?: string;
ds_name: string; dsName: string;
ds_type: string; dsType: string;
ds_url: string; dsURL: string;
access_type: string; accessType: string;
auth_type: string; authType: string;
basic_auth_username?: string; basicAuthUsername?: string;
basic_auth_password?: string; basicAuthPassword?: string;
scrape_interval: number; scrapeInterval: number;
query_timeout: number; queryTimeout: number;
http_method: string; httpMethod: string;
project_id?: string; projectID?: string;
}; };
} }
export interface ListDataSourceResponse { export interface ListDataSourceResponse {
ds_id: string; dsID: string;
ds_name: string; dsName: string;
ds_type: string; dsType: string;
ds_url: string; dsURL: string;
access_type: string; accessType: string;
auth_type: string; authType: string;
basic_auth_username: string; basicAuthUsername: string;
basic_auth_password: string; basicAuthPassword: string;
scrape_interval: number; scrapeInterval: number;
query_timeout: number; queryTimeout: number;
http_method: string; httpMethod: string;
project_id: string; projectID: string;
created_at: string; createdAt: string;
updated_at: string; updatedAt: string;
health_status: string; healthStatus: string;
} }
export interface deleteDSInput { export interface deleteDSInput {
force_delete: boolean; forceDelete: boolean;
ds_id: string; dsID: string;
} }
export interface DeleteDataSourceInput { export interface DeleteDataSourceInput {
@ -47,5 +47,5 @@ export interface ListDataSourceVars {
} }
export interface DataSourceList { export interface DataSourceList {
ListDataSource: ListDataSourceResponse[]; listDataSource: ListDataSourceResponse[];
} }

View File

@ -1,15 +1,15 @@
export interface GitOpsData { export interface GitOpsData {
Enabled: boolean; enabled: boolean;
ProjectID: string | null; projectID: string | null;
Branch: string | null; branch: string | null;
RepoURL: string | null; repoURL: string | null;
AuthType: string | null; authType: string | null;
Token: string | null; token: string | null;
UserName: string | null; userName: string | null;
Password: string | null; password: string | null;
SSHPrivateKey: string | null; sshPrivateKey: string | null;
} }
export interface GitOpsDetail { export interface GetGitOpsDetailRequest {
getGitOpsDetails: GitOpsData; getGitOpsDetails: GitOpsData;
} }

View File

@ -0,0 +1,35 @@
export interface ImageRegistryInfo {
isDefault: boolean;
imageRegistryName: string;
imageRepoName: string;
imageRegistryType: string;
secretName: string;
secretNamespace: string;
enableRegistry: boolean;
}
export interface ImageRegistry {
isDefualt: boolean;
imageRegistryInfo: ImageRegistryInfo;
imageRegistryID: string;
projectID: string;
updatedAt: string;
createdAt: string;
isRemoved: boolean;
}
export interface CreateImageRegistryResponse {
createImageRegistry: ImageRegistry;
}
export interface GetImageRegistryResponse {
getImageRegistry: ImageRegistry;
}
export interface ListImageRegistryResponse {
listImageRegistry: ImageRegistry[];
}
export interface UpdateImageRegistryResponse {
updateImageRegistry: ImageRegistry;
}

View File

@ -1,31 +1,16 @@
export interface MemberInvitation {
member: {
project_id: string;
user_id: string;
};
}
export interface MemberInviteNew {
member: {
project_id: string;
user_id: string;
role: string;
};
}
export interface UserInvite { export interface UserInvite {
_id: string; _id: string;
name: string; name: string;
username: string; username: string;
email: string; email: string;
created_at: string; createdAt: string;
deactivated_at: string; deactivatedAt: string;
} }
// Invitation status for users // Invitation status for users
export enum InvitationStatus { export enum InvitationStatus {
accepted = 'Accepted', ACCEPTED = 'ACCEPTED',
pending = 'Pending', PENDING = 'PENDING',
declined = 'Declined', DECLINED = 'DECLINED',
exited = 'Exited', EXITED = 'EXITED',
} }

View File

@ -1,23 +1,21 @@
export interface PodLogRequest {
cluster_id: string;
workflow_run_id: string;
pod_name: string;
pod_namespace: string;
pod_type: string;
exp_pod?: string;
runner_pod?: string;
chaos_namespace?: string;
}
export interface PodLogResponse { export interface PodLogResponse {
workflow_run_id: string; workflowRunID: string;
pod_name: string; podName: string;
pod_type: string; podType: string;
log: string; log: string;
} }
export interface PodLogVars { export interface PodLogRequest {
podDetails: PodLogRequest; request: {
clusterID: string;
workflowRunID: string;
podName: string;
podNamespace: string;
podType: string;
expPod?: string;
runnerPod?: string;
chaosNamespace?: string;
};
} }
export interface PodLog { export interface PodLog {

View File

@ -1,5 +1,5 @@
export interface promQueryInput { export interface promQueryInput {
queryid: string; queryID: string;
query: string; query: string;
legend?: string; legend?: string;
resolution?: string; resolution?: string;
@ -7,7 +7,7 @@ export interface promQueryInput {
} }
export interface promInput { export interface promInput {
ds_details: dsDetails; dsDetails: dsDetails;
queries?: promQueryInput[]; queries?: promQueryInput[];
} }
@ -46,16 +46,16 @@ export interface promResponse {
} }
export interface PrometheusQueryVars { export interface PrometheusQueryVars {
prometheusInput: promInput; request: promInput;
} }
export interface PrometheusResponse { export interface PrometheusResponse {
GetPromQuery: promResponse; getPrometheusData: promResponse;
} }
export interface promSeriesInput { export interface promSeriesInput {
series: string; series: string;
ds_details: dsDetails; dsDetails: dsDetails;
} }
export interface Option { export interface Option {
@ -71,11 +71,11 @@ export interface promSeriesResponse {
} }
export interface PrometheusSeriesQueryVars { export interface PrometheusSeriesQueryVars {
prometheusInput: promSeriesInput; request: promSeriesInput;
} }
export interface PrometheusSeriesResponse { export interface PrometheusSeriesResponse {
GetPromLabelNamesAndValues: promSeriesResponse; getPromLabelNamesAndValues: promSeriesResponse;
} }
export interface dsDetails { export interface dsDetails {
@ -89,19 +89,19 @@ export interface promSeriesListResponse {
} }
export interface PrometheusSeriesListQueryVars { export interface PrometheusSeriesListQueryVars {
prometheusDSInput: dsDetails; request: dsDetails;
} }
export interface PrometheusSeriesListResponse { export interface PrometheusSeriesListResponse {
GetPromSeriesList: promSeriesListResponse; getPromSeriesList: promSeriesListResponse;
} }
export interface dataVars { export interface dataVars {
url: string; url: string;
start: string; start: string;
end: string; end: string;
relative_time: number; relativeTime: number;
refresh_interval: number; refreshInterval: number;
} }
export interface queryMapForPanel { export interface queryMapForPanel {
@ -115,10 +115,10 @@ export interface queryMapForPanelGroup {
} }
export interface ViewDashboardInput { export interface ViewDashboardInput {
dbID?: string; dashboardID?: string;
prometheusQueries: promQueryInput[]; promQueries: promQueryInput[];
queryMap: queryMapForPanelGroup[]; dashboardQueryMap: queryMapForPanelGroup[];
dataVarMap: dataVars; dataVariables: dataVars;
} }
export interface metricDataForPanel { export interface metricDataForPanel {

View File

@ -1,26 +1,26 @@
export interface Weights { export interface Weights {
experiment_name: string; experimentName: string;
weightage: number; weightage: number;
} }
export interface ScheduleWorkflow { export interface ScheduleWorkflow {
cluster_id: string; clusterID: string;
created_at: string; createdAt: string;
cronSyntax: string; cronSyntax: string;
isCustomWorkflow: string; isCustomWorkflow: string;
project_id: string; projectID: string;
updated_at: string; updatedAt: string;
weightages: Weights[]; weightages: Weights[];
workflow_description: string; workflowDescription: string;
workflow_id: string; workflowID: string;
workflow_manifest: string; workflowManifest: string;
workflow_name: string; workflowName: string;
cluster_name: string; clusterName: string;
cluster_type: string; clusterType: string;
regularity?: string; regularity?: string;
isRemoved: boolean; isRemoved: boolean;
last_updated_by: string; lastUpdatedBy: string;
} }
export interface DeleteSchedule { export interface DeleteSchedule {
workflow_id: string; workflowID: string;
} }

View File

@ -1,24 +1,38 @@
export interface ProjectData { export interface ProjectData {
ProjectId: string; projectID: string;
Workflows: { workflows: {
Schedules: number; schedules: number;
ExpRuns: number; expRuns: number;
Runs: number; runs: number;
}; };
Agents: { agents: {
Total: number; total: number;
Ns: number; ns: number;
Cluster: number; cluster: number;
}; };
} }
export interface AgentStat {
ns: number;
cluster: number;
total: number;
active: number;
}
export interface WorkflowStat {
schedules: number;
runs: number;
expRuns: number;
}
export interface UsageData { export interface UsageData {
TotalCount: { totalCount: {
Projects: number; projects: number;
agents: AgentStat;
workflows: WorkflowStat;
}; };
Projects: ProjectData[]; projects: ProjectData[];
} }
export interface UsageStats { export interface UsageStatsResponse {
UsageQuery: UsageData; getUsageData: UsageData;
} }

View File

@ -21,7 +21,7 @@ export interface Project {
} }
export interface Owner { export interface Owner {
UserId: string; UserID: string;
Username: string; Username: string;
} }
@ -32,37 +32,29 @@ export interface MemberData {
export interface ProjectStats { export interface ProjectStats {
Name: string; Name: string;
ProjectId: string; ProjectID: string;
Members: MemberData; Members: MemberData;
} }
export interface UserDetails { export interface UserDetails {
username: string; Username: string;
projects: Project[]; Projects: Project[];
name: string; Name: string;
email: string; Email: string;
id: string; Id: string;
company_name: string; CompanyName: string;
updated_at: string; UpdatedAt: string;
created_at: string; CreatedAt: string;
removed_at: string; RemovedAt: string;
is_email_verified: string; IsEmailVerified: string;
role: string; Role: string;
} }
export interface MyHubDetail { export interface MyHubDetail {
id: string; id: string;
HubName: string; hubName: string;
RepoBranch: string; repoBranch: string;
RepoURL: string; repoURL: string;
}
export interface CurrentUserDetails {
getUser: UserDetails;
}
export interface CurrentUserDedtailsVars {
username: string;
} }
export interface CreateUserData { export interface CreateUserData {
@ -86,83 +78,29 @@ export interface UserData {
username: string; username: string;
email: string; email: string;
name: string; name: string;
logged_in: boolean; loggedIn: boolean;
created_at: string; createdAt: string;
updated_at: string; updatedAt: string;
deactivated_at: string; deactivatedAt: string;
}
export interface UpdateUserStateInput {
uid: string;
isDeactivate: boolean;
}
export interface SSHKey {
privateKey: string;
publicKey: string;
}
export interface SSHKeys {
generaterSSHKey: SSHKey;
}
export interface MyHubInput {
id?: string;
HubName: string;
RepoURL: string;
RepoBranch: string;
IsPrivate: Boolean;
AuthType: MyHubType;
Token?: string;
UserName?: string;
Password?: string;
SSHPrivateKey?: string;
SSHPublicKey?: string;
}
export interface MyHubData {
id: string;
RepoURL: string;
RepoBranch: string;
ProjectID: string;
HubName: string;
CreatedAt: string;
UpdatedAt: string;
}
export interface CreateMyHub {
MyHubDetails: MyHubInput;
projectID: string;
}
export enum MyHubType {
basic = 'basic',
token = 'token',
ssh = 'ssh',
none = 'none',
} }
export interface Projects { export interface Projects {
listProjects: Project[]; getProjects: Project[];
} }
export interface ProjectDetail { export interface ProjectDetail {
getProject: Project; getProject: Project;
} }
export interface ProjectDetailVars {
projectID: string;
}
export enum Role { export enum Role {
viewer = 'Viewer', VIEWER = 'Viewer',
editor = 'Editor', EDITOR = 'Editor',
owner = 'Owner', OWNER = 'Owner',
} }
export enum UserRole { export enum UserRole {
admin = 'admin', ADMIN = 'admin',
user = 'user', USER = 'user',
} }
export enum InvitationStatus { export enum InvitationStatus {
@ -171,7 +109,7 @@ export enum InvitationStatus {
} }
export enum UserStatus { export enum UserStatus {
DELETED = 'deleted', DELETED = 'DELETED',
ACTIVE = 'active', ACTIVE = 'ACTIVE',
INACTIVE = 'inactive', INACTIVE = 'INACTIVE',
} }

View File

@ -32,10 +32,10 @@ export interface Nodes {
} }
export interface ExecutionData { export interface ExecutionData {
resiliency_score?: number; resiliencyScore?: number;
experiments_passed?: number; experimentsPassed?: number;
total_experiments?: number; totalExperiments?: number;
event_type: string; eventType: string;
uid: string; uid: string;
namespace: string; namespace: string;
name: string; name: string;
@ -47,47 +47,47 @@ export interface ExecutionData {
} }
export interface WeightageMap { export interface WeightageMap {
experiment_name: string; experimentName: string;
weightage: number; weightage: number;
} }
export interface WorkflowRun { export interface WorkflowRun {
workflow_run_id: string; workflowRunID: string;
workflow_id: string; workflowID: string;
cluster_name: string; clusterName: string;
weightages: WeightageMap[]; weightages: WeightageMap[];
last_updated: string; lastUpdated: string;
project_id: string; projectID: string;
cluster_id: string; clusterID: string;
workflow_name: string; workflowName: string;
cluster_type: String; clusterType: String;
phase: string; phase: string;
resiliency_score: number; resiliencyScore: number;
experiments_passed: number; experimentsPassed: number;
experiments_failed: number; experimentsFailed: number;
experiments_awaited: number; experimentsAwaited: number;
experiments_stopped: number; experimentsStopped: number;
experiments_na: number; experimentsNa: number;
total_experiments: number; totalExperiments: number;
execution_data: string; executionData: string;
executed_by: string; executedBy: string;
isRemoved: boolean; isRemoved: boolean;
} }
interface GetWorkflowRunsOutput { interface GetWorkflowRunsResponse {
total_no_of_workflow_runs: number; totalNoOfWorkflowRuns: number;
workflow_runs: WorkflowRun[]; workflowRuns: WorkflowRun[];
} }
export interface Workflow { export interface Workflow {
getWorkflowRuns: GetWorkflowRunsOutput; listWorkflowRuns: GetWorkflowRunsResponse;
} }
export interface WorkflowSubscription { export interface WorkflowSubscription {
workflowEventListener: WorkflowRun; getWorkflowEvents: WorkflowRun;
} }
export interface WorkflowSubscriptionInput { export interface WorkflowSubscriptionRequest {
projectID: string; projectID: string;
} }
@ -98,15 +98,15 @@ export interface Pagination {
} }
// Sort // Sort
export interface SortInput { export interface SortRequest {
field: 'Name' | 'Time'; field: 'NAME' | 'TIME';
descending?: boolean; descending?: boolean;
} }
// Filter // Filter
interface DateRange { interface DateRange {
start_date: string; startDate: string;
end_date?: string; endDate?: string;
} }
export type WorkflowStatus = export type WorkflowStatus =
@ -117,34 +117,34 @@ export type WorkflowStatus =
| 'Terminated' | 'Terminated'
| undefined; | undefined;
export interface WorkflowRunFilterInput { export interface WorkflowRunFilterRequest {
workflow_name?: string; workflowName?: string;
cluster_name?: string; clusterName?: string;
workflow_status?: WorkflowStatus; workflowStatus?: WorkflowStatus;
date_range?: DateRange; dateRange?: DateRange;
isRemoved?: boolean | null; isRemoved?: boolean | null;
} }
export interface WorkflowDataVars { export interface WorkflowDataRequest {
workflowRunsInput: { request: {
project_id: string; projectID: string;
workflow_run_ids?: string[]; workflowRunIDs?: string[];
workflow_ids?: string[]; workflowIDs?: string[];
pagination?: Pagination; pagination?: Pagination;
sort?: SortInput; sort?: SortRequest;
filter?: WorkflowRunFilterInput; filter?: WorkflowRunFilterRequest;
}; };
} }
export interface HeatmapDataVars { export interface HeatmapDataRequest {
project_id: string; projectID: string;
workflow_id: string; workflowID: string;
year: number; year: number;
} }
export interface WorkflowRunDetails { export interface WorkflowRunDetails {
no_of_runs: number; noOfRuns: number;
date_stamp: number; dateStamp: number;
} }
export interface HeatMapData { export interface HeatMapData {
value: number; value: number;
@ -152,32 +152,32 @@ export interface HeatMapData {
} }
export interface HeatmapDataResponse { export interface HeatmapDataResponse {
getHeatmapData: WeekData[]; listHeatmapData: WeekData[];
} }
export interface WorkflowRunStatsResponse { export interface WorkflowRunStatsResponse {
getWorkflowRunStats: { getWorkflowRunStats: {
total_workflow_runs: number; totalWorkflowRuns: number;
succeeded_workflow_runs: number; succeededWorkflowRuns: number;
failed_workflow_runs: number; failedWorkflowRuns: number;
running_workflow_runs: number; runningWorkflowRuns: number;
workflow_run_succeeded_percentage: number; workflowRunSucceededPercentage: number;
workflow_run_failed_percentage: number; workflowRunFailedPercentage: number;
average_resiliency_score: number; averageResiliencyScore: number;
passed_percentage: number; passedPercentage: number;
failed_percentage: number; failedPercentage: number;
total_experiments: number; totalExperiments: number;
experiments_passed: number; experimentsPassed: number;
experiments_failed: number; experimentsFailed: number;
experiments_awaited: number; experimentsAwaited: number;
experiments_stopped: number; experimentsStopped: number;
experiments_na: number; experimentsNa: number;
}; };
} }
export interface WorkflowRunStatsRequest { export interface WorkflowRunStatsRequest {
workflowRunStatsRequest: { workflowRunStatsRequest: {
project_id: string; projectID: string;
workflow_ids?: string[]; workflowIDs?: string[];
}; };
} }

View File

@ -1,5 +1,5 @@
export interface WeightageMap { export interface WeightageMap {
experiment_name: string; experimentName: string;
weightage: number; weightage: number;
} }
@ -33,8 +33,8 @@ export interface Nodes {
} }
export interface ExecutionData { export interface ExecutionData {
resiliency_score?: number; resiliencyScore?: number;
event_type: string; eventType: string;
uid: string; uid: string;
namespace: string; namespace: string;
name: string; name: string;
@ -46,44 +46,44 @@ export interface ExecutionData {
} }
export interface WorkflowRun { export interface WorkflowRun {
execution_data: string; executionData: string;
last_updated: string; lastUpdated: string;
workflow_run_id: string; workflowRunID: string;
} }
export interface ScheduledWorkflow { export interface ScheduledWorkflow {
workflow_id: string; workflowID: string;
workflow_manifest: string; workflowManifest: string;
cronSyntax: string; cronSyntax: string;
cluster_name: string; clusterName: string;
workflow_name: string; workflowName: string;
workflow_description: string; workflowDescription: string;
weightages: WeightageMap[]; weightages: WeightageMap[];
isCustomWorkflow: string; isCustomWorkflow: string;
updated_at: string; updatedAt: string;
created_at: string; createdAt: string;
project_id: string; projectID: string;
cluster_id: string; clusterID: string;
cluster_type: string; clusterType: string;
isRemoved: Boolean; isRemoved: Boolean;
last_updated_by: string; lastUpdatedBy: string;
} }
export interface WorkflowList { export interface GetWorkflow {
ListWorkflow: ScheduledWorkflow[]; getWorkflow: ScheduledWorkflow[];
} }
export interface WorkflowListDataVars { export interface GetWorkflowDataRequest {
projectID: string; projectID: string;
workflowIDs: string[]; workflowIDs: string[];
} }
export interface ListManifestTemplateArray { export interface GetManifestTemplateArray {
template_id: string; templateID: string;
manifest: string; manifest: string;
project_name: string; projectName: string;
template_description: string; templateDescription: string;
template_name: string; templateName: string;
isCustomWorkflow: boolean; isCustomWorkflow: boolean;
} }
@ -92,34 +92,35 @@ export interface Pagination {
limit: number; limit: number;
} }
export interface ListManifestTemplate { export interface GetManifestTemplate {
ListManifestTemplate: ListManifestTemplateArray[]; listWorkflowManifests: GetManifestTemplateArray[];
} }
export interface SortInput { export interface SortRequest {
field: 'Name' | 'Time'; field: 'NAME' | 'TIME';
descending?: Boolean; descending?: Boolean;
} }
export interface WorkflowFilterInput { export interface WorkflowFilterRequest {
workflow_name?: string; workflowName?: string;
cluster_name?: string; clusterName?: string;
} }
export interface ListWorkflowsInput {
workflowInput: { export interface GetWorkflowsRequest {
project_id: string; request: {
workflow_ids?: string[]; projectID: string;
workflowIDs?: string[];
pagination?: Pagination; pagination?: Pagination;
sort?: SortInput; sort?: SortRequest;
filter?: WorkflowFilterInput; filter?: WorkflowFilterRequest;
}; };
} }
export interface ListWorkflowsOutput { export interface GetWorkflowsResponse {
total_no_of_workflows: number; totalNoOfWorkflows: number;
workflows: ScheduledWorkflow[]; workflows: ScheduledWorkflow[];
} }
export interface ScheduledWorkflows { export interface ScheduledWorkflows {
ListWorkflow: ListWorkflowsOutput; listWorkflows: GetWorkflowsResponse;
} }

View File

@ -4,17 +4,17 @@ export type DateValue = {
}; };
export enum Filter { export enum Filter {
Monthly = 'Monthly', MONTHLY = 'MONTHLY',
Daily = 'Daily', DAILY = 'DAILY',
Hourly = 'Hourly', HOURLY = 'HOURLY',
} }
export interface WorkflowStatsResponse { export interface WorkflowStatsResponse {
getWorkflowStats: Array<DateValue>; listWorkflowStats: Array<DateValue>;
} }
export interface WorkflowStatsVars { export interface WorkflowStatsVars {
filter: Filter; filter: Filter;
project_id: string; projectID: string;
show_workflow_runs: boolean; showWorkflowRuns: boolean;
} }

View File

@ -18,7 +18,7 @@ interface Panel {
panel_name: string; panel_name: string;
panel_options: { panel_options: {
points: boolean; points: boolean;
grids: boolean; grIDs: boolean;
left_axis: boolean; left_axis: boolean;
}; };
y_axis_left: string; y_axis_left: string;

View File

@ -1,73 +1,75 @@
import { MyHubType } from '../graphql/user'; import { MyHubType } from '../graphql/chaoshub';
export interface Chart { export interface Chart {
ApiVersion: string; apiVersion: string;
Kind: string; kind: string;
Metadata: Metadata; metadata: Metadata;
Spec: Spec; spec: Spec;
PackageInfo: PackageInfo; packageInfo: PackageInfo;
} }
export interface Spec { export interface Spec {
DisplayName: string; displayName: string;
CategoryDescription: string; categoryDescription: string;
Keywords: string[]; keywords: string[];
Maturity: string; maturity: string;
Maintainers: Maintainer[]; maintainers: Maintainer[];
MinKubeVersion: string; minKubeVersion: string;
Provider: string; provider: {
Links: Link[]; name: string;
Experiments: string[]; };
ChaosExpCRDLink: string; links: Link[];
Platforms: string[]; experiments: string[];
ChaosType: string; chaosExpCRDLink: string;
platforms: string[];
chaosType: string;
} }
export interface Maintainer { export interface Maintainer {
Name: string; name: string;
Email: string; email: string;
} }
export interface Link { export interface Link {
Name: string; name: string;
Url: string; url: string;
} }
export interface Metadata { export interface Metadata {
Name: string; name: string;
Version: string; version: string;
Annotations: Annotation[]; annotations: Annotation[];
} }
export interface Annotation { export interface Annotation {
Categories: string; categories: string;
Vendor: string; vendor: string;
CreatedAt: string; createdAt: string;
Repository: string; repository: string;
Support: string; support: string;
ChartDescription: string; chartDescription: string;
} }
export interface PackageInfo { export interface PackageInfo {
PackageName: string; packageName: string;
Experiments: Experiments[]; experiments: Experiments[];
} }
export interface Experiments { export interface Experiments {
Name: string; name: string;
Csv: string; CSV: string;
Desc: string; desc: string;
} }
export interface ChartsInput { export interface ChartsInput {
HubName: string; hubName: string;
UserName: string; userName: string;
RepoURL: string; repoURL: string;
RepoBranch: string; repoBranch: string;
} }
export interface Charts { export interface Charts {
getCharts: Chart[]; listCharts: Chart[];
} }
export interface ExperimentDetail { export interface ExperimentDetail {
@ -76,23 +78,23 @@ export interface ExperimentDetail {
export interface HubDetails { export interface HubDetails {
id: string; id: string;
HubName: string; hubName: string;
RepoURL: string; repoURL: string;
RepoBranch: string; repoBranch: string;
TotalExp: string; totalExp: string;
IsAvailable: boolean; isAvailable: boolean;
AuthType?: MyHubType; authType?: MyHubType;
IsPrivate: boolean; isPrivate: boolean;
Token: string; token: string;
UserName: string; userName: string;
Password: string; password: string;
SSHPrivateKey: string; sshPrivateKey: string;
SSHPublicKey: string; sshPublicKey: string;
LastSyncedAt: string; lastSyncedAt: string;
} }
export interface HubStatus { export interface HubStatus {
getHubStatus: HubDetails[]; listHubStatus: HubDetails[];
} }
export enum MyHubActions { export enum MyHubActions {

View File

@ -1,7 +1,7 @@
import { Node } from '../graphql/workflowData'; import { Node } from '../graphql/workflowData';
export interface SelectedNode extends Node { export interface SelectedNode extends Node {
pod_name: string; podName: string;
} }
export enum NodeSelectionActions { export enum NodeSelectionActions {

View File

@ -30,9 +30,9 @@ export interface customWorkflow {
export interface WorkflowData { export interface WorkflowData {
chaosEngineChanged: boolean; chaosEngineChanged: boolean;
namespace: string; namespace: string;
workflow_id?: string; workflowID?: string;
clusterid: string; clusterID: string;
clustername: string; clusterName: string;
cronSyntax: string; cronSyntax: string;
scheduleType: scheduleType; scheduleType: scheduleType;
scheduleInput: scheduleInput; scheduleInput: scheduleInput;

View File

@ -23,12 +23,12 @@ import {
} from '../../../graphql/mutations'; } from '../../../graphql/mutations';
import { GET_HUB_STATUS } from '../../../graphql/queries'; import { GET_HUB_STATUS } from '../../../graphql/queries';
import { import {
CreateMyHub,
MyHubData,
MyHubType,
SSHKey, SSHKey,
MyHubData,
CreateMyHub,
SSHKeys, SSHKeys,
} from '../../../models/graphql/user'; MyHubType,
} from '../../../models/graphql/chaoshub';
import { HubStatus } from '../../../models/redux/myhub'; import { HubStatus } from '../../../models/redux/myhub';
import { getProjectID } from '../../../utils/getSearchParams'; import { getProjectID } from '../../../utils/getSearchParams';
import { import {
@ -90,11 +90,11 @@ const MyHubConnectDrawer: React.FC<MyHubConnectDrawerProps> = ({
}); });
const { data } = useQuery<HubStatus>(GET_HUB_STATUS, { const { data } = useQuery<HubStatus>(GET_HUB_STATUS, {
variables: { data: projectID }, variables: { projectID },
fetchPolicy: 'network-only', fetchPolicy: 'network-only',
}); });
const hubData = data?.getHubStatus.filter( const hubData = data?.listHubStatus.filter(
(hubs) => hubs.HubName === hubName (hubs) => hubs.hubName === hubName
)[0]; )[0];
/** /**
@ -169,28 +169,28 @@ const MyHubConnectDrawer: React.FC<MyHubConnectDrawerProps> = ({
if (hubName?.length) { if (hubName?.length) {
updateMyHub({ updateMyHub({
variables: { variables: {
MyHubDetails: { request: {
id: hubData?.id, id: hubData?.id,
HubName: gitHub.HubName.trim(), hubName: gitHub.HubName.trim(),
RepoURL: gitHub.GitURL, repoURL: gitHub.GitURL,
RepoBranch: gitHub.GitBranch, repoBranch: gitHub.GitBranch,
IsPrivate: isToggled.isPublicToggled isPrivate: isToggled.isPublicToggled
? false ? false
: !!isToggled.isPrivateToggled, : !!isToggled.isPrivateToggled,
AuthType: isToggled.isPublicToggled authType: isToggled.isPublicToggled
? MyHubType.basic ? MyHubType.BASIC
: privateHub === 'token' : privateHub === 'token'
? MyHubType.token ? MyHubType.TOKEN
: privateHub === 'ssh' : privateHub === 'ssh'
? MyHubType.ssh ? MyHubType.SSH
: MyHubType.basic, : MyHubType.BASIC,
Token: accessToken, token: accessToken,
UserName: 'user', userName: 'user',
Password: 'user', password: 'user',
SSHPrivateKey: sshKey.privateKey, sshPrivateKey: sshKey.privateKey,
SSHPublicKey: sshKey.publicKey, sshPublicKey: sshKey.publicKey,
projectID,
}, },
projectID,
}, },
}); });
} else } else
@ -199,27 +199,27 @@ const MyHubConnectDrawer: React.FC<MyHubConnectDrawerProps> = ({
*/ */
addMyHub({ addMyHub({
variables: { variables: {
MyHubDetails: { request: {
HubName: gitHub.HubName.trim(), hubName: gitHub.HubName.trim(),
RepoURL: gitHub.GitURL, repoURL: gitHub.GitURL,
RepoBranch: gitHub.GitBranch, repoBranch: gitHub.GitBranch,
IsPrivate: isToggled.isPublicToggled isPrivate: isToggled.isPublicToggled
? false ? false
: !!isToggled.isPrivateToggled, : !!isToggled.isPrivateToggled,
AuthType: isToggled.isPublicToggled authType: isToggled.isPublicToggled
? MyHubType.basic ? MyHubType.BASIC
: privateHub === 'token' : privateHub === 'token'
? MyHubType.token ? MyHubType.TOKEN
: privateHub === 'ssh' : privateHub === 'ssh'
? MyHubType.ssh ? MyHubType.SSH
: MyHubType.basic, : MyHubType.BASIC,
Token: accessToken, token: accessToken,
UserName: 'user', userName: 'user',
Password: 'user', password: 'user',
SSHPrivateKey: sshKey.privateKey, sshPrivateKey: sshKey.privateKey,
SSHPublicKey: sshKey.publicKey, sshPublicKey: sshKey.publicKey,
projectID,
}, },
projectID,
}, },
}); });
}; };
@ -267,11 +267,11 @@ const MyHubConnectDrawer: React.FC<MyHubConnectDrawerProps> = ({
if (hubName?.length) { if (hubName?.length) {
if (hubData !== undefined) { if (hubData !== undefined) {
setGitHub({ setGitHub({
HubName: hubData.HubName, HubName: hubData.hubName,
GitURL: hubData.RepoURL, GitURL: hubData.repoURL,
GitBranch: hubData.RepoBranch, GitBranch: hubData.repoBranch,
}); });
if (hubData.IsPrivate) { if (hubData.isPrivate) {
setIsToggled({ setIsToggled({
isPublicToggled: false, isPublicToggled: false,
isPrivateToggled: true, isPrivateToggled: true,
@ -282,14 +282,14 @@ const MyHubConnectDrawer: React.FC<MyHubConnectDrawerProps> = ({
isPrivateToggled: false, isPrivateToggled: false,
}); });
} }
if (hubData.AuthType === MyHubType.token) { if (hubData.authType === MyHubType.TOKEN) {
setPrivateHub('token'); setPrivateHub('token');
setAccessToken(hubData.Token); setAccessToken(hubData.token);
} else if (hubData.AuthType === MyHubType.ssh) { } else if (hubData.authType === MyHubType.SSH) {
setPrivateHub('ssh'); setPrivateHub('ssh');
setSshKey({ setSshKey({
privateKey: hubData.SSHPrivateKey, privateKey: hubData.sshPrivateKey,
publicKey: hubData.SSHPublicKey, publicKey: hubData.sshPublicKey,
}); });
} else { } else {
setPrivateHub('token'); setPrivateHub('token');

View File

@ -77,11 +77,11 @@ const CustomMyHubCard: React.FC<customMyHubCardProp> = ({
action={ action={
<div className={classes.mainCardDiv}> <div className={classes.mainCardDiv}>
<div <div
className={hub.IsAvailable ? classes.connected : classes.error} className={hub.isAvailable ? classes.connected : classes.error}
> >
<Center> <Center>
<Typography className={classes.statusText}> <Typography className={classes.statusText}>
{hub.IsAvailable ? 'Connected' : 'Error'} {hub.isAvailable ? 'Connected' : 'Error'}
</Typography> </Typography>
</Center> </Center>
</div> </div>
@ -128,7 +128,7 @@ const CustomMyHubCard: React.FC<customMyHubCardProp> = ({
data-cy="myHubEdit" data-cy="myHubEdit"
value="View" value="View"
onClick={() => { onClick={() => {
handleEditHub(hub.HubName); handleEditHub(hub.hubName);
handleClose(); handleClose();
}} }}
> >
@ -175,7 +175,7 @@ const CustomMyHubCard: React.FC<customMyHubCardProp> = ({
<CardContent <CardContent
onClick={() => { onClick={() => {
history.push({ history.push({
pathname: `/myhub/${hub.HubName}`, pathname: `/myhub/${hub.hubName}`,
search: `?projectID=${projectID}&projectRole=${userRole}`, search: `?projectID=${projectID}&projectRole=${userRole}`,
}); });
}} }}
@ -183,7 +183,7 @@ const CustomMyHubCard: React.FC<customMyHubCardProp> = ({
<div className={classes.cardContent}> <div className={classes.cardContent}>
<img <img
src={`./icons/${ src={`./icons/${
hub.HubName === 'Litmus ChaosHub' hub.hubName === 'Litmus ChaosHub'
? 'myhub-litmus.svg' ? 'myhub-litmus.svg'
: 'my-hub-charts.svg' : 'my-hub-charts.svg'
}`} }`}
@ -195,11 +195,11 @@ const CustomMyHubCard: React.FC<customMyHubCardProp> = ({
align="center" align="center"
className={classes.hubName} className={classes.hubName}
> >
<strong>{hub.HubName}</strong>/{hub.RepoBranch} <strong>{hub.hubName}</strong>/{hub.repoBranch}
</Typography> </Typography>
<Typography className={classes.totalExp} gutterBottom> <Typography className={classes.totalExp} gutterBottom>
{parseInt(hub.TotalExp, 10) > 0 {parseInt(hub.totalExp, 10) > 0
? `${hub.TotalExp} experiments` ? `${hub.totalExp} experiments`
: t('myhub.error')} : t('myhub.error')}
</Typography> </Typography>
</div> </div>
@ -216,7 +216,7 @@ const CustomMyHubCard: React.FC<customMyHubCardProp> = ({
{t('myhub.lastSync')} {t('myhub.lastSync')}
</Typography> </Typography>
<Typography className={classes.lastSyncText}> <Typography className={classes.lastSyncText}>
{formatDate(hub.LastSyncedAt)} {formatDate(hub.lastSyncedAt)}
</Typography> </Typography>
</div> </div>
)} )}

View File

@ -41,7 +41,7 @@ const MyHub: React.FC = () => {
// Get MyHubs with Status // Get MyHubs with Status
const { data, loading, refetch } = useQuery<HubStatus>(GET_HUB_STATUS, { const { data, loading, refetch } = useQuery<HubStatus>(GET_HUB_STATUS, {
variables: { data: projectID }, variables: { projectID },
fetchPolicy: 'cache-and-network', fetchPolicy: 'cache-and-network',
}); });
@ -83,7 +83,7 @@ const MyHub: React.FC = () => {
refetchQueries: [ refetchQueries: [
{ {
query: GET_HUB_STATUS, query: GET_HUB_STATUS,
variables: { data: projectID }, variables: { projectID },
}, },
], ],
onError: () => { onError: () => {
@ -98,7 +98,7 @@ const MyHub: React.FC = () => {
}, },
}); });
const totalHubs = data && data.getHubStatus; const totalHubs = data && data.listHubStatus;
const [deleteHub, setDeleteHub] = useState<DeleteHub>({ const [deleteHub, setDeleteHub] = useState<DeleteHub>({
deleteHubModal: false, deleteHubModal: false,

View File

@ -6,7 +6,7 @@ import { useSelector } from 'react-redux';
import BackButton from '../../components/Button/BackButton'; import BackButton from '../../components/Button/BackButton';
import Loader from '../../components/Loader'; import Loader from '../../components/Loader';
import Wrapper from '../../containers/layouts/Wrapper'; import Wrapper from '../../containers/layouts/Wrapper';
import { LIST_DASHBOARD, LIST_DATASOURCE } from '../../graphql'; import { GET_DASHBOARD, GET_DATASOURCE } from '../../graphql';
import { import {
DashboardDetails, DashboardDetails,
PanelDetails, PanelDetails,
@ -16,13 +16,13 @@ import {
import { import {
ApplicationMetadata, ApplicationMetadata,
ApplicationMetadataResponse, ApplicationMetadataResponse,
DashboardList, GetDashboard,
ListDashboardVars, GetDashboardRequest,
PanelGroupResponse, PanelGroupResponse,
PanelOption, PanelOption,
PanelResponse, PanelResponse,
Resource, Resource,
updatePanelGroupInput, UpdatePanelGroupRequest,
} from '../../models/graphql/dashboardsDetails'; } from '../../models/graphql/dashboardsDetails';
import { import {
DataSourceList, DataSourceList,
@ -55,7 +55,7 @@ const ChooseAndConfigureDashboards: React.FC<ChooseAndConfigureDashboardsProps>
data: dataSourceList, data: dataSourceList,
loading: loadingDataSources, loading: loadingDataSources,
error: errorFetchingDataSources, error: errorFetchingDataSources,
} = useQuery<DataSourceList, ListDataSourceVars>(LIST_DATASOURCE, { } = useQuery<DataSourceList, ListDataSourceVars>(GET_DATASOURCE, {
variables: { projectID }, variables: { projectID },
fetchPolicy: 'cache-and-network', fetchPolicy: 'cache-and-network',
}); });
@ -65,7 +65,7 @@ const ChooseAndConfigureDashboards: React.FC<ChooseAndConfigureDashboardsProps>
data: dashboardList, data: dashboardList,
loading: loadingDashboard, loading: loadingDashboard,
error: errorFetchingDashboard, error: errorFetchingDashboard,
} = useQuery<DashboardList, ListDashboardVars>(LIST_DASHBOARD, { } = useQuery<GetDashboard, GetDashboardRequest>(GET_DASHBOARD, {
variables: { projectID, dbID: selectedDashboard.selectedDashboardID }, variables: { projectID, dbID: selectedDashboard.selectedDashboardID },
skip: !configure || selectedDashboard.selectedDashboardID === '', skip: !configure || selectedDashboard.selectedDashboardID === '',
fetchPolicy: 'network-only', fetchPolicy: 'network-only',
@ -96,39 +96,39 @@ const ChooseAndConfigureDashboards: React.FC<ChooseAndConfigureDashboardsProps>
const panels: PanelDetails[] = []; const panels: PanelDetails[] = [];
panelGroup.panels.forEach((panel: PanelResponse) => { panelGroup.panels.forEach((panel: PanelResponse) => {
const promQueries: PromQueryDetails[] = []; const promQueries: PromQueryDetails[] = [];
panel.prom_queries.forEach((promQuery) => { panel.promQueries.forEach((promQuery) => {
promQueries.push({ promQueries.push({
queryid: promQuery.queryid, queryID: promQuery.queryID,
prom_query_name: promQuery.prom_query_name, promQueryName: promQuery.promQueryName,
legend: promQuery.legend, legend: promQuery.legend,
resolution: promQuery.resolution, resolution: promQuery.resolution,
minstep: promQuery.minstep, minstep: promQuery.minstep,
line: promQuery.line, line: promQuery.line,
close_area: promQuery.close_area, closeArea: promQuery.closeArea,
}); });
}); });
const panelOption: PanelOption = { const panelOption: PanelOption = {
points: panel.panel_options.points, points: panel.panelOptions.points,
grids: panel.panel_options.grids, grIDs: panel.panelOptions.grIDs,
left_axis: panel.panel_options.left_axis, leftAxis: panel.panelOptions.leftAxis,
}; };
panels.push({ panels.push({
panel_name: panel.panel_name, panelName: panel.panelName,
y_axis_left: panel.y_axis_left, yAxisLeft: panel.yAxisLeft,
y_axis_right: panel.y_axis_right, yAxisRight: panel.yAxisRight,
x_axis_down: panel.x_axis_down, xAxisDown: panel.xAxisDown,
unit: panel.unit, unit: panel.unit,
panel_options: panelOption, panelOptions: panelOption,
prom_queries: promQueries, promQueries,
panel_id: panel.panel_id, panelID: panel.panelID,
created_at: panel.created_at, createdAt: panel.createdAt,
panel_group_id: panelGroup.panel_group_id, panelGroupID: panelGroup.panelGroupID,
panel_group_name: panelGroup.panel_group_name, panelGroupName: panelGroup.panelGroupName,
}); });
}); });
panelGroups.push({ panelGroups.push({
panel_group_id: panelGroup.panel_group_id, panelGroupID: panelGroup.panelGroupID,
panel_group_name: panelGroup.panel_group_name, panelGroupName: panelGroup.panelGroupName,
panels, panels,
}); });
}); });
@ -139,12 +139,12 @@ const ChooseAndConfigureDashboards: React.FC<ChooseAndConfigureDashboardsProps>
const getExistingPanelGroupMap = ( const getExistingPanelGroupMap = (
panelGroupsInput: PanelGroupResponse[] panelGroupsInput: PanelGroupResponse[]
) => { ) => {
const panelGroupMap: updatePanelGroupInput[] = []; const panelGroupMap: UpdatePanelGroupRequest[] = [];
if (panelGroupsInput?.length) { if (panelGroupsInput?.length) {
panelGroupsInput.forEach((panelGroup: PanelGroupResponse) => { panelGroupsInput.forEach((panelGroup: PanelGroupResponse) => {
panelGroupMap.push({ panelGroupMap.push({
panel_group_id: panelGroup.panel_group_id, panelGroupID: panelGroup.panelGroupID,
panel_group_name: panelGroup.panel_group_name, panelGroupName: panelGroup.panelGroupName,
panels: panelGroup.panels, panels: panelGroup.panels,
}); });
}); });
@ -178,28 +178,27 @@ const ChooseAndConfigureDashboards: React.FC<ChooseAndConfigureDashboardsProps>
if ( if (
configure === true && configure === true &&
dashboardList && dashboardList &&
dashboardList.ListDashboard && dashboardList.listDashboard &&
dashboardList.ListDashboard.length > 0 dashboardList.listDashboard.length > 0
) { ) {
const dashboardDetail = dashboardList.ListDashboard[0]; const dashboardDetail = dashboardList.listDashboard[0];
setDashboardVars({ setDashboardVars({
...dashboardVars, ...dashboardVars,
id: selectedDashboard.selectedDashboardID, id: selectedDashboard.selectedDashboardID,
name: dashboardDetail.db_name, name: dashboardDetail.dbName,
dataSourceType: dashboardDetail.ds_type, dataSourceType: dashboardDetail.dsType,
dashboardTypeID: dashboardDetail.db_type_id, dashboardTypeID: dashboardDetail.dbTypeID,
dashboardTypeName: dashboardDetail.db_type_name, dashboardTypeName: dashboardDetail.dbTypeName,
dataSourceID: dashboardDetail.ds_id, dataSourceID: dashboardDetail.dsID,
dataSourceURL: dashboardDetail.ds_url, dataSourceURL: dashboardDetail.dsURL,
agentID: dashboardDetail.cluster_id, agentID: dashboardDetail.clusterID,
information: dashboardDetail.db_information, information: dashboardDetail.dbInformation,
panelGroupMap: getExistingPanelGroupMap(dashboardDetail.panel_groups), panelGroupMap: getExistingPanelGroupMap(dashboardDetail.panelGroups),
panelGroups: getExistingPanelGroups(dashboardDetail.panel_groups), panelGroups: getExistingPanelGroups(dashboardDetail.panelGroups),
chaosEventQueryTemplate: dashboardDetail.chaos_event_query_template, chaosEventQueryTemplate: dashboardDetail.chaosEventQueryTemplate,
chaosVerdictQueryTemplate: chaosVerdictQueryTemplate: dashboardDetail.chaosVerdictQueryTemplate,
dashboardDetail.chaos_verdict_query_template,
applicationMetadataMap: getApplicationMetadataMap( applicationMetadataMap: getApplicationMetadataMap(
dashboardDetail.application_metadata_map dashboardDetail.applicationMetadataMap
), ),
}); });
} }
@ -244,7 +243,7 @@ const ChooseAndConfigureDashboards: React.FC<ChooseAndConfigureDashboardsProps>
configure={configure} configure={configure}
activePanelID={selectedDashboard.activePanelID} activePanelID={selectedDashboard.activePanelID}
existingDashboardVars={dashboardVars} existingDashboardVars={dashboardVars}
dataSourceList={dataSourceList?.ListDataSource ?? []} dataSourceList={dataSourceList?.listDataSource ?? []}
/> />
</> </>
)} )}

View File

@ -104,23 +104,20 @@ const DataSourceConfigurePage: React.FC<DataSourceConfigurePageProps> = ({
authType = 'basic auth'; authType = 'basic auth';
} }
const dataSourceInput = { const dataSourceInput = {
ds_name: dataSourceVars.name, dsName: dataSourceVars.name,
ds_type: dataSourceVars.dataSourceType, dsType: dataSourceVars.dataSourceType,
ds_url: dsURL:
dataSourceVars.url[dataSourceVars.url.length - 1] !== '/' dataSourceVars.url[dataSourceVars.url.length - 1] !== '/'
? dataSourceVars.url ? dataSourceVars.url
: dataSourceVars.url.slice(0, -1), : dataSourceVars.url.slice(0, -1),
access_type: dataSourceVars.access, accessType: dataSourceVars.access,
auth_type: authType, authType,
basic_auth_username: dataSourceVars.username, basicAuthUsername: dataSourceVars.username,
basic_auth_password: dataSourceVars.password, basicAuthPassword: dataSourceVars.password,
scrape_interval: parseInt( scrapeInterval: parseInt(dataSourceVars.scrapeInterval.split('s')[0], 10),
dataSourceVars.scrapeInterval.split('s')[0], queryTimeout: parseInt(dataSourceVars.queryTimeout.split('s')[0], 10),
10 httpMethod: dataSourceVars.httpMethod,
), projectID,
query_timeout: parseInt(dataSourceVars.queryTimeout.split('s')[0], 10),
http_method: dataSourceVars.httpMethod,
project_id: projectID,
}; };
createDataSource({ createDataSource({
variables: { DSInput: dataSourceInput }, variables: { DSInput: dataSourceInput },
@ -133,24 +130,21 @@ const DataSourceConfigurePage: React.FC<DataSourceConfigurePageProps> = ({
authType = 'basic auth'; authType = 'basic auth';
} }
const dataSourceInput = { const dataSourceInput = {
ds_id: dataSourceVars.id ?? '', dsID: dataSourceVars.id ?? '',
ds_name: dataSourceVars.name, dsName: dataSourceVars.name,
ds_type: dataSourceVars.dataSourceType, dsType: dataSourceVars.dataSourceType,
ds_url: dsURL:
dataSourceVars.url[dataSourceVars.url.length - 1] !== '/' dataSourceVars.url[dataSourceVars.url.length - 1] !== '/'
? dataSourceVars.url ? dataSourceVars.url
: dataSourceVars.url.slice(0, -1), : dataSourceVars.url.slice(0, -1),
access_type: dataSourceVars.access, accessType: dataSourceVars.access,
auth_type: authType, authType,
basic_auth_username: dataSourceVars.username, basicAuthUsername: dataSourceVars.username,
basic_auth_password: dataSourceVars.password, basicAuthPassword: dataSourceVars.password,
scrape_interval: parseInt( scrapeInterval: parseInt(dataSourceVars.scrapeInterval.split('s')[0], 10),
dataSourceVars.scrapeInterval.split('s')[0], queryTimeout: parseInt(dataSourceVars.queryTimeout.split('s')[0], 10),
10 httpMethod: dataSourceVars.httpMethod,
), projectID,
query_timeout: parseInt(dataSourceVars.queryTimeout.split('s')[0], 10),
http_method: dataSourceVars.httpMethod,
project_id: projectID,
}; };
updateDataSource({ updateDataSource({
variables: { DSInput: dataSourceInput }, variables: { DSInput: dataSourceInput },

View File

@ -94,7 +94,7 @@ const ScheduleWorkflow = () => {
delete newParsedYaml.metadata.generateName; delete newParsedYaml.metadata.generateName;
newParsedYaml.metadata.name = fetchWorkflowNameFromManifest(manifest); newParsedYaml.metadata.name = fetchWorkflowNameFromManifest(manifest);
newParsedYaml.metadata.labels = { newParsedYaml.metadata.labels = {
workflow_id: workflowData.workflow_id, workflow_id: workflowData.workflowID,
}; };
newParsedYaml.spec.workflowSpec = oldParsedYaml.spec; newParsedYaml.spec.workflowSpec = oldParsedYaml.spec;
const tz = { const tz = {
@ -119,7 +119,7 @@ const ScheduleWorkflow = () => {
newParsedYaml.metadata.name = fetchWorkflowNameFromManifest(manifest); newParsedYaml.metadata.name = fetchWorkflowNameFromManifest(manifest);
newParsedYaml.spec = oldParsedYaml.spec.workflowSpec; newParsedYaml.spec = oldParsedYaml.spec.workflowSpec;
newParsedYaml.metadata.labels = { newParsedYaml.metadata.labels = {
workflow_id: workflowData.workflow_id, workflow_id: workflowData.workflowID,
}; };
NewYaml = YAML.stringify(newParsedYaml); NewYaml = YAML.stringify(newParsedYaml);
workflowAction.setWorkflowManifest({ workflowAction.setWorkflowManifest({
@ -136,7 +136,7 @@ const ScheduleWorkflow = () => {
// newParsedYaml.spec.suspend = false; // newParsedYaml.spec.suspend = false;
delete newParsedYaml.metadata.generateName; delete newParsedYaml.metadata.generateName;
newParsedYaml.metadata.name = fetchWorkflowNameFromManifest(manifest); newParsedYaml.metadata.name = fetchWorkflowNameFromManifest(manifest);
newParsedYaml.metadata.labels = { workflow_id: workflowData.workflow_id }; newParsedYaml.metadata.labels = { workflow_id: workflowData.workflowID };
const tz = { const tz = {
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC', timezone: Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC',
}; };

View File

@ -15,14 +15,14 @@ import Loader from '../../components/Loader';
import { parseYamlValidations } from '../../components/YamlEditor/Validations'; import { parseYamlValidations } from '../../components/YamlEditor/Validations';
import Wrapper from '../../containers/layouts/Wrapper'; import Wrapper from '../../containers/layouts/Wrapper';
import { UPDATE_SCHEDULE } from '../../graphql/mutations'; import { UPDATE_SCHEDULE } from '../../graphql/mutations';
import { WORKFLOW_LIST_DETAILS } from '../../graphql/queries'; import { GET_WORKFLOW_DETAILS } from '../../graphql/queries';
import { import {
CreateWorkFlowInput, CreateWorkFlowRequest,
UpdateWorkflowResponse, UpdateWorkflowResponse,
WeightMap, WeightMap,
} from '../../models/graphql/createWorkflowData'; } from '../../models/graphql/createWorkflowData';
import { import {
ListWorkflowsInput, GetWorkflowsRequest,
ScheduledWorkflows, ScheduledWorkflows,
} from '../../models/graphql/workflowListData'; } from '../../models/graphql/workflowListData';
import { experimentMap, WorkflowData } from '../../models/redux/workflow'; import { experimentMap, WorkflowData } from '../../models/redux/workflow';
@ -83,14 +83,14 @@ const EditSchedule: React.FC = () => {
const projectID = getProjectID(); const projectID = getProjectID();
const userRole = getProjectRole(); const userRole = getProjectRole();
const { data, loading } = useQuery<ScheduledWorkflows, ListWorkflowsInput>( const { data, loading } = useQuery<ScheduledWorkflows, GetWorkflowsRequest>(
WORKFLOW_LIST_DETAILS, GET_WORKFLOW_DETAILS,
{ {
variables: { variables: {
workflowInput: { request: {
project_id: projectID, projectID,
filter: { filter: {
workflow_name: paramData.workflowName, workflowName: paramData.workflowName,
}, },
}, },
}, },
@ -102,14 +102,14 @@ const EditSchedule: React.FC = () => {
(state: RootState) => state.workflowManifest.manifest (state: RootState) => state.workflowManifest.manifest
); );
const wfDetails = data && data.ListWorkflow.workflows[0]; const wfDetails = data && data.listWorkflows.workflows[0];
const doc = new YAML.Document(); const doc = new YAML.Document();
const w: Weights[] = []; const w: Weights[] = [];
const { cronSyntax, clusterid, clustername } = workflowData; const { cronSyntax, clusterID, clusterName } = workflowData;
const [createChaosWorkFlow, { error: workflowError }] = useMutation< const [createChaosWorkFlow, { error: workflowError }] = useMutation<
UpdateWorkflowResponse, UpdateWorkflowResponse,
CreateWorkFlowInput CreateWorkFlowRequest
>(UPDATE_SCHEDULE, { >(UPDATE_SCHEDULE, {
onCompleted: () => { onCompleted: () => {
setFinishModalOpen(true); setFinishModalOpen(true);
@ -126,7 +126,7 @@ const EditSchedule: React.FC = () => {
weights.forEach((data) => { weights.forEach((data) => {
weightData.push({ weightData.push({
experiment_name: data.experimentName, experimentName: data.experimentName,
weightage: data.weight, weightage: data.weight,
}); });
}); });
@ -137,19 +137,19 @@ const EditSchedule: React.FC = () => {
const yamlJson = JSON.stringify(yml, null, 2); // Converted to Stringified JSON const yamlJson = JSON.stringify(yml, null, 2); // Converted to Stringified JSON
const chaosWorkFlowInputs = { const chaosWorkFlowInputs = {
workflow_id: wfDetails?.workflow_id, workflow_id: wfDetails?.workflowID,
workflow_manifest: yamlJson, workflowManifest: yamlJson,
cronSyntax, cronSyntax,
workflow_name: fetchWorkflowNameFromManifest(manifest), workflowName: fetchWorkflowNameFromManifest(manifest),
workflow_description: workflow.description, workflowDescription: workflow.description,
isCustomWorkflow: false, isCustomWorkflow: false,
weightages: weightData, weightages: weightData,
project_id: projectID, projectID,
cluster_id: clusterid, clusterID,
}; };
createChaosWorkFlow({ createChaosWorkFlow({
variables: { ChaosWorkFlowInput: chaosWorkFlowInputs }, variables: { request: chaosWorkFlowInputs },
}); });
} }
}; };
@ -159,22 +159,22 @@ const EditSchedule: React.FC = () => {
if (wfDetails !== undefined) { if (wfDetails !== undefined) {
for (let i = 0; i < wfDetails?.weightages.length; i++) { for (let i = 0; i < wfDetails?.weightages.length; i++) {
w.push({ w.push({
experimentName: wfDetails?.weightages[i].experiment_name, experimentName: wfDetails?.weightages[i].experimentName,
weight: wfDetails?.weightages[i].weightage, weight: wfDetails?.weightages[i].weightage,
}); });
} }
doc.contents = JSON.parse(wfDetails?.workflow_manifest); doc.contents = JSON.parse(wfDetails?.workflowManifest);
workflowAction.setWorkflowManifest({ workflowAction.setWorkflowManifest({
manifest: isCronEdited === null ? doc.toString() : manifest, manifest: isCronEdited === null ? doc.toString() : manifest,
}); });
setWorkflow({ setWorkflow({
name: wfDetails?.workflow_name, name: wfDetails?.workflowName,
description: wfDetails?.workflow_description, description: wfDetails?.workflowDescription,
}); });
localforage.setItem('weights', w); localforage.setItem('weights', w);
workflowAction.setWorkflowDetails({ workflowAction.setWorkflowDetails({
workflow_id: wfDetails?.workflow_id, workflow_id: wfDetails?.workflowID,
clusterid: wfDetails?.cluster_id, clusterID: wfDetails?.clusterID,
cronSyntax: cronSyntax:
isCronEdited === null ? wfDetails?.cronSyntax : cronSyntax, isCronEdited === null ? wfDetails?.cronSyntax : cronSyntax,
scheduleType: { scheduleType: {
@ -313,7 +313,7 @@ const EditSchedule: React.FC = () => {
</Typography> </Typography>
</div> </div>
<Typography className={classes.schCol2}> <Typography className={classes.schCol2}>
{clustername} {clusterName}
</Typography> </Typography>
</div> </div>

View File

@ -58,6 +58,7 @@ const GetStarted: React.FC = () => {
.then((data) => { .then((data) => {
if ('error' in data) { if ('error' in data) {
console.error(data); console.error(data);
// eslint-disable-next-line no-alert
window.alert('Token expired, please login again'); window.alert('Token expired, please login again');
logout(); logout();
} }

View File

@ -5,7 +5,7 @@ import { useTranslation } from 'react-i18next';
import Loader from '../../components/Loader'; import Loader from '../../components/Loader';
import Wrapper from '../../containers/layouts/Wrapper'; import Wrapper from '../../containers/layouts/Wrapper';
import { GET_CLUSTER_LENGTH } from '../../graphql'; import { GET_CLUSTER_LENGTH } from '../../graphql';
import { Clusters, ClusterVars } from '../../models/graphql/clusterData'; import { ClusterRequest, Clusters } from '../../models/graphql/clusterData';
import { getUsername } from '../../utils/auth'; import { getUsername } from '../../utils/auth';
import { getProjectID } from '../../utils/getSearchParams'; import { getProjectID } from '../../utils/getSearchParams';
import useStyles from './styles'; import useStyles from './styles';
@ -19,10 +19,10 @@ const HomePage: React.FC = () => {
const classes = useStyles(); const classes = useStyles();
const { t } = useTranslation(); const { t } = useTranslation();
const { data: agentList, loading } = useQuery<Clusters, ClusterVars>( const { data: agentList, loading } = useQuery<Clusters, ClusterRequest>(
GET_CLUSTER_LENGTH, GET_CLUSTER_LENGTH,
{ {
variables: { project_id: getProjectID() }, variables: { projectID: getProjectID() },
fetchPolicy: 'network-only', fetchPolicy: 'network-only',
} }
); );
@ -30,7 +30,7 @@ const HomePage: React.FC = () => {
let agentCount = 0; let agentCount = 0;
if (agentList !== undefined) { if (agentList !== undefined) {
agentCount = agentList.getCluster.length; agentCount = agentList?.listClusters.length;
} }
return ( return (

View File

@ -14,7 +14,7 @@ import { useSelector } from 'react-redux';
import BackButton from '../../components/Button/BackButton'; import BackButton from '../../components/Button/BackButton';
import Loader from '../../components/Loader'; import Loader from '../../components/Loader';
import Wrapper from '../../containers/layouts/Wrapper'; import Wrapper from '../../containers/layouts/Wrapper';
import { LIST_DASHBOARD, VIEW_DASHBOARD } from '../../graphql'; import { GET_DASHBOARD, VIEW_DASHBOARD } from '../../graphql';
import { import {
PanelNameAndID, PanelNameAndID,
ParsedChaosEventPrometheusData, ParsedChaosEventPrometheusData,
@ -23,9 +23,9 @@ import {
SelectedDashboardInformation, SelectedDashboardInformation,
} from '../../models/dashboardsData'; } from '../../models/dashboardsData';
import { import {
DashboardList, GetDashboard,
ListDashboardResponse, GetDashboardRequest,
ListDashboardVars, GetDashboardResponse,
PanelGroupResponse, PanelGroupResponse,
PanelResponse, PanelResponse,
} from '../../models/graphql/dashboardsDetails'; } from '../../models/graphql/dashboardsDetails';
@ -144,7 +144,7 @@ const DashboardPage: React.FC = () => {
loading: loadingDashboards, loading: loadingDashboards,
error: errorFetchingDashboards, error: errorFetchingDashboards,
refetch: refetchDashboards, refetch: refetchDashboards,
} = useQuery<DashboardList, ListDashboardVars>(LIST_DASHBOARD, { } = useQuery<GetDashboard, GetDashboardRequest>(GET_DASHBOARD, {
variables: { variables: {
projectID, projectID,
clusterID: selectedDashboard.selectedAgentID, clusterID: selectedDashboard.selectedAgentID,
@ -168,24 +168,24 @@ const DashboardPage: React.FC = () => {
error: errorFetchingDashboardQueries, error: errorFetchingDashboardQueries,
} = useSubscription<ViewDashboard, ViewDashboardInput>(VIEW_DASHBOARD, { } = useSubscription<ViewDashboard, ViewDashboardInput>(VIEW_DASHBOARD, {
variables: { variables: {
dbID: selectedDashboardInformation.id, dashboardID: selectedDashboardInformation.id,
prometheusQueries: selectedDashboardInformation.promQueries, promQueries: selectedDashboardInformation.promQueries,
queryMap: getDashboardQueryMap( dashboardQueryMap: getDashboardQueryMap(
selectedDashboardInformation.metaData?.panel_groups ?? [] selectedDashboardInformation.metaData?.panelGroups ?? []
), ),
dataVarMap: { dataVariables: {
url: selectedDashboardInformation.dataSourceURL, url: selectedDashboardInformation.dataSourceURL,
start: selectedDashboardInformation.range.startDate, start: selectedDashboardInformation.range.startDate,
end: selectedDashboardInformation.range.endDate, end: selectedDashboardInformation.range.endDate,
relative_time: selectedDashboardInformation.relativeTime, relativeTime: selectedDashboardInformation.relativeTime,
refresh_interval: selectedDashboardInformation.refreshInterval, refreshInterval: selectedDashboardInformation.refreshInterval,
}, },
}, },
skip: skip:
loadingDashboards || loadingDashboards ||
errorFetchingDashboards !== undefined || errorFetchingDashboards !== undefined ||
selectedDashboardInformation.promQueries.length === 0 || selectedDashboardInformation.promQueries.length === 0 ||
selectedDashboardInformation.metaData?.panel_groups.length === 0 || selectedDashboardInformation.metaData?.panelGroups.length === 0 ||
selectedDashboardInformation.dataSourceURL === '' || selectedDashboardInformation.dataSourceURL === '' ||
(selectedDashboardInformation.range.startDate === INVALID_DATE && (selectedDashboardInformation.range.startDate === INVALID_DATE &&
selectedDashboardInformation.range.endDate === INVALID_DATE && selectedDashboardInformation.range.endDate === INVALID_DATE &&
@ -205,13 +205,13 @@ const DashboardPage: React.FC = () => {
onSubscriptionData: (subscriptionUpdate) => { onSubscriptionData: (subscriptionUpdate) => {
setPromData({ setPromData({
chaosEventData: ChaosEventDataParserForPrometheus( chaosEventData: ChaosEventDataParserForPrometheus(
subscriptionUpdate.subscriptionData.data?.viewDashboard subscriptionUpdate.subscriptionData?.data?.viewDashboard
?.annotationsResponse ?? [], ?.annotationsResponse ?? [],
areaGraph, areaGraph,
selectedEvents selectedEvents
), ),
panelGroupQueryMap: DashboardMetricDataParserForPrometheus( panelGroupQueryMap: DashboardMetricDataParserForPrometheus(
subscriptionUpdate.subscriptionData.data?.viewDashboard subscriptionUpdate.subscriptionData?.data?.viewDashboard
?.dashboardMetricsResponse ?? [], ?.dashboardMetricsResponse ?? [],
lineGraph, lineGraph,
areaGraph, areaGraph,
@ -236,65 +236,64 @@ const DashboardPage: React.FC = () => {
useEffect(() => { useEffect(() => {
if ( if (
dashboards && dashboards &&
dashboards.ListDashboard && dashboards.listDashboard &&
dashboards.ListDashboard.length dashboards.listDashboard.length
) { ) {
if ( if (
selectedDashboardInformation.id !== selectedDashboardInformation.id !==
selectedDashboardInformation.dashboardKey selectedDashboardInformation.dashboardKey
) { ) {
const selectedDashboard: ListDashboardResponse = const selectedDashboard: GetDashboardResponse =
dashboards.ListDashboard.filter((data) => { dashboards.listDashboard.filter((data) => {
return data.db_id === selectedDashboardInformation.id; return data.dbID === selectedDashboardInformation.id;
})[0]; })[0];
const selectedPanelNameAndIDList: PanelNameAndID[] = []; const selectedPanelNameAndIDList: PanelNameAndID[] = [];
if (selectedDashboard) { if (selectedDashboard) {
(selectedDashboard.panel_groups ?? []).forEach( (selectedDashboard.panelGroups ?? []).forEach(
(panelGroup: PanelGroupResponse) => { (panelGroup: PanelGroupResponse) => {
(panelGroup.panels ?? []).forEach((panel: PanelResponse) => { (panelGroup.panels ?? []).forEach((panel: PanelResponse) => {
selectedPanelNameAndIDList.push({ selectedPanelNameAndIDList.push({
name: panel.panel_name, name: panel.panelName,
id: panel.panel_id, id: panel.panelID,
}); });
}); });
} }
); );
setSelectedDashboardInformation({ setSelectedDashboardInformation({
...selectedDashboardInformation, ...selectedDashboardInformation,
dashboardListForAgent: dashboards.ListDashboard, dashboardListForAgent: dashboards.listDashboard,
metaData: selectedDashboard, metaData: selectedDashboard,
closedAreaQueryIDs: (selectedDashboard.panel_groups ?? []) closedAreaQueryIDs: (selectedDashboard.panelGroups ?? [])
.flatMap((panelGroup) => .flatMap((panelGroup) =>
panelGroup ? panelGroup.panels ?? [] : [] panelGroup ? panelGroup.panels ?? [] : []
) )
.flatMap((panel) => (panel ? panel.prom_queries ?? [] : [])) .flatMap((panel) => (panel ? panel.promQueries ?? [] : []))
.filter((query) => query.close_area) .filter((query) => query.closeArea)
.map((query) => query.queryid), .map((query) => query.queryID),
dashboardKey: selectedDashboardInformation.id, dashboardKey: selectedDashboardInformation.id,
panelNameAndIDList: selectedPanelNameAndIDList, panelNameAndIDList: selectedPanelNameAndIDList,
name: selectedDashboard.db_name, name: selectedDashboard.dbName,
typeName: selectedDashboard.db_type_name, typeName: selectedDashboard.dbTypeName,
typeID: selectedDashboard.db_type_id, typeID: selectedDashboard.dbTypeID,
agentName: selectedDashboard.cluster_name, agentName: selectedDashboard.clusterName,
urlToIcon: `./icons/${ urlToIcon: `./icons/${
selectedDashboard.db_type_id.includes('custom') selectedDashboard.dbTypeID.includes('custom')
? 'custom' ? 'custom'
: selectedDashboard.db_type_id : selectedDashboard.dbTypeID
}_dashboard.svg`, }_dashboard.svg`,
information: selectedDashboard.db_information, information: selectedDashboard.dbInformation,
chaosEventQueryTemplate: chaosEventQueryTemplate: selectedDashboard.chaosEventQueryTemplate,
selectedDashboard.chaos_event_query_template,
chaosVerdictQueryTemplate: chaosVerdictQueryTemplate:
selectedDashboard.chaos_verdict_query_template, selectedDashboard.chaosVerdictQueryTemplate,
applicationMetadataMap: selectedDashboard.application_metadata_map, applicationMetadataMap: selectedDashboard.applicationMetadataMap,
dataSourceURL: selectedDashboard.ds_url, dataSourceURL: selectedDashboard.dsURL,
dataSourceID: selectedDashboard.ds_id, dataSourceID: selectedDashboard.dsID,
dataSourceName: selectedDashboard.ds_name, dataSourceName: selectedDashboard.dsName,
promQueries: generatePromQueries( promQueries: generatePromQueries(
selectedDashboardInformation.range, selectedDashboardInformation.range,
selectedDashboard.panel_groups ?? [], selectedDashboard.panelGroups ?? [],
selectedDashboard.chaos_event_query_template, selectedDashboard.chaosEventQueryTemplate,
selectedDashboard.chaos_verdict_query_template selectedDashboard.chaosVerdictQueryTemplate
), ),
}); });
setSelectedPanels( setSelectedPanels(
@ -305,8 +304,8 @@ const DashboardPage: React.FC = () => {
...promData, ...promData,
panelGroupQueryMap: [], panelGroupQueryMap: [],
}); });
if (selectedDashboard.ds_health_status !== ACTIVE) { if (selectedDashboard.dsHealthStatus !== ACTIVE) {
setDataSourceStatus(selectedDashboard.ds_health_status); setDataSourceStatus(selectedDashboard.dsHealthStatus);
} }
} }
setReFetch(true); setReFetch(true);
@ -454,21 +453,21 @@ const DashboardPage: React.FC = () => {
classes={{ paper: classes.menuList }} classes={{ paper: classes.menuList }}
> >
{selectedDashboardInformation.dashboardListForAgent.map( {selectedDashboardInformation.dashboardListForAgent.map(
(data: ListDashboardResponse) => { (data: GetDashboardResponse) => {
return ( return (
<MenuItem <MenuItem
key={`${data.db_id}-monitoringDashboard`} key={`${data.dbID}-monitoringDashboard`}
value={data.db_id} value={data.dbID}
selected={ selected={
data.db_id === selectedDashboardInformation.id data.dbID === selectedDashboardInformation.id
} }
onClick={() => { onClick={() => {
dashboard.selectDashboard({ dashboard.selectDashboard({
selectedDashboardID: data.db_id, selectedDashboardID: data.dbID,
}); });
setSelectedDashboardInformation({ setSelectedDashboardInformation({
...selectedDashboardInformation, ...selectedDashboardInformation,
id: data.db_id, id: data.dbID,
}); });
setAnchorEl(null); setAnchorEl(null);
}} }}
@ -480,7 +479,7 @@ const DashboardPage: React.FC = () => {
className={classes.btnText} className={classes.btnText}
variant="h5" variant="h5"
> >
{data.db_name} {data.dbName}
</Typography> </Typography>
</div> </div>
</MenuItem> </MenuItem>
@ -544,7 +543,7 @@ const DashboardPage: React.FC = () => {
refreshInterval, refreshInterval,
promQueries: generatePromQueries( promQueries: generatePromQueries(
range, range,
selectedDashboardInformation.metaData?.panel_groups ?? [], selectedDashboardInformation.metaData?.panelGroups ?? [],
selectedDashboardInformation.chaosEventQueryTemplate, selectedDashboardInformation.chaosEventQueryTemplate,
selectedDashboardInformation.chaosVerdictQueryTemplate selectedDashboardInformation.chaosVerdictQueryTemplate
), ),
@ -651,15 +650,15 @@ const DashboardPage: React.FC = () => {
promData.panelGroupQueryMap.length > 0 && promData.panelGroupQueryMap.length > 0 &&
!reFetching && !reFetching &&
selectedDashboardInformation.metaData && selectedDashboardInformation.metaData &&
selectedDashboardInformation.metaData.panel_groups.length > 0 && selectedDashboardInformation.metaData.panelGroups.length > 0 &&
selectedDashboardInformation.metaData.panel_groups.map( selectedDashboardInformation.metaData.panelGroups.map(
(panelGroup: PanelGroupResponse, index) => ( (panelGroup: PanelGroupResponse, index) => (
<div <div
key={`${panelGroup.panel_group_id}-dashboardPage-div`} key={`${panelGroup.panelGroupID}-dashboardPage-div`}
data-cy="dashboardPanelGroup" data-cy="dashboardPanelGroup"
> >
<DashboardPanelGroup <DashboardPanelGroup
key={`${panelGroup.panel_group_id}-dashboardPage-component`} key={`${panelGroup.panelGroupID}-dashboardPage-component`}
centralAllowGraphUpdate={centralAllowGraphUpdate} centralAllowGraphUpdate={centralAllowGraphUpdate}
centralBrushPosition={centralBrushPosition} centralBrushPosition={centralBrushPosition}
handleCentralBrushPosition={( handleCentralBrushPosition={(
@ -766,7 +765,7 @@ const DashboardPage: React.FC = () => {
promQueries: generatePromQueries( promQueries: generatePromQueries(
range, range,
selectedDashboardInformation.metaData selectedDashboardInformation.metaData
?.panel_groups ?? [], ?.panelGroups ?? [],
selectedDashboardInformation.chaosEventQueryTemplate, selectedDashboardInformation.chaosEventQueryTemplate,
selectedDashboardInformation.chaosVerdictQueryTemplate selectedDashboardInformation.chaosVerdictQueryTemplate
), ),
@ -787,7 +786,7 @@ const DashboardPage: React.FC = () => {
promQueries: generatePromQueries( promQueries: generatePromQueries(
timeControlObjectFromHistory.range, timeControlObjectFromHistory.range,
selectedDashboardInformation.metaData selectedDashboardInformation.metaData
?.panel_groups ?? [], ?.panelGroups ?? [],
selectedDashboardInformation.chaosEventQueryTemplate, selectedDashboardInformation.chaosEventQueryTemplate,
selectedDashboardInformation.chaosVerdictQueryTemplate selectedDashboardInformation.chaosVerdictQueryTemplate
), ),
@ -844,7 +843,7 @@ const DashboardPage: React.FC = () => {
endDate: INVALID_DATE, endDate: INVALID_DATE,
}, },
selectedDashboardInformation.metaData selectedDashboardInformation.metaData
?.panel_groups ?? [], ?.panelGroups ?? [],
selectedDashboardInformation.chaosEventQueryTemplate, selectedDashboardInformation.chaosEventQueryTemplate,
selectedDashboardInformation.chaosVerdictQueryTemplate selectedDashboardInformation.chaosVerdictQueryTemplate
), ),
@ -858,8 +857,8 @@ const DashboardPage: React.FC = () => {
setShowPromQueryResponseLoader(false); setShowPromQueryResponseLoader(false);
} }
}} }}
panel_group_id={panelGroup.panel_group_id} panelGroupID={panelGroup.panelGroupID}
panel_group_name={panelGroup.panel_group_name} panelGroupName={panelGroup.panelGroupName}
panels={panelGroup.panels ?? []} panels={panelGroup.panels ?? []}
selectedPanels={selectedPanels} selectedPanels={selectedPanels}
metricDataForGroup={ metricDataForGroup={

View File

@ -63,7 +63,7 @@ const Settings: React.FC = () => {
> >
<StyledTab data-cy="my-account" label="My Account" {...tabProps(0)} /> <StyledTab data-cy="my-account" label="My Account" {...tabProps(0)} />
<StyledTab data-cy="teaming" label="Team" {...tabProps(1)} /> <StyledTab data-cy="teaming" label="Team" {...tabProps(1)} />
{role === UserRole.admin && ( {role === UserRole.ADMIN && (
<StyledTab <StyledTab
data-cy="user-management" data-cy="user-management"
label="User Management" label="User Management"
@ -73,12 +73,12 @@ const Settings: React.FC = () => {
<StyledTab <StyledTab
data-cy="gitOps" data-cy="gitOps"
label="GitOps" label="GitOps"
{...tabProps(role === UserRole.admin ? 3 : 2)} {...tabProps(role === UserRole.ADMIN ? 3 : 2)}
/> />
<StyledTab <StyledTab
data-cy="image-registry" data-cy="image-registry"
label="Image Registry" label="Image Registry"
{...tabProps(role === UserRole.admin ? 4 : 3)} {...tabProps(role === UserRole.ADMIN ? 4 : 3)}
/> />
</Tabs> </Tabs>
</Paper> </Paper>
@ -94,7 +94,7 @@ const Settings: React.FC = () => {
</SuspenseLoader> </SuspenseLoader>
</TabPanel> </TabPanel>
</div> </div>
{role === UserRole.admin && ( {role === UserRole.ADMIN && (
<TabPanel value={settingsTabValue} index={2}> <TabPanel value={settingsTabValue} index={2}>
<SuspenseLoader style={{ height: '50vh' }}> <SuspenseLoader style={{ height: '50vh' }}>
<UserManagement /> <UserManagement />
@ -104,7 +104,7 @@ const Settings: React.FC = () => {
<div data-cy="GitOpsPanel"> <div data-cy="GitOpsPanel">
<TabPanel <TabPanel
value={settingsTabValue} value={settingsTabValue}
index={role === UserRole.admin ? 3 : 2} index={role === UserRole.ADMIN ? 3 : 2}
> >
<SuspenseLoader style={{ height: '50vh' }}> <SuspenseLoader style={{ height: '50vh' }}>
<GitOpsTab /> <GitOpsTab />
@ -114,7 +114,7 @@ const Settings: React.FC = () => {
<div data-cy="ImageRegistry"> <div data-cy="ImageRegistry">
<TabPanel <TabPanel
value={settingsTabValue} value={settingsTabValue}
index={role === UserRole.admin ? 4 : 3} index={role === UserRole.ADMIN ? 4 : 3}
> >
<SuspenseLoader style={{ height: '50vh' }}> <SuspenseLoader style={{ height: '50vh' }}>
<ImageRegistry /> <ImageRegistry />

View File

@ -11,20 +11,20 @@ import { SuspenseLoader } from '../../components/SuspenseLoader';
import { StyledTab, TabPanel } from '../../components/Tabs'; import { StyledTab, TabPanel } from '../../components/Tabs';
import Wrapper from '../../containers/layouts/Wrapper'; import Wrapper from '../../containers/layouts/Wrapper';
import { import {
GET_WORKFLOW_DETAILS,
WORKFLOW_DETAILS_WITH_EXEC_DATA, WORKFLOW_DETAILS_WITH_EXEC_DATA,
WORKFLOW_EVENTS_WITH_EXEC_DATA, WORKFLOW_EVENTS_WITH_EXEC_DATA,
WORKFLOW_LIST_DETAILS,
} from '../../graphql'; } from '../../graphql';
import { ScheduleWorkflow } from '../../models/graphql/scheduleData'; import { ScheduleWorkflow } from '../../models/graphql/scheduleData';
import { import {
ExecutionData, ExecutionData,
Workflow, Workflow,
WorkflowDataVars, WorkflowDataRequest,
WorkflowSubscription, WorkflowSubscription,
WorkflowSubscriptionInput, WorkflowSubscriptionRequest,
} from '../../models/graphql/workflowData'; } from '../../models/graphql/workflowData';
import { import {
ListWorkflowsInput, GetWorkflowsRequest,
ScheduledWorkflows, ScheduledWorkflows,
} from '../../models/graphql/workflowListData'; } from '../../models/graphql/workflowListData';
import useActions from '../../redux/actions'; import useActions from '../../redux/actions';
@ -46,7 +46,7 @@ const NodeTable = lazy(
); );
interface URLParams { interface URLParams {
workflowRunId: string; workflowRunID: string;
} }
const WorkflowDetails: React.FC = () => { const WorkflowDetails: React.FC = () => {
@ -70,34 +70,33 @@ const WorkflowDetails: React.FC = () => {
(state: RootState) => state.tabNumber.node (state: RootState) => state.tabNumber.node
); );
const { pod_name } = useSelector((state: RootState) => state.selectedNode); const { podName } = useSelector((state: RootState) => state.selectedNode);
const { workflowRunId }: URLParams = useParams();
const { workflowRunID }: URLParams = useParams();
// Query to get workflows // Query to get workflows
const { subscribeToMore, data, error } = useQuery<Workflow, WorkflowDataVars>( const { subscribeToMore, data, error } = useQuery<
WORKFLOW_DETAILS_WITH_EXEC_DATA, Workflow,
{ WorkflowDataRequest
variables: { >(WORKFLOW_DETAILS_WITH_EXEC_DATA, {
workflowRunsInput: { variables: {
project_id: projectID, request: {
workflow_run_ids: [workflowRunId], projectID,
}, workflowRunIDs: [workflowRunID],
}, },
fetchPolicy: 'cache-and-network', },
} fetchPolicy: 'cache-and-network',
); });
const workflowRun = data?.getWorkflowRuns.workflow_runs[0]; const workflowRun = data?.listWorkflowRuns.workflowRuns[0];
const { data: workflowData, loading } = useQuery< const { data: workflowData, loading } = useQuery<
ScheduledWorkflows, ScheduledWorkflows,
ListWorkflowsInput GetWorkflowsRequest
>(WORKFLOW_LIST_DETAILS, { >(GET_WORKFLOW_DETAILS, {
variables: { variables: {
workflowInput: { request: {
project_id: projectID, projectID,
workflow_ids: [workflowRun?.workflow_id ?? ' '], workflowIDs: [workflowRun?.workflowID ?? ' '],
}, },
}, },
fetchPolicy: 'cache-and-network', fetchPolicy: 'cache-and-network',
@ -106,29 +105,27 @@ const WorkflowDetails: React.FC = () => {
// Using subscription to get realtime data // Using subscription to get realtime data
useEffect(() => { useEffect(() => {
if (workflowRun?.phase && workflowRun.phase === 'Running') { if (workflowRun?.phase && workflowRun.phase === 'Running') {
subscribeToMore<WorkflowSubscription, WorkflowSubscriptionInput>({ subscribeToMore<WorkflowSubscription, WorkflowSubscriptionRequest>({
document: WORKFLOW_EVENTS_WITH_EXEC_DATA, document: WORKFLOW_EVENTS_WITH_EXEC_DATA,
variables: { projectID }, variables: { projectID },
updateQuery: (prev, { subscriptionData }) => { updateQuery: (prev, { subscriptionData }) => {
if (!subscriptionData.data || !prev || !prev.getWorkflowRuns) if (!subscriptionData.data || !prev || !prev.listWorkflowRuns)
return prev; return prev;
const modifiedWorkflows = prev.getWorkflowRuns.workflow_runs.slice(); const modifiedWorkflows = prev.listWorkflowRuns.workflowRuns.slice();
const newWorkflow = subscriptionData.data.workflowEventListener; const newWorkflow = subscriptionData.data.getWorkflowEvents;
// Update only the required workflowRun // Update only the required workflowRun
if ( if (modifiedWorkflows[0].workflowRunID === newWorkflow.workflowRunID)
modifiedWorkflows[0].workflow_run_id === newWorkflow.workflow_run_id
)
modifiedWorkflows[0] = newWorkflow; modifiedWorkflows[0] = newWorkflow;
const totalNoOfWorkflows = const totalNoOfWorkflows =
prev.getWorkflowRuns.total_no_of_workflow_runs; prev.listWorkflowRuns.totalNoOfWorkflowRuns;
return { return {
getWorkflowRuns: { listWorkflowRuns: {
total_no_of_workflow_runs: totalNoOfWorkflows, totalNoOfWorkflowRuns: totalNoOfWorkflows,
workflow_runs: modifiedWorkflows, workflowRuns: modifiedWorkflows,
}, },
}; };
}, },
@ -141,10 +138,12 @@ const WorkflowDetails: React.FC = () => {
}; };
useEffect(() => { useEffect(() => {
const scheduledWorkflow = workflowData?.ListWorkflow.workflows; const scheduledWorkflow = workflowData?.listWorkflows.workflows;
if (scheduledWorkflow) { if (scheduledWorkflow) {
setworkflowSchedulesDetails( setworkflowSchedulesDetails(
(scheduledWorkflow[0] ? scheduledWorkflow[0] : null) as ScheduleWorkflow (scheduledWorkflow[0]
? scheduledWorkflow[0]
: null) as unknown as ScheduleWorkflow
); );
} }
}, [workflowData]); }, [workflowData]);
@ -156,21 +155,19 @@ const WorkflowDetails: React.FC = () => {
// Setting NodeId of first Node in redux for selection of first node in Argo graph by default // Setting NodeId of first Node in redux for selection of first node in Argo graph by default
useEffect(() => { useEffect(() => {
if (workflowRun !== undefined && pod_name === '') { if (workflowRun !== undefined && podName === '') {
if ( if (
JSON.parse(workflowRun.execution_data as string).nodes !== null && JSON.parse(workflowRun.executionData as string).nodes !== null &&
Object.keys(JSON.parse(workflowRun.execution_data as string).nodes) Object.keys(JSON.parse(workflowRun.executionData as string).nodes)
.length .length
) { ) {
const firstNodeId = JSON.parse(workflowRun.execution_data as string) const firstNodeId = JSON.parse(workflowRun.executionData as string)
.nodes[ .nodes[
Object.keys(JSON.parse(workflowRun.execution_data as string).nodes)[0] Object.keys(JSON.parse(workflowRun.executionData as string).nodes)[0]
].name; ].name;
nodeSelection.selectNode({ nodeSelection.selectNode({
...JSON.parse(workflowRun.execution_data as string).nodes[ ...JSON.parse(workflowRun.executionData as string).nodes[firstNodeId],
firstNodeId podName: firstNodeId,
],
pod_name: firstNodeId,
}); });
} else { } else {
setWorkflowFailed(true); setWorkflowFailed(true);
@ -185,10 +182,10 @@ const WorkflowDetails: React.FC = () => {
<BackButton /> <BackButton />
</div> </div>
{/* If workflowRun data is present then display the workflowRun details */} {/* If workflowRun data is present then display the workflowRun details */}
{workflowRun && pod_name !== '' && !loading ? ( {workflowRun && podName !== '' && !loading ? (
<div> <div>
<Typography data-cy="wfName" className={classes.title}> <Typography data-cy="wfName" className={classes.title}>
{t('workflowDetailsView.headerDesc')} {workflowRun.workflow_name} {t('workflowDetailsView.headerDesc')} {workflowRun.workflowName}
</Typography> </Typography>
{/* AppBar */} {/* AppBar */}
@ -220,7 +217,7 @@ const WorkflowDetails: React.FC = () => {
{/* Argo Workflow DAG Graph */} {/* Argo Workflow DAG Graph */}
<ArgoWorkflow <ArgoWorkflow
nodes={ nodes={
(JSON.parse(workflowRun.execution_data) as ExecutionData) (JSON.parse(workflowRun.executionData) as ExecutionData)
.nodes .nodes
} }
setIsInfoToggled={setIsInfoToggled} setIsInfoToggled={setIsInfoToggled}
@ -229,23 +226,23 @@ const WorkflowDetails: React.FC = () => {
{/* Workflow Details and Experiment Logs */} {/* Workflow Details and Experiment Logs */}
{isInfoToggled ? ( {isInfoToggled ? (
<div> <div>
{pod_name !== {podName !==
JSON.parse(workflowRun.execution_data).nodes[ JSON.parse(workflowRun.executionData).nodes[
Object.keys( Object.keys(
JSON.parse(workflowRun.execution_data as string).nodes JSON.parse(workflowRun.executionData as string).nodes
)[0] )[0]
].name ? ( ].name ? (
/* Node details and Logs */ /* Node details and Logs */
<WorkflowNodeInfo <WorkflowNodeInfo
manifest={ manifest={
workflowSchedulesDetails?.workflow_manifest as string workflowSchedulesDetails?.workflowManifest as string
} }
setIsInfoToggled={setIsInfoToggled} setIsInfoToggled={setIsInfoToggled}
cluster_id={workflowRun.cluster_id} clusterID={workflowRun.clusterID}
workflow_run_id={workflowRun.workflow_run_id} workflowRunID={workflowRun.workflowRunID}
data={ data={
JSON.parse( JSON.parse(
workflowRun.execution_data workflowRun.executionData
) as ExecutionData ) as ExecutionData
} }
/> />
@ -254,14 +251,14 @@ const WorkflowDetails: React.FC = () => {
<WorkflowInfo <WorkflowInfo
tab={1} tab={1}
setIsInfoToggled={setIsInfoToggled} setIsInfoToggled={setIsInfoToggled}
workflow_phase={workflowRun.phase} workflowPhase={workflowRun.phase}
cluster_name={workflowRun.cluster_name} clusterName={workflowRun.clusterName}
data={ data={
JSON.parse( JSON.parse(
workflowRun.execution_data workflowRun.executionData
) as ExecutionData ) as ExecutionData
} }
resiliency_score={workflowRun.resiliency_score} resiliencyScore={workflowRun.resiliencyScore}
/> />
)} )}
</div> </div>
@ -274,27 +271,27 @@ const WorkflowDetails: React.FC = () => {
{/* Workflow Info */} {/* Workflow Info */}
<WorkflowInfo <WorkflowInfo
tab={2} tab={2}
workflow_phase={workflowRun.phase} workflowPhase={workflowRun.phase}
cluster_name={workflowRun.cluster_name} clusterName={workflowRun.clusterName}
data={JSON.parse(workflowRun.execution_data) as ExecutionData} data={JSON.parse(workflowRun.executionData) as ExecutionData}
resiliency_score={workflowRun.resiliency_score} resiliencyScore={workflowRun.resiliencyScore}
/> />
{/* Table for all Node details */} {/* Table for all Node details */}
<NodeTable <NodeTable
manifest={ manifest={
workflowSchedulesDetails?.workflow_manifest as string workflowSchedulesDetails?.workflowManifest as string
} }
data={JSON.parse(workflowRun.execution_data) as ExecutionData} data={JSON.parse(workflowRun.executionData) as ExecutionData}
handleClose={() => setLogsModalOpen(true)} handleClose={() => setLogsModalOpen(true)}
/> />
{/* Modal for viewing logs of a node */} {/* Modal for viewing logs of a node */}
<NodeLogsModal <NodeLogsModal
logsOpen={logsModalOpen} logsOpen={logsModalOpen}
handleClose={() => setLogsModalOpen(false)} handleClose={() => setLogsModalOpen(false)}
cluster_id={workflowRun.cluster_id} clusterID={workflowRun.clusterID}
workflow_run_id={workflowRun.workflow_run_id} workflowRunID={workflowRun.workflowRunID}
data={JSON.parse(workflowRun.execution_data) as ExecutionData} data={JSON.parse(workflowRun.executionData) as ExecutionData}
workflow_name={workflowRun.workflow_name} workflowName={workflowRun.workflowName}
/> />
</SuspenseLoader> </SuspenseLoader>
</TabPanel> </TabPanel>

View File

@ -51,8 +51,8 @@ const WorkflowStats: React.FC<WorkflowStatsProps> = ({
>(GET_WORKFLOW_RUNS_STATS, { >(GET_WORKFLOW_RUNS_STATS, {
variables: { variables: {
workflowRunStatsRequest: { workflowRunStatsRequest: {
project_id: projectID, projectID,
workflow_ids: [workflowID], workflowIDs: [workflowID],
}, },
}, },
fetchPolicy: 'cache-and-network', fetchPolicy: 'cache-and-network',
@ -68,22 +68,22 @@ const WorkflowStats: React.FC<WorkflowStatsProps> = ({
const graphData: RadialChartMetric[] = [ const graphData: RadialChartMetric[] = [
{ {
value: isSingleRun value: isSingleRun
? data?.getWorkflowRunStats.experiments_passed ?? 0 ? data?.getWorkflowRunStats.experimentsPassed ?? 0
: data?.getWorkflowRunStats.succeeded_workflow_runs ?? 0, : data?.getWorkflowRunStats.succeededWorkflowRuns ?? 0,
label: isSingleRun ? 'Passed' : 'Succeeded', label: isSingleRun ? 'Passed' : 'Succeeded',
baseColor: theme.palette.status.experiment.completed, baseColor: theme.palette.status.experiment.completed,
}, },
{ {
value: isSingleRun value: isSingleRun
? data?.getWorkflowRunStats.experiments_failed ?? 0 ? data?.getWorkflowRunStats.experimentsFailed ?? 0
: data?.getWorkflowRunStats.failed_workflow_runs ?? 0, : data?.getWorkflowRunStats.failedWorkflowRuns ?? 0,
label: 'Failed', label: 'Failed',
baseColor: theme.palette.status.experiment.failed, baseColor: theme.palette.status.experiment.failed,
}, },
{ {
value: isSingleRun value: isSingleRun
? data?.getWorkflowRunStats.experiments_awaited ?? 0 ? data?.getWorkflowRunStats.experimentsAwaited ?? 0
: data?.getWorkflowRunStats.running_workflow_runs ?? 0, : data?.getWorkflowRunStats.runningWorkflowRuns ?? 0,
label: isSingleRun ? 'Awaited' : 'Running', label: isSingleRun ? 'Awaited' : 'Running',
baseColor: theme.palette.status.workflow.running, baseColor: theme.palette.status.workflow.running,
}, },
@ -92,12 +92,12 @@ const WorkflowStats: React.FC<WorkflowStatsProps> = ({
if (isSingleRun) { if (isSingleRun) {
graphData.push( graphData.push(
{ {
value: data?.getWorkflowRunStats.experiments_stopped ?? 0, value: data?.getWorkflowRunStats.experimentsStopped ?? 0,
label: 'Stopped', label: 'Stopped',
baseColor: theme.palette.status.experiment.error, baseColor: theme.palette.status.experiment.error,
}, },
{ {
value: data?.getWorkflowRunStats.experiments_na ?? 0, value: data?.getWorkflowRunStats.experimentsNa ?? 0,
label: 'NA', label: 'NA',
baseColor: theme.palette.status.experiment.omitted, baseColor: theme.palette.status.experiment.omitted,
} }
@ -109,10 +109,10 @@ const WorkflowStats: React.FC<WorkflowStatsProps> = ({
}; };
const progressGraphData = { const progressGraphData = {
value: data?.getWorkflowRunStats.average_resiliency_score ?? 0, value: data?.getWorkflowRunStats.averageResiliencyScore ?? 0,
label: 'Avg Resiliency Score', label: 'Avg Resiliency Score',
baseColor: getValueColor( baseColor: getValueColor(
data?.getWorkflowRunStats.average_resiliency_score ?? 0, data?.getWorkflowRunStats.averageResiliencyScore ?? 0,
resilienceScoreColourMap resilienceScoreColourMap
), ),
}; };
@ -136,7 +136,7 @@ const WorkflowStats: React.FC<WorkflowStatsProps> = ({
heading={ heading={
isSingleRun isSingleRun
? 'Experiments' ? 'Experiments'
: data?.getWorkflowRunStats.total_workflow_runs !== 1 : data?.getWorkflowRunStats.totalWorkflowRuns !== 1
? 'Runs' ? 'Runs'
: 'Run' : 'Run'
} }
@ -194,14 +194,13 @@ const WorkflowStats: React.FC<WorkflowStatsProps> = ({
passPercentage={ passPercentage={
showWorkflowStats showWorkflowStats
? data?.getWorkflowRunStats ? data?.getWorkflowRunStats
.workflow_run_succeeded_percentage ?? 0 .workflowRunSucceededPercentage ?? 0
: data?.getWorkflowRunStats.passed_percentage ?? 0 : data?.getWorkflowRunStats.passedPercentage ?? 0
} }
failPercentage={ failPercentage={
showWorkflowStats showWorkflowStats
? data?.getWorkflowRunStats ? data?.getWorkflowRunStats.workflowRunFailedPercentage ?? 0
.workflow_run_failed_percentage ?? 0 : data?.getWorkflowRunStats.failedPercentage ?? 0
: data?.getWorkflowRunStats.failed_percentage ?? 0
} }
/> />
</div> </div>

View File

@ -39,13 +39,13 @@ const InfoSection: React.FC<InfoSectionProps> = ({
<Typography> <Typography>
Name :{' '} Name :{' '}
<span className={classes.infoHint} data-cy="infoWorkflowName"> <span className={classes.infoHint} data-cy="infoWorkflowName">
{data.ListWorkflow.workflows[0].workflow_name} {data.listWorkflows.workflows[0].workflowName}
</span> </span>
</Typography> </Typography>
<Typography> <Typography>
Id :{' '} Id :{' '}
<span className={classes.infoHint} data-cy="infoWorkflowId"> <span className={classes.infoHint} data-cy="infoWorkflowId">
{data.ListWorkflow.workflows[0].workflow_id} {data.listWorkflows.workflows[0].workflowID}
</span> </span>
</Typography> </Typography>
{data && ( {data && (
@ -57,7 +57,7 @@ const InfoSection: React.FC<InfoSectionProps> = ({
> >
{ {
YAML.parse( YAML.parse(
data?.ListWorkflow.workflows[0].workflow_manifest data?.listWorkflows.workflows[0].workflowManifest
).metadata.labels.subject ).metadata.labels.subject
} }
</span> </span>
@ -72,7 +72,7 @@ const InfoSection: React.FC<InfoSectionProps> = ({
> >
{ {
YAML.parse( YAML.parse(
data?.ListWorkflow.workflows[0].workflow_manifest data?.listWorkflows.workflows[0].workflowManifest
).metadata.namespace ).metadata.namespace
} }
</span> </span>
@ -86,13 +86,13 @@ const InfoSection: React.FC<InfoSectionProps> = ({
<Typography> <Typography>
Name :{' '} Name :{' '}
<span className={classes.infoHint} data-cy="infoAgentName"> <span className={classes.infoHint} data-cy="infoAgentName">
{data.ListWorkflow.workflows[0].cluster_name} {data.listWorkflows.workflows[0].clusterName}
</span> </span>
</Typography> </Typography>
<Typography> <Typography>
Id :{' '} Id :{' '}
<span className={classes.infoHint} data-cy="infoClusterId"> <span className={classes.infoHint} data-cy="infoClusterId">
{data.ListWorkflow.workflows[0].cluster_id} {data.listWorkflows.workflows[0].clusterID}
</span> </span>
</Typography> </Typography>
</div> </div>
@ -105,16 +105,16 @@ const InfoSection: React.FC<InfoSectionProps> = ({
Last Run :{' '} Last Run :{' '}
<span className={classes.infoHint}> <span className={classes.infoHint}>
{timeDifferenceForDate( {timeDifferenceForDate(
data.ListWorkflow.workflows[0].updated_at data.listWorkflows.workflows[0].updatedAt
)} )}
</span> </span>
</Typography> </Typography>
<Typography data-cy="infoWorkflowNextRun"> <Typography data-cy="infoWorkflowNextRun">
Next Run :{' '} Next Run :{' '}
{data.ListWorkflow.workflows[0].cronSyntax ? ( {data.listWorkflows.workflows[0].cronSyntax ? (
<span className={classes.infoHint}> <span className={classes.infoHint}>
{parser {parser
.parseExpression(data.ListWorkflow.workflows[0].cronSyntax) .parseExpression(data.listWorkflows.workflows[0].cronSyntax)
.next() .next()
.toString()} .toString()}
</span> </span>
@ -126,13 +126,13 @@ const InfoSection: React.FC<InfoSectionProps> = ({
{/* Column 4 */} {/* Column 4 */}
<div className={classes.regularity} data-cy="infoWorkflowRegularity"> <div className={classes.regularity} data-cy="infoWorkflowRegularity">
<Typography className={classes.infoHeader}>Regularity :</Typography> <Typography className={classes.infoHeader}>Regularity :</Typography>
{data.ListWorkflow.workflows[0].cronSyntax === '' ? ( {data.listWorkflows.workflows[0].cronSyntax === '' ? (
<Typography>Non cron workflow</Typography> <Typography>Non cron workflow</Typography>
) : ( ) : (
data.ListWorkflow.workflows[0].cronSyntax !== undefined && ( data.listWorkflows.workflows[0].cronSyntax !== undefined && (
<Typography> <Typography>
{cronstrue.toString( {cronstrue.toString(
data.ListWorkflow.workflows[0].cronSyntax data.listWorkflows.workflows[0].cronSyntax
)} )}
</Typography> </Typography>
) )
@ -141,8 +141,8 @@ const InfoSection: React.FC<InfoSectionProps> = ({
</div> </div>
{showMore && ( {showMore && (
<WorkflowStats <WorkflowStats
workflowID={data.ListWorkflow.workflows[0].workflow_id} workflowID={data.listWorkflows.workflows[0].workflowID}
isCron={data.ListWorkflow.workflows[0].cronSyntax !== ''} isCron={data.listWorkflows.workflows[0].cronSyntax !== ''}
noOfWorkflowRuns={workflowRunLength ?? 0} noOfWorkflowRuns={workflowRunLength ?? 0}
/> />
)} )}

View File

@ -13,7 +13,7 @@ import Center from '../../../containers/layouts/Center';
import { WORKFLOW_DETAILS } from '../../../graphql'; import { WORKFLOW_DETAILS } from '../../../graphql';
import { import {
Workflow, Workflow,
WorkflowDataVars, WorkflowDataRequest,
} from '../../../models/graphql/workflowData'; } from '../../../models/graphql/workflowData';
import { getProjectID } from '../../../utils/getSearchParams'; import { getProjectID } from '../../../utils/getSearchParams';
import WorkflowRunTable from '../WorkflowRunTable'; import WorkflowRunTable from '../WorkflowRunTable';
@ -60,20 +60,20 @@ const StackedBarGraph: React.FC<StackedBarGraphProps> = ({
return ''; return '';
}; };
const { data, loading } = useQuery<Workflow, WorkflowDataVars>( const { data, loading } = useQuery<Workflow, WorkflowDataRequest>(
WORKFLOW_DETAILS, WORKFLOW_DETAILS,
{ {
variables: { variables: {
workflowRunsInput: { request: {
project_id: projectID, projectID,
workflow_ids: [workflowID], workflowIDs: [workflowID],
sort: { sort: {
field: 'Time', field: 'TIME',
}, },
filter: { filter: {
date_range: { dateRange: {
start_date: moment.unix(date).startOf('day').unix().toString(), startDate: moment.unix(date).startOf('day').unix().toString(),
end_date: moment.unix(date).endOf('day').unix().toString(), endDate: moment.unix(date).endOf('day').unix().toString(),
}, },
}, },
}, },
@ -82,30 +82,30 @@ const StackedBarGraph: React.FC<StackedBarGraphProps> = ({
} }
); );
if (data?.getWorkflowRuns.workflow_runs) { if (data?.listWorkflowRuns.workflowRuns) {
data.getWorkflowRuns.workflow_runs.forEach((wfrun) => { data.listWorkflowRuns.workflowRuns.forEach((wfrun) => {
if (wfrun.phase !== 'Running') { if (wfrun.phase !== 'Running') {
stackBarData.push({ stackBarData.push({
id: wfrun.workflow_run_id, id: wfrun.workflowRunID,
date: Number(wfrun.last_updated) * 1000, date: Number(wfrun.lastUpdated) * 1000,
passPercentage: passPercentage:
wfrun.total_experiments && wfrun.totalExperiments &&
wfrun.experiments_passed && wfrun.experimentsPassed &&
wfrun.total_experiments > 0 wfrun.totalExperiments > 0
? (wfrun.experiments_passed * 100) / wfrun.total_experiments ? (wfrun.experimentsPassed * 100) / wfrun.totalExperiments
: 0, : 0,
failPercentage: failPercentage:
wfrun.total_experiments && wfrun.totalExperiments &&
!wfrun.experiments_failed && !wfrun.experimentsFailed &&
wfrun.total_experiments > 0 wfrun.totalExperiments > 0
? (wfrun.experiments_failed * 100) / wfrun.total_experiments ? (wfrun.experimentsFailed * 100) / wfrun.totalExperiments
: 0, : 0,
passCount: wfrun.experiments_passed ?? 0, passCount: wfrun.experimentsPassed ?? 0,
failCount: wfrun.experiments_failed ?? 0, failCount: wfrun.experimentsFailed ?? 0,
}); });
openSeries.data.push({ openSeries.data.push({
date: Number(wfrun.last_updated) * 1000, date: Number(wfrun.lastUpdated) * 1000,
value: wfrun.resiliency_score ?? 0, value: wfrun.resiliencyScore ?? 0,
}); });
} }
}); });
@ -220,8 +220,8 @@ const StackedBarGraph: React.FC<StackedBarGraphProps> = ({
</div> </div>
{showTable && ( {showTable && (
<WorkflowRunTable <WorkflowRunTable
workflowId={workflowID} workflowID={workflowID}
workflowRunId={workflowRunID} workflowRunID={workflowRunID}
/> />
)} )}
</div> </div>

View File

@ -14,16 +14,16 @@ import React, { useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import Loader from '../../../components/Loader'; import Loader from '../../../components/Loader';
import Center from '../../../containers/layouts/Center'; import Center from '../../../containers/layouts/Center';
import { WORKFLOW_LIST_DETAILS, WORKFLOW_RUN_DETAILS } from '../../../graphql'; import { GET_WORKFLOW_DETAILS, WORKFLOW_RUN_DETAILS } from '../../../graphql';
import { import {
ExecutionData, ExecutionData,
Pagination, Pagination,
Workflow, Workflow,
WorkflowDataVars, WorkflowDataRequest,
WorkflowRunFilterInput, WorkflowRunFilterRequest,
} from '../../../models/graphql/workflowData'; } from '../../../models/graphql/workflowData';
import { import {
ListWorkflowsInput, GetWorkflowsRequest,
ScheduledWorkflows, ScheduledWorkflows,
WeightageMap, WeightageMap,
} from '../../../models/graphql/workflowListData'; } from '../../../models/graphql/workflowListData';
@ -60,13 +60,13 @@ interface WorkFlowTests {
} }
interface WorkflowRunTableProps { interface WorkflowRunTableProps {
workflowId: string; workflowID: string;
workflowRunId: string; workflowRunID: string;
} }
const WorkflowRunTable: React.FC<WorkflowRunTableProps> = ({ const WorkflowRunTable: React.FC<WorkflowRunTableProps> = ({
workflowId, workflowID,
workflowRunId, workflowRunID,
}) => { }) => {
// get ProjectID // get ProjectID
const projectID = getProjectID(); const projectID = getProjectID();
@ -75,12 +75,12 @@ const WorkflowRunTable: React.FC<WorkflowRunTableProps> = ({
const [wfRunData, setWfRunData] = React.useState<WorkFlowTests[]>([]); const [wfRunData, setWfRunData] = React.useState<WorkFlowTests[]>([]);
const [dateRange, setDateRange] = React.useState<WorkflowRunFilterInput>({ const [dateRange, setDateRange] = React.useState<WorkflowRunFilterRequest>({
workflow_name: '', workflowName: '',
cluster_name: 'All', clusterName: 'All',
workflow_status: 'All', workflowStatus: 'All',
date_range: { dateRange: {
start_date: new Date(0).valueOf().toString(), startDate: new Date(0).valueOf().toString(),
}, },
}); });
@ -142,21 +142,21 @@ const WorkflowRunTable: React.FC<WorkflowRunTableProps> = ({
data: weightageDetail, data: weightageDetail,
loading: loadWeightage, loading: loadWeightage,
error: errorWeightage, error: errorWeightage,
} = useQuery<ScheduledWorkflows, ListWorkflowsInput>(WORKFLOW_LIST_DETAILS, { } = useQuery<ScheduledWorkflows, GetWorkflowsRequest>(GET_WORKFLOW_DETAILS, {
variables: { variables: {
workflowInput: { project_id: projectID, workflow_ids: [workflowId] }, request: { projectID, workflowIDs: [workflowID] },
}, },
}); });
const { loading: loadWfRun, error: errorWfRun } = useQuery< const { loading: loadWfRun, error: errorWfRun } = useQuery<
Workflow, Workflow,
WorkflowDataVars WorkflowDataRequest
>(WORKFLOW_RUN_DETAILS, { >(WORKFLOW_RUN_DETAILS, {
variables: { variables: {
workflowRunsInput: { request: {
project_id: projectID, projectID,
workflow_ids: [workflowId], workflowIDs: [workflowID],
workflow_run_ids: [workflowRunId], workflowRunIDs: [workflowRunID],
pagination: { pagination: {
page: paginationData.page, page: paginationData.page,
limit: paginationData.limit, limit: paginationData.limit,
@ -166,9 +166,9 @@ const WorkflowRunTable: React.FC<WorkflowRunTableProps> = ({
}, },
onCompleted: (data) => { onCompleted: (data) => {
const workflowTestsArray: WorkFlowTests[] = []; const workflowTestsArray: WorkFlowTests[] = [];
if (data.getWorkflowRuns.workflow_runs.length > 0) { if (data.listWorkflowRuns.workflowRuns) {
const executionData: ExecutionData = JSON.parse( const executionData: ExecutionData = JSON.parse(
data?.getWorkflowRuns?.workflow_runs[0]?.execution_data data.listWorkflowRuns.workflowRuns[0].executionData
); );
const { nodes } = executionData; const { nodes } = executionData;
let index: number = 1; let index: number = 1;
@ -178,11 +178,11 @@ const WorkflowRunTable: React.FC<WorkflowRunTableProps> = ({
if (node.chaosData) { if (node.chaosData) {
const { chaosData } = node; const { chaosData } = node;
const weightageMap: WeightageMap[] = weightageDetail const weightageMap: WeightageMap[] = weightageDetail
? weightageDetail?.ListWorkflow.workflows[0]?.weightages ? weightageDetail?.listWorkflows.workflows[0]?.weightages
: []; : [];
/* eslint-disable no-loop-func */ /* eslint-disable no-loop-func */
weightageMap.forEach((weightage) => { weightageMap.forEach((weightage) => {
if (weightage.experiment_name === node.name) { if (weightage.experimentName === node.name) {
workflowTestsArray.push({ workflowTestsArray.push({
test_id: index, test_id: index,
test_name: node.name, test_name: node.name,
@ -274,12 +274,12 @@ const WorkflowRunTable: React.FC<WorkflowRunTableProps> = ({
// Change filter value for date range // Change filter value for date range
setDateRange({ setDateRange({
...dateRange, ...dateRange,
date_range: { dateRange: {
start_date: new Date(selectStartDate) startDate: new Date(selectStartDate)
.setHours(0, 0, 0) .setHours(0, 0, 0)
.valueOf() .valueOf()
.toString(), .toString(),
end_date: new Date(selectEndDate) endDate: new Date(selectEndDate)
.setHours(23, 59, 59) .setHours(23, 59, 59)
.valueOf() .valueOf()
.toString(), .toString(),

View File

@ -22,15 +22,18 @@ import BackButton from '../../components/Button/BackButton';
import Loader from '../../components/Loader'; import Loader from '../../components/Loader';
import Center from '../../containers/layouts/Center'; import Center from '../../containers/layouts/Center';
import Wrapper from '../../containers/layouts/Wrapper'; import Wrapper from '../../containers/layouts/Wrapper';
import { WORKFLOW_LIST_DETAILS } from '../../graphql/queries';
import { import {
GET_WORKFLOW_DETAILS,
WORKFLOW_RUN_DETAILS,
} from '../../graphql/queries';
import {
HeatmapDataRequest,
HeatmapDataResponse, HeatmapDataResponse,
HeatmapDataVars,
Workflow, Workflow,
WorkflowDataVars, WorkflowDataRequest,
} from '../../models/graphql/workflowData'; } from '../../models/graphql/workflowData';
import { import {
ListWorkflowsInput, GetWorkflowsRequest,
ScheduledWorkflows, ScheduledWorkflows,
} from '../../models/graphql/workflowListData'; } from '../../models/graphql/workflowListData';
import { history } from '../../redux/configureStore'; import { history } from '../../redux/configureStore';
@ -55,9 +58,9 @@ const TestCalendarHeatmapTooltip = ({
{tooltipData?.data?.bin?.bin.value ?? 0}% Average Resiliency {tooltipData?.data?.bin?.bin.value ?? 0}% Average Resiliency
</div> </div>
<div> <div>
{tooltipData?.data?.bin?.bin.workflowRunDetail.no_of_runs ?? 0}{' '} {tooltipData?.data?.bin?.bin.workflowRunDetail.noOfRuns ?? 0} completed
completed runs on{' '} runs on{' '}
{formatDate(tooltipData?.data?.bin?.bin.workflowRunDetail.date_stamp) ?? {formatDate(tooltipData?.data?.bin?.bin.workflowRunDetail.dateStamp) ??
''} ''}
</div> </div>
</div> </div>
@ -65,7 +68,7 @@ const TestCalendarHeatmapTooltip = ({
}; };
interface URLParams { interface URLParams {
workflowId: string; workflowID: string;
} }
const valueThreshold = [13, 26, 39, 49, 59, 69, 79, 89, 100]; const valueThreshold = [13, 26, 39, 49, 59, 69, 79, 89, 100];
@ -76,44 +79,36 @@ const WorkflowInfoStats: React.FC = () => {
const { t } = useTranslation(); const { t } = useTranslation();
const theme = useTheme(); const theme = useTheme();
const { workflowId }: URLParams = useParams(); const { workflowID }: URLParams = useParams();
// Keep track of whether workflow has run or not // Keep track of whether workflow has run or not
const [hasWorkflowRun, setHasWorkflowRun] = useState<boolean>(true); const [hasWorkflowRun, setHasWorkflowRun] = useState<boolean>(true);
// Apollo query to get the scheduled workflow data // Apollo query to get the scheduled workflow data
const { data } = useQuery<ScheduledWorkflows, ListWorkflowsInput>( const { data } = useQuery<ScheduledWorkflows, GetWorkflowsRequest>(
WORKFLOW_LIST_DETAILS, GET_WORKFLOW_DETAILS,
{ {
variables: { variables: {
workflowInput: { project_id: projectID, workflow_ids: [workflowId] }, request: { projectID, workflowIDs: [workflowID] },
}, },
fetchPolicy: 'cache-and-network', fetchPolicy: 'cache-and-network',
} }
); );
const { data: workflowRunData } = useQuery<Workflow, WorkflowDataVars>( // TODO: shift out
gql` const { data: workflowRunData } = useQuery<Workflow, WorkflowDataRequest>(
query workflowDetails($workflowRunsInput: GetWorkflowRunsInput!) { WORKFLOW_RUN_DETAILS,
getWorkflowRuns(workflowRunsInput: $workflowRunsInput) {
total_no_of_workflow_runs
workflow_runs {
workflow_run_id
}
}
}
`,
{ {
variables: { variables: {
workflowRunsInput: { request: {
project_id: projectID, projectID,
workflow_ids: [workflowId], workflowIDs: [workflowID],
}, },
}, },
onCompleted: () => { onCompleted: () => {
setHasWorkflowRun( setHasWorkflowRun(
workflowRunData !== undefined && workflowRunData !== undefined &&
workflowRunData.getWorkflowRuns.total_no_of_workflow_runs > 0 workflowRunData.listWorkflowRuns.totalNoOfWorkflowRuns > 0
); );
}, },
fetchPolicy: 'cache-and-network', fetchPolicy: 'cache-and-network',
@ -121,7 +116,7 @@ const WorkflowInfoStats: React.FC = () => {
); );
const workflowRunID = const workflowRunID =
workflowRunData?.getWorkflowRuns?.workflow_runs[0]?.workflow_run_id ?? ''; workflowRunData?.listWorkflowRuns?.workflowRuns[0]?.workflowRunID ?? '';
const presentYear = new Date().getFullYear(); const presentYear = new Date().getFullYear();
const [showTable, setShowTable] = useState<boolean>(false); const [showTable, setShowTable] = useState<boolean>(false);
@ -136,27 +131,28 @@ const WorkflowInfoStats: React.FC = () => {
setShowTable(false); setShowTable(false);
}; };
// TODO: shift out
// Apollo query to get the heatmap data // Apollo query to get the heatmap data
const { data: heatmapData, loading } = useQuery< const { data: heatmapData, loading } = useQuery<
HeatmapDataResponse, HeatmapDataResponse,
HeatmapDataVars HeatmapDataRequest
>( >(
gql` gql`
query getHeatmapData( query listHeatmapData(
$project_id: String! $projectID: String!
$workflow_id: String! $workflowID: String!
$year: Int! $year: Int!
) { ) {
getHeatmapData( listHeatmapData(
project_id: $project_id projectID: $projectID
workflow_id: $workflow_id workflowID: $workflowID
year: $year year: $year
) { ) {
bins { bins {
value value
workflowRunDetail { workflowRunDetail {
no_of_runs noOfRuns
date_stamp dateStamp
} }
} }
} }
@ -164,8 +160,8 @@ const WorkflowInfoStats: React.FC = () => {
`, `,
{ {
variables: { variables: {
project_id: projectID, projectID,
workflow_id: workflowId, workflowID,
year, year,
}, },
fetchPolicy: 'cache-and-network', fetchPolicy: 'cache-and-network',
@ -215,7 +211,7 @@ const WorkflowInfoStats: React.FC = () => {
<div className={classes.headingSection}> <div className={classes.headingSection}>
<div className={classes.pageHeading}> <div className={classes.pageHeading}>
<Typography className={classes.heading} data-cy="statsWorkflowName"> <Typography className={classes.heading} data-cy="statsWorkflowName">
{data?.ListWorkflow.workflows[0].workflow_name} {data?.listWorkflows.workflows[0].workflowName}
</Typography> </Typography>
<Typography className={classes.subHeading}> <Typography className={classes.subHeading}>
Heres the statistics of the selected workflow Heres the statistics of the selected workflow
@ -232,16 +228,16 @@ const WorkflowInfoStats: React.FC = () => {
<InfoSection <InfoSection
data={data} data={data}
workflowRunLength={ workflowRunLength={
workflowRunData.getWorkflowRuns.total_no_of_workflow_runs workflowRunData.listWorkflowRuns.totalNoOfWorkflowRuns
} }
/> />
)} )}
{/* Visulization Area */} {/* Visulization Area */}
{/* Check for cron workflow OR single workflow which has been re-run */} {/* Check for cron workflow OR single workflow which has been re-run */}
{data?.ListWorkflow.workflows[0].cronSyntax !== '' || {data?.listWorkflows.workflows[0].cronSyntax !== '' ||
(workflowRunData?.getWorkflowRuns.total_no_of_workflow_runs && (workflowRunData?.listWorkflowRuns.totalNoOfWorkflowRuns &&
workflowRunData?.getWorkflowRuns.total_no_of_workflow_runs > 1) ? ( workflowRunData?.listWorkflowRuns.totalNoOfWorkflowRuns > 1) ? (
<div className={classes.heatmapArea}> <div className={classes.heatmapArea}>
<div className={classes.heatmapAreaHeading}> <div className={classes.heatmapAreaHeading}>
<Typography className={classes.sectionHeading}> <Typography className={classes.sectionHeading}>
@ -253,7 +249,7 @@ const WorkflowInfoStats: React.FC = () => {
<div className={classes.formControlParent}> <div className={classes.formControlParent}>
<Typography> <Typography>
Total runs till date:{' '} Total runs till date:{' '}
{workflowRunData?.getWorkflowRuns.total_no_of_workflow_runs} {workflowRunData?.listWorkflowRuns.totalNoOfWorkflowRuns}
</Typography> </Typography>
<FormControl <FormControl
className={classes.formControl} className={classes.formControl}
@ -285,12 +281,12 @@ const WorkflowInfoStats: React.FC = () => {
) : ( ) : (
<div className={classes.heatmapParent} data-cy="statsHeatMap"> <div className={classes.heatmapParent} data-cy="statsHeatMap">
<CalendarHeatmap <CalendarHeatmap
calendarHeatmapMetric={heatmapData?.getHeatmapData ?? []} calendarHeatmapMetric={heatmapData?.listHeatmapData ?? []}
valueThreshold={valueThreshold} valueThreshold={valueThreshold}
CalendarHeatmapTooltip={TestCalendarHeatmapTooltip} CalendarHeatmapTooltip={TestCalendarHeatmapTooltip}
handleBinClick={(bin: any) => { handleBinClick={(bin: any) => {
if (bin) { if (bin) {
if (bin?.bin?.workflowRunDetail.no_of_runs === 0) { if (bin?.bin?.workflowRunDetail.noOfRuns === 0) {
setDataCheck(true); setDataCheck(true);
setShowStackBar(false); setShowStackBar(false);
handleTableClose(); handleTableClose();
@ -299,7 +295,7 @@ const WorkflowInfoStats: React.FC = () => {
handleTableClose(); handleTableClose();
setBinResiliencyScore(bin.bin.value); setBinResiliencyScore(bin.bin.value);
setWorkflowRunDate( setWorkflowRunDate(
bin.bin.workflowRunDetail.date_stamp bin.bin.workflowRunDetail.dateStamp
); );
} }
} else { } else {
@ -329,7 +325,7 @@ const WorkflowInfoStats: React.FC = () => {
<StackedBarGraph <StackedBarGraph
date={workflowRunDate} date={workflowRunDate}
averageResiliency={binResiliencyScore} averageResiliency={binResiliencyScore}
workflowID={workflowId} workflowID={workflowID}
handleTableOpen={handleTableOpen} handleTableOpen={handleTableOpen}
handleTableClose={handleTableClose} handleTableClose={handleTableClose}
showTable={showTable} showTable={showTable}
@ -345,8 +341,8 @@ const WorkflowInfoStats: React.FC = () => {
</div> </div>
) : ( ) : (
<WorkflowRunTable <WorkflowRunTable
workflowId={workflowId} workflowID={workflowID}
workflowRunId={workflowRunID} workflowRunID={workflowRunID}
/> />
)} )}
</Wrapper> </Wrapper>

View File

@ -1,24 +1,24 @@
import { import {
HubDetails,
MyHubAction, MyHubAction,
MyHubActions, MyHubActions,
HubDetails,
} from '../../models/redux/myhub'; } from '../../models/redux/myhub';
import createReducer from './createReducer'; import createReducer from './createReducer';
const initialState: HubDetails = { const initialState: HubDetails = {
id: '', id: '',
HubName: '', hubName: '',
RepoURL: '', repoURL: '',
RepoBranch: '', repoBranch: '',
TotalExp: '', totalExp: '',
IsAvailable: true, isAvailable: true,
IsPrivate: false, isPrivate: false,
Token: '', token: '',
UserName: '', userName: '',
Password: '', password: '',
SSHPrivateKey: '', sshPrivateKey: '',
SSHPublicKey: '', sshPublicKey: '',
LastSyncedAt: '', lastSyncedAt: '',
}; };
export const hubDetails = createReducer<HubDetails>(initialState, { export const hubDetails = createReducer<HubDetails>(initialState, {

View File

@ -10,7 +10,7 @@ const initialState: SelectedNode = {
finishedAt: '', finishedAt: '',
message: '', message: '',
name: '', name: '',
pod_name: '', podName: '',
phase: '', phase: '',
startedAt: '', startedAt: '',
type: '', type: '',

View File

@ -9,7 +9,7 @@ import createReducer from './createReducer';
const initialState: WorkflowData = { const initialState: WorkflowData = {
chaosEngineChanged: false, chaosEngineChanged: false,
namespace: '', namespace: '',
clusterid: '', clusterID: '',
cronSyntax: '', cronSyntax: '',
scheduleType: { scheduleType: {
scheduleOnce: 'now', scheduleOnce: 'now',
@ -22,7 +22,7 @@ const initialState: WorkflowData = {
time: new Date(), time: new Date(),
date: new Date(), date: new Date(),
}, },
clustername: '', clusterName: '',
}; };
const init: WorkflowManifest = { const init: WorkflowManifest = {

View File

@ -1,3 +1,4 @@
/* eslint-disable no-unused-expressions */
import { import {
ParsedChaosEventPrometheusData, ParsedChaosEventPrometheusData,
ParsedMetricPrometheusData, ParsedMetricPrometheusData,
@ -46,12 +47,12 @@ export const getDashboardQueryMap = (panelGroups: PanelGroupResponse[]) => {
const queryMapPanel: queryMapForPanel[] = []; const queryMapPanel: queryMapForPanel[] = [];
panelGroup.panels.forEach((panel) => { panelGroup.panels.forEach((panel) => {
queryMapPanel.push({ queryMapPanel.push({
panelID: panel.panel_id, panelID: panel.panelID,
queryIDs: panel.prom_queries.map((query) => query.queryid), queryIDs: panel.promQueries.map((query) => query.queryID),
}); });
}); });
queryMapPanelGroup.push({ queryMapPanelGroup.push({
panelGroupID: panelGroup.panel_group_id, panelGroupID: panelGroup.panelGroupID,
panelQueryMap: queryMapPanel, panelQueryMap: queryMapPanel,
}); });
}); });
@ -91,8 +92,8 @@ export const getPromQueryInput = (
const promQueries: promQueryInput[] = []; const promQueries: promQueryInput[] = [];
prom_queries.forEach((query: PromQueryDetails) => { prom_queries.forEach((query: PromQueryDetails) => {
promQueries.push({ promQueries.push({
queryid: query.queryid, queryID: query.queryID,
query: query.prom_query_name, query: query.promQueryName,
legend: query.legend, legend: query.legend,
resolution: query.resolution, resolution: query.resolution,
minstep: minstep:
@ -104,7 +105,7 @@ export const getPromQueryInput = (
}); });
if (withEvents && eventQueryTemplate && verdictQueryTemplate) { if (withEvents && eventQueryTemplate && verdictQueryTemplate) {
promQueries.push({ promQueries.push({
queryid: DEFAULT_CHAOS_EVENT_QUERY_ID, queryID: DEFAULT_CHAOS_EVENT_QUERY_ID,
query: eventQueryTemplate, query: eventQueryTemplate,
legend: DEFAULT_CHAOS_EVENT_AND_VERDICT_PROMETHEUS_QUERY_LEGEND, legend: DEFAULT_CHAOS_EVENT_AND_VERDICT_PROMETHEUS_QUERY_LEGEND,
resolution: DEFAULT_CHAOS_EVENT_AND_VERDICT_PROMETHEUS_QUERY_RESOLUTION, resolution: DEFAULT_CHAOS_EVENT_AND_VERDICT_PROMETHEUS_QUERY_RESOLUTION,
@ -118,7 +119,7 @@ export const getPromQueryInput = (
), ),
}); });
promQueries.push({ promQueries.push({
queryid: DEFAULT_CHAOS_VERDICT_QUERY_ID, queryID: DEFAULT_CHAOS_VERDICT_QUERY_ID,
query: verdictQueryTemplate, query: verdictQueryTemplate,
legend: DEFAULT_CHAOS_EVENT_AND_VERDICT_PROMETHEUS_QUERY_LEGEND, legend: DEFAULT_CHAOS_EVENT_AND_VERDICT_PROMETHEUS_QUERY_LEGEND,
resolution: DEFAULT_CHAOS_EVENT_AND_VERDICT_PROMETHEUS_QUERY_RESOLUTION, resolution: DEFAULT_CHAOS_EVENT_AND_VERDICT_PROMETHEUS_QUERY_RESOLUTION,
@ -148,7 +149,7 @@ export const generatePromQueries = (
const promQueries: promQueryInput[] = getPromQueryInput( const promQueries: promQueryInput[] = getPromQueryInput(
dashboardMetaPanelGroups dashboardMetaPanelGroups
.flatMap((panelGroup) => (panelGroup ? panelGroup.panels ?? [] : [])) .flatMap((panelGroup) => (panelGroup ? panelGroup.panels ?? [] : []))
.flatMap((panel) => (panel ? panel.prom_queries ?? [] : [])), .flatMap((panel) => (panel ? panel.promQueries ?? [] : [])),
timeRangeDiff, timeRangeDiff,
true, true,
chaosEventQueryTemplate, chaosEventQueryTemplate,
@ -168,7 +169,7 @@ export const MetricDataParserForPrometheus = (
seriesData: [], seriesData: [],
closedAreaData: [], closedAreaData: [],
}; };
metricData.forEach((queryResponse, mainIndex) => { metricData?.forEach((queryResponse, mainIndex) => {
if (queryResponse && queryResponse.legends && queryResponse.tsvs) { if (queryResponse && queryResponse.legends && queryResponse.tsvs) {
let { legends } = queryResponse; let { legends } = queryResponse;
let { tsvs } = queryResponse; let { tsvs } = queryResponse;
@ -300,7 +301,7 @@ export const DashboardMetricDataParserForPrometheus = (
selectedApplications?: string[] selectedApplications?: string[]
) => { ) => {
const mappedData: QueryMapForPanelGroup[] = []; const mappedData: QueryMapForPanelGroup[] = [];
metricData.forEach((panelGroupData, panelGroupIndex) => { metricData?.forEach((panelGroupData, panelGroupIndex) => {
mappedData.push({ mappedData.push({
panelGroupID: panelGroupData.panelGroupID, panelGroupID: panelGroupData.panelGroupID,
metricDataForGroup: [], metricDataForGroup: [],

View File

@ -47,11 +47,11 @@ const SaveTemplateModal: React.FC<SaveTemplateModalProps> = ({
ADD_WORKFLOW_TEMPLATE, ADD_WORKFLOW_TEMPLATE,
{ {
variables: { variables: {
data: { request: {
manifest: editManifest, manifest: editManifest,
template_name: templateName, templateName,
template_description: templateDesc, templateDescription: templateDesc,
project_id: getProjectID(), projectID: getProjectID(),
isCustomWorkflow, isCustomWorkflow,
}, },
}, },

View File

@ -134,7 +134,7 @@ const TableData: React.FC<TableDataProps> = ({
const editSchedule = () => { const editSchedule = () => {
history.push({ history.push({
pathname: `/workflows/schedule/${data.project_id}/${data.workflow_name}`, pathname: `/workflows/schedule/${data.projectID}/${data.workflowName}`,
search: `?projectID=${projectID}&projectRole=${projectRole}`, search: `?projectID=${projectID}&projectRole=${projectRole}`,
}); });
}; };
@ -153,7 +153,7 @@ const TableData: React.FC<TableDataProps> = ({
reRunChaosWorkFlow({ reRunChaosWorkFlow({
variables: { variables: {
projectID: getProjectID(), projectID: getProjectID(),
data: data.workflow_id, workflowID: data.workflowID,
}, },
}); });
}; };
@ -201,12 +201,12 @@ const TableData: React.FC<TableDataProps> = ({
<Typography> <Typography>
<span <span
className={`${classes.boldText} ${ className={`${classes.boldText} ${
YAML.parse(data.workflow_manifest).spec.suspend === true YAML.parse(data.workflowManifest).spec.suspend === true
? classes.dark ? classes.dark
: '' : ''
}`} }`}
> >
{data.workflow_name} {data.workflowName}
</span> </span>
</Typography> </Typography>
</TableCell> </TableCell>
@ -214,18 +214,18 @@ const TableData: React.FC<TableDataProps> = ({
<Typography className={classes.clusterData}> <Typography className={classes.clusterData}>
<span <span
className={ className={
YAML.parse(data.workflow_manifest).spec.suspend === true YAML.parse(data.workflowManifest).spec.suspend === true
? classes.dark ? classes.dark
: '' : ''
} }
> >
{data.cluster_name} {data.clusterName}
</span> </span>
</Typography> </Typography>
</TableCell> </TableCell>
<TableCell> <TableCell>
<Typography className={classes.clusterData}> <Typography className={classes.clusterData}>
<span>{data.last_updated_by || '-'}</span> <span>{data.lastUpdatedBy || '-'}</span>
</Typography> </Typography>
</TableCell> </TableCell>
<TableCell> <TableCell>
@ -235,7 +235,7 @@ const TableData: React.FC<TableDataProps> = ({
> >
<span <span
className={ className={
YAML.parse(data.workflow_manifest).spec.suspend === true YAML.parse(data.workflowManifest).spec.suspend === true
? classes.dark ? classes.dark
: '' : ''
} }
@ -265,9 +265,9 @@ const TableData: React.FC<TableDataProps> = ({
<div className={classes.weightDiv}> <div className={classes.weightDiv}>
{data.weightages.map((expData) => { {data.weightages.map((expData) => {
return ( return (
<div key={expData.experiment_name} style={{ marginBottom: 8 }}> <div key={expData.experimentName} style={{ marginBottom: 8 }}>
<ExperimentPoints <ExperimentPoints
expName={expData.experiment_name} expName={expData.experimentName}
weight={expData.weightage} weight={expData.weightage}
/> />
</div> </div>
@ -283,7 +283,7 @@ const TableData: React.FC<TableDataProps> = ({
> >
<span <span
className={ className={
YAML.parse(data.workflow_manifest).spec.suspend === true YAML.parse(data.workflowManifest).spec.suspend === true
? classes.dark ? classes.dark
: '' : ''
} }
@ -320,7 +320,7 @@ const TableData: React.FC<TableDataProps> = ({
{t('chaosWorkflows.browseSchedules.startingDate')} : {t('chaosWorkflows.browseSchedules.startingDate')} :
</span> </span>
<span className={classes.scheduleDetailsValue}> <span className={classes.scheduleDetailsValue}>
{formatDate(data.created_at)} {formatDate(data.createdAt)}
</span> </span>
</Typography> </Typography>
<Typography className={classes.scheduleDetailsFlex}> <Typography className={classes.scheduleDetailsFlex}>
@ -328,7 +328,7 @@ const TableData: React.FC<TableDataProps> = ({
{t('chaosWorkflows.browseSchedules.lastUpdated')} : {t('chaosWorkflows.browseSchedules.lastUpdated')} :
</span> </span>
<span className={classes.scheduleDetailsValue}> <span className={classes.scheduleDetailsValue}>
{timeDifferenceForDate(data.updated_at)} {timeDifferenceForDate(data.updatedAt)}
</span> </span>
</Typography> </Typography>
<Typography className={classes.scheduleDetailsFlex}> <Typography className={classes.scheduleDetailsFlex}>
@ -347,12 +347,12 @@ const TableData: React.FC<TableDataProps> = ({
<TableCell> <TableCell>
<span <span
className={ className={
YAML.parse(data.workflow_manifest).spec.suspend === true YAML.parse(data.workflowManifest).spec.suspend === true
? classes.dark ? classes.dark
: '' : ''
} }
> >
{YAML.parse(data.workflow_manifest).spec.suspend === true ? ( {YAML.parse(data.workflowManifest).spec.suspend === true ? (
<Typography> <Typography>
{t('chaosWorkflows.browseSchedules.scheduleIsDisabled')} {t('chaosWorkflows.browseSchedules.scheduleIsDisabled')}
</Typography> </Typography>
@ -374,7 +374,7 @@ const TableData: React.FC<TableDataProps> = ({
<IconButton <IconButton
onClick={() => { onClick={() => {
tabs.changeWorkflowsTabs(0); tabs.changeWorkflowsTabs(0);
setWorkflowName(data.workflow_name); setWorkflowName(data.workflowName);
}} }}
data-cy="showSchedules" data-cy="showSchedules"
> >
@ -450,7 +450,7 @@ const TableData: React.FC<TableDataProps> = ({
</Snackbar> </Snackbar>
{projectRole !== 'Viewer' && {projectRole !== 'Viewer' &&
data.cronSyntax !== '' && data.cronSyntax !== '' &&
YAML.parse(data.workflow_manifest).spec.suspend !== true && ( YAML.parse(data.workflowManifest).spec.suspend !== true && (
<MenuItem <MenuItem
value="Disable" value="Disable"
onClick={() => { onClick={() => {
@ -474,7 +474,7 @@ const TableData: React.FC<TableDataProps> = ({
)} )}
{projectRole !== 'Viewer' && {projectRole !== 'Viewer' &&
YAML.parse(data.workflow_manifest).spec.suspend === true && ( YAML.parse(data.workflowManifest).spec.suspend === true && (
<MenuItem <MenuItem
value="Enable" value="Enable"
onClick={() => { onClick={() => {
@ -499,7 +499,7 @@ const TableData: React.FC<TableDataProps> = ({
<MenuItem <MenuItem
value="Download" value="Download"
onClick={() => onClick={() =>
downloadYAML(data.workflow_manifest, data.workflow_name) downloadYAML(data.workflowManifest, data.workflowName)
} }
> >
<div className={classes.expDiv}> <div className={classes.expDiv}>
@ -515,7 +515,7 @@ const TableData: React.FC<TableDataProps> = ({
<MenuItem <MenuItem
value="SaveTemplate" value="SaveTemplate"
data-cy="saveTemplate" data-cy="saveTemplate"
onClick={() => handleSaveWorkflowTemplate(data.workflow_manifest)} onClick={() => handleSaveWorkflowTemplate(data.workflowManifest)}
> >
<div className={classes.expDiv}> <div className={classes.expDiv}>
<InsertDriveFileOutlined className={classes.downloadBtn} /> <InsertDriveFileOutlined className={classes.downloadBtn} />
@ -570,7 +570,7 @@ const TableData: React.FC<TableDataProps> = ({
variant="error" variant="error"
className={classes.w7} className={classes.w7}
onClick={() => { onClick={() => {
deleteRow(data.workflow_id); deleteRow(data.workflowID);
setIsModalOpen(false); setIsModalOpen(false);
}} }}
> >

View File

@ -27,19 +27,19 @@ import Loader from '../../../components/Loader';
import { import {
DELETE_WORKFLOW, DELETE_WORKFLOW,
GET_CLUSTER_NAMES, GET_CLUSTER_NAMES,
GET_WORKFLOW_DETAILS,
UPDATE_SCHEDULE, UPDATE_SCHEDULE,
WORKFLOW_LIST_DETAILS,
} from '../../../graphql'; } from '../../../graphql';
import { Clusters, ClusterVars } from '../../../models/graphql/clusterData'; import { ClusterRequest, Clusters } from '../../../models/graphql/clusterData';
import { WeightMap } from '../../../models/graphql/createWorkflowData'; import { WeightMap } from '../../../models/graphql/createWorkflowData';
import { DeleteSchedule } from '../../../models/graphql/scheduleData'; import { DeleteSchedule } from '../../../models/graphql/scheduleData';
import { import {
ListWorkflowsInput, GetWorkflowsRequest,
Pagination, Pagination,
ScheduledWorkflow, ScheduledWorkflow,
ScheduledWorkflows, ScheduledWorkflows,
SortInput, SortRequest,
WorkflowFilterInput, WorkflowFilterRequest,
} from '../../../models/graphql/workflowListData'; } from '../../../models/graphql/workflowListData';
import { getProjectID } from '../../../utils/getSearchParams'; import { getProjectID } from '../../../utils/getSearchParams';
import useStyles from './styles'; import useStyles from './styles';
@ -49,9 +49,9 @@ interface BrowseScheduleProps {
setWorkflowName: React.Dispatch<React.SetStateAction<string>>; setWorkflowName: React.Dispatch<React.SetStateAction<string>>;
} }
interface FilterOption extends WorkflowFilterInput { interface FilterOption extends WorkflowFilterRequest {
suspended?: string; suspended?: string;
workflow_type?: string; workflowType?: string;
} }
const BrowseSchedule: React.FC<BrowseScheduleProps> = ({ setWorkflowName }) => { const BrowseSchedule: React.FC<BrowseScheduleProps> = ({ setWorkflowName }) => {
@ -67,34 +67,34 @@ const BrowseSchedule: React.FC<BrowseScheduleProps> = ({ setWorkflowName }) => {
// States for filters // States for filters
const [filters, setFilters] = useState<FilterOption>({ const [filters, setFilters] = useState<FilterOption>({
workflow_name: '', workflowName: '',
cluster_name: 'All', clusterName: 'All',
suspended: 'All', suspended: 'All',
workflow_type: 'All', workflowType: 'All',
}); });
// State for sorting // State for sorting
const [sortData, setSortData] = useState<SortInput>({ const [sortData, setSortData] = useState<SortRequest>({
field: 'Time', field: 'TIME',
descending: true, descending: true,
}); });
// Apollo query to get the scheduled data // Apollo query to get the scheduled data
const { data, refetch, loading, error } = useQuery< const { data, refetch, loading, error } = useQuery<
ScheduledWorkflows, ScheduledWorkflows,
ListWorkflowsInput GetWorkflowsRequest
>(WORKFLOW_LIST_DETAILS, { >(GET_WORKFLOW_DETAILS, {
variables: { variables: {
workflowInput: { request: {
project_id: projectID, projectID,
pagination: { pagination: {
page: paginationData.page, page: paginationData.page,
limit: paginationData.limit, limit: paginationData.limit,
}, },
sort: sortData, sort: sortData,
filter: { filter: {
workflow_name: filters.workflow_name, workflowName: filters.workflowName,
cluster_name: filters.cluster_name, clusterName: filters.clusterName,
}, },
}, },
}, },
@ -114,7 +114,7 @@ const BrowseSchedule: React.FC<BrowseScheduleProps> = ({ setWorkflowName }) => {
// Disable and re-enable a schedule // Disable and re-enable a schedule
const handleToggleSchedule = (schedule: ScheduledWorkflow) => { const handleToggleSchedule = (schedule: ScheduledWorkflow) => {
const yaml = YAML.parse(schedule.workflow_manifest); const yaml = YAML.parse(schedule.workflowManifest);
if (yaml.spec.suspend === undefined || yaml.spec.suspend === false) { if (yaml.spec.suspend === undefined || yaml.spec.suspend === false) {
yaml.spec.suspend = true; yaml.spec.suspend = true;
} else { } else {
@ -125,7 +125,7 @@ const BrowseSchedule: React.FC<BrowseScheduleProps> = ({ setWorkflowName }) => {
schedule.weightages.forEach((weightEntry) => { schedule.weightages.forEach((weightEntry) => {
weightData.push({ weightData.push({
experiment_name: weightEntry.experiment_name, experimentName: weightEntry.experimentName,
weightage: weightEntry.weightage, weightage: weightEntry.weightage,
}); });
}); });
@ -133,14 +133,14 @@ const BrowseSchedule: React.FC<BrowseScheduleProps> = ({ setWorkflowName }) => {
updateSchedule({ updateSchedule({
variables: { variables: {
ChaosWorkFlowInput: { ChaosWorkFlowInput: {
workflow_id: schedule.workflow_id, workflowID: schedule.workflowID,
workflow_name: schedule.workflow_name, workflowName: schedule.workflowName,
workflow_description: schedule.workflow_description, workflowDescription: schedule.workflowDescription,
isCustomWorkflow: schedule.isCustomWorkflow, isCustomWorkflow: schedule.isCustomWorkflow,
cronSyntax: schedule.cronSyntax, cronSyntax: schedule.cronSyntax,
workflow_manifest: JSON.stringify(yaml, null, 2), workflowManifest: JSON.stringify(yaml, null, 2),
project_id: schedule.project_id, projectID: schedule.projectID,
cluster_id: schedule.cluster_id, clusterID: schedule.clusterID,
weightages: weightData, weightages: weightData,
}, },
}, },
@ -148,31 +148,31 @@ const BrowseSchedule: React.FC<BrowseScheduleProps> = ({ setWorkflowName }) => {
}; };
// Query to get list of Clusters // Query to get list of Clusters
const { data: clusterList } = useQuery<Partial<Clusters>, ClusterVars>( const { data: clusterList } = useQuery<Partial<Clusters>, ClusterRequest>(
GET_CLUSTER_NAMES, GET_CLUSTER_NAMES,
{ {
variables: { variables: {
project_id: projectID, projectID,
}, },
} }
); );
const filteredWorkflows = data?.ListWorkflow.workflows const filteredWorkflows = data?.listWorkflows.workflows
.filter((dataRow) => .filter((dataRow) =>
filters.suspended === 'All' filters.suspended === 'All'
? true ? true
: filters.suspended === 'true' : filters.suspended === 'true'
? YAML.parse(dataRow.workflow_manifest).spec.suspend === true ? YAML.parse(dataRow.workflowManifest).spec.suspend === true
: filters.suspended === 'false' : filters.suspended === 'false'
? YAML.parse(dataRow.workflow_manifest).spec.suspend === undefined ? YAML.parse(dataRow.workflowManifest).spec.suspend === undefined
: false : false
) )
.filter((dataRow) => .filter((dataRow) =>
filters.workflow_type === 'All' filters.workflowType === 'All'
? true ? true
: filters.workflow_type === 'workflow' : filters.workflowType === 'workflow'
? dataRow.cronSyntax.length === 0 || dataRow.cronSyntax === '' ? dataRow.cronSyntax.length === 0 || dataRow.cronSyntax === ''
: filters.workflow_type === 'cronworkflow' : filters.workflowType === 'cronworkflow'
? dataRow.cronSyntax.length > 0 ? dataRow.cronSyntax.length > 0
: false : false
); );
@ -182,7 +182,7 @@ const BrowseSchedule: React.FC<BrowseScheduleProps> = ({ setWorkflowName }) => {
variables: { variables: {
projectID: getProjectID(), projectID: getProjectID(),
workflowID: wfid, workflowID: wfid,
workflow_run_id: '', workflowRunID: '',
}, },
}); });
}; };
@ -195,11 +195,11 @@ const BrowseSchedule: React.FC<BrowseScheduleProps> = ({ setWorkflowName }) => {
id="input-with-icon-adornment" id="input-with-icon-adornment"
placeholder="Search" placeholder="Search"
className={classes.search} className={classes.search}
value={filters.workflow_name} value={filters.workflowName}
onChange={(event) => onChange={(event) =>
setFilters({ setFilters({
...filters, ...filters,
workflow_name: event.target.value as string, workflowName: event.target.value as string,
}) })
} }
startAdornment={ startAdornment={
@ -214,11 +214,11 @@ const BrowseSchedule: React.FC<BrowseScheduleProps> = ({ setWorkflowName }) => {
Schedule Type Schedule Type
</InputLabel> </InputLabel>
<Select <Select
value={filters.workflow_type} value={filters.workflowType}
onChange={(event) => onChange={(event) =>
setFilters({ setFilters({
...filters, ...filters,
workflow_type: event.target.value as string, workflowType: event.target.value as string,
}) })
} }
label="Schedule Type" label="Schedule Type"
@ -267,23 +267,20 @@ const BrowseSchedule: React.FC<BrowseScheduleProps> = ({ setWorkflowName }) => {
<FormControl variant="outlined" className={classes.formControl}> <FormControl variant="outlined" className={classes.formControl}>
<InputLabel className={classes.selectText}>Target Agent</InputLabel> <InputLabel className={classes.selectText}>Target Agent</InputLabel>
<Select <Select
value={filters.cluster_name} value={filters.clusterName}
onChange={(event) => onChange={(event) =>
setFilters({ setFilters({
...filters, ...filters,
cluster_name: event.target.value as string, clusterName: event.target.value as string,
}) })
} }
label="Target Cluster" label="Target Cluster"
className={classes.selectText} className={classes.selectText}
> >
<MenuItem value="All">All</MenuItem> <MenuItem value="All">All</MenuItem>
{clusterList?.getCluster?.map((cluster) => ( {clusterList?.listClusters?.map((cluster) => (
<MenuItem <MenuItem key={cluster.clusterName} value={cluster.clusterName}>
key={cluster.cluster_name} {cluster.clusterName}
value={cluster.cluster_name}
>
{cluster.cluster_name}
</MenuItem> </MenuItem>
))} ))}
</Select> </Select>
@ -311,7 +308,7 @@ const BrowseSchedule: React.FC<BrowseScheduleProps> = ({ setWorkflowName }) => {
size="small" size="small"
onClick={() => onClick={() =>
setSortData({ setSortData({
field: 'Name', field: 'NAME',
descending: false, descending: false,
}) })
} }
@ -323,7 +320,7 @@ const BrowseSchedule: React.FC<BrowseScheduleProps> = ({ setWorkflowName }) => {
size="small" size="small"
onClick={() => onClick={() =>
setSortData({ setSortData({
field: 'Name', field: 'NAME',
descending: true, descending: true,
}) })
} }
@ -394,7 +391,7 @@ const BrowseSchedule: React.FC<BrowseScheduleProps> = ({ setWorkflowName }) => {
filteredWorkflows.map((data) => ( filteredWorkflows.map((data) => (
<TableRow <TableRow
data-cy="workflowSchedulesTableRow" data-cy="workflowSchedulesTableRow"
key={data.workflow_id} key={data.workflowID}
> >
<TableData <TableData
data={data} data={data}
@ -419,7 +416,7 @@ const BrowseSchedule: React.FC<BrowseScheduleProps> = ({ setWorkflowName }) => {
<TablePagination <TablePagination
rowsPerPageOptions={[5, 10, 25]} rowsPerPageOptions={[5, 10, 25]}
component="div" component="div"
count={data?.ListWorkflow.total_no_of_workflows ?? 0} count={data?.listWorkflows.totalNoOfWorkflows ?? 0}
rowsPerPage={paginationData.limit} rowsPerPage={paginationData.limit}
page={paginationData.page} page={paginationData.page}
onChangePage={(_, page) => onChangePage={(_, page) =>

View File

@ -127,9 +127,9 @@ const HeaderSection: React.FC<HeaderSectionProps> = ({
className={classes.selectText} className={classes.selectText}
> >
<MenuItem value="All">All</MenuItem> <MenuItem value="All">All</MenuItem>
{clusterList?.getCluster?.map((cluster) => ( {clusterList?.listClusters?.map((cluster) => (
<MenuItem key={cluster.cluster_name} value={cluster.cluster_name}> <MenuItem key={cluster.clusterName} value={cluster.clusterName}>
{cluster.cluster_name} {cluster.clusterName}
</MenuItem> </MenuItem>
))} ))}
</Select> </Select>

View File

@ -1,35 +1,35 @@
import { useQuery } from '@apollo/client'; import { useQuery } from '@apollo/client';
import { Typography } from '@material-ui/core'; import { Typography } from '@material-ui/core';
import React from 'react'; import React from 'react';
import YAML from 'yaml';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import YAML from 'yaml';
import Loader from '../../../components/Loader'; import Loader from '../../../components/Loader';
import YamlEditor from '../../../components/YamlEditor/Editor'; import YamlEditor from '../../../components/YamlEditor/Editor';
import { WORKFLOW_LIST_DETAILS } from '../../../graphql'; import { GET_WORKFLOW_DETAILS } from '../../../graphql';
import { import {
ListWorkflowsInput, GetWorkflowsRequest,
ScheduledWorkflows, ScheduledWorkflows,
} from '../../../models/graphql/workflowListData'; } from '../../../models/graphql/workflowListData';
import useStyles from './styles'; import useStyles from './styles';
interface ManifestModalProps { interface ManifestModalProps {
project_id: string; projectID: string;
workflow_id: string | undefined; workflowID: string | undefined;
} }
const ManifestModal: React.FC<ManifestModalProps> = ({ const ManifestModal: React.FC<ManifestModalProps> = ({
project_id, projectID,
workflow_id, workflowID,
}) => { }) => {
const classes = useStyles(); const classes = useStyles();
const { t } = useTranslation(); const { t } = useTranslation();
const { data, loading } = useQuery<ScheduledWorkflows, ListWorkflowsInput>( const { data, loading } = useQuery<ScheduledWorkflows, GetWorkflowsRequest>(
WORKFLOW_LIST_DETAILS, GET_WORKFLOW_DETAILS,
{ {
variables: { variables: {
workflowInput: { request: {
project_id, projectID,
workflow_ids: [workflow_id ?? ''], workflowIDs: [workflowID ?? ''],
}, },
}, },
} }
@ -47,7 +47,7 @@ const ManifestModal: React.FC<ManifestModalProps> = ({
<YamlEditor <YamlEditor
content={YAML.stringify( content={YAML.stringify(
YAML.parse( YAML.parse(
data?.ListWorkflow.workflows[0].workflow_manifest as string data?.listWorkflows.workflows[0].workflowManifest as string
) )
)} )}
filename="Workflow Template" filename="Workflow Template"

View File

@ -25,13 +25,13 @@ import { useTranslation } from 'react-i18next';
import TimePopOver from '../../../components/TimePopOver'; import TimePopOver from '../../../components/TimePopOver';
import { import {
DELETE_WORKFLOW, DELETE_WORKFLOW,
GET_WORKFLOW_DETAILS,
SYNC_WORKFLOW, SYNC_WORKFLOW,
TERMINATE_WORKFLOW, TERMINATE_WORKFLOW,
WORKFLOW_LIST_DETAILS,
} from '../../../graphql'; } from '../../../graphql';
import { WorkflowRun } from '../../../models/graphql/workflowData'; import { WorkflowRun } from '../../../models/graphql/workflowData';
import { import {
ListWorkflowsInput, GetWorkflowsRequest,
ScheduledWorkflows, ScheduledWorkflows,
} from '../../../models/graphql/workflowListData'; } from '../../../models/graphql/workflowListData';
import useActions from '../../../redux/actions'; import useActions from '../../../redux/actions';
@ -74,12 +74,12 @@ const TableData: React.FC<TableDataProps> = ({ data, refetchQuery }) => {
const { data: scheduledWorkflowData } = useQuery< const { data: scheduledWorkflowData } = useQuery<
ScheduledWorkflows, ScheduledWorkflows,
ListWorkflowsInput GetWorkflowsRequest
>(WORKFLOW_LIST_DETAILS, { >(GET_WORKFLOW_DETAILS, {
variables: { variables: {
workflowInput: { request: {
project_id: projectID, projectID,
workflow_ids: [data.workflow_id ?? ''], workflowIDs: [data.workflowID ?? ''],
}, },
}, },
}); });
@ -184,7 +184,7 @@ const TableData: React.FC<TableDataProps> = ({ data, refetchQuery }) => {
<> <>
{/* Table cell for warning (if the workflow is in running state from 20 mins) */} {/* Table cell for warning (if the workflow is in running state from 20 mins) */}
<TableCell className={classes.warningTableCell}> <TableCell className={classes.warningTableCell}>
{timeDiff(new Date().getTime(), data.last_updated ?? '') >= 20 && {timeDiff(new Date().getTime(), data.lastUpdated ?? '') >= 20 &&
data.phase?.toLowerCase() === 'running' ? ( data.phase?.toLowerCase() === 'running' ? (
<IconButton onClick={handleWarningPopOverClick}> <IconButton onClick={handleWarningPopOverClick}>
<img src="./icons/warning.svg" alt="warning" width="20" /> <img src="./icons/warning.svg" alt="warning" width="20" />
@ -220,7 +220,7 @@ const TableData: React.FC<TableDataProps> = ({ data, refetchQuery }) => {
<Typography className={classes.runningText}> <Typography className={classes.runningText}>
{t('chaosWorkflows.browseWorkflows.runningFrom')}{' '} {t('chaosWorkflows.browseWorkflows.runningFrom')}{' '}
{Math.round( {Math.round(
timeDiff(new Date().getTime(), data.last_updated ?? '') timeDiff(new Date().getTime(), data.lastUpdated ?? '')
)}{' '} )}{' '}
{t('chaosWorkflows.browseWorkflows.min')} {t('chaosWorkflows.browseWorkflows.min')}
</Typography> </Typography>
@ -233,8 +233,8 @@ const TableData: React.FC<TableDataProps> = ({ data, refetchQuery }) => {
syncWorkflow({ syncWorkflow({
variables: { variables: {
projectID: getProjectID(), projectID: getProjectID(),
workflowID: data.workflow_id, workflowID: data.workflowID,
workflow_run_id: data.workflow_run_id, workflowRunID: data.workflowRunID,
}, },
}); });
}} }}
@ -249,8 +249,8 @@ const TableData: React.FC<TableDataProps> = ({ data, refetchQuery }) => {
deleteWorkflow({ deleteWorkflow({
variables: { variables: {
projectID: getProjectID(), projectID: getProjectID(),
workflowID: data.workflow_id, workflowID: data.workflowID,
workflow_run_id: data.workflow_run_id, workflowRunID: data.workflowRunID,
}, },
}); });
}} }}
@ -278,43 +278,43 @@ const TableData: React.FC<TableDataProps> = ({ data, refetchQuery }) => {
style={{ cursor: 'pointer' }} style={{ cursor: 'pointer' }}
onClick={() => { onClick={() => {
nodeSelection.selectNode({ nodeSelection.selectNode({
pod_name: '', podName: '',
}); });
history.push({ history.push({
pathname: `/workflows/${data.workflow_run_id}`, pathname: `/workflows/${data.workflowRunID}`,
search: `?projectID=${projectID}&projectRole=${projectRole}`, search: `?projectID=${projectID}&projectRole=${projectRole}`,
}); });
}} }}
> >
<Typography className={classes.boldText} data-cy="workflowName"> <Typography className={classes.boldText} data-cy="workflowName">
{data.workflow_name} {data.workflowName}
</Typography> </Typography>
</TableCell> </TableCell>
<TableCell> <TableCell>
<Typography className={classes.clusterName}> <Typography className={classes.clusterName}>
{nameCapitalized(data.cluster_name ?? '')} {nameCapitalized(data.clusterName ?? '')}
</Typography> </Typography>
</TableCell> </TableCell>
<TableCell className={classes.reliabiltyData}> <TableCell className={classes.reliabiltyData}>
{scheduledWorkflowData?.ListWorkflow.workflows[0]?.weightages[0] {scheduledWorkflowData?.listWorkflows.workflows[0]?.weightages[0]
?.experiment_name !== '' ? ( ?.experimentName !== '' ? (
<> <>
<Typography data-cy="ResScore"> <Typography data-cy="ResScore">
<span> <span>
{t('chaosWorkflows.browseWorkflows.tableData.overallRR')} {t('chaosWorkflows.browseWorkflows.tableData.overallRR')}
</span> </span>
{data.resiliency_score === undefined || {data.resiliencyScore === undefined ||
data.resiliency_score === null ? ( data.resiliencyScore === null ? (
<span className={classes.less}> <span className={classes.less}>
{t('chaosWorkflows.browseWorkflows.tableData.na')} {t('chaosWorkflows.browseWorkflows.tableData.na')}
</span> </span>
) : ( ) : (
<span <span
className={`${classes.boldText} ${getResiliencyScoreColor( className={`${classes.boldText} ${getResiliencyScoreColor(
data.resiliency_score data.resiliencyScore
)}`} )}`}
> >
{data.resiliency_score}% {data.resiliencyScore}%
</span> </span>
)} )}
</Typography> </Typography>
@ -324,23 +324,23 @@ const TableData: React.FC<TableDataProps> = ({ data, refetchQuery }) => {
'chaosWorkflows.browseWorkflows.tableData.experimentsPassed' 'chaosWorkflows.browseWorkflows.tableData.experimentsPassed'
)} )}
</span> </span>
{data.experiments_passed === undefined || {data.experimentsPassed === undefined ||
data.experiments_passed === null || data.experimentsPassed === null ||
data.total_experiments === undefined || data.totalExperiments === undefined ||
data.total_experiments === null || data.totalExperiments === null ||
data.total_experiments === 0 || data.totalExperiments === 0 ||
data.resiliency_score === undefined || data.resiliencyScore === undefined ||
data.resiliency_score === null ? ( data.resiliencyScore === null ? (
<span className={classes.less}> <span className={classes.less}>
{t('chaosWorkflows.browseWorkflows.tableData.na')} {t('chaosWorkflows.browseWorkflows.tableData.na')}
</span> </span>
) : ( ) : (
<span <span
className={`${classes.boldText} ${getResiliencyScoreColor( className={`${classes.boldText} ${getResiliencyScoreColor(
data.resiliency_score data.resiliencyScore
)}`} )}`}
> >
{data.experiments_passed}/{data.total_experiments} {data.experimentsPassed}/{data.totalExperiments}
</span> </span>
)} )}
</Typography> </Typography>
@ -353,8 +353,8 @@ const TableData: React.FC<TableDataProps> = ({ data, refetchQuery }) => {
</TableCell> </TableCell>
<TableCell> <TableCell>
<div> <div>
{scheduledWorkflowData?.ListWorkflow.workflows[0]?.weightages[0] {scheduledWorkflowData?.listWorkflows.workflows[0]?.weightages[0]
?.experiment_name !== '' ? ( ?.experimentName !== '' ? (
<> <>
<Button <Button
onClick={handlePopOverClick} onClick={handlePopOverClick}
@ -365,7 +365,7 @@ const TableData: React.FC<TableDataProps> = ({ data, refetchQuery }) => {
'chaosWorkflows.browseWorkflows.tableData.showExperiments' 'chaosWorkflows.browseWorkflows.tableData.showExperiments'
)} )}
( (
{scheduledWorkflowData?.ListWorkflow.workflows[0]?.weightages {scheduledWorkflowData?.listWorkflows.workflows[0]?.weightages
.length ?? 0} .length ?? 0}
) )
</Typography> </Typography>
@ -392,14 +392,14 @@ const TableData: React.FC<TableDataProps> = ({ data, refetchQuery }) => {
}} }}
> >
<div className={classes.popover}> <div className={classes.popover}>
{scheduledWorkflowData?.ListWorkflow.workflows[0]?.weightages.map( {scheduledWorkflowData?.listWorkflows.workflows[0]?.weightages.map(
(weightEntry) => ( (weightEntry) => (
<div <div
key={weightEntry.experiment_name} key={weightEntry.experimentName}
style={{ marginBottom: 8 }} style={{ marginBottom: 8 }}
> >
<ExperimentPoints <ExperimentPoints
expName={weightEntry.experiment_name} expName={weightEntry.experimentName}
weight={weightEntry.weightage} weight={weightEntry.weightage}
/> />
</div> </div>
@ -416,11 +416,11 @@ const TableData: React.FC<TableDataProps> = ({ data, refetchQuery }) => {
</div> </div>
</TableCell> </TableCell>
<TableCell> <TableCell>
<TimePopOver unixTime={data.last_updated ?? ''} /> <TimePopOver unixTime={data.lastUpdated ?? ''} />
</TableCell> </TableCell>
<TableCell> <TableCell>
<Typography className={classes.executedBy}> <Typography className={classes.executedBy}>
{data.executed_by || '-'} {data.executedBy || '-'}
</Typography> </Typography>
</TableCell> </TableCell>
<TableCell> <TableCell>
@ -445,10 +445,10 @@ const TableData: React.FC<TableDataProps> = ({ data, refetchQuery }) => {
value="Workflow" value="Workflow"
onClick={() => { onClick={() => {
nodeSelection.selectNode({ nodeSelection.selectNode({
pod_name: '', podName: '',
}); });
history.push({ history.push({
pathname: `/workflows/${data.workflow_run_id}`, pathname: `/workflows/${data.workflowRunID}`,
search: `?projectID=${projectID}&projectRole=${projectRole}`, search: `?projectID=${projectID}&projectRole=${projectRole}`,
}); });
}} }}
@ -468,7 +468,7 @@ const TableData: React.FC<TableDataProps> = ({ data, refetchQuery }) => {
value="Analysis" value="Analysis"
onClick={() => { onClick={() => {
history.push({ history.push({
pathname: `/analytics/workflowStatistics/${data.workflow_id}`, pathname: `/analytics/workflowStatistics/${data.workflowID}`,
search: `?projectID=${projectID}&projectRole=${projectRole}`, search: `?projectID=${projectID}&projectRole=${projectRole}`,
}); });
}} }}
@ -510,10 +510,7 @@ const TableData: React.FC<TableDataProps> = ({ data, refetchQuery }) => {
</ButtonOutlined> </ButtonOutlined>
} }
> >
<ManifestModal <ManifestModal projectID={projectID} workflowID={data.workflowID} />
project_id={projectID}
workflow_id={data.workflow_id}
/>
</Modal> </Modal>
{data.phase?.toLowerCase() === 'running' && ( {data.phase?.toLowerCase() === 'running' && (
<MenuItem <MenuItem
@ -522,8 +519,8 @@ const TableData: React.FC<TableDataProps> = ({ data, refetchQuery }) => {
terminateWorkflow({ terminateWorkflow({
variables: { variables: {
projectID: getProjectID(), projectID: getProjectID(),
workflowID: data.workflow_id, workflowID: data.workflowID,
workflow_run_id: data.workflow_run_id, workflowRunID: data.workflowRunID,
}, },
}); });
}} }}

View File

@ -21,17 +21,17 @@ import {
WORKFLOW_DETAILS, WORKFLOW_DETAILS,
WORKFLOW_EVENTS, WORKFLOW_EVENTS,
} from '../../../graphql'; } from '../../../graphql';
import { Clusters, ClusterVars } from '../../../models/graphql/clusterData'; import { ClusterRequest, Clusters } from '../../../models/graphql/clusterData';
import { import {
Pagination, Pagination,
SortInput, SortRequest,
Workflow, Workflow,
WorkflowDataVars, WorkflowDataRequest,
WorkflowRun, WorkflowRun,
WorkflowRunFilterInput, WorkflowRunFilterRequest,
WorkflowStatus, WorkflowStatus,
WorkflowSubscription, WorkflowSubscription,
WorkflowSubscriptionInput, WorkflowSubscriptionRequest,
} from '../../../models/graphql/workflowData'; } from '../../../models/graphql/workflowData';
import { getProjectID } from '../../../utils/getSearchParams'; import { getProjectID } from '../../../utils/getSearchParams';
import HeaderSection from './HeaderSection'; import HeaderSection from './HeaderSection';
@ -58,12 +58,12 @@ const BrowseWorkflow: React.FC<BrowseWorkflowProps> = ({
}); });
// States for filters // States for filters
const [filters, setFilters] = useState<WorkflowRunFilterInput>({ const [filters, setFilters] = useState<WorkflowRunFilterRequest>({
workflow_name: workflowName, workflowName,
cluster_name: 'All', clusterName: 'All',
workflow_status: 'All', workflowStatus: 'All',
date_range: { dateRange: {
start_date: new Date(0).valueOf().toString(), startDate: new Date(0).valueOf().toString(),
}, },
}); });
@ -73,32 +73,32 @@ const BrowseWorkflow: React.FC<BrowseWorkflowProps> = ({
); );
// State for sorting // State for sorting
const [sortData, setSortData] = useState<SortInput>({ const [sortData, setSortData] = useState<SortRequest>({
field: 'Time', field: 'TIME',
descending: true, descending: true,
}); });
// Checks if the workflow event from subscription exists in the table // Checks if the workflow event from subscription exists in the table
function isFiltered(newWorkflow: WorkflowRun) { function isFiltered(newWorkflow: WorkflowRun) {
const nameExists = const nameExists =
filters.workflow_name && filters.workflowName &&
newWorkflow.workflow_name newWorkflow.workflowName
.toLowerCase() .toLowerCase()
.includes(filters.workflow_name.toLowerCase()); .includes(filters.workflowName.toLowerCase());
const clusterExists = const clusterExists =
filters.cluster_name === 'All' || filters.clusterName === 'All' ||
filters.cluster_name === newWorkflow.cluster_name; filters.clusterName === newWorkflow.clusterName;
const phaseExists = const phaseExists =
filters.workflow_status === 'All' || filters.workflowStatus === 'All' ||
filters.workflow_status === newWorkflow.phase; filters.workflowStatus === newWorkflow.phase;
const dateExists = const dateExists =
filters.date_range && filters.dateRange &&
newWorkflow.last_updated >= filters.date_range.start_date && newWorkflow.lastUpdated >= filters.dateRange.startDate &&
(filters.date_range.end_date (filters.dateRange.endDate
? newWorkflow.last_updated < filters.date_range.end_date ? newWorkflow.lastUpdated < filters.dateRange.endDate
: true); : true);
const shouldAddNewWorkflow = const shouldAddNewWorkflow =
@ -108,11 +108,11 @@ const BrowseWorkflow: React.FC<BrowseWorkflowProps> = ({
} }
// Query to get list of Clusters // Query to get list of Clusters
const { data: clusterList } = useQuery<Partial<Clusters>, ClusterVars>( const { data: clusterList } = useQuery<Partial<Clusters>, ClusterRequest>(
GET_CLUSTER_NAMES, GET_CLUSTER_NAMES,
{ {
variables: { variables: {
project_id: projectID, projectID,
}, },
} }
); );
@ -120,11 +120,11 @@ const BrowseWorkflow: React.FC<BrowseWorkflowProps> = ({
// Query to get workflows // Query to get workflows
const { subscribeToMore, data, error, refetch } = useQuery< const { subscribeToMore, data, error, refetch } = useQuery<
Workflow, Workflow,
WorkflowDataVars WorkflowDataRequest
>(WORKFLOW_DETAILS, { >(WORKFLOW_DETAILS, {
variables: { variables: {
workflowRunsInput: { request: {
project_id: projectID, projectID,
pagination: { pagination: {
page: paginationData.page, page: paginationData.page,
limit: paginationData.limit, limit: paginationData.limit,
@ -138,23 +138,22 @@ const BrowseWorkflow: React.FC<BrowseWorkflowProps> = ({
// Using subscription to get realtime data // Using subscription to get realtime data
useEffect(() => { useEffect(() => {
subscribeToMore<WorkflowSubscription, WorkflowSubscriptionInput>({ subscribeToMore<WorkflowSubscription, WorkflowSubscriptionRequest>({
document: WORKFLOW_EVENTS, document: WORKFLOW_EVENTS,
variables: { projectID }, variables: { projectID },
updateQuery: (prev, { subscriptionData }) => { updateQuery: (prev, { subscriptionData }) => {
if (!subscriptionData.data || !prev || !prev.getWorkflowRuns) if (!subscriptionData.data || !prev || !prev.listWorkflowRuns)
return prev; return prev;
const modifiedWorkflows = prev.getWorkflowRuns.workflow_runs.slice(); const modifiedWorkflows = prev.listWorkflowRuns.workflowRuns.slice();
const newWorkflow = subscriptionData.data.workflowEventListener; const newWorkflow = subscriptionData.data.getWorkflowEvents;
// Updating the query data // Updating the query data
let i = 0; let i = 0;
let totalNoOfWorkflows = prev.getWorkflowRuns.total_no_of_workflow_runs; let totalNoOfWorkflows = prev.listWorkflowRuns.totalNoOfWorkflowRuns;
for (; i < modifiedWorkflows.length; i++) { for (; i < modifiedWorkflows.length; i++) {
if ( if (
modifiedWorkflows[i].workflow_run_id === newWorkflow.workflow_run_id modifiedWorkflows[i].workflowRunID === newWorkflow.workflowRunID
) { ) {
modifiedWorkflows[i] = newWorkflow; modifiedWorkflows[i] = newWorkflow;
break; break;
@ -166,9 +165,9 @@ const BrowseWorkflow: React.FC<BrowseWorkflowProps> = ({
} }
return { return {
getWorkflowRuns: { listWorkflowRuns: {
total_no_of_workflow_runs: totalNoOfWorkflows, totalNoOfWorkflowRuns: totalNoOfWorkflows,
workflow_runs: modifiedWorkflows, workflowRuns: modifiedWorkflows,
}, },
}; };
}, },
@ -191,13 +190,12 @@ const BrowseWorkflow: React.FC<BrowseWorkflowProps> = ({
setOpen(true); setOpen(true);
}; };
const workflowRuns = data?.getWorkflowRuns.workflow_runs; const workflowRuns = data?.listWorkflowRuns.workflowRuns;
// Functions passed as props in the headerSection // Functions passed as props in the headerSection
const changeSearch = ( const changeSearch = (
event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement> event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>
) => { ) => {
setFilters({ ...filters, workflow_name: event.target.value as string }); setFilters({ ...filters, workflowName: event.target.value as string });
setWorkflowName(event.target.value as string); setWorkflowName(event.target.value as string);
setPaginationData({ ...paginationData, page: 0 }); setPaginationData({ ...paginationData, page: 0 });
}; };
@ -210,7 +208,7 @@ const BrowseWorkflow: React.FC<BrowseWorkflowProps> = ({
) => { ) => {
setFilters({ setFilters({
...filters, ...filters,
workflow_status: event.target.value as WorkflowStatus, workflowStatus: event.target.value as WorkflowStatus,
}); });
setPaginationData({ ...paginationData, page: 0 }); setPaginationData({ ...paginationData, page: 0 });
}; };
@ -221,7 +219,7 @@ const BrowseWorkflow: React.FC<BrowseWorkflowProps> = ({
value: unknown; value: unknown;
}> }>
) => { ) => {
setFilters({ ...filters, cluster_name: event.target.value as string }); setFilters({ ...filters, clusterName: event.target.value as string });
setPaginationData({ ...paginationData, page: 0 }); setPaginationData({ ...paginationData, page: 0 });
}; };
@ -230,12 +228,12 @@ const BrowseWorkflow: React.FC<BrowseWorkflowProps> = ({
// Change filter value for date range // Change filter value for date range
setFilters({ setFilters({
...filters, ...filters,
date_range: { dateRange: {
start_date: new Date(selectStartDate) startDate: new Date(selectStartDate)
.setHours(0, 0, 0) .setHours(0, 0, 0)
.valueOf() .valueOf()
.toString(), .toString(),
end_date: new Date(selectEndDate) endDate: new Date(selectEndDate)
.setHours(23, 59, 59) .setHours(23, 59, 59)
.valueOf() .valueOf()
.toString(), .toString(),
@ -257,11 +255,11 @@ const BrowseWorkflow: React.FC<BrowseWorkflowProps> = ({
<section className="Heading section"> <section className="Heading section">
{/* Header Section */} {/* Header Section */}
<HeaderSection <HeaderSection
searchValue={filters.workflow_name} searchValue={filters.workflowName}
changeSearch={changeSearch} changeSearch={changeSearch}
statusValue={filters.workflow_status} statusValue={filters.workflowStatus}
changeStatus={changeStatus} changeStatus={changeStatus}
clusterValue={filters.cluster_name} clusterValue={filters.clusterName}
changeCluster={changeCluster} changeCluster={changeCluster}
popOverClick={handlePopOverClick} popOverClick={handlePopOverClick}
popOverClose={handlePopOverClose} popOverClose={handlePopOverClose}
@ -299,7 +297,7 @@ const BrowseWorkflow: React.FC<BrowseWorkflowProps> = ({
size="small" size="small"
onClick={() => onClick={() =>
setSortData({ setSortData({
field: 'Name', field: 'NAME',
}) })
} }
> >
@ -310,7 +308,7 @@ const BrowseWorkflow: React.FC<BrowseWorkflowProps> = ({
size="small" size="small"
onClick={() => onClick={() =>
setSortData({ setSortData({
field: 'Name', field: 'NAME',
descending: true, descending: true,
}) })
} }
@ -354,7 +352,7 @@ const BrowseWorkflow: React.FC<BrowseWorkflowProps> = ({
size="small" size="small"
onClick={() => onClick={() =>
setSortData({ setSortData({
field: 'Time', field: 'TIME',
descending: true, descending: true,
}) })
} }
@ -366,7 +364,7 @@ const BrowseWorkflow: React.FC<BrowseWorkflowProps> = ({
size="small" size="small"
onClick={() => onClick={() =>
setSortData({ setSortData({
field: 'Time', field: 'TIME',
}) })
} }
> >
@ -401,8 +399,8 @@ const BrowseWorkflow: React.FC<BrowseWorkflowProps> = ({
) : workflowRuns && workflowRuns.length ? ( ) : workflowRuns && workflowRuns.length ? (
workflowRuns.map((dataRow) => ( workflowRuns.map((dataRow) => (
<TableRow <TableRow
data-cy={dataRow.workflow_name} data-cy={dataRow.workflowName}
key={dataRow.workflow_run_id} key={dataRow.workflowRunID}
> >
<TableData data={dataRow} refetchQuery={refetch} /> <TableData data={dataRow} refetchQuery={refetch} />
</TableRow> </TableRow>
@ -424,7 +422,7 @@ const BrowseWorkflow: React.FC<BrowseWorkflowProps> = ({
<TablePagination <TablePagination
rowsPerPageOptions={[10, 25, 50]} rowsPerPageOptions={[10, 25, 50]}
component="div" component="div"
count={data?.getWorkflowRuns.total_no_of_workflow_runs ?? 0} count={data?.listWorkflowRuns.totalNoOfWorkflowRuns ?? 0}
rowsPerPage={paginationData.limit} rowsPerPage={paginationData.limit}
page={paginationData.page} page={paginationData.page}
onChangePage={(_, page) => onChangePage={(_, page) =>

View File

@ -1,5 +1,6 @@
import { useLazyQuery, useQuery } from '@apollo/client'; import { useLazyQuery, useQuery } from '@apollo/client';
import { RadioGroup, Typography, useTheme } from '@material-ui/core'; import { RadioGroup, Typography, useTheme } from '@material-ui/core';
import ArrowUpwardIcon from '@material-ui/icons/ArrowUpward';
import { import {
ButtonOutlined, ButtonOutlined,
LitmusCard, LitmusCard,
@ -8,22 +9,21 @@ import {
Search, Search,
} from 'litmus-ui'; } from 'litmus-ui';
import React, { import React, {
lazy,
forwardRef, forwardRef,
lazy,
useEffect, useEffect,
useImperativeHandle, useImperativeHandle,
useState, useState,
} from 'react'; } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import ArrowUpwardIcon from '@material-ui/icons/ArrowUpward'; import Loader from '../../../components/Loader';
import { constants } from '../../../constants'; import { constants } from '../../../constants';
import { import {
GET_CLUSTER, GET_CLUSTER,
GET_IMAGE_REGISTRY, GET_IMAGE_REGISTRY,
LIST_IMAGE_REGISTRY, LIST_IMAGE_REGISTRY_BY_PROJECT_ID,
} from '../../../graphql'; } from '../../../graphql';
import { ImageRegistryInfo } from '../../../models/redux/image_registry';
import useActions from '../../../redux/actions'; import useActions from '../../../redux/actions';
import * as AlertActions from '../../../redux/actions/alert'; import * as AlertActions from '../../../redux/actions/alert';
import * as ImageRegistryActions from '../../../redux/actions/image_registry'; import * as ImageRegistryActions from '../../../redux/actions/image_registry';
@ -31,17 +31,16 @@ import * as WorkflowActions from '../../../redux/actions/workflow';
import { RootState } from '../../../redux/reducers'; import { RootState } from '../../../redux/reducers';
import { getProjectID, getProjectRole } from '../../../utils/getSearchParams'; import { getProjectID, getProjectRole } from '../../../utils/getSearchParams';
import useStyles from './styles'; import useStyles from './styles';
import Loader from '../../../components/Loader';
const AgentDeployModal = lazy( const AgentDeployModal = lazy(
() => import('../../../components/AgentDeployModal') () => import('../../../components/AgentDeployModal')
); );
interface Cluster { interface Cluster {
cluster_name: string; clusterName: string;
is_active: boolean; isActive: boolean;
cluster_id: string; clusterID: string;
agent_namespace: string; agentNamespace: string;
} }
const ChooseWorkflowAgent = forwardRef((_, ref) => { const ChooseWorkflowAgent = forwardRef((_, ref) => {
@ -52,8 +51,8 @@ const ChooseWorkflowAgent = forwardRef((_, ref) => {
const workflow = useActions(WorkflowActions); const workflow = useActions(WorkflowActions);
const alert = useActions(AlertActions); const alert = useActions(AlertActions);
const imageRegistry = useActions(ImageRegistryActions); const imageRegistry = useActions(ImageRegistryActions);
const clusterid: string = useSelector( const clusterID: string = useSelector(
(state: RootState) => state.workflowData.clusterid (state: RootState) => state.workflowData.clusterID
); );
const selectedProjectID = getProjectID(); const selectedProjectID = getProjectID();
@ -72,36 +71,35 @@ const ChooseWorkflowAgent = forwardRef((_, ref) => {
fetchPolicy: 'network-only', fetchPolicy: 'network-only',
onCompleted: (data) => { onCompleted: (data) => {
if (data !== undefined) { if (data !== undefined) {
const regData = data.GetImageRegistry const regData = data.getImageRegistry.imageRegistryInfo;
.image_registry_info as ImageRegistryInfo;
imageRegistry.selectImageRegistry({ imageRegistry.selectImageRegistry({
image_registry_name: regData.image_registry_name, image_registry_name: regData.imageRegistryName,
image_repo_name: regData.image_repo_name, image_repo_name: regData.imageRepoName,
image_registry_type: regData.image_registry_type, image_registry_type: regData.imageRegistryType,
secret_name: regData.secret_name, secret_name: regData.secretName,
secret_namespace: regData.secret_namespace, secret_namespace: regData.secretNamespace,
enable_registry: regData.enable_registry, enable_registry: regData.enableRegistry,
is_default: regData.is_default, is_default: regData.isDefault,
update_registry: true, update_registry: true,
}); });
} }
}, },
}); });
useQuery(LIST_IMAGE_REGISTRY, { useQuery(LIST_IMAGE_REGISTRY_BY_PROJECT_ID, {
variables: { variables: {
data: selectedProjectID, data: selectedProjectID,
}, },
fetchPolicy: 'network-only', fetchPolicy: 'network-only',
onCompleted: (data) => { onCompleted: (data) => {
if ( if (
data.ListImageRegistry !== null && data.listImageRegistry !== null &&
data.ListImageRegistry.length > 0 data.listImageRegistry.length > 0
) { ) {
getRegistryData({ getRegistryData({
variables: { variables: {
registryid: data.ListImageRegistry[0].image_registry_id, imageRegistryID: data.listImageRegistry[0].imageRegistryID,
projectid: selectedProjectID, projectID: selectedProjectID,
}, },
}); });
} else { } else {
@ -122,19 +120,19 @@ const ChooseWorkflowAgent = forwardRef((_, ref) => {
const [getCluster, { loading }] = useLazyQuery(GET_CLUSTER, { const [getCluster, { loading }] = useLazyQuery(GET_CLUSTER, {
onCompleted: (data) => { onCompleted: (data) => {
const clusters: Cluster[] = []; const clusters: Cluster[] = [];
if (data && data.getCluster.length !== 0) { if (data && data.listClusters.length !== 0) {
data.getCluster.forEach((e: Cluster) => { data.listClusters.forEach((e: Cluster) => {
if (e.is_active === true) { if (e.isActive === true) {
// Populating all the cluster data in the clusters[] array // Populating all the cluster data in the clusters[] array
clusters.push({ clusters.push({
cluster_name: e.cluster_name, clusterName: e.clusterName,
is_active: e.is_active, isActive: e.isActive,
cluster_id: e.cluster_id, clusterID: e.clusterID,
agent_namespace: e.agent_namespace, agentNamespace: e.agentNamespace,
}); });
// Setting the initial workflow yaml to be of type Workflow // Setting the initial workflow yaml to be of type Workflow
workflow.setWorkflowDetails({ workflow.setWorkflowDetails({
clusterid: '', clusterID: '',
cronSyntax: '', cronSyntax: '',
scheduleType: { scheduleType: {
scheduleOnce: 'now', scheduleOnce: 'now',
@ -162,7 +160,7 @@ const ChooseWorkflowAgent = forwardRef((_, ref) => {
alert.changeAlertState(true); alert.changeAlertState(true);
return false; return false;
} }
if (clusterid === '' || clusterData.length === 0) { if (clusterID === '' || clusterData.length === 0) {
alert.changeAlertState(true); // No Cluster has been selected and user clicked on Next alert.changeAlertState(true); // No Cluster has been selected and user clicked on Next
return false; return false;
} }
@ -171,7 +169,7 @@ const ChooseWorkflowAgent = forwardRef((_, ref) => {
// Rendering once to get the cluster data // Rendering once to get the cluster data
useEffect(() => { useEffect(() => {
getCluster({ variables: { project_id: selectedProjectID } }); getCluster({ variables: { projectID: selectedProjectID } });
}, []); }, []);
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => { const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
@ -181,7 +179,7 @@ const ChooseWorkflowAgent = forwardRef((_, ref) => {
// Filter the clusters based on search results // Filter the clusters based on search results
const filteredCluster = clusterData.filter((cluster: Cluster) => { const filteredCluster = clusterData.filter((cluster: Cluster) => {
if (search === null) return cluster; if (search === null) return cluster;
if (cluster.cluster_name.toLowerCase().includes(search.toLowerCase())) if (cluster.clusterName.toLowerCase().includes(search.toLowerCase()))
return cluster; return cluster;
return null; return null;
}); });
@ -190,12 +188,12 @@ const ChooseWorkflowAgent = forwardRef((_, ref) => {
useEffect(() => { useEffect(() => {
if (currentlySelectedAgent !== '') { if (currentlySelectedAgent !== '') {
clusterData.forEach((cluster) => { clusterData.forEach((cluster) => {
if (currentlySelectedAgent === cluster.cluster_id) { if (currentlySelectedAgent === cluster.clusterID) {
workflow.setWorkflowDetails({ workflow.setWorkflowDetails({
clusterid: cluster.cluster_id, clusterID: cluster.clusterID,
project_id: selectedProjectID, projectID: selectedProjectID,
clustername: cluster.cluster_name, clustername: cluster.clusterName,
namespace: cluster.agent_namespace, namespace: cluster.agentNamespace,
}); });
} }
}); });
@ -284,25 +282,25 @@ const ChooseWorkflowAgent = forwardRef((_, ref) => {
{filteredCluster?.length > 0 ? ( {filteredCluster?.length > 0 ? (
filteredCluster.map((cluster) => ( filteredCluster.map((cluster) => (
<LitmusCard <LitmusCard
key={cluster.cluster_id} key={cluster.clusterID}
glow={currentlySelectedAgent === cluster.cluster_id} glow={currentlySelectedAgent === cluster.clusterID}
width="40%" width="40%"
height="4rem" height="4rem"
className={classes.litmusCard} className={classes.litmusCard}
borderColor={ borderColor={
currentlySelectedAgent === cluster.cluster_id currentlySelectedAgent === cluster.clusterID
? palette.primary.main ? palette.primary.main
: palette.border.main : palette.border.main
} }
> >
<RadioButton <RadioButton
value={cluster.cluster_id} value={cluster.clusterID}
className={classes.agentRadioButton} className={classes.agentRadioButton}
data-cy={cluster.cluster_name} data-cy={cluster.clusterName}
> >
<div> <div>
<Typography>{cluster.cluster_name}</Typography> <Typography>{cluster.clusterName}</Typography>
<Typography>{cluster.cluster_id}</Typography> <Typography>{cluster.clusterID}</Typography>
</div> </div>
</RadioButton> </RadioButton>
</LitmusCard> </LitmusCard>

View File

@ -12,11 +12,11 @@ import React, { useState } from 'react';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { import {
DELETE_WORKFLOW_TEMPLATE, DELETE_WORKFLOW_TEMPLATE,
LIST_MANIFEST_TEMPLATE, GET_MANIFEST_TEMPLATE,
} from '../../../graphql'; } from '../../../graphql';
import { import {
ListManifestTemplate, GetManifestTemplate,
ListManifestTemplateArray, GetManifestTemplateArray,
} from '../../../models/graphql/workflowListData'; } from '../../../models/graphql/workflowListData';
import useActions from '../../../redux/actions'; import useActions from '../../../redux/actions';
import * as WorkflowActions from '../../../redux/actions/workflow'; import * as WorkflowActions from '../../../redux/actions/workflow';
@ -42,11 +42,11 @@ const ChooseWorkflowFromExisting: React.FC<ChooseWorkflowFromExistingProps> = ({
const [search, setSearch] = useState<string | null>(null); const [search, setSearch] = useState<string | null>(null);
const [selected, setSelected] = useState<string>(''); const [selected, setSelected] = useState<string>('');
const workflowAction = useActions(WorkflowActions); const workflowAction = useActions(WorkflowActions);
const { data: templateData } = useQuery<ListManifestTemplate>( const { data: templateData } = useQuery<GetManifestTemplate>(
LIST_MANIFEST_TEMPLATE, GET_MANIFEST_TEMPLATE,
{ {
variables: { variables: {
data: getProjectID(), projectID: getProjectID(),
}, },
fetchPolicy: 'network-only', fetchPolicy: 'network-only',
} }
@ -55,17 +55,17 @@ const ChooseWorkflowFromExisting: React.FC<ChooseWorkflowFromExistingProps> = ({
const [deleteTemplate] = useMutation(DELETE_WORKFLOW_TEMPLATE, { const [deleteTemplate] = useMutation(DELETE_WORKFLOW_TEMPLATE, {
refetchQueries: [ refetchQueries: [
{ {
query: LIST_MANIFEST_TEMPLATE, query: GET_MANIFEST_TEMPLATE,
variables: { data: getProjectID() }, variables: { projectID: getProjectID() },
}, },
], ],
}); });
const filteredExistingWorkflows: ListManifestTemplateArray[] = templateData const filteredExistingWorkflows = templateData
? templateData.ListManifestTemplate.filter( ? templateData.listWorkflowManifests.filter(
(w: ListManifestTemplateArray) => { (w: GetManifestTemplateArray) => {
if (search === null) return w; if (search === null) return w;
if (w.template_name.toLowerCase().includes(search.toLowerCase())) if (w.templateName.toLowerCase().includes(search.toLowerCase()))
return w; return w;
return null; return null;
} }
@ -81,7 +81,7 @@ const ChooseWorkflowFromExisting: React.FC<ChooseWorkflowFromExistingProps> = ({
}; };
selectedExp(selection.id); selectedExp(selection.id);
const templateData = filteredExistingWorkflows.filter((workflow) => { const templateData = filteredExistingWorkflows.filter((workflow) => {
return workflow.template_id === event.target.value; return workflow.templateID === event.target.value;
})[0]; })[0];
workflowAction.setWorkflowManifest({ workflowAction.setWorkflowManifest({
isCustomWorkflow: templateData.isCustomWorkflow, isCustomWorkflow: templateData.isCustomWorkflow,
@ -114,22 +114,22 @@ const ChooseWorkflowFromExisting: React.FC<ChooseWorkflowFromExistingProps> = ({
> >
{filteredExistingWorkflows && filteredExistingWorkflows.length ? ( {filteredExistingWorkflows && filteredExistingWorkflows.length ? (
filteredExistingWorkflows.map( filteredExistingWorkflows.map(
(templateData: ListManifestTemplateArray) => ( (templateData: GetManifestTemplateArray) => (
<LitmusCard <LitmusCard
width="100%" width="100%"
height="5rem" height="5rem"
key={templateData.template_id} key={templateData.templateID}
borderColor={palette.border.main} borderColor={palette.border.main}
className={classes.existingWorkflowCard} className={classes.existingWorkflowCard}
> >
<RadioButton value={templateData.template_id.toString()}> <RadioButton value={templateData.templateID.toString()}>
<div id="body"> <div id="body">
<div id="left-div"> <div id="left-div">
<Typography>{templateData.template_name}</Typography> <Typography>{templateData.templateName}</Typography>
</div> </div>
<div id="right-div"> <div id="right-div">
<Typography> <Typography>
{templateData.template_description} {templateData.templateDescription}
</Typography> </Typography>
</div> </div>
<div id="last-div"> <div id="last-div">
@ -138,7 +138,7 @@ const ChooseWorkflowFromExisting: React.FC<ChooseWorkflowFromExistingProps> = ({
src="./icons/litmus-icon.svg" src="./icons/litmus-icon.svg"
alt="Experiment Icon" alt="Experiment Icon"
/> />
<Typography>{templateData.project_name}</Typography> <Typography>{templateData.projectName}</Typography>
</div> </div>
<img <img
@ -152,7 +152,7 @@ const ChooseWorkflowFromExisting: React.FC<ChooseWorkflowFromExistingProps> = ({
deleteTemplate({ deleteTemplate({
variables: { variables: {
projectID: getProjectID(), projectID: getProjectID(),
data: templateData.template_id, data: templateData.templateID,
}, },
}); });
}} }}

View File

@ -18,7 +18,7 @@ const SelectMyHub = () => {
// Get all MyHubs with status // Get all MyHubs with status
const { data } = useQuery<HubStatus>(GET_HUB_STATUS, { const { data } = useQuery<HubStatus>(GET_HUB_STATUS, {
variables: { data: selectedProjectID }, variables: { projectID: selectedProjectID },
fetchPolicy: 'cache-and-network', fetchPolicy: 'cache-and-network',
}); });
@ -38,25 +38,25 @@ const SelectMyHub = () => {
}; };
useEffect(() => { useEffect(() => {
if (data?.getHubStatus !== undefined) { if (data?.listHubStatus !== undefined) {
if (data.getHubStatus.length) { if (data.listHubStatus.length) {
const hubDetails: MyHubDetail[] = []; const hubDetails: MyHubDetail[] = [];
data.getHubStatus.forEach((hub) => { data.listHubStatus.forEach((hub) => {
/** /**
* Push only available hubs * Push only available hubs
*/ */
if (hub.IsAvailable) { if (hub.isAvailable) {
hubDetails.push({ hubDetails.push({
id: hub.id, id: hub.id,
HubName: hub.HubName, hubName: hub.hubName,
RepoBranch: hub.RepoBranch, repoBranch: hub.repoBranch,
RepoURL: hub.RepoURL, repoURL: hub.repoURL,
}); });
} }
}); });
setAvailableHubs(hubDetails); setAvailableHubs(hubDetails);
data.getHubStatus.forEach((hubData) => { data.listHubStatus.forEach((hubData) => {
if (hubData.HubName.toLowerCase() === 'litmus chaoshub') { if (hubData.hubName.toLowerCase() === 'litmus chaoshub') {
setSelectedHub('Litmus ChaosHub'); setSelectedHub('Litmus ChaosHub');
localforage.setItem('selectedHub', 'Litmus ChaosHub'); localforage.setItem('selectedHub', 'Litmus ChaosHub');
localforage.setItem('hasSetWorkflowData', false); localforage.setItem('hasSetWorkflowData', false);
@ -85,11 +85,11 @@ const SelectMyHub = () => {
> >
{availableHubs.map((hubs) => ( {availableHubs.map((hubs) => (
<MenuItem <MenuItem
key={hubs.HubName} key={hubs.hubName}
data-cy="hubOption" data-cy="hubOption"
value={hubs.HubName} value={hubs.hubName}
> >
{hubs.HubName} {hubs.hubName}
</MenuItem> </MenuItem>
))} ))}
</Select> </Select>

View File

@ -47,7 +47,7 @@ const ChoosePreDefinedExperiments: React.FC<ChoosePreDefinedExperimentsProps> =
// Get all MyHubs with status // Get all MyHubs with status
const { data } = useQuery<HubStatus>(GET_HUB_STATUS, { const { data } = useQuery<HubStatus>(GET_HUB_STATUS, {
variables: { data: selectedProjectID }, variables: { projectID: selectedProjectID },
fetchPolicy: 'cache-and-network', fetchPolicy: 'cache-and-network',
}); });
@ -57,8 +57,8 @@ const ChoosePreDefinedExperiments: React.FC<ChoosePreDefinedExperimentsProps> =
const [getPredefinedWorkflow] = useLazyQuery(GET_PREDEFINED_WORKFLOW_LIST, { const [getPredefinedWorkflow] = useLazyQuery(GET_PREDEFINED_WORKFLOW_LIST, {
fetchPolicy: 'network-only', fetchPolicy: 'network-only',
onCompleted: (data) => { onCompleted: (data) => {
if (data.GetPredefinedWorkflowList !== undefined) { if (data.listPredefinedWorkflows !== undefined) {
setWorkflowlist(data.GetPredefinedWorkflowList); setWorkflowlist(data.listPredefinedWorkflows);
} }
}, },
onError: () => { onError: () => {
@ -98,8 +98,8 @@ const ChoosePreDefinedExperiments: React.FC<ChoosePreDefinedExperimentsProps> =
setSelectedHub(event.target.value as string); setSelectedHub(event.target.value as string);
getPredefinedWorkflow({ getPredefinedWorkflow({
variables: { variables: {
hubname: event.target.value as string, hubName: event.target.value as string,
projectid: selectedProjectID, projectID: selectedProjectID,
}, },
}); });
localforage.setItem('selectedHub', event.target.value as string); localforage.setItem('selectedHub', event.target.value as string);
@ -110,32 +110,32 @@ const ChoosePreDefinedExperiments: React.FC<ChoosePreDefinedExperimentsProps> =
* fetch the pre-defined workflows * fetch the pre-defined workflows
*/ */
useEffect(() => { useEffect(() => {
if (data?.getHubStatus !== undefined) { if (data?.listHubStatus !== undefined) {
if (data.getHubStatus.length) { if (data.listHubStatus.length) {
const hubDetails: MyHubDetail[] = []; const hubDetails: MyHubDetail[] = [];
data.getHubStatus.forEach((hub) => { data.listHubStatus.forEach((hub) => {
/** /**
* Push only available hub * Push only available hub
*/ */
if (hub.IsAvailable) { if (hub.isAvailable) {
hubDetails.push({ hubDetails.push({
id: hub.id, id: hub.id,
HubName: hub.HubName, hubName: hub.hubName,
RepoBranch: hub.RepoBranch, repoBranch: hub.repoBranch,
RepoURL: hub.RepoURL, repoURL: hub.repoURL,
}); });
} }
}); });
setAvailableHubs(hubDetails); setAvailableHubs(hubDetails);
} }
data.getHubStatus.forEach((hubData) => { data.listHubStatus.forEach((hubData) => {
if (hubData.HubName.toLowerCase() === 'litmus chaoshub') { if (hubData.hubName.toLowerCase() === 'litmus chaoshub') {
setSelectedHub('Litmus ChaosHub'); setSelectedHub('Litmus ChaosHub');
localforage.setItem('selectedHub', 'Litmus ChaosHub'); localforage.setItem('selectedHub', 'Litmus ChaosHub');
getPredefinedWorkflow({ getPredefinedWorkflow({
variables: { variables: {
hubname: 'Litmus ChaosHub', hubName: 'Litmus ChaosHub',
projectid: selectedProjectID, projectID: selectedProjectID,
}, },
}); });
} }
@ -163,9 +163,9 @@ const ChoosePreDefinedExperiments: React.FC<ChoosePreDefinedExperimentsProps> =
MenuProps={MenuProps} MenuProps={MenuProps}
> >
{availableHubs.map((hubs) => ( {availableHubs.map((hubs) => (
<MenuItem key={hubs.HubName} value={hubs.HubName}> <MenuItem key={hubs.hubName} value={hubs.hubName}>
<Typography data-cy="PreDefinedHubOption"> <Typography data-cy="PreDefinedHubOption">
{hubs.HubName} {hubs.hubName}
</Typography> </Typography>
</MenuItem> </MenuItem>
))} ))}

View File

@ -181,7 +181,7 @@ const ScheduleWorkflow = forwardRef((_, ref) => {
newParsedYaml.metadata.name = fetchWorkflowNameFromManifest(manifest); newParsedYaml.metadata.name = fetchWorkflowNameFromManifest(manifest);
newParsedYaml.metadata.namespace = namespace; newParsedYaml.metadata.namespace = namespace;
newParsedYaml.metadata.labels = { newParsedYaml.metadata.labels = {
workflow_id: workflowData.workflow_id, workflow_id: workflowData.workflowID,
}; };
newParsedYaml.spec.workflowSpec = oldParsedYaml.spec; newParsedYaml.spec.workflowSpec = oldParsedYaml.spec;
const tz = { const tz = {
@ -207,7 +207,7 @@ const ScheduleWorkflow = forwardRef((_, ref) => {
newParsedYaml.metadata.namespace = namespace; newParsedYaml.metadata.namespace = namespace;
newParsedYaml.spec = oldParsedYaml.spec.workflowSpec; newParsedYaml.spec = oldParsedYaml.spec.workflowSpec;
newParsedYaml.metadata.labels = { newParsedYaml.metadata.labels = {
workflow_id: workflowData.workflow_id, workflow_id: workflowData.workflowID,
}; };
NewYaml = YAML.stringify(newParsedYaml); NewYaml = YAML.stringify(newParsedYaml);
workflow.setWorkflowManifest({ workflow.setWorkflowManifest({
@ -225,7 +225,7 @@ const ScheduleWorkflow = forwardRef((_, ref) => {
delete newParsedYaml.metadata.generateName; delete newParsedYaml.metadata.generateName;
newParsedYaml.metadata.name = fetchWorkflowNameFromManifest(manifest); newParsedYaml.metadata.name = fetchWorkflowNameFromManifest(manifest);
newParsedYaml.metadata.namespace = namespace; newParsedYaml.metadata.namespace = namespace;
newParsedYaml.metadata.labels = { workflow_id: workflowData.workflow_id }; newParsedYaml.metadata.labels = { workflow_id: workflowData.workflowID };
const tz = { const tz = {
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC', timezone: Intl.DateTimeFormat().resolvedOptions().timeZone || 'UTC',
}; };

View File

@ -1,3 +1,4 @@
import { useSubscription } from '@apollo/client';
import { import {
Button, Button,
Checkbox, Checkbox,
@ -9,23 +10,16 @@ import {
Typography, Typography,
useTheme, useTheme,
} from '@material-ui/core'; } from '@material-ui/core';
import React, { useEffect, useState } from 'react'; import { Autocomplete } from '@material-ui/lab';
import { InputField } from 'litmus-ui';
import ToggleButton from '@material-ui/lab/ToggleButton'; import ToggleButton from '@material-ui/lab/ToggleButton';
import ToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup'; import ToggleButtonGroup from '@material-ui/lab/ToggleButtonGroup';
import YAML from 'yaml'; import { InputField } from 'litmus-ui';
import { useSelector } from 'react-redux'; import React, { useEffect, useState } from 'react';
import { useSubscription } from '@apollo/client';
import { Autocomplete } from '@material-ui/lab';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import useStyles from './styles'; import { useSelector } from 'react-redux';
import * as WorkflowActions from '../../../../redux/actions/workflow'; import YAML from 'yaml';
import { import { constants } from '../../../../constants';
WorkflowData, import { KUBE_OBJ } from '../../../../graphql';
WorkflowManifest,
} from '../../../../models/redux/workflow';
import { RootState } from '../../../../redux/reducers';
import useActions from '../../../../redux/actions';
import { import {
GVRRequest, GVRRequest,
KubeObjData, KubeObjData,
@ -33,9 +27,15 @@ import {
KubeObjResource, KubeObjResource,
KubeObjResponse, KubeObjResponse,
} from '../../../../models/graphql/createWorkflowData'; } from '../../../../models/graphql/createWorkflowData';
import { KUBE_OBJ } from '../../../../graphql'; import {
import { constants } from '../../../../constants'; WorkflowData,
WorkflowManifest,
} from '../../../../models/redux/workflow';
import useActions from '../../../../redux/actions';
import * as WorkflowActions from '../../../../redux/actions/workflow';
import { RootState } from '../../../../redux/reducers';
import { gvrData } from './data'; import { gvrData } from './data';
import useStyles from './styles';
interface AppInfoData { interface AppInfoData {
namespace: string; namespace: string;
@ -71,7 +71,7 @@ const TargetApplication: React.FC<TargetApplicationProp> = ({ gotoStep }) => {
const workflowData: WorkflowData = useSelector( const workflowData: WorkflowData = useSelector(
(state: RootState) => state.workflowData (state: RootState) => state.workflowData
); );
const { clusterid } = workflowData; const { clusterID } = workflowData;
const engineManifest = YAML.parse(manifest.engineYAML); const engineManifest = YAML.parse(manifest.engineYAML);
/** /**
@ -161,10 +161,10 @@ const TargetApplication: React.FC<TargetApplicationProp> = ({ gotoStep }) => {
*/ */
const { data } = useSubscription<KubeObjResponse, KubeObjRequest>(KUBE_OBJ, { const { data } = useSubscription<KubeObjResponse, KubeObjRequest>(KUBE_OBJ, {
variables: { variables: {
data: { request: {
cluster_id: clusterid, clusterID,
object_type: 'kubeobject', objectType: 'kubeobject',
kube_obj_request: { kubeObjRequest: {
group: GVRObj.group, group: GVRObj.group,
version: GVRObj.version, version: GVRObj.version,
resource: GVRObj.resource, resource: GVRObj.resource,
@ -184,7 +184,7 @@ const TargetApplication: React.FC<TargetApplicationProp> = ({ gotoStep }) => {
/** /**
* Parse the kubeObject data * Parse the kubeObject data
*/ */
const kubeData: KubeObjData[] = JSON.parse(data.getKubeObject.kube_obj); const kubeData: KubeObjData[] = JSON.parse(data.getKubeObject.kubeObj);
kubeData.forEach((obj: KubeObjData) => { kubeData.forEach((obj: KubeObjData) => {
const applabels: string[] = []; const applabels: string[] = [];
if (obj.data != null) { if (obj.data != null) {

View File

@ -145,10 +145,10 @@ const TuneWorkflow = forwardRef((_, ref) => {
const [getCharts] = useLazyQuery<Charts>(GET_CHARTS_DATA, { const [getCharts] = useLazyQuery<Charts>(GET_CHARTS_DATA, {
onCompleted: (data) => { onCompleted: (data) => {
const allExp: ChartName[] = []; const allExp: ChartName[] = [];
data.getCharts.forEach((data) => { data.listCharts.forEach((data) => {
return data.Spec.Experiments?.forEach((experiment) => { return data.spec.experiments?.forEach((experiment) => {
allExp.push({ allExp.push({
ChaosName: data.Metadata.Name, ChaosName: data.metadata.name,
ExperimentName: experiment, ExperimentName: experiment,
}); });
}); });
@ -166,7 +166,7 @@ const TuneWorkflow = forwardRef((_, ref) => {
{ {
onCompleted: (data) => { onCompleted: (data) => {
const wfmanifest = updateEngineName( const wfmanifest = updateEngineName(
YAML.parse(data.GetPredefinedExperimentYAML) YAML.parse(data.getPredefinedExperimentYAML)
); );
const updatedManifestImage = updateManifestImage( const updatedManifestImage = updateManifestImage(
YAML.parse(wfmanifest), YAML.parse(wfmanifest),
@ -189,7 +189,7 @@ const TuneWorkflow = forwardRef((_, ref) => {
*/ */
const [getTemplate] = useLazyQuery(GET_TEMPLATE_BY_ID, { const [getTemplate] = useLazyQuery(GET_TEMPLATE_BY_ID, {
onCompleted: (data) => { onCompleted: (data) => {
const parsedYAML = YAML.parse(data.GetTemplateManifestByID.manifest); const parsedYAML = YAML.parse(data.getWorkflowManifestByID.manifest);
const updatedManifestImage = updateManifestImage( const updatedManifestImage = updateManifestImage(
parsedYAML, parsedYAML,
@ -308,12 +308,12 @@ const TuneWorkflow = forwardRef((_, ref) => {
localforage.getItem('selectedHub').then((hub) => { localforage.getItem('selectedHub').then((hub) => {
getPredefinedExperimentYaml({ getPredefinedExperimentYaml({
variables: { variables: {
experimentInput: { request: {
ProjectID: selectedProjectID, projectID: selectedProjectID,
ChartName: 'predefined', chartName: 'predefined',
ExperimentName: (value as WorkflowDetailsProps).CRDLink, experimentName: (value as WorkflowDetailsProps).CRDLink,
HubName: hub as string, hubName: hub as string,
FileType: 'WORKFLOW', fileType: 'WORKFLOW',
}, },
}, },
}); });
@ -330,7 +330,7 @@ const TuneWorkflow = forwardRef((_, ref) => {
getTemplate({ getTemplate({
variables: { variables: {
projectID: getProjectID(), projectID: getProjectID(),
data: (value as ChooseWorkflowRadio).id, templateID: (value as ChooseWorkflowRadio).id,
}, },
}); });
} }
@ -340,7 +340,7 @@ const TuneWorkflow = forwardRef((_, ref) => {
localforage.getItem('selectedHub').then((hub) => { localforage.getItem('selectedHub').then((hub) => {
setHubName(hub as string); setHubName(hub as string);
getCharts({ getCharts({
variables: { projectID: selectedProjectID, HubName: hub as string }, variables: { projectID: selectedProjectID, hubName: hub as string },
}); });
}); });
} }
@ -377,23 +377,23 @@ const TuneWorkflow = forwardRef((_, ref) => {
const handleDone = () => { const handleDone = () => {
getExperimentYaml({ getExperimentYaml({
variables: { variables: {
experimentInput: { request: {
ProjectID: selectedProjectID, projectID: selectedProjectID,
HubName: hubName, hubName,
ChartName: selectedExp.split('/')[0], chartName: selectedExp.split('/')[0],
ExperimentName: selectedExp.split('/')[1], experimentName: selectedExp.split('/')[1],
FileType: 'EXPERIMENT', fileType: 'EXPERIMENT',
}, },
}, },
}); });
getEngineYaml({ getEngineYaml({
variables: { variables: {
experimentInput: { request: {
ProjectID: selectedProjectID, projectID: selectedProjectID,
HubName: hubName, hubName,
ChartName: selectedExp.split('/')[0], chartName: selectedExp.split('/')[0],
ExperimentName: selectedExp.split('/')[1], experimentName: selectedExp.split('/')[1],
FileType: 'ENGINE', fileType: 'ENGINE',
}, },
}, },
}); });

View File

@ -20,7 +20,7 @@ import YamlEditor from '../../../components/YamlEditor/Editor';
import { parseYamlValidations } from '../../../components/YamlEditor/Validations'; import { parseYamlValidations } from '../../../components/YamlEditor/Validations';
import { CREATE_WORKFLOW } from '../../../graphql'; import { CREATE_WORKFLOW } from '../../../graphql';
import { import {
CreateWorkFlowInput, CreateWorkFlowRequest,
CreateWorkflowResponse, CreateWorkflowResponse,
WeightMap, WeightMap,
} from '../../../models/graphql/createWorkflowData'; } from '../../../models/graphql/createWorkflowData';
@ -90,7 +90,7 @@ const VerifyCommit = forwardRef(
(state: RootState) => state.workflowData (state: RootState) => state.workflowData
); );
const { clusterid, cronSyntax, clustername } = workflowData; const { clusterID, cronSyntax, clusterName } = workflowData;
const { manifest, isCustomWorkflow, isUploaded } = useSelector( const { manifest, isCustomWorkflow, isUploaded } = useSelector(
(state: RootState) => state.workflowManifest (state: RootState) => state.workflowManifest
@ -226,7 +226,7 @@ const VerifyCommit = forwardRef(
// Create Workflow Mutation // Create Workflow Mutation
const [createChaosWorkFlow, { loading, error: workflowError }] = const [createChaosWorkFlow, { loading, error: workflowError }] =
useMutation<CreateWorkflowResponse, CreateWorkFlowInput>( useMutation<CreateWorkflowResponse, CreateWorkFlowRequest>(
CREATE_WORKFLOW, CREATE_WORKFLOW,
{ {
onError: () => { onError: () => {
@ -246,7 +246,7 @@ const VerifyCommit = forwardRef(
weights.forEach((data) => { weights.forEach((data) => {
weightData.push({ weightData.push({
experiment_name: data.experimentName, experimentName: data.experimentName,
weightage: data.weight, weightage: data.weight,
}); });
}); });
@ -261,17 +261,17 @@ const VerifyCommit = forwardRef(
const yamlJson = JSON.stringify(updatedYaml, null, 2); // Converted to Stringified JSON const yamlJson = JSON.stringify(updatedYaml, null, 2); // Converted to Stringified JSON
const chaosWorkFlowInputs = { const chaosWorkFlowInputs = {
workflow_manifest: yamlJson, workflowManifest: yamlJson,
cronSyntax, cronSyntax,
workflow_name: fetchWorkflowNameFromManifest(manifest), workflowName: fetchWorkflowNameFromManifest(manifest),
workflow_description: workflow.description, workflowDescription: workflow.description,
isCustomWorkflow, isCustomWorkflow,
weightages: weightData, weightages: weightData,
project_id: getProjectID(), projectID: getProjectID(),
cluster_id: clusterid, clusterID,
}; };
createChaosWorkFlow({ createChaosWorkFlow({
variables: { ChaosWorkFlowInput: chaosWorkFlowInputs }, variables: { request: chaosWorkFlowInputs },
}); });
} }
}; };
@ -415,7 +415,7 @@ const VerifyCommit = forwardRef(
</Typography> </Typography>
<Typography className={classes.right}> <Typography className={classes.right}>
{clustername} {clusterName}
</Typography> </Typography>
</div> </div>
<div className={classes.itemWrapper}> <div className={classes.itemWrapper}>

View File

@ -66,12 +66,12 @@ const WorkflowSettings = forwardRef((_, ref) => {
fetchPolicy: 'cache-and-network', fetchPolicy: 'cache-and-network',
onCompleted: (data) => { onCompleted: (data) => {
if (data.getHubExperiment !== undefined) { if (data.getHubExperiment !== undefined) {
setName(data.getHubExperiment.Metadata.Name.toLowerCase()); setName(data.getHubExperiment.metadata.name.toLowerCase());
setDescription(data.getHubExperiment.Spec.CategoryDescription); setDescription(data.getHubExperiment.spec.categoryDescription);
setIcon( setIcon(
`${config.grahqlEndpoint}/icon/${projectID}/${hubName}/predefined/${data.getHubExperiment.Metadata.Name}.png` `${config.grahqlEndpoint}/icon/${projectID}/${hubName}/predefined/${data.getHubExperiment.metadata.name}.png`
); );
setCRDLink(data.getHubExperiment.Metadata.Name); setCRDLink(data.getHubExperiment.metadata.name);
} }
}, },
} }
@ -80,12 +80,12 @@ const WorkflowSettings = forwardRef((_, ref) => {
const [getSavedTemplateDetails] = useLazyQuery(GET_TEMPLATE_BY_ID, { const [getSavedTemplateDetails] = useLazyQuery(GET_TEMPLATE_BY_ID, {
fetchPolicy: 'network-only', fetchPolicy: 'network-only',
onCompleted: (data) => { onCompleted: (data) => {
if (data.GetTemplateManifestByID !== undefined) { if (data.getWorkflowManifestByID !== undefined) {
setName(data.GetTemplateManifestByID.template_name); setName(data.getWorkflowManifestByID.templateName);
setDescription(data.GetTemplateManifestByID.template_description); setDescription(data.getWorkflowManifestByID.templateDescription);
setIcon('./avatars/litmus.svg'); setIcon('./avatars/litmus.svg');
setCRDLink(data.GetTemplateManifestByID.template_id); setCRDLink(data.getWorkflowManifestByID.template_id);
const savedTemplate = data.GetTemplateManifestByID.manifest; const savedTemplate = data.getWorkflowManifestByID.manifest;
if (parsed(savedTemplate).length === 0) { if (parsed(savedTemplate).length === 0) {
workflowAction.setWorkflowManifest({ workflowAction.setWorkflowManifest({
manifest: savedTemplate, manifest: savedTemplate,
@ -144,12 +144,12 @@ const WorkflowSettings = forwardRef((_, ref) => {
setHubName(hub as string); setHubName(hub as string);
getWorkflowDetails({ getWorkflowDetails({
variables: { variables: {
data: { request: {
HubName: hub as string, hubName: hub as string,
ProjectID: projectID, projectID,
ChartName: 'predefined', chartName: 'predefined',
ExperimentName: (value as ChooseWorkflowRadio).id, experimentName: (value as ChooseWorkflowRadio).id,
FileType: 'CSV', fileType: 'CSV',
}, },
}, },
}); });
@ -161,7 +161,7 @@ const WorkflowSettings = forwardRef((_, ref) => {
getSavedTemplateDetails({ getSavedTemplateDetails({
variables: { variables: {
projectID: getProjectID(), projectID: getProjectID(),
data: (value as ChooseWorkflowRadio).id, templateID: (value as ChooseWorkflowRadio).id,
}, },
}); });
setDisplayRegChange(true); setDisplayRegChange(true);

View File

@ -72,7 +72,7 @@ const WorkflowRunCard: React.FC<WorkflowRunCardProps> = ({ data }) => {
}); });
history.push({ history.push({
pathname: `/workflows/${data.workflow_run_id}`, pathname: `/workflows/${data.workflowRunID}`,
search: `?projectID=${projectID}&projectRole=${projectRole}`, search: `?projectID=${projectID}&projectRole=${projectRole}`,
}); });
}} }}
@ -93,10 +93,10 @@ const WorkflowRunCard: React.FC<WorkflowRunCardProps> = ({ data }) => {
<Typography <Typography
className={`${classes.testName} ${classes.noWrapProvider}`} className={`${classes.testName} ${classes.noWrapProvider}`}
> >
{data.workflow_name} {data.workflowName}
</Typography> </Typography>
<Typography className={classes.hint}> <Typography className={classes.hint}>
{data.cluster_name} {data.clusterName}
</Typography> </Typography>
</div> </div>
</div> </div>
@ -109,12 +109,12 @@ const WorkflowRunCard: React.FC<WorkflowRunCardProps> = ({ data }) => {
)} )}
</Typography> </Typography>
<Typography <Typography
className={getResiliencyScoreVariant(data.resiliency_score ?? 0)} className={getResiliencyScoreVariant(data.resiliencyScore ?? 0)}
> >
{data.resiliency_score === undefined || {data.resiliencyScore === undefined ||
data.resiliency_score === null data.resiliencyScore === null
? 'NA' ? 'NA'
: `${data.resiliency_score}%`} : `${data.resiliencyScore}%`}
</Typography> </Typography>
</div> </div>
@ -127,7 +127,7 @@ const WorkflowRunCard: React.FC<WorkflowRunCardProps> = ({ data }) => {
<Typography <Typography
className={`${classes.noWrapProvider} ${classes.lastRunTime}`} className={`${classes.noWrapProvider} ${classes.lastRunTime}`}
> >
{timeDifferenceForDate(data.last_updated)} {timeDifferenceForDate(data.lastUpdated)}
</Typography> </Typography>
</div> </div>
</div> </div>

View File

@ -13,7 +13,7 @@ import { WORKFLOW_DETAILS } from '../../../graphql';
import { Role } from '../../../models/graphql/user'; import { Role } from '../../../models/graphql/user';
import { import {
Workflow, Workflow,
WorkflowDataVars, WorkflowDataRequest,
} from '../../../models/graphql/workflowData'; } from '../../../models/graphql/workflowData';
import useActions from '../../../redux/actions'; import useActions from '../../../redux/actions';
import * as TabActions from '../../../redux/actions/tabs'; import * as TabActions from '../../../redux/actions/tabs';
@ -50,12 +50,12 @@ const AgentConfiguredHome: React.FC<AgentConfiguredHomeProps> = ({
setModalOpen(true); setModalOpen(true);
}; };
const { data, loading, error } = useQuery<Workflow, WorkflowDataVars>( const { data, loading, error } = useQuery<Workflow, WorkflowDataRequest>(
WORKFLOW_DETAILS, WORKFLOW_DETAILS,
{ {
variables: { variables: {
workflowRunsInput: { request: {
project_id: projectID, projectID,
pagination: { pagination: {
page: 0, page: 0,
limit: 3, limit: 3,
@ -66,7 +66,7 @@ const AgentConfiguredHome: React.FC<AgentConfiguredHomeProps> = ({
} }
); );
const workflowRunCount = data?.getWorkflowRuns.total_no_of_workflow_runs ?? 0; const workflowRunCount = data?.listWorkflowRuns.totalNoOfWorkflowRuns ?? 0;
if (error) { if (error) {
console.error('Error fetching Workflow Data'); console.error('Error fetching Workflow Data');
@ -112,9 +112,9 @@ const AgentConfiguredHome: React.FC<AgentConfiguredHomeProps> = ({
'homeViews.agentConfiguredHome.recentWorkflowRuns.schedule' 'homeViews.agentConfiguredHome.recentWorkflowRuns.schedule'
)} )}
> >
{data?.getWorkflowRuns.workflow_runs.map((workflow) => { {data?.listWorkflowRuns.workflowRuns.map((workflow) => {
return ( return (
<WorkflowRunCard key={workflow.workflow_run_id} data={workflow} /> <WorkflowRunCard key={workflow.workflowRunID} data={workflow} />
); );
})} })}
</RecentOverviewContainer> </RecentOverviewContainer>
@ -195,7 +195,7 @@ const AgentConfiguredHome: React.FC<AgentConfiguredHomeProps> = ({
/> />
{/* Project Level info container */} {/* Project Level info container */}
{projectRole === Role.owner && <ProjectInfoContainer />} {projectRole === Role.OWNER && <ProjectInfoContainer />}
</div> </div>
); );
}; };

View File

@ -13,7 +13,7 @@ const LandingHome: React.FC = () => {
{/* Agent Deployment Container */} {/* Agent Deployment Container */}
<UnconfiguredAgent /> <UnconfiguredAgent />
{/* Project Level info container */} {/* Project Level info container */}
{projectRole === Role.owner && <ProjectInfoContainer />} {projectRole === Role.OWNER && <ProjectInfoContainer />}
</div> </div>
); );
}; };

Some files were not shown because too many files have changed in this diff Show More