Skip to content

Commit

Permalink
Browse DB: Add initial UI displaying selected item in TopMenu
Browse files Browse the repository at this point in the history
(reference #40)
  • Loading branch information
piotrzarzycki21 committed Oct 30, 2023
1 parent 4bb2346 commit 4bebed3
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ package interfaces
{
import classes.breadcrump.Breadcrump;
import classes.topMenu.TopMenu;
import model.vo.ServerVO;

public interface IBrowseMyServerView extends IResetView
{
function get breadcrump():Breadcrump;
function get topMenu():TopMenu;
function get selectedItem():ServerVO;
function set selectedItem(value:ServerVO):void;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ package mediator.bookmarks
private function onTopMenuItemChange(event:TopMenuEvent):void
{
this.view.breadcrump.buildBreadcrump(event.item);
view.selectedItem = event.item.data;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ package model.vo
public var bookmarkCount:int;

public var serverPath:Array = [];
public var databaseName:String;

public function ServerVO(name:String = "", type:String = "", url:String = "", nomadURL:String = "",
server:String = "", database:String = "", view:String = "",
Expand All @@ -33,12 +34,12 @@ package model.vo

private var _server:String;

private function get server():String
public function get server():String
{
return _server;
}

private function set server(value:String):void
public function set server(value:String):void
{
if (_server != value)
{
Expand All @@ -47,6 +48,10 @@ package model.vo
if (value)
{
serverPath = value.split("/");
if (serverPath && serverPath.length > 0)
{
databaseName = serverPath[serverPath.length - 1];
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<j:VGroup xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:j="library://ns.apache.org/royale/jewel"
xmlns:js="library://ns.apache.org/royale/basic" xmlns:breadcrump="classes.breadcrump.*" xmlns:topMenu="classes.topMenu.*"
xmlns:js="library://ns.apache.org/royale/basic" xmlns:breadcrump="classes.breadcrump.*" xmlns:topMenu="classes.topMenu.*" xmlns:html="library://ns.apache.org/royale/html" xmlns:controls="view.controls.*"
implements="interfaces.IBrowseMyServerView" gap="1">

<j:beads>
Expand All @@ -12,7 +12,22 @@
<![CDATA[
import classes.breadcrump.Breadcrump;
import classes.topMenu.TopMenu;
import utils.ClipboardText;
import model.vo.ServerVO;
private var _selectedItem:ServerVO;
[Bindable]
public function get selectedItem():ServerVO
{
return _selectedItem;
}
public function set selectedItem(value:ServerVO):void
{
_selectedItem = value;
}
public function get breadcrump():Breadcrump
{
return this.browserBreadcrump;
Expand All @@ -32,8 +47,56 @@
<breadcrump:Breadcrump localId="browserBreadcrump"/>
<j:HGroup percentWidth="100" percentHeight="100" gap="1">
<topMenu:TopMenu localId="browserTopMenu" />
<j:VGroup localId="contentBrowseMyServer" percentWidth="100">

<j:VGroup localId="contentBrowseMyServer" percentWidth="100"
itemsHorizontalAlign="itemsCenter">
<j:Card>
<j:CardHeader>
<html:H4 text="{selectedItem.databaseName}" percentWidth="100"/>
</j:CardHeader>
<j:CardPrimaryContent>
<j:Form>
<controls:CustomFormItem className="horizontalContentCenterExpandFormItem"
labelClass="formItemAppDetailsLabel"
label="Title:">
<j:Label text="{selectedItem.name}" />
</controls:CustomFormItem>
<controls:CustomFormItem className="horizontalContentCenterExpandFormItem"
labelClass="formItemAppDetailsLabel"
label="Server:">
<j:Label text="{selectedItem.server}" />
<j:HGroup itemsHorizontalAlign="itemsRight">
<j:Button localId="serverCopyToClpboard" text="Copy to Clipboard" width="135" />
</j:HGroup>
</controls:CustomFormItem>
<controls:CustomFormItem className="horizontalContentCenterExpandFormItem"
labelClass="formItemAppDetailsLabel"
label="Database:">
<j:Label text="{selectedItem.database}" />
<j:HGroup itemsHorizontalAlign="itemsRight">
<j:Button localId="databaseCopyToClipboard" text="Copy to Clipboard" width="135" />
</j:HGroup>
</controls:CustomFormItem>
<controls:CustomFormItem className="horizontalContentCenterExpandFormItem"
labelClass="formItemAppDetailsLabel"
label="View:">
<j:Label text="{selectedItem.view}" />
</controls:CustomFormItem>
<controls:CustomFormItem className="horizontalContentCenterExpandFormItem"
labelClass="formItemAppDetailsLabel"
label="ReplicaID:">
<j:Label text="{selectedItem.replicaID}" />
<j:HGroup itemsHorizontalAlign="itemsRight">
<j:Button localId="replicaCopyToClipboard" text="Copy to Clipboard" width="135" />
</j:HGroup>
</controls:CustomFormItem>
</j:Form>
</j:CardPrimaryContent>
<j:CardActions itemsHorizontalAlign="itemsRight">
<j:Button text="Add Bookmark" className="noLinkStyle"/>
<j:Button text="Open in Client" className="noLinkStyle"/>
<j:Button text="Open in Nomad" className="noLinkStyle"/>
</j:CardActions>
</j:Card>
</j:VGroup>
</j:HGroup>
</j:VGroup>

0 comments on commit 4bebed3

Please sign in to comment.