From ab4bfee019348f51976062512f2586fdf6b915c9 Mon Sep 17 00:00:00 2001 From: Sam Chow Date: Tue, 3 Jul 2018 13:06:54 -0400 Subject: [PATCH] Add progress bar to other parts of the config app Hardcode active classes to modal step bars --- config_app/config_endpoints/common.py | 4 ++ .../config/TransientDirectoryProvider.py | 4 ++ .../cor-floating-bottom-bar.html | 3 ++ .../cor-floating-bottom-bar.js | 44 ++++++++++++++++++ .../cor-progress/cor-progress-components.js | 2 +- .../download-tarball-modal.component.html | 8 ++++ .../download-tarball-modal.css | 4 -- ...config.html => load-config.component.html} | 8 ++++ .../load-config/load-config.component.ts | 14 +++--- .../js/components/load-config/load-config.css | 0 .../registry-name/registry-name.html | 1 + .../components/registry-name/registry-name.js | 22 +++++++++ .../core-config-setup/config-setup-tool.html | 15 ++++-- config_app/js/setup/setup.component.js | 9 ---- config_app/js/setup/setup.html | 10 ++-- .../static/css/config-setup-app-component.css | 12 +++++ config_app/static/img/quay-logo.png | Bin 0 -> 36645 bytes config_app/templates/index.html | 3 +- 18 files changed, 131 insertions(+), 32 deletions(-) create mode 100644 config_app/js/components/cor-floating-bottom-bar/cor-floating-bottom-bar.html create mode 100644 config_app/js/components/cor-floating-bottom-bar/cor-floating-bottom-bar.js rename config_app/js/components/load-config/{load-config.html => load-config.component.html} (70%) delete mode 100644 config_app/js/components/load-config/load-config.css create mode 100644 config_app/js/components/registry-name/registry-name.html create mode 100644 config_app/js/components/registry-name/registry-name.js create mode 100644 config_app/static/img/quay-logo.png diff --git a/config_app/config_endpoints/common.py b/config_app/config_endpoints/common.py index 2cb1c2dc8..9551101b4 100644 --- a/config_app/config_endpoints/common.py +++ b/config_app/config_endpoints/common.py @@ -5,6 +5,9 @@ import re from flask import make_response, render_template from flask_restful import reqparse +from config import frontend_visible_config + +from config_app.c_app import app from config_app._init_config import ROOT_DIR @@ -45,6 +48,7 @@ def render_page_template(name, route_data=None, js_bundle_name=DEFAULT_JS_BUNDLE contents = render_template(name, route_data=route_data, main_scripts=main_scripts, + config_set=frontend_visible_config(app.config), **kwargs) resp = make_response(contents) diff --git a/config_app/config_util/config/TransientDirectoryProvider.py b/config_app/config_util/config/TransientDirectoryProvider.py index 2e0509e74..3737ec732 100644 --- a/config_app/config_util/config/TransientDirectoryProvider.py +++ b/config_app/config_util/config/TransientDirectoryProvider.py @@ -16,6 +16,10 @@ class TransientDirectoryProvider(FileConfigProvider): self.temp_dir = temp_dir super(TransientDirectoryProvider, self).__init__(temp_dir.name, yaml_filename, py_filename) + @property + def provider_id(self): + return 'transient' + def new_config_dir(self): """ Update the path with a new temporary directory, deleting the old one in the process diff --git a/config_app/js/components/cor-floating-bottom-bar/cor-floating-bottom-bar.html b/config_app/js/components/cor-floating-bottom-bar/cor-floating-bottom-bar.html new file mode 100644 index 000000000..11615e6a8 --- /dev/null +++ b/config_app/js/components/cor-floating-bottom-bar/cor-floating-bottom-bar.html @@ -0,0 +1,3 @@ +
+ +
diff --git a/config_app/js/components/cor-floating-bottom-bar/cor-floating-bottom-bar.js b/config_app/js/components/cor-floating-bottom-bar/cor-floating-bottom-bar.js new file mode 100644 index 000000000..ae18dcae7 --- /dev/null +++ b/config_app/js/components/cor-floating-bottom-bar/cor-floating-bottom-bar.js @@ -0,0 +1,44 @@ +const templateUrl = require('./cor-floating-bottom-bar.html'); + +angular.module('quay-config') + .directive('corFloatingBottomBar', function() { + var directiveDefinitionObject = { + priority: 3, + templateUrl, + replace: true, + transclude: true, + restrict: 'C', + scope: {}, + controller: function($rootScope, $scope, $element, $timeout, $interval) { + var handler = function() { + $element.removeClass('floating'); + $element.css('width', $element[0].parentNode.clientWidth + 'px'); + + var windowHeight = $(window).height(); + var rect = $element[0].getBoundingClientRect(); + if (rect.bottom > windowHeight) { + $element.addClass('floating'); + } + }; + + $(window).on("scroll", handler); + $(window).on("resize", handler); + + var previousHeight = $element[0].parentNode.clientHeight; + var stop = $interval(function() { + var currentHeight = $element[0].parentNode.clientWidth; + if (previousHeight != currentHeight) { + currentHeight = previousHeight; + handler(); + } + }, 100); + + $scope.$on('$destroy', function() { + $(window).off("resize", handler); + $(window).off("scroll", handler); + $interval.cancel(stop); + }); + } + }; + return directiveDefinitionObject; + }); diff --git a/config_app/js/components/cor-progress/cor-progress-components.js b/config_app/js/components/cor-progress/cor-progress-components.js index a8bc9b3b9..bbc955792 100644 --- a/config_app/js/components/cor-progress/cor-progress-components.js +++ b/config_app/js/components/cor-progress/cor-progress-components.js @@ -13,7 +13,7 @@ angular.module('quay-config') transclude: true, restrict: 'C', scope: { - 'progress': '=progress' + 'progress': '=?progress' }, controller: function($rootScope, $scope, $element) { $scope.$watch('progress', function(progress) { diff --git a/config_app/js/components/download-tarball-modal/download-tarball-modal.component.html b/config_app/js/components/download-tarball-modal/download-tarball-modal.component.html index dfc95c578..faa206531 100644 --- a/config_app/js/components/download-tarball-modal/download-tarball-modal.component.html +++ b/config_app/js/components/download-tarball-modal/download-tarball-modal.component.html @@ -5,6 +5,14 @@ + @@ -1605,9 +1606,17 @@