feat(web): onboarding (#6066)

* feat(web): onboarding

* feat: openapi

* feat: modulization

* feat: page advancing

* Animation

* Add storage templaete settings

* sql

* more style

* Theme

* information and styling

* hide/show table

* Styling

* Update user property

* fix test

* fix test:

* fix e2e

* test

* Update web/src/lib/components/onboarding-page/onboarding-hello.svelte

Co-authored-by: bo0tzz <git@bo0tzz.me>

* naming

* use System Metadata

* better return type

* onboarding using server metadata

* revert previous changes in user entity

* sql

* test web

* fix test server

* server/web test

* more test

* consolidate color theme change logic

* consolidate save button to storage template

* merge main

* fix web

---------

Co-authored-by: bo0tzz <git@bo0tzz.me>
This commit is contained in:
Alex 2024-01-03 23:28:32 -06:00 committed by GitHub
parent f8d64be13c
commit 18f59f78e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 698 additions and 111 deletions

View file

@ -176,6 +176,7 @@ Class | Method | HTTP request | Description
*ServerInfoApi* | [**getSupportedMediaTypes**](doc//ServerInfoApi.md#getsupportedmediatypes) | **GET** /server-info/media-types |
*ServerInfoApi* | [**getTheme**](doc//ServerInfoApi.md#gettheme) | **GET** /server-info/theme |
*ServerInfoApi* | [**pingServer**](doc//ServerInfoApi.md#pingserver) | **GET** /server-info/ping |
*ServerInfoApi* | [**setAdminOnboarding**](doc//ServerInfoApi.md#setadminonboarding) | **POST** /server-info/admin-onboarding |
*SharedLinkApi* | [**addSharedLinkAssets**](doc//SharedLinkApi.md#addsharedlinkassets) | **PUT** /shared-link/{id}/assets |
*SharedLinkApi* | [**createSharedLink**](doc//SharedLinkApi.md#createsharedlink) | **POST** /shared-link |
*SharedLinkApi* | [**getAllSharedLinks**](doc//SharedLinkApi.md#getallsharedlinks) | **GET** /shared-link |

View file

@ -10,6 +10,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**externalDomain** | **String** | |
**isInitialized** | **bool** | |
**isOnboarded** | **bool** | |
**loginPageMessage** | **String** | |
**oauthButtonText** | **String** | |
**trashDays** | **int** | |

View file

@ -17,6 +17,7 @@ Method | HTTP request | Description
[**getSupportedMediaTypes**](ServerInfoApi.md#getsupportedmediatypes) | **GET** /server-info/media-types |
[**getTheme**](ServerInfoApi.md#gettheme) | **GET** /server-info/theme |
[**pingServer**](ServerInfoApi.md#pingserver) | **GET** /server-info/ping |
[**setAdminOnboarding**](ServerInfoApi.md#setadminonboarding) | **POST** /server-info/admin-onboarding |
# **getServerConfig**
@ -343,3 +344,53 @@ No authorization required
[[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)
# **setAdminOnboarding**
> setAdminOnboarding()
### Example
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: cookie
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure HTTP Bearer authorization: bearer
// Case 1. Use String Token
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken('YOUR_ACCESS_TOKEN');
// Case 2. Use Function which generate token.
// String yourTokenGeneratorFunction() { ... }
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
final api_instance = ServerInfoApi();
try {
api_instance.setAdminOnboarding();
} catch (e) {
print('Exception when calling ServerInfoApi->setAdminOnboarding: $e\n');
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
void (empty response body)
### Authorization
[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[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)

View file

@ -343,4 +343,37 @@ class ServerInfoApi {
}
return null;
}
/// Performs an HTTP 'POST /server-info/admin-onboarding' operation and returns the [Response].
Future<Response> setAdminOnboardingWithHttpInfo() async {
// ignore: prefer_const_declarations
final path = r'/server-info/admin-onboarding';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
Future<void> setAdminOnboarding() async {
final response = await setAdminOnboardingWithHttpInfo();
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
}

View file

@ -15,6 +15,7 @@ class ServerConfigDto {
ServerConfigDto({
required this.externalDomain,
required this.isInitialized,
required this.isOnboarded,
required this.loginPageMessage,
required this.oauthButtonText,
required this.trashDays,
@ -24,6 +25,8 @@ class ServerConfigDto {
bool isInitialized;
bool isOnboarded;
String loginPageMessage;
String oauthButtonText;
@ -34,6 +37,7 @@ class ServerConfigDto {
bool operator ==(Object other) => identical(this, other) || other is ServerConfigDto &&
other.externalDomain == externalDomain &&
other.isInitialized == isInitialized &&
other.isOnboarded == isOnboarded &&
other.loginPageMessage == loginPageMessage &&
other.oauthButtonText == oauthButtonText &&
other.trashDays == trashDays;
@ -43,17 +47,19 @@ class ServerConfigDto {
// ignore: unnecessary_parenthesis
(externalDomain.hashCode) +
(isInitialized.hashCode) +
(isOnboarded.hashCode) +
(loginPageMessage.hashCode) +
(oauthButtonText.hashCode) +
(trashDays.hashCode);
@override
String toString() => 'ServerConfigDto[externalDomain=$externalDomain, isInitialized=$isInitialized, loginPageMessage=$loginPageMessage, oauthButtonText=$oauthButtonText, trashDays=$trashDays]';
String toString() => 'ServerConfigDto[externalDomain=$externalDomain, isInitialized=$isInitialized, isOnboarded=$isOnboarded, loginPageMessage=$loginPageMessage, oauthButtonText=$oauthButtonText, trashDays=$trashDays]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'externalDomain'] = this.externalDomain;
json[r'isInitialized'] = this.isInitialized;
json[r'isOnboarded'] = this.isOnboarded;
json[r'loginPageMessage'] = this.loginPageMessage;
json[r'oauthButtonText'] = this.oauthButtonText;
json[r'trashDays'] = this.trashDays;
@ -70,6 +76,7 @@ class ServerConfigDto {
return ServerConfigDto(
externalDomain: mapValueOfType<String>(json, r'externalDomain')!,
isInitialized: mapValueOfType<bool>(json, r'isInitialized')!,
isOnboarded: mapValueOfType<bool>(json, r'isOnboarded')!,
loginPageMessage: mapValueOfType<String>(json, r'loginPageMessage')!,
oauthButtonText: mapValueOfType<String>(json, r'oauthButtonText')!,
trashDays: mapValueOfType<int>(json, r'trashDays')!,
@ -122,6 +129,7 @@ class ServerConfigDto {
static const requiredKeys = <String>{
'externalDomain',
'isInitialized',
'isOnboarded',
'loginPageMessage',
'oauthButtonText',
'trashDays',

View file

@ -26,6 +26,11 @@ void main() {
// TODO
});
// bool isOnboarded
test('to test the property `isOnboarded`', () async {
// TODO
});
// String loginPageMessage
test('to test the property `loginPageMessage`', () async {
// TODO

View file

@ -57,5 +57,10 @@ void main() {
// TODO
});
//Future setAdminOnboarding() async
test('test setAdminOnboarding', () async {
// TODO
});
});
}