Fix alembic migrations importing app

Ensure we connect to loaded config db
This commit is contained in:
Sam Chow 2018-06-19 13:46:34 -04:00
parent bb2b28cd11
commit b5f630ba29
18 changed files with 69 additions and 81 deletions

View file

@ -23,4 +23,4 @@
</div>
</div>
<div ng-if="$ctrl.state === 'setup'" class="setup"></div>
<load-config ng-if="$ctrl.state === 'load'"></load-config>
<load-config ng-if="$ctrl.state === 'load'" config-loaded="$ctrl.configLoaded()"></load-config>

View file

@ -22,4 +22,8 @@ export class ConfigSetupAppComponent {
private chooseLoad(): void {
this.state = 'load';
}
private configLoaded(): void {
this.state = 'setup';
}
}

View file

@ -1,4 +1,4 @@
import { Component, Inject } from 'ng-metadata/core';
import {Component, EventEmitter, Inject, Output} from 'ng-metadata/core';
const templateUrl = require('./load-config.html');
const styleUrl = require('./load-config.css');
@ -10,7 +10,7 @@ const styleUrl = require('./load-config.css');
export class LoadConfigComponent {
private readyToSubmit: boolean = false;
private uploadFunc: Function;
private state: 'load' | 'validate' = 'load';
@Output() public configLoaded: EventEmitter<any> = new EventEmitter();
private constructor(@Inject('ApiService') private apiService: any) {
}
@ -27,9 +27,8 @@ export class LoadConfigComponent {
private uploadTarball() {
this.uploadFunc(success => {
if (success) {
this.state = 'validate';
}
else {
this.configLoaded.emit({});
} else {
this.apiService.errorDisplay('Error loading configuration',
'Could not upload configuration. Please reload the page and try again.\n' +
'If this problem persists, please contact support')();

View file

@ -1,4 +0,0 @@
.load-config__body strong {
}

View file

@ -1,4 +1,4 @@
<div ng-if="$ctrl.state === 'load'">
<div>
<div class="co-dialog modal fade initial-setup-modal in" id="setupModal" style="display: block;">
<div class="modal-backdrop fade in" style="height: 1000px;"></div>
<div class="modal-dialog fade in">
@ -26,22 +26,3 @@
</div><!-- /.modal-dialog -->
</div>
</div>
<div ng-if="$ctrl.state === 'validate'">
<div class="co-dialog modal fade initial-setup-modal in" id="validateModal" style="display: block;">
<div class="modal-backdrop fade in" style="height: 1000px;"></div>
<div class="modal-dialog fade in">
<div class="modal-content">
<!-- Header -->
<div class="modal-header">
<h4 class="modal-title"><span>Validate Config</span></h4>
</div>
<!-- Body -->
<div class="modal-body">
<span>Validating Config...</span>
spinner here...
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
</div>

View file

@ -190,9 +190,10 @@ angular.module("quay-config")
};
$scope.validateHostname = function(hostname) {
if (hostname.indexOf('127.0.0.1') == 0 || hostname.indexOf('localhost') == 0) {
return 'Please specify a non-localhost hostname. "localhost" will refer to the container, not your machine.'
}
// TODO(sam): maybe revert?
// if (hostname.indexOf('127.0.0.1') == 0 || hostname.indexOf('localhost') == 0) {
// return 'Please specify a non-localhost hostname. "localhost" will refer to the container, not your machine.'
// }
return null;
};

View file

@ -31,9 +31,10 @@ const templateUrl = require('./setup.html');
$scope.HOSTNAME_REGEX = '^[a-zA-Z-0-9_\.\-]+(:[0-9]+)?$';
$scope.validateHostname = function(hostname) {
if (hostname.indexOf('127.0.0.1') == 0 || hostname.indexOf('localhost') == 0) {
return 'Please specify a non-localhost hostname. "localhost" will refer to the container, not your machine.'
}
// TODO(sam): maybe revert?
// if (hostname.indexOf('127.0.0.1') == 0 || hostname.indexOf('localhost') == 0) {
// return 'Please specify a non-localhost hostname. "localhost" will refer to the container, not your machine.'
// }
return null;
};
@ -65,9 +66,6 @@ const templateUrl = require('./setup.html');
// Database is being setup.
'DB_SETUP': 'setup-db',
// Database setup has succeeded.
'DB_SETUP_SUCCESS': 'setup-db-success',
// An error occurred when setting up the database.
'DB_SETUP_ERROR': 'setup-db-error',
@ -262,7 +260,7 @@ const templateUrl = require('./setup.html');
$scope.createSuperUser = function() {
$scope.currentStep = $scope.States.CREATING_SUPERUSER;
ApiService.scCreateInitialSuperuser($scope.superUser, null).then(function(resp) {
UserService.load();
// UserService.load();
$scope.checkStatus();
}, function(resp) {
$scope.currentStep = $scope.States.SUPERUSER_ERROR;
@ -277,7 +275,7 @@ const templateUrl = require('./setup.html');
$scope.currentStep = $scope.States.DB_SETUP_ERROR;
$scope.errors.DatabaseSetupError = resp['error'];
} else {
$scope.currentStep = $scope.States.DB_SETUP_SUCCESS;
$scope.currentStep = $scope.States.CREATE_SUPERUSER;
}
}, ApiService.errorDisplay('Could not setup database. Please report this to support.'))
};

View file

@ -24,8 +24,8 @@
<div>Configure your Redis database and other settings below</div>
</div>
<config-setup-tool is-active="isStep(currentStep, States.CONFIG)"
configuration-saved="configurationSaved(config)"></config-setup-tool>
<div class="config-setup-tool" is-active="isStep(currentStep, States.CONFIG)"
configuration-saved="configurationSaved(config)"></divconfig-setup-tool>
</div>
</div>
</div>
@ -39,7 +39,7 @@
<span class="cor-step-bar" progress="stepProgress">
<span class="cor-step" title="Configure Database" text="1"></span>
<span class="cor-step" title="Setup Database" icon="database"></span>
<span class="cor-step" title="Container Restart" icon="refresh"></span>
<span class="cor-step" title="Container Restart" icon="sync"></span>
<span class="cor-step" title="Create Superuser" text="2"></span>
<span class="cor-step" title="Configure Registry" text="3"></span>
<span class="cor-step" title="Validate Configuration" text="4"></span>
@ -95,7 +95,7 @@
<div class="modal-body" style="padding: 20px;"
ng-show="isStep(currentStep, States.DB_RESTARTING, States.CONFIG_RESTARTING)">
<h4 style="margin-bottom: 20px;">
<i class="fa fa-lg fa-refresh" style="margin-right: 10px;"></i>
<i class="fa fa-lg fa-sync" style="margin-right: 10px;"></i>
<span class="registry-name"></span> is currently being restarted
</h4>
This can take several minutes. If the container does not restart on its own,