private void TestPanoramaServerUrls() { var PWEB = "panoramaweb.org"; var PWEB_FULL = "https://panoramaweb.org/"; var PWEB_LK = "panoramaweb.org/labkey"; var PWEB_LK_FULL = "https://panoramaweb.org/labkey/"; var serverUri = PanoramaUtil.ServerNameToUri(PWEB); var pServer = new PanoramaServer(serverUri, string.Empty, string.Empty); Assert.AreEqual(pServer.ServerUri.AbsoluteUri, PWEB_FULL); Assert.IsFalse(pServer.RemoveContextPath()); Assert.IsTrue(pServer.AddLabKeyContextPath()); Assert.AreEqual(pServer.ServerUri.AbsoluteUri, PWEB_LK_FULL); serverUri = PanoramaUtil.ServerNameToUri(PWEB_LK); pServer = new PanoramaServer(serverUri, string.Empty, string.Empty); Assert.AreEqual(pServer.ServerUri.AbsoluteUri, PWEB_LK_FULL); Assert.IsFalse(pServer.AddLabKeyContextPath()); Assert.IsTrue(pServer.RemoveContextPath()); Assert.AreEqual(pServer.ServerUri.AbsoluteUri, PWEB_FULL); serverUri = PanoramaUtil.ServerNameToUri(PWEB_LK); pServer = new PanoramaServer(serverUri, string.Empty, string.Empty); Assert.AreEqual(pServer.ServerUri, PWEB_LK_FULL); Assert.IsTrue(pServer.Redirect(PWEB_FULL + PanoramaUtil.ENSURE_LOGIN_PATH, PanoramaUtil.ENSURE_LOGIN_PATH)); Assert.AreEqual(pServer.ServerUri, PWEB_FULL); Assert.IsFalse(pServer.Redirect("/labkey/" + PanoramaUtil.ENSURE_LOGIN_PATH, PanoramaUtil.ENSURE_LOGIN_PATH)); // Need full URL Assert.IsFalse(pServer.Redirect("http:/another.server/" + PanoramaUtil.ENSURE_LOGIN_PATH, PanoramaUtil.ENSURE_LOGIN_PATH)); // Not the same host }
public static void AddChildContainers(Server server, TreeNode node, JToken folder) { JEnumerable <JToken> subFolders = folder["children"].Children(); // Not L10N foreach (var subFolder in subFolders) { string folderName = (string)subFolder["name"]; // Not L10N TreeNode folderNode = new TreeNode(folderName); AddChildContainers(server, folderNode, subFolder); // User can only upload to folders where TargetedMS is an active module. var canUpload = PanoramaUtil.CheckFolderPermissions(subFolder) && PanoramaUtil.CheckFolderType(subFolder); // If the user does not have write permissions in this folder or any // of its subfolders, do not add it to the tree. if (folderNode.Nodes.Count == 0 && !canUpload) { continue; } node.Nodes.Add(folderNode); // User cannot upload files to folder if (!canUpload) { folderNode.ForeColor = Color.Gray; folderNode.ImageIndex = folderNode.SelectedImageIndex = (int)ImageId.folder; } else { JToken moduleProperties = subFolder["moduleProperties"]; // Not L10N if (moduleProperties == null) { folderNode.ImageIndex = folderNode.SelectedImageIndex = (int)ImageId.labkey; } else { string effectiveValue = (string)moduleProperties[0]["effectiveValue"]; // Not L10N folderNode.ImageIndex = folderNode.SelectedImageIndex = (effectiveValue.Equals("Library") || effectiveValue.Equals("LibraryProtein")) // Not L10N ? (int)ImageId.chrom_lib : (int)ImageId.labkey; } } folderNode.Tag = new FolderInformation(server, canUpload); } }
private void PanoramaSetup() { Uri serverUri = new Uri(SERVER_URL); IPanoramaClient panoramaClient = PanoramaUtil.CreatePanoramaClient(serverUri); var deleteResult = panoramaClient.DeleteFolder($@"{PANORAMA_FOLDER}/{testFolderName}", PANORAMA_USER_NAME, PANORAMA_PASSWORD); if (deleteResult != FolderOperationStatus.OK && deleteResult != FolderOperationStatus.notfound) { Assert.Fail($@"Cannot delete existing test folder. Returns {deleteResult}"); } Assert.AreEqual(FolderOperationStatus.OK, panoramaClient.CreateFolder(PANORAMA_FOLDER, testFolderName, PANORAMA_USER_NAME, PANORAMA_PASSWORD), "Error when creating panorama test folder."); }
public void OkDialog() { MessageBoxHelper helper = new MessageBoxHelper(this); string serverName; if (!helper.ValidateNameTextBox(textServerURL, out serverName)) { return; } Uri uriServer = PanoramaUtil.ServerNameToUri(serverName); if (uriServer == null) { helper.ShowTextBoxError(textServerURL, Resources.EditServerDlg_OkDialog_The_text__0__is_not_a_valid_server_name_, serverName); return; } var panoramaClient = PanoramaClient ?? new WebPanoramaClient(uriServer); using (var waitDlg = new LongWaitDlg { Text = Resources.EditServerDlg_OkDialog_Verifying_server_information }) { try { waitDlg.PerformWork(this, 1000, () => PanoramaUtil.VerifyServerInformation(panoramaClient, Username, Password)); } catch (Exception x) { helper.ShowTextBoxError(textServerURL, x.Message); return; } } Uri updatedUri = panoramaClient.ServerUri ?? uriServer; if (_existing.Contains(server => !ReferenceEquals(_server, server) && Equals(updatedUri, server.URI))) { helper.ShowTextBoxError(textServerURL, Resources.EditServerDlg_OkDialog_The_server__0__already_exists_, uriServer.Host); return; } _server = new Server(updatedUri, Username, Password); DialogResult = DialogResult.OK; }
protected override void DoTest() { RunUI(() => { SkylineWindow.ResetDefaultSettings(); SkylineWindow.NewDocument(); }); ShowAndPositionAuditLog(false); PauseForScreenShot <AuditLogForm>("Empty Audit Log form.", 2); // Configuring Settings for Inserting a New Peptide, p. 3 { var doc = SkylineWindow.Document; var transitionSettingsUI = ShowDialog <TransitionSettingsUI>(SkylineWindow.ShowTransitionSettingsUI); RunUI(() => { // Filter Settings transitionSettingsUI.SelectedTab = TransitionSettingsUI.TABS.Filter; transitionSettingsUI.RangeFrom = Resources.TransitionFilter_FragmentStartFinders_ion_3; transitionSettingsUI.RangeTo = Resources.TransitionFilter_FragmentEndFinders_last_ion_minus_1; }); OkDialog(transitionSettingsUI, transitionSettingsUI.OkDialog); WaitForDocumentChange(doc); } PeptideSettingsUI peptideSettingsUi = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI); RunUI(() => peptideSettingsUi.SelectedTab = PeptideSettingsUI.TABS.Modifications); var modHeavyK = new StaticMod("Label:13C(6)15N(2) (C-term K)", "K", ModTerminus.C, false, null, LabelAtoms.C13 | LabelAtoms.N15, RelativeRT.Matching, null, null, null); AddHeavyMod(modHeavyK, peptideSettingsUi); RunUI(() => peptideSettingsUi.PickedHeavyMods = new[] { modHeavyK.Name }); OkDialog(peptideSettingsUi, peptideSettingsUi.OkDialog); PauseForScreenShot <AuditLogForm>("Audit Log form with settings modifications.", 4); RunUI(() => { SkylineWindow.AuditLogForm.Close(); SkylineWindow.Width = 1010; }); PauseForScreenShot("Undo list expanded. (manual)", 4); RunUI(SkylineWindow.Undo); PauseForScreenShot("Redo list expanded. (manual)", 5); RunUI(SkylineWindow.Redo); // Inserting a peptide sequence p. 5 using (new CheckDocumentState(1, 1, 2, 10)) { WaitForProteinMetadataBackgroundLoaderCompletedUI(); var pasteDlg = ShowDialog <PasteDlg>(SkylineWindow.ShowPastePeptidesDlg); RunUI(() => SetClipboardText("IEAIPQIDK\tGST-tag")); RunUI(pasteDlg.PastePeptides); RunUI(() => { pasteDlg.Size = new Size(700, 210); pasteDlg.Top = SkylineWindow.Bottom + 20; }); PauseForScreenShot <PasteDlg.PeptideListTab>("Insert Peptide List", 6); using (new WaitDocumentChange()) { OkDialog(pasteDlg, pasteDlg.OkDialog); } WaitForConditionUI(() => SkylineWindow.SequenceTree.Nodes.Count > 0); } RunUI(() => { SkylineWindow.ExpandPrecursors(); SkylineWindow.Height = 390; }); PauseForScreenShot("Main window with Targets view", 6); ShowAndPositionAuditLog(true); PauseForScreenShot <AuditLogForm>("Audit Log form with inserted peptide.", 7); ShowLastExtraInfo("Extra info form with inserted peptide info.", 7); string documentPath = GetTestPath("AuditLogTutorial" + SrmDocument.EXT); RunUI(() => SkylineWindow.SaveDocument(documentPath)); WaitForCondition(() => File.Exists(documentPath)); // Importing RAW files into Skyline p. 7 var importResultsDlg = ShowDialog <ImportResultsDlg>(SkylineWindow.ImportResults); RunUI(() => { var rawFiles = DataSourceUtil.GetDataSources(TestFilesDirs[0].FullPath).First().Value; var namedPathSets = from rawFile in rawFiles select new KeyValuePair <string, MsDataFileUri[]>( rawFile.GetFileNameWithoutExtension(), new[] { rawFile }); importResultsDlg.NamedPathSets = namedPathSets.ToArray(); }); OkDialog(importResultsDlg, importResultsDlg.OkDialog); WaitForGraphs(); RunUI(() => { SkylineWindow.SelectedPath = SkylineWindow.Document.GetPathTo((int)SrmDocument.Level.Molecules, 0); Settings.Default.ArrangeGraphsOrder = GroupGraphsOrder.Document.ToString(); Settings.Default.ArrangeGraphsReversed = false; SkylineWindow.ArrangeGraphsTabbed(); SkylineWindow.AutoZoomBestPeak(); }); WaitForCondition(() => Equals(9, SkylineWindow.GraphChromatograms.Count(graphChrom => !graphChrom.IsHidden)), "unexpected visible graphChromatogram count"); WaitForCondition(10 * 60 * 1000, // ten minutes () => SkylineWindow.Document.Settings.HasResults && SkylineWindow.Document.Settings.MeasuredResults.IsLoaded); PauseForScreenShot <AuditLogForm>("Audit Log form with imported data files.", 9); ShowLastExtraInfo("Extra info form for the import.", 9); // Peptide Quantitification Settings p. 9 peptideSettingsUi = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI); RunUI(() => peptideSettingsUi.SelectedTab = (PeptideSettingsUI.TABS) 5); const string quantUnits = "fmol/ul"; RunUI(() => { peptideSettingsUi.QuantRegressionFit = RegressionFit.LINEAR; peptideSettingsUi.QuantNormalizationMethod = new NormalizationMethod.RatioToLabel(IsotopeLabelType.heavy); peptideSettingsUi.QuantUnits = quantUnits; }); OkDialog(peptideSettingsUi, peptideSettingsUi.OkDialog); PauseForScreenShot <AuditLogForm>("Audit Log form with quantification settings.", 10); // Specify analyte concentrations of external standards RunUI(() => { SkylineWindow.AuditLogForm.Close(); SkylineWindow.ShowDocumentGrid(true); }); var documentGridForm = FindOpenForm <DocumentGridForm>(); RunUI(() => { documentGridForm.ChooseView(Resources.SkylineViewContext_GetDocumentGridRowSources_Replicates); }); WaitForConditionUI(() => documentGridForm.IsComplete); var concentrations = new[] { 40, 12.5, 5, 2.5, 1, .5, .25, .1 }; string pasteString = TextUtil.LineSeparate(concentrations.Select((f, i) => QuantificationStrings.SampleType_STANDARD_Standard + "\t" + f)); ClipboardEx.SetText(pasteString); using (new WaitDocumentChange()) { RunUI(() => { var colSampleType = documentGridForm.FindColumn(PropertyPath.Root.Property("SampleType")); documentGridForm.DataGridView.CurrentCell = documentGridForm.DataGridView.Rows[1].Cells[colSampleType.Index]; documentGridForm.DataGridView.SendPaste(); }); } // ReSharper restore AccessToModifiedClosure WaitForConditionUI(() => documentGridForm.IsComplete); RunUI(() => { var gridFloatingWindow = documentGridForm.Parent.Parent; gridFloatingWindow.Size = new Size(370, 315); gridFloatingWindow.Top = SkylineWindow.Bottom + 20; }); PauseForScreenShot <DocumentGridForm>("Document grid with concentrations filled in", 11); RunUI(documentGridForm.Close); ShowAndPositionAuditLog(true); PauseForScreenShot <AuditLogForm>("Audit Log form with grid changes", 12); ShowLastExtraInfo("Extra Info for the analyte data import.", 12); RunUI(SkylineWindow.AuditLogForm.Close); const string unknownReplicate = "FOXN1-GST"; RestoreViewOnScreen(13); ActivateReplicate(unknownReplicate); SelectNode(SrmDocument.Level.TransitionGroups, 1); RunUI(() => SkylineWindow.Size = new Size(936, 527)); WaitForGraphs(); PauseForScreenShot("Heavy precursor chromatogram", 13); RunUI(() => { var pathHeavy = SkylineWindow.DocumentUI.GetPathTo((int)SrmDocument.Level.TransitionGroups, 1); var graphChrom = SkylineWindow.GetGraphChrom(unknownReplicate); Assert.IsNotNull(graphChrom); Assert.AreEqual(unknownReplicate, graphChrom.NameSet); var firstGroupInfo = graphChrom.ChromGroupInfos.FirstOrDefault(); Assert.IsNotNull(firstGroupInfo, "Missing group info"); var firstChromItem = graphChrom.GraphItems.FirstOrDefault(gci => gci.TransitionChromInfo != null); Assert.IsNotNull(firstChromItem, "Missing graph item"); var listChanges = new List <ChangedPeakBoundsEventArgs> { new ChangedPeakBoundsEventArgs(pathHeavy, null, graphChrom.NameSet, firstGroupInfo.FilePath, firstChromItem.GetValidPeakBoundaryTime(20.65), firstChromItem.GetValidPeakBoundaryTime(21.15), PeakIdentification.FALSE, PeakBoundsChangeType.both) }; graphChrom.SimulateChangedPeakBounds(listChanges); }); ShowAndPositionAuditLog(true, 50, 200); WaitForConditionUI(500, () => SkylineWindow.AuditLogForm.DataGridView.Rows.Count > 0); PauseForScreenShot <AuditLogForm>("Audit Log form with changed integration boundary.", 14); int reasonIndex = 2; using (new WaitDocumentChange()) { RunUI(() => { var pathReason = PropertyPath.Root.Property("Reason"); var colReason = SkylineWindow.AuditLogForm.FindColumn(pathReason); reasonIndex = colReason.Index; SetCellValue(SkylineWindow.AuditLogForm.DataGridView, 0, reasonIndex, "Changed peak integration as instructed by the tutorial"); }); } RunUI(() => SkylineWindow.AuditLogForm.DataGridView.AutoResizeColumn(reasonIndex)); SetGridFormToFullWidth(SkylineWindow.AuditLogForm); PauseForScreenShot <AuditLogForm>("Audit Log form with updated reason.", 14); // View the calibration curve p. 15 RunUI(() => SkylineWindow.ShowCalibrationForm()); var calibrationForm = FindOpenForm <CalibrationForm>(); var priorZoomState = ZoomCalibrationCurve(calibrationForm, 0.52); RunUI(() => { Assert.AreEqual(CalibrationCurveFitter.AppendUnits(QuantificationStrings.Analyte_Concentration, quantUnits), calibrationForm.ZedGraphControl.GraphPane.XAxis.Title.Text); Assert.AreEqual(string.Format(QuantificationStrings.CalibrationCurveFitter_PeakAreaRatioText__0___1__Peak_Area_Ratio, IsotopeLabelType.light.Title, IsotopeLabelType.heavy.Title), calibrationForm.ZedGraphControl.GraphPane.YAxis.Title.Text); VerifyCalibrationCurve(calibrationForm, 5.4065E-1, -2.9539E-1, 0.999); }); PauseForScreenShot <CalibrationForm>("Calibration curve zoomed", 15); RunUI(() => { priorZoomState?.ApplyState(calibrationForm.ZedGraphControl.GraphPane); var chromatograms = SkylineWindow.DocumentUI.Settings.MeasuredResults.Chromatograms; new [] { 5, 6, 7, 8 }.ForEach((index) => { int replicateIdx = chromatograms.IndexOf((ch) => ch.Name.Equals("Standard_" + index)); Assert.IsTrue(replicateIdx >= 0); using (var excludeStandardMenu = calibrationForm.MakeExcludeStandardMenuItem(replicateIdx)) { excludeStandardMenu?.PerformClick(); } }); }); WaitForGraphs(); RunUI(() => VerifyCalibrationCurve(calibrationForm, 5.52E-1, -6.3678E-1, 1)); OkDialog(calibrationForm, calibrationForm.Close); PauseForScreenShot <AuditLogForm>("Audit Log with excluded standard records", 16); PauseForScreenShot <AuditLogForm>("Audit Log Reports menu (manual)", 16); // TODO(nicksh): Audit log reason field does not currently support fill down // RunUI(() => // { // SetCellValue(SkylineWindow.AuditLogForm.DataGridView, 0, reasonIndex, "Excluded standard below LOD"); // for (int i = 0; i < 4; i++) // SkylineWindow.AuditLogForm.DataGridView.Rows[i].Cells[reasonIndex].Selected = true; // }); // RunUI(() => SkylineWindow.AuditLogForm.DataboundGridControl.FillDown()); RunUI(() => { for (int i = 0; i < 4; i++) { SetCellValue(SkylineWindow.AuditLogForm.DataGridView, i, reasonIndex, "Excluded standard below LOD"); } }); RunUI(() => { SkylineWindow.AuditLogForm.ChooseView(AuditLogStrings.AuditLogForm_MakeAuditLogForm_Undo_Redo); }); SetGridFormToFullWidth(SkylineWindow.AuditLogForm); RunUI(() => { var floatingWindow = SkylineWindow.AuditLogForm.Parent.Parent; floatingWindow.Height = 334; floatingWindow.Width -= 15; }); PauseForScreenShot <AuditLogForm>("Audit Log with UndoRedo view.", 17); if (IsCoverShotMode) { RunUI(() => { SkylineWindow.ChangeTextSize(TreeViewMS.LRG_TEXT_FACTOR); }); RestoreCoverViewOnScreen(); var calibrationCoverForm = WaitForOpenForm <CalibrationForm>(); ZoomCalibrationCurve(calibrationCoverForm, 0.53); var floatingLogWindow = SkylineWindow.AuditLogForm.Parent.Parent; var floatingCalWindow = calibrationCoverForm.Parent.Parent; RunUI(() => { floatingLogWindow.Top = SkylineWindow.Bottom - floatingLogWindow.Height - 8; floatingLogWindow.Left = (SkylineWindow.Left + SkylineWindow.Right) / 2 - floatingLogWindow.Width / 2; floatingCalWindow.Top = SkylineWindow.Top + 8; floatingCalWindow.Left = SkylineWindow.Right - floatingCalWindow.Width - 8; SkylineWindow.AuditLogForm.DataGridView.AutoResizeColumn(reasonIndex); SkylineWindow.AuditLogForm.DataGridView.AutoResizeColumn(reasonIndex - 1); }); TakeCoverShot(); } var customizeDialog = ShowDialog <ViewEditor>(SkylineWindow.AuditLogForm.NavBar.CustomizeView); RunUI(() => { customizeDialog.ViewName = "Custom Columns"; var columnsToAdd = new[] { PropertyPath.Parse("SkylineVersion"), PropertyPath.Parse("User"), }; foreach (var id in columnsToAdd) { Assert.IsTrue(customizeDialog.ChooseColumnsTab.TrySelect(id), "Unable to select {0}", id); customizeDialog.ChooseColumnsTab.AddSelectedColumn(); } customizeDialog.Height = 370; }); PauseForScreenShot <ViewEditor.ChooseColumnsView>("Custom Columns report template", 17); OkDialog(customizeDialog, customizeDialog.OkDialog); SetGridFormToFullWidth(SkylineWindow.AuditLogForm); RunUI(() => SkylineWindow.AuditLogForm.Parent.Parent.Height += 10); // Extra for 2-line headers PauseForScreenShot <AuditLogForm>("Audit Log with custom view.", 18); var registrationDialog = ShowDialog <MultiButtonMsgDlg>(() => SkylineWindow.ShowPublishDlg(null)); PauseForScreenShot <MultiButtonMsgDlg>("Upload confirmation dialog.", 19); var loginDialog = ShowDialog <EditServerDlg>(registrationDialog.ClickNo); PauseForScreenShot <EditServerDlg>("Login dialog.", 20); RunUI(() => { loginDialog.URL = SERVER_URL; loginDialog.Username = PANORAMA_USER_NAME; }); if (!IsPauseForScreenShots) { OkDialog(loginDialog, loginDialog.CancelButton.PerformClick); } else { PauseTest("Enter password. (manual) No screen shot."); var publishDialog = ShowDialog <PublishDocumentDlg>(loginDialog.OkDialog); WaitForCondition(() => publishDialog.IsLoaded); RunUI(() => { publishDialog.SelectItem(testFolderName); }); PauseForScreenShot <PublishDocumentDlg>("Folder selection dialog.", 21); var browserConfirmationDialog = ShowDialog <MultiButtonMsgDlg>(publishDialog.OkDialog); OkDialog(browserConfirmationDialog, browserConfirmationDialog.ClickYes); PauseForScreenShot("Uploaded document in Panorama (in browser)."); Regex reDocId = new Regex(@"\?id=([0-9]+)"); Assert.IsTrue(reDocId.IsMatch(publishDialog.PanoramaPublishClient.UploadedDocumentUri.ToString())); string docId = reDocId.Match(publishDialog.PanoramaPublishClient.UploadedDocumentUri.ToString()).Groups[1].Captures[0].Value; Uri serverUri = new Uri(SERVER_URL); Uri requestUri = PanoramaUtil.Call(serverUri, "targetedms", String.Format("{0}/{1}", PANORAMA_FOLDER, testFolderName), "showSkylineAuditLog", "id=" + docId); Process.Start(requestUri.ToString()); PauseForScreenShot("Uploaded document audit log in Panorama (in browser)."); } }