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

Minor enhancement to OperationStack for readability #591

Open
MikeTschudi opened this issue Jul 30, 2021 · 0 comments
Open

Minor enhancement to OperationStack for readability #591

MikeTschudi opened this issue Jul 30, 2021 · 0 comments

Comments

@MikeTschudi
Copy link
Member

The start function in OperationStack is coded as

  start(type: string, params?: Record<string, unknown>): string {
    const op = {
      type,
      id: getWithDefault(params, "id", createId(`${type}_`)),
      inputs: getWithDefault(params, "inputs", {}),
      cleanup: getWithDefault(params, "cleanup", "n/a"),
      startedAt: new Date().getTime(),
      state: "working"
    } as IOperation;

    this.operations.push(op);
    return op.id;
  }

If it were to be reordered as

  start(type: string, params?: Record<string, unknown>): string {
    const op = {
      id: getWithDefault(params, "id", createId(`${type}_`)),
      type,
      inputs: getWithDefault(params, "inputs", {}),
      startedAt: new Date().getTime(),
      state: "working",
      cleanup: getWithDefault(params, "cleanup", "n/a")
    } as IOperation;

    this.operations.push(op);
    return op.id;
  }

then the structure would align with the structure produced by the startOperation function and make the results easier to read and process automatically.

Currently, the stack appears as
image

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

No branches or pull requests

1 participant