Skip to content
This repository has been archived by the owner on Feb 26, 2023. It is now read-only.

Commit

Permalink
Merge pull request #153 from iverberk/mega-refactor
Browse files Browse the repository at this point in the history
[WIP] Refactor
  • Loading branch information
jippi authored Dec 9, 2016
2 parents 228521e + 28ceb8d commit 1fa30fe
Show file tree
Hide file tree
Showing 201 changed files with 10,311 additions and 17,665 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ script:
after_success:
- export PR=https://api.github.com/repos/$TRAVIS_REPO_SLUG/pulls/$TRAVIS_PULL_REQUEST
- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo `curl -s $PR | jq -r .head.ref`; fi)
- if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then make docker DOCKER_USER=$DOCKER_USER DOCKER_PASS=$DOCKER_PASS DOCKER_EMAIL=$DOCKER_EMAIL TAG=pr-$TRAVIS_PULL_REQUEST COMMIT=$TRAVIS_COMMIT; fi
- if [[ "$TRAVIS_TAG" =~ ^v.*$ ]]; then make docker DOCKER_USER=$DOCKER_USER DOCKER_PASS=$DOCKER_PASS DOCKER_EMAIL=$DOCKER_EMAIL TAG=$TRAVIS_TAG COMMIT=$TRAVIS_COMMIT; fi
- if [[ "$BRANCH" == "master" ]]; then make docker DOCKER_USER=$DOCKER_USER DOCKER_PASS=$DOCKER_PASS DOCKER_EMAIL=$DOCKER_EMAIL TAG=latest COMMIT=$TRAVIS_COMMIT; fi

Expand Down
20 changes: 16 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,23 @@ EXTERNAL_TOOLS=\

GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./backend/vendor/*")

.PHONY: bootstrap
bootstrap:
@for tool in $(EXTERNAL_TOOLS); do \
echo "Installing $$tool" ; \
go get $$tool; \
done

.PHONY: fmt
fmt:
@echo "--> Running go fmt" ;
@if [ -n "`go fmt ${GOFILES_NOVENDOR}`" ]; then \
echo "[ERR] go fmt updated formatting. Please commit formatted code first."; \
exit 1; \
fi

vet:
.PHONY: vet
vet: fmt
@go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \
go get golang.org/x/tools/cmd/vet; \
fi
Expand All @@ -30,29 +33,38 @@ vet:
echo "and fix them if necessary before submitting the code for review."; \
fi

.PHONY: frontend
frontend:
@echo "=> building frontend ..."
$(MAKE) -C frontend build

backend/bindata_assetfs.go:
.PHONY: backend/bindata_assetfs.go
backend/bindata_assetfs.go: frontend
@echo "=> packaging assets ..."
go-bindata-assetfs -prefix frontend frontend/build/...
mv -f bindata_assetfs.go backend/

.PHONY: build
build: fmt vet bootstrap frontend backend/bindata_assetfs.go
$(MAKE) -C backend build

.PHONY: rebuild
rebuild:
rm -f backend/bindata_assetfs.go
rm -f backend/build/nomad-ui-darwin-amd64
$(MAKE) -j build

.PHONY: clean
clean:
@echo "=> cleaning ..."
$(MAKE) -C backend clean
$(MAKE) -C frontend clean
rm -f backend/bindata_assetfs.go

.PHONY: docker
docker:
@echo "=> build and push Docker image ..."
@docker login -e $(DOCKER_EMAIL) -u $(DOCKER_USER) -p $(DOCKER_PASS)
docker build -f Dockerfile -t iverberk/nomad-ui:$(COMMIT) .
docker tag iverberk/nomad-ui:$(COMMIT) iverberk/nomad-ui:$(TAG)
docker push iverberk/nomad-ui:$(TAG)

.PHONY: docker clean build backend frontend fmt vet
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ Nomad UI [![Build Status](https://travis-ci.org/iverberk/nomad-ui.svg?branch=mas

[![Join the chat at https://gitter.im/nomad-ui/Lobby](https://badges.gitter.im/nomad-ui/Lobby.svg)](https://gitter.im/nomad-ui/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

An awesome user interface for an awesome scheduler, plain and simple :-)
An awesome user interface (even for mobile devices!) for an awesome scheduler, plain and simple :-)

![Nomad UI](http://www.ivoverberk.nl/dl/nomad-ui.jpg)
![Nomad UI](http://www.ivoverberk.nl/dl/nomad-ui-2.jpg)
![Nomad UI](http://www.ivoverberk.nl/dl/nomad-ui-3.jpg)
![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/cluster-overview-small.jpg)

[More screenshots](https://github.com/iverberk/nomad-ui/blob/master/SCREENSHOTS.md)

# Usage

Expand All @@ -25,18 +25,25 @@ Another way to run nomad-ui is through Docker. Run the following command to
start a webserver that will serve the application.

```
docker run -e NOMAD_ADDR=... -p 8000:3000 iverberk/nomad-ui:v0.3.1
docker run -e NOMAD_ADDR=... -p 8000:3000 iverberk/nomad-ui
```

Check the releases page on Github to see which version is current.
Check the releases page on GitHub to see which version is current.

The user interface will be accessible on localhost, port `8000`. Adjust the Docker
run parameters as needed. If you need to change the port that Nomad is listening
on, you should do it with ```-e NOMAD_ADDR``` environment variable that contains
both hostname and port.

`NOMAD_ADDR` (IP or DNS name) should point to the correct location of your Nomad server.
If you have a Node and Go environment you can also build the production version yourself.
# Configuration

Nomad-UI can be controlled by both ENV or CLI flags as described below

| Environment | Flag | Default | Description |
|------------------- |----------------------- |------------------------- |------------------------------------------------------------------------------------------------------ |
| `NOMAD_ADDR` | `--nomad.address` | `http://127.0.0.1:4646` | Must point to the correct location of your Nomad server. |
| `NOMAD_PORT_http` | `--web.listen-address` | `0.0.0.0:3000` | The IP + PORT to listen on |
| `NOMAD_LOG_LEVEL` | `--log.level` | `info` | Log level to use while running the nomad-ui server - (`critical`, `error`, `warning`, `notice`, `info`, `debug`) |

# Try

Expand Down Expand Up @@ -85,8 +92,3 @@ Just run ```npm install``` and ```npm start``` and start developing. Hot reloadi
changes will be visible in the browser immediately. Unfortunately there are no tests yet.

If you would like to contribute please open a pull-request.

# Credits

The awesome dashboard theme is created by [Creative Tim](www.creative-tim.com)
and can be found [here](http://www.creative-tim.com/product/light-bootstrap-dashboard-pro)
72 changes: 72 additions & 0 deletions SCREENSHOTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Cluster

![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/cluster-overview.jpg)

# Jobs

## List

![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/job-list.jpg)
![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/job-list-filter.jpg)

### Mobile

![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/job-list-mobile.jpg)

## Details

![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/job-details-info.jpg)
![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/job-details-allocations.jpg)
![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/job-details-evaluations.jpg)
![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/job-details-task-groups.jpg)
![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/job-details-raw.jpg)

# Allocations

## List

![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/allocation-list-filtered.jpg)
![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/allocation-list.jpg)

## Details

![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/allocation-details-info.jpg)
![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/allocation-details-files.jpg)
![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/allocation-details-logs.jpg)
![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/allocation-details-raw.jpg)

# Client

## List

![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/client-list.jpg)

## Details

![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/client-details-info.jpg)
![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/client-details-allocations.jpg)
![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/client-details-evaluations.jpg)
![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/client-details-raw.jpg)

# Evaluation

## List

![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/evaluation-list.jpg)

## Details

![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/evaluation-details-info.jpg)
![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/evaluation-details-allocations.jpg)
![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/evaluation-details-raw.jpg)

# Server

## List

![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/server-list.jpg)

## Details

![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/server-details-info.jpg)
![Nomad UI](https://dl.dropboxusercontent.com/u/27514/nomad-screenshots/0.5/server-details-raw.jpg)
50 changes: 33 additions & 17 deletions backend/actions.go
Original file line number Diff line number Diff line change
@@ -1,32 +1,47 @@
package main

const (
watchAllocs = "WATCH_ALLOCS"
unwatchAllocs = "UNWATCH_ALLOCS"
fetchedAllocs = "FETCHED_ALLOCS"
fetchedAlloc = "FETCHED_ALLOC"
watchAlloc = "WATCH_ALLOC"
unwatchAlloc = "UNWATCH_ALLOC"

fetchedAlloc = "FETCHED_ALLOC"
watchAlloc = "WATCH_ALLOC"
unwatchAlloc = "UNWATCH_ALLOC"

watchEvals = "WATCH_EVALS"
unwatchEvals = "UNWATCH_EVALS"
fetchedEvals = "FETCHED_EVALS"
fetchedEval = "FETCHED_EVAL"
watchEval = "WATCH_EVAL"
unwatchEval = "UNWATCH_EVAL"

fetchedEval = "FETCHED_EVAL"
watchEval = "WATCH_EVAL"
unwatchEval = "UNWATCH_EVAL"

watchJobs = "WATCH_JOBS"
unwatchJobs = "UNWATCH_JOBS"
fetchedJobs = "FETCHED_JOBS"
fetchedJob = "FETCHED_JOB"
watchJob = "WATCH_JOB"
unwatchJob = "UNWATCH_JOB"

fetchedJob = "FETCHED_JOB"
watchJob = "WATCH_JOB"
unwatchJob = "UNWATCH_JOB"

watchNodes = "WATCH_NODES"
unwatchNodes = "UNWATCH_NODES"
fetchedNodes = "FETCHED_NODES"
fetchedNode = "FETCHED_NODE"
fetchNode = "FETCH_NODE"
watchNode = "WATCH_NODE"
unwatchNode = "UNWATCH_NODE"

fetchedNode = "FETCHED_NODE"
fetchNode = "FETCH_NODE"
watchNode = "WATCH_NODE"
unwatchNode = "UNWATCH_NODE"

watchMembers = "WATCH_MEMBERS"
unwatchMembers = "UNWATCH_MEMBERS"
fetchedMembers = "FETCHED_MEMBERS"
fetchedMember = "FETCHED_MEMBER"
fetchMember = "FETCH_MEMBER"
watchMember = "WATCH_MEMBER"
unwatchMember = "UNWATCH_MEMBER"

fetchedMember = "FETCHED_MEMBER"
fetchMember = "FETCH_MEMBER"
watchMember = "WATCH_MEMBER"
unwatchMember = "UNWATCH_MEMBER"

fetchDir = "FETCH_DIR"
fetchedDir = "FETCHED_DIR"
Expand All @@ -41,5 +56,6 @@ const (
// via a websocket connection.
type Action struct {
Type string
Index uint64
Payload interface{}
}
Loading

0 comments on commit 1fa30fe

Please sign in to comment.