update service generation + update section order
This commit is contained in:
parent
28030af17d
commit
0f63c18b4d
@ -1,17 +1,13 @@
|
|||||||
import 'package:auto_size_text/auto_size_text.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/painting.dart';
|
import 'package:flutter/painting.dart';
|
||||||
import 'package:manager_app/Components/color_picker_input_container.dart';
|
import 'package:manager_app/Components/color_picker_input_container.dart';
|
||||||
import 'package:manager_app/Components/confirmation_dialog.dart';
|
import 'package:manager_app/Components/confirmation_dialog.dart';
|
||||||
import 'package:manager_app/Components/fetch_section_icon.dart';
|
|
||||||
import 'package:manager_app/Components/message_notification.dart';
|
import 'package:manager_app/Components/message_notification.dart';
|
||||||
import 'package:manager_app/Components/multi_select_container.dart';
|
import 'package:manager_app/Components/multi_select_container.dart';
|
||||||
import 'package:manager_app/Components/rounded_button.dart';
|
import 'package:manager_app/Components/rounded_button.dart';
|
||||||
import 'package:manager_app/Components/string_input_container.dart';
|
import 'package:manager_app/Components/string_input_container.dart';
|
||||||
import 'package:manager_app/Models/managerContext.dart';
|
import 'package:manager_app/Models/managerContext.dart';
|
||||||
import 'package:manager_app/Screens/Configurations/listView_card_section.dart';
|
|
||||||
import 'package:manager_app/Screens/Configurations/new_section_popup.dart';
|
|
||||||
import 'package:manager_app/Screens/Configurations/section_reorderList.dart';
|
import 'package:manager_app/Screens/Configurations/section_reorderList.dart';
|
||||||
import 'package:manager_app/app_context.dart';
|
import 'package:manager_app/app_context.dart';
|
||||||
import 'package:manager_app/client.dart';
|
import 'package:manager_app/client.dart';
|
||||||
@ -260,6 +256,13 @@ class _ConfigurationDetailScreenState extends State<ConfigurationDetailScreen> {
|
|||||||
child: SectionReorderList(
|
child: SectionReorderList(
|
||||||
sectionsIn: sections,
|
sectionsIn: sections,
|
||||||
configurationId: configurationDTO.id,
|
configurationId: configurationDTO.id,
|
||||||
|
onChangedOrder: (List<SectionDTO> sectionsOut) async {
|
||||||
|
sections = sectionsOut;
|
||||||
|
|
||||||
|
// Update section order
|
||||||
|
ManagerAppContext managerAppContext = appContext.getContext();
|
||||||
|
var result = await managerAppContext.clientAPI.sectionApi.sectionUpdateOrder(sections);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -13,10 +13,12 @@ import 'package:provider/provider.dart';
|
|||||||
class SectionReorderList extends StatefulWidget {
|
class SectionReorderList extends StatefulWidget {
|
||||||
final String configurationId;
|
final String configurationId;
|
||||||
final List<SectionDTO> sectionsIn;
|
final List<SectionDTO> sectionsIn;
|
||||||
|
final ValueChanged<List<SectionDTO>> onChangedOrder;
|
||||||
const SectionReorderList({
|
const SectionReorderList({
|
||||||
Key key,
|
Key key,
|
||||||
this.configurationId,
|
this.configurationId,
|
||||||
this.sectionsIn,
|
this.sectionsIn,
|
||||||
|
this.onChangedOrder,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -47,9 +49,7 @@ class _SectionReorderListState extends State<SectionReorderList> {
|
|||||||
i++;
|
i++;
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO SAVE SECTION ALSO WHEN SAVE CONFIG
|
widget.onChangedOrder(sections);
|
||||||
// TODO call method in service (create new)
|
|
||||||
// List of {section.id, section.order}
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,6 +96,7 @@ Class | Method | HTTP request | Description
|
|||||||
*SectionApi* | [**sectionGetVideoDTO**](doc\/SectionApi.md#sectiongetvideodto) | **GET** /api/Section/VideoDTO |
|
*SectionApi* | [**sectionGetVideoDTO**](doc\/SectionApi.md#sectiongetvideodto) | **GET** /api/Section/VideoDTO |
|
||||||
*SectionApi* | [**sectionGetWebDTO**](doc\/SectionApi.md#sectiongetwebdto) | **GET** /api/Section/WebDTO |
|
*SectionApi* | [**sectionGetWebDTO**](doc\/SectionApi.md#sectiongetwebdto) | **GET** /api/Section/WebDTO |
|
||||||
*SectionApi* | [**sectionUpdate**](doc\/SectionApi.md#sectionupdate) | **PUT** /api/Section |
|
*SectionApi* | [**sectionUpdate**](doc\/SectionApi.md#sectionupdate) | **PUT** /api/Section |
|
||||||
|
*SectionApi* | [**sectionUpdateOrder**](doc\/SectionApi.md#sectionupdateorder) | **PUT** /api/Section/order |
|
||||||
*UserApi* | [**userCreateUser**](doc\/UserApi.md#usercreateuser) | **POST** /api/User |
|
*UserApi* | [**userCreateUser**](doc\/UserApi.md#usercreateuser) | **POST** /api/User |
|
||||||
*UserApi* | [**userDeleteUser**](doc\/UserApi.md#userdeleteuser) | **DELETE** /api/User/{id} |
|
*UserApi* | [**userDeleteUser**](doc\/UserApi.md#userdeleteuser) | **DELETE** /api/User/{id} |
|
||||||
*UserApi* | [**userGet**](doc\/UserApi.md#userget) | **GET** /api/User |
|
*UserApi* | [**userGet**](doc\/UserApi.md#userget) | **GET** /api/User |
|
||||||
|
|||||||
@ -22,6 +22,7 @@ Method | HTTP request | Description
|
|||||||
[**sectionGetVideoDTO**](SectionApi.md#sectiongetvideodto) | **GET** /api/Section/VideoDTO |
|
[**sectionGetVideoDTO**](SectionApi.md#sectiongetvideodto) | **GET** /api/Section/VideoDTO |
|
||||||
[**sectionGetWebDTO**](SectionApi.md#sectiongetwebdto) | **GET** /api/Section/WebDTO |
|
[**sectionGetWebDTO**](SectionApi.md#sectiongetwebdto) | **GET** /api/Section/WebDTO |
|
||||||
[**sectionUpdate**](SectionApi.md#sectionupdate) | **PUT** /api/Section |
|
[**sectionUpdate**](SectionApi.md#sectionupdate) | **PUT** /api/Section |
|
||||||
|
[**sectionUpdateOrder**](SectionApi.md#sectionupdateorder) | **PUT** /api/Section/order |
|
||||||
|
|
||||||
|
|
||||||
# **sectionCreate**
|
# **sectionCreate**
|
||||||
@ -559,3 +560,46 @@ Name | Type | Description | Notes
|
|||||||
|
|
||||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
# **sectionUpdateOrder**
|
||||||
|
> String sectionUpdateOrder(sectionDTO)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```dart
|
||||||
|
import 'package:managerapi/api.dart';
|
||||||
|
// TODO Configure OAuth2 access token for authorization: bearer
|
||||||
|
//defaultApiClient.getAuthentication<OAuth>('bearer').accessToken = 'YOUR_ACCESS_TOKEN';
|
||||||
|
|
||||||
|
final api_instance = SectionApi();
|
||||||
|
final sectionDTO = [List<SectionDTO>()]; // List<SectionDTO> |
|
||||||
|
|
||||||
|
try {
|
||||||
|
final result = api_instance.sectionUpdateOrder(sectionDTO);
|
||||||
|
print(result);
|
||||||
|
} catch (e) {
|
||||||
|
print('Exception when calling SectionApi->sectionUpdateOrder: $e\n');
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**sectionDTO** | [**List<SectionDTO>**](SectionDTO.md)| |
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
**String**
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
[bearer](../README.md#bearer)
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: application/json
|
||||||
|
- **Accept**: application/json
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
|||||||
@ -778,4 +778,67 @@ class SectionApi {
|
|||||||
}
|
}
|
||||||
return Future<SectionDTO>.value(null);
|
return Future<SectionDTO>.value(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Performs an HTTP 'PUT /api/Section/order' operation and returns the [Response].
|
||||||
|
/// Parameters:
|
||||||
|
///
|
||||||
|
/// * [List<SectionDTO>] sectionDTO (required):
|
||||||
|
Future<Response> sectionUpdateOrderWithHttpInfo(List<SectionDTO> sectionDTO) async {
|
||||||
|
// Verify required params are set.
|
||||||
|
if (sectionDTO == null) {
|
||||||
|
throw ApiException(HttpStatus.badRequest, 'Missing required param: sectionDTO');
|
||||||
|
}
|
||||||
|
|
||||||
|
final path = r'/api/Section/order';
|
||||||
|
|
||||||
|
Object postBody = sectionDTO;
|
||||||
|
|
||||||
|
final queryParams = <QueryParam>[];
|
||||||
|
final headerParams = <String, String>{};
|
||||||
|
final formParams = <String, String>{};
|
||||||
|
|
||||||
|
final contentTypes = <String>['application/json'];
|
||||||
|
final nullableContentType = contentTypes.isNotEmpty ? contentTypes[0] : null;
|
||||||
|
final authNames = <String>['bearer'];
|
||||||
|
|
||||||
|
if (
|
||||||
|
nullableContentType != null &&
|
||||||
|
nullableContentType.toLowerCase().startsWith('multipart/form-data')
|
||||||
|
) {
|
||||||
|
bool hasFields = false;
|
||||||
|
final mp = MultipartRequest(null, null);
|
||||||
|
if (hasFields) {
|
||||||
|
postBody = mp;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
|
||||||
|
return await apiClient.invokeAPI(
|
||||||
|
path,
|
||||||
|
'PUT',
|
||||||
|
queryParams,
|
||||||
|
postBody,
|
||||||
|
headerParams,
|
||||||
|
formParams,
|
||||||
|
nullableContentType,
|
||||||
|
authNames,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Parameters:
|
||||||
|
///
|
||||||
|
/// * [List<SectionDTO>] sectionDTO (required):
|
||||||
|
Future<String> sectionUpdateOrder(List<SectionDTO> sectionDTO) async {
|
||||||
|
final response = await sectionUpdateOrderWithHttpInfo(sectionDTO);
|
||||||
|
if (response.statusCode >= HttpStatus.badRequest) {
|
||||||
|
throw ApiException(response.statusCode, _decodeBodyBytes(response));
|
||||||
|
}
|
||||||
|
// When a remote server returns no body with a status of 204, we shall not decode it.
|
||||||
|
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
||||||
|
// FormatException when trying to decode an empty string.
|
||||||
|
if (response.body != null && response.statusCode != HttpStatus.noContent) {
|
||||||
|
return apiClient.deserialize(_decodeBodyBytes(response), 'String') as String;
|
||||||
|
}
|
||||||
|
return Future<String>.value(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@ info:
|
|||||||
description: API Manager Service
|
description: API Manager Service
|
||||||
version: Version Alpha
|
version: Version Alpha
|
||||||
servers:
|
servers:
|
||||||
- url: 'http://192.168.31.96'
|
- url: http://192.168.31.96
|
||||||
paths:
|
paths:
|
||||||
/api/Configuration:
|
/api/Configuration:
|
||||||
get:
|
get:
|
||||||
@ -107,7 +107,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
security:
|
security:
|
||||||
- bearer: []
|
- bearer: []
|
||||||
'/api/Configuration/{id}':
|
/api/Configuration/{id}:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Configuration
|
- Configuration
|
||||||
@ -278,7 +278,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
security:
|
security:
|
||||||
- bearer: []
|
- bearer: []
|
||||||
'/api/Device/{id}/detail':
|
/api/Device/{id}/detail:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Device
|
- Device
|
||||||
@ -310,7 +310,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
'/api/Device/{id}':
|
/api/Device/{id}:
|
||||||
delete:
|
delete:
|
||||||
tags:
|
tags:
|
||||||
- Device
|
- Device
|
||||||
@ -450,7 +450,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
security:
|
security:
|
||||||
- bearer: []
|
- bearer: []
|
||||||
'/api/Resource/{id}/detail':
|
/api/Resource/{id}/detail:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Resource
|
- Resource
|
||||||
@ -482,7 +482,7 @@ paths:
|
|||||||
application/json:
|
application/json:
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
'/api/Resource/{id}':
|
/api/Resource/{id}:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Resource
|
- Resource
|
||||||
@ -689,7 +689,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
security:
|
security:
|
||||||
- bearer: []
|
- bearer: []
|
||||||
'/api/Section/configuration/{id}':
|
/api/Section/configuration/{id}:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Section
|
- Section
|
||||||
@ -758,7 +758,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
security:
|
security:
|
||||||
- bearer: []
|
- bearer: []
|
||||||
'/api/Section/{id}/subsections':
|
/api/Section/{id}/subsections:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Section
|
- Section
|
||||||
@ -793,7 +793,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
security:
|
security:
|
||||||
- bearer: []
|
- bearer: []
|
||||||
'/api/Section/{id}':
|
/api/Section/{id}:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Section
|
- Section
|
||||||
@ -864,6 +864,48 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
security:
|
security:
|
||||||
- bearer: []
|
- bearer: []
|
||||||
|
/api/Section/order:
|
||||||
|
put:
|
||||||
|
tags:
|
||||||
|
- Section
|
||||||
|
operationId: Section_UpdateOrder
|
||||||
|
requestBody:
|
||||||
|
x-name: updatedSectionsOrder
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/SectionDTO'
|
||||||
|
required: true
|
||||||
|
x-position: 1
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: ''
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
'400':
|
||||||
|
description: ''
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
'404':
|
||||||
|
description: ''
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
'500':
|
||||||
|
description: ''
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
security:
|
||||||
|
- bearer: []
|
||||||
/api/Section/MapDTO:
|
/api/Section/MapDTO:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
@ -1032,7 +1074,7 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
security:
|
security:
|
||||||
- bearer: []
|
- bearer: []
|
||||||
'/api/User/{id}':
|
/api/User/{id}:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- User
|
- User
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user