Some updates to the frontent
This commit is contained in:
@ -7,13 +7,15 @@ class EnvironmentLocalData {
|
||||
required this.serverLocation,
|
||||
required this.provider,
|
||||
required this.name,
|
||||
required this.description});
|
||||
required this.description,
|
||||
this.uuid});
|
||||
|
||||
final String name;
|
||||
final String description;
|
||||
final String provider;
|
||||
final String serverType;
|
||||
final String serverLocation;
|
||||
String? uuid;
|
||||
}
|
||||
|
||||
class EnvironmentsGrpc {
|
||||
@ -24,9 +26,9 @@ class EnvironmentsGrpc {
|
||||
EnvironmentsGrpc(channel) : envStub = EnvironmentsClient(channel);
|
||||
|
||||
// Get environments from the API
|
||||
Future<EnvironmentLocalData> get(String name, SoftplayerCreds creds) async {
|
||||
Future<EnvironmentLocalData> get(String uuid, SoftplayerCreds creds) async {
|
||||
final request = GetOptions(
|
||||
metadata: EnvironmentMetadata(name: name),
|
||||
id: EnvironmentId(uuid: uuid),
|
||||
ownerId: OwnerId(uuid: creds.uuid),
|
||||
token: Token(token: creds.token),
|
||||
);
|
||||
@ -34,6 +36,7 @@ class EnvironmentsGrpc {
|
||||
try {
|
||||
final response = await envStub.get(request);
|
||||
return EnvironmentLocalData(
|
||||
uuid: uuid,
|
||||
serverType: response.spec.serverType.toString(),
|
||||
serverLocation: response.spec.serverLocation.toString(),
|
||||
provider: response.spec.provider.toString(),
|
||||
@ -46,9 +49,7 @@ class EnvironmentsGrpc {
|
||||
|
||||
Future<EnvironmentLocalData> create(
|
||||
EnvironmentLocalData data, SoftplayerCreds creds) async {
|
||||
Location.values.forEach((element) => print(element.toString() + " - " + data.serverLocation));
|
||||
print(ServerType.values);
|
||||
|
||||
print(data);
|
||||
final request = CreateOptions(
|
||||
metadata:
|
||||
EnvironmentMetadata(description: data.description, name: data.name),
|
||||
@ -68,6 +69,7 @@ class EnvironmentsGrpc {
|
||||
try {
|
||||
final response = await envStub.create(request);
|
||||
return EnvironmentLocalData(
|
||||
uuid: response.id.uuid,
|
||||
serverType: response.spec.serverType.toString(),
|
||||
serverLocation: response.spec.serverLocation.toString(),
|
||||
provider: response.spec.provider.toString(),
|
||||
@ -88,6 +90,7 @@ class EnvironmentsGrpc {
|
||||
),
|
||||
)) {
|
||||
envs.add(EnvironmentLocalData(
|
||||
uuid: feature.id.uuid,
|
||||
serverType: feature.spec.serverType.toString(),
|
||||
serverLocation: feature.spec.serverLocation.toString(),
|
||||
provider: feature.spec.provider.toString(),
|
||||
|
Reference in New Issue
Block a user