protected override void PageLoadedCore(PageLoadedDirection direction)
        {
            if (direction == PageLoadedDirection.Back)
            {
                RefreshRechecks();
                return;
            }
            var selectedMasters = new List <Host>(SelectedMasters);

            ManualUpgrade = ManualModeSelected;
            RemoveEventHandlersToMasters();
            SelectedServers.Clear();
            foreach (Host selectedMaster in selectedMasters)
            {
                Host master = selectedMaster;
                if (master != null)
                {
                    Pool pool = Helpers.GetPoolOfOne(master.Connection);
                    if (pool != null)
                    {
                        SelectedServers.AddRange(pool.HostsToUpgrade());
                    }
                    else
                    {
                        SelectedServers.Add(master);
                    }
                }
            }
            AddEventHandlersToMasters();
            labelPrechecksFirstLine.Text = Messages.ROLLINGUPGRADE_PRECHECKS;
            RefreshRechecks();
        }
Esempio n. 2
0
        protected override void PageLeaveCore(PageLoadedDirection direction, ref bool cancel)
        {
            SelectedServers.Clear();
            SelectedServers.AddRange(GetSelectedServers());

            if (direction == PageLoadedDirection.Forward)
            {
                if (!AllSelectedHostsConnected())
                {
                    foreach (PatchingHostsDataGridViewRow row in dataGridViewHosts.Rows)
                    {
                        row.UpdateIcon();
                    }
                    dataGridViewHosts.Invalidate();
                    cancel = true;
                    return;
                }

                //Upload the patches to the masters if it is necessary
                List <Host> masters = SelectedMasters;

                //Do RBAC check
                foreach (Host master in masters)
                {
                    if (!(Role.CanPerform(new RbacMethodList("pool_patch.apply"), master.Connection)))
                    {
                        string nameLabel = master.Name();
                        Pool   pool      = Helpers.GetPoolOfOne(master.Connection);
                        if (pool != null)
                        {
                            nameLabel = pool.Name();
                        }

                        using (var dlg = new WarningDialog(string.Format(Messages.RBAC_UPDATES_WIZARD, master.Connection.Username, nameLabel))
                        {
                            WindowTitle = Messages.UPDATES_WIZARD
                        })
                        {
                            dlg.ShowDialog(this);
                        }

                        cancel = true;
                        return;
                    }
                }
            }
        }