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

Remove old UI #5643

Merged
merged 6 commits into from Apr 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 0 additions & 6 deletions .gitignore
Expand Up @@ -12,12 +12,6 @@ Thumbs.db
bin/
changelog.tmp
exit-code
ui/.bundle
ui/.sass-cache
ui/dist/
ui/static/application.min.js
ui/static/base.css
ui/vendor
website/.bundle
website/build/
website/npm-debug.log
Expand Down
17 changes: 4 additions & 13 deletions GNUmakefile
Expand Up @@ -43,7 +43,6 @@ endif
CONSUL_DEV_IMAGE?=consul-dev
GO_BUILD_TAG?=consul-build-go
UI_BUILD_TAG?=consul-build-ui
UI_LEGACY_BUILD_TAG?=consul-build-ui-legacy
BUILD_CONTAINER_NAME?=consul-builder

DIST_TAG?=1
Expand Down Expand Up @@ -88,7 +87,6 @@ NOGOX?=1
export NOGOX
export GO_BUILD_TAG
export UI_BUILD_TAG
export UI_LEGACY_BUILD_TAG
export BUILD_CONTAINER_NAME
export GIT_COMMIT
export GIT_DIRTY
Expand Down Expand Up @@ -223,7 +221,7 @@ static-assets:


# Build the static web ui and build static assets inside a Docker container
ui: ui-legacy-docker ui-docker static-assets-docker
ui: ui-docker static-assets-docker

tools:
go get -u -v $(GOTOOLS)
Expand All @@ -239,7 +237,7 @@ version:
@$(SHELL) $(CURDIR)/build-support/scripts/version.sh -r -g


docker-images: go-build-image ui-build-image ui-legacy-build-image
docker-images: go-build-image ui-build-image

go-build-image:
@echo "Building Golang build container"
Expand All @@ -249,10 +247,6 @@ ui-build-image:
@echo "Building UI build container"
@docker build $(NOCACHE) $(QUIET) -t $(UI_BUILD_TAG) - < build-support/docker/Build-UI.dockerfile

ui-legacy-build-image:
@echo "Building Legacy UI build container"
@docker build $(NOCACHE) $(QUIET) -t $(UI_LEGACY_BUILD_TAG) - < build-support/docker/Build-UI-Legacy.dockerfile

static-assets-docker: go-build-image
@$(SHELL) $(CURDIR)/build-support/scripts/build-docker.sh static-assets

Expand All @@ -262,12 +256,9 @@ consul-docker: go-build-image
ui-docker: ui-build-image
@$(SHELL) $(CURDIR)/build-support/scripts/build-docker.sh ui

ui-legacy-docker: ui-legacy-build-image
@$(SHELL) $(CURDIR)/build-support/scripts/build-docker.sh ui-legacy

proto:
protoc agent/connect/ca/plugin/*.proto --gofast_out=plugins=grpc:../../..

.PHONY: all ci bin dev dist cov test test-ci test-internal test-install-deps cover format vet ui static-assets tools
.PHONY: docker-images go-build-image ui-build-image ui-legacy-build-image static-assets-docker consul-docker ui-docker
.PHONY: ui-legacy-docker version proto
.PHONY: docker-images go-build-image ui-build-image static-assets-docker consul-docker ui-docker
.PHONY: version proto
1,518 changes: 388 additions & 1,130 deletions agent/bindata_assetfs.go

Large diffs are not rendered by default.

16 changes: 1 addition & 15 deletions agent/http.go
Expand Up @@ -8,7 +8,6 @@ import (
"net/http"
"net/http/pprof"
"net/url"
"os"
"reflect"
"regexp"
"strconv"
Expand Down Expand Up @@ -218,29 +217,16 @@ func (s *HTTPServer) handler(enableDebug bool) http.Handler {
handlePProf("/debug/pprof/trace", pprof.Trace)

if s.IsUIEnabled() {
legacy_ui, err := strconv.ParseBool(os.Getenv("CONSUL_UI_LEGACY"))
if err != nil {
legacy_ui = false
}
var uifs http.FileSystem

// Use the custom UI dir if provided.
if s.agent.config.UIDir != "" {
uifs = http.Dir(s.agent.config.UIDir)
} else {
fs := assetFS()

if legacy_ui {
fs.Prefix += "/v1/"
} else {
fs.Prefix += "/v2/"
}
uifs = fs
}

if !legacy_ui {
uifs = &redirectFS{fs: uifs}
}
uifs = &redirectFS{fs: uifs}

mux.Handle("/robots.txt", http.FileServer(uifs))
mux.Handle("/ui/", http.StripPrefix("/ui/", http.FileServer(uifs)))
Expand Down
16 changes: 0 additions & 16 deletions build-support/docker/Build-UI-Legacy.dockerfile

This file was deleted.

1 change: 0 additions & 1 deletion build-support/functions/00-vars.sh
Expand Up @@ -3,7 +3,6 @@ HASHICORP_GPG_KEY="348FFC4C"

# Default Image Names
UI_BUILD_CONTAINER_DEFAULT="consul-build-ui"
UI_LEGACY_BUILD_CONTAINER_DEFAULT="consul-build-ui-legacy"
GO_BUILD_CONTAINER_DEFAULT="consul-build-go"

# Whether to colorize shell output
Expand Down
51 changes: 2 additions & 49 deletions build-support/functions/20-build.sh
Expand Up @@ -113,62 +113,15 @@ function build_ui {
# Copy UI over ready to be packaged into the binary
if test ${ret} -eq 0
then
rm -rf ${1}/pkg/web_ui/v2
rm -rf ${1}/pkg/web_ui
mkdir -p ${1}/pkg/web_ui
cp -r ${1}/ui-v2/dist ${1}/pkg/web_ui/v2
cp -r ${1}/ui-v2/dist/ ${1}/pkg/web_ui
fi

popd > /dev/null
return $ret
}

function build_ui_legacy {
# Arguments:
# $1 - Path to the top level Consul source
# $2 - The docker image to run the build within (optional)
#
# Returns:
# 0 - success
# * - error

if ! test -d "$1"
then
err "ERROR: '$1' is not a directory. build_ui_legacy must be called with the path to the top level source as the first argument'"
return 1
fi

local sdir="$1"
local ui_legacy_dir="${sdir}/ui"

local image_name=${UI_LEGACY_BUILD_CONTAINER_DEFAULT}
if test -n "$2"
then
image_name="$2"
fi

pushd ${ui_legacy_dir} > /dev/null
status "Creating the Legacy UI Build Container with image: ${image_name}"
rm -r ${sdir}/pkg/web_ui/v1 >/dev/null 2>&1
mkdir -p ${sdir}/pkg/web_ui/v1
local container_id=$(docker create -it ${image_name})
local ret=$?
if test $ret -eq 0
then
status "Copying the source from '${ui_legacy_dir}' to /consul-src/ui within the container"
(
docker cp . ${container_id}:/consul-src/ui &&
status "Running build in container" &&
docker start -i ${container_id} &&
status "Copying back artifacts" &&
docker cp ${container_id}:/consul-src/pkg/web_ui/v1/. ${sdir}/pkg/web_ui/v1
)
ret=$?
docker rm ${container_id} > /dev/null
fi
popd > /dev/null
return $ret
}

function build_assetfs {
# Arguments:
# $1 - Path to the top level Consul source
Expand Down
10 changes: 1 addition & 9 deletions build-support/functions/30-release.sh
Expand Up @@ -457,14 +457,6 @@ function build_release {
return 1
fi

status_stage "==> Building Legacy UI for version ${vers}"
build_ui_legacy "${sdir}" "${UI_LEGACY_BUILD_TAG}"
if test $? -ne 0
then
err "ERROR: Failed to build the legacy ui"
return 1
fi

status_stage "==> Building UI for version ${vers}"
# passing the version to override the version determined via tags
build_ui "${sdir}" "${UI_BUILD_TAG}" "${vers}"
Expand All @@ -473,7 +465,7 @@ function build_release {
err "ERROR: Failed to build the ui"
return 1
fi
status "UI Built with Version: $(ui_version "${sdir}/pkg/web_ui/v2/index.html")"
status "UI Built with Version: $(ui_version "${sdir}/pkg/web_ui/index.html")"

status_stage "==> Building Static Assets for version ${vers}"
build_assetfs "${sdir}" "${GO_BUILD_TAG}"
Expand Down
16 changes: 3 additions & 13 deletions build-support/scripts/build-docker.sh
Expand Up @@ -14,7 +14,7 @@ source "${SCRIPT_DIR}/functions.sh"

function usage {
cat <<-EOF
Usage: ${SCRIPT_NAME} (consul|ui|ui-legacy|static-assets) [<options ...>]
Usage: ${SCRIPT_NAME} (consul|ui|static-assets) [<options ...>]

Description:
This script will build the various Consul components within docker containers
Expand Down Expand Up @@ -81,7 +81,7 @@ function main {
refresh=1
shift
;;
consul | ui | ui-legacy | static-assets )
consul | ui | static-assets )
command="$1"
shift
;;
Expand Down Expand Up @@ -128,17 +128,7 @@ function main {
fi
status_stage "==> Building UI"
build_ui "${sdir}" "${image}" || return 1
status "==> UI Built with Version: $(ui_version ${sdir}/pkg/web_ui/v2/index.html), Logo: $(ui_logo_type ${sdir}/pkg/web_ui/v2/index.html)"
;;
ui-legacy )
if is_set "${refresh}"
then
status_stage "==> Refreshing Legacy UI build container image"
export UI_LEGACY_BUILD_TAG="${image:-${UI_LEGACY_BUILD_CONTAINER_DEFAULT}}"
refresh_docker_images "${sdir}" ui-legacy-build-image || return 1
fi
status_stage "==> Building UI"
build_ui_legacy "${sdir}" "${image}" || return 1
status "==> UI Built with Version: $(ui_version ${sdir}/pkg/web_ui/index.html), Logo: $(ui_logo_type ${sdir}/pkg/web_ui/index.html)"
;;
* )
err_usage "ERROR: Unknown command: '${command}'"
Expand Down
12 changes: 0 additions & 12 deletions ui/GNUmakefile

This file was deleted.

7 changes: 0 additions & 7 deletions ui/Gemfile

This file was deleted.

32 changes: 0 additions & 32 deletions ui/Gemfile.lock

This file was deleted.

80 changes: 0 additions & 80 deletions ui/README.md

This file was deleted.