Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrzarzycki21 committed Aug 23, 2023
2 parents e35023d + 89c8f9d commit 7650521
Show file tree
Hide file tree
Showing 10 changed files with 384 additions and 12 deletions.
4 changes: 4 additions & 0 deletions Assets/text/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -389,5 +389,9 @@
"browsernotdetected": "%1 not detected",
"configurebrowser": "Configure"
}
},
"servicetypepage": {
"title": "What would you like to create?",
"continue": "Continue"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class GenesisApplicationTheme extends ClassVariantTheme {
public static final CHECK_LARGE:String = "check-large";
public static final CHECK_MEDIUM:String = "check-medium";
public static final INVALID:String = "invalid";
public static final LABEL_DEFAULT:String = "label-default";
public static final LABEL_CENTERED:String = "label-centered";
public static final LABEL_COPYRIGHT:String = "label-copyright";
public static final LABEL_COPYRIGHT_CENTER:String = "label-copyright-center";
Expand Down Expand Up @@ -303,6 +304,7 @@ class GenesisApplicationTheme extends ClassVariantTheme {
this.styleProvider.setStyleFunction( Header, Alert.CHILD_VARIANT_HEADER, _setAlertHeaderStyles );
this.styleProvider.setStyleFunction( Label, Alert.CHILD_VARIANT_MESSAGE_LABEL, _setLabelAlertStyles );
this.styleProvider.setStyleFunction( Label, DefaultToolTipManager.CHILD_VARIANT_TOOL_TIP, _setToolTipStyles );
this.styleProvider.setStyleFunction( Label, LABEL_DEFAULT, _setLabelDefaultStyles );
this.styleProvider.setStyleFunction( Label, LABEL_CENTERED, _setLabelCenteredStyles );
this.styleProvider.setStyleFunction( Label, LABEL_COPYRIGHT, _setLabelCopyrightStyles );
this.styleProvider.setStyleFunction( Label, LABEL_COPYRIGHT_CENTER, _setLabelCopyrightCenterStyles );
Expand Down Expand Up @@ -569,6 +571,10 @@ class GenesisApplicationTheme extends ClassVariantTheme {

}

function _setLabelDefaultStyles(label:Label) {
label.textFormat = _themeTypography.Default;
}

function _setLabelCenteredStyles( label:Label ) {

label.textFormat = _themeTypography.DefaultCentered;
Expand Down
50 changes: 45 additions & 5 deletions Source/SuperHumanInstaller.hx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@

package;

import superhuman.server.data.ServiceTypeData;
import superhuman.server.provisioners.ProvisionerType;
import superhuman.components.serviceType.ServiceTypePage;
import genesis.application.events.GenesisApplicationEvent;
import cpp.NativeSys;
import haxe.io.Path;
Expand Down Expand Up @@ -97,6 +100,7 @@ class SuperHumanInstaller extends GenesisApplication {
static final _TEXT_LINK_VIRTUALBOX:String = "VirtualBox";
static final _TEXT_LINK_YAML:String = "YAML";

static public final PAGE_SERVICE_TYPE = "page-service-type";
static public final PAGE_CONFIG = "page-config";
static public final PAGE_CONFIG_ADVANCED = "page-config-advanced";
static public final PAGE_HELP = "page-help";
Expand Down Expand Up @@ -126,6 +130,7 @@ class SuperHumanInstaller extends GenesisApplication {

var _advancedConfigPage:AdvancedConfigPage;
var _appCheckerOverlay:LayoutGroup;
var _serviceTypePage:ServiceTypePage;
var _config:SuperHumanConfig;
var _configPage:ConfigPage;
var _defaultRoles:Map<String, RoleData>;
Expand All @@ -140,7 +145,8 @@ class SuperHumanInstaller extends GenesisApplication {
var _vagrantFile:String;
var _setupBrowserPage:SetupBrowserPage;
var _browsersCollection:Array<BrowserData>;

var _serviceTypesCollection:Array<ServiceTypeData>;

public var config( get, never ):SuperHumanConfig;
function get_config() return _config;

Expand Down Expand Up @@ -248,6 +254,21 @@ class SuperHumanInstaller extends GenesisApplication {
if ( this._window.y < 0 ) this._window.y = 0;

}

_serviceTypesCollection = [
{value: "Standalone Domino Server",
description: "A new, independent Domino Server",
provisionerType: ProvisionerType.DemoTasks,
isEnabled: true},
{value: "Additional Domino Server",
description: "Join a new server to an existing Domino environment",
provisionerType: "",
isEnabled: false},
{value: "Volt MX Go Foundry Server",
description: "Coming soon!",
provisionerType: "",
isEnabled: false}
];

Server.keepFailedServersRunning = _config.preferences.keepfailedserversrunning;
Shell.getInstance().findProcessId( 'SuperHumanInstaller', null, _processIdFound );
Expand Down Expand Up @@ -301,7 +322,7 @@ class SuperHumanInstaller extends GenesisApplication {
_serverPage = new ServerPage( ServerManager.getInstance().servers, SuperHumanGlobals.MAXIMUM_ALLOWED_SERVERS );
_serverPage.addEventListener( SuperHumanApplicationEvent.CONFIGURE_SERVER, _configureServer );
_serverPage.addEventListener( SuperHumanApplicationEvent.COPY_TO_CLIPBOARD, _copyToClipboard );
_serverPage.addEventListener( SuperHumanApplicationEvent.CREATE_SERVER, _createServer );
_serverPage.addEventListener( SuperHumanApplicationEvent.START_CONFIGURE_SERVER, _startConfigureServer);
_serverPage.addEventListener( SuperHumanApplicationEvent.DELETE_SERVER, _deleteServer );
_serverPage.addEventListener( SuperHumanApplicationEvent.DESTROY_SERVER, _destroyServer );
_serverPage.addEventListener( SuperHumanApplicationEvent.DOWNLOAD_VAGRANT, _downloadVagrant );
Expand All @@ -322,6 +343,11 @@ class SuperHumanInstaller extends GenesisApplication {
_helpPage.addEventListener( SuperHumanApplicationEvent.TEXT_LINK, _helpPageTextLink );
this.addPage( _helpPage, PAGE_HELP );

_serviceTypePage = new ServiceTypePage(_serviceTypesCollection);
_serviceTypePage.addEventListener( SuperHumanApplicationEvent.CREATE_SERVER, _createServer);
_serviceTypePage.addEventListener( SuperHumanApplicationEvent.CLOSE_SERVICE_TYPE_PAGE, _cancelServiceType );
this.addPage( _serviceTypePage, PAGE_SERVICE_TYPE );

_configPage = new ConfigPage();
_configPage.addEventListener( SuperHumanApplicationEvent.ADVANCED_CONFIGURE_SERVER, _advancedConfigureServer );
_configPage.addEventListener( SuperHumanApplicationEvent.CANCEL_PAGE, _cancelConfigureServer );
Expand Down Expand Up @@ -520,10 +546,20 @@ class SuperHumanInstaller extends GenesisApplication {

}

function _cancelConfigureServer( e:SuperHumanApplicationEvent ) {

function _cancelServiceType( e:SuperHumanApplicationEvent ) {
this.selectedPageId = PAGE_SERVER;
}

function _cancelConfigureServer( e:SuperHumanApplicationEvent ) {

if (this.previousPageId != PAGE_SERVICE_TYPE)
{
this.selectedPageId = PAGE_SERVER;
}
else
{
this.selectedPageId = PAGE_SERVICE_TYPE;
}
}

function _cancelAdvancedConfigureServer( e:SuperHumanApplicationEvent ) {
Expand Down Expand Up @@ -1012,7 +1048,11 @@ class SuperHumanInstaller extends GenesisApplication {
}

}


function _startConfigureServer(e:SuperHumanApplicationEvent) {
this.selectedPageId = PAGE_SERVICE_TYPE;
}

function _showCPUArchitectureNotSupportedWarning() {

Alert.show(
Expand Down
11 changes: 6 additions & 5 deletions Source/superhuman/components/ServerPage.hx
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,12 @@ class ServerPage extends Page {
}

function _createServerButtonTriggered( e:TriggerEvent ) {

var event = new SuperHumanApplicationEvent( SuperHumanApplicationEvent.CREATE_SERVER );
event.provisionerType = ProvisionerType.DemoTasks;
this.dispatchEvent( event );


/*var event = new SuperHumanApplicationEvent( SuperHumanApplicationEvent.CREATE_SERVER );
event.provisionerType = ProvisionerType.DemoTasks;
this.dispatchEvent( event );*/

this.dispatchEvent(new SuperHumanApplicationEvent(SuperHumanApplicationEvent.START_CONFIGURE_SERVER));
}

function _headerInputChanged( e:Event ) {
Expand Down
120 changes: 120 additions & 0 deletions Source/superhuman/components/serviceType/ServiceTypeGrid.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
package superhuman.components.serviceType;

import feathers.skins.RectangleSkin;
import feathers.layout.HorizontalLayoutData;
import feathers.layout.HorizontalLayout;
import feathers.data.GridViewCellState;
import feathers.data.GridViewHeaderState;
import feathers.layout.AnchorLayoutData;
import feathers.utils.DisplayObjectRecycler;
import superhuman.server.data.ServiceTypeData;
import feathers.data.IFlatCollection;
import genesis.application.theme.GenesisApplicationTheme;
import feathers.controls.Label;
import feathers.controls.dataRenderers.LayoutGroupItemRenderer;
import feathers.controls.GridView;
import superhuman.theme.SuperHumanInstallerTheme;

class ServiceTypeGrid extends GridView
{
public function new(?dataProvider:IFlatCollection<ServiceTypeData>)
{
super(dataProvider);

this.variant = GridView.VARIANT_BORDERLESS;
this.layoutData = AnchorLayoutData.fill();

var backgroundSkin = new RectangleSkin();
backgroundSkin.fill = SolidColor(0x222222);
backgroundSkin.width = 16.0;
backgroundSkin.height = 16.0;
this.backgroundSkin = backgroundSkin;

this.headerRendererRecycler = DisplayObjectRecycler.withFunction(() -> {
return (new GridViewHeader());
}, (itemRenderer:GridViewHeader, state:GridViewHeaderState) -> {
itemRenderer.label.text = state.text;
},
(itemRenderer:GridViewHeader, state:GridViewHeaderState) -> {
itemRenderer.label.text = "";
});

this.cellRendererRecycler = DisplayObjectRecycler.withFunction(() -> {
return (new GridViewColumnMultiline());
}, (itemRenderer:GridViewColumnMultiline, state:GridViewCellState) -> {
itemRenderer.label.text = state.text;
itemRenderer.label.enabled = state.data.isEnabled;
itemRenderer.enabled = state.data.isEnabled;
state.enabled = state.data.isEnabled;
},
(itemRenderer:GridViewColumnMultiline, state:GridViewCellState) -> {
itemRenderer.label.text = "";
});
}
}

@:styleContext
class GridViewHeader extends LayoutGroupItemRenderer
{
private var _label:Label;
public var label(get, never):Label;
private function get_label():Label
{
return this._label;
}

override private function initialize():Void
{
this.variant = SuperHumanInstallerTheme.GRID_VIEW_HEADER_VARIANT;

var layout = new HorizontalLayout();
layout.gap = 6.0;
layout.paddingTop = 2.0;
layout.paddingBottom = 4.0;
layout.paddingLeft = 8.0;
layout.paddingRight = 8.0;
layout.verticalAlign = MIDDLE;
this.layout = layout;

this._label = new Label();
this._label.variant = GenesisApplicationTheme.LABEL_DEFAULT;
this._label.wordWrap = true;
this._label.layoutData = new HorizontalLayoutData(100, null);
this.addChild(_label);

super.initialize();
}
}

@:styleContext
class GridViewColumnMultiline extends LayoutGroupItemRenderer
{
private var _label:Label;
public var label(get, never):Label;
private function get_label():Label
{
return this._label;
}

override private function initialize():Void
{
this.variant = SuperHumanInstallerTheme.GRID_VIEW_COLUMN_VARIANT;

var layout = new HorizontalLayout();
layout.gap = 6.0;
layout.paddingTop = 2.0;
layout.paddingBottom = 4.0;
layout.paddingLeft = 8.0;
layout.paddingRight = 8.0;
layout.verticalAlign = MIDDLE;
this.layout = layout;

this._label = new Label();
this._label.variant = GenesisApplicationTheme.LABEL_DEFAULT;
this._label.wordWrap = true;
this._label.layoutData = new HorizontalLayoutData(100, null);
this.addChild(_label);

super.initialize();
}
}
Loading

0 comments on commit 7650521

Please sign in to comment.