コード例 #1
0
        /// <summary>
        /// ノートブック履歴コンテナを削除し、ステータスを変更する。
        /// </summary>
        /// <param name="notebookHistory">対象ノートブック履歴</param>
        /// <param name="status">変更後のステータス</param>
        /// <param name="force">他テナントに対する変更を許可するか</param>
        public async Task ExitAsync(NotebookHistory notebookHistory, ContainerStatus status, bool force)
        {
            // コンテナの生存確認
            if (notebookHistory.GetStatus().Exist())
            {
                var info = await clusterManagementLogic.GetContainerDetailsInfoAsync(notebookHistory.Key, CurrentUserInfo.SelectedTenant.Name, force);

                // コンテナ削除の前に、DBの更新を先に実行
                await notebookHistoryRepository.UpdateStatusAsync(notebookHistory.Id, status, DateTime.Now, force);

                // 実コンテナ削除の結果は確認せず、DBの更新を確定する(コンテナがいないなら、そのまま消しても問題ない想定)
                unitOfWork.Commit();

                if (info.Status.Exist())
                {
                    // 再確認してもまだ存在していたら、コンテナ削除

                    await clusterManagementLogic.DeleteContainerAsync(
                        ContainerType.Notebook, notebookHistory.Key, CurrentUserInfo.SelectedTenant.Name, force);
                }
            }
            else
            {
                await notebookHistoryRepository.UpdateStatusAsync(notebookHistory.Id, status, force);

                // DBの更新を確定する
                unitOfWork.Commit();
            }
        }
コード例 #2
0
 public SimpleOutputModel(NotebookHistory history) : base(history)
 {
     Id        = history.Id;
     DisplayId = history.DisplayId;
     Name      = history.Name;
     Memo      = history.Memo;
     Status    = history.GetStatus().ToString();
     FullName  = $"{Id}:{Name}";
     Favorite  = history.Favorite;
 }
コード例 #3
0
        /// <summary>
        /// ステータスを更新して、出力モデルに変換する
        /// </summary>
        /// <param name="history">ノートブック履歴</param>
        private async Task <IndexOutputModel> GetUpdatedIndexOutputModelAsync(NotebookHistory history)
        {
            var model = new IndexOutputModel(history);

            var status = history.GetStatus();

            if (status.Exist())
            {
                //ノートブックコンテナがまだ進行中の場合、情報を更新する
                var newStatus = await clusterManagementLogic.GetContainerStatusAsync(history.Key, CurrentUserInfo.SelectedTenant.Name, false);

                if (status.Key != newStatus.Key)
                {
                    //更新があったので、変更処理
                    await notebookHistoryRepository.UpdateStatusAsync(history.Id, newStatus, false);

                    unitOfWork.Commit();

                    model.Status = newStatus.Name;
                }
            }
            return(model);
        }