Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions forms.go
Original file line number Diff line number Diff line change
Expand Up @@ -1874,15 +1874,15 @@ func GetJobSubDocTypes() ([]string, error) {
func GetProcessQualifiers() ([]string, error) {
processQualifiers = make([]string, 0)
cluster := GetConnection(GetCBCredentials())
query := "SELECT DISTINCT model FROM vxdata._default.RUNTIME WHERE docType = 'ingest' AND subType = 'MODEL'"
query := "SELECT DISTINCT SPLIT(id, '':')[4] AS model_type FROM vxdata._default.RUNTIME WHERE docType = 'ingest' AND subType = 'MODEL';"
result, err := cluster.Query(query, &gocb.QueryOptions{})
if err != nil {
return nil, err
}
for result.Next() {
var row map[string]interface{}
if err := result.Row(&row); err == nil {
if v, ok := row["model"].(string); ok {
if v, ok := row["model_type"].(string); ok {
processQualifiers = append(processQualifiers, fmt.Sprintf("%v", v))
}
}
Expand Down Expand Up @@ -2035,13 +2035,13 @@ func GetAssociatedSpecIds(id string) ([]string, error) {
switch documentType {
case "DS":
// data source
query = fmt.Sprintf("SELECT id FROM vxdata._default.RUNTIME WHERE type = 'PS' AND dataSourceId = '%s' ORDER BY meta().id", id)
query = fmt.Sprintf("SELECT id FROM vxdata._default.RUNTIME WHERE type = 'PS' AND (dataSourceId = '%s' OR ARRAY_CONTAINS(dataSourceIds, '%s')) ORDER BY meta().id", id, id)
case "IS":
// ingest documents have no associated ids
return nil, nil
case "PS":
// process spec
query = fmt.Sprintf("SELECT meta().id FROM vxdata._default.RUNTIME WHERE type = 'DS' and ARRAY_CONTAINS(processSpecIds, '%s') ORDER BY meta().id", id)
query = fmt.Sprintf("SELECT META().id FROM vxdata._default.RUNTIME WHERE type = 'DS' AND (processSpecIds='%s' OR ARRAY_CONTAINS(processSpecIds, '%s')) ORDER BY META().id", id, id)
case "JS":
// job specification documents have no associated ids
return nil, nil
Expand Down
8 changes: 7 additions & 1 deletion jobSet.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ func CreateJobSetFromId(jobID, filePattern, fileMask, sourceDataURI, durationDay
// iterate through the results and change each occurrence of the modelComponent in the document to the new jobID's modelComponent
// change any occurrence of the modelComponent in the document to the new jobID's modelComponent
newJobset = strings.ReplaceAll(string(baseModelJobset), ":"+baseModelComponent+":", ":"+newModelComponent+":")
// unmarshal the new jobset string back to a map
var newJobsetMap map[string]interface{}
err = json.Unmarshal([]byte(newJobset), &newJobsetMap)
if err != nil {
Expand All @@ -245,8 +244,15 @@ func CreateJobSetFromId(jobID, filePattern, fileMask, sourceDataURI, durationDay
// Define function to recursively iterate through the newJobsetMap to commit nested documents
var updateNestedFields func(interface{})
updateNestedFields = func(node interface{}) {
if nodeMap, ok := node.(map[string]interface{}); ok {
if _, exists := nodeMap["qualifier"]; exists {
nodeMap["qualifier"] = newModelComponent
}
}
switch v := node.(type) {
case map[string]interface{}:
// update the qualifier value if it exists with the value of newModelComponent
// i.e. replace any occurrence of "qualifier": "RRFSv2_conus_3km" with "qualifier": "RRFSv2_conus_3km_ret_test4_may2024"
// Update specific fields if they exist in type "DS" documents
value, exists := v["type"]
if exists && value == "DS" {
Expand Down
9 changes: 7 additions & 2 deletions static/js/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -937,8 +937,13 @@ function applyPreviewToForm(tree) {
document.querySelectorAll(".btn-checkmark").forEach(function (btn) {
btn.disabled = false;
});
// Disable the preview button since changes have been applied
document.querySelector('button[id="previewButton"]').disabled = true;
// Enable the preview button since changes have been applied
document.querySelector('button[id="previewButton"]').disabled = false;
// Disable the viewJobBtn button since changes have been applied
viewJobButton = document.querySelector('button[id="viewJobBtn"]');
if (viewJobButton) {
viewJobButton.disabled = true;
}
}

function clearSpecIds() {
Expand Down
4 changes: 4 additions & 0 deletions static/js/indexPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ function commitJobSet() {
}

async function viewAssociatedJobSet() {
if (!document.getElementById("acceptButton").disabled) {
alert("Please click 'Accept All' to apply all changes before viewing the associated Job Set.");
return;
}
if (window.authenticatedRole != "vx") {
document.getElementById("jsonJobSetContent").classList.add("d-none");
document.getElementById("jsonJobSetContent").classList.remove("d-block");
Expand Down
Loading