Skip to content

Commit

Permalink
Admin UI: Initialize flutter setup (#547)
Browse files Browse the repository at this point in the history
* chore: update settings.json with dart

* chore: add readme

* fix: git-un-ignore adminui packages

* chore: add initial flutter setup

* feat: add adminui boilerplate

* feat: add types

* feat: add sdk

* feat: use client in the app

* chore: move AdminUI to AdminUI folder

* fix: allow internet access for the mac app

* chore: add setup for configs

* feat: async creation of client

* chore: update mac icons

* chore: change name from admin_ui to AdminUI

* feat: add window_size plugin

* fix: use empty baseurl for web

* feat: add shared preferences

* feat: add routing

* feat: add packages

* chore: move AdminUI to AdminUi

* chore: add packages

* chore: move stuff

* chore: ignore again

* chore: simplify logout

* chore: make more readable

* fix: check for api key validity

* chore: do not copy code from go_router package

* fix: use enmeshed logo as svg

* chore: update default window size on macos

* chore: yeet unused launch config

* chore: update extensions

* fix: obscure text in pw field

* chore: add tier get and delete endpoints

* feat: add quota types and endpoints

* feat: add quota endpoint

* chore format

* wip

* chore: wip

* chore: update identity

* chore: update, change method name and type

* chore: remove unnecessary imports

* feat: add relationships type and endpoint

* ci: move runAdminUiChecks to aui folder and rename it to runChecks

* ci: add and execute runFlutterChecks script

* ci: rename flutter checks jobs

* ci: use correct script folder and name

* chore: simplify relationship type

* chore: finalize identities odata

* chore: add separate get and make result for odata

* chore: comment now follows flutter style to-do

* chore: simplify relationship endpoint

* chore: show the results of getting the data

* ci: trigger pipelines

* chore: add some basic pagination

* chore: add filtering for odata

* chore: add filtering example

* chore: export identity overview filter

* fix: syntax

* chore: bump melos

* chore: use builtin melos analyze command

* refactor: identities

* chore: add types to dependencies

* refactor: move enum

* chore: rename parameters

* feat: add identity overview

* chore: display only identity overview

* chore: add trailing comma and add named parameter

* refactor: use port 8082 for local testing

* chore: remove UI code

* fix: make pagination usable

* chore: remove comment

* fix: early return

* refactor: make pretty

* chore: remove unused file

---------

Co-authored-by: Vladimir Vuckovic <[email protected]>
Co-authored-by: Timo Notheisen <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored Mar 15, 2024
1 parent 3b712b5 commit c840c4d
Show file tree
Hide file tree
Showing 125 changed files with 5,576 additions and 15 deletions.
1 change: 1 addition & 0 deletions .ci/runAdminUiChecks.sh → .ci/aui/runChecks.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
set -e
set -x

Expand Down
9 changes: 9 additions & 0 deletions .ci/aui/runFlutterChecks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
set -e
set -x

cd AdminUi
dart pub global activate melos
melos bootstrap
melos analyze
melos format
13 changes: 12 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,18 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Run Checks
run: ./.ci/runAdminUiChecks.sh
run: ./.ci/aui/runChecks.sh

run-adminUi-flutter-checks:
runs-on: ubuntu-latest
name: Run Admin UI Flutter Checks
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/[email protected]
- name: Run checks
run: ./.ci/aui/runFlutterChecks.sh

check-formatting:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -366,3 +366,6 @@ dist
# feature.cs files are generated by the build process and should not be committed to source control
**/*.feature.cs
**/SpecFlow/

# flutter
!AdminUi/packages/*
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"recommendations": ["ms-azuretools.vscode-docker", "ms-dotnettools.csdevkit"]
"recommendations": ["ms-azuretools.vscode-docker", "Dart-Code.flutter", "Dart-Code.dart-code"]
}
14 changes: 5 additions & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Consumer API (Docker)",
"type": "docker",
"request": "attach",
"platform": "netCore",
"sourceFileMap": {
"/app": "${workspaceFolder}"
},
"containerName": "consumerApi",
"processName": "ConsumerApi"
"name": "Launch current dart file",
"request": "launch",
"type": "dart",
"toolArgs": ["--dart-define-from-file=${workspaceFolder}/AdminUi/config.local.json"],
"templateFor": ""
}
]
}
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,10 @@
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"files.eol": "\n"
"files.eol": "\n",
"dart.lineLength": 150,
"[dart]": {
"editor.defaultFormatter": "Dart-Code.dart-code",
"editor.rulers": [150]
}
}
9 changes: 9 additions & 0 deletions AdminUi/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pubspec_overrides.yaml
.dart_tool
build
.flutter-plugins
.flutter-plugins-dependencies
.DS_Store

# config.json for connecting to the admin api
config.json
35 changes: 35 additions & 0 deletions AdminUi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Admin UI

## Development Guide

### Prerequisites

- [Flutter](https://flutter.dev/docs/get-started/install) (we are using the `stable` channel)
- [melos](https://melos.invertase.dev/getting-started)

TLDR: `dart pub global activate melos`

Make sure to [add the system cache bin directory to your path](https://dart.dev/tools/pub/cmd/pub-global#running-a-script-from-your-path) (`$HOME/.pub-cache/bin` for mac and linux and `%LOCALAPPDATA%\Pub\Cache\bin` for most Windows versions).

### Getting Started

Run `melos bootstrap` to [install and link dependencies](https://melos.invertase.dev/commands/bootstrap) in all packages and apps.

### Melos scripts

For an overview of all available melos scripts, run `melos run` or `melos run --help`.

### Configuration

Create a file `AdminUI/config.json` with the following content:

```json
{
"BASE_URL": "...",
"API_KEY": "..."
}
```

This configuration is automatically used when using the VSCode tooling (run / debug buttons).

For building and running the app from the command line, you can use the `--dart-define-from-file=<path-to-file>` flag.
9 changes: 9 additions & 0 deletions AdminUi/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include: package:very_good_analysis/analysis_options.yaml

linter:
rules:
lines_longer_than_80_chars: false
sort_constructors_first: false
public_member_api_docs: false
always_use_package_imports: false
avoid_setters_without_getters: false
43 changes: 43 additions & 0 deletions AdminUi/apps/admin_ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
36 changes: 36 additions & 0 deletions AdminUi/apps/admin_ui/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "abb292a07e20d696c4568099f918f6c5f330e6b0"
channel: "stable"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: abb292a07e20d696c4568099f918f6c5f330e6b0
base_revision: abb292a07e20d696c4568099f918f6c5f330e6b0
- platform: macos
create_revision: abb292a07e20d696c4568099f918f6c5f330e6b0
base_revision: abb292a07e20d696c4568099f918f6c5f330e6b0
- platform: web
create_revision: abb292a07e20d696c4568099f918f6c5f330e6b0
base_revision: abb292a07e20d696c4568099f918f6c5f330e6b0
- platform: windows
create_revision: abb292a07e20d696c4568099f918f6c5f330e6b0
base_revision: abb292a07e20d696c4568099f918f6c5f330e6b0

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
3 changes: 3 additions & 0 deletions AdminUi/apps/admin_ui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# admin_ui

The Enmeshed Backbone Admin UI.
1 change: 1 addition & 0 deletions AdminUi/apps/admin_ui/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include: ../../analysis_options.yaml
Binary file added AdminUi/apps/admin_ui/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions AdminUi/apps/admin_ui/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added AdminUi/apps/admin_ui/assets/mac-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions AdminUi/apps/admin_ui/lib/home/home.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import 'package:flutter/material.dart';

class Dashboard extends StatefulWidget {
const Dashboard({super.key});

@override
State<Dashboard> createState() => _DashboardState();
}

class _DashboardState extends State<Dashboard> {
@override
Widget build(BuildContext context) {
return const Placeholder();
}
}

class Identities extends StatelessWidget {
const Identities({super.key});

@override
Widget build(BuildContext context) {
return const Placeholder();
}
}

class Tiers extends StatelessWidget {
const Tiers({super.key});

@override
Widget build(BuildContext context) {
return const Placeholder();
}
}

class Clients extends StatelessWidget {
const Clients({super.key});

@override
Widget build(BuildContext context) {
return const Placeholder();
}
}
80 changes: 80 additions & 0 deletions AdminUi/apps/admin_ui/lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

import 'home/home.dart';
import 'pages/pages.dart';
import 'setup/setup_desktop.dart' if (dart.library.html) 'setup/setup_web.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();

await setup();

runApp(const MainApp());
}

final _rootNavigatorKey = GlobalKey<NavigatorState>();
final _shellNavigatorKey = GlobalKey<NavigatorState>();

final _router = GoRouter(
initialLocation: '/splash',
navigatorKey: _rootNavigatorKey,
routes: [
GoRoute(
parentNavigatorKey: _rootNavigatorKey,
path: '/splash',
builder: (context, state) => const SplashScreen(),
),
GoRoute(
parentNavigatorKey: _rootNavigatorKey,
path: '/login',
builder: (context, state) => const LoginScreen(),
),
ShellRoute(
navigatorKey: _shellNavigatorKey,
parentNavigatorKey: _rootNavigatorKey,
routes: [
GoRoute(
parentNavigatorKey: _shellNavigatorKey,
path: '/dashboard',
pageBuilder: (context, state) => const NoTransitionPage(child: Dashboard()),
),
GoRoute(
parentNavigatorKey: _shellNavigatorKey,
path: '/identities',
pageBuilder: (context, state) => const NoTransitionPage(child: Identities()),
),
GoRoute(
parentNavigatorKey: _shellNavigatorKey,
path: '/tiers',
pageBuilder: (context, state) => const NoTransitionPage(child: Tiers()),
),
GoRoute(
parentNavigatorKey: _shellNavigatorKey,
path: '/clients',
pageBuilder: (context, state) => const NoTransitionPage(child: Clients()),
),
],
builder: (context, state, child) => HomeScreen(
location: state.fullPath!,
child: child,
),
),
],
);

class MainApp extends StatelessWidget {
const MainApp({super.key});

@override
Widget build(BuildContext context) {
const colorSchemeSeed = Color.fromARGB(255, 23, 66, 141);
return MaterialApp.router(
debugShowCheckedModeBanner: false,
themeMode: ThemeMode.light,
theme: ThemeData(colorSchemeSeed: colorSchemeSeed, useMaterial3: true),
darkTheme: ThemeData(brightness: Brightness.dark, colorSchemeSeed: colorSchemeSeed, useMaterial3: true),
routerConfig: _router,
);
}
}
Loading

0 comments on commit c840c4d

Please sign in to comment.