Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Spl2 fixes #89

Merged
merged 7 commits into from
Jun 30, 2023
Merged

Spl2 fixes #89

merged 7 commits into from
Jun 30, 2023

Conversation

fantavlik
Copy link
Collaborator

  • Provide better error handling and configurability for language server download and install by allowing user to specify custom path to LSP file

  • Fix issue with progress bars getting stuck

  • Allow users to input earliest and latest times
    Demo:
    spl2-earliest-latest

  • Serialize the format for SPL2 notebooks saved to disk to more closely match modules.json expectations, example:

{
  "modules": [
    {
      "name": "module1",
      "namespace": "",
      "definition": "$q1 = from _internal where log_level != \"ERROR\"",
      "_vscode": {
        "metadata": {
          "splunk": {
            "earliestTime": "-24h",
            "latestTime": "now"
          }
        },
        "outputs": []
      }
    },
    {
      "name": "module2",
      "namespace": "",
      "definition": " $q2 = from main",
      "_vscode": {
        "metadata": {
          "splunk": {
            "earliestTime": "@d",
            "latestTime": "now"
          }
        },
        "outputs": []
      }
    }
  ],
  "app": "apps.search"
}

@fantavlik fantavlik requested a review from JasonConger June 28, 2023 05:55
@@ -112,6 +123,64 @@ export async function addVisualizationPreference(
await controller.runCell(cell);
}

export async function enterEarliestTime(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: not a big deal at all, but these two functions seem to share logic. Totally ok to keep them this way if refactoring is pain.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually had the same thought and started to refactor it, but it ultimately only saved ~4 lines of code due to the multiple places where the two differ and ended up having a lot of indirection which made it harder to read so I reverted to this.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, then this is way better :) 4 lines ain't worth it

@@ -64,6 +91,11 @@ export class CellResultCountStatusBarProvider implements vscode.NotebookCellStat
"arguments": [cell]
}
});
// earliest and latest time pickers are only supported for SPL2 at the moment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this done in 2 places?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One is for the state when the job hasn't been run yet and the other is for the state where there are outputs from the job. There are a different set of icons for each.

Before:
image

After (with job details):
image

// TODO: Remove this hardcoded version/update time and check for updates
let lspVersion: string = '2.0.362'; // context.globalState.get(stateKeyLatestLspVersion) || "";
let latestLspVersion: string = '2.0.362'; // context.globalState.get(stateKeyLatestLspVersion) || "";
const lastUpdateMs: number = Date.now(); // context.globalState.get(stateKeyLastLspCheck) || 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be Date.now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is my way of turning the feature off for now until I have a chance to flesh out the issues I was seeing with retrieving the latest version from maven metdata, related to the TODO above

app: "apps.search",
};

let indx = 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index starts at 1?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I'm saving these as module1, module2, etc to be human readable.

@fantavlik fantavlik merged commit 22fbcca into splunk:spl2 Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants