Open Bug 1540610 Opened 5 years ago Updated 2 years ago

[remote-dbg-next] Move connection state of runtime to ui state

Categories

(DevTools :: about:debugging, enhancement, P3)

enhancement

Tracking

(Not tracked)

People

(Reporter: daisuke, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: remote-debugging-technical-debt)

This is a followup of bug 1505131.

In that bug, the runtime status has introduced the connection status that a flag which is connecting or not, error of connection, and a flag which is taking time for connection. However, we might better introduce those status as ui state not runtime state. In this bug, we discuss about this, and fix if needed.

Note: we need more discussion about how to exactly solve this.

Whiteboard: remote-debugging-technical-debt

While reviewing a patch that adds yet another of those flags, I think a good compromise would be to introduce a "connectionStatus" object on runtime objects, that would keep all the flags.

    runtimes.forEach(runtime => {
      const existingRuntime = findRuntimeById(runtime.id, getState().runtimes);
      const isConnectionValid = existingRuntime && existingRuntime.runtimeDetails &&
                                !existingRuntime.runtimeDetails.clientWrapper.isClosed();
      runtime.runtimeDetails = isConnectionValid ? existingRuntime.runtimeDetails : null;
      runtime.isConnecting = existingRuntime ? existingRuntime.isConnecting : false;
      runtime.isConnectionFailed =
        existingRuntime ? existingRuntime.isConnectionFailed : false;
      runtime.isConnectionNotResponding =
        existingRuntime ? existingRuntime.isConnectionNotResponding : false;
      runtime.isConnectionTimeout =
        existingRuntime ? existingRuntime.isConnectionTimeout : false;
    });

would become

    runtimes.forEach(runtime => {
      const existingRuntime = findRuntimeById(runtime.id, getState().runtimes);
      const isConnectionValid = existingRuntime && existingRuntime.runtimeDetails &&
                                !existingRuntime.runtimeDetails.clientWrapper.isClosed();
      runtime.runtimeDetails = isConnectionValid ? existingRuntime.runtimeDetails : null;
      runtime.connectionStatus = existingRuntime ? existingRuntime.connectionStatus : {};
    });

Or maybe instead of 4 boolean flags, we can have one field "connectionState" that can be either: ["CONNECTING", "NOT_RESPONDING", "TIMED_OUT", "FAILED"]. We could also add the two states "DISCONNECTED", "CONNECTED", but we infer those from runtime.runtimeDetails so they might be confusing without more refactor.

Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.