mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-27 02:56:01 +01:00
CP-15409: Add read-only mode to License manager
Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
parent
249489220b
commit
f12b4765b6
@ -291,7 +291,16 @@ namespace XenAdmin.Controls.CheckableDataGridView
|
|||||||
if (rowIndex < 0 || rowIndex >= Rows.Count)
|
if (rowIndex < 0 || rowIndex >= Rows.Count)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CurrentCell = Rows[rowIndex].Cells[0];
|
CurrentCell = null;
|
||||||
|
// Set CurrentCell to first visible cell
|
||||||
|
for (int i = 0; i < Rows[rowIndex].Cells.Count; i++)
|
||||||
|
{
|
||||||
|
if (Rows[rowIndex].Cells[i].Visible)
|
||||||
|
{
|
||||||
|
CurrentCell = Rows[rowIndex].Cells[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
Rows[rowIndex].Selected = highlightStatus;
|
Rows[rowIndex].Selected = highlightStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,6 +388,12 @@ namespace XenAdmin.Core
|
|||||||
{ return HiddenFeatures != null && HiddenFeatures.Contains(UPLOAD_OPTION_HIDDEN); }
|
{ return HiddenFeatures != null && HiddenFeatures.Contains(UPLOAD_OPTION_HIDDEN); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static bool LicenseOperationsHidden
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{ return HiddenFeatures != null && HiddenFeatures.Contains(LICENSE_OPERATIONS_HIDDEN); }
|
||||||
|
}
|
||||||
|
|
||||||
private const string SSL_CERTIFICATES_CHANGED_ONLY = "CHANGED";
|
private const string SSL_CERTIFICATES_CHANGED_ONLY = "CHANGED";
|
||||||
private const string SSL_CERTIFICATES_ALL = "ALL";
|
private const string SSL_CERTIFICATES_ALL = "ALL";
|
||||||
private const string SSL_CERTIFICATES_KEY = "ForceSSLCertificates";
|
private const string SSL_CERTIFICATES_KEY = "ForceSSLCertificates";
|
||||||
@ -417,8 +423,9 @@ namespace XenAdmin.Core
|
|||||||
private const string TOOL_STRIP_MENU_ITEM_HIDDEN = "tool_strip_menu_item";
|
private const string TOOL_STRIP_MENU_ITEM_HIDDEN = "tool_strip_menu_item";
|
||||||
private const string CROSS_SERVER_PRIVATE_NETWORK_HIDDEN = "cross_server_private_network";
|
private const string CROSS_SERVER_PRIVATE_NETWORK_HIDDEN = "cross_server_private_network";
|
||||||
private const string COPYRIGHT_HIDDEN = "copyright";
|
private const string COPYRIGHT_HIDDEN = "copyright";
|
||||||
private const string HEALTH_CHECK_HIDDEN = "health_check";
|
private const string HEALTH_CHECK_HIDDEN = "health_check";
|
||||||
private const string UPLOAD_OPTION_HIDDEN = "upload_option";
|
private const string UPLOAD_OPTION_HIDDEN = "upload_option";
|
||||||
|
private const string LICENSE_OPERATIONS_HIDDEN = "license_operations";
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SSLCertificateTypes { None, Changed, All }
|
public enum SSLCertificateTypes { None, Changed, All }
|
||||||
|
@ -60,5 +60,6 @@ namespace XenAdmin.Dialogs
|
|||||||
Control Parent { get; }
|
Control Parent { get; }
|
||||||
void DrawSummaryInformation(string info, bool show);
|
void DrawSummaryInformation(string info, bool show);
|
||||||
void SetRowDisabledRowInfo(int rowIndex, string info, bool disabled);
|
void SetRowDisabledRowInfo(int rowIndex, string info, bool disabled);
|
||||||
|
void DrawViewAsReadOnly(bool isReadOnly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,7 @@ using System.Windows.Forms;
|
|||||||
using XenAdmin.Controls;
|
using XenAdmin.Controls;
|
||||||
using XenAdmin.Controls.CheckableDataGridView;
|
using XenAdmin.Controls.CheckableDataGridView;
|
||||||
using XenAdmin.Controls.SummaryPanel;
|
using XenAdmin.Controls.SummaryPanel;
|
||||||
|
using XenAdmin.Core;
|
||||||
using XenAdmin.Properties;
|
using XenAdmin.Properties;
|
||||||
using XenAPI;
|
using XenAPI;
|
||||||
|
|
||||||
@ -57,6 +58,7 @@ namespace XenAdmin.Dialogs
|
|||||||
checkableDataGridView.LoadView();
|
checkableDataGridView.LoadView();
|
||||||
Controller = lmcontroller;
|
Controller = lmcontroller;
|
||||||
Controller.View = this;
|
Controller.View = this;
|
||||||
|
downloadLicenseServerLink.Visible = checkBoxColumn.Visible = !Controller.ReadOnlyView;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadView(List<IXenObject> itemsToShow, List<IXenObject> selectedItems)
|
private void LoadView(List<IXenObject> itemsToShow, List<IXenObject> selectedItems)
|
||||||
@ -167,7 +169,7 @@ namespace XenAdmin.Dialogs
|
|||||||
Program.Invoke(this, Controller.Repopulate);
|
Program.Invoke(this, Controller.Repopulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region ISummaryPanelView Members
|
#region ILicenseManagerView Members
|
||||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||||
public LicenseManagerController Controller { set; private get; }
|
public LicenseManagerController Controller { set; private get; }
|
||||||
|
|
||||||
@ -206,7 +208,7 @@ namespace XenAdmin.Dialogs
|
|||||||
|
|
||||||
summaryPanel.Title = lRow.XenObject.Name;
|
summaryPanel.Title = lRow.XenObject.Name;
|
||||||
summaryPanel.HelperUrl = Messages.LICENSE_MANAGER_BUY_LICENSE_LINK_TEXT;
|
summaryPanel.HelperUrl = Messages.LICENSE_MANAGER_BUY_LICENSE_LINK_TEXT;
|
||||||
summaryPanel.HelperUrlVisible = lRow.HelperUrlRequired;
|
summaryPanel.HelperUrlVisible = lRow.HelperUrlRequired && !Controller.ReadOnlyView;
|
||||||
summaryPanel.WarningVisible = lRow.WarningRequired;
|
summaryPanel.WarningVisible = lRow.WarningRequired;
|
||||||
summaryPanel.WarningText = lRow.WarningText;
|
summaryPanel.WarningText = lRow.WarningText;
|
||||||
summaryPanel.SummaryText = summaryComponent;
|
summaryPanel.SummaryText = summaryComponent;
|
||||||
@ -295,6 +297,23 @@ namespace XenAdmin.Dialogs
|
|||||||
checkableDataGridView.SetRowInformation(rowIndex, info, disabled);
|
checkableDataGridView.SetRowInformation(rowIndex, info, disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||||
|
public void DrawViewAsReadOnly(bool isReadOnly)
|
||||||
|
{
|
||||||
|
if (isReadOnly)
|
||||||
|
{
|
||||||
|
activateFreeXenServerButton.Hide();
|
||||||
|
assignLicenceButton.Hide();
|
||||||
|
releaseLicenseButton.Hide();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
activateFreeXenServerButton.Show();
|
||||||
|
assignLicenceButton.Show();
|
||||||
|
releaseLicenseButton.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ namespace XenAdmin.Dialogs
|
|||||||
{
|
{
|
||||||
ActivationRequest = new LicenseActivationRequest();
|
ActivationRequest = new LicenseActivationRequest();
|
||||||
VerifierFactory = new LicenseSelectionVerifierFactory();
|
VerifierFactory = new LicenseSelectionVerifierFactory();
|
||||||
|
ReadOnlyView = Registry.LicenseOperationsHidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LicenseManagerController(ILicenseManagerView view)
|
public LicenseManagerController(ILicenseManagerView view)
|
||||||
@ -64,6 +65,8 @@ namespace XenAdmin.Dialogs
|
|||||||
|
|
||||||
public SelectionVerifierFactory VerifierFactory { private get; set; }
|
public SelectionVerifierFactory VerifierFactory { private get; set; }
|
||||||
|
|
||||||
|
public bool ReadOnlyView { get; private set; }
|
||||||
|
|
||||||
private void AddToGrid(List<IXenObject> dataToDraw)
|
private void AddToGrid(List<IXenObject> dataToDraw)
|
||||||
{
|
{
|
||||||
View.DrawRowsInGrid(ConvertXenObjects(dataToDraw));
|
View.DrawRowsInGrid(ConvertXenObjects(dataToDraw));
|
||||||
@ -107,7 +110,7 @@ namespace XenAdmin.Dialogs
|
|||||||
|
|
||||||
private void CheckPreSelectedRows(List<IXenObject> dataToCheck)
|
private void CheckPreSelectedRows(List<IXenObject> dataToCheck)
|
||||||
{
|
{
|
||||||
if(dataToCheck.Count < 1)
|
if (dataToCheck.Count < 1 || ReadOnlyView)
|
||||||
{
|
{
|
||||||
DisableAllButtons();
|
DisableAllButtons();
|
||||||
return;
|
return;
|
||||||
@ -297,13 +300,15 @@ namespace XenAdmin.Dialogs
|
|||||||
public void UpdateButtonEnablement(List<LicenseDataGridViewRow> lRows)
|
public void UpdateButtonEnablement(List<LicenseDataGridViewRow> lRows)
|
||||||
{
|
{
|
||||||
//All buttons disabled?
|
//All buttons disabled?
|
||||||
if(lRows.Count < 1)
|
if(lRows.Count < 1 || ReadOnlyView)
|
||||||
{
|
{
|
||||||
DisableAllButtons();
|
DisableAllButtons();
|
||||||
|
View.DrawViewAsReadOnly(ReadOnlyView);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
View.DrawViewAsReadOnly(ReadOnlyView);
|
||||||
|
|
||||||
LicenseSelectionVerifier verifier;
|
LicenseSelectionVerifier verifier;
|
||||||
verifier = VerifierFactory.Verifier(SelectionVerifierFactory.Option.NotLive, lRows);
|
verifier = VerifierFactory.Verifier(SelectionVerifierFactory.Option.NotLive, lRows);
|
||||||
if (verifier.Status == LicenseSelectionVerifier.VerificationStatus.Error)
|
if (verifier.Status == LicenseSelectionVerifier.VerificationStatus.Error)
|
||||||
@ -351,7 +356,7 @@ namespace XenAdmin.Dialogs
|
|||||||
View.DrawAssignButtonAsDisabled(true);
|
View.DrawAssignButtonAsDisabled(true);
|
||||||
View.DrawReleaseButtonAsDisabled(true);
|
View.DrawReleaseButtonAsDisabled(true);
|
||||||
View.DrawActivateButtonAsDisabled(true);
|
View.DrawActivateButtonAsDisabled(true);
|
||||||
View.DrawActivateButtonAsHidden(false);
|
View.DrawActivateButtonAsHidden(ReadOnlyView);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ResetButtonEnablement()
|
private void ResetButtonEnablement()
|
||||||
|
Loading…
Reference in New Issue
Block a user