This class is the dialog to manage traffic splitting for a GAE instance.
Inheritance: GoogleCloudExtension.Theming.CommonDialogWindowBase
        /// <summary>
        /// Shows the dialog to the user.
        /// </summary>
        /// <param name="service">The instance on which to managed traffic splitting</param>
        /// <param name="versions">The versions of the service.</param>
        /// <returns>The split traffic changes or null if the user cancelled the dialog.</returns>
        public static SplitTrafficChange PromptUser(Service service, IEnumerable <Version> versions)
        {
            SplitTrafficWindow dialog = new SplitTrafficWindow(service, versions);

            dialog.ShowModal();
            return(dialog.ViewModel.Result);
        }
Esempio n. 2
0
        public SplitTrafficViewModel(SplitTrafficWindow owner, Service service, IEnumerable <Google.Apis.Appengine.v1.Data.Version> versions)
        {
            _owner   = owner;
            _service = service;

            // Set up the radio buttons properly.  Default to "IP" splitting if none is set.
            IsCookieChecked = GaeServiceExtensions.ShardByCookie.Equals(service?.Split?.ShardBy);
            IsIpChecked     = !IsCookieChecked;

            // Set up the current allocations and avaible versions.
            Allocations        = GetAllocations(service);
            _availableVersions = GetAvailableVersions(service, versions);

            SaveCommand                 = new ProtectedCommand(OnSaveCommand);
            DeleteAllocationCommand     = new ProtectedCommand(OnDeleteCommand);
            AddTrafficAllocationCommand = new ProtectedCommand(OnAddTrafficAllocationCommand);

            UpdateCommands();
        }
        public SplitTrafficViewModel(SplitTrafficWindow owner, Service service, IEnumerable<Google.Apis.Appengine.v1.Data.Version> versions)
        {
            _owner = owner;
            _service = service;

            // Set up the radio buttons properly.  Default to "IP" splitting if none is set.
            IsCookieChecked = GaeServiceExtensions.ShardByCookie.Equals(service?.Split?.ShardBy);
            IsIpChecked = !IsCookieChecked;

            // Set up the current allocations and avaible versions.
            Allocations = GetAllocations(service);
            _availableVersions = GetAvailableVersions(service, versions);

            SaveCommand = new ProtectedCommand(OnSaveCommand);
            DeleteAllocationCommand = new ProtectedCommand(OnDeleteCommand);
            AddTrafficAllocationCommand = new ProtectedCommand(OnAddTrafficAllocationCommand);

            UpdateCommands();
        }
 /// <summary>
 /// Shows the dialog to the user.
 /// </summary>
 /// <param name="instance">The instance on which to managed traffic splitting</param>
 /// <returns>The split traffic changes or null if the user cancelled the dialog.</returns>
 public static SplitTrafficChange PromptUser(Service service, IEnumerable<Version> versions)
 {
     SplitTrafficWindow dialog = new SplitTrafficWindow(service, versions);
     dialog.ShowModal();
     return dialog.ViewModel.Result;
 }