Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRAFT] New UI Refactor #31

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
backing-services/freeipa/
home/
ui/node_modules
ui/package-lock.json
ui/yarn.lock

.vscode
bin/
Expand Down
Empty file modified api/prestart.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion api/v1/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

from v1 import models

config_path = Path(os.environ["CONFIG_FILE"] if "CONFIG_FILE" in os.environ else "/config.yml")
config_path = Path(os.environ["CONFIG_FILE"] if "CONFIG_FILE" in os.environ else "../config.yml")
config = models.config.Config.parse_obj(yaml.safe_load(config_path.read_text()))
2 changes: 1 addition & 1 deletion api/v1/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def exception_handler(request: Request, e: Exception):
"""
api.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_origins=["http://localhost:3000"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
Expand Down
7 changes: 6 additions & 1 deletion api/v1/models/proxmox.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class Specs(BaseModel):
# number of gb of disk
disk_space: int


# number of mb of ram
memory: int

Expand Down Expand Up @@ -224,4 +225,8 @@ class Instance(BaseModel):
# Remarks about the VM and it's configuration we return to the user
remarks: List[str] = []

status: Status
status: Status

disk: int
mem: int
uptime: int
15 changes: 12 additions & 3 deletions api/v1/providers/proxmox.py
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,8 @@ def _read_instance_on_node(
elif current_status['status'] == 'stopped':
status = models.proxmox.Status.Stopped

print(current_status.keys())

instance = models.proxmox.Instance(
type=instance_type,
id=vmid,
Expand All @@ -787,7 +789,10 @@ def _read_instance_on_node(
specs=specs,
remarks=[],
status=status,
active=active
active=active,
mem=current_status["mem"],
disk=current_status["disk"],
uptime=current_status["uptime"],
)

# Build remarks about the vhosts
Expand Down Expand Up @@ -877,7 +882,10 @@ def _read_instance_on_node(
specs=specs,
remarks=[],
status=status,
active=active
active=active,
mem=current_status["mem"],
disk=current_status["disk"],
uptime=current_status["uptime"],
)

# Build remarks about the thing, problems, etc...
Expand Down Expand Up @@ -926,7 +934,7 @@ def read_instances_by_account(
ret = { }

lxcs_qemus = self.prox.cluster.resources.get(type="vm")

for entry in lxcs_qemus:
if 'name' in entry and entry['name'].endswith(self._get_instance_fqdn_for_account(instance_type, account, "")):
if ignore_errors == True:
Expand All @@ -938,6 +946,7 @@ def read_instances_by_account(
else:
instance = self._read_instance_on_node(instance_type, entry['node'], entry['vmid'])
ret[instance.hostname] = instance


return ret

Expand Down
2 changes: 0 additions & 2 deletions ui/.dockerignore

This file was deleted.

7 changes: 3 additions & 4 deletions ui/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[*.{js,jsx,ts,tsx,vue}]
# all files have 2-space tabs
[**/*.tsx,**.ts,*.js,*.jsx,*.json,*.html,*.css,*.scss,*.md]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
insert_final_newline = true
indent_size = 2
2 changes: 0 additions & 2 deletions ui/.eslintignore

This file was deleted.

31 changes: 0 additions & 31 deletions ui/.eslintrc.js

This file was deleted.

32 changes: 17 additions & 15 deletions ui/.gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
.DS_Store
node_modules
/dist
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# local env files
# production
/build

# misc
.DS_Store
.env.local
.env.*.local
.env.development.local
.env.test.local
.env.production.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
2 changes: 0 additions & 2 deletions ui/.prettierrc.yml

This file was deleted.

25 changes: 0 additions & 25 deletions ui/Dockerfile

This file was deleted.

75 changes: 46 additions & 29 deletions ui/README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,46 @@
# ui

## Project setup
```
npm install
```

### Compiles and hot-reloads for development
```
npm run serve
```

### Compiles and minifies for production
```
npm run build
```

### Run your unit tests
```
npm run test:unit
```

### Lints and fixes files
```
npm run lint
```

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
5 changes: 0 additions & 5 deletions ui/babel.config.js

This file was deleted.

3 changes: 0 additions & 3 deletions ui/jest.config.js

This file was deleted.

30 changes: 0 additions & 30 deletions ui/nginx.conf

This file was deleted.

Loading