Future _getWorkstationsHandler()

in server/lib/controllers/WorkstationsController.dart [96:121]


  Future<Response> _getWorkstationsHandler(Request request) async {
    try {
      String clusterName = request.params['clusterName']!;
      String configName = request.params['configName']!;
      String projectId = request.url.queryParameters['projectId']!;
      String region = request.url.queryParameters['region']!;


      List<Workstation> response = await _workstationsService.getWorkstations(projectId, clusterName, configName, region);

      if (response != null) {
        return Response.ok(
          jsonResponseEncode(response),
        );
      } else {
        return Response.internalServerError(
          body: jsonResponseEncode({"msg": "Failed to get workstations"}),
        );
      }
    } on Exception catch (e, stacktrace) {
      print("Exception occurred: $e stackTrace: $stacktrace");
      return Response.internalServerError(
        body: jsonResponseEncode({"msg": "Internal Server Error"}),
      );
    }
  }